2022 Aug 20 3:02 PM
I need to create a sales order for a sales contract and then create a proforma invoice for that sales order however i am getting a pricing error when creating the proforma invoice
Can some tell me what might be going wrong
bellow is the data i am passing to the BAPI_SALESORDER_CREATEFROMDAT2
order_header_in-doc_type = 'ZREX'.
order_header_in-ref_doc = ls_vbak-vbeln.
order_header_in-sd_doc_cat = 'C'.
order_header_in-refdoc_cat = 'G'.
order_header_in-sales_org = ls_vbak-vkorg.
order_header_in-distr_chan = ls_vbak-vtweg.
order_header_in-division = ls_vbak-spart.
* order_items_in-purch_no_c = ls_vbak-ebeln.
order_header_in-sales_off = ls_vbak-vkbur.
order_header_in-purch_no_c = ls_vbak-bstnk.
order_header_in-pmnttrms = ls_vbkd-zterm.
order_header_in-incoterms1 = ls_vbkd-inco1.
order_header_in-price_date = sy-datum.
order_header_in-ord_reason = 'PER'.
order_header_in-bill_date = sy-datum.
order_header_in-purch_no_c = ls_vbkd-bstkd.
order_header_in-purch_no_s = ls_vbkd-bstkd_e.
order_header_in-name = ls_vbak-bname.
order_header_in-po_meth_s = ls_vbkd-bsark_e.
order_header_inx-doc_type = 'X'.
order_header_inx-sales_org = 'X'.
order_header_inx-distr_chan = 'X'.
order_header_inx-division = 'X'.
order_header_inx-sales_off = 'X'.
order_header_inx-purch_no_c = 'X'.
order_header_inx-pmnttrms = 'X'.
order_header_inx-incoterms1 = 'X'.
* order_header_inx-price_date = 'X'.
order_header_inx-sd_doc_cat = 'X'.
order_header_inx-ord_reason = 'X'.
order_header_inx-ref_doc = 'X'.
order_header_inx-refdoc_cat = 'X'.
order_header_inx-bill_date = 'X'.
order_header_inx-purch_no_s = 'X'.
order_header_inx-name = 'X'.
order_header_inx-po_meth_s = 'X'.
*---Partner Details---
order_partners-partn_role = 'AG'.
order_partners-partn_numb = ls_vbpa-kunnr.
APPEND order_partners.
CLEAR : order_partners.
order_partners-partn_role = 'WE'.
order_partners-partn_numb = ls_vbpa-kunnr.
APPEND order_partners.
CLEAR : order_partners.
order_partners-partn_role = 'RE'.
order_partners-partn_numb = ls_vbpa-kunnr.
APPEND order_partners.
CLEAR : order_partners.
order_partners-partn_role = 'RG'.
order_partners-partn_numb = ls_vbpa-kunnr.
APPEND order_partners.
CLEAR : order_partners.
*---Line Items---
order_items_in-itm_number = ls_vbap-posnr.
order_items_in-material = ls_vbap-matnr.
* order_items_in-target_qty = ls_vbap-zmeng.
order_items_in-target_qu = ls_vbap-zieme.
order_items_in-bill_date = lv_to_date.
order_items_in-pmnttrms = ls_vbkd-zterm.
order_items_in-incoterms1 = ls_vbkd-inco1.
*---Convert the WBS element---
CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
EXPORTING
input = ls_vbap-ps_psp_pnr
IMPORTING
OUTPUT = lv_wbs.
*---Convert the WBS element---
order_items_in-wbs_elem = lv_wbs.
order_items_in-plant = ls_vbap-werks.
order_items_in-store_loc = ls_vbap-lgort.
* order_items_in-target_val = ls_vbak-netwr.
order_items_in-ref_doc = ls_vbap-vbeln.
order_items_in-ref_doc_ca = 'G'.
* order_items_in-ref_doc_it = ls_vbap-posnr.
APPEND order_items_in.
CLEAR order_items_in.
order_items_inx-itm_number = ls_vbap-posnr.
order_items_inx-material = 'X'.
* order_items_inx-target_qty = 'X'.
order_items_inx-target_qu = 'X'.
order_items_inx-target_val = 'X'.
order_items_inx-bill_date = 'X'.
order_items_inx-pmnttrms = 'X'.
order_items_inx-incoterms1 = 'X'.
order_items_inx-wbs_elem = 'X'.
order_items_inx-plant = 'X'.
order_items_inx-store_loc = 'X'.
order_items_in-ref_doc = 'X'.
order_items_in-ref_doc_ca = 'X'.
order_items_in-ref_doc_it = 'X'.
APPEND order_items_inx.
CLEAR : order_items_inx.
*---schedul el lines---
order_schedules_in-itm_number = ls_vbap-posnr.
order_schedules_in-req_qty = ls_vbap-zmeng.
APPEND order_schedules_in.
CLEAR : order_schedules_in.
order_schedules_inx-itm_number = ls_vbap-posnr.
order_schedules_inx-req_qty = 'X'.
APPEND order_schedules_inx.
CLEAR : order_schedules_inx.
order_conditions_in-itm_number = ls_vbap-posnr.
order_conditions_in-cond_type = 'PR00'.
order_conditions_in-condvalue = ls_vbak-netwr.
order_conditions_in-cond_value = ls_vbap-netpr.
APPEND order_conditions_in.
CLEAR order_conditions_in.
*
order_conditions_inx-itm_number = ls_vbap-posnr..
order_conditions_inx-cond_type = 'PR00'.
order_conditions_inx-cond_value = 'X'.
APPEND order_conditions_inx.
CLEAR order_conditions_inx.
2022 Aug 22 7:34 AM
Hi atharva12k
atharva12kIt looks like you need to maintain the condition records for the Condition type ZIND - in VK11 ( for the required combination ). In your example the Customer - material or viz..
In my example for ZPD1 - we need to maintain as below. Then it will automatically picks up in SO and put price there.
In your case, check for ZIND for the required combination is the price is maintained here in VK11.
Regards,
Venkat
2022 Aug 21 5:56 AM
Please update your code using CODE option ( code button in toolbar ). This will help us to read with clarity.
Secondly, what was the error message. Please provide the error message you receieved.
2022 Aug 21 7:32 AM
Hi atharva12k
The problem you are getting is in invoice, - so creating sales order BAPI may not be a issue.
Regards.
Venkat
2022 Aug 21 2:04 PM
this is the error i am getting when creating a PROFORMA INVOICE ( ZTF5 ).
i am creating the invoice using SHDB recording
i shared the code for the BAPI because i wanted to make sure that the data i am passing is correct
2022 Aug 21 2:15 PM
Hi
I assume, the billing document is saved. If so Please open the billing document and go to condition tab of the item and select the pricing condition and press analysis button and review it.
Or check with the pricing procedure / validity date of the condition.
2022 Aug 21 2:23 PM
after the bapi commit when i check the sales order it shows this error however if i manually save it twice then it saves the sales order correctly and also the proforma invoice is genereated correctly
we need automated process without manual intervention
2022 Aug 22 7:34 AM
Hi atharva12k
atharva12kIt looks like you need to maintain the condition records for the Condition type ZIND - in VK11 ( for the required combination ). In your example the Customer - material or viz..
In my example for ZPD1 - we need to maintain as below. Then it will automatically picks up in SO and put price there.
In your case, check for ZIND for the required combination is the price is maintained here in VK11.
Regards,
Venkat
2022 Aug 22 7:48 AM
2022 Aug 24 7:38 AM
The routine used for pricing condition had a condition because of which it was giving the error