on 02-10-2009 2:52 PM
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
*
o ORDER_HEADER_IN =
order_header_inx = i_t_header
simulation = cc_x
behave_when_error = l_behave
*
o INT_NUMBER_ASSIGNMENT = ' '
o LOGIC_SWITCH =
TABLES
return = i_t_return
order_item_in = i_t_item
order_item_inx = i_t_itemx
*
o PARTNERS =
o PARTNERCHANGES =
o PARTNERADDRESSES =
o ORDER_CFGS_REF =
o ORDER_CFGS_INST =
o ORDER_CFGS_PART_OF =
o ORDER_CFGS_VALUE =
o ORDER_CFGS_BLOB =
o ORDER_CFGS_VK =
o ORDER_CFGS_REFINST =
o SCHEDULE_LINES =
o SCHEDULE_LINESX =
order_text = i_t_text
*
o 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'
could you please tell me about the three BOLD errors?.
Best Regards,
Emilia
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello all,
the problem was with material number.
i had to add leading zeroes or else the material number could not be recognized and was set to initial.
(e.g 0000..0009321 instead of just 9321).
if the material is set to zero then the item usage is set either to TEXT either to VCTR and so the item category cannot be found.
then the item line is faulty.
and so the conditions could not be analized at item level.
best regards,
emilia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi EMI,
ERROR1
Message: No item category available. In BAPI there are some information that isnt determined automaticaly as when you run the trx online, so you should provide the all data required.
Message: Condition cc_cond is not allowed as header condition. This message is because the price condition is not a condition of header level.
I dont have idea for ERROR2.
Anyway, post this issue in ABAP forum.
Thanks,
Mariano.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.