You are on page 1of 21

IBM Global Services

Batch Input Methods

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Objectives
The participants will be able to:
Research a transaction for the BDC purpose.
Describe the contents of a BDC table. Declare a BDC table and how to fill the BDC table.

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Overview

External System

SAP System

Data

Batch Input

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Data Transfer Rules

External
Data X SAP Checks & Validations Database Table

External Data

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Online Program
To check and validate the external data, user dialogue is simulated through an SAP transaction (i.e., an online program). Vendor Company Code X Address TEST1

Name Street City

Computers, Inc.

Philadelphia

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

BDCDATA Structure
To simulate user dialogue, you must know the following information: (1) (2) (3) (4) online program name, screen numbers, field names, and field values.

ABAP Dictionary

BDCDATA

The BDCDATA ABAP Dictionary structure is used in a batch input program to collect this information for an entire transaction.

PROGRAM DYNPRO DYNBEGIN FNAM

FVAL
6 Data Interfaces | 7.04 March-2005

2005 IBM Corporation

IBM Global Services

Example - Change Vendor

Vendor Company Code X For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor. Name Street City Address

TEST1

Computers, Inc. 123 Main St.

Philadelphia

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Researching Transaction - 1st Screen


Step #1 Step #2 Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.

Use System > Status menu path to determine online program name (SAPMF02K), screen number (0106), and transaction code (FK02).

Step #3 Determine how to proceed in the transaction (go to the next screen by pressing the Enter key).

Field name = RF02K-LIFNR Field name = RF02K-D0110


8 Data Interfaces | 7.04 March-2005

2005 IBM Corporation

IBM Global Services

Researching Transaction - 2nd Screen


Step #1 Use System > Status menu path to determine online program name (SAPMF02K) and screen number (0110). Step #2 Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.

Step #3
Determine how to proceed in the transaction (save the record by clicking on the Save pushbutton or pressing the CTRL+S key).

Field name = LFA1-STRAS

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Researching Transaction - 2nd Screen (Contd.)


Step #1 Use System > Status menu path to determine online program name (SAPMF02K) and screen number (0110). Step #2 Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.

Step #3
Determine how to proceed in the transaction (save the record by clicking on the Save pushbutton or pressing the CTRL+S key).

Field name = LFA1-STRAS

10

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

BDC Table Contents


After researching the transaction, we can
determine the contents of the BDC table.

PROGRAM

DYNPRO

DYNBEGIN

FNAM

FVAL

SAPMF02K

0106

RF02K-LIFNR
RF02K-D0110 BDC_OKCODE SAPMF02K 0110 X LFA1-STARS

TEST1
X /00 123 Maim St..

BDC_OKCODE =UPDA

11

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Declaring BDC Table

DATA:

BDC_TAB LIKE STANDARD TABLE OF BDCDATA INITIAL SIZE 6 WITH HEADER LINE.

The internal table used to collect the transactions information must be declared LIKE BDCDATA.

12

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Filling BDC Table - Method #1


FORM FILL_BDC_TAB. CLEAR BDC_TAB. BDC_TAB-PROGRAM = SAPMF02K. BDC_TAB-DYNPRO = 0111. BDC_TAB-DYNBEGIN = X. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = LFA1-STRAS. BDC_TAB-FVAL = 123 Main St.. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = BDC_OKCODE. BDC_TAB-FVAL = =UPDA. APPEND BDC_TAB. ENDFORM.

REFRESH BDC_TAB.
CLEAR BDC_TAB. BDC_TAB-PROGRAM = SAPMF02K. BDC_TAB-DYNPRO = 0106. BDC_TAB-DYNBEGIN = X. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = RF02K-LIFNR. BDC_TAB-FVAL = TEST1. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = RF02K-D0110. BDC_TAB-FVAL = X. APPEND BDC_TAB.

13

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Filling BDC Table - Method #1 (Contd.)


