Steps To Create BAPI
Steps To Create BAPI
BAPI is a remote enabled function module, which is used to communicate between SAP to SAP, SAP
to NON-SAP systems.
BAPI RFC function module will be inserted into business object, it will convert into BAPI.
Uses of BAPI
Generating reports.
For communication between different servers SAP-SAP or SAP- NON-SAP.
BAPI`s can be used for data migration.
BAPI RFC
Used for communication Between SAP SAP Used for communication Between SAP SAP and
and SAP non-SAP SAP non-SAP
BAPI is a part of business object, it can RFC is a standalone function module, it cannot
communicate with other BAPI`s. communicate with other RFC`s
BAPI Uses Object Oriented concepts RFC uses procedure oriented concepts
We know BAPI is a remote enable function module but when ever we are creating a BAPI, we need
to follow some rules.
Step 1: Create structures for required importing and exporting parameters in SE11.
Step 2: Go to SE37, create a remote enabled Function module to get material details for material
input.
Do not save it in a local object, we cannot make BAPI methods with non-transportable objects.
To insert RFC into business object, click on Utilities -> API Methods -> Add Method.
A popup will come, provide RFC function module name and enter.
We have inserted a RFC function module into methods of business object, now we need to do two
things.
BAPI can be used in report development, in the example program we will develop a report to display
material basic details for a material input.
To get material details for a material we use BAPI_MATERIAL_GET_DETAIL (go to SE37 check).
REPORT ZSAPN_BAPI_MATERIAL.
PARAMETERS: P_MATNR TYPE MARA-MATNR.
DATA : MAT_DATA TYPE BAPIMATDOA.
START-OF-SELECTION.
CALL FUNCTION 'BAPI_MATERIAL_GET_DETAIL' "get material details
EXPORTING
MATERIAL = P_MATNR
* PLANT =
* VALUATIONAREA =
* VALUATIONTYPE =
* MATERIAL_EVG =
IMPORTING
MATERIAL_GENERAL_DATA = MAT_DATA
* RETURN =
* MATERIALPLANTDATA =
* MATERIALVALUATIONDATA =
.
WRITE: / MAT_DATA-MATL_DESC, MAT_DATA-MATL_TYPE, MAT_DATA-IND_SECTOR, MAT_DATA-
MATL_GROUP.
Execute the above program and test.