How To Create BAPI in SAP ABAP

Many people need to learn how to create BAPI in SAP ABAP. BAPI which short for Business  Application Programming Interface is simply an interface that provides access to data and processes in business systems like R/3. BAPIs are usually referred to as API processes of SAP business objects. Such business types and their BAPIs are normally described and then stored in a Business Object Repository or (BOR). A BAPI is therefore implemented as some kind of function mode which is stored and then described at the Function Builder.

BAPIs can also be called right within the R3 system from other external application systems among other programs. BAPIs are usually the communication standard for most business applications.

The BAPI interface forms the foundation for various developments such as:-

  •  Connecting Non-SAP software
  • Connecting Legacy systems
  • Connecting R/3 components such as APO and BW and many others.

BAPI is an RFC enabled function module. What happens is that one creates business objects then registers then in the Business Object Repository which can be successfully accessed from outside the SAP system by simply using other non-SAP applications like JAVA or VB.

In this case all you have to do is specify what the business object is and its process from an external system. Remember that in BAPI there is usually no direct system call but in RFC there is a direct system call.

Some BAPIs will provide the basic functions and will be effectively used for various SAP business types. Such BAPIs should be implemented in the same way for all the business object types. In other words, BAPI is simply an RFC enabled function module just as stated earlier.

How To Create BAPI in SAP ABAP

First start by creating some kind of structure in dictionary, then create a simple remote-enabled function module which will get some details from the Table T001 that is often based on the “input company code. The table T001 contains these company codes.

In the next step create a business object by using SWO1 and then add the function module created earlier as a modality of the business object. When you complete the steps in SWO1, you will then find your created BAPI in BAPI Explorer. The simply make sure you test run your BAPI by simply inputting values.

Further outlined below is the step by step process of how to create BAPI in SAP ABAP.

Creating a Structure in The SE11

1. Simply go to the transaction SE11 and then create a structure basing it on your requirements. Remember to save it the package. You can check the structure by pressing Ctrl and F2 and activate it by pressing Ctrl and F3.

2. Create your function module in the SE37 by going to SE37 which is where the function modules are created. Simply click on “Create” after entering the name of your function module. You can enter the function group and a short text then click the save button. Note that if the function isn’t already made, you can simply create it from the function group then create it from the first screen of SE37.

3. A message will then be displayed saying that the function module name is SAP reserved. Simply click on “Continue” which will result to a new screen displayed. Go to the attributes tab then indicate the processing type as “Remote Enabled Module”

4. Next go to the import tab and then put in the details as per your requirements. Got to the export tab and enter the details then do the same in the Tables tab.

5. Next head to source code tab and then enter the code after which you will release your function module by going to function module then selecting “Release”

Creating A Business Object at The SWO1

1. Simply go to the transaction SWO1 and then enter BAPI name that you would love to create then select “Create” enter the details in the screen that will come as your requirements dictate then click on “Continue”. You will be asked to save the object, simply save it in the package.

2. In the screen that comes up next, select the methods to drop down and see the provided methods. You will see two methods showing the a red color that usually comes automatically when creating BAPI. Select the “Add Method” option from utilities

3. Another screen will come up where you will indicate the function module name that you created previously and then click on the “continue” option. A pop-up will come up where you will click the next icon. You will notice that the information is predefined inside the fields

4. Simply click on the “next” option on the screen that comes up and then another pop-up will be seen. On the pop-up click “Yes” and some king of information message will come up.

5. Save after adding the method. Select then double click on the API method.

6. Select the Object you created and then go to Edit, select “Change Release Status” then the “object type” then “Modeled”. A new screen will be shown where you will click on yes, after which a message will come up showing that the object type status is already modeled.

7. Next go to Edit then “Change Release Status” Then “Object type” and lastly to “Implemented”. You will then see a message indicating that the object type status is set to be implemented.

8. Use the same method to change release status to released and two pop-ups will come up. Simply click continue and then use the same method to change the release status of the object type component. Next click “Generate” from the object and then a message will come up saying that the object type has successfully generated. This will make the end of your BAPI creation.

View and Test Your BAPI

You can find your created BAPI by going to the BAPI explorer. Simply click on that Alphabetical tab which will enable you to navigate the BAPI in the alphabetical order. You can then enter your BAPI name in the SWO1 and then click on “Test” . Follow the prompts and you will finally confirm that your BAPI is functioning well. Test it with different values through the input and the execution screen just as before.

With the above guide, you will definitely have learnt how to create a BAPI in SAP ABAP.

mm
Marissa Hart is the Lead Author & Editor ShareMe. ShareMe is a blog focused on SharePoint Online. SharePoint Online delivers the powerful features of SharePoint without the associated overhead of managing the infrastructure.