The method below enables to convert standard texts to string (with carriage returns). It can be useful when standard texts need to be changed or completed before being printed on Adobe forms.
(Otherwise, it is recommanded to use the standard text objet for Adobe forms).
**************************************************
* STATIC METHOD READ_TEXT_TO_STRING
**************************************************
METHOD read_text_to_string.
* +-------------+-----------+------------+-------------------------------------+
* | Name | Category | TYPE | Designation |
* +-------------+-----------+------------+-------------------------------------+
* | IV_TDOBJECT | Importing | TDOBJECT | Textes : objet d'application |
* | IV_TDNAME | Importing | TDOBNAME | Nom |
* | IV_TDID | Importing | TDID | ID de texte |
* | IV_TDSPRAS | Importing | TDSPRAS | Code langue |
* | RV_TEXT | Returning | ZBC_STRING | ... or any data element type STRING |
* +-------------+-----------+------------+-------------------------------------+
DATA : lt_lines TYPE TABLE OF tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
id = iv_tdid
language = iv_tdspras
name = iv_tdname
object = iv_tdobject
* id = 'ST'
* language = 'F'
* name = 'ZTEST_FJO_TEXT'
* object = 'TEXT'
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.
IF sy-subrc = 0.
LOOP AT lt_lines ASSIGNING FIELD-SYMBOL(<fs_line>).
AT FIRST.
rv_text = <fs_line>-tdline.
CONTINUE.
ENDAT.
IF <fs_line>-tdformat IS INITIAL OR <fs_line>-tdformat = '='.
rv_text = | { rv_text } { <fs_line>-tdline }|.
ELSE.
rv_text = | { rv_text }\n{ <fs_line>-tdline }|.
ENDIF.
ENDLOOP.
CONDENSE rv_text.
ENDIF.
ENDMETHOD.
Search tags : SO10
About the author