BAPI in SAP ABAP
BAPI in SAP ABAP
Contributed by
Sana Shaikh
Under the guidance of TagSkills
Some BAPIs and methods provide basic functions and can be used for most
SAP Business Objects.These are called STANDARDIZED BAPI’s.
Example
The functions that are implemented in the SAP business CostCenter object type
include, for example, listing all the available cost centers. The business object
type CostCenter provides the BAPI GetList() for this purpose.
GetList ( ) With the BAPI GetList you can select a range of object key values,
for example, company codes and material numbers.
The following BAPIs of the same object type have to be programmed so that
they can be called several times within one transaction. For example, if, after
sales order 1 has been created, a second sales order 2 is created in the same
transaction, the second BAPI call must not affect the consistency of the sales
order 2. After completing the transaction with a COMMIT WORK, both the
orders are saved consistently in the database.
Change( )
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a
business object type. The instance to be cancelled remains in the database and
an additional instance is created and this is the one that is actually canceled. The
Cancel() BAPI is an instance method.
Select the business object, according to the functional requirement for which the
BAPI is being created.
Step 2) Open the business object in change mode. Then Select Utilities ->API
Methods ->Add method. Then enter the name of the function module and select
Continue.
Step 4) After the program has been generated and executed, check the program
in the method just created. Thus , a BAPI is created.
To release the BAPI , first release the function module ( using transaction
se37 ) .
Set the status of the method to ‘released’ in the Business Object Builder (
using transaction SWo1 – Edit-> change status-> released. )
You can also use the BAPI Explorer (Transaction code BAPI) for 360′ view on
BAPI
You can make your function module remotely enabled in attributes of Function
module .
In the SAP system, BAPIs are stored as RFC-capable function modules in the
ABAP Workbench Function Builder. BAPIs have standard business interfaces
that enable external applications (with the help of SAP business objects) to
access SAP processes, functions and data.
Client programs that use BAPIs to access SAP business objects can be part of
the same SAP system, part of an external system (for example, a .Net
application), part of an HTTP Gateway, or part of another SAP system.
If you want to use a BAPI to trigger a business process in another system, you
usually use the synchronous communication methods RFC, because in most
cases, you want the data to be returned to the sending system.
The BAPIs in the SAP Systems are currently implemented as function modules,
which are created and managed in the Function Builder. Each function module
underlying a BAPI:
The graphic below shows the relationship between an SAP business object type,
its associated BAPIs and its function modules.
BAPI is the new enhanced Application Interface through which data can be
uploaded into SAP System.
BDC is transaction oriented. Meaning, the data is uploaded into SAP through
standard transactions. All checks, validations,exits that are applicable to the
transaction are active while loading data into SAP.
Whereas BAPI is an interfacing method, through which SAP data can be processed
from within SAP or from other non-SAP applications. BAPI can be termed as
SAP transaction without dialog. All the screens of particular transaction is
converted in the form of a Code Module.
We can establish on-line interface with SAP data from non-SAP applications
through BAPI's if they are enabled for Remote Access.
Generally BDC is preferred if the data from the legacy system is moved to SAP
single time. For example, at the time of Go-Live the data required for SAP is
either downloaded from other software or manually prepared in excel sheets and
uploaded into SAP at once. After that data or SAP has nothing to do with other
software.
BAPI BDC
BAPI is used only when it is available for BDC can be used for any
the particular transaction like Delivery transaction which have screen
Sales order. and fields.
Objective :
Uploading single record in database table Using BAPI.
steps :
1: Search for BAPI: So BAPI_BANK_CREATE is the function module that can
help to upload the data.
OUTPUT: