2013 Sep 26 6:23 PM
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.
2013 Sep 30 3:39 AM
Hi
If you need to update a sales order long text, why not use the sales order BAPI - BAPI_SALESORDER_CHANGE? Using the BAPI will ensure that any other sales order logic (such as the incompletion check) will be executed in addition to your data changes.
Regards
Glen
2013 Sep 26 7:13 PM
would you uncomment save_direct parameter while calling create_text. also, try save_text after create_text. i know this irrelevant as create_text too save the text internally but just to double save.
Rgds
2013 Sep 26 8:19 PM
Many thanks for your input Sudhanshu I uncomment save_direct parameter while calling create_text and also tried to use save_text but still nothing changes and I still get Incompletion log error.
2013 Sep 26 8:29 PM
Hi.
Check the name of the i_tdname in the second part when you create the text, because you are using another ID, the first ID is ZINH with the name v_tdname and the second ID is ZCRH with the name i_tdname.
What I think is that the name could have something different.
You can create the sales orden directly using text ID ZCRH and check how it is save on the table, maybe there are some values that you need to pass to the FM create text.
Regards
Miguel
2013 Sep 26 9:25 PM
I imagine that Miguel's hint will get you there, but just one other possibility. Some of the documents that allow long texts also provide a long text flag. If you don't set the flag, then no long text can be seen on the document even though you successfully save the long text. Probably won't be relevant here, but maybe you'll need it some where else.
Neal
2013 Sep 30 2:45 AM
Thanks for your input Miguel. Yes I use two different ID's (first ID is ZINH with the name v_tdname and the second ID is ZCRH with same name) because if I use ZINH to CREATE_TEXT then It doesn't work at all. With ZCRH I can at least save text but get Incompletion log error.
2013 Sep 27 6:44 AM
Can you check with SAVE_TEXT FM in place of Create_Text FM .
also check Header Information Field Value are Correct .
Regard's
Smruti
2013 Sep 30 2:39 AM
Thanks for you input Smruti I even tried with SAVE_TEXT instead of CREATE_TEXT but still nothing changes. Same Incompletion log error. Here is my SAVE_TEXT code.
constants:
lc_idc type thead-tdid value 'ZCRH',
lc_obj type thead-tdobject value 'VBBK'.
if sy-subrc eq 0.
sv_header-mandt = sy-mandt.
sv_header-tdobject = lc_obj.
sv_header-tdname = i_tdname. (6010001540)
sv_header-tdid = lc_idc.
sv_header-tdspras = sy-langu.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = sv_header
savemode_direct = 'X'
owner_specified = 'X'
tables
lines = it_ftext
exceptions
id = 1
language = 2
name = 3
object = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
2013 Sep 30 5:36 AM
Hi,
Check with below Code .
sv_header-mandt = sy-mandt.
sv_header-tdobject = lc_obj.
sv_header-tdname = i_tdname. (6010001540)
sv_header-tdid = lc_idc.
sv_header-tdspras = sy-langu.
MOVE '*' TO it_ftext-TDFORMAT.
MOVE 'TEST LONG TEXT' TO it_ftext-TDLINE.
APPEND it_ftext.
CLEAR it_ftext.
call function 'SAVE_TEXT'
exporting
client = sy-mandt
header = sv_header
INSERT = ' '
savemode_direct = 'X'
tables
lines = it_ftext
exceptions
id = 1
language = 2
name = 3
object = 4
others = 5.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Regard's
Smruti
2013 Sep 30 3:46 PM
Thank you Smruti for your suggestion but I"m already passing values in table it_ftext as you showed.
2013 Sep 30 3:39 AM
Hi
If you need to update a sales order long text, why not use the sales order BAPI - BAPI_SALESORDER_CHANGE? Using the BAPI will ensure that any other sales order logic (such as the incompletion check) will be executed in addition to your data changes.
Regards
Glen
2013 Sep 30 3:48 PM
Thanks for your input Glen. I've not used BAPI_SALESORDER_CHANGE and not sure how I can pass header text values. Can you provide any example, please?
2013 Sep 30 6:07 PM
You might look at :
CL_IM_SRM_SALES_ITEMS_TEXT - IF_EX_DIP_SALES_ITEMS_TEXT~FILL_TEXT_TABLE
They seem to be doing a similar coding for SRM to get long text. That should be what the use of bapisdtext is about.
Neal
2013 Oct 01 7:21 AM
Check this Note Create/change texts via BAPIs,Note : 426980
How to Create/Change Header and Item Level Long Text Using BAPI for Sales Order , Check above note .
If you still finding text incompleteness using BAPI create/change Header and Item Text then check below Note .
BAPI SD: Document creation - texts and incompleteness :Notes - 390465
Regard's
Smruti