2009 Aug 18 11:38 PM
Hello,
I need to be able to add, update or delete texts from a sales order line item. I created a sample program (below) to test out if I could do this with BAPI_SALESORDER_CHANGE. I get back a message that the order was saved but the texts are not created. If anyone has any suggestions I would appreciate it.
REPORT ZTEXTTEST.
data: wa_vbeln like vbak-vbeln.
data: it_BAPISDH1X type BAPISDH1X.
data: it_ordertext like BAPISDTEXT occurs 0 with header line.
data: it_BAPIRET2 type BAPIRET2 occurs 0 with header line.
wa_vbeln = '0000001081'.
it_BAPISDH1X-UPDATEFLAG = 'U'.
it_ordertext-doc_number = wa_vbeln.
it_ordertext-itm_number = '000100'.
it_ordertext-text_id = '0001'.
it_ordertext-langu = 'EN'.
it_ordertext-langu_iso = 'EN'.
it_ordertext-format_col = '* '.
it_ordertext-text_line = 'This is a test for text type 0001'.
it_ordertext-function = '009'.
append it_ordertext.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = wa_vbeln
ORDER_HEADER_IN =
ORDER_HEADER_INX = it_BAPISDH1X
TABLES
RETURN = it_BAPIRET2
ORDER_ITEM_IN =
ORDER_ITEM_INX =
ORDER_TEXT = it_ordertext.
loop at it_bapiret2.
write:/ it_bapiret2-message.
endloop.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
.
Thanks,
Bert
2009 Aug 19 8:31 AM
Hi!
Try with CREATE_TEXT, with DELETE_TEXT can you delete it.
DATA: lt_textlines TYPE TABLE OF tline.
DATA: ls_textline TYPE tline.
ls_textline-tdformat = '* '.
ls_textline-tdline = 'This is a test for text type 0001'.
APPEND ls_textline TO lt_textlines.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = '0001'
flanguage = 'E'
fname = '0000001081000010'
fobject = 'VBBP' " VBBP Item VBBK Header
save_direct = 'X'
FFORMAT = '*'
TABLES
flines = lt_textlines
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3
.
br
Kalman
Hello,
I need to be able to add, update or delete texts from a sales order line item. I created a sample program (below) to test out if I could do this with BAPI_SALESORDER_CHANGE. I get back a message that the order was saved but the texts are not created. If anyone has any suggestions I would appreciate it.
REPORT ZTEXTTEST.
data: wa_vbeln like vbak-vbeln.
data: it_BAPISDH1X type BAPISDH1X.
data: it_ordertext like BAPISDTEXT occurs 0 with header line.
data: it_BAPIRET2 type BAPIRET2 occurs 0 with header line.
wa_vbeln = '0000001081'.
it_BAPISDH1X-UPDATEFLAG = 'U'.
it_ordertext-doc_number = wa_vbeln.
it_ordertext-itm_number = '000100'.
it_ordertext-text_id = '0001'.
it_ordertext-langu = 'EN'.
it_ordertext-langu_iso = 'EN'.
it_ordertext-format_col = '* '.
it_ordertext-text_line = 'This is a test for text type 0001'.
it_ordertext-function = '009'.
append it_ordertext.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = wa_vbeln
ORDER_HEADER_IN =
ORDER_HEADER_INX = it_BAPISDH1X
TABLES
RETURN = it_BAPIRET2
ORDER_ITEM_IN =
ORDER_ITEM_INX =
ORDER_TEXT = it_ordertext.
loop at it_bapiret2.
write:/ it_bapiret2-message.
endloop.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN =
.
Thanks,
Bert
2009 Aug 19 12:59 AM
Hi Bert,
Your coding seems ok .The only thing you should verify is this lines of code:
it_ordertext-itm_number = '000100'.
Check if you sales order has item 100 or item 10. If you trying to update item 10 then the value needs to be
'000010'.
The other thingg,which should not influence your outcome but just to note is langu is a one char field ,so you only need to pass 'E' and not 'EN'. Ofcourse in the assignment below SAP will truncate it anyways.
it_ordertext-langu = 'EN'.
it_ordertext-langu_iso = 'EN'.
Regards,
Neil.
2009 Aug 19 8:31 AM
Hi!
Try with CREATE_TEXT, with DELETE_TEXT can you delete it.
DATA: lt_textlines TYPE TABLE OF tline.
DATA: ls_textline TYPE tline.
ls_textline-tdformat = '* '.
ls_textline-tdline = 'This is a test for text type 0001'.
APPEND ls_textline TO lt_textlines.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
fid = '0001'
flanguage = 'E'
fname = '0000001081000010'
fobject = 'VBBP' " VBBP Item VBBK Header
save_direct = 'X'
FFORMAT = '*'
TABLES
flines = lt_textlines
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3
.
br
Kalman
2009 Aug 19 8:47 AM
2009 Aug 19 9:04 AM
2009 Aug 19 10:16 AM
Hi,
Use FM Create_text and then use FM Save_text.
Let me know if u face any difficulty.
Regards,
Pranil Shinde.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |