Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BAPI_SALESORDER_CHANGE - Updating pricing after change to shipping cond.


I am using BAPI_SALESORDER_CHANGE to update the shipping conditions of sales orders (ex: from "standard" to "next day air"). That part is working fine; the conditions are updated correctly and all is well there. The problem, at least with my code, is that the freight charge pricing condition is not re-determined.

Can I do that with that BAPI, or do I need to call a subsequent function to re-determine the pricing? I'm very fast with points and I will gladly reward any useful answers!



MOVE: in_po_number TO wf_order_change_header-purch_no_c,
              in_req_deliv_date TO wf_order_change_header-req_date_h,
              in_shipping_code TO wf_order_change_header-ship_cond.
        wf_order_headerx-updateflag = in_update_flag.    "U
        wf_order_headerx-req_date_h = wc_update_flag.
        wf_order_headerx-purch_no_c = wc_update_flag.
        wf_order_headerx-ship_cond = wc_update_flag.    "X

        LOOP AT in_tab_order_items.

          IF in_tab_order_items-update_flag CO 'DUI'.
* Create the line item number and add the article number
            CLEAR wa_order_items.
            wa_order_items-itm_number = in_tab_order_items-item_number.
            wa_order_items-material = in_tab_order_items-sap_article.
            APPEND wa_order_items TO int_order_items.

* Set up the table to allow the line item to be updated.  This tells the
* BAPI what fields to update, rather than update them all.
            CLEAR wa_order_itemsx.
            wa_order_itemsx-updateflag = in_tab_order_items-update_flag.
            wa_order_itemsx-itm_number = in_tab_order_items-item_number.
            wa_order_itemsx-material = wc_update_flag.
            APPEND wa_order_itemsx TO int_order_itemsx.

* Set up the schedule line for the quantity and date.
            CLEAR wa_order_sched.
            wa_order_sched-itm_number = in_tab_order_items-item_number.
            wa_order_sched-sched_line = wc_sched_line.
            wa_order_sched-req_date = in_tab_order_items-req_delv_date.
            IF wa_order_sched-req_date IS INITIAL.
              wa_order_sched-req_date = sy-datum.
            wa_order_sched-req_qty = in_tab_order_items-req_qty.
            APPEND wa_order_sched TO int_order_sched.

* Set up the table to allow the schedule line to be updated.
            CLEAR wa_order_schedx.
            wa_order_schedx-itm_number = in_tab_order_items-item_number.
            wa_order_schedx-sched_line = wc_sched_line.
            wa_order_schedx-updateflag = in_tab_order_items-update_flag.
            wa_order_schedx-req_date = wc_update_flag.
            wa_order_schedx-req_qty = wc_update_flag.
            APPEND wa_order_schedx TO int_order_schedx.

* Call the BAPI to change the sales order.
                  salesdocument    = in_order_number
                  order_header_in  = wf_order_change_header
                  order_header_inx = wf_order_headerx
                  return           = out_tab_return
                  order_item_in    = int_order_items
                  order_item_inx   = int_order_itemsx
                  schedule_lines   = int_order_sched
                  schedule_linesx  = int_order_schedx
                  order_text       = int_order_text.

                    wait = 'X'.

Not what you were looking for? View more on this topic or Ask a question