Creating Custom BAPI For Updating Employee Details in Employee Custom Table

 

  • B - Business , A - Application , P - Programming , I - Interface
  • BAPI is standard programming interface that enables the external access to business process in the SAP system.
  • An external system ( may be as SAP system or any other system that uses programming language like JAVA or Visual Basic or C++ ) can make a call to BAPI.
  • BAPI’s in the SAP systems are implemented as function modules.
  • BAPI = function module + business object
  • A BAPI is defined in the Business Object Repository ( BOR ).
  • The transaction code to display the BAPI is ‘BAPI’ ( BAPI Explorer ).

Requirement :-

  • We need to fill data in our custom Employee Table Using Custom BAPI.

Solution :-

Step 1 :- Creating Employee Table




Step 2 :- Creating a RFC Enabled Function Module :-

Pre-requisites of BAPI

  1. The function module name must start with <namespace>BAPI_<business object>_<Method>.
  2. All parameters associated type must begin with <namespace> BAPI.
  3. All parameters must be pass by value.
  4. It must contain a parameter RETURN of type ‘BAPIRET2’.
  5. Function module must be RFC enabled.
  6. Function Module must be released ( GOTO → Release ).

Steps For Creating Function Module :-

  • Step 1 :- go to SE37 transaction code.

  • Step 2 :- Give a proper name to function module.



  • Step 3 :- Click on create button.

    • Function Group is a container for Function Modules.


  • Step 4 :- Click on save.

  • Step 5 :- Now we need to create a structure for the fields of our table Employee Id and Name and then pass this structure in the import of the Function Module.



  • Step 6 :- For any BAPI, it is mandatory to pass a returning parameter of type BAPIRET2.



    • Note :- make sure all parameters should be pass by value.
  • Step 7 :- Now we need to write the logic in our source code.



  • Step 8 :- make this function module as RFC enabled.



  • Step 9 :- Now we need to release our function Module.




    Step 3 :- Creating Business Object and Merging With RFC

    • Transaction code for business object builder is SWO1.
    • We need to provide the below mentioned things while creating the business document.
    • Super type :- To inherit the components of existing object type.
    • Object Type :- It is used for external identification of the business object.
    • Object Name :- It is used for external identification of the business object. Using this property external system can interact with SAP system.
    • Name :- It is a descriptive name of the business object.

    • Step 1 :- Go to transaction code SWO1.

    • Step 2 :- Give a name for the object and click on create button.



      • As soon as you will click on create button and popup screen will appear where you need to provide the details.






    • Step 3 :- Now we need to find the business object with the function Module.



      • Pass the FM and give the name as CREATE.


      • now, we can see that CREATE method is created.

    Status of Business Object / Business Object Components

    • There are 4 status for business object / business object components.
      1. Modeled :- This status means the business object / business object components are defined.
      2. Implemented :- This status means business object / business object components have got full functionality implemented and these can be used for internal purpose ( within SAP ), and for testing purpose.
      3. Released :- This status means business object / business object components have got full functionality and the interface is freeze, means this will make an entry in the BAPI explorer and can be invoked from external application as well ( non - SAP ).
      4. Obsolete - Can’t be used.

    Now, we need to release the BAPI to see it on BAPI Explorer ( i.e. BAPI transaction code ).




Comments

Popular posts from this blog

Understanding Different Types of SAP Function Modules: Normal, RFC, and Update

Unlocking SAP ABAP Secrets: Interactive Classical Reports with GET CURSOR, At User Command, and a Comparison of HIDE Statements

Mastering ABAP: A Step-by-Step Guide to Function Modules and Groups for Modularized Programming