How to Create BAPI in SAP ABAP
How to Create BAPI in SAP ABAP
What is a BAPI
Business Application Programming Interface(BAPI) is a interface providing us access to SAP and Non-SAP systems to process data from the remote systems. BAPI's are API methods which are stored in the Business Object Repository (BOR). BAPI is implemented as a function module which connects the New R/3 components, Information Warehouse (BW),Non-SAP software,Legacy systems,Isolating components within the R/3 System in the context of Business Framework,Distributed R/3 scenarios with asynchronous connections using Application Link Enabling (ALE) and Connecting R/3 Systems to the Internet using Internet Application Components (IACs).
Business Application Programming Interface's(BAPI's) are standardized programming interfaces which enable external applications to access business processes and data in the R/3 System. BAPI provides us seamless integration between the R/3 System and external applications and BAPI's defined as methods of SAP business object types that are used for different business functions. BAPI's are implemented as RFC-enabled function modules created in the Function Builder of the ABAP Workbench.
Business Application Programming Interface's(BAPI's) are standardized programming interfaces which enable external applications to access business processes and data in the R/3 System. BAPI provides us seamless integration between the R/3 System and external applications and BAPI's defined as methods of SAP business object types that are used for different business functions. BAPI's are implemented as RFC-enabled function modules created in the Function Builder of the ABAP Workbench.
Difference between RFC and BAPI
BAPI is a RFC enabled function module. The main difference between RFC enabled function module and BAPI is business objects. We create business objects which we registered in BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA languages. For this we only define 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 which can be used for SAP business object types.
We need five main steps to create a BAPI
We need five main steps to create a BAPI
1.Defining structure in SE11
2. Defining function module in SE37
3.Defining business object in SWO1
4.Checking the created BAPI in BAPI Explorer
5.Testing BAPI
1: Defining a structure in SE11 for BAPI
Go to transaction SE11 and create a structure .
2: Defining the function module in SE37 for BAPI
Go to transaction SE37 where create function module.
Click on create after you enter the name of the function module. Enter the function group and short text. Now click on save button.
A message will be displayed ‘Function module name is reserved for SAP’. click continue.
Now go to the Import tab and enter the details
In the export tab enter the details as below.
In the Tables tab enter the details as below.
Now go to source code tab and enter the code as shown below.
Next we have to release the function module by Function Module>Release>Release.
3.Defining the business object in SWO1 for BAPI
Go to transaction SWO1 and enter the name of the BAPI .
Now select ‘Add Method’ from Utilities > API Methods > Add Method.
Provide the function module name that we just created in the previous stage and click on the continue icon. In the coming pop-up, click the next step icon.
Just click on the “next” icon.
A popup will be displayed as below.
Click on Yes.
Select & Double click on the API method.
Go to Tab: ABAP Check 'API Function' as shown below.
Select the Radio button reading “API Function” as already said above.
Now select the Object “ZBAPI_SRI”
Now Go to : Edit > Change Release Status > Object type > To Modeled.
Click on yes.
Message shows, The object type status set to modeled.
Now go to: Edit > Change Release Status > Object type >To Implemented. We can see a message reading “Object type status set to implemented” .
Now, go to: Edit > Change Release Status > Object > To Released. Click continue on the Pop Ups.
Keep the cursor on the 'Method'. Now go to: Edit > Change Release Status > Object type component > To Modeled. .
Now, go to: Edit > Change Release Status > Object type component > To Implemented. “ status for method ‘zbapifmt002’ set to implemented”.
Now go to: Edit > Change Releasse Status > Object type component > To Released. You can see the message reading “ status for method ‘zbapifmt002’ set to Released”.
Click on ‘Generate’ from Object Type as shown below.
After clicking on the generate button, you can see the message reading “Object type 'ZBAPI_ABY' generated successfully”. Now we are done with the creation of a BAPI.
4: Checking the created BAPI in BAPI Explorer
Go to BAPI Explorer (BAPI) there we can find the BAPI (our BAPI).
5: Testing a BAPI
Enter the name of your BAPI in the transaction SWO1 and click on ‘Test’.
Click on the Execute icon against the BAPI .
Give the input and click the execute button.
Final output looking below image.
Finally,we have completed the creating a BAPI and its steps .
Comments
Post a Comment