Before developing a BDC program, it is essential to record the transaction flow and understand how BDC data is structured. SAP provides a transaction recording tool (SHDB) that captures screen sequences, fields, and values entered in a transaction.

This tutorial will cover:
✅ How to record a transaction using SHDB
✅ Understanding the BDC recording structure
✅ Handling screens, fields, and dynamic elements
✅ Best practices for effective BDC recording


1. What is BDC Recording in SAP?

BDC Recording is the process of capturing user interactions in a SAP transaction to generate an input template. The recorded sequence helps in automating data entry via a BDC program.

Why is BDC Recording important?
✔ Captures screen navigation, field inputs, and validations.
✔ Helps in identifying technical field names used in BDC programs.
✔ Enables developers to replicate user actions programmatically.


2. How to Perform a BDC Recording (SHDB Transaction)

SAP provides the SHDB (Transaction Recorder) tool for BDC recordings.

Step-by-Step Process for BDC Recording

1️⃣ Open Transaction Recorder

  • Go to Transaction Code: SHDB
  • Click on “New Recording”

2️⃣ Enter Recording Details

  • Enter a name for your recording (e.g., ZBDC_MATERIAL)
  • Specify the transaction code to record (e.g., MM01 for material creation)
  • Click “Start Recording”

3️⃣ Perform the Transaction Manually

  • SAP will launch the transaction.
  • Enter sample data just as an end-user would.
  • Click through each screen without skipping any fields.

4️⃣ Save the Recording

  • Once completed, stop the recording.
  • SAP will display a list of screens, programs, and fields captured.

3. Understanding the BDC Recording Structure

Once the recording is complete, SAP generates a BDC structure containing:

Transaction Code – The SAP transaction being executed.
Screens & Programs – Identifies the SAP program name and screen number.
Field Names & Values – Captures input fields and their values.

Example BDC Recording Output (MM01 – Material Master Creation)

Program NameScreen No.Field NameValue Entered
SAPLMGMM0101MATNR123456
SAPLMGMM0101MTARTFERT
SAPLMGMM0101MEINSPC
SAPLMGMM0101VKORG1000

BDC Data Structure Explanation

A BDC Table (BDCDATA) is used to store the recorded data. It consists of:

Field NameDescription
PROGRAMName of the SAP program
DYNPROScreen number
DYNBEGINFlag (X = Start of screen)
FNAMField name
FVALField value

BDC Internal Table Example in ABAP:

DATA: lt_bdcdata TYPE TABLE OF bdcdata,
      ls_bdcdata TYPE bdcdata.

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.

ls_bdcdata-fnam = 'MTART'.
ls_bdcdata-fval = 'FERT'.
APPEND ls_bdcdata TO lt_bdcdata.

4. Handling Multiple Screens and Dynamic Fields

4.1 Dealing with Multi-Screen Transactions

Some transactions require navigating through multiple screens. In such cases:
✅ Each screen must have a new entry in the BDCDATA table.
DYNBEGIN = ‘X’ indicates the start of a new screen.

Example: Multi-Screen Handling in BDC

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.

ls_bdcdata-program = 'SAPLMGMM'.
ls_bdcdata-dynpro  = '0201'.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.

4.2 Handling Table Controls in BDC

  • Table controls involve dynamic scrolling and row selections.
  • Use OK codes like /00 to move between screens or /PAGE+ to scroll.

Example: Selecting Rows in a Table Control

ls_bdcdata-fnam = 'BDC_OKCODE'.
ls_bdcdata-fval = '=P+'.   " Page Down  
APPEND ls_bdcdata TO lt_bdcdata.

5. Best Practices for BDC Recording

Always use SHDB to analyze the transaction flow before coding.
Record only required fields (unnecessary fields increase complexity).
Use consistent field mapping between the input file and the BDC program.
Check screen flow carefully – some fields are dependent on others.
Use breakpoints (BREAK-POINT) to debug incorrect field mappings.


6. Common Issues and Troubleshooting in BDC Recording

IssuePossible CauseSolution
BDC transaction failsIncorrect screen sequenceVerify with SHDB recording
Fields not updatingField names mismatchedUse correct field technical names from SHDB
Pop-ups disrupting executionUnhandled pop-up screensRecord and add pop-up handling logic
Scrolling issues in table controlsDynamic row selection missingUse OK codes (P+, P-) to handle scrolling

Conclusion

Understanding BDC recording and data structure is essential before writing a BDC program. Using SHDB, developers can capture the transaction flow, identify screen numbers, field names, and program logic, and efficiently map data in an ABAP BDC program.

Next Tutorial: Developing a BDC Program – Session Method →

👉 In the next tutorial, we will write a complete BDC Session Method program, from reading a flat file to executing batch input sessions in SM35.