FORM FILL_BDC_TAB. CLEAR BDC_TAB. BDC_TAB-PROGRAM = SAPMF02K. BDC_TAB-DYNPRO = 0111. BDC_TAB-DYNBEGIN = X. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = LFA1-STRAS. BDC_TAB-FVAL = 123 Main St.. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = BDC_OKCODE. BDC_TAB-FVAL = =UPDA. APPEND BDC_TAB. ENDFORM.

REFRESH BDC_TAB.
CLEAR BDC_TAB. BDC_TAB-PROGRAM = SAPMF02K. BDC_TAB-DYNPRO = 0106. BDC_TAB-DYNBEGIN = X. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = RF02K-LIFNR. BDC_TAB-FVAL = TEST1. APPEND BDC_TAB. CLEAR BDC_TAB. BDC_TAB-FNAM = RF02K-D0110. BDC_TAB-FVAL = X. APPEND BDC_TAB.

14

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Filling BDC Table - Method #2


FORM FILL_BDC_TAB.
REFRESH BDC_TAB. PERFORM POPULATE_BDC_TAB USING: 1 SAPMF02K RF02K-LIFNR RF02K-D0110 1 SAPMF02K LFA1-STRAS BDC_OKCODE ENDFORM. 0106, TEST1, X, 0111, 123 Main St., =UPDA. FORM POPULATE_BDC_TAB USING FLAG TYPE C VAR1 TYPE C VAR2 TYPE C. CLEAR BDC_TAB. IF FLAG = 1. BDC_TAB-PROGRAM = VAR1. BDC_TAB-DYNPRO = VAR2. BDC_TAB-DYNBEGIN= X. ELSE. BDC_TAB-FNAM = VAR1. BDC_TAB-FVAL = VAR2. ENDIF. APPEND BDC_TAB. ENDFORM.

This two-subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TAB subroutine is reusable throughout all batch input programs.
15 Data Interfaces | 7.04 March-2005

2005 IBM Corporation

IBM Global Services

Filling BDC Table - Method #2 (Contd.)


FORM FILL_BDC_TAB.
REFRESH BDC_TAB. PERFORM POPULATE_BDC_TAB USING: 1 SAPMF02K RF02K-LIFNR RF02K-D0110 1 SAPMF02K LFA1-STRAS BDC_OKCODE ENDFORM. 0106, TEST1, X, 0111, 123 Main St., =UPDA. FORM POPULATE_BDC_TAB USING FLAG TYPE C VAR1 TYPE C VAR2 TYPE C. CLEAR BDC_TAB. IF FLAG = 1. BDC_TAB-PROGRAM = VAR1. BDC_TAB-DYNPRO = VAR2. BDC_TAB-DYNBEGIN= X. ELSE. BDC_TAB-FNAM = VAR1. BDC_TAB-FVAL = VAR2. ENDIF. APPEND BDC_TAB. ENDFORM.

This two-subroutine method to fill the BDC table is preferable because the POPULATE_BDC_TAB subroutine is reusable throughout all batch input programs.
16 Data Interfaces | 7.04 March-2005

2005 IBM Corporation

IBM Global Services

Batch Input Methods

Method #1

Batch Input Session

Method #2

CALL TRANSACTION USING Statement

17

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Demonstration
Creation of a custom BDC program using call transaction method for transaction XD02 (Change Customer).

18

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Practice
Creation of a custom BDC program using call transaction method for transaction XD02 (Change Customer).

19

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Summary
The <bdc table> must be declared LIKE BDCDATA.

To fill the BDC table delete all entries first with the REFRESH statement
Initialize the header line with CLEAR statement. Fill the header line (or staging area) with the appropriate information.For a new screen entry, fill the PROGRAM, DYNPRO, and and DYNBEGIN fields.For a field entry, fill the FNAM and FVAL fields

20

Data Interfaces | 7.04

March-2005

2005 IBM Corporation

IBM Global Services

Questions
What are the fields present in the BDC table ?

What are the different Batch Input methods.

21

Data Interfaces | 7.04

March-2005

2005 IBM Corporation