Skip to Content
author's profile photo Former Member
Former Member

Why only BADI and not normal Z-Classes?

Usually an SAP program calls a BADI using a code

similar to:

CLASS CL_EXITHANDLER DEFINITION LOAD.

DATA MYEXIT TYPE REF TO IF_EX_BADINAME.

CALL METHOD CL_EXITHANDLER=>GET_INSTANCE

CHANGING INSTANCE = MYEXIT.

“ fetching instance of the BADI class

MYEXIT->BADIMETHOD “ calling the BADI method

EXPORTING….

……

IMPORTING….

It is recommended that the BADI we create also be called

the same way.. It would work juz fine if i create a

normal interface and class and call them from my

program.. If the BADI's are implemented by use of normal

Classes and Interfaces why should we go for BADI's and

why the special name 'BADI'?

Or is there any special functioning of a BADI? Does any

one know how BADI's exactly work and how they are

different from normal interfaces and classes? If anyone

has a link to some BADI reference material pls do provide

the link..

Thank you..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Mar 24, 2006 at 07:08 AM

    Hi,

    BADI is Business Addin , here you can add a specific logic/fucntionality to the existing SAP standard Program or Transaction. you cannot add your own code where ever you feel. SAP will not support those. and you cannot use or implement what ever you feel in BADI, there are BADI's defined for certain functionalities like adding of customer screens, doing some checks etc...

    Regards

    Vijay

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2006 at 07:49 AM

    Anand,

    BADI's are nothing but user exits. So, you use them only if you want to add more to the standard functionality. You usually don't create a BADI for yourself, all you do implement a BADI which SAP has provided.

    Technically, BADI is implemented using classes / methods / interfaces and user exits are done using function modules.

    For your custom coding, you should always go with creating CLASSES / METHODS - SE24. You don't create BADI's.

    Hope things are clear now.

    Regards,

    Ravi

    Note : Please mark the helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Dusan,

      The whole idea of BADI is to add value to the standard processing. I went through the weblog you have mentioned.

      What the author of the weblog is doing is to create a new BADR, no doubt about it. However, if you have observer it closely he is calling it from a user exit (Function module). That means, whether its a standard BADI or a custom BADI, we are still dependent on the standard code to provide a user exit. Now assume a case, where you don't have a user exit, what are you going to do by creating a custom BADI, you cannot call that anyways.

      So, my point of view is, for this thread's question - BADI vs Z-Classes - These are two different things. You can implement a standard / custom BADI only when there a provision made by the SAP Developers. Where as Custom classes are specific to my functionality and I can use it as it is applicable.

      Now, coming to weblog's point of creating a custom BADI - If I have to create a custom BADI, I can as well create a custom class and a custom interface and implement that in the user exit (Function) provided. Technically I don't have to create a BADI. And the custom class will still serve the same purpose. As I have an interface, every programmer using this interface can have their own implementation, so it doesn't mandate me to create my own BADI.

      Your thought's please?

      regards,

      Ravi

  • Posted on Mar 24, 2006 at 07:10 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2006 at 12:41 AM

    BAdI Works under the concepts of Run time polymorphism. BADI is a User exit. Standard SAP Program call the interface method not the Z-class that u going to create. Objects cannot be handled without creating the instances .

    CREATE OBJECT ref TYPE class.

    CREATE OBJECT ref TYPE (class).

    This are two syntax help to create object for the class with reference of interface . BADI works like this , it will contain the name of the class that u created and currently been activated(since many implementation can there for same definition,add-ins) . This help to call that class method using instance create by above syntax. This is what happen in the CL_EXITHANDLER=>GET_INSTANCE method. They help to get the activated business add-in which it as to reflect in the standard SAP program and create the instance to the method.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.