Skip to Content
Author's profile photo Ashim Chowdhury

Align vendor batch number with SAP batch number during Goods Receipt

Vendor batch number is an important attribute of a material batch. For purchased material, vendor batch number can be entered in the goods receipt screen using the batch details send by vendor in the delivery document.

But as the vendor batch number is a textual field and the user nerds to enter the value manually at the time of goods receipt. Moreover the vendor batch number has no direct relation with the SAP batch number and it is possible to have the same vendor batch number in multiple SAP batch for the same material.

To overcome this miss-alignment between the SAP batch number and the corresponding vendor batch number, some system enhancement needs to be done. The enhancement will try to find out existing SAP batch number based on vendor batch number and make all the material posting with subsequent delivery to the same SAP batch so as there is only one SAP batch in the system corresponds to a given vendor batch.


Proposed Functionality:

At the time of goods receipt for a vendor supplied material, using the material, vendor and vendor batch number as key information, the enhancement will check in the system for any existing SAP batch based on material master setting and assign the existing SAP batch number in goods receipt transaction to the same receipt of material/ vendor/ vendor batch.

A new SAP batch is only created when there is no existing vendor batch in the system for the material-vendor-vendor batch.

Technical Design:

Technically this functionality can be achieved with either implementing a customer-exit or through implementing a BADI as described below. Any one of the approach can be used.

Customer Exit:

Enhancement Name: MBCFC010

Exit function module: EXIT_SAPMM07M_010

Include Name: ZXMBCU10

Main Program: SAPMM07M


Subroutine charge_vorschlagen


SAP has also provided BADI “MB_MIGO_BADI” with method LINE_MODIFY to implement the functionality.

Detail Design:

The enhancement can be implemented using the customer-exit EXIT_SAPMM07M_010 as mentioned before. The customer-exit is called at the time of goods receipt (Transaction MIGO_GR). The related main program is SAPMM07M and this customer-exit is called inside the subroutine CHARGE_VORSCHLAGEN.


This customer exit has been provided to assign some batch number without creating a new batch number by the system. In this case, this customer-exit can be used to check for any existing vendor batch and assign the corresponding SAP batch.

Step 1: Following are the important import variables available inside the exit.

I_MSEG-MATNR => Material No


I_MSEG-LGRT => Storage Location

I_MSEG-LIFNR => Vendor Number

I_VM07M-LICHA => Vendor batch number

Step 2:  Go to table MCH1 and search for the SAP batch number for the given material, vendor and vendor batch (MCH1-MATNR = I_MSEG-MATNR, MCH1-LIFNR = I_MSEG-LIFNR and MCH1-LICHA = I_VM07M-LICHA)

Step 3: There can be three cases

Case A: No matching SAP batch record found.

This means there is no existing vendor batch in the system.  No batch number assignment needs to be done. System should create a new batch and assign it.

Case B: There is a single matching batch record.

            System should use this SAP batch and should not create any new batch. Assign this batch number to the export parameter E_CHARG.

Case C: There is multiple matching batch record

            A pop-up screen can be displayed with the existing list of SAP batches. User can select the required entry from the list.

Business Benefit:

Implementing this enhancement will allow to have an alignment between the vendor batch number with the SAP batch number. Because of this functionality a given material batch of a vendor (the same batch might be delivered multiple time as part of different deliveries) always has the same SAP batch – hence tracking will be much easier.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Irfan Dalal
      Irfan Dalal

      Nice Document

      Author's profile photo Tomaž Makuc
      Tomaž Makuc


      Is there maybe any additional explanation how to set this? So if this is set up - if u have more GR with same vendor batch no - the same SAP batch will be created?