Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 20

BATCH DATA

COMMUNICATION(BDC)
Introduction to BDCs
Let us assume that we have installed SAP
R/3 in a company.
This company has data pertaining to
different modules in legacy system (other
systems like Oracle, sybase databases etc.,).
This data has to be transferred in to R/3
system.
Introduction to BDCs contd.

Transfer of data from legacy system to R/3
is possible through BDC.
There are 2 steps involved in this data
transfer.
Conversion
SAP data transfer
Conversion

Data is first converted from legacy system
into required flat file format.
Conversion contd.
There is no specific tool in SAP to do this
conversion.
C, COBOL > Conversion programs.
Oracle or Sybase > Export utilities.
Format editors or code generators.
You can write ABAP/4 programs to do this job.
SAP data transfer

SAP Data transfer program reads flat file
and moves it into R/3 system.
Data Transfer Methods

You can use the following methods to transfer data:

Direct input: With DIRECT INPUT, the SAP function
modules execute the consistency checks. However
with batch input, these consistency checks are
executed with the help of the screens. This means that
direct input has considerable performance
advantages.

CALL TRANSACTION: Data consistency check with
the help of screen logic.

Batch input with batch input sessions : Data
consistency check with the help of screen logic.


With CALL TRANSACTION USING, the system processes the
data more quickly than with batch input sessions. Unlike batch
input sessions, CALL TRANSACTION USING does not
automatically support interactive correction or logging
functions.
Your program prepares the data and then calls the
corresponding transaction that is then processed immediately.
The most important features of CALL TRANSACTION USING
are:
Synchronous processing
Transfer of data from an individual transaction each
time the statement CALL TRANSACTION USING is
called
You can update the database both synchronously and
asynchronously
Separate LUW (logical units of work) for the
transaction
No batch input processing log


Overview
5-268
Batch input
BDC table
Sequential
file
Queue
file
Application function
Batch input function
SAP
databases
Call transaction
BDC table
Sequential
file
Application function
SAP
databases
CALL
TRANSACTION
The CALL TRANSACTION Statement
5-269
CALL TRANSACTION <transaction code>
USING <BDC table>
MODE <display mode>
UPDATE <update mode>
MESSAGES INTO <messtab>
A Display all
E Display only if there are errors
N Display nothing
S
Do not continue processing until
update has finished (synchronous)
A Continue processing immediately
<display mode>:
<update mode>:
The MODE Parameter
You can use the MODE parameter to specify whether data transfer
processing should be displayed as it happens.

The UPDATE Parameter
You use the UPDATE parameter to specify how updates produced
by a transaction should be processed.

The MESSAGES Parameter
The MESSAGES specification indicates that all system
messages issued during a CALL TRANSACTION USING are
written into the internal table <MESSTAB> . The internal table
must have the structure BDCMSGCOLL

Technical Implementation
5-270

REPORT.....
DATA: BEGIN OF <BDC table> OCCURS.....
INCLUDE STRUCTURE BDC_DATA.
DATA: END OF <BDC table>.
:
PERFORM GENERATE_BDC_DATA.
CALL TRANSACTION <transaction code>
USING <BDC table>
MODE <display mode>
UPDATE <update mode>
:
CASE SY-SUBRC.
:
............................
............................
............................
................................
...............................
...............................
Roll area 1
Roll area 2
Return Codes and System Fields
5-273
Meaning
0 Successful
<1000 Error in dialog program
>1000
Error in batch input processing
(see system fields)
Return codes
Field name Meaning
Message ID
SY-MSGTY Message type (EIWSA)
SY-MSGNO Message number
SY-MSGV1 Message variable 1
SY-MSGV2 Message variable 2
SY-MSGV3 Message variable 3
Value
SY-MSGID
System Fields
Message Output
5-274
REPORT RSFFF05B.
......
CALL TRANSACTION TFBA
using BDC_TAB
MODE DISMODE
UPDATE UPMODE.
MESSAGES INTO MASSTAB.
MESSAGE ID SY-MSGID
TYPE SY-MSGTY.
NUMBER SY-MAGNO
WITH SY-MSGV1 SY-MSGV4.
........

Batch Input / CALL TRANSACTION - Summary
5-275
Batch Input
Return code No
Error logging Yes
Processing Time-delayed
CALL TRANSACTION
Yes
No
Immediately
Reading Data From Application Server
Or Presentation Server
ABAP/4
PROGRAM
Internal
Table
Presentation
Server
Application
Server
WS_UPLOAD
READ DATASET
WS_UPLOAD
To read data from the presentation server into an internal table
without a user dialog, use the function module WS_UPLOAD.
For more information, refer to the function module documentation in
the Function Builder (Transaction SE37).

UPLOAD
To read data from the presentation server into an internal table with a
user dialog, use the function module UPLOAD.

WS_DOWNLOAD
To write data from an internal table to the presentation server without
using a user dialog, use the function module WS_DOWNLOAD.

DOWNLOAD
To write data from an internal table to the presentation server using a
user dialog, use the function module DOWNLOAD.




Reading Data from Files

To read data from a file on the application server, use the READ
DATASET statement:

Syntax
READ DATASET <dsn> INTO <f> [LENGTH <len>].

This statement reads data from the file <dsn> into the variable <f>.
In order to determine into which variable you should read data
from a file, you need to know the structure of the file.

You can specify the transfer mode in the OPEN DATASET
statement. If you have not already opened the file for reading, the
system tries to open it either in binary mode, or using the additions
from the last OPEN DATASET statement. However, it is good
practice only to open files using the OPEN DATASET statement.
If the system was able to read data successfully, SY-SUBRC is set
to 0. When the end of the file is reached, SY-SUBRC is set to 4. If
the file could not be opened, SY-SUBRC is set to 8.




Summary
5-277
no 276
CALL TRANSACTION USING.... is an alternative to the
conventional batch input processes. Direct transfer of data is
particularly fast since the queue file is avoided (i.e. no
sessions are generated.).
As with batch input, there is a high degree of data integrity
since the data is imported using transactions. CALL
TRANSACTION has certain advantages over batch input
(e.g. when you choose update mode), but it does not offer
thye same correction and administration options as batch
input.

You might also like