Sie sind auf Seite 1von 7

Validation of External Batch

Numbering during Goods Receipt


using MIGO Transaction

Applies to:
SAP ABAP, SAP PP, SAP MM. For more information, visit the ABAP homepage.

Summary
This paper outlines the correct implementation approach for validating the external batch number while doing
goods receipt using MIGO transaction.
We have to check the business rules on which the batch number is created. If the batch number is correct
we shall allow the goods receipt otherwise we shall throw an error message pop up.
The challenge / problem faced was we tried many implementation but after getting the error message pop
up , the user was unable to change the batch number since the screen was getting locked .

Author: Abhishek Gupta


Company: IBM India Pvt Ltd.
Created on: 25th January 2011

Author Bio
Abhishek Gupta currently works at IBM India Pvt Ltd. His current role is of application package
consultant. He has total year of 5.5 years of experience . He has previous worked in organizations
viz, SAP Labs , Wipro Technologies. You can reach him on mail id : abhishek.princy@gmail.com

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 1
Validation of External Batch Numbering during Goods Receipt using MIGO Transaction

Table of Contents
Business Background ......................................................................................................................................... 3
Associated Screen .......................................................................................................................................... 3
The old approach and problem ....................................................................................................................... 3
The Problem .................................................................................................................................................... 4
The Correct Approach. ....................................................................................................................................... 5
Related Content .................................................................................................................................................. 6
Disclaimer and Liability Notice ............................................................................................................................ 7

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 2
Validation of External Batch Numbering during Goods Receipt using MIGO Transaction

Business Background
The Batch management is often used for traceability purposes and is active at the material level. The batch
number is based on the business rules which makes it unique and the material to which it is assigned.
We need to build up a logic which shall check the business rules on the batch number while doing a goods
receipt using MIGO transaction.

Associated Screen
Screen where we give the Batch number during goods receipt in MIGO transaction.

The old approach and problem


Previously we used an exit EXIT_SAPLV01Z_004 where we can check our own business rule.
This exit is available in the sap enhancement SAPLV1ZE.
Details of EXIT_SAPLV01Z_004.
Function Group: XVBZ Customer Exits for Batch Handling
Short Text: Check New Batch Number According to Customer Rule.
The above exit was implemented and activated for performing the batch validation .

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 3
Validation of External Batch Numbering during Goods Receipt using MIGO Transaction

The Problem
Every time a wrong batch was added while performing the goods receipt, the error message pop up was
thrown. When the end user checks the errors message and tries to enter the batch number again, the screen
gets locked .Hence the end user has to again start the goods receipt.

As we can see here an error message pop up has come due to wrong batch number. After checking this
error pop up, we get the screen locked and we cannot re-enter the batch number.
Hence we gave up this approach and tried a different approach.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 4
Validation of External Batch Numbering during Goods Receipt using MIGO Transaction

The Correct Approach.


We implemented the BADI, MB_MIGO_BADI. , BAdI in MIGO for External Detail Sub screens
The following interfaces were implemented.
1) LINE_MODIFY: Add / Change a Line (GOITEM).
2) PAI_DETAIL: PAI of Detail Screen.
The sample code in interfaces:
1) PAI Detail:
METHOD if_ex_mb_migo_badi~pai_detail.

DATA lv_ok_code TYPE sy-ucomm.

lv_ok_code = sy-ucomm.

IF lv_ok_code = 'OK_POST' or lv_ok_code = OK_POST1.


e_force_change = 'X'.
ENDIF.

ENDMETHOD.

2) LINE_MODIFY:
METHOD if_ex_mb_migo_badi~line_modify.
DATA lv_line_id TYPE mb_line_id.
DATA ls_item TYPE goitem.
DATA lv_ok_code TYPE syucomm.
DATA ty_input TYPE bncom.
DATA ty_batch_number TYPE sa_charg.

lv_line_id = i_line_id.

ls_item = cs_goitem.

lv_ok_code = sy-ucomm.

IF lv_ok_code = 'OK_POST' or lv_ok_code = 'OK_POST1'. (Check whether the save or


post button has been pressed).

* Reading the input parameters.


ty_input-matnr = ls_item-matnr.
ty_batch_number = ls_item-charg.

IF NOT ty_batch_number IS INITIAL.

* Put your logic for batch number check.


ENDIF.
ENDIF.
ENDMETHOD.

Using the above approach the end user is now able to re-enter the batch number if the previously enter
batch number was not as per the business rules. The screen does not get locked now.
Another benefit of this approach was that it does not allow you to post the material with a wrong batch .

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 5
Validation of External Batch Numbering during Goods Receipt using MIGO Transaction

Related Content
https://forums.sdn.sap.com/thread.jspa?messageID=5299616#5299616
http://forums.sdn.sap.com/thread.jspa?threadID=878139
http://forums.sdn.sap.com/thread.jspa?threadID=1836426
For more information, visit the ABAP homepage

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 6
Validation of External Batch Numbering during Goods Receipt using MIGO Transaction

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2011 SAP AG 7

Das könnte Ihnen auch gefallen