Application Development and Automation 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: 
Read only

BAPI_SALESORDER_CHANGE insert sales order item lines ERRORS

Former Member
0 Likes
2,719

Hello experts,

i have to insert new item lines for a given sales order document number.

i use bapi_salesorder_change but it does not work.

these are the messages in the return table:

Error 1.

Message: ORDER_HEADER_IN has been processed succesfully

Message: No item category available

Message: Error in ITEM_IN

Message: Condition cc_cond is not allowed as header condition

Message: Sales document was not changed

Error 2.

Message: ORDER_HEADER_IN has been processed succesfully

Message:Material is not defined for sales org., distribution chan, language DE {but i checked the table mvke with the matnr and sales org and distribution chanel and the material exists}

Message: Error in ITEM_IN

Message: Condition cc_cond is not allowed as header condition

Message: Sales document was not changed

here is the code:

i_t_item-itm_number = p_posnr.

i_t_item-material = p_matnr.

i_t_item-target_qty = p_qty.

i_t_item-plant = p_plant.

i_t_item-hg_lv_item = p_uepos.

i_t_item-price_date = p_preisdat.

i_t_item-prc_group2 = cc_prc_group.

APPEND i_t_item.

*setting conditions

i_t_bapicond-itm_number = p_posnr.

i_t_bapicond-cond_type = cc_condition_type.

i_t_bapicond-cond_value = l_netwr.

i_t_bapicond-conpricdat = gc_datum.

i_t_bapicond-currency = cc_eur.

APPEND i_t_bapicond.

i_t_itemx-updateflag = cc_i. {= 'I'}

i_t_itemx-itm_number = p_posnr.

i_t_itemx-material = cc_x.

i_t_itemx-target_qty = cc_x.

i_t_itemx-plant = cc_x.

i_t_itemx-hg_lv_item = cc_x.

i_t_itemx-price_date = cc_x.

i_t_itemx-prc_group2 = cc_x.

APPEND i_t_itemx.

i_t_bapicondx-updateflag = cc_i.{'I'}

i_t_bapicondx-itm_number = p_posnr.

i_t_bapicondx-cond_type = cc_x.

i_t_bapicondx-cond_value = cc_x.

  • i_t_bapicondx-conpricdat = cc_x.

i_t_bapicondx-currency = cc_x.

append i_t_bapicondx.

CLEAR: l_behave, sy-subrc.

CLEAR i_t_header.

i_t_header-updateflag = cc_u. {='U'}

APPEND i_t_header.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = sales_ord_number

    • ORDER_HEADER_IN =

order_header_inx = i_t_header

simulation = cc_x

behave_when_error = l_behave

    • INT_NUMBER_ASSIGNMENT = ' '

    • LOGIC_SWITCH =

TABLES

return = i_t_return

order_item_in = i_t_item

order_item_inx = i_t_itemx

    • 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 = i_t_text

    • ORDER_KEYS =

conditions_in = i_t_bapicond

conditions_inx = i_t_bapicondx

  • extensionin = i_t_extensionin.

.

IF i_t_return-type EQ cc_s OR i_t_return-type EQ cc_w OR i_t_return-type EQ cc_i.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = cc_x.

PERFORM return_code.

ELSE.

p_flag = cc_x.

PERFORM return_code_err.

  • to rollback the transation for error records

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ENDIF. " IF i_t_return-type EQ 'S'

i hope you can tell me where my code is wrong.

Best Regards,

Emilia

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,349

Hi,

Error 1

Header data is process succesfully

Item data has a problem. Item category is not available in the sytem.

Error 2

material is the flat file is not defined in the system or there might be a mismatch in the way it has been written.

Check if the material number is given sometimes the FF might contain the materail desc instead of Mat no.

Regards

Gokul

Hello experts,

i have to insert new item lines for a given sales order document number.

i use bapi_salesorder_change but it does not work.

these are the messages in the return table:

Error 1.

Message: ORDER_HEADER_IN has been processed succesfully

Message: No item category available

Message: Error in ITEM_IN

Message: Condition cc_cond is not allowed as header condition

Message: Sales document was not changed

Error 2.

Message: ORDER_HEADER_IN has been processed succesfully

Message:Material is not defined for sales org., distribution chan, language DE {but i checked the table mvke with the matnr and sales org and distribution chanel and the material exists}

Message: Error in ITEM_IN

Message: Condition cc_cond is not allowed as header condition

Message: Sales document was not changed

here is the code:

i_t_item-itm_number = p_posnr.

i_t_item-material = p_matnr.

i_t_item-target_qty = p_qty.

