Skip to Content

I searched on SCN and found there are so many threads we have asked for User Ext/Badi which updates the Batch Number when doing Goods Movement of Production Order, Non of the thread I found marked as Resolved/Answered.. 😯

I thought to share my past experience when I had come across similar requirement of customer and Implemented one Badi to update the Batch Number.

Requirement was when we create Production Order (Transaction Code CO01 ), SAP  Proposes Batch Number or you can Enter any batch number Manually.

/wp-content/uploads/2015/10/1_820768.png

After releasing production order, we normally Enter Time Ticket for Production Order( Transaction Code CO11N) and do the Goods Movement.

/wp-content/uploads/2015/10/2_820761.png

After Creating time ticket for production order When you try to do Goods Movement (As shown in Screen below), same batch number reflects against created production order.

/wp-content/uploads/2015/10/3_820762.png

But, here we want to update custom batch number with below posting date entered in below screen in CO11N :

/wp-content/uploads/2015/10/4_820766.png

Example: Batch Number should be always posting date of production order in YYMMDD format, so that user can easily identify the batches against which materials production is confirmed.

We will use BADI definition “WORKORDER_GOODSMVT” to update the Batch Number.

Step 1: Go to Transaction code SE19 and create Implementation for  BADI WORKORDER_GOODSMVT.

Step 2: Enter BADI Defination Name.

Step 3: Go to Interface Tab and select Method “GOODS_RECEIPT” to Write the Logic.

Step 4: Write the below Sample Code:

DATA: ls_confirmations LIKE LINE OF it_confirmations,
ix_tabix
TYPE sytabix.

IF sytcode = ‘CO11N’.

READ TABLE it_confirmations INTO ls_confirmations INDEX 1.
IF sysubrc = 0.
WRITE ls_confirmationsbudat TO ls_confirmationsbudat YYMMDD.
ENDIF.
CLEAR ix_tabix.
LOOP AT ct_goods_receipt INTO ls_goods_receipt.
ix_tabix
= ix_tabix + 1.
ls_goods_receipt
charg = ls_confirmationsbudat.

MODIFY ct_goods_receipt FROM ls_goods_receipt INDEX ix_tabix.
ENDLOOP.
ENDIF.

Step 5: Activate the Badi and Test the Scenario.

Note: Above Logic will not update custom batch in Production order transaction code (CO01/CO02/CO03). ❗


In Transaction Code CO11N in Goods Movement Tab we can see the updated batch number.

/wp-content/uploads/2015/10/5_820767.png

Now Go to Production Order and see the “Documented Goods Movement”, you will get the updated batch number there too. 😛

Thanks for reading this short document.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply