1.查看文本表头信息
事务码VF02, Goto->Item->Item Texts
双击空白文本
Goto -> Header
然后我们就可以得到文本的表头信息
已有文本读文本
IF is_xvbrp-vbeln IS INITIAL.
lv_source_tdname = 'XXXXXXXXXX'.
ELSE.
lv_source_tdname = is_xvbrp-vbeln && is_xvbrp-posnr.
ENDIF.
* CALL FUNCTION 'READ_TEXT'
* EXPORTING
* id = mc_source_tdid "Y831
* language = is_language "ES
* name = lv_source_tdname "9026049901001000
* object = mc_source_tdobject "VBBP
* IMPORTING
* header = es_thead
* TABLES
* lines = ct_tlinetab
* EXCEPTIONS
* id = 1
* language = 2
* name = 3
* not_found = 4
* object = 5
* reference_check = 6
* wrong_access_to_archive = 7
* OTHERS = 8.
loop at ct_tlinetab in to ls_tlinetab.
''''''''''''''''''''''''''''''''''''''''
endloop.
"保存文本
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = es_thead
IMPORTING
newheader = ls_thead
TABLES
lines = ct_tlinetab
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
创建填充文本
*full the header
es_thead-tdid = mc_tdid.
es_thead-tdform = 'SYSTEM'.
es_thead-tdlinesize = 72.
es_thead-mandt = sy-mandt.
es_thead-tdobject = mc_tdobject.
es_thead-tdname = lv_source_tdname.
es_thead-tdspras = is_language.
'''''''''''''''''''''''''''''''''''''''
ls_tlinetab = '''''''''''''''''''''.
append ls_tlinetab to ct_tlinetab.
"保存文本
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = es_thead
IMPORTING
newheader = ls_thead
TABLES
lines = ct_tlinetab
EXCEPTIONS
id = 1
language = 2
name = 3
object = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.