i_t_item-plant = p_plant.

i_t_item-hg_lv_item = p_uepos.

i_t_item-price_date = p_preisdat.

i_t_item-prc_group2 = cc_prc_group.

APPEND i_t_item.

*setting conditions

i_t_bapicond-itm_number = p_posnr.

i_t_bapicond-cond_type = cc_condition_type.

i_t_bapicond-cond_value = l_netwr.

i_t_bapicond-conpricdat = gc_datum.

i_t_bapicond-currency = cc_eur.

APPEND i_t_bapicond.

i_t_itemx-updateflag = cc_i. {= 'I'}

i_t_itemx-itm_number = p_posnr.

i_t_itemx-material = cc_x.

i_t_itemx-target_qty = cc_x.

i_t_itemx-plant = cc_x.

i_t_itemx-hg_lv_item = cc_x.

i_t_itemx-price_date = cc_x.

i_t_itemx-prc_group2 = cc_x.

APPEND i_t_itemx.

i_t_bapicondx-updateflag = cc_i.{'I'}

i_t_bapicondx-itm_number = p_posnr.

i_t_bapicondx-cond_type = cc_x.

i_t_bapicondx-cond_value = cc_x.

  • i_t_bapicondx-conpricdat = cc_x.

i_t_bapicondx-currency = cc_x.

append i_t_bapicondx.

CLEAR: l_behave, sy-subrc.

CLEAR i_t_header.

i_t_header-updateflag = cc_u. {='U'}

APPEND i_t_header.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = sales_ord_number

    • ORDER_HEADER_IN =

order_header_inx = i_t_header

simulation = cc_x

behave_when_error = l_behave

    • INT_NUMBER_ASSIGNMENT = ' '

    • LOGIC_SWITCH =

TABLES

return = i_t_return

order_item_in = i_t_item

order_item_inx = i_t_itemx

    • 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 = i_t_text

    • ORDER_KEYS =

conditions_in = i_t_bapicond

conditions_inx = i_t_bapicondx

  • extensionin = i_t_extensionin.

.

IF i_t_return-type EQ cc_s OR i_t_return-type EQ cc_w OR i_t_return-type EQ cc_i.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = cc_x.

PERFORM return_code.

ELSE.

p_flag = cc_x.

PERFORM return_code_err.

  • to rollback the transation for error records

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ENDIF. " IF i_t_return-type EQ 'S'

i hope you can tell me where my code is wrong.

Best Regards,

Emilia

5 REPLIES 5
Read only

Former Member
0 Likes
1,350

Hi,

Error 1

Header data is process succesfully

Item data has a problem. Item category is not available in the sytem.

Error 2

material is the flat file is not defined in the system or there might be a mismatch in the way it has been written.

Check if the material number is given sometimes the FF might contain the materail desc instead of Mat no.

Regards

Gokul

Read only

0 Likes
1,349

Hello ,

Error 2

i checked about the material number and it seems that everything is in order.

so this is not the problem.:(

Error 1

about the item category error: do i get this error because i don't fill the field ITEM_CATEG?

Error 1 and Error 2

About Message: Condition cc_cond is not allowed as header condition

i really don't undesrtand what this is about.

thank you for your answer.

Best regards,

Emilia

Read only

0 Likes
1,349

Hi,

About Message: Condition cc_cond is not allowed as header condition

Some condition has been given in the Header which cannot be assigned in the item level or vice versa. Please chk with the sd guys.

regards

Gokul

Read only

0 Likes
1,349

hello all,

i rechecked the data and it seems that it was indeed a problem of the way the matnr was written.

because a matnr has leading zeroes (e.g. 000000000000009321).

when i read the material i just read 9321 and when i assign the value the matnr becomes: 932100000000000000. so i had to add the leading zeroes.

all the other problems were directly related to the faulty mat number.

so:

since the material number was not recognized the item line had an error and could not be inserted and so the conditions were recognized at header level.

thank you very much.

best regards, emilia.

Read only

Former Member
0 Likes
1,349

ERROR1

Message: No item category available.

if you are creating a new line item, this message might indicated that system cannot determine a item category for the new line item , you should check the configuration of item category determinatoin in spro, Combine sales document type/Item category group(in Material Master data-Sales 2 View)/Usage/ High item category(if BOM is involved) in VOV4

elseif you are changing a existing line item, this message might indicates that system did not read the line item data since you already create the order ,there's no way your configuration is wrong unless you change the configuration afterthen, SO Please check the BAPI Table :ORDER ITEMS INX, check whether you maintain the parameter : ITM_NUMBER , without this ,BAPI can not read the line item data