SlideShare a Scribd company logo
SAP R/3 Document : BDC Concept

BDC & Programming Interfaces (Scheduling)
With the programming interfaces you can schedule and manage background-processing jobs
through your programs
Programming Interface provides two function modules for scheduling and management of
background jobs namely:
BP_JOBVARIANT_SCHEDULE for scheduling a job for execution. This needs only an ABAP
program. You need a variant and an start time to execute the program.
Second function is BP_JOBVARIANT_OVERVIEW offers to manage the jobs. You display
job logs, spool output, delete inactive jobs etc.
There are two ways to schedule the jobs:
First
the
“Express
Method”,
BP_JOBVARIANT_SCHEDULE

which

uses

the

functional

module

Second method is the “Full Control” method, which uses the JOB_OPEN, JOB_SUBMIT and
JOB_CLOSE function modules.
The “Full Control” method gives you complete control over the job scheduling options such as
job printing, job start time options etc.

BATCH DATA COMMUNICATION
BDC is used to transfer data from SAP to SAP system or from a non-SAP system to SAP system.
It uses the normal Transaction codes to transfer the data.
This method is used to transfer large amount data that is available in electronic form.
There are two types of methods offered by SAP for BDC
First method is called the “Classical Method”. In this method, the data that is read by the BDC
program from a sequential dataset file is stored in a batch-input session. To run the transactions in
the session, you need to execute the session.
You can start and monitor the session from System à Services à Batch Input or have the
session run in the background.
This method uses the function module BDC_OPEN, BDC_INSERT and BDC_CLOSE to
generate the sessions
In the second method, BDC uses the ABAP statement CALL TRANSACTION USING statement
to run a transaction.

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept

In this method, BDC does not create a session
Both the above methods need a common data structure for storing the instructions and data for
SAP transactions. This structure is defined as the BDCDATA in the dictionary
To transfer the data from the non-SAP system to an SAP System, you would have to write a
ABAP program that would export the data to a sequential dataset file. The data in this file should
be stored in a format acceptable to SAP batch input program
To transfer data from an SAP system to another SAP system you may use RFC or CPI-C.
The data transfer program should convert the data that has to transfer into the SAP system as
required by the SAP data structure or the transactions using it.
A conversion of the data types could be necessary at times. In case of data type mismatch,
convert the data types to type C.
Also the data transfer program should be able to export the data in SAP format to a sequential
file. The BDC program reads the data from this file during the upload of the data into the SAP
system
To write a data transfer program follow this procedure :
1. Analyze the structure of the existing data and specify the conversions that are required to fill
the SAP data structures.
2. Generate the SAP data structure
If the program is written in ABAP, you need only include the required tables in your program
with the TABLES statement.
3. Initialize the SAP data structure.
4. Fill the structure with data, performing any conversions and error-checking that are required.
5. Write the sequential file that is typically required for making the data available to the batchinput program in the SAP System.
The purpose of analyzing the data is to gather the transaction code that is to used, list of the
required fields for input, field names, types and lengths, to note the screen numbers involved in
the transaction, program names for the screen,
There are two ways by which you can achieve the above,
One is run the transaction and note the information about the Screen No., Program name by going
to System à Status and for information on the fields by placing the cursor in the field and then
pressing F1 and then by looking into the Technical Information of the fields.

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept

The following is the procedure for transferring the data using batch input.
1. Analyze the data that is to be transferred to the SAP System to determine how your
existing data should be mapped to the SAP data structure.
Method: You’ll need to determine the structure of the data that is to be transferred into the
system. Using the SAP data structure that you generate in step 2, you’ll need to determine
how the data to be transferred must be mapped to the SAP structure. You’ll also need to
determine whether any data type or data length conversions are required.
2. Generate SAP data structures for incorporation into your data export program.
Method: Use the data structure generation function of the ABAP dictionary to generate data
structures for SAP tables in any of several programming languages.
If you are using one of SAP’s standard batch input programs, then use of this function is
required. The standard batch input programs generally require that you use a special predefined data structure.
If you’re writing your own batch input procedure, then you will need to determine the data
structure on your own. You’ll need to analyze the SAP transactions to find the names of the
fields that the transaction requires.
3. Code your data transfer program. You can write the program in ABAP or as an external
program.
4. Export the data that is to be transferred to a sequential file.
Requirements:
– The file must use the logical format required by the batch-input program that will
import the file (step 6).
– Reading and interpreting the file is much easier if you write it in ASCII or EBCDIC
(character) format rather than, for example, writing numeric data in hexadecimal format.
Character format is required by the pre-defined SAP batch input programs.
5. If necessary, code the ABAP batch input program that will read in the data to be
transferred from your file.
SAP supplies ready-to-run batch-input programs for most of the SAP applications.
6. Process the data and add it to the SAP System. You can do this either by:
– Generating a batch input session; or
– by processing data directly in your batch-input program with the ABAP statement
CALL TRANSACTION USING.
7. Check that all data has been successfully processed.
Method: Analyze the batch input-processing log. If you are using CALL TRANSACTION
USING, then you will need to analyze the processing messages collected by your program.
8. Correct and re-process erroneous data.

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept

