Introduction
In SAP, Batch Data Communication (BDC) supports two primary methods for processing batch input sessions and automating data entry:
- Session Method (Recommended for large data loads)
- Call Transaction Method (Faster but requires error handling)
Each method has distinct advantages, disadvantages, and use cases, making it important to understand when to use each.
BDC Methods Overview
BDC Method | Processing Mode | Error Handling | Performance | When to Use? |
---|---|---|---|---|
Session Method | Asynchronous (batch processing) | Errors logged automatically | Slower | For large data volumes requiring batch execution |
Call Transaction Method | Synchronous (real-time execution) | Manual error handling required | Faster | When immediate execution is needed |
1. Session Method (Recommended for Large Data Loads)
The Session Method processes data in the background using batch input sessions.
Key Features of Session Method:
✅ Executes transactions in batch mode (Asynchronous processing).
✅ Errors are automatically logged in SM35 for reprocessing.
✅ Preferred for large data loads where reliability is crucial.
✅ Requires more system resources but ensures better error tracking.
How Session Method Works (Step-by-Step)
- Record the Transaction using
SHDB
. - Create the BDC Data File (Flat file, CSV, or Excel).
- Write an ABAP Program that:
- Reads the input file
- Uses
BDC_OPEN_GROUP
,BDC_INSERT
, andBDC_CLOSE_GROUP
to create a batch session
- Execute the Session in SM35 (Batch Input Session).
- Monitor & Debug Errors in SM35 logs.
Session Method ABAP Code Example
DATA: lt_bdcdata TYPE TABLE OF bdcdata,
ls_bdcdata TYPE bdcdata.
* Populate BDC Data
ls_bdcdata-program = 'SAPLMGMM'.
ls_bdcdata-dynpro = '0101'.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
ls_bdcdata-fnam = 'MATNR'.
ls_bdcdata-fval = '123456'.
APPEND ls_bdcdata TO lt_bdcdata.
* Open Batch Session
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'MATERIAL_UPLOAD'
user = sy-uname.
* Insert data into session
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'MM01'
TABLES
dynprotab = lt_bdcdata.
* Close the session
CALL FUNCTION 'BDC_CLOSE_GROUP'.
Steps to Execute:
- Run the ABAP program.
- Navigate to Transaction
SM35
to execute the batch session. - Monitor logs and correct errors if needed.
Advantages of Session Method:
✔ Automatic error handling via SM35 logs.
✔ Can handle large data volumes efficiently.
✔ Supports background execution without user intervention.
Disadvantages:
❌ Slower processing due to batch execution.
❌ Requires manual execution in SM35
.
2. Call Transaction Method (Faster but Requires Error Handling)
The Call Transaction Method executes transactions immediately without creating a batch session.
Key Features of Call Transaction Method:
✅ Runs transactions in real-time (Synchronous processing).
✅ Faster than Session Method.
✅ Does not require SM35
execution.
✅ Requires manual error handling in the program.
How Call Transaction Works (Step-by-Step)
- Record the Transaction using
SHDB
. - Create the BDC Data File.
- Write an ABAP Program that:
- Reads the input file
- Uses
CALL TRANSACTION
to process data - Captures error messages manually
- Execute and log errors manually.
Call Transaction ABAP Code Example
DATA: lt_bdcdata TYPE TABLE OF bdcdata,
ls_bdcdata TYPE bdcdata,
lt_messages TYPE TABLE OF bapiret2,
lv_tcode TYPE tcode VALUE 'MM01'.
* Populate BDC Data
ls_bdcdata-program = 'SAPLMGMM'.
ls_bdcdata-dynpro = '0101'.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
ls_bdcdata-fnam = 'MATNR'.
ls_bdcdata-fval = '123456'.
APPEND ls_bdcdata TO lt_bdcdata.
* Execute Call Transaction
CALL TRANSACTION lv_tcode USING lt_bdcdata
MODE 'N' " No screen display
UPDATE 'A' " Synchronous update
MESSAGES INTO lt_messages.
Modes in Call Transaction Method
Mode | Description |
---|---|
A (All Screens) | Displays all screens (for debugging) |
E (Errors Only) | Displays only error screens |
N (No Screens) | Runs in the background (fastest mode) |
Advantages of Call Transaction Method:
✔ Faster execution since it runs in real-time.
✔ No need for manual execution via SM35.
Disadvantages:
❌ No automatic error handling – must be coded manually.
❌ If an error occurs, transaction execution may be incomplete.
Session Method vs. Call Transaction Method – Which One to Use?
Criteria | Session Method | Call Transaction Method |
---|---|---|
Processing | Asynchronous (Batch) | Synchronous (Real-time) |
Error Handling | Automatic in SM35 | Manual (must be coded) |
Performance | Slower but reliable | Faster but riskier |
Use Case | Large data loads, safe execution | Real-time execution, quick updates |
Use Session Method when:
✅ You need error tracking via SM35.
✅ The process involves large data volumes.
✅ Background execution is preferred.
Use Call Transaction Method when:
✅ You need immediate execution.
✅ Performance is a priority.
✅ You are prepared to handle errors programmatically.
Conclusion
Understanding BDC Session Method vs. Call Transaction Method helps in choosing the right approach for data migration.
Next Tutorial: BDC Recording and Data Structure →
👉 In the next tutorial, we will cover SHDB recording, screen flows, and how to structure BDC data for efficient execution.