how to create bapi

51
How to Create BAPI PRESENTED BY www.saptechies.org

Upload: rohit-mahajan-totu

Post on 18-May-2015

748 views

Category:

Technology


6 download

DESCRIPTION

SAP Techies is a question and answer site for professional and enthusiast programmers. It's built and run by you as part of the SAP Techies Exchange network. With your help, we're working together to build a library of detailed answers to every question about SAP.

TRANSCRIPT

Page 1: How to create bapi

How to Create BAPI

PRESENTED BYwww.saptechies.org

Page 2: How to create bapi

• 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.

Page 4: How to create bapi

• In the pop-up that comes up, select the radio button “ structure”.

Page 5: How to create bapi

• 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.

Page 6: How to create bapi

• 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.

Check the structure (ctrl + F2) and activate (ctrl + F3) the structure.Now we are done with the creation of a Structure.

Page 7: How to create bapi

Go to transaction SE37 where you create function modules. Click on create after you enter the name of the Function module.

Page 8: How to create bapi

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.

Page 9: How to create bapi

In the next pop-up that follows, click on continue as shown above.

Page 10: How to create bapi

The function module screen would look like the one above.

Page 11: How to create bapi

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.

Page 12: How to create bapi

Now in the Export tab, provide the export parameters as shown or as per your requirement

Page 13: How to create bapi

In the tables tab, provide the information as shown or as per your requirement.

Page 14: How to create bapi

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.

Page 15: How to create bapi

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.

Page 16: How to create bapi

Give the name of the BAPI as above and click on create

Page 17: How to create bapi

Give the above-mentioned details and click on the continue icon.

Page 18: How to create bapi

Save in a package.

The resulting screen is as follows.

Page 19: How to create bapi

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.

Page 20: How to create bapi

Click or select the method as shown above and go to the path “Utilities->API methods->Add methods”.

On the screen that follows, provide the function module name and click on the continue icon.

Page 22: How to create bapi

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.

Page 25: How to create bapi

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.

Page 26: How to create bapi

The above screen is displayed. Go to the ABAP tab as shown below.

Page 28: How to create bapi

click on the continue icon to proceed further.

Now select the Object “ZBAPI_T001” as shown below.

Page 29: How to create bapi

Go to : Edit -> Change Release Status->Object type ->To Modeled.

Page 31: How to create bapi

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.

Page 32: How to create bapi

You can see a message reading “Object type status set to implemented”

Now, go to: Edit -> Change Release Status -> Object -> To Released.

Page 33: How to create bapi

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.

Page 34: How to create bapi

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

Page 35: How to create bapi

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

Page 36: How to create bapi

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)

Page 37: How to create bapi

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.

Page 38: How to create bapi

You can click on the Alphabetical tab so that you can browse the BAPI’s in an alphabetical order. Find your BAPI as shown.

Page 39: How to create bapi

Now we are done with the creation of a BAPI.

• Test Your BAPI.

Page 40: How to create bapi

Enter the name of your BAPI in the transaction SWO1 and click on ‘Test’.

Page 41: How to create bapi

The above screen is displayed. Click on the Execute icon against the BAPI as shown.

Page 42: How to create bapi

The above screen is displayed where you would require entering the data against the empty input fields

Page 43: How to create bapi

We have entered some data in the Field.After entering the data, click on the execute icon as shown below.

Page 44: How to create bapi

Click on the Edit table icon as shown below.

Page 45: How to create bapi

The results as per our input are as shown below.

Page 46: How to create bapi

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.

Page 47: How to create bapi

After executing the BAPI based on the input provided, we get the following screen.

Page 48: How to create bapi

Hit on the execute icon.

Page 49: How to create bapi

In the above shown screen, hit on the edit table icon.

Page 50: How to create bapi

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.

Page 51: How to create bapi

• Thanks for watching this Presentation• Find more SAP Articles, SAP Jobs,SAP Courses • Visit www.saptechies.org