Method: You can use the batch-input management function to process erroneous transactions
interactively. You can correct data during this interactive processing.
SAP has provided special data structure for batch data input for most of the objects. Using these
structures, one need not know what tables are required for BDC.
SAP has also provided with pre-defined batch input programs for data transfer. But you may still
need to write a BDC to meet the your requirements since the programs given by SAP may not
meet them.
You should therefore initialize all of the fields in your batch input data structure with the
NODATA character. The default is ‘/’.
If the BDC program does not find a value for a field then it sets the value of that field to ‘/’.
To write a BDC you need to do the following:
1. Analyze the transaction(s) that you will use to process your batch-input data.
You may have already done this when you wrote your data transfer program.
2. Decide on the batch-input method that you wish to use.
"Classical" batch input -- by way of a batch-input session -- is more comfortable. Restartcapability and detailed logging are supported by the batch input management transaction for
batch input sessions.
Batch input by way of CALL TRANSACTION USING offers faster processing if you need it to
get your batch input done in the time slot that is available for it. CALL TRANSACTION USING
offers, however, less support for error recovery and management of batch input.
3. Write the batch input program.
Your program will need to do the following:
– read data in, often from a sequential file that has been exported from another system or
prepared by a data transfer program
– if necessary, perform data conversions or error-checking
– prepare the data for batch input processing by storing the data in the batch input data
structure, BDCDATA.
– generate a batch input session for classical batch input, or process the data directly with
CALL TRANSACTION US
There are three methods of doing a BDC, namely: Creating a Session, Call Transaction and
CALL Dialog method. Of theses, only the first two are recommended for use since CALL
DIALOG method is outdated.
Now let us see what these three metods do:
· Creating a session on the batch input queue.
This is the standard method to do a BDC. It offers management of sessions, support for
playing back and correcting sessions that contain errors, and detailed logging.

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept

The program prepares the data and stores it in a batch input session. A session is a collection
of transaction data for one or more transactions. Batch input sessions are maintained by the
system in the batch input queue. You can process batch-input sessions in the background
processing system.
Your program must open a session in the queue before transferring data to it, and must close
it again afterwards. Making function module calls from the ABAP program performs all of
these operations.
The most important aspects of the session interface are:
- Asynchronous processing
- Transfers data for multiple transactions
- Synchronous database update
During processing, no transaction is started until the previous transaction has been
written to the database.
- A batch input processing log is generated for each session
- Sessions cannot be generated in parallel
The batch-input program must not open a session until it has closed the preceding
session.

· Use the CALL TRANSACTION USING statement
This method offers faster processing of data than batch input sessions. It is recommended that
if you’re having problems getting data entered into your SAP System quickly enough. The
playback, interactive correction, and logging facilities offered for batch input sessions that are
not available for CALL TRANSACTION USING.
Your program prepares the data and calls the desired transaction for immediate processing.
The most important aspects of the CALL TRANSACTION USING interface are:
- Synchronous processing
- Transfers data for a single transaction
- Synchronous and asynchronous database updating both possible
The program specifies which kind of updating is desired.
- Separate LUW for the transaction
The system performs a database commit immediately before and after the CALL
TRANSACTION USING statement.
- No batch input processing log is generated
· Use the CALL DIALOG statement
This method is not recommended to be used to do a BDC if you can enter data by way of
sessions or CALL TRANSACTION USING.
In this method, your program prepares data for a sequence of dialog screens, and calls a
dialog module for immediate processing.
The most important aspects of the CALL DIALOG interface are:
- Synchronous processing
- Transfers data for a sequence of dialog screens

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept
- No separate database update for the dialog
A database update occurs only when the calling program executes a commit operation.
- Shares LUW with calling program
- No batch input processing log is generated
The data and the necessary action to be performed in order to enter the data into the SAP is stored
in Batch Input data structure (BDCDATA).
This structure is used in all the three methods mentioned above
The diagram below shows how to declare the structure in your ABAP program and the fields
contained in the structure

