Hi,
I'm trying to use bapi BAPI_SALESORDER_CHANGE to update a sale order, by adding new items with conditions.
I tried differents way, differents values, but i already the same problem : Error message VH_BAPI 050 - Price determination error
Here is parts of my code (lt_poste and lt_condition are internal table containing new items and new condition for my order)
CLEAR : ls_headerx, ls_bapisdls. ls_headerx-updateflag = 'U'. " Update code ls_bapisdls-cond_handl = 'X'. " Flag to maintain conditions *== Loop on my new items LOOP AT lt_postes INTO ls_postes. *== Item datas CLEAR : ls_items, ls_itemsx. ls_items-itm_number = ls_postes-posnr ls_itemsx-itm_number = ls_postes-posnr. ls_itemsx-updateflag = 'I'. " Creation code ls_items-item_categ = ls_postes-pstyv. ls_itemsx-item_categ = 'X'. ls_items-material = ls_postes-matnr. ls_itemsx-material = 'X'. ls_items-short_text = ls_postes-arktx. ls_itemsx-short_text = 'X'. ls_items-plant = ls_postes-werks. ls_itemsx-plant = 'X'. ls_items-mat_pr_grp = ls_postes-kondm. ls_itemsx-mat_pr_grp = 'X'. ls_items-tax_class1 = ls_postes-taxm1. ls_itemsx-tax_class1 = 'X'. ls_items-ex_rate_fi = ls_postes-kurrf. ls_itemsx-ex_rate_fi = 'X'. ls_items-exch_rate_fi_v = ls_postes-kurrf. ls_itemsx-exch_rate_fi_v = 'X'. ls_items-po_itm_no = ls_postes-posex. ls_itemsx-po_itm_no = 'X'. ls_items-reason_rej = ls_postes-abgru. ls_itemsx-reason_rej = 'X'. SELECT SINGLE bstkd bstdk FROM vbkd INTO (ls_items-purch_no_c , ls_items-purch_date) WHERE vbeln = me->s_vbak-vbeln AND posnr = ls_postes-posnr. IF sy-subrc = 0. ls_itemsx-purch_date = 'X'. ls_itemsx-purch_no_c = 'X'. ENDIF. CLEAR ls_items-wbs_elem. CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT' EXPORTING input = ls_postes-ps_psp_pnr IMPORTING output = ls_items-wbs_elem. ls_itemsx-wbs_elem = 'X'. APPEND ls_items TO lt_items. APPEND ls_itemsx TO lt_itemsx. *== Condition datas LOOP AT lt_condition INTO ls_condition. CLEAR : ls_bapicond, ls_bapicondx. ls_bapicond-itm_number = ls_postes-posnr. ls_bapicondx-itm_number = ls_postes-posnr. ls_bapicond-cond_type = ls_condition-kschl. ls_bapicondx-cond_type = ls_condition-kschl. ls_bapicond-cond_value = ls_condition-kbetr / 10. ls_bapicondx-cond_value = c_x. CLEAR lv_krech. SELECT SINGLE krech FROM t685a INTO lv_krech WHERE kappl = 'V' AND kschl = ls_condition-kschl. ls_bapicond-calctypcon = lv_krech. IF lv_krech = 'C'. "Pricing condition ls_bapicond-currency = 'EUR'. ls_bapicondx-currency = c_x. ENDIF. ls_bapicond-cond_updat = 'I' ls_bapicondx-updateflag = 'I' APPEND ls_bapicond TO lt_bapicond. APPEND ls_bapicondx TO lt_bapicondx. ENDLOOP. ENDLOOP *== BAPI Execution CALL FUNCTION 'BAPI_SALESORDER_CHANGE' EXPORTING salesdocument = me->s_vbak-vbeln order_header_inx = ls_headerx logic_switch = ls_bapisdls TABLES return = lt_bapiret2 order_item_in = lt_items order_item_inx = lt_itemsx conditions_in = lt_bapicond conditions_inx = lt_bapicondx. CLEAR ls_bapiret2. READ TABLE lt_bapiret2 INTO ls_bapiret2 WITH KEY type = 'E'. IF sy-subrc <> 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ENDIF.
So i'm getting this an error message, indicate that's it's impossible to determine price.
ie : 000010 : Processing terminated; pricing error ( KOMP-FXMSG = 801 )
I tried to update other value but nothing change.
I have only 2 condition to add to my item : PR00 and ZMAR (% type)
So here are the other field in condition table that a filled but, i also have the same message :
APPLICATIO = V
CALCTYPCON = A (ZMAR) or B (PR00)
STAT_CON = X (only for ZMAR)
CONDORIGIN = C
GROUPCOND = X (only for ZMAR)
CONDCNTRL = C
CONDCLASS = A (ZMAR) OR C (PR00)
CONDCHAMAN = X
Is there any field that i could forgot ? Do you know where i could be wrong ?
Many thanks in advance for any answer.