10-06-2019 11:09 AM
Hi gurus,
I am working on an upload program which will mass create Sales Order.
A brief introduction as below:
1. Prices are all manually entered during upload.
2. Condition type (ZEAP) is configured to allow manual entries.
3. Manual creation via VA01 is working without any issue.
4. I am attempting to upload and create a sales order with multiple line items.
5. All line items have the same condition type (ZEAP) in upload file and before passing to bapi BAPI_SALESORDER_CREATEFROMDAT2.
My issue:
1. When upload a sales order with 3 line items, in the created sales order, the first two line items have their prices updated. The third line is not updated.
2. Issue only occurs when there are multiple line items and only occurs to the last line item.
Kindly advise on what are the possible cause of errors and let me know the information is suffficient.
Code snippet:
"Begin of line item condition details
ls_cond-itm_number = lv_posnr.
ls_cond-cond_type = <fs_upload>-kschl.
ls_cond-cond_value = <fs_upload>-kbetr.
ls_cond-condvalue = <fs_upload>-kbetr.
ls_cond-cond_p_unt = <fs_upload>-kpein.
ls_cond-currency = <fs_upload>-waers.
ls_cond-curr_iso = <fs_upload>-waers.
ls_cond-cond_unit = <fs_upload>-kmein.
ls_cond-cd_unt_iso = <fs_upload>-kmein.
ls_cond-cond_st_no = '020'.
ls_cond-cond_count = '01'.
ls_cond-cond_updat = abap_true.
ls_condx-itm_number = lv_posnr.
ls_condx-cond_st_no = '020'.
ls_condx-cond_count = '01'.
ls_condx-cond_type = <fs_upload>-kschl.
ls_condx-cond_value = abap_true.
ls_condx-cond_p_unt = abap_true.
ls_condx-currency = abap_true.
ls_condx-cond_unit = abap_true.
ls_condx-updateflag = 'U'.
APPEND ls_items TO lt_items.
APPEND ls_itemx TO lt_itemx.
APPEND ls_schedule TO lt_schedule.
APPEND ls_schedulex TO lt_schedulex.
APPEND ls_cond TO lt_cond.
APPEND ls_condx TO lt_condx.
ENDLOOP.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = ls_header
order_header_inx = ls_headerx
IMPORTING
salesdocument = lv_vbeln
TABLES
return = lt_return
order_items_in = lt_items
order_items_inx = lt_itemx
order_partners = lt_partner
order_schedules_in = lt_schedule
order_schedules_inx = lt_schedulex
order_conditions_in = lt_cond
order_conditions_inx = lt_condx.
10-07-2019 11:14 PM
It's an odd one but could be a variety of reasons. From the top of my head:
1) Is it always the last item? Check with 1 item and, say, 5 items. Use the same material in all items to make sure it's not material related.
2) Use the same data in VA01 and confirm it works - maybe there are other factors involve and this specific condition simply can't be entered for the specific item?
3) User exit gone wrong?
Don't see anything wrong in the code and I assume you've already checked the data before BAPI is called.
10-21-2019 2:50 PM
Solved it. The problem is caused by an existing user exit. We have added proper filters so that it is not triggered by our programs.