IBM Global Services
Batch Input Methods
Data Interfaces |
Dec-2008
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 |
Dec-2008
2005 IBM Corporation
IBM Global Services
Overview
External System
Data
SAP System
Batch Input
Data Interfaces |
Dec-2008
2005 IBM Corporation
IBM Global Services
Data Transfer Rules
External
Data
X
SAP
Checks &
Database
Validations
Table
External
Data
Data Interfaces |
Dec-2008
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
TEST1
Company Code
Address
Name
Computers, Inc.
Street
City
Data Interfaces |
Philadelphia
Dec-2008
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.
The BDCDATA ABAP Dictionary structure
is used
in a batch input program to collect this
information for
an entire transaction.
ABAP
ABAP Dictionary
Dictionary
BDCDATA
PROGRAM
DYNPRO
DYNBEGIN
FNAM
FVAL
Data Interfaces |
Dec-2008
2005 IBM Corporation
IBM Global Services
Example - Change Vendor
Vendor
TEST1
Company Code
Address
X
For our example, we will use the
Change Vendor transaction
(FK02) to add a street address to
an already existing vendor.
Data Interfaces |
Name
Computers, Inc.
Street
123 Main St.
City
Philadelphia
Dec-2008
2005 IBM Corporation
IBM Global Services
Researching Transaction - 1st Screen
Step #1
Step #2
Use System > Status menu path
to determine online program name
(SAPMF02K), screen number
(0106), and transaction code
(FK02).
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
(go to the next screen by
pressing the Enter key).
Field name = RF02K-LIFNR
Field name = RF02K-D0110
Data Interfaces |
Dec-2008
2005 IBM Corporation
IBM Global Services
Researching Transaction - 2nd Screen
Step #1
Step #2
Use System > Status menu path
to determine online program name
(SAPMF02K) and screen number
(0110).
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 |
Dec-2008
2005 IBM Corporation
IBM Global Services
Researching Transaction - 2nd Screen (Contd.)
Step #1
Step #2
Use System > Status menu path
to determine online program name
(SAPMF02K) and screen number
(0110).
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 |
Dec-2008
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
SAPMF02K
0106
SAPMF02K
0110
FNAM
FVAL
RF02K-LIFNR
TEST1
RF02K-D0110
BDC_OKCODE
/00
X
LFA1-STARS
123 Maim St..
BDC_OKCODE =UPDA
11
Data Interfaces |
Dec-2008
2005 IBM Corporation
IBM Global Services
Declaring BDC Table
DATA:
BDC_TAB TYPE STANDARD TABLE OF
BDCDATA INITIAL SIZE 6 .
DATA:
WA_BDC_TAB TYPE BDCDATA.
The internal table used to collect the transactions
information must be declared TYPE BDCDATA.
12
Data Interfaces |
Dec-2008
2005 IBM Corporation
IBM Global Services
Filling BDC Table - Method #1
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-PROGRAM =SAPMF02K.
WA_BDC_TAB-DYNPRO = 0106.
WA_BDC_TAB-DYNBEGIN = X.
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-FNAM = RF02K-LIFNR.
WA_BDC_TAB-FVAL = TEST1.
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_ BDC_TAB-FNAM = RF02K-D0110.
WA_BDC_TAB-FVAL = X.
APPEND WA_BDC_TAB TO BDC_TAB.
13
Data Interfaces |
CLEAR WA_BDC_TAB.
WA_BDC_TAB-PROGRAM = SAPMF02K.
WA_BDC_TAB-DYNPRO = 0111.
WA_BDC_TAB-DYNBEGIN = X.
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-FNAM = LFA1-STRAS.
WA_BDC_TAB-FVAL = 123 Main St.
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-FNAM = BDC_OKCODE.
WA_BDC_TAB-FVAL = =UPDA.
APPEND WA_BDC_TAB TO BDC_TAB.
ENDFORM.
Dec-2008
2005 IBM Corporation
IBM Global Services
Filling BDC Table - Method #1 (Contd.)
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-PROGRAM =SAPMF02K.
WA_ BDC_TAB-DYNPRO = 0106.
WA_BDC_TAB-DYNBEGIN = X.
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-FNAM = RF02K-LIFNR.
WA_BDC_TAB-FVAL = TEST1.
APPEND WA_BDC_TAB TO BDC_TAB
CLEAR WA_BDC_TAB..
WA_BDC_TAB-FNAM = RF02K-D0110.
WA_BDC_TAB-FVAL = X.
APPEND WA_BDC_TAB TO BDC_TAB.
14
Data Interfaces |
CLEAR WA_BDC_TAB.
WA_BDC_TAB-PROGRAM = SAPMF02K.
WA_BDC_TAB-DYNPRO = 0111.
WA_BDC_TAB-DYNBEGIN = X.
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-FNAM = LFA1-STRAS.
WA_BDC_TAB-FVAL = 123 Main St..
APPEND WA_BDC_TAB TO BDC_TAB.
CLEAR WA_BDC_TAB.
WA_BDC_TAB-FNAM = BDC_OKCODE.
WA_BDC_TAB-FVAL = =UPDA.
APPEND WA_BDC_TAB TO BDC_TAB.
ENDFORM.
Dec-2008
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
0106,
TEST1,
X,
1 SAPMF02K
LFA1-STRAS
BDC_OKCODE
0111,
123 Main St.,
=UPDA.
FORM POPULATE_BDC_TAB USING
FLAG TYPE C
VAR1 TYPE C
VAR2 TYPE C.
CLEAR WA_BDC_TAB.
IF FLAG = 1.
WA_BDC_TAB-PROGRAM = VAR1.
WA_ BDC_TAB-DYNPRO = VAR2.
WA_ BDC_TAB-DYNBEGIN = X.
ELSE.
WA_BDC_TAB-FNAM = VAR1.
WA_BDC_TAB-FVAL
= VAR2.
ENDIF.
APPEND WA_BDC_TAB TO BDC_TAB.
ENDFORM.
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 |
Dec-2008
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
0106,
TEST1,
X,
1 SAPMF02K
LFA1-STRAS
BDC_OKCODE
0111,
123 Main St.,
=UPDA.
FORM POPULATE_BDC_TAB USING
FLAG TYPE C
VAR1 TYPE C
VAR2 TYPE C.
CLEAR WA_BDC_TAB.
IF FLAG = 1.
WA_BDC_TAB-PROGRAM = VAR1.
WA_BDC_TAB-DYNPRO = VAR2.
WA_BDC_TAB-DYNBEGIN = X.
ELSE.
WA_BDC_TAB-FNAM = VAR1.
WA_BDC_TAB-FVAL
= VAR2.
ENDIF.
APPEND WA_BDC_TAB TO BDC_TAB.
ENDFORM.
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 |
Dec-2008
2005 IBM Corporation
IBM Global Services
Batch Input Methods
17
Method #1
Batch Input Session
Method #2
CALL TRANSACTION
USING Statement
Data Interfaces |
Dec-2008
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 |
Dec-2008
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 |
Dec-2008
2005 IBM Corporation
IBM Global Services
Summary
The <bdc table> must be declared TYPE BDCDATA.
To fill the BDC table delete all entries first with the REFRESH statement
Initialize the Work-area 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 |
Dec-2008
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 |
Dec-2008
2005 IBM Corporation