Reporting long text
A simple way to locate the long text object you need.
Don't be intimidated by long text! I often have requirements to report long text (such as sales order notes or...
Continue Reading This Article
Enjoy this article as well as all of our content, including E-Guides, news, tips and more.
delivery notes). A simple way to locate the long text object you need is as follows:
1) In a test or production client, modify one line of the long text you want to report. For instance, VA02 can be used to update sales order text at the header or item level.
2) Use SE16 to browse table STXH. Enter the userid of the person who modified the long text (in field TDLUSER) and today's date (in field TDLDATE). The query should display just one record - the one that was just changed.
3) Use the keys from table STXH to call function module READ_TEXT. The keys are TDOBJECT, TDNAME, TDID, and TDSPRAS. Three of the four keys are constants, with TDNAME being the variable that contains the key of the sales order, delivery number, etc. READ_TEXT fills an internal table with the long text of the object desired. Loop at this table to unload as may lines of text as required.
Good luck!
DATA: BEGIN OF ws_tline OCCURS 10. INCLUDE STRUCTURE tline. DATA: END OF ws_tline. CONSTANTS WS_TDID_EXT_NOTE LIKE THEAD-TDID VALUE 'ZDLE'. CONSTANTS WS_TDSPRAS LIKE THEAD-TDSPRAS VALUE 'E'. DATA WS_SO_AND_LINE LIKE THEAD-TDNAME. CONSTANTS WS_TDOBJECT LIKE THEAD-TDOBJECT VALUE 'VBBP'. * Build ws_so_and_line - don't use concatenate, it removes leading zeros ws_so_and_line+0(10) = vbap-vbeln. ws_so_and_line+10(6) = vbap-posnr. CALL FUNCTION 'READ_TEXT' EXPORTING id = ws_tdid_ext_note language = ws_tdspras name = ws_so_and_line object = ws_tdobject TABLES lines = ws_tline 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 ws_tline. * ws_tline-tdline contains text line ... ... ENDLOOP. ENDIF.