Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_SALESORDER_CREATEFROMDAT2 :E V1 331 Item 000020 does not exist

former_member605939
Participant
0 Likes
5,940

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


1 ACCEPTED SOLUTION
Read only

venkateswaran_k
Active Contributor
0 Likes
5,300

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

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


13 REPLIES 13
Read only

venkateswaran_k
Active Contributor
5,300

Please paste your code..

There is some mismatch in your bapi data assignments

Read only

former_member605939
Participant
0 Likes
5,299

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 .

bapi-code-for-refrence.txt

Please let me know the rectification...

Read only

venkateswaran_k
Active Contributor
0 Likes
5,299

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

Read only

0 Likes
5,299

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

Read only

0 Likes
5,299

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.

bapi-modified-code-for-refrence.txterror-log.txt

Read only

venkateswaran_k
Active Contributor
0 Likes
5,299

Hi

I saw your error log,

You need to use CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' for Item number also

Read only

venkateswaran_k
Active Contributor
0 Likes
5,301

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

Read only

0 Likes
5,299

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

Read only

5,299

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

Read only

0 Likes
5,299

Mr. Venkat sir thanks for support, valuable suggestions and correcting to get the desired result

Thread is solved and close the thread.

Read only

MateuszAdamus
Active Contributor
0 Likes
5,299

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

Read only

0 Likes
5,299

mateuszadamus

Thanks for valuable suggestions for correcting the code for bapi

Read only

venkateswaran_k
Active Contributor
0 Likes
5,299

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