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

CREATING BAPI

my actual requirement is creating

 BAPI for displaying the Customer details based on sales organization, Distribution channel and Division.

?  BAPI for deleting purchase orders using bapi_po_change.

help me in this how to create bapi structure and function module and object forthis and how to release object and function module for this.help me i this.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Apr 01, 2008 at 08:57 AM

    Create a Remote enabled Function module firsst..

    then you need to add this BAPI in Business Object Repository

    Please award points

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 01, 2008 at 09:01 AM

    1. Yes we can create new BAPI, BADI .

    2. Create BAPI steps:

    Programming a BAPI consists of some tasks like:

    • Defining BAPI Data structures ( using SE11 )

    • Creating BAPI Function Modules (For each method)

    • Defining BAPI Methods in the BOR

    • Generate and release

    1. Defining BAPI Data structures: This is the basic step followed while creating BAPIs. All the relevant structures that are required for BAPI have to be created using T-Code SE11. The structures can be created for Import/Tables parameters.

    2. Creating BAPI Function Modules: We must create new function group for each BAPI. If the BAPIs are related then the same can be grouped under the same FUNCTION GROUP to enable the sharing of global data amongst the related BAPIs.

    3. Defining BAPI Methods in the BOR: When creating a new object type in BOR (Business Object Repository), there can be two possibilities. Either it is created as a subtype of an existing business object or it is created as a new business object from scratch. Create a business object using the T-Code SWO1. The business object gets created with the standard interface that contains an Interface IFSAP, an Attribute ObjectType, and two methods namely ExistenceCheck and Display. All these cannot be changed. You can add a method to the business object. For this, we will choose from the menu path, Utillities -> API methods -> Add method. To use the business object Object type status has to be set to Implemented.

    4. Generate and Release: Go to SE37 and release the API enabled Function module. In the Object created in the BOR, set the status of Object Type Component to Released.

    You can then display the BAPI in the BAPI Explorer. Invoke the same using the T-code BAPI.

    Create BADI Steps:

    Go to SE18. Enter the definition name. Click on Create.

    In attributes, Enter short description for BADI and click on checkbox Multiple Use.

    Go to Interface tab. Double-click on Interface name which will take you to class builder screen.

    Enter Name of Method, Level and Description.

    Define Parameters for the method.

    Save, Check and Activate. Adapter class proposed by system, ZCL_IM_IM_LINESEL, is generated.

    Go to SE18. Enter the Definition name. Go to Implementation -> Create.

    Enter Implementation Name.

    Enter Implementation short text.

    In Interface tab, Double click on Method Name to insert implementation code.

    Enter code between Method and Endmethod statements.

    Check and Activate.

    Go to SE38. Create report to use created BADI.

    3. Find BADI

    There are multiple ways of searching for BADI.

    • Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE

    • Finding BADI Using SQL Trace (TCODE-ST05).

    • Finding BADI Using Repository Information System (TCODE- SE84).

    1. Go to the Transaction, for which we want to find the BADI, take the example of Transaction VD02. Click on System->Status. Double click on the program name. Once inside the program search for ‘CL_EXITHANDLER=>GET_INSTANCE’.

    Make sure the radio button “In main program” is checked. A list of all the programs with call to the BADI’s will be listed.

    The export parameter ‘EXIT_NAME’ for the method GET_INSTANCE of class CL_EXITHANDLER will have the user exit assigned to it. The changing parameter ‘INSTANCE’ will have the interface assigned to it. Double click on the method to enter the source code.Definition of Instance would give you the Interface name.

    2. Start transaction ST05 (Performance Analysis).

    Set flag field "Buffer trace"

    Remark: We need to trace also the buffer calls, because BADI database tables are buffered. (Especially view V_EXT_IMP and V_EXT_ACT)

    Push the button "Activate Trace". Start transaction VA02 in a new GUI session. Go back to the Performance trace session.

    Push the button "Deactivate Trace".

    Push the button "Display Trace".

    The popup screen "Set Restrictions for Displaying Trace" appears.

    Now, filter the trace on Objects:

    • V_EXT_IMP

    • V_EXT_ACT

    Push button "Multiple selections" button behind field Objects

    Fill: V_EXT_IMP and V_EXT_ACT

    All the interface class names of view V_EXT_IMP start with IF_EX_. This is the standard SAP prefix for BADI class interfaces. The BADI name is after the IF_EX_.

    So the BADI name of IF_EX_CUSTOMER_ADD_DATA is CUSTOMER_ADD_DATA

    3. Go to “Maintain Transaction” (TCODE- SE93).

    Enter the Transaction VD02 for which you want to find BADI.

    Click on the Display push buttons.

    Get the Package Name. (Package VS in this case)

    Go to TCode: SE84->Enhancements->Business Add-inns->Definition

    Enter the Package Name and Execute.

    Here you get a list of all the Enhancement BADI’s for the given package

    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.