Close Sidebar close
Sapignite
  • SAP
  • Coding Challenges
  • Download
  • SAP Ignite Products

Subscribe & Follow

All product names on this web site are trademarks of the companies that own them. Sapignite.com is not affiliated with SAP AG in any way. SAP AG is the registered trademark holder of SAP, SAP R/3, mySAP, ABAP, xApps, NetWeaver, and other proprietary terms. The technical information on this site is verified to the greatest extent possible, however, any information found on this site is used at the site visitor's own risk. Sapignite.com reserves the right to correct any errors or omissions in any portion of this site at any time without obligation.

  • SAP
  • Coding Challenges
  • Download
  • SAP Ignite Products
Sapignite
Sapignite
    ABAP SAP

    How to implement a BADI in SAP ABAP

    July 17, 2017

    The Requirement is to put a information message while creating a material if Material Group is A05 and Division is: 02.

    (Why can’t we use field exit ??: As it needs two information for the material and user wants information message while saving the material. we can’t use field exit for this).

    Step 1:

    How to find appropriate BADI for this requirement??

    Put the break- point into Class CL_EXITHANDLER’s GET_INSTANCE method.

    Go to transaction code MM01, create a material and try to save it. it stops at many locations with different values of EXIT_NAME. (After checking into Se18 we got the BADI_MATERIAL_CHECK which can be used 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 à 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 it’s the time to Disco !!!!!!!Upsssss Sorry it’s 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.

    sap abap badi implimentationsap abap code sample for badi implementationsap abap enhancementsap abap tutorial
    raju borda
    Raju is working with Technical areas like SAP ABAP, PI , Web design, JAVA , PBT, robotics as architect also functional areas like SCM , QM, MM , insurance . When he is not Doing above geeky things you might find him travelling , Cooking , dancing or drinking with friends :-) .
    • In LOVE with SAP’s LUW

    • Enhancement in sap how to find work and implement

    You Might Also Like

    Have you ever seen standard SAP ABAP code like these

    August 3, 2017

    Tutorial on how to work with USER EXIT

    August 11, 2017

    Layer aware debugging in SAP ABAP video blog

    August 10, 2017

    No Comments

    Leave a Reply Cancel Reply

Sign up for some exciting content

Recent Posts

  • How to prepare for SAP IBP Certification
  • What is SAP Leonardo ?
  • RoadMap UI Tutorial webdynpro for ABAP
  • Offline Adobe forms in WebDynPro for ABAP
  • MVC Architecture for Webdynpro for ABAP

Categories

  • ABAP
  • Android
  • Coding Challenges
  • Enhancement
  • featured
  • Interviews
  • Learning Hub
  • PI ( Process integration )
  • SAP
  • SAP HANA
  • Uncategorized
  • Webdynpro for ABAP
  • Webdynpro For ABAP