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: 

Header co ndition error in BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Kudos

Hi All,

I am using BAPI_SALESORDER_CREATEFROMDAT2 to create sales order and assign the characteristics i.e configuration to the material(item)

When i execute the BAPI, I am getting error "Condition ZMCH is not allowed as header condition".

My code is

***Conditions for value

w_order_conditions-itm_number = '000010'.

w_order_conditions-cond_type = 'ZMCH'(035).

w_order_conditions-cond_value = w_sdsales_sap-sduprc .

w_order_conditions-currency = w_sdsales_sap-sdcrcd.

APPEND w_order_conditions TO i_order_conditions.

w_order_conditionsx-itm_number = '000010'.

w_order_conditionsx-cond_type = 'ZMCH'.

w_order_conditionsx-cond_value = 'X' .

w_order_conditionsx-currency = 'X'.

APPEND w_order_conditionsx TO i_order_conditionsx.

*Order items

w_order_items-itm_number = '000010'.

w_order_items-po_itm_no = '000010'.

w_order_items-material = w_sdsales_sap-matnr.

w_order_items-target_qty = '1'.

w_order_items-CONFIG_ID = '000001'.

w_order_items-INST_ID = '00000001'.

APPEND w_order_items TO i_order_items.

*Order itemsX

w_order_itemsx-itm_number = '000010'.

w_order_itemsx-po_itm_no = 'X'.

w_order_itemsx-material = 'X'.

w_order_itemsx-target_qty = 'X'.

w_order_itemsx-CONFIG_ID = 'X'.

w_order_itemsx-INST_ID = 'X'.

APPEND w_order_itemsx TO i_order_itemsx.

Can you please help me to fix this error.

thanks in advance

3 REPLIES 3

mvoros
Active Contributor
0 Kudos

Hi,

you condition ZMCH is not item condition. This condition can be used only in header. You can check settings of your conditions in SPRO - Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control -> Define Condition Types. Try to fill field CONDCOINHD - Condition counter for (header conditions).

Cheers

Former Member
0 Kudos

Thanks for your reply....

I checked in SPRO, Item Condition is checked. So if i pass the value to CONDCOINHD, i am getting the same error...

Can you please help me to fix it.

Thanks..

Former Member
0 Kudos

We had the same error using the same bapi before. We got this error because our net invoice total was a negative amount. I'm not sure you have the same problem but it may be worth to check your input data.

RLC