Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete conditions with BAPI_SALESORDER_CHANGE

Former Member
0 Kudos

Hi,

I try to delete same conditions in an order sale with BAPI BAPI_SALESORDER_CHANGE with the next code:

select single knumv

into vbak-knumv

from vbak

where vbeln = p_vbeln_n.

if sy-subrc = 0.

select kposn zaehk stunr

appending corresponding fields of table it_condiciones

from konv

where kschl = 'ZDF'

and knumv = vbak-knumv.

clear iorder_cond_in.

refresh iorder_cond_in.

clear iorder_cond_inx.

refresh iorder_cond_inx.

clear iorder_hdr_inx.

refresh iorder_hdr_inx.

clear ilogic_switch.

refresh ilogic_switch.

clear ireturn.

refresh ireturn.

loop at it_condiciones.

clear iorder_cond_in.

iorder_cond_in-itm_number = it_condiciones-kposn.

iorder_cond_in-COND_ST_NO = it_condiciones-stunr.

iorder_cond_in-cond_count = it_condiciones-zaehk.

iorder_cond_in-cond_type = 'ZDF'.

append iorder_cond_in.

clear iorder_cond_inx.

iorder_cond_inx-itm_number = it_condiciones-kposn.

iorder_cond_inx-COND_ST_NO = it_condiciones-stunr.

iorder_cond_inx-cond_count = it_condiciones-zaehk.

iorder_cond_inx-cond_type = 'ZDF'.

iorder_cond_inx-updateflag = 'D'.

append iorder_cond_inx.

endloop.

clear iorder_hdr_inx.

iorder_hdr_inx-updateflag = 'U'.

append iorder_hdr_inx.

clear ilogic_switch.

ilogic_switch-cond_handl = 'X'.

append ilogic_switch.

call function 'BAPI_SALESORDER_CHANGE'

exporting

salesdocument = p_vbeln_n

order_header_inx = iorder_hdr_inx

logic_switch = ilogic_switch

tables

return = ireturn

conditions_in = iorder_cond_in

conditions_inx = iorder_cond_inx.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'.

endif.

but the table ireturn give me the next values:

1|S|V4 |233|ORDER_HEADER_IN has been processed successfully | |000000|VBAKKOM | | | |ORDER_HEADER_IN|0| |SSA|

2|E|VH_BAPI|050|000010: Processing terminated; pricing error ( KOMP-FXMSG = 804 )| |000000|000010 | |804| |KONVKOM |0| |SSA|

3|E|V4 |219|Sales document 0055310650 was not changed | |000000|0055310650| |804| | |0| |SSA|

Anyone can i help me??, please, it's uregent (always it's urgent )

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Because of the pricing error VH_BAPI 050, the sales document cannot be changed. This is due to either (1) the values passed to the BAPI or (2) the pricing configuration in your system.

Take a look at <a href="https://websmp202.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=012006153200000099342003">Note 593246</a>.

If Note 593246 "BAPI SD as of Rel.4.70: New functions for pricing" does not contain information that will help you eliminate the pricing check or if the pricing error is legitimate, then you will need to check with your SD functional team to determine why the pricing error is being sent during sales order change.

You could try to simulate the problem via transaction VA02 to determine if the pricing error shows up when changing the sales order in normal dialog mode. If it does, then perhaps the problem is the configuration. If it does not, then you need to check the values you are passing to the BAPI (the Note 593246 may help you in this regard -- also check the BAPI documentation for information on each of the parameters.)

Regards,

James G.

1 REPLY 1

Former Member
0 Kudos

Hi,

Because of the pricing error VH_BAPI 050, the sales document cannot be changed. This is due to either (1) the values passed to the BAPI or (2) the pricing configuration in your system.

Take a look at <a href="https://websmp202.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=012006153200000099342003">Note 593246</a>.

If Note 593246 "BAPI SD as of Rel.4.70: New functions for pricing" does not contain information that will help you eliminate the pricing check or if the pricing error is legitimate, then you will need to check with your SD functional team to determine why the pricing error is being sent during sales order change.

You could try to simulate the problem via transaction VA02 to determine if the pricing error shows up when changing the sales order in normal dialog mode. If it does, then perhaps the problem is the configuration. If it does not, then you need to check the values you are passing to the BAPI (the Note 593246 may help you in this regard -- also check the BAPI documentation for information on each of the parameters.)

Regards,

James G.