Hello Experts,
I've a requirement where I need to read header text from a document 'A' and copy into document 'B'. I've been able to read text from document 'A' using FM READ_TEXT table and able to create text in document 'B' using CREATE_TEXT. However, when I look at Incompletion log then I see error (refer to the attached scree shot).
Can anybody suggest what change I should make in my following code to make it working? I've a feeling that maybe I'm not using correct ID in FM to create text on sales order.
------------- READ HEADER TEXT FROM DOC A --------------------
constants: lc_id type thead-tdid value 'ZINH',
lc_idc type thead-tdid value 'ZCRH',
lc_obj type thead-tdobject value 'VBBK'.
clear: v_tdname.
v_tdname = lw_zrerate_dtl-vbeln.
call function 'READ_TEXT'
exporting
client = sy-mandt
id = lc_id
language = sy-langu
name = v_tdname
object = lc_obj
importing
header = header
tables
lines = l_text_table
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.
"r_flag = 'C'.
elseif sy-subrc eq 0.
if l_text_table[] is not initial.
"r_flag = 'E'.
loop at l_text_table into lw_tdline.
lw_o_tdline = lw_tdline-tdline.
append lw_o_tdline to o_tdline.
endloop.
endif.
endif.
-----------------------------------------------------------------------------------------
----------- CREATE HEADER TEXT IN DOC B IF TEXT FOUND IN DOC A ------------------
if lw_zrerate_dtl-zvbeln_pr is not initial and o_tdline[] is not initial.
clear: wa_tdline.
loop at o_tdline into wa_tdline.
wa_ftext-tdformat = '*'.
wa_ftext-tdline = wa_tdline.
append wa_ftext to it_ftext.
endloop.
clear: i_tdname.
i_tdname = lw_zrerate_dtl-zvbeln_pr.
call function 'CREATE_TEXT'
exporting
fid = lc_idc
flanguage = sy-langu
fname = i_tdname
fobject = lc_obj
* SAVE_DIRECT = 'X'
* FFORMAT = '*'
tables
flines = it_ftext
exceptions
no_init = 1
no_save = 2
others = 3.
endif.
--------------------------------------------------------------------------------------------------------------------------
Many thanks in advance.