This BDCDATA structure can contain data for one transaction at a time.
You first create a BDCDATA structure. Then fill the structures with data using either create
session method or call transaction method. And then create it again for the next transaction. If
your BDC involves more than one transaction, then this process will be in a loop.
Build the structure line by line using MOVE and APPEND statements. Before building each line,
reset the header line of the internal table with the CLEAR statement.
The first record for each screen must contain information that identifies the screen: program
name, screen name and a start-of-screen indicator. You record this information in the
PROGRAM, DYNPRO, and DYNBEGIN fields of the BDCDATA structure.
This sample BDCDATA starts a screen. The record specifies the program and screen identifiers.
With BDCDATA-DYNBEGIN, the record shows that batch input data for a new screen is
starting:

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept

BDCDATA-PROGRAM = 'sapms38m'.
BDCDATA-DYNPRO = '0100'.
BDCDATA-DYNBEGIN = 'x'.
APPEND BDCDATA.
After the dynpro-start record, you must add a record for each field that is to receive a value. You
need fill only the FNAM and FVAL fields.
This sample BDCDATA enters a value into a field. The FNAM field identifies the target field by
its table and field names. FVAL specifies the value that is to be entered:
BDCDATA-FNAM = 'RS38M-FUNC_EDIT'.
BDCDATA-FVAL = 'x'.
APPEND BDCDATA.
The command field is identified by a special name in batch input, BDC_OKCODE. This name is
constant and always identifies the command field.
This sample record would execute the save function. It uses the function key assignment of save,
which is F11. A function key number must be prefixed with the / (slash) character:

BDCDATA-FNAM = ‘BDC_OKCODE’.
BDCDATA-FVAL = ‘/11’.

This sample record also executes save, but uses the function code instead of the function key
assignment. All functions, whether they are displayed in menus or as buttons, are identified by
function codes. A function code must be prefixed with the = character.
BDCDATA-FNAM = ‘BDC_OKCODE’.
BDCDATA-FVAL = ‘=UPDA’.

Some screen fields need multiple values, one on each line. To provide input to one of these loop
fields, you must use an explicit line index :
BDCDATA-FNAM = 'fieldx (5)'.
BDCDATA-FVAL = 'value'.
The line index (in the example: (5), line 5) indicates in which loop line on the screen values are to
appear.
To position the cursor on a particular field, you must use the special cursor field:
BDCDATA-FNAM = 'BDC_CURSOR'.
BDCDATA-FVAL = 'fieldx'.
To position the cursor on a loop field, you must use again an index:
BDCDATA-FNAM = 'BDC_CURSOR'.
BDCDATA-FVAL = 'fieldy(5)'.

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
SAP R/3 Document : BDC Concept

After finishing the BDC, to return to the SAP Main Menu, from the text input screen in the
ABAP editor, for example, the following BDCDATA records are necessary to leave the
transaction:
BDCDATA-PROGRAM = ‘SAPMSEDT’. "Leave text input field
BDCDATA-DYNPRO = ‘2310’.
BDCDATA-DYNBEGIN = ‘X’.
BDCDATA-FNAM = ‘BDC_OKCODE’.
BDCDATA-FVAL = ‘/3’. "Back function key
BDCDATA-PROGRAM = ‘SAPMS38M’. "Leave ABAP editor
BDCDATA-DYNPRO = ‘0100’.
BDCDATA-DYNBEGIN = ‘X’.
BDCDATA-FNAM = ‘BDC_OKCODE’.
BDCDATA-FVAL = ‘/15’. "Quit function key
CREATING BATCH INPUT SESSION :
One of the methods of doing a BDC is storing the batch input data in a session.
Creating a session also enables us to specify the BDC start time.

Compiled By : Subba Rao

For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial

More Related Content

What's hot (20)

PPT
Lsmw demo
ILAIAH
 
PDF
Lsmw overview
vinay5672
 
PDF
Lsmw (Legacy System Migration Workbench)
Leila Morteza
 
DOC
Uploading customer master extended address using bapi method
londonchris1970
 
