Professional Documents
Culture Documents
Bapi S
Bapi S
Overview
Overview
BAPI stands for
BUSINESS APPLICATION PROGRAMMING INTERFACE
It is also called as B+API
BUSINESS OBJECT REPOSITARY (BOR) :
It is a Repository of Business objects or container of
Business objects.
SWO1 is the tcode for Business objects
BUSINESS OBJECT(BO) :
It is an object which is similar to class, which is group of
attributes methods, interfaces, key fields, events for a
particular Business Application or Scenario.
SWO1 is the TCODE for Business Object Repository
Examples for Business objects are,
BUS1001 – Materials
BUS2012 – Purchase Order
BUS1001
Methods are :
BAPI_Material _Get detail
BAPI_Material_GETLIST
BUS2012
Methods are :
BAPI_PO_GETDETAIL
BAPI_PO_GETITEMS
What is BAPI?
BAPI:
It is also an Remote Enable function module which is
used to communicate between SAP-SAP or SAP-
NONSAP servers.
Basically BAPI uses RFC Technology
In the Initial stage it is a RFC Function module
Later, this RFC Function module will be inserted into a
business object, Now it is converted into BAPI.
Both are used to communicate between SAP-SAP &
NONSAP-SAP.
Both are remote enabled FM
The difference is,
RFC’s are called as Standalone Function Modules.
BAPI’s are part of Business Objects which are used to
communicate with other BAPI’s, events, Interfaces,
attributes, Key fields etc., with in a single B.O.
This is not possible with RFC’s. Because they are
standalone FM’S
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 11
Overview
USAGE OF BAPI’S
BAPI’S are used in 3 scenarios.
1)Report generation using BAPI’S
2)Using standard or custom BAPI to communicate
between SAP & NONSAP
3)Using BAPI’s for uploading data into SAP instead of
BDC.
RULES FOR BAPI’S:
Every BAPI should start with BAPI or ZBAPI.
All the Importing and Exporting parameters should be of
Type structures, not the direct Data Types.
All the structures must start with BAPI or ZBAPI.
All the Parameters must be pass by Value because
BAPI’S doesn’t support pass by reference.
Every BAPI should have a returning Parameter by Name
RETURN or BAPIRET2, to display success or error
messages.
SAP AG 2001, Smart Forms - the Form Printing Solution,
Claudia Binder / Jens Stumpe 15
Overview
If BAPI is Success, we have to use another BAPI
BAPI_TRANSACTION_COMMIT to Save the Data into
Database Tables.
If the BAPI has error, use another BAPI
BAPI_TRANSACTION_ROLLBACK to revert back the
changes made to the Database Tables.
Report generation using BAPI’S
Reports:
Develop a Report which displays Material Details
Develop a Report which displays list of the Materials for
a given Range.
BAPI_MATERIAL_GETLIST_PROG.txt
Develop a report which displays PO Details
Develop a report which displays list of items for a PO .
Developing Custom BAPI
Develop a Custom BAPI to display the Material details
which can be used by NON-SAP.
Step 1: Create structures for Importing and Exporting
Parameters.
Step2: Create a function module and make it as remote
enabled.
Step3 : Create a BO.
Step4 : Embed or insert RFC into BO so that it will be
converted into BAPI.
Step 1: Create structures for Importing and Exporting
Parameters.
Go to SE11
Create a structure by Name ZBAPI_MATNR
Create a single field MATNR.
Again Go to SE11
Create another structure by name ZBAPI_MARA
Create the fields MATNR, MTART, MBRSH, MEINS
Step2: Create a function module ZBAPI_MAT_GET_DET
and make it as remote enabled
Goto SE37
Create a function module ZBAPI_MAT_GET_DET
Specify importing parameter as below with pass by
value.
Specify Exporting parameter as below with pass by
value.
Ssssssssssssssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssssssssss
ssssssssssssssssssssssssssssssssssssssssssssssss
Specify returning parameter as below:
Write the below source code:
FUNCTION ZBAPI_MAT_GET_DET.
select SINGLE * from mara
into CORRESPONDING FIELDS OF mara
WHERE matnr = matnr .
ENDFUNCTION.
Save it.
Make the FM as REMOTE ENABLED .
Save, Activate and test it .
Step3 : Create a BO
Go to SWO1Give the BO name as ZYBUS1001
Click on CreateSpecify the details as below :
Put the cursor on methods
Give the Function Module name as
ZBAPI_MAT_GET_DET
Press enter
Again click on NEXT STEP button
A pop-up is displayed with below message
Click on Yes
Now our RFC is converted into BAPI
Click on SAVE Click on BACK
Goto Object Type Change Release Status
Implemented
Again Go to Object Type Change Release Status
Released
Now our Business Object is released and it can be
visible/used by NON-SAP System
Mapping from NON-SAP fields to BAPI fields will be
done by NON-SAP Consultants.
The Remote connection between SAP and NON-SAP
Servers will be done by BASIS Consultants
As an ABAP Consultant, our role is to develop a BAPI
and give it to NON-SAP Consultants
BAPI’S For uploading Data
Business Requirement:
Develop a program for uploading material
master data.
Interview Questions