Why Can't I Find This Text in SE16N? Mastering the READ_TEXT Function Module
How to Use READ_TEXT Function Module in SAP ABAP
Have you ever tried to find a Sales Note, Purchase Order Header Text, or Purchase Requisition Header Text in standard tables like VBAK, EKKO, or EBAN, only to find that the field is missing? You are not alone! SAP stores "Long Texts" in a compressed format that cannot be viewed directly via SE16 or SE16N.
To retrieve these texts, we must use a specific tool in our ABAP arsenal: the READ_TEXT Function Module.
Step 1: Find for the Parameters
To use READ_TEXT, you need four specific "keys" to unlock the data. Here is how to find them:
Go to your transaction (e.g., ME53N for Purchase Req).
A popup will appear showing the following values:
Text ID: (e.g., B01)
Language: (e.g., EN)
Text Name: (Usually the document number, e.g., xxxxxxxxxx)
Text Object: (e.g., EBANH for Sales Header)
Step 2: The ABAP Implementation
Once you have the parameters, you can call the function module in your program. Here is a clean way to do it:
REPORT ytest00001.
DATA: lt_lines TYPE STANDARD TABLE OF tline,
lw_objek TYPE cuobn,
lv_id TYPE thead-tdid,
lv_language TYPE thead-tdspras,
lv_name TYPE thead-tdname.
CONSTANTS: lv_obj TYPE thead-tdobject VALUE 'EBANH'.
REFRESH lt_lines.
lv_name = '1214000007'. "Insert your Doc Number in here
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'B01'
language = sy-langu
name = lv_name
object = lv_obj
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 lt_lines[] IS NOT INITIAL.
LOOP AT lt_lines INTO DATA(ls_lines).
WRITE:/ ls_lines-tdline.
ENDLOOP.
ENDIF.
Conclusion
READ_TEXT is the standard way to handle long texts in SAP, whether you are building a custom report, or a Smartform. Mastering this FM will save you hours of searching for data that simply isn't in the standard tables!
Comments
Post a Comment