12-03-2007 4:52 PM
Hello!
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!
Thanks!
John
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.
ENDIF.
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.
ENDIF.
ENDLOOP.
* Call the BAPI to change the sales order.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = in_order_number
order_header_in = wf_order_change_header
order_header_inx = wf_order_headerx
TABLES
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.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
12-03-2007 6:16 PM
Check OSS 593246
If you are using v => 4.7 try using the LOGIC_SWITCH parameter and pass COND_HANDL = X
12-03-2007 6:16 PM
Hi Daniel;
We are in 4.6C, but part of your fix did help. I did start passing LOGIC_SWITCH to update the pricing value of 'B', but I also had to pass in the conditions_inx table, populated as follows:
DATA: wf_knumv TYPE knumv.
SELECT SINGLE knumv
FROM vbak
INTO wf_knumv
WHERE vbeln = in_order_number.
IF sy-subrc EQ 0.
SELECT SINGLE kposn stunr zaehk
INTO (wf_conditionsx-itm_number, wf_conditionsx-cond_st_no,
wf_conditionsx-cond_count)
FROM konv
WHERE knumv = wf_knumv
AND kposn = in_tab_order_items-item_number.
IF sy-subrc EQ 0.
MOVE: 'ZFF1' TO wf_conditionsx-cond_type,
'X' TO wf_conditionsx-updateflag.
APPEND wf_conditionsx TO int_conditions_inx.
ENDIF.
ENDIF.
Thanks!
John