100% found this document useful (1 vote)
773 views5 pages

Badi Example - Mm01

This document provides steps to create a BADI implementation that displays an information message when creating a material with a specific material group and division.  It describes putting a breakpoint to identify the appropriate BADI (BADI_MATERIAL_CHECK) which is called before saving a material and contains the relevant MARA table fields.  Steps are provided to create a BADI implementation (ZMM_MAT_CHECK) that checks the material group and division in the CHECK_DATA method and displays a message if they match certain values.  The implementation is activated and testing instructions are given to create a material to trigger the message.

Uploaded by

EmilS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
773 views5 pages

Badi Example - Mm01

This document provides steps to create a BADI implementation that displays an information message when creating a material with a specific material group and division.  It describes putting a breakpoint to identify the appropriate BADI (BADI_MATERIAL_CHECK) which is called before saving a material and contains the relevant MARA table fields.  Steps are provided to create a BADI implementation (ZMM_MAT_CHECK) that checks the material group and division in the CHECK_DATA method and displays a message if they match certain values.  The implementation is activated and testing instructions are given to create a material to trigger the message.

Uploaded by

EmilS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

BADI Example - MM01

The Requirement is to put a information message while creating a material if Material Group is A05 and
Division is: 02.
(Why cant we use field exit ?? : As it needs two information for the material and user wants information
message while saving the material. we cant use field exit for this).
Step 1:
How to find appropriate BADI for this requirement??
Put the break- point into Class CL_EXITHANDLERs GET_INSTANCE method.
Go to transaction code MM01 , create a material and try to save it. it stops at many location with different
values of EXIT_NAME. (After checking into Se18 we got the BADI_MATERIAL_CHECK which can be use for
our requirement.

It has a method CHECK_DATA which is called before saving the material.


It also has WMARA table as input data (Material Group and Division comes in MARA table).

Step 2:
Go to Transaction code SE18.
Open BADI : BADI_MATERIAL_CHECK.
Go to menu option Implementation and Create.

Step 3:
Give the implementation name as ZMM_MAT_CHECK.

Step 4:
Double click on the method CHECK_DATA.If you notice the input parameters we have many data related to
batch , material and storage location etc..

For our requirement we need material group and devision Which exist in WMARA.Put the below code inside
the method then activate the class and method.
if WMARA-MATKL eq A05 and WMARA-SPART eq 02.
message Material creation for this Group should be avoided for animal products!! TYPE I.
endif.
This code is just checks the material group and division.

Step 5:
Go back and Activate the implementation.

Step 6:
So now its the time to Disco !!!!!!!Upsssss Sorry its the time to test this BADI.
For this go to transaction MM01 and try to create a material.
(if you are confused use material name as CH004 ,
Industry sector as Animal Health and
Material Type as Beverages )
Click on the ENTER Button and from the view select BASIC DATA 1.

You might also like