PPT
BATCH DATA COMMUNICATION
Kranthi Kumar
 
PDF
SAP Legacy System Migration Workbench (LSMW): Introduction
Jonathan Eemans
 
DOCX
Sap query for task list data extraction
Srinivasa Rao Mullapudi
 
PPT
Step by-step-lsmw-tutorial-101208040548-phpapp02
johnbryan26
 
DOCX
Lsmw Anilkumar chowdary
ANILKUMARPULIPATI1
 
DOC
1000 solved questions
Kranthi Kumar
 
PPT
Maximizing SAP ABAP Performance
PeterHBrown
 
PPT
Lsmw final with comments
rajyalakshmi10
 
PPTX
SAP ABAP Practice exam
IT LearnMore
 
DOCX
I doc in SAP
Rajeev Kumar
 
PDF
SAP-ABAP/4@e_max
Bhuvnesh Gupta
 
PPT
Introduction to ABAP
sapdocs. info
 
PPT
The ABAP Query
PeterHBrown
 
PDF
Abap interview questions and answers
Kaustav Pyne
 
PDF
1000 sap-interview-qa
SiddheshSirsat
 
Lsmw demo
ILAIAH
 
Lsmw overview
vinay5672
 
Lsmw (Legacy System Migration Workbench)
Leila Morteza
 
Uploading customer master extended address using bapi method
londonchris1970
 
BATCH DATA COMMUNICATION
Kranthi Kumar
 
SAP Legacy System Migration Workbench (LSMW): Introduction
Jonathan Eemans
 
Sap query for task list data extraction
Srinivasa Rao Mullapudi
 
Step by-step-lsmw-tutorial-101208040548-phpapp02
johnbryan26
 
Lsmw Anilkumar chowdary
ANILKUMARPULIPATI1
 
1000 solved questions
Kranthi Kumar
 
Maximizing SAP ABAP Performance
PeterHBrown
 
Lsmw final with comments
rajyalakshmi10
 
SAP ABAP Practice exam
IT LearnMore
 
I doc in SAP
Rajeev Kumar
 
SAP-ABAP/4@e_max
Bhuvnesh Gupta
 
Introduction to ABAP
sapdocs. info
 
The ABAP Query
PeterHBrown
 
Abap interview questions and answers
Kaustav Pyne
 
1000 sap-interview-qa
SiddheshSirsat
 

Similar to Programming Interface & SAP BDC (20)

PPTX
What is bdc in sap types of bdc
kavyagaur3
 
PPT
SAP-BDC know as Batch data conversion.ppt
pagajal493
 
DOCX
Bdc
nag_m
 
PDF
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Srinivas Dukka
 
PPT
Call transaction method
Kranthi Kumar
 
PPT
3 modularisation and bdc
Siva Kumar
 
PPT
Batch input session
Kranthi Kumar
 
DOC
Bdc
ANKUTICKOO
 
PPTX
Sure BDCs
SAP Sure
 
PDF
SAP Periodical Jobs And Tasks
Ajay Kumar Uppal
 
PPTX
Sap abap
nrj10
 
DOCX
Sap index
saranrj321
 
PDF
Analysis process designer (apd) part 2
dejavee
 
PPTX
SAP Batch data communication
Jugul Crasta
 
DOC
Ab ap faq
alok khobragade
 
PDF
Establishing A Robust Data Migration Methodology - White Paper
James Chi
 
PDF
Analysis process designer (apd) part 1
dejavee
 
PPT
Sap bi training with bo integrations
pjraosapbi
 
PPT
SAP BI/DW Training with BO Integration
mishra4927
 
PDF
Copy b wsimple
Daniel Pinto
 
What is bdc in sap types of bdc
kavyagaur3
 
SAP-BDC know as Batch data conversion.ppt
pagajal493
 
Bdc
nag_m
 
Backup%20 domain%20controller%20(bdc)%20step by-step(1)
Srinivas Dukka
 
Call transaction method
Kranthi Kumar
 
3 modularisation and bdc
Siva Kumar
 
Batch input session
Kranthi Kumar
 
Sure BDCs
SAP Sure
 
SAP Periodical Jobs And Tasks
Ajay Kumar Uppal
 
Sap abap
nrj10
 
Sap index
saranrj321
 
Analysis process designer (apd) part 2
dejavee
 
SAP Batch data communication
Jugul Crasta
 
