Bapi

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

To create the custom BAPI, we need to follow this step-by-step procedure. The steps are 1. 2. 3. 4.

Create the BAPI structure. Create Remote Function Module. Place the Remote Function Module into BOR (Business Object Repository). (Using TCODE SWO1) Implement, Generate and Release the BAPI.

Custom BAPI creation:Agenda: - to retrieve data from table T001 Step 1:- go to TCODE se11 and create a structure ZBAPISTRT001.

Fields are BUKRS BUTXT ORT01 LAND1 Step 2:Go to TCODE se37 to create a FM. (ZBAPI_FMT001). Enter the function group also. In attributes, select it as RFC. In import tab, provide BUKRS like ZBAPISTRT001-BUKRS. EXPORT TAB: - RETURN type BAPIRETURN. In the table tab ITEMTAB LIKE ZBAPISTRT001.

Return parameter in the Export parameter contains the error messages. Here, we must create a parameter of type structure BAPIRETURN either in Export Parameter or Table Parameter In the source code tab write the following code:Select BUKRS BUTXT ORT01 LAND1 From T001 Into table ITEMTAB Where BUKRS = BUKRS Then go to function module tab in menu bar select release. Now we are done with creation of function module. Step 3:- Creation of BAPI. Go to transaction SWO1. Enter the name of BAPI name you want to create. ZBAPI_T001. (SELECT OBJECT TYPE).

Then save it in a package. The resulting screen is as follows.

Click on the drop down in method and we can check what default method is there. Suppose BAPI name ZBAPI_T001. Then 2 methods will be created automatically. ZBAPI_T001.EXISTENCECHECK (check existence of object) ZBAPI_T001.DISPLAY. (Display Object)

For adding new methods go to Utilities -> API ->methods-> add methods

Provide the FM name and click on the continue icon. FM we have created earlier ZBAPI_FMT001. FM should be synchronous

Why it is synchronous and instance-independent?

Select API function in ABAP tab.

Now select the Object ZBAPI_T001 as shown below. .

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

Go to edit->change release status -> object type -> to implemented.

Now, go to edit->Change Release Status Object To Released So we did it for object type that is ZBAPI_T001, now same procedure we will follow For methods. Select the methods ZBAPIFMT001. Go to: Edit->Change Release Status ->Object type component->TO Modeled

Go to edit->change release status -> object type -> to implemented

Now, go to edit->Change Release Status Object To Released

Now we can see the message status of method zbapifmt001 set to implemented.

Now go to: Edit->Change Release Status->Object type component-> To Released

Click on Generate Button. (The red ball kind of button is the Generate button).

Now you can go to the BAPI TCODE. Select alphabetical order so that our BAPI we can find easily.

Step 4:- test our BAPI. Enter the name of your BAPI in the transaction SWO1 and click on Test.

Click on test. The following screen will appear.

Click on execute button displayed

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

Then enter the input filed value and execute it.

The result as input shown below.

BAPI executed successfully. ********************************************Questions********** BAPI are RFC enabled function modules. The difference between RFC and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. What is single and up to one row different? The Major difference between Select Single and Select UPTO 1 rows is The Usage Of Buffer for each. Select Single will search for all the satisfied data and bring all that data into Buffer and later it will give to that data to the program. Select UPTO 1 Rows will end the search after getting the 1st satisfied record and gives that record to the program. Thus Select Single will take much processing time when compare with Select UPTO 1 rows. 6. Question: The BAPI was processed successfully. Why does the document still not exist or why was it not changed? Answer: BAPIs do not execute a COMMIT WORK command that triggers the update. This is done by the calling program. For this purpose, use the BAPI_TRANSACTION_COMMIT BAPI.

BAPI Just as Google offers Image/Chart/Map APIs OR Facebook offers APIs for Comment/Like, SAP offers APIs in the form of BAPIs. BAPI is a library of function modules released by SAP to the public so that they can interface with SAP. There is a Business Object Associated with a BAPI. So a BAPI has an Interface, Key Field, Attributes, Methods, and Events.

RFC RFC is nothing but a remote enabled function module. So if there is a Function Module in SAP system 1 on server X , it can be called from a SAP system 2 residing on server Y. No Business Object is associated with a RFC.

Outside world (JAVA, VB, .Net or any Non SAP system) can connect to SAP using a BAPI. Error or Success messages are returned in a RETURN table.

NonSAP world cannot connect to SAP using RFC. RFC does not have a return table.

BAPI would generally use for small data uploads in comparison to BDC.

You might also like