【转自http://lz357502668.blog.163.com/blog/static/1649674320109119101907/】
这里,定义ITAB内表来存储长文本,并放到内表ITAB_EKKO_EKPO中,
这里,定义ITAB内表来存储长文本,并放到内表ITAB_EKKO_EKPO中,
注意,这里是读抬头的长文本信息,没有加项目号,
DATA: ITAB LIKE TLINE OCCURS 0 WITH HEADER LINE. "长文本
LOOP AT ITAB_EKKO_EKPO.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F01'
LANGUAGE = SY-LANGU
NAME = ITAB_EKKO_EKPO-EBELN
OBJECT = 'EKKO'
TABLES
LINES = ITAB
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT ITAB.
* MESSAGE ITAB-TDLINE TYPE 'I' .
IF SY-SUBRC = 0.
ITAB_EKKO_EKPO-TDLINE = ITAB-TDLINE.
ELSE.
CLEAR : ITAB.
ENDIF.
ENDLOOP.
MODIFY ITAB_EKKO_EKPO.
ENDLOOP.
详细见ZMMF0001_TL。
读项目的长文本信息,要加项目号。
LOOP AT ITAB.
CONCATENATE ITAB-VBELN ITAB-POSNR INTO TEMP_NAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'Z001'
LANGUAGE = SY-LANGU
NAME = TEMP_NAME
OBJECT = 'VBBP'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
* IMPORTING
* HEADER =
TABLES
LINES = TEXT_ITAB
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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT TEXT_ITAB.
SKIP .
WRITE : / TEXT_ITAB-TDLINE.
ENDLOOP.
REFRESH TEXT_ITAB.
ENDLOOP.