Hi,
I am having problems when using the BAPI_SALESORDER_CHANGE function module trying to update the profit_ctr of the sales order.
After the FM call i get the success message V1 311 but the profit center is not changed.
I am calling the FM 'BAPI_TRANSACTION_COMMIT' after i have called BAPI_SALESORDER_CHANGE.
Can anyone assist with what could be wrong?
Here is my code below:
* fill bapi data
i_bapisdh1x-updateflag = 'U'.
t_bapisditm-itm_number = w_sopos.
t_bapisditm-profit_ctr = f_prctr.
APPEND t_bapisditm.
t_bapisditmx-itm_number = w_sopos.
t_bapisditmx-profit_ctr = 'X'.
t_bapisditmx-updateflag = 'U'.
APPEND t_bapisditmx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = w_so
order_header_inx = i_bapisdh1x
TABLES
return = t_bapiret2
order_item_in = t_bapisditm
order_item_inx = t_bapisditmx.
* Check for a success message
READ TABLE t_bapiret2 WITH KEY
type = 'S'
id = 'V1'
number = '311'.
IF sy-subrc = 0.
CONCATENATE 'SO:' w_so ' updated successfully'
INTO f_message.
f_error = ' '.
ELSE.
CONCATENATE 'SO:' w_so ' NOT updated'
INTO f_message.
f_error = 'X'.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Thanks.
Regards,
Barbara