Skip to Content
0
Dec 25, 2018 at 05:20 PM

Update Sales Order pricing with G from Purchase Order

194 Views

Hi All,

I am trying to update the sales order pricing with G from purchase order and then the relevant changes should be saved to the VBAP table.

I have used the methods POST and CLOSE of BAdI "ME_PROCESS_PO_CUST" trying to update the pricing with G but I couldn't trigger the pricing with G. Please see the below coding.

I have set a break point in USEREXIT_NEW_PRICING_VBKD to check if sales order change is getting triggered. with the below coding sales order is getting triggered but pricing is not updated. So I have set the new_pricing variable in the USEREXIT_NEW_PRICING_VBKD to 'G'. Now pricing is updated but data is not saved to the VBAP data base table.

Is it safe to call the function BAPI_TRANSACTION_COMMIT after the below coding? and will it update the data in VBAP table.

All your suggestions are highly appreciated and thanks a lot in advance.

ls_header_inx-updateflag = 'U'.
ls_logic_switch-pricing = 'G'.

ls_item_inx-updateflag = 'U'.
ls_item_inx-itm_number = lv_posnr.
APPEND ls_item_inx TO lt_item_inx.
CLEAR: ls_item_inx.

"Call the SAP FM to update the sales order
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument    = lv_vbeln
*   ORDER_HEADER_IN  =
    order_header_inx = ls_header_inx
*   SIMULATION       =
*   BEHAVE_WHEN_ERROR     = ' '
*   INT_NUMBER_ASSIGNMENT = ' '
*   LOGIC_SWITCH     =
*   NO_STATUS_BUF_INIT    = ' '
  TABLES
    return           = lt_return
*   ORDER_ITEM_IN    =
    order_item_inx   = lt_item_inx.