How to read text with READ_TEXT FM

Most of text in SAP are stored in STXH and STXL tables.
We can read text by read_text fm. If you can not find input parameters of the fm , you can use STXH tables.

Example  :

Read text purchase requisition header note

11jan16 T-code : ME52N (Change Purchase Req.)

 

Find READ_TEXT import parameters :

CLIENT  = SY-MANDT
ID  = ?
LANGUAGE = sy-langu
NAME  = ?
OBJECT  = ?

Now go to SE16N and look for the table STXH , give your key parameter( banfn – purchasing req. number) into TDNAME field.

11jan16_2

ID  = ‘B01’
NAME  = ‘5000000112’
OBJECT  = ‘EBANH’

Now we have all import parameter to call read_text.( If you don’t want to call the read_text , use the table STXL for getting text lines.)

CODES :

BREAK xasag.
DATA : lv_name type THEAD-TDNAME,
gt_lines type table of tline,
gs_line type tline.

lv_name = '50000000112'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = 'B01'
language = sy-langu
NAME = lv_name
OBJECT = 'EBANH'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
* OLD_LINE_COUNTER =
TABLES
lines = gt_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.
* Implement suitable error handling here
ENDIF.

loop at gs_lines into gs_line.
*gs_line-tdline.

endloop.

11jan16_3
You can see header note rows in the debug mode.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s