*perform frm_get_txt USING 'F01' '6900000140' 'EKKO' s.
*id name object 可到STXH表查看
* -->i_id
* -->i_name
* -->i_object
* -->i_outtxt
*注意语言
*----------------------------------------------------------------------*
FORM frm_get_txt USING i_id i_name i_object
CHANGING i_outtxt.
DATA: lt_lines TYPE STANDARD TABLE OF tline.
DATA: lw_lines TYPE tline.
DATA: lv_client TYPE sy-mandt,
lv_langu TYPE sy-langu,
lv_date TYPE sy-datum,
lv_sptxt(256) TYPE c,
lv_sptxt_copy_one(256) TYPE c,
lv_sptxt_copy_two(256) TYPE c.
lv_client = sy-mandt.
lv_langu = sy-langu.
lv_date = sy-datum.
* DATA: cn_grun TYPE thead-tdid VALUE 'GRUN',
* cn_material TYPE thead-tdobject VALUE 'MATERIAL'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = lv_client
id = i_id "cn_grun
language = lv_langu
name = i_name "i_matnr
object = i_object "cn_material
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 sy-subrc = 0.
LOOP AT lt_lines INTO lw_lines.
IF sy-tabix = 1.
lv_sptxt = lw_lines-tdline.
ELSE.
CLEAR lv_sptxt_copy_two.
lv_sptxt_copy_two = lv_sptxt.
CLEAR lv_sptxt_copy_one.
lv_sptxt_copy_one = lw_lines-tdline.
CLEAR lv_sptxt.
CONCATENATE lv_sptxt_copy_one lv_sptxt_copy_two INTO lv_sptxt.
ENDIF.
ENDLOOP.
ENDIF.
CLEAR lv_sptxt_copy_one.
CLEAR lv_sptxt_copy_two.
CLEAR lw_lines.
i_outtxt = lv_sptxt.
CLEAR lv_sptxt.
ENDFORM.