2020 May 09 8:33 AM
I am working on object using BAPI_SALESORDER_CREATEFROMDAT2. And gettting error
E V1 331 item 000020 does not exist in sales_schedules_in.
Thanks
2020 May 11 8:13 AM
Hi
Good to know that you are able to come across the first problem.
First step
If some orders gives error, try to create manually for that order and see how it behaves. Consult with functional consultant for the reason. Is there anything required for not creating schedule lines
Second Step
Make sure your code as below
In Bapi you will find ORDER_ITEMS_IN and ORDER_ITEMS_INX as well as ORDER_SCHEDULES_IN and ORDER_SCHEDULES_INX. Update KWMENG you will have to pass that value to ORDER_ITEMS_IN-TARGET_QTY and update the same in the table ORDER_ITEMS_INX (ORDER_ITEMS_INX-TARGET_QTY) with 'X'. For updating schedule line go for ORDER_SCHEDULES_IN-SCHED_LINE and update X for the same in ORDER_SCHEDULES_INX.
Look at example below
loop at t_mdata into fs_mdata.
fs_item-itm_number = fs_mdata-posnr.
fs_itemx-itm_number = c_flag.
fs_item-material = fs_mdata-matnr.
fs_itemx-material = c_flag.
fs_item-target_qty = fs_mdata-kwmeng. <============
fs_itemx-target_qty = c_flag.
fs_item-item_categ = fs_mdata-pstyv.
fs_itemx-item_categ = c_flag.
fs_itemx-updateflag = c_flag.
APPEND fs_item TO t_item.
APPEND fs_itemx TO t_itemx.
fs_sline-ITM_NUMBER = fs_mdata-posnr.
fs_slinex-ITM_NUMBER = c_flag. <=========== chek here
fs_sline-SCHED_LINE = c_sline.
fs_slinex-SCHED_LINE = c_flag.
fs_sline-REQ_QTY = fs_mdata-kwmeng. <===================
fs_slinex-REQ_QTY = c_flag.
APPEND fs_sline TO t_sline.
APPEND fs_slinex TO t_slinex.
endloop. " Loop t_mdata
Regards,
Venkat
2020 May 09 2:09 PM
Please paste your code..
There is some mismatch in your bapi data assignments
2020 May 10 6:30 AM
Thanks Mr. venkateswaran.k
As you are asking for code. I am attaching the code file and the debugging error log.
For this BAPI just changed the line item data type and sales order quantity data type .

