Custom BAPI creation - Step-by-step Procedure
Scenario: Step-by-step creation of a BAPI to retrieve fields from table T001...
In the components tab of the structure, give the different fields and their corresponding field types
and press enter to c...
Check the structure (ctrl + F2) and activate (ctrl + F3) the structure.
++++++++++++++++++++++++++++++++++++++++++++++++++...
A screen as shown above would pop-up where you mention the function group to save the
function module and also provide som...
The function module screen would look like the one above.
Go to the Attributes tab and select the radio button reading “re...
Now in the Export tab, provide the export parameters as shown or as per your requirement.
In the tables tab, provide the i...
In the source code tab, write the following code in order to pick the data based on the input you
provide.
Now, save and c...
+++++++++++++++++++++++++++++++++++++++++++++++
Now we are done with the creation of a Function Module.
++++++++++++++++++...
Give the above-mentioned details and click on the continue icon.
Save in a package.
The resulting screen is as follows.
Now click on the methods to drop down and see what methods are provided by default. There
would be two methods, showing in...
On the screen that follows, provide the function module name and click on the continue icon.
In the ultimate pop-up, click...
Click on Yes. You can see an information message reading “ ZBAPIFMT001” inserted.
Now save after you add the method. Selec...
The above screen is displayed. Go to the ABAP tab as shown below.
Select the Radio button reading “API Function” as already said above.
click on the continue icon to proceed further.
Now select the Object “ZBAPI_T001” as shown below.
Go to : EditàChange Rele...
The above shown screen will be displayed. Click on yes.
The message shows, The object type status set to modeled. (or alre...
You can see a message reading “Object type status set to implemented”
Now, go to: EditàChange Release StatusàObjectàTo Rel...
You can see the message reading “ status for method ‘zbapifmt001’ set to modeled”.
Now, go to: EditàChange Release Statusà...
You can see the message reading “ status for method ‘zbapifmt001’ set to Released”.
Click on Generate Button. (the red bal...
You can click on the Alphabetical tab so that you can browse the BAPI’s in an alphabetical order.
Find your BAPI as shown....
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Test Your BAPI.
Enter the name of your BAPI in t...
The above screen is displayed where you would require entering the data against the empty input
fields.
We have entered some data in the Field.
After entering the data, click on the execute icon as shown below.
The following s...
Click on the Edit table icon as shown below.
The results as per our input are as shown below.
By this, we would get it confirmed that our BAPI is working properly.
We can even check it by passing different values aga...
Hit on the execute icon.
In the above shown screen, hit on the edit table icon.
The above is the output we get from the input we provided.
We are now done with the creation and successful execution of a...
Upcoming SlideShare
Loading in …5
×

Step by-step creation of a bapi in detailed steps with scr…

912 views
889 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
912
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
65
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Step by-step creation of a bapi in detailed steps with scr…

  1. 1. Custom BAPI creation - Step-by-step Procedure Scenario: Step-by-step creation of a BAPI to retrieve fields from table T001. Procedure: Go to transaction SE11 and create a structure as shown or as per your requirement. Give the name in the Data type field and click create. In the pop-up that comes up, select the radio button “ structure”.
  2. 2. In the components tab of the structure, give the different fields and their corresponding field types and press enter to check the compatibility and corrective ness. Do not forget to save it in a package. You can even save it as a local object. For my example, I save it in a package.
  3. 3. Check the structure (ctrl + F2) and activate (ctrl + F3) the structure. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Now we are done with the creation of a Structure. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Go to transaction SE37 where you create function modules. Click on create after you enter the name of the Function module.
  4. 4. A screen as shown above would pop-up where you mention the function group to save the function module and also provide some short text describing your function module. In the next pop-up that follows, click on continue as shown above.
  5. 5. The function module screen would look like the one above. Go to the Attributes tab and select the radio button reading “remote-enabled module”. Come back to the imports tab and provide the import parameters as shown or as per your requirement.
  6. 6. Now in the Export tab, provide the export parameters as shown or as per your requirement. In the tables tab, provide the information as shown or as per your requirement. The next screen you visit is the source code. It would look like this.
  7. 7. In the source code tab, write the following code in order to pick the data based on the input you provide. Now, save and check the code and activate the function module. After successful activation, Go to the attributes tab. Go to Function moduleàReleaseàRelease.
  8. 8. +++++++++++++++++++++++++++++++++++++++++++++++ Now we are done with the creation of a Function Module. +++++++++++++++++++++++++++++++++++++++++++++++ Go to transaction SWO1 and enter the name of the BAPI you would like to create or as shown in the screen and click the create button. Give the name of the BAPI as above and click on create.
  9. 9. Give the above-mentioned details and click on the continue icon. Save in a package. The resulting screen is as follows.
  10. 10. Now click on the methods to drop down and see what methods are provided by default. There would be two methods, showing in red color which come by default while creating the BAPI. Click or select the method as shown above and go to the path “UtilitiesàAPI methodsàAdd methods”.
  11. 11. On the screen that follows, provide the function module name and click on the continue icon. In the ultimate pop-up, click the next step icon. We observe that the information is predefined in the fields. This is the next screen where you would just click on the “next” icon.
  12. 12. Click on Yes. You can see an information message reading “ ZBAPIFMT001” inserted. Now save after you add the method. Select & Double click on the API method. Go to Tab: ABAP Check 'API Function'.
  13. 13. The above screen is displayed. Go to the ABAP tab as shown below.
  14. 14. Select the Radio button reading “API Function” as already said above.
  15. 15. click on the continue icon to proceed further. Now select the Object “ZBAPI_T001” as shown below. Go to : EditàChange Release StatusàObject type àTo Modeled.
  16. 16. The above shown screen will be displayed. Click on yes. The message shows, The object type status set to modeled. (or already modeled) Go to : EditàChange Release StatusàObject type à To Implemented.
  17. 17. You can see a message reading “Object type status set to implemented” Now, go to: EditàChange Release StatusàObjectàTo Released. There would be two pop ups coming up. Click continue on the Pop Ups. Keep the cursor on the 'Method'. Go to: EditàChange Release StatusàObject type componentàTO Modeled.
  18. 18. You can see the message reading “ status for method ‘zbapifmt001’ set to modeled”. Now, go to: EditàChange Release StatusàObject type componentà TO Implemented You can see the message reading “ status for method ‘zbapifmt001’ set to implemented”. Now go to: EditàChange Releasse Status à Object type component à To Released
  19. 19. You can see the message reading “ status for method ‘zbapifmt001’ set to Released”. Click on Generate Button. (the red ball kind of button is the Generate button) After clicking on the generate button, you can see the message reading “Object type 'ZBAPI_T001' generated successfully”. Now go to BAPI Tcode (BOR) there we can find the BAPI (our BAPI) The BAPI browser would look like the screen below.
  20. 20. You can click on the Alphabetical tab so that you can browse the BAPI’s in an alphabetical order. Find your BAPI as shown. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Now we are done with the creation of a BAPI.
  21. 21. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Test Your BAPI. Enter the name of your BAPI in the transaction SWO1 and click on ‘Test’. The above screen is displayed. Click on the Execute icon against the BAPI as shown.
  22. 22. The above screen is displayed where you would require entering the data against the empty input fields.
  23. 23. We have entered some data in the Field. After entering the data, click on the execute icon as shown below. The following screen is displayed which has some values as is indicated by the ITEMTAB.
  24. 24. Click on the Edit table icon as shown below. The results as per our input are as shown below.
  25. 25. By this, we would get it confirmed that our BAPI is working properly. We can even check it by passing different values again. Come back to the input and execution screen. After executing the BAPI based on the input provided, we get the following screen.
  26. 26. Hit on the execute icon. In the above shown screen, hit on the edit table icon.
  27. 27. The above is the output we get from the input we provided. We are now done with the creation and successful execution of a BAPI. For more Tips, Tutorials, Certification Questions and Interview Questions, please visit SAPTechnical.com

×