2015 Feb 18 1:20 PM
Hi Experts,
I have to change Sales orders Material sales text. I tried with BAPI_SALESORDER_CHANGE by passing data to ORDER_TEXT. Buts its not updating.
I passed the data in the following way.
ls_order_item_in-itm_number = ls_salesorder-posnr.
APPEND ls_order_item_in TO lt_order_item_in.
ls_order_item_inx-itm_number = ls_salesorder-posnr.
ls_order_item_inx-updateflag = 'U'.
APPEND ls_order_item_inx TO lt_order_item_inx.
ls_order_text-doc_number = ls_salesorder-vbeln.
ls_order_text-itm_number = ls_salesorder-posnr.
ls_order_text-text_id = 001.
ls_order_text-langu = E.
ls_order_text-text_line = ls_salesorder-smtext.
ls_order_text-function = 005.
APPEND ls_order_text TO lt_order_text.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = lv_vbeln
order_header_inx = ls_order_header_inx
TABLES
return = lt_return
order_item_in = lt_order_item_in
order_item_inx = lt_order_item_inx
schedule_lines = lt_schedule_lines
schedule_linesx = lt_schedule_linesx
order_text = lt_order_text.
Am I missing something? or is there any other way to achieve this?
Thanks in Advance.
Regards,
S Sivaganesh.
2015 Feb 19 3:37 AM
Hello
Use following FM to change the Text
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
Sample Code:
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
EXPORTING
salesdocument = pi_order_header-salesdocument
order_header_in = wa_bapisdhd1
order_header_inx = wa_bapisdhd1x
convert_parvw_auart = convert_parvw_auart
TABLES
return = it_return
item_in = it_items_in
item_inx = it_items_inx
schedule_in = it_schedule_lines
schedule_inx = it_schedule_linesx
sales_text = it_text
conditions_in = it_conditions_in
conditions_inx = it_conditions_inx.
* Process of commit work or rollback
READ TABLE it_return WITH KEY type = flag_error
TRANSPORTING NO FIELDS.
IF NOT ( sy-subrc IS INITIAL ).
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.Regards
Sandy
2015 Feb 19 2:52 AM
Hello Sivag.
Please read the BAPI's documentation first whenever you face some issues.
You need to call BAPI_TRANSACTION_COMMIT after BAPI_SALESORDER_CHANGE.
Regards.
2015 Feb 19 3:37 AM
Hello
Use following FM to change the Text
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
Sample Code:
CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'
EXPORTING
salesdocument = pi_order_header-salesdocument
order_header_in = wa_bapisdhd1
order_header_inx = wa_bapisdhd1x
convert_parvw_auart = convert_parvw_auart
TABLES
return = it_return
item_in = it_items_in
item_inx = it_items_inx
schedule_in = it_schedule_lines
schedule_inx = it_schedule_linesx
sales_text = it_text
conditions_in = it_conditions_in
conditions_inx = it_conditions_inx.
* Process of commit work or rollback
READ TABLE it_return WITH KEY type = flag_error
TRANSPORTING NO FIELDS.
IF NOT ( sy-subrc IS INITIAL ).
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.Regards
Sandy
2015 Mar 12 10:59 AM
Hello
Is this issue resolved ?
Close the thread with correct and helpful answers
Regards
Sandy