Please let me know the rectification...
2020 May 10 7:59 AM
Hi
My initial finding is that
1. Your data definiton for TAB-ITM_NUMBER TYPE C LENGTH 10 is wrong
It should be similar to the exact data type of item number in BAPISDITM
2. when you populate the item tables you need to populate the X tables also as below - other wise the update will not be successful.
ORDER_ITEMS_IN = ORDER_ITEMS_IN
ORDER_ITEMS_INX =
ORDER_PARTNERS = ORDER_PARTNERS
ORDER_SCHEDULES_IN = ORDER_SCHEDULES_IN
ORDER_SCHEDULES_INX =
Let me know your result after this correction
Regards,
Venkat
2020 May 11 5:50 AM
Mr. Venkat sir thanks for support.
As you suggested "need to use CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' for Item number also"
I did the changes and program works. I just observed when i execute the programs with ORDER_SCHEDULES_IN and ORDER_SCHEDULES_INX
all sales order gets updated without any error but the quantity gets updated with zero for all sales order and all line items.
but when execute the program with ORDER_SCHEDULES_IN and ORDER_SCHEDULES_INX then some of the sales order gets updated with exact quantity and some of the sales order gets error message below:
Item 000020 does not exist
Sales document was not changed
SALES_HEADER_IN has been processed succe
SALES_ITEM_IN has been processed success
Item 000030 does not exist
Sales document was not changed
SALES_HEADER_IN has been processed succe
SALES_ITEM_IN has been processed success
Item 000030 does not exist
Sales document was not changed
2020 May 10 2:04 PM
Mr. Venkat thanks you.
I did as you suggested.
I changed the POSNR to POSNR LIKE BAPISDITM-ITM_NUMBER,
But the output is same.I am attaching the the modified code and errors log. But before these changes, subject to first code some of the sales order getting generated and some of them throwing errors. But after modifications all are generating errors.
2020 May 10 5:45 PM
Hi
I saw your error log,
You need to use CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' for Item number also
2020 May 11 8:13 AM
Hi
Good to know that you are able to come across the first problem.
First step
If some orders gives error, try to create manually for that order and see how it behaves. Consult with functional consultant for the reason. Is there anything required for not creating schedule lines
Second Step
Make sure your code as below
In Bapi you will find ORDER_ITEMS_IN and ORDER_ITEMS_INX as well as ORDER_SCHEDULES_IN and ORDER_SCHEDULES_INX. Update KWMENG you will have to pass that value to ORDER_ITEMS_IN-TARGET_QTY and update the same in the table ORDER_ITEMS_INX (ORDER_ITEMS_INX-TARGET_QTY) with 'X'. For updating schedule line go for ORDER_SCHEDULES_IN-SCHED_LINE and update X for the same in ORDER_SCHEDULES_INX.
Look at example below
loop at t_mdata into fs_mdata.
fs_item-itm_number = fs_mdata-posnr.
fs_itemx-itm_number = c_flag.
fs_item-material = fs_mdata-matnr.
fs_itemx-material = c_flag.
fs_item-target_qty = fs_mdata-kwmeng. <============
fs_itemx-target_qty = c_flag.
fs_item-item_categ = fs_mdata-pstyv.
fs_itemx-item_categ = c_flag.
fs_itemx-updateflag = c_flag.
APPEND fs_item TO t_item.
APPEND fs_itemx TO t_itemx.
fs_sline-ITM_NUMBER = fs_mdata-posnr.
fs_slinex-ITM_NUMBER = c_flag. <=========== chek here
fs_sline-SCHED_LINE = c_sline.
fs_slinex-SCHED_LINE = c_flag.
fs_sline-REQ_QTY = fs_mdata-kwmeng. <===================
fs_slinex-REQ_QTY = c_flag.
APPEND fs_sline TO t_sline.
APPEND fs_slinex TO t_slinex.
endloop. " Loop t_mdata
Regards,
Venkat
2020 May 12 12:43 PM
Mr venkateswaran.k sir
Thanks for correcting me. One point was the posnr field second was updateflag and third main point was not clearing the ORDER_SCHEDULES table.
Now Bapi executing and the sales order getting punched. But the for those customer where credit limit ( SAP standard functionality ) is there in that case the sales orders are not getting generated. As it gives a Information message and that goes to RETURN.
Can we handle the credit limit of customer in BAPI_SALESORDER_CREATEFROMDAT2. The message is
W V1 555 The sales document is not yet complete: Edit data
E V1 152 Dynamic credit check has been exceeded 55.00 INR
2020 May 12 1:34 PM
Hi
I believe the original problem of this thread is solved. In that case you close this thread by marking the answer as accepted.
You open new thread for the Credit limit check.
This will help for the other people who looks for similar solution .
Regards,
Venkat
2020 May 13 4:29 AM
Mr. Venkat sir thanks for support, valuable suggestions and correcting to get the desired result
Thread is solved and close the thread.
2020 May 11 8:37 AM
Hi
You need to have an item number in the ITM_NUMBER fields of structures ending with an "X", too.
So, to be precise, fields ORDER_ITEMS_INX-ITM_NUMBER and ORDER_SCHEDULES_INX-ITM_NUMBER should contain the same item number as ORDER_ITEMS_IN-ITM_NUMBER and ORDER_SCHEDULES_IN-ITM_NUMBER. Otherwise BAPI won't know to which item the structures are reffering to.
regards,
Mateusz
2020 May 12 12:47 PM
mateuszadamus
Thanks for valuable suggestions for correcting the code for bapi
2020 May 12 1:34 PM
Hi
I believe the original problem of this thread is solved. In that case you close this thread by marking the answer as accepted.
You open new thread for the Credit limit check.
This will help for the other people who looks for similar solution .
Regards,
Venkat