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

Doubt in BAPI_MATPHYSINV_CREATE

Former Member
0 Likes
3,698

Hi,

I am using the Function Module BAPI_MATPHYSINV_CREATE and then BAPI_TRANSACTION_COMMIT for creating Physical Inventory document in a Z program.

My requirement is, this BAPI should create one document for 300 articles, and consider those batches with non zero stock only.

I am passing the article, and batch number in the ITEMS tab, but it is still not working. The BAPI creates many physical inventory documents by taking all the zero stock batches as well.

Please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,232

Thanks, now its working.

I used the old FM only, which was BAPI_MATPHYSINV_CREATE and populated batches with positive quantity in the ITEMS tab. It worked.

5 REPLIES 5
Read only

Former Member
0 Likes
2,232

Hi anita,

before you are passing the BATCH to the BAPI, please do check for zero stock batch .

so pass only the BTACHEs which are not ZEro stock..

rewardpoint if helpful.

regards

mueksh

Read only

Former Member
0 Likes
2,232

Hi Anita,

can you please elaborate what is the error that you're facing.

In the items you need to pass Material and Batch.

Batch you need to mention in the ITAB.

Also try using the BAPI - 'BAPI_MATPHYSINV_CREATE_MULT'

  i_maxitems = 300.

loop at it_tab.

i_items-material = it_tab-matnr.

       i_items-batch    = it_tab-batch.

       append i_items.
       clear  i_items.
endloop.

call function 'BAPI_MATPHYSINV_CREATE_MULT'
       exporting
         head     = i_head
         maxitems = i_maxitems
       tables
         items    = i_items
         return   = i_return.
read table i_return with key type = 'S' .
    if sy-subrc = 0.
       call function 'BAPI_TRANSACTION_COMMIT'
         exporting
           wait = 'X'.

Hope this is helpful.

Regards...

Sultana

Read only

0 Likes
2,232

Hi,

Accorind to the documentation of function modue 'BAPI_MATPHYSINV_CREATE' The method 'CREATE' is obsolete from 4.60 release onwards, so it is advicable to use the bapi 'BAPI_MATPHYSINV_CREATE_MULT' as suggested by Sultana Seher.

Regards,

Kartik

Read only

Former Member
0 Likes
2,232

Hi,

Mukesh Chandu -  I am selecting batches with positive stock only. I am yet to confirm results.

Sultana Seher: I will try this BAPI also. Thanks very much.

Kartik - It is working already - it is some problem with passing values or the coding. However if it still doesnt work I will try the BAPI mentioned by Sultana. Thanks !

Read only

Former Member
0 Likes
2,233

Thanks, now its working.

I used the old FM only, which was BAPI_MATPHYSINV_CREATE and populated batches with positive quantity in the ITEMS tab. It worked.