How To Create a Custom Bapi
How To Create a Custom Bapi
Cross Application: Sap Cross applications are part of the Interface which helps to transfer the data
between 2 systems.
With the help of cross-application, we can transfer the data between sap-to-sap, sap-to-non-sap, and
non sap-to-sap systems.
Requirement: The customer will provide the employee data in the file and transfer that data into our
custom table using BAPI.
we will migrate the data in SAP using bapi with idoc interface.
Step 2:- Migrate the employee data using the business object method (BAPI).
Business Application Programming Interface, Bapi is an interface that enables external access to the
business process of the SAP system.
the external system is getting access to those business processes through Bapi only, the external system
will send the data to Bapi and baPi will create all those things like sales orders.
an external system can be a sap or a non-sap system ( which uses other languages like java, c++, or
Visual Basic) can be called bapi.
bapi in the sap system is implemented in the form of a function module only.
bapi = fm + business object. (Bapi is a function module having a business object) if that function module
doesn't has any business object then it is not a bapi.
once we create the fm then we will create a business object then our bapi will be defined in the business
object repository we will simply be called as BOR. Once our BAPI is ready we have a dedicated t-code
BAPI (BAPI explorer). there we can check our bapi there.
1
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
2
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
1). Function module name must starts with <namespace> BAPI <business_object>_<method>.
2). All parameters associated type must begin with <namespace> BAPI
Let's create FM
3
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
in importing, exporting we define our parameters and in source code, we write the logic
4
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
For the second prerequisite, we need to create a type with Zbapi to fulfill our second prerequisite.
now let's pass this structure to Zbapi to fulfill our second prerequisite.
if you dont wanna go with structure type and want to go single parameters then you can also go with
that also.
5
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
6
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
7
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
Fm must be rfc.
8
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
It is fully released.
Object type - internal identification of the business object (to identify the business object within sap ).
Supertype - you are creating a new object type with the help of an existing type. Or to inherit the
component of the existing object type.
Object name - it is the external identification of business object (using this property external system can
interact with sap system).
Name- a descriptive name of the business object. (business object for employee data).
Zprg_employee
Application - * (cross-application)
9
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
10
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
11
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
NEXT STEP
12
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
13
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
1) modeled - whenever you are defining things the status will be modeled (components of the business
object )
2). implemented - the business object components have got full functionality implemented and these
can be used for internal purpose (within sap ) and for testing purpose.
3) . Released - once it is released only it can make entry in bapi Explorer and can be invoked from an
external system (non-sap).
14
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
15
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
It is inserted successfully.
16
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
For now, in bapi t-code there is no bapi with the name employee
17
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
18
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
It is now released but it will not show it in bapi t-code because we need to also generate it.
19
Made By Rahul Sharma SAP ABAP ASSOCIATE CONSULTANT
Everything same
20