Difference between revisions of "SAP ABAP TEXT"
From SapWiki
| (18 intermediate revisions by the same user not shown) | |||
| Line 190: | Line 190: | ||
==[[SAP_ABAP_SAPSCRIPT#crear/editar_objetos_de_textos_y_ID|Crear/editar objetos de textos y ID]]== | ==[[SAP_ABAP_SAPSCRIPT#crear/editar_objetos_de_textos_y_ID|Crear/editar objetos de textos y ID]]== | ||
| + | |||
| + | ==[[SAP_HCM_OM#Leer_Descripción_de_Objeto_RH_OBJECT_DESCRIPTION_READ_2|Leer descripción de objeto OM]]== | ||
==FM. READ_TEXT== | ==FM. READ_TEXT== | ||
| Line 225: | Line 227: | ||
ENDFORM.</nowiki> | ENDFORM.</nowiki> | ||
| + | |||
| + | ===Tablas STXH & STXL=== | ||
| + | |||
| + | ejemplo con clase CL_RSTX_TABLE_VIEW=> READ_STXH_INTERNAL & IMPORT_STXL | ||
| + | <nowiki> | ||
| + | data: l_stxh type stxh. | ||
| + | |||
| + | * Read normal table | ||
| + | select single (l_select_fields) from stxh client specified "#EC DBACCESS_OK | ||
| + | into corresponding fields of l_stxh | ||
| + | where mandt = i_mandt | ||
| + | and tdobject = i_tdobject | ||
| + | and tdname = i_tdname | ||
| + | and tdid = i_tdid | ||
| + | and tdspras = i_tdspras. | ||
| + | ************************************************* | ||
| + | l_subrc = cl_rstx_table_view=>import_stxl( | ||
| + | exporting i_mandt = rt_client | ||
| + | i_tdobject = stxl_id-tdobject | ||
| + | i_tdname = stxl_id-tdname | ||
| + | i_tdid = stxl_id-tdid | ||
| + | i_tdspras = stxl_id-tdspras | ||
| + | i_storage_location = storage_location "N | ||
| + | importing e_text_lines = rt_lines[] ). | ||
| + | *********************************************************************** | ||
| + | data E_TEXT_LINES type T_TLINE_TABLE. | ||
| + | data: | ||
| + | begin of l_stxl_id, | ||
| + | tdobject type stxl-tdobject, | ||
| + | tdname type stxl-tdname, | ||
| + | tdid type stxl-tdid, | ||
| + | tdspras type stxl-tdspras, | ||
| + | end of l_stxl_id. | ||
| + | |||
| + | * Read normal table | ||
| + | import tline to e_text_lines | ||
| + | from database stxl(tx) "#EC DBACCESS_OK | ||
| + | client i_mandt | ||
| + | id l_stxl_id | ||
| + | accepting truncation "important for Unicode->Nonunicode | ||
| + | ignoring conversion errors.</nowiki> | ||
| + | |||
| + | ejemplo ID | ||
| + | TDOBJECT TEXT | ||
| + | TDNAME 1111111111 | ||
| + | TDID ST | ||
| + | TDSPRAS P | ||
| + | |||
| + | ==Convertir string a tabla == | ||
| + | <nowiki> | ||
| + | DATA: lt_lines TYPE STANDARD TABLE OF tline. | ||
| + | DATA lv_text_plain TYPE string. | ||
| + | |||
| + | lv_text_plain = |Starro hizo su debut original en la década de 1960 en The Brave and the Bold # 28, el número que también presentó| && | ||
| + | | a los lectores de cómics a la Liga de la Justicia de América. Mientras que el DCEU y los cómics contemporáneos de| && | ||
| + | | DC representan a Darkseid como la amenaza omnipresente que reúne a los héroes más poderosos de la Tierra por primera vez,| && | ||
| + | | en el pasado, una estrella de mar psíquica gigante era el único llamado a la acción de Wonder Woman, Aquaman, Flash,| && | ||
| + | | Green Lantern y Martian Manhunter (Batman y Superman no podían ser molestados).|. | ||
| + | |||
| + | CALL FUNCTION 'VB_CP_CONVERT_STRING_2_ITF' | ||
| + | EXPORTING | ||
| + | i_string = lv_text_plain | ||
| + | TABLES | ||
| + | et_table = lt_lines. | ||
| + | </nowiki> | ||
| + | |||
| + | * FM ISH_N2_SPLIT_TEXTSTRING | ||
| + | ==convertir tabla texto a HTML== | ||
| + | reporte RSTXHTML FM CONVERT_ITF_TO_HTML | ||
| + | |||
| + | ===clase CL_BFW_WEBRESOURCE_POC method CONVERT_ASCII_TO_HTML=== | ||
| + | <nowiki> | ||
| + | METHOD CONVERT_ASCII_TO_HTML . | ||
| + | * importing source | ||
| + | * returning result | ||
| + | |||
| + | DATA: l_char_tab TYPE STANDARD TABLE OF char255 INITIAL SIZE 10, | ||
| + | l_itf_tab TYPE STANDARD TABLE OF tline INITIAL SIZE 10, | ||
| + | lv_hex TYPE xstring, | ||
| + | lo_conv TYPE REF TO cl_abap_conv_in_ce, | ||
| + | l_header TYPE thead, | ||
| + | lt_bin_tab TYPE sdokcntbins, | ||
| + | lv_len TYPE i. | ||
| + | |||
| + | FIELD-SYMBOLS: <l_itf_wa> TYPE tline. | ||
| + | |||
| + | CALL METHOD cl_bfw_webresource_poc=>convert_string_into_table | ||
| + | EXPORTING | ||
| + | string = source | ||
| + | IMPORTING | ||
| + | table = l_char_tab. | ||
| + | |||
| + | * Convert ASCII to ITF | ||
| + | CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT' | ||
| + | TABLES | ||
| + | text_stream = l_char_tab "ascii | ||
| + | itf_text = l_itf_tab. | ||
| + | |||
| + | * Replace CRs with line breaks to avoid <P> tags in HTML text | ||
| + | LOOP AT l_itf_tab ASSIGNING <l_itf_wa> WHERE tdformat = '*'. | ||
| + | <l_itf_wa>-tdformat = '/'. | ||
| + | ENDLOOP. | ||
| + | |||
| + | * Convert ITF to HTML... | ||
| + | l_header-tdobject = 'INST_POC'. | ||
| + | l_header-tdid = '0001'. | ||
| + | l_header-tdname = '%1'. | ||
| + | l_header-tdspras = sy-langu. | ||
| + | CLEAR l_char_tab[]. | ||
| + | |||
| + | CALL FUNCTION 'CONVERT_ITF_TO_HTML' | ||
| + | EXPORTING | ||
| + | i_header = l_header | ||
| + | i_replace = space | ||
| + | i_html_header = space | ||
| + | IMPORTING | ||
| + | e_html_text = lv_hex | ||
| + | TABLES | ||
| + | t_itf_text = l_itf_tab | ||
| + | t_html_text = l_char_tab | ||
| + | EXCEPTIONS | ||
| + | illegal_header = 1 | ||
| + | OTHERS = 2. | ||
| + | |||
| + | IF sy-subrc <> 0. | ||
| + | * Error. Should never occur | ||
| + | CLEAR result. | ||
| + | EXIT. | ||
| + | ENDIF. | ||
| + | |||
| + | * Converting hex to string | ||
| + | CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' | ||
| + | EXPORTING | ||
| + | buffer = lv_hex | ||
| + | IMPORTING | ||
| + | output_length = lv_len | ||
| + | TABLES | ||
| + | binary_tab = lt_bin_tab. | ||
| + | |||
| + | CALL FUNCTION 'SCMS_BINARY_TO_STRING' | ||
| + | EXPORTING | ||
| + | input_length = lv_len | ||
| + | IMPORTING | ||
| + | text_buffer = result | ||
| + | TABLES | ||
| + | binary_tab = lt_bin_tab. | ||
| + | |||
| + | ENDMETHOD.</nowiki> | ||
| + | |||
| + | ===Ejemplo 2 === | ||
| + | <nowiki> | ||
| + | DATA ls_header TYPE thead. | ||
| + | |||
| + | CALL FUNCTION 'READ_TEXT' | ||
| + | EXPORTING | ||
| + | id = 'ST' | ||
| + | language = sy-langu | ||
| + | name = iv_name | ||
| + | object = 'TEXT' | ||
| + | IMPORTING | ||
| + | header = ls_header | ||
| + | TABLES | ||
| + | lines = lt_lines | ||
| + | EXCEPTIONS | ||
| + | id = 1 | ||
| + | language = 2 | ||
| + | name = 3 | ||
| + | not_found = 4 | ||
| + | object = 5 | ||
| + | reference_check = 6 | ||
| + | wrong_access_to_archive = 7 | ||
| + | OTHERS = 8. | ||
| + | |||
| + | gv_email_remitente = iv_sender. | ||
| + | gv_dias = iv_dias. | ||
| + | gv_mes = lv_mes. | ||
| + | gv_anio = iv_anio. | ||
| + | |||
| + | DESCRIBE TABLE lt_lines LINES sy-tabix. | ||
| + | |||
| + | CALL FUNCTION 'TEXT_SYMBOL_REPLACE' | ||
| + | EXPORTING | ||
| + | endline = sy-tabix | ||
| + | header = ls_header | ||
| + | program = 'SAPLZHR_FG_MIFUNCTIONGROUP' | ||
| + | TABLES | ||
| + | lines = lt_lines. | ||
| + | *--------------------------------------------------------------------* | ||
| + | DATA lt_html_txt TYPE htmltable. | ||
| + | PERFORM convert_text_to_html USING lt_lines | ||
| + | ls_header | ||
| + | CHANGING lt_html_txt. | ||
| + | LOOP AT lt_html_txt TRANSPORTING NO FIELDS WHERE tdline CS '<BODY>'. | ||
| + | DATA(lv_tabix) = sy-tabix. | ||
| + | EXIT. | ||
| + | ENDLOOP. | ||
| + | |||
| + | lv_tabix = lv_tabix + 1. | ||
| + | *--------------------------------------------------------------------* | ||
| + | |||
| + | *----------------------------------------------------------------------* | ||
| + | * FORM ....... | ||
| + | *----------------------------------------------------------------------* | ||
| + | * copiado de reporte RSTXHTML | ||
| + | *----------------------------------------------------------------------* | ||
| + | * --> p1 text | ||
| + | * <-- p2 text | ||
| + | *----------------------------------------------------------------------* | ||
| + | FORM convert_text_to_html USING it_lines TYPE tlinet | ||
| + | is_header TYPE thead | ||
| + | CHANGING et_html TYPE htmltable. | ||
| + | DATA: ls_header TYPE thead, | ||
| + | lt_lines TYPE TABLE OF tline. " like tline occurs 100 with header line. | ||
| + | ls_header = is_header. | ||
| + | lt_lines[] = it_lines[]. | ||
| + | |||
| + | REFRESH html_text. | ||
| + | |||
| + | CALL FUNCTION 'CONVERT_ITF_TO_HTML' | ||
| + | EXPORTING | ||
| + | i_header = ls_header | ||
| + | i_syntax_check = space | ||
| + | i_replace = 'X' | ||
| + | i_print_commands = space | ||
| + | i_html_header = 'X' | ||
| + | * i_funcname = 'SAPSCRIPT_WWW_MAKE_LINK' | ||
| + | * i_title = 'Dies ist mein <eigener> Titel' | ||
| + | * i_background = '\images\background.gif' | ||
| + | * i_unescape_formats = unescape_formats | ||
| + | * i_encoding = 'UTF-8' | ||
| + | TABLES | ||
| + | t_itf_text = lt_lines | ||
| + | t_html_text = html_text | ||
| + | t_conv_charformats = conv_charformats | ||
| + | t_conv_parformats = conv_parformats | ||
| + | EXCEPTIONS | ||
| + | syntax_check = 1 | ||
| + | OTHERS = 2. | ||
| + | |||
| + | et_html[] = html_text[]. | ||
| + | |||
| + | ENDFORM. | ||
| + | </nowiki> | ||
| + | |||
| + | ==FM TEXT_SYMBOL_REPLACE== | ||
| + | <nowiki> | ||
| + | CALL FUNCTION 'READ_TEXT' | ||
| + | EXPORTING | ||
| + | id = 'ST' | ||
| + | language = sy-langu | ||
| + | name = iv_name | ||
| + | object = 'TEXT' | ||
| + | IMPORTING | ||
| + | header = ls_header | ||
| + | TABLES | ||
| + | lines = lt_lines | ||
| + | EXCEPTIONS | ||
| + | id = 1 | ||
| + | language = 2 | ||
| + | name = 3 | ||
| + | not_found = 4 | ||
| + | object = 5 | ||
| + | reference_check = 6 | ||
| + | wrong_access_to_archive = 7 | ||
| + | OTHERS = 8. | ||
| + | |||
| + | * variables a reemplazar en texto | ||
| + | gv_nombre = lv_nombre. | ||
| + | gv_nombre_jefe = lv_nombre_jefe. | ||
| + | gv_mes = lv_mes. | ||
| + | gv_anio = iv_anio. | ||
| + | gv_email_remitente = iv_sender. | ||
| + | |||
| + | DESCRIBE TABLE lt_lines LINES sy-tabix. | ||
| + | |||
| + | CALL FUNCTION 'TEXT_SYMBOL_REPLACE' | ||
| + | EXPORTING | ||
| + | endline = sy-tabix | ||
| + | header = ls_header | ||
| + | program = 'SAPLZMI_GRUPO_FUNCION' | ||
| + | TABLES | ||
| + | lines = lt_lines. | ||
| + | </nowiki> | ||
| + | ==Ejecutar editor de textos== | ||
| + | <nowiki> | ||
| + | * Call Text editor | ||
| + | PERFORM EDIT_TEXT(SAPMSSCE) USING 'TEXT' | ||
| + | 'ST' | ||
| + | TEXTNAME | ||
| + | SY-LANGU | ||
| + | DISPLAY.</nowiki> | ||
| + | ==Traducción== | ||
| + | ===Reporte RSLANG20=== | ||
| + | En ciertos casos, despues de un transporte de traducciones, en el sistema destino la traduccion no se ve reflejada. Vale la pena ejecutar el reporte | ||
| + | RSLANG20 en el sistema destino. | ||
Latest revision as of 21:25, 24 June 2026
Contents
Cuadro de texto en dynpro ( Clase cl_gui_textedit )
REPORT ytest_texto.
*--------------------------------------------------------------------*
* Datos para cuadro de texto
*--------------------------------------------------------------------*
*Variables extras Control Custom
DATA: container TYPE REF TO cl_gui_custom_container,
editor TYPE REF TO cl_gui_textedit.
DATA: line TYPE tdline,
text_tab type STANDARD TABLE OF TDLINE.
**********************************************************************
DATA ok_code TYPE sy-ucomm.
START-OF-SELECTION.
line = 'Hola Mundo'.
append line to text_tab.
CALL SCREEN 0100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS'. "Crear con 'BACK' 'EXIT' 'CANC' de tipo comando exit y 'SAVE'
SET TITLEBAR 'T01'. "Editar Texto
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit INPUT.
DATA l_ok_code TYPE sy-ucomm.
l_ok_code = ok_code.
CLEAR ok_code.
CASE l_ok_code.
WHEN 'BACK' OR 'EXIT' OR 'CANC'.
* free editor de texto
CLEAR: text_tab[].
IF editor IS BOUND.
FREE editor.
CALL METHOD container->free
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
FREE container.
ENDIF.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " EXIT INPUT
*&---------------------------------------------------------------------*
*& Module TEXTO OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE texto OUTPUT.
IF editor IS NOT BOUND.
* create control container
CREATE OBJECT: container EXPORTING container_name = 'CC_01', "crear custom container CC_01 en dynpro 0100
editor EXPORTING parent = container.
* show toolbar and statusbar on this screen
CALL METHOD editor->set_toolbar_mode
EXPORTING
toolbar_mode = editor->true. "true(saca la barra de herramienta).
CALL METHOD editor->set_statusbar_mode
EXPORTING
statusbar_mode = editor->false. "true(saca la barra de status).
* if f_mode = c_display.
* call method editor->set_readonly_mode
* exporting
* readonly_mode = editor->true.
*
* endif.
* CALL METHOD editor->set_visible
* EXPORTING
* visible = ' '.
* CALL METHOD editor->set_enable_editing_protected
* EXPORTING
* MODE = 0.
ENDIF.
CALL METHOD editor->set_text_as_stream
EXPORTING
text = text_tab.
ENDMODULE. " TEXTO OUTPUT
MODULE refresh_txt INPUT.
CALL METHOD editor->get_text_as_stream
IMPORTING
text = text_tab.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module EXIT_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE exit_0100 INPUT.
l_ok_code = ok_code.
CLEAR ok_code.
CASE l_ok_code.
WHEN 'SAVE'.
BREAK-POINT.
PERFORM save.
ENDCASE.
ENDMODULE. " EXIT_0100 INPUT
FORM save.
*text data
DATA: lt_tlinetab type STANDARD TABLE OF tline,
lt_text type STANDARD TABLE OF TDLINE,
ls_theader type thead,
ls_tlinetab type tline,
l_key TYPE tdobname.
IF editor IS NOT INITIAL.
* cuadro texto
CALL METHOD editor->get_text_as_r3table
IMPORTING
table = lt_text[]
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4.
CLEAR lt_tlinetab[].
LOOP AT lt_text into data(ls_text).
MOVE ls_text TO ls_tlinetab-tdline.
APPEND ls_tlinetab to lt_tlinetab.
ENDLOOP.
ENDIF.
ls_theader-tdid = 'Z001'.
ls_theader-tdspras = sy-langu.
ls_theader-tdname = l_key.
ls_theader-tdobject = 'ZMYOBJ'.
* CALL FUNCTION 'SAVE_TEXT'
* EXPORTING
* header = ls_theader
* insert = 'X'
* savemode_direct = 'X'
* IMPORTING
** FUNCTION = SD_FUNCTION
* newheader = ls_theader
* TABLES
* lines = lt_tlinetab
* EXCEPTIONS
* id = 01
* language = 02
* name = 03
* object = 04.
* IF sy-subrc <> 0.
** MESSAGE A017.
* ENDIF.
ENDFORM.
dynpro 0100
PROCESS BEFORE OUTPUT. MODULE status_0100. MODULE texto. * PROCESS AFTER INPUT. MODULE exit AT EXIT-COMMAND. MODULE refresh_txt. MODULE exit_0100.
Como leer textos de infotipo
Crear/editar objetos de textos y ID
Leer descripción de objeto OM
FM. READ_TEXT
FORM read_text.
DATA: lt_tlinetab TYPE STANDARD TABLE OF tline,
ls_theader TYPE thead,
l_id TYPE thead-tdid,
l_name TYPE thead-tdname,
l_object TYPE thead-tdobject.
l_id = 'Z000'. "obs esp
l_object = 'VBBK'.
l_name = es_dlv_delnote-hd_gen-deliv_numb.
REFRESH lt_tlinetab.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = l_id
language = sy-langu
name = l_name
object = l_object
IMPORTING
header = ls_theader
TABLES
lines = lt_tlinetab
EXCEPTIONS
id = 01
language = 02
name = 03
not_found = 04
object = 05
reference_check = 06
wrong_access_to_archive = 07.
ENDFORM.
Tablas STXH & STXL
ejemplo con clase CL_RSTX_TABLE_VIEW=> READ_STXH_INTERNAL & IMPORT_STXL
data: l_stxh type stxh.
* Read normal table
select single (l_select_fields) from stxh client specified "#EC DBACCESS_OK
into corresponding fields of l_stxh
where mandt = i_mandt
and tdobject = i_tdobject
and tdname = i_tdname
and tdid = i_tdid
and tdspras = i_tdspras.
*************************************************
l_subrc = cl_rstx_table_view=>import_stxl(
exporting i_mandt = rt_client
i_tdobject = stxl_id-tdobject
i_tdname = stxl_id-tdname
i_tdid = stxl_id-tdid
i_tdspras = stxl_id-tdspras
i_storage_location = storage_location "N
importing e_text_lines = rt_lines[] ).
***********************************************************************
data E_TEXT_LINES type T_TLINE_TABLE.
data:
begin of l_stxl_id,
tdobject type stxl-tdobject,
tdname type stxl-tdname,
tdid type stxl-tdid,
tdspras type stxl-tdspras,
end of l_stxl_id.
* Read normal table
import tline to e_text_lines
from database stxl(tx) "#EC DBACCESS_OK
client i_mandt
id l_stxl_id
accepting truncation "important for Unicode->Nonunicode
ignoring conversion errors.
ejemplo ID
TDOBJECT TEXT TDNAME 1111111111 TDID ST TDSPRAS P
Convertir string a tabla
DATA: lt_lines TYPE STANDARD TABLE OF tline.
DATA lv_text_plain TYPE string.
lv_text_plain = |Starro hizo su debut original en la década de 1960 en The Brave and the Bold # 28, el número que también presentó| &&
| a los lectores de cómics a la Liga de la Justicia de América. Mientras que el DCEU y los cómics contemporáneos de| &&
| DC representan a Darkseid como la amenaza omnipresente que reúne a los héroes más poderosos de la Tierra por primera vez,| &&
| en el pasado, una estrella de mar psíquica gigante era el único llamado a la acción de Wonder Woman, Aquaman, Flash,| &&
| Green Lantern y Martian Manhunter (Batman y Superman no podían ser molestados).|.
CALL FUNCTION 'VB_CP_CONVERT_STRING_2_ITF'
EXPORTING
i_string = lv_text_plain
TABLES
et_table = lt_lines.
- FM ISH_N2_SPLIT_TEXTSTRING
convertir tabla texto a HTML
reporte RSTXHTML FM CONVERT_ITF_TO_HTML
clase CL_BFW_WEBRESOURCE_POC method CONVERT_ASCII_TO_HTML
METHOD CONVERT_ASCII_TO_HTML .
* importing source
* returning result
DATA: l_char_tab TYPE STANDARD TABLE OF char255 INITIAL SIZE 10,
l_itf_tab TYPE STANDARD TABLE OF tline INITIAL SIZE 10,
lv_hex TYPE xstring,
lo_conv TYPE REF TO cl_abap_conv_in_ce,
l_header TYPE thead,
lt_bin_tab TYPE sdokcntbins,
lv_len TYPE i.
FIELD-SYMBOLS: <l_itf_wa> TYPE tline.
CALL METHOD cl_bfw_webresource_poc=>convert_string_into_table
EXPORTING
string = source
IMPORTING
table = l_char_tab.
* Convert ASCII to ITF
CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
TABLES
text_stream = l_char_tab "ascii
itf_text = l_itf_tab.
* Replace CRs with line breaks to avoid <P> tags in HTML text
LOOP AT l_itf_tab ASSIGNING <l_itf_wa> WHERE tdformat = '*'.
<l_itf_wa>-tdformat = '/'.
ENDLOOP.
* Convert ITF to HTML...
l_header-tdobject = 'INST_POC'.
l_header-tdid = '0001'.
l_header-tdname = '%1'.
l_header-tdspras = sy-langu.
CLEAR l_char_tab[].
CALL FUNCTION 'CONVERT_ITF_TO_HTML'
EXPORTING
i_header = l_header
i_replace = space
i_html_header = space
IMPORTING
e_html_text = lv_hex
TABLES
t_itf_text = l_itf_tab
t_html_text = l_char_tab
EXCEPTIONS
illegal_header = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Error. Should never occur
CLEAR result.
EXIT.
ENDIF.
* Converting hex to string
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_hex
IMPORTING
output_length = lv_len
TABLES
binary_tab = lt_bin_tab.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = lv_len
IMPORTING
text_buffer = result
TABLES
binary_tab = lt_bin_tab.
ENDMETHOD.
Ejemplo 2
DATA ls_header TYPE thead.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = sy-langu
name = iv_name
object = 'TEXT'
IMPORTING
header = ls_header
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
gv_email_remitente = iv_sender.
gv_dias = iv_dias.
gv_mes = lv_mes.
gv_anio = iv_anio.
DESCRIBE TABLE lt_lines LINES sy-tabix.
CALL FUNCTION 'TEXT_SYMBOL_REPLACE'
EXPORTING
endline = sy-tabix
header = ls_header
program = 'SAPLZHR_FG_MIFUNCTIONGROUP'
TABLES
lines = lt_lines.
*--------------------------------------------------------------------*
DATA lt_html_txt TYPE htmltable.
PERFORM convert_text_to_html USING lt_lines
ls_header
CHANGING lt_html_txt.
LOOP AT lt_html_txt TRANSPORTING NO FIELDS WHERE tdline CS '<BODY>'.
DATA(lv_tabix) = sy-tabix.
EXIT.
ENDLOOP.
lv_tabix = lv_tabix + 1.
*--------------------------------------------------------------------*
*----------------------------------------------------------------------*
* FORM .......
*----------------------------------------------------------------------*
* copiado de reporte RSTXHTML
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM convert_text_to_html USING it_lines TYPE tlinet
is_header TYPE thead
CHANGING et_html TYPE htmltable.
DATA: ls_header TYPE thead,
lt_lines TYPE TABLE OF tline. " like tline occurs 100 with header line.
ls_header = is_header.
lt_lines[] = it_lines[].
REFRESH html_text.
CALL FUNCTION 'CONVERT_ITF_TO_HTML'
EXPORTING
i_header = ls_header
i_syntax_check = space
i_replace = 'X'
i_print_commands = space
i_html_header = 'X'
* i_funcname = 'SAPSCRIPT_WWW_MAKE_LINK'
* i_title = 'Dies ist mein <eigener> Titel'
* i_background = '\images\background.gif'
* i_unescape_formats = unescape_formats
* i_encoding = 'UTF-8'
TABLES
t_itf_text = lt_lines
t_html_text = html_text
t_conv_charformats = conv_charformats
t_conv_parformats = conv_parformats
EXCEPTIONS
syntax_check = 1
OTHERS = 2.
et_html[] = html_text[].
ENDFORM.
FM TEXT_SYMBOL_REPLACE
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = sy-langu
name = iv_name
object = 'TEXT'
IMPORTING
header = ls_header
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
* variables a reemplazar en texto
gv_nombre = lv_nombre.
gv_nombre_jefe = lv_nombre_jefe.
gv_mes = lv_mes.
gv_anio = iv_anio.
gv_email_remitente = iv_sender.
DESCRIBE TABLE lt_lines LINES sy-tabix.
CALL FUNCTION 'TEXT_SYMBOL_REPLACE'
EXPORTING
endline = sy-tabix
header = ls_header
program = 'SAPLZMI_GRUPO_FUNCION'
TABLES
lines = lt_lines.
Ejecutar editor de textos
* Call Text editor
PERFORM EDIT_TEXT(SAPMSSCE) USING 'TEXT'
'ST'
TEXTNAME
SY-LANGU
DISPLAY.
Traducción
Reporte RSLANG20
En ciertos casos, despues de un transporte de traducciones, en el sistema destino la traduccion no se ve reflejada. Vale la pena ejecutar el reporte RSLANG20 en el sistema destino.