Anda di halaman 1dari 16

IBM Global Services

2005 IBM Corporation Use of BAPIs for Data Interfacing |


7.12.03
March-2005
Use of BAPIs for Data Interfacing
IBM Global Services
2005 IBM Corporation 2 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Objectives
The participants will be able to :
Recall the basic techniques of using BAPI.
Learn process flow of mass data transfer using BAPIs in the DX Workbench.
IBM Global Services
2005 IBM Corporation 3 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Mass Data Transfer : Process flow
We will discuss
use of BAPI in
detail in this
chapter
Clean
Extract Map
Load
Check
IBM Global Services
2005 IBM Corporation 4 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Mass Data Transfer : Process flow (Contd.)
We will discuss
use of BAPI in
detail in this
chapter
Clean
Extract Map
Load
Check
IBM Global Services
2005 IBM Corporation 5 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
BAPI : Overview
Business Application Programming Interfaces (BAPIs) are standardized
programming interfaces that provide external access to SAP business processes
and data.
BAPIs are defined in the Business Object Repository (BOR) as methods of SAP
business objects or SAP interface types.
BAPIs enable an object-oriented access to SAP application components.
BAPIs are implemented and stored as RFC-enabled function modules in the
Function Builder of the ABAP Workbench.
IBM Global Services
2005 IBM Corporation 6 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
BAPIs as Interfaces
When using BAPIs as interfaces to the SAP System, the Workbench uses the
same technology as used with permanent data transfer via ALE between SAP
Systems or between SAP Systems and non-SAP systems.
The data to be loaded must be in IDoc format. The IDoc numbers in the file must
be unique.
When the task is started, the IDocs from the specified input files are read and
transferred to the BAPI.

IBM Global Services
2005 IBM Corporation 7 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Why use BAPIs in Data Interfacing?
The use of BAPIs is increasingly important, because the previous techniques are
only of limited or no use for data transfer from Release 4.6 onwards:
The batch input procedure CANNOT be used for the new Enjoy transactions because
the batch input recorder does not support the controls used in these transactions.
The administration transaction associated with the direct input method will no longer be
supported from Release 5.0 onwards (at the latest). This means that existing direct
input programs can be used, but the data transfer should be converted to BAPIs in the
medium term.
When you use call transaction, you have to specify values for all the mandatory fields
on a screen. You can't update a single field, if there are some more fields which are
mandatory in the same screen. But, when you use BAPI you can update individual
fields without having to specify other fields.
If you use CALL TRANSACTION you have to do a new recording each time the screens
of a particular transaction changes. But, if you are using BAPI to update fields, it does
not matter, where on the screen or in which screen a particular field resides. This is due
to the fact that BAPI updates through structures that are mapped directly with database
tables, so position of the fields on the screen does not matter.
Data Interfacing through BAPIs greatly increase the performance as the updates are
done directly through structures.
IBM Global Services
2005 IBM Corporation 8 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Developing BAPIs for Mass Data Transfer
The following aspects are relevant for developing a BAPI that can be used for
mass data transfer in the DX Workbench:
Implementing a BAPI
BAPIs for mass data transfer must be developed as described in the BAPI
Programming Guide. All write BAPIs can potentially be used for mass data processing.
Generating the BAPI-ALE Interface
Since the data for the BAPI call is received in the SAP System in IDoc format, the BAPI-
ALE interface has to be generated to automate the mapping of the IDoc to the
parameters of the BAPI.
Writing a report
The report is responsible for writing existing R/3 objects in IDoc format to a file. This
report is required, since it is the only way for users to establish the connection between
the online transaction, the BAPI, and the IDoc.
Registering a BAPI
This step is required if the BAPI will be used in the DX Workbench. To register the
BAPI, including its corresponding report, use transaction BDLR.

IBM Global Services
2005 IBM Corporation 9 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Process Flow of Mass Data Transfer With BAPI
Determine how the
data used for BAPI is
to be represented in
IDoc
Generate Idocs for a
BAPI whose
parameters have
been filled with data
from an existing R/3
object
Generate default
Idocs for a BAPI
without application
data
DX Workbench
Step 1: Analyzing the underlying structures
IBM Global Services
2005 IBM Corporation 10 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Process Flow of Mass Data Transfer With BAPI (Contd.)
External format data
IDoc format of the
transfer file
Mapping
LSMW/External
mapping tool
Transfer file
imported to
target system
Step 2:Mapping the non-SAP system data in SAP format
IBM Global Services
2005 IBM Corporation 11 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Process Flow of Mass Data Transfer With BAPI (Contd.)
Transfer file
received in the
target system
Each IDoc is read and
its contents are
mapped to the
parameters of
corresponding BAPI
BAPI carries out
required business
checks & updates
database.
If the BAPI
call
fails,error
message
is returned
in the
BAPI
Return
parameter
Step 3:Performing the actual data import
IBM Global Services
2005 IBM Corporation 12 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Use of BAPI in custom programs
LOOP AT <itab> INTO <work area>.
.. Populate all structures to be passed into BAPI
*Call BAPI to change material master data with future
*planned prices & future planned date.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA
DESTINATION RFC_DEST
EXPORTING
headdata = t_headdata
valuationdata = t_valuationdata
valuationdatax = t_valuationdatax
IMPORTING
return = w_return
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT
SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT.
.. Handle w_return appropriately here.
ENDLOOP.
2 special system
exceptions with
addition
DESTINATION
Depending on
destination,FM is
executed in
another R/3
system.
IBM Global Services
2005 IBM Corporation 13 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Demonstration
Using BAPI function modules instead of Call Transaction to update Material data.
IBM Global Services
2005 IBM Corporation 14 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Practice
Using BAPI function modules instead of Call Transaction to update Material data.

IBM Global Services
2005 IBM Corporation 15 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Summary
Mass Data Transfer technically involves 5 steps :
Analysis & Cleanup of data in Non SAP system,
Extraction of data from the non-SAP system,
Mapping the data in SAP format,
Transferring the data to the SAP System,
Checking the data for consistency in R/3.
The batch input procedure CANNOT be used for the new Enjoy transactions
because the batch input recorder does not support the controls used in these
transactions. Hence use of BAPI is becoming increasingly important.
Data Interfacing through BAPI is performance efficient.
IBM Global Services
2005 IBM Corporation 16 March-2005 Use of BAPIs for Data Interfacing | 7.12.03
Questions
What is SAP Control Framework ?
What is container control ? What are their types ?
Which class encapsulates the functionality of ALV grid in OOPs ?
What are the steps required to build an ALV report using OOPs concept ?
How to handle events in ALV using OOPs concept ?

Anda mungkin juga menyukai