Sunteți pe pagina 1din 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.

2 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Overview

External System SAP System

Data Batch Input

3 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Data Transfer Rules

External
Data

SAP
Checks & Database
Validations Table

External
Data

4 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Online Program

To check and validate the external Vendor TEST1


data, user dialogue is simulated
through an SAP transaction Company Code
(i.e., an online program).
X Address

Name Computers, Inc.

Street

City Philadelphia

5 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

BDCDATA Structure

To simulate user dialogue,


you must know the ABAP Dictionary
following information:
(1) online program name,
(2) screen numbers,
(3) field names, and “BDCDATA”
(4) field values.

The “BDCDATA” ABAP Dictionary structure


is used PROGRAM
in a batch input program to collect this DYNPRO
information for
an entire transaction. DYNBEGIN
FNAM
FVAL

6 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Example - Change Vendor

Vendor TEST1

Company Code

X Address
For our example, we will use the
“Change Vendor” transaction
(“FK02”) to add a street address to
an already existing vendor.

Name Computers, Inc.

Street 123 Main St.

City Philadelphia

7 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Researching Transaction - 1st Screen

Step #1 Step #2
Use “System > Status” menu path Use ‘F1’ key and “Technical Info”
to determine online program name pushbutton in each screen field to
(SAPMF02K), screen number be filled to determine the field
(0106), and transaction code name.
(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 Step #2
Use “System > Status” menu path Use ‘F1’ key and “Technical Info”
to determine online program name pushbutton in each screen field to
(SAPMF02K) and screen number be filled to determine the field
(0110). 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

9 Data Interfaces | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Researching Transaction - 2nd Screen (Contd.)

Step #1 Step #2
Use “System > Status” menu path Use ‘F1’ key and “Technical Info”
to determine online program name pushbutton in each screen field to
(SAPMF02K) and screen number be filled to determine the field
(0110). 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 X
RF02K-LIFNR TEST1
RF02K-D0110 X
BDC_OKCODE /00
SAPMF02K 0110 X
LFA1-STARS 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 transaction’s


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.
REFRESH BDC_TAB. BDC_TAB-PROGRAM = ‘SAPMF02K’.
BDC_TAB-DYNPRO = ‘0111’.
CLEAR BDC_TAB. BDC_TAB-DYNBEGIN = ‘X’.
BDC_TAB-PROGRAM = ‘SAPMF02K’. APPEND BDC_TAB.
BDC_TAB-DYNPRO = ‘0106’.
BDC_TAB-DYNBEGIN = ‘X’. CLEAR BDC_TAB.
APPEND BDC_TAB. BDC_TAB-FNAM = ‘LFA1-STRAS’.
BDC_TAB-FVAL = ‘123 Main St.’.
CLEAR BDC_TAB. APPEND BDC_TAB.
BDC_TAB-FNAM = ‘RF02K-LIFNR’.
BDC_TAB-FVAL = ‘TEST1’. CLEAR BDC_TAB.
APPEND BDC_TAB. BDC_TAB-FNAM = ‘BDC_OKCODE’.
BDC_TAB-FVAL = ‘=UPDA’.
CLEAR BDC_TAB. APPEND BDC_TAB.
BDC_TAB-FNAM = ‘RF02K-D0110’.
BDC_TAB-FVAL = ‘X’. ENDFORM.
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.
REFRESH BDC_TAB. BDC_TAB-PROGRAM = ‘SAPMF02K’.
BDC_TAB-DYNPRO = ‘0111’.
CLEAR BDC_TAB. BDC_TAB-DYNBEGIN = ‘X’.
BDC_TAB-PROGRAM = ‘SAPMF02K’. APPEND BDC_TAB.
BDC_TAB-DYNPRO = ‘0106’.
BDC_TAB-DYNBEGIN = ‘X’. CLEAR BDC_TAB.
APPEND BDC_TAB. BDC_TAB-FNAM = ‘LFA1-STRAS’.
BDC_TAB-FVAL = ‘123 Main St.’.
CLEAR BDC_TAB. APPEND BDC_TAB.
BDC_TAB-FNAM = ‘RF02K-LIFNR’.
BDC_TAB-FVAL = ‘TEST1’. CLEAR BDC_TAB.
APPEND BDC_TAB. BDC_TAB-FNAM = ‘BDC_OKCODE’.
BDC_TAB-FVAL = ‘=UPDA’.
CLEAR BDC_TAB. APPEND BDC_TAB.
BDC_TAB-FNAM = ‘RF02K-D0110’.
BDC_TAB-FVAL = ‘X’. ENDFORM.
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. FORM POPULATE_BDC_TAB USING


FLAG TYPE C
REFRESH BDC_TAB. VAR1 TYPE C
VAR2 TYPE C.
PERFORM POPULATE_BDC_TAB CLEAR BDC_TAB.
USING: IF FLAG = ‘1’.
BDC_TAB-PROGRAM= VAR1.
‘1’ ‘SAPMF02K’ ‘0106’, BDC_TAB-DYNPRO = VAR2.
‘ ’ ‘RF02K-LIFNR’ ‘TEST1’, BDC_TAB-DYNBEGIN= ‘X’.
‘ ’ ‘RF02K-D0110’ ‘X’, ELSE.
BDC_TAB-FNAM = VAR1.
‘1’ ‘SAPMF02K’ ‘0111’, BDC_TAB-FVAL = VAR2.
‘ ’ ‘LFA1-STRAS’ ‘123 Main St.’, ENDIF.
‘ ’ ‘BDC_OKCODE’ ‘=UPDA’. APPEND 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 | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Filling BDC Table - Method #2 (Contd.)

FORM FILL_BDC_TAB. FORM POPULATE_BDC_TAB USING


FLAG TYPE C
REFRESH BDC_TAB. VAR1 TYPE C
VAR2 TYPE C.
PERFORM POPULATE_BDC_TAB CLEAR BDC_TAB.
USING: IF FLAG = ‘1’.
BDC_TAB-PROGRAM= VAR1.
‘1’ ‘SAPMF02K’ ‘0106’, BDC_TAB-DYNPRO = VAR2.
‘ ’ ‘RF02K-LIFNR’ ‘TEST1’, BDC_TAB-DYNBEGIN= ‘X’.
‘ ’ ‘RF02K-D0110’ ‘X’, ELSE.
BDC_TAB-FNAM = VAR1.
‘1’ ‘SAPMF02K’ ‘0111’, BDC_TAB-FVAL = VAR2.
‘ ’ ‘LFA1-STRAS’ ‘123 Main St.’, ENDIF.
‘ ’ ‘BDC_OKCODE’ ‘=UPDA’. APPEND 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 | 7.04 March-2005 © 2005 IBM Corporation


IBM Global Services

Batch Input Methods

Method #1 Batch Input Session

“CALL TRANSACTION
Method #2 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

S-ar putea să vă placă și