Introduction

In SAP, Batch Data Communication (BDC) supports two primary methods for processing batch input sessions and automating data entry:

  1. Session Method (Recommended for large data loads)
  2. 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 MethodProcessing ModeError HandlingPerformanceWhen to Use?
Session MethodAsynchronous (batch processing)Errors logged automaticallySlowerFor large data volumes requiring batch execution
Call Transaction MethodSynchronous (real-time execution)Manual error handling requiredFasterWhen immediate execution is needed
BDC Methods Overview

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)

  1. Record the Transaction using SHDB.
  2. Create the BDC Data File (Flat file, CSV, or Excel).
  3. Write an ABAP Program that:
    • Reads the input file
    • Uses BDC_OPEN_GROUP, BDC_INSERT, and BDC_CLOSE_GROUP to create a batch session
  4. Execute the Session in SM35 (Batch Input Session).
  5. 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:

  1. Run the ABAP program.
  2. Navigate to Transaction SM35 to execute the batch session.
  3. 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)

  1. Record the Transaction using SHDB.
  2. Create the BDC Data File.
  3. Write an ABAP Program that:
    • Reads the input file
    • Uses CALL TRANSACTION to process data
    • Captures error messages manually
  4. 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

ModeDescription
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?

CriteriaSession MethodCall Transaction Method
ProcessingAsynchronous (Batch)Synchronous (Real-time)
Error HandlingAutomatic in SM35Manual (must be coded)
PerformanceSlower but reliableFaster but riskier
Use CaseLarge data loads, safe executionReal-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.