SAP gets the long text of the purchase order header
SAP gets the long text of the purchase order header
Long text is not directly stored in a table, you can double-click the text in (me23n), and then select the menu goto- > header to view the technical information of the text, and then enter the relevant technical information through function module 'read_text', to get the text.
DATA: BEGIN OF T_LINES OCCURS 50.
INCLUDE STRUCTURE TLINE.
DATA: END OF T_LINES.
DATA: BEGIN OF HTEXT.
INCLUDE STRUCTURE THEAD.
DATA: END OF HTEXT.
DATA: TNAME LIKE THEAD-TDNAME.
DATA: S_LINE (100) TYPE C.
TNAME = open_po-ebeln. "pay the purchase order number to the variable
S_LINE =''.
CLEAR T_LINES.
REFRESH T_LINES.
*-purchase header long text
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F01'
LANGUAGE ='1'
NAME = TNAME
OBJECT = 'EKKO'
ARCHIVE_HANDLE = 0
IMPORTING
HEADER = HTEXT
TABLES
LINES = T_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 T_LINES.
IF T_LINES-TDLINE NE.
CONCATENATE S_LINE T_LINES-TDLINE INTO S_LINE.
ENDIF.
ENDLOOP.
Open_po-LTEXT = S_LINE.
ENDIF.
Https://mp.weixin.qq.com/s/mX_V6VoZEUt09RGseGyCfA