‎2010 Oct 15 9:53 AM
Hi Experts,
I have been trying to change a sales order using the BAPI_SALESORDER_CHANGE, but it gives the message: ORDER_HEADER_IN has been processed successfully
VBAKKOM
No data was changed.
What could be wrong. See my code below. The BAPI had an extension, which also needs to update.
data: socond type standard table of bapicond with header line.
data socondx type standard table of bapicondx with header line.
data: header_inx type standard table of BAPISDH1X with header line.
data: return2 type bapiret2 occurs 0 with header line.
data: l_logic_switch type bapisdls occurs 0 with header line.
parameters: amt type vbak-netwr,
ord type vbak-vbeln.
clear header_inx.
header_inx-updateflag = 'U'.
append header_inx.
clear l_logic_switch.
l_logic_switch-pricing = 'G'.
l_logic_switch-cond_handl = 'X'.
append l_logic_switch.
clear socondx.
socondx-cond_type = 'ZC07'.
socondx-updateflag = 'I'.
socondx-cond_value = 'X'.
socondx-currency = 'X'.
append socondx.
clear socond.
socond-cond_value = AMT.
socond-cond_type = 'ZC07'.
socond-currency = 'ZAR'.
append socond.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = ord
IMPORTING
OUTPUT = ord.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = ORD
* ORDER_HEADER_IN =
ORDER_HEADER_INX = header_inx
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH = l_logic_switch
* NO_STATUS_BUF_INIT = ' '
TABLES
RETURN = return2
* ORDER_ITEM_IN =
* ORDER_ITEM_INX =
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* SCHEDULE_LINES =
* SCHEDULE_LINESX =
* ORDER_TEXT =
* ORDER_KEYS =
CONDITIONS_IN = socond
CONDITIONS_INX = socondx
EXTENSIONIN =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
loop at return2.
write:/ return2-message, return2-message_v1.
endloop.
‎2010 Oct 15 10:40 AM
Hi,
If you have not passed to the extension, how the extension will get updated.
You have to pass to the table extension. Hope you have updated the new fields INTO BAPE_VBAK & VBAKKOZ etc.
Try giving l_logic_switch-cond_handl = ' ' and check if updates.
If it doesn't, I don't have an immediate solution except asking you to debug.
Sujay
‎2010 Oct 15 10:04 AM
hi..
Try Passing Paramter "ORDER_HEADER_IN " along with "ORDER_HEADER_INX"
It will Update.
thanks,
Padma
‎2010 Oct 15 10:40 AM
Hi,
If you have not passed to the extension, how the extension will get updated.
You have to pass to the table extension. Hope you have updated the new fields INTO BAPE_VBAK & VBAKKOZ etc.
Try giving l_logic_switch-cond_handl = ' ' and check if updates.
If it doesn't, I don't have an immediate solution except asking you to debug.
Sujay
‎2010 Oct 15 3:52 PM
Thank you both for your quick response.
Padma, what value should I put in the order_header_in parameter since I am changing a Sales Document? The document is already there with the distribution channel, sales org etc, I do not need to change these, I only need to change the pricing and add the extension values only.
Sujay, Here are the values I am inserting in the extension, I have an append structure in VBAK for these. If I add the extension, it doesn't update saying enter document number, and if I don't add the extension, it updates (only the price, not the extension values), with l_logic_switch-cond_handl = ''. as you suggested. Here is a snippet:
data: socond type standard table of bapicond with header line.
data socondx type standard table of bapicondx with header line.
data: header_inx like BAPISDH1X.
data: order_header_in1 like BAPISDHD1.
data: return2 type bapiret2 occurs 0 with header line.
data: l_logic_switch like bapisdls." occurs 0 with header line.
data: t_bape_vbak like standard table of bape_vbak
with header line,
t_bape_vbakx like standard table of bape_vbakx
with header line,
t_extensionin like standard table of bapiparex
with header line.
parameters: amt type vbak-netwr,
ord type vbak-vbeln.
*CLEAR order_header_in1.
*order_header_in1-PRICE_DATE = sy-datum.
*order_header_in1-REQ_DATE_H = sy-datum.
*order_header_in1-DISTR_CHAN = '10'.
*order_header_in1-SALES_ORG = '1000'.
clear header_inx.
header_inx-updateflag = 'U'.
*append header_inx.
clear l_logic_switch.
l_logic_switch-pricing = ''.
l_logic_switch-cond_handl = 'X'.
*append l_logic_switch.
clear socondx.
socondx-cond_type = 'ZC07'.
socondx-updateflag = 'I'.
socondx-cond_value = 'X'.
socondx-currency = 'X'.
append socondx.
clear socond.
socond-cond_value = AMT.
socond-cond_type = 'ZC07'.
socond-currency = 'ZAR'.
append socond.
t_bape_vbak-ZZCST = 21.
t_bape_vbak-ZZebf = 5.
t_bape_vbak-ZZSAD = 2.
t_bape_vbak-ZZNWW = 5.
t_bape_vbak-zzrss = 'C'.
t_bape_vbak-zztst = 26.
t_bape_vbak-zzecf = 2.
append t_bape_vbak.
t_bape_vbakx-ZZCST = 'X'.
t_bape_vbakx-ZZTST = 'X'.
t_bape_vbakx-ZZSAD = 'X'.
t_bape_vbakx-ZZNWW = 'X'.
t_bape_vbakx-zzecf = 'X'.
t_bape_vbakx-ZZebf = 'X'.
t_bape_vbakx-zzrss = 'X'.
append t_bape_vbakx.
Loop at t_bape_vbak.
t_extensionin-structure = 'BAPE_VBAK'.
t_extensionin-valuepart1 = t_bape_vbak.
append t_extensionin.
Endloop.
Loop at t_bape_vbakx.
t_extensionin-structure = 'BAPE_VBAKX'.
t_extensionin-valuepart1 = t_bape_vbakx.
append t_extensionin.
Endloop.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = ord
IMPORTING
OUTPUT = ord.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
SALESDOCUMENT = ORD
* ORDER_HEADER_IN =
ORDER_HEADER_INX = header_inx
* SIMULATION =
* BEHAVE_WHEN_ERROR = ' '
* INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH = l_logic_switch
* NO_STATUS_BUF_INIT = ' '
TABLES
RETURN = return2
* ORDER_ITEM_IN =
* ORDER_ITEM_INX =
* PARTNERS =
* PARTNERCHANGES =
* PARTNERADDRESSES =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CFGS_BLOB =
* ORDER_CFGS_VK =
* ORDER_CFGS_REFINST =
* SCHEDULE_LINES =
* SCHEDULE_LINESX =
* ORDER_TEXT =
* ORDER_KEYS =
CONDITIONS_IN = socond
CONDITIONS_INX = socondx
EXTENSIONIN = t_extensionin
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
loop at return2.
write:/ return2-message, return2-message_v1.
endloop.
‎2010 Oct 15 4:09 PM
Hi,
You have to provide the sales order number in BAPE_VBAK and BAPE_VBAKX.
Hope it helps.
Sujay