Record Your First BDC Code with SHDB

Blog header illustration showing a SAP monitor with a form on the left, a mouse cursor, and code snippets on the right, linked by a record icon.

Blog 1: Your First SAP BDC Code (Step-by-Step)

Open your SAP GUI, log into your SAP system, and type SHDB in the command box. By the end of this post, you will own a piece of ABAP code that fills SAP screens automatically.

In this blog, we are going to do something cool. We are going to teach SAP to do our work for us. We will use the Transaction Recorder.

It’s like a voice recorder on your phone, but instead of recording your voice, it records your mouse clicks and keyboard typing inside SAP.

The SHDB Recording Overview screen

Look at the top left and click the button that says New recording.

Step 1: Start the Recorder

A small pop-up window will open. It should look exactly like this:

The Create Recording window

Fill it out exactly like this:
  • Recording: Type Z_MY_FIRST_BDC
  • Transaction code: Type MM01 (This is the SAP screen used to create a new material/item. We will use this to practice.)
  • Leave everything else exactly as it is.
  • Click the Start recording button.
Your Check: You should now see the “Create Material” screen (MM01). If you see something else, go back and make sure you typed MM01 correctly.

Step 2: Do the Work Manually

Now, we pretend to be a normal SAP user. We will create a material by hand. SAP is watching and recording everything we do.

Do this:
Your Check: You might get a green success message, or a red error message (like “Plant missing”). It does not matter! Success or error, the recorder got what it needed. Click the back arrow to exit the screen.

Step 3: Turn Your Clicks into Code

When you exit, SAP will take you back to the first screen (the list of recordings).

Do this:
  1. Look at the list. You will see your new recording: Z_MY_FIRST_BDC.
  2. Click the small gray box next to it to select it.
  3. Click the Program button at the top.
  4. SAP will ask for a name. Type: Z_MY_FIRST_BDC_PROG.
  5. Choose Transfer from recording. Click the green checkmark and save it.

SAP will now show you a screen full of text. This is ABAP code!

The Magic Check

Scroll down in the code until you see words that look like this:

perform bdc_field using 'RMMG1-MATNR' 'ZTEST-001'.

Your Task: Look at the first line that starts with perform bdc_field. See the word inside the very first set of quotes? (It will probably be RMMG1-MATNR).

Think about it: Why did SAP write that specific word? Because when you typed “ZTEST-001” into the screen, SAP wrote it into the code. Your clicks became code!

Revision: What did we just learn?

Click the question below to reveal the answer. Try answering it out loud before you click!

Why is the code we just generated considered “dumb” or “hardcoded”?
Because it is programmed to only ever create the exact material we typed: ZTEST-001. If you want to upload 500 materials, this code will just create ZTEST-001 500 times. It cannot read new data from a file yet.
What is the purpose of Transaction SHDB?
SHDB is the Transaction Recorder. It records your manual keystrokes and mouse clicks inside an SAP transaction and converts them into ABAP code. This is the starting point for creating a Batch Data Communication (BDC) program.
🎮 Quick Quiz: Let’s see what you remember!

What’s Next?

In Blog 2, we are going to make this robot smart. We will teach it to read a text file on your computer and upload 500 materials in one click.

Homework: Make sure you saved your program Z_MY_FIRST_BDC_PROG. See you in Blog 2!

WhatsApp WhatsApp us
Call Now Button