Ab ap faq
alok khobragade
 
Establishing A Robust Data Migration Methodology - White Paper
James Chi
 
Analysis process designer (apd) part 1
dejavee
 
Sap bi training with bo integrations
pjraosapbi
 
SAP BI/DW Training with BO Integration
mishra4927
 
Copy b wsimple
Daniel Pinto
 
Ad

Recently uploaded (20)

PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
July Patch Tuesday
Ivanti
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
July Patch Tuesday
Ivanti
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Python basic programing language for automation
DanialHabibi2
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Ad

Programming Interface & SAP BDC

  • 1. SAP R/3 Document : BDC Concept BDC & Programming Interfaces (Scheduling) With the programming interfaces you can schedule and manage background-processing jobs through your programs Programming Interface provides two function modules for scheduling and management of background jobs namely: BP_JOBVARIANT_SCHEDULE for scheduling a job for execution. This needs only an ABAP program. You need a variant and an start time to execute the program. Second function is BP_JOBVARIANT_OVERVIEW offers to manage the jobs. You display job logs, spool output, delete inactive jobs etc. There are two ways to schedule the jobs: First the “Express Method”, BP_JOBVARIANT_SCHEDULE which uses the functional module Second method is the “Full Control” method, which uses the JOB_OPEN, JOB_SUBMIT and JOB_CLOSE function modules. The “Full Control” method gives you complete control over the job scheduling options such as job printing, job start time options etc. BATCH DATA COMMUNICATION BDC is used to transfer data from SAP to SAP system or from a non-SAP system to SAP system. It uses the normal Transaction codes to transfer the data. This method is used to transfer large amount data that is available in electronic form. There are two types of methods offered by SAP for BDC First method is called the “Classical Method”. In this method, the data that is read by the BDC program from a sequential dataset file is stored in a batch-input session. To run the transactions in the session, you need to execute the session. You can start and monitor the session from System à Services à Batch Input or have the session run in the background. This method uses the function module BDC_OPEN, BDC_INSERT and BDC_CLOSE to generate the sessions In the second method, BDC uses the ABAP statement CALL TRANSACTION USING statement to run a transaction. Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 2. SAP R/3 Document : BDC Concept In this method, BDC does not create a session Both the above methods need a common data structure for storing the instructions and data for SAP transactions. This structure is defined as the BDCDATA in the dictionary To transfer the data from the non-SAP system to an SAP System, you would have to write a ABAP program that would export the data to a sequential dataset file. The data in this file should be stored in a format acceptable to SAP batch input program To transfer data from an SAP system to another SAP system you may use RFC or CPI-C. The data transfer program should convert the data that has to transfer into the SAP system as required by the SAP data structure or the transactions using it. A conversion of the data types could be necessary at times. In case of data type mismatch, convert the data types to type C. Also the data transfer program should be able to export the data in SAP format to a sequential file. The BDC program reads the data from this file during the upload of the data into the SAP system To write a data transfer program follow this procedure : 1. Analyze the structure of the existing data and specify the conversions that are required to fill the SAP data structures. 2. Generate the SAP data structure If the program is written in ABAP, you need only include the required tables in your program with the TABLES statement. 3. Initialize the SAP data structure. 4. Fill the structure with data, performing any conversions and error-checking that are required. 5. Write the sequential file that is typically required for making the data available to the batchinput program in the SAP System. The purpose of analyzing the data is to gather the transaction code that is to used, list of the required fields for input, field names, types and lengths, to note the screen numbers involved in the transaction, program names for the screen, There are two ways by which you can achieve the above, One is run the transaction and note the information about the Screen No., Program name by going to System à Status and for information on the fields by placing the cursor in the field and then pressing F1 and then by looking into the Technical Information of the fields. Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 3. SAP R/3 Document : BDC Concept The following is the procedure for transferring the data using batch input. 1. Analyze the data that is to be transferred to the SAP System to determine how your existing data should be mapped to the SAP data structure. Method: You’ll need to determine the structure of the data that is to be transferred into the system. Using the SAP data structure that you generate in step 2, you’ll need to determine how the data to be transferred must be mapped to the SAP structure. You’ll also need to determine whether any data type or data length conversions are required. 2. Generate SAP data structures for incorporation into your data export program. Method: Use the data structure generation function of the ABAP dictionary to generate data structures for SAP tables in any of several programming languages. If you are using one of SAP’s standard batch input programs, then use of this function is required. The standard batch input programs generally require that you use a special predefined data structure. If you’re writing your own batch input procedure, then you will need to determine the data structure on your own. You’ll need to analyze the SAP transactions to find the names of the fields that the transaction requires. 3. Code your data transfer program. You can write the program in ABAP or as an external program. 4. Export the data that is to be transferred to a sequential file. Requirements: – The file must use the logical format required by the batch-input program that will import the file (step 6). – Reading and interpreting the file is much easier if you write it in ASCII or EBCDIC (character) format rather than, for example, writing numeric data in hexadecimal format. Character format is required by the pre-defined SAP batch input programs. 5. If necessary, code the ABAP batch input program that will read in the data to be transferred from your file. SAP supplies ready-to-run batch-input programs for most of the SAP applications. 6. Process the data and add it to the SAP System. You can do this either by: – Generating a batch input session; or – by processing data directly in your batch-input program with the ABAP statement CALL TRANSACTION USING. 7. Check that all data has been successfully processed. Method: Analyze the batch input-processing log. If you are using CALL TRANSACTION USING, then you will need to analyze the processing messages collected by your program. 8. Correct and re-process erroneous data. Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 4. SAP R/3 Document : BDC Concept Method: You can use the batch-input management function to process erroneous transactions interactively. You can correct data during this interactive processing. SAP has provided special data structure for batch data input for most of the objects. Using these structures, one need not know what tables are required for BDC. SAP has also provided with pre-defined batch input programs for data transfer. But you may still need to write a BDC to meet the your requirements since the programs given by SAP may not meet them. You should therefore initialize all of the fields in your batch input data structure with the NODATA character. The default is ‘/’. If the BDC program does not find a value for a field then it sets the value of that field to ‘/’. To write a BDC you need to do the following: 1. Analyze the transaction(s) that you will use to process your batch-input data. You may have already done this when you wrote your data transfer program. 2. Decide on the batch-input method that you wish to use. "Classical" batch input -- by way of a batch-input session -- is more comfortable. Restartcapability and detailed logging are supported by the batch input management transaction for batch input sessions. Batch input by way of CALL TRANSACTION USING offers faster processing if you need it to get your batch input done in the time slot that is available for it. CALL TRANSACTION USING offers, however, less support for error recovery and management of batch input. 3. Write the batch input program. Your program will need to do the following: – read data in, often from a sequential file that has been exported from another system or prepared by a data transfer program – if necessary, perform data conversions or error-checking – prepare the data for batch input processing by storing the data in the batch input data structure, BDCDATA. – generate a batch input session for classical batch input, or process the data directly with CALL TRANSACTION US There are three methods of doing a BDC, namely: Creating a Session, Call Transaction and CALL Dialog method. Of theses, only the first two are recommended for use since CALL DIALOG method is outdated. Now let us see what these three metods do: · Creating a session on the batch input queue. This is the standard method to do a BDC. It offers management of sessions, support for playing back and correcting sessions that contain errors, and detailed logging. Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 5. SAP R/3 Document : BDC Concept The program prepares the data and stores it in a batch input session. A session is a collection of transaction data for one or more transactions. Batch input sessions are maintained by the system in the batch input queue. You can process batch-input sessions in the background processing system. Your program must open a session in the queue before transferring data to it, and must close it again afterwards. Making function module calls from the ABAP program performs all of these operations. The most important aspects of the session interface are: - Asynchronous processing - Transfers data for multiple transactions - Synchronous database update During processing, no transaction is started until the previous transaction has been written to the database. - A batch input processing log is generated for each session - Sessions cannot be generated in parallel The batch-input program must not open a session until it has closed the preceding session. · Use the CALL TRANSACTION USING statement This method offers faster processing of data than batch input sessions. It is recommended that if you’re having problems getting data entered into your SAP System quickly enough. The playback, interactive correction, and logging facilities offered for batch input sessions that are not available for CALL TRANSACTION USING. Your program prepares the data and calls the desired transaction for immediate processing. The most important aspects of the CALL TRANSACTION USING interface are: - Synchronous processing - Transfers data for a single transaction - Synchronous and asynchronous database updating both possible The program specifies which kind of updating is desired. - Separate LUW for the transaction The system performs a database commit immediately before and after the CALL TRANSACTION USING statement. - No batch input processing log is generated · Use the CALL DIALOG statement This method is not recommended to be used to do a BDC if you can enter data by way of sessions or CALL TRANSACTION USING. In this method, your program prepares data for a sequence of dialog screens, and calls a dialog module for immediate processing. The most important aspects of the CALL DIALOG interface are: - Synchronous processing - Transfers data for a sequence of dialog screens Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 6. SAP R/3 Document : BDC Concept - No separate database update for the dialog A database update occurs only when the calling program executes a commit operation. - Shares LUW with calling program - No batch input processing log is generated The data and the necessary action to be performed in order to enter the data into the SAP is stored in Batch Input data structure (BDCDATA). This structure is used in all the three methods mentioned above The diagram below shows how to declare the structure in your ABAP program and the fields contained in the structure This BDCDATA structure can contain data for one transaction at a time. You first create a BDCDATA structure. Then fill the structures with data using either create session method or call transaction method. And then create it again for the next transaction. If your BDC involves more than one transaction, then this process will be in a loop. Build the structure line by line using MOVE and APPEND statements. Before building each line, reset the header line of the internal table with the CLEAR statement. The first record for each screen must contain information that identifies the screen: program name, screen name and a start-of-screen indicator. You record this information in the PROGRAM, DYNPRO, and DYNBEGIN fields of the BDCDATA structure. This sample BDCDATA starts a screen. The record specifies the program and screen identifiers. With BDCDATA-DYNBEGIN, the record shows that batch input data for a new screen is starting: Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 7. SAP R/3 Document : BDC Concept BDCDATA-PROGRAM = 'sapms38m'. BDCDATA-DYNPRO = '0100'. BDCDATA-DYNBEGIN = 'x'. APPEND BDCDATA. After the dynpro-start record, you must add a record for each field that is to receive a value. You need fill only the FNAM and FVAL fields. This sample BDCDATA enters a value into a field. The FNAM field identifies the target field by its table and field names. FVAL specifies the value that is to be entered: BDCDATA-FNAM = 'RS38M-FUNC_EDIT'. BDCDATA-FVAL = 'x'. APPEND BDCDATA. The command field is identified by a special name in batch input, BDC_OKCODE. This name is constant and always identifies the command field. This sample record would execute the save function. It uses the function key assignment of save, which is F11. A function key number must be prefixed with the / (slash) character: BDCDATA-FNAM = ‘BDC_OKCODE’. BDCDATA-FVAL = ‘/11’. This sample record also executes save, but uses the function code instead of the function key assignment. All functions, whether they are displayed in menus or as buttons, are identified by function codes. A function code must be prefixed with the = character. BDCDATA-FNAM = ‘BDC_OKCODE’. BDCDATA-FVAL = ‘=UPDA’. Some screen fields need multiple values, one on each line. To provide input to one of these loop fields, you must use an explicit line index : BDCDATA-FNAM = 'fieldx (5)'. BDCDATA-FVAL = 'value'. The line index (in the example: (5), line 5) indicates in which loop line on the screen values are to appear. To position the cursor on a particular field, you must use the special cursor field: BDCDATA-FNAM = 'BDC_CURSOR'. BDCDATA-FVAL = 'fieldx'. To position the cursor on a loop field, you must use again an index: BDCDATA-FNAM = 'BDC_CURSOR'. BDCDATA-FVAL = 'fieldy(5)'. Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial
  • 8. SAP R/3 Document : BDC Concept After finishing the BDC, to return to the SAP Main Menu, from the text input screen in the ABAP editor, for example, the following BDCDATA records are necessary to leave the transaction: BDCDATA-PROGRAM = ‘SAPMSEDT’. "Leave text input field BDCDATA-DYNPRO = ‘2310’. BDCDATA-DYNBEGIN = ‘X’. BDCDATA-FNAM = ‘BDC_OKCODE’. BDCDATA-FVAL = ‘/3’. "Back function key BDCDATA-PROGRAM = ‘SAPMS38M’. "Leave ABAP editor BDCDATA-DYNPRO = ‘0100’. BDCDATA-DYNBEGIN = ‘X’. BDCDATA-FNAM = ‘BDC_OKCODE’. BDCDATA-FVAL = ‘/15’. "Quit function key CREATING BATCH INPUT SESSION : One of the methods of doing a BDC is storing the batch input data in a session. Creating a session also enables us to specify the BDC start time. Compiled By : Subba Rao For more tutorials & articles visit : http://sapbrainsonline.com/bdc-tutorial