Skip to Content
avatar image
Former Member

bapi tutorial

Hello friends,

plz give me the tutorial for creating a new project in BAPI.

helpful notes will be appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jan 11, 2008 at 06:31 AM

    BAPI (Business Application Programming Interface) is an API method of a business object which intern is a RFC enabled Function Module.

    Business Objects are the Objects which has business sence associated to it. Ex. Sales Orders, Purchase Orders etc.

    The Properties of BAPI are:

    Every BAPI name should start with letters 'BAPI'.

    It is an API method of a Business Object.

    it does not contain a internal COMMIT statement in the Function Module.

    It does not contain "CALL TRANSACTION" statements.

    BAPI do not raise 'EXCEPTIONS'.

    a RETURN structure is defined as an interface parameter of a BAPI which is used to log all the errors, warnings and the successful processes tha are triggered in the course of execution of a BAPI.

    A successful execution of a BAPI requires the data to be commited and this process of performing a COMMIT is achieved by calling the BAPI_TRANSACTION_COMMIT' explicitly if there are no errors logged in the RETURN structure.

    There are two types of BAPI's: Instance Dependent & Instance Independent.

    BAPI provides an access to the SAP system for external applications to have the business data processed in the form of web services. When BAPI's are used to post the data in SAP system these are used as Function Modules.

    For Sales order:

    Check these BAPI



    for Purchase Order:

    check these combination



    BAPI-step by step

    Creating BAPI:

    BAPI Convention:

    Coding Example:

    Reward points if useful.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member
      Hi Former Member!

                  Thanks for you post!   by using "BAPI_SALESORDER_CREATEFROMDAT2"  i have created successfully sales order through java program.  now i want  to get the invoice amount for created sales order, how can i get this over java program? can you pls help me?


      Raja M


  • avatar image
    Former Member
    Jan 11, 2008 at 06:32 AM


    BAPI-step by step

    list of all bapis

    for BAPI's

    Also refer to the following links..

    Checkout !!,289142,sid21_gci948835,00.html

    u can check the below the material also

    what is BAPI?

    BAPI stands for Business API(Application Program Interface).

    I have answered this question before..

    A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..

    You can make your function module remotely enabled in attributes of Function module but

    A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).

    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.

    The following standardized BAPIs are provided:

    Reading instances of SAP business objects

    GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.

    The BAPI GetList() is a class method.

    GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type

    The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.

    Create( ) and CreateFromData! ( )

    The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.

    Change( )

    The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.

    Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.

    The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.

    Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.

    Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 11, 2008 at 09:33 AM

    Hi Lokesh,


    BAPIs are standardized programming interfaces (methods) enabling external applications to access business processes and data in the R/3 System.

    BAPIs provide stable and standardized methods to achieve seamless integration between the R/3 System and external applications, legacy systems and add-ons.

    BAPIs are defined in the BOR(Business object repository) as methods of SAP business object types that carry out specific business functions.

    BAPIs are implemented as RFC-enabled function modules and are created in the Function Builder of the ABAP Workbench.

    The BAPI Explorer is the R/3 System working environment for developing BAPIs.

    A BAPI interface is defined by:

    -Import parameters

    -Export parameters

    -Import/export (table) parameters

    Each function module underlying a BAPI:

    · Supports the Remote Function Call (RFC) protocol

    · Has been assigned as a method to an SAP Business Object in the BOR

    · Is processed without returning any screen dialogs to the calling application

    The process of defining and implementing a BAPI consists of the

    following steps --

    Describing the Scenario the BAPI is Used in

    Reviewing the BAPI Concept and BAPI Scenario

    Defining a BAPI and Its Interface

    Creating Individual Programming Objects

    Testing the BAPI

    Releasing and Freezing the BAPI .

    Some BAPIs and methods provide basic functions and can be used for

    most SAP Business Objects.These are called STANDARDIZED


    Standardized BAPIs

    BAPIs for Reading Data

    GetList() , GetDetail() , GetStatus() , ExistenceCheck()

    BAPIs for Creating or Changing Data

    Create() or CreateFromData(),Change(),Delete() and Undelete() ,

    Cancel() ,Add

    BAPIs for Mass Processing

    ChangeMultiple(), CreateMultiple(), DeleteMultiple().

    BAPIs for Replicating Business Object Instances

    Replicate() and SaveReplica()

    Creating a BAPI

    Go to transaction sw01 (that is Tools->Business Framework -> BAPI Development ->Business Object builder ) .

    Select the business object ( generally of type BUS nnnn ) , according to the functional requirement for which the BAPI is being created.

    Open the business object in change mode. Then Select Utilities ->API Methods ->Add method.

    Then enter the name of the function module and select Continue.

    In the next dialog box, following information needs to be specified :

    Method : Suggest an appropriate name for the method,

    Texts : Enter description for the BAPI,

    Radio buttons : Dialog, Synchronous, Instance-independent . BAPI ‘s are usually implemented synchronously.

    Now, select Next step.

    To create the method select Yes in the next dialog box.

    After the program has been generated and executed, check the program in the method just created.

    Thus , a BAPI is created.

    Testing the BAPI :-

    You can test the BAPI by testing the individual method of the Business Object in the Business Object Builder.

    ( or one can use the transaction ‘swud’ to test the method ) .

    Releasing and freezing the BAPI :-

    -To release the BAPI , first release the function module ( using transaction se37 ) .

    -Set the status of the method to 'released' in the Business Object Builder .

    ( using transaction swo1 – Edit-> change status-> released. )

    Use of BAPI in Custom programs

    Step 1: First step is to identify the application area. Then go to the transaction code BAPI and obtain the corresponding BAPI.

    Eg : if your dealing with a sales order , in the BAPI explorer , go to sales and distribution-> sales->sales order.

    Step 2: Refer to the documentation of the method to know how to use the BAPI.

    Eg : In order to create a sales order, select the BAPI CreateFromDat2. (BAPI_SALESORDER_CREATEFROMDAT1).

    Step 3: Simulate the desired output using SE37 transaction. Do sample testing with the function module found. SAP does not specify flag population part to control the update. That you can achieve by some trial run of the function module.

    Example :



    Order_header_in = s_order_header


    Salesdocument = w_sales_docno

    Return = s_return


    Order_items_in = t_order_item

    Order_partners = t_order_partner

    Order_item_out = t_order_item_out.


    reward if useful

    thanks and regards

    suma sailaja pvn

    Add comment
    10|10000 characters needed characters exceeded