cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_SALESORDER_CHANGE updating unrequested data

wesleynz
Explorer
0 Kudos

I'm using BAPI_SALESORDER_CHANGE to block / reject sales order. It is working fine but I've noticed at the log (VA03) it is modifying many price related things. It is not actually changing values but is registering as they were modified:

My code is as follows:

w_bapisdh1x-updateflag = c_u.
t_item-itm_number = <f_itmnum>.
t_item-reason_rej = c_zh.
APPEND t_item.

t_itemx-itm_number = <f_itmnum>.
t_itemx-updateflag = c_u.
t_itemx-reason_rej = abap_true.
APPEND t_itemx.


SET UPDATE TASK LOCAL.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = <f_documento>
order_header_inx = w_bapisdh1x
TABLES
return = t_return
order_item_in = t_item
order_item_inx = t_itemx.

Since I'm only rejecting a sales order I thing there's no need at all to update so many data. Is that right?

aoyang
Contributor

Tried to reproduce the issue but when I ran the same logic, rejection reason(VBAP-ABGRU) and Doc status(VBAK-GBSTK) are the only thing that are displayed in the change log in VA03. Below is my code.

Is there custom exits that are getting triggered when sales order is changed? If so, you can suspect them.

DATA:LT_RETURN           TYPE STANDARD TABLE OF BAPIRET2,<br>     LW_ORDER_HEADER_INX TYPE BAPISDH1X,<br>     LT_ORDER_ITEM_IN    TYPE STANDARD TABLE OF BAPISDITM,<br>     LT_ORDER_ITEM_INX   TYPE STANDARD TABLE OF BAPISDITMX<br>     .<br><br>LW_ORDER_HEADER_INX-UPDATEFLAG = 'U'.<br><br>APPEND INITIAL LINE TO LT_ORDER_ITEM_IN ASSIGNING FIELD-SYMBOL(<LW_ORDER_ITEM_IN>).<br><LW_ORDER_ITEM_IN>-ITM_NUMBER = '000010'.<br><LW_ORDER_ITEM_IN>-REASON_REJ = '01'.<br>APPEND INITIAL LINE TO LT_ORDER_ITEM_INX ASSIGNING FIELD-SYMBOL(<LW_ORDER_ITEM_INX>).<br><LW_ORDER_ITEM_INX>-ITM_NUMBER = '000010'.<br><LW_ORDER_ITEM_INX>-UPDATEFLAG = 'U'.<br><LW_ORDER_ITEM_INX>-REASON_REJ = 'X'.<br><br><br>CALL FUNCTION 'BAPI_SALESORDER_CHANGE'<br>  EXPORTING<br>    SALESDOCUMENT    = '0000099999'<br>    ORDER_HEADER_INX = LW_ORDER_HEADER_INX<br>  TABLES<br>    RETURN           = LT_RETURN<br>    ORDER_ITEM_IN    = LT_ORDER_ITEM_IN<br>    ORDER_ITEM_INX   = LT_ORDER_ITEM_INX.<br><br><br>IF SY-SUBRC <> 0.<br>  ROLLBACK WORK.<br>ELSE.<br>  COMMIT WORK AND WAIT.<br>ENDIF.<br>
wesleynz
Explorer
0 Kudos

aocheng, makes a lot of sense. I'm going to check this out.

Thank you for replying.

Lakshmipathi
Active Contributor
0 Kudos

When you create a discussion and start adding additional information as asked by the members, please add the same under Comments and not under Answer as you were not answering but sharing additional information. Also, when you add under comments, a mail will be triggered to who you respond. By the way, I have converted your above Answer to Comment

Accepted Solutions (0)

Answers (0)