Chapter 05 - Batch Input Session
Chapter 05 - Batch Input Session
Data Interfaces |
Dec-2008
Objectives
The participants will be able to:
Create the Batch Input part of an Inbound Interface.
Describe the Batch Input Session Method for Batch Input.
Data Interfaces |
Dec-2008
Overview
BDC
Program
External
Data
SAP
Database
Table
Batch
Input
Session
Data Interfaces |
Dec-2008
BDC_INSERT is
called for each
transaction
entered into the
batch input
session.
Data Interfaces |
Dec-2008
BDC_OPEN_GROUP
= <client>
GROUP
= <session name>
HOLDDATE
=1
CHECK
SY-SUBRC
...
OTHERS
Data Interfaces |
= 11.
Dec-2008
BDC_INSERT
= <transaction code>
POST_LOCAL
= <local update>
TABLES
DYNPROTAB
EXCEPTIONS
INTERNAL_ERROR
=1
...
OTHERS
Data Interfaces |
CHECK
SY-SUBRC
= 5.
Dec-2008
BDC_INSERT (Contd.)
= <transaction code>
POST_LOCAL
= <local update>
TABLES
DYNPROTAB
EXCEPTIONS
INTERNAL_ERROR
=1
...
OTHERS
Data Interfaces |
CHECK
SY-SUBRC
= 5.
Dec-2008
BDC_CLOSE_GROUP
=1
QUEUE_ERROR = 2
OTHERS
Data Interfaces |
= 3.
CHECK
SY-SUBRC
Dec-2008
Data Section
Transaction Data
Data Interfaces |
Dec-2008
Vendor
Company Code
Address
10
Data Interfaces |
ABAPXX-002
Name
Computers, Inc.
Street
Buyer, Inc.1
City
Philadelphia
Dec-2008
11
Data Interfaces |
Dec-2008
Step #2
Step #3
Step #4
Step #5
START-OF-SELECTION.
CALL FUNCTION BDC_OPEN_GROUP
EXPORTING
CLIENT
= SY-MANDT
GROUP
= SESSION
USER
= SY-UNAME
EXCEPTIONS. . . .
PERFORM FILL_BDC_TAB.
CALL FUNCTION BDC_INSERT
EXPORTING
TCODE
= FK02
TABLES
DYNPROTAB = BDC_TAB
EXCEPTIONS. . . .
CALL FUNCTION BDC_CLOSE_GROUP
EXCEPTIONS. . . .
Data Interfaces |
Dec-2008
Example #1 - Subroutines
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1SAPMF02K
RF02K-LIFNR
RF02K-D0110
0106,
ABAPXX-002,
X,
1SAPMF02K
LFA1-STRAS
BDC_OKCODE
0110,
Buyer, Inc.1,
=UPDA.
ENDFORM.
ENDFORM.
13
Data Interfaces |
Dec-2008
Vendor
TEST1
Company Code
X
TEST2
Company Code
X
Address
City
14
Address
Vendor
Philadelphia
Data Interfaces |
City
Boston
Dec-2008
TEST1
TEST2
10 Walnut St.
TEST3
32 Chestnut St.
TEST4
30 Market St.
TEST5
17 S. 30th St.
File name:
/tmp/bc180_file3
15
Data Interfaces |
Dec-2008
Step #1
Step #2
BEGIN OF INREC,
VENDNUM TYPE LIFNR,
STREET TYPE STRAS_GP,
END OF INREC.
Data Interfaces |
Dec-2008
Step #9
Step #10
START-OF-SELECTION.
CHECK
OPEN DATASET INFILE
SY-SUBRC
FOR INPUT IN TEXT MODE
ENCODING DEFAULT.
CALL FUNCTION BDC_OPEN_GROUP. . . .
DO.
READ DATASET INFILE INTO INREC.
IF SY-SUBRC <> 0. EXIT. ENDIF.
PERFORM FILL_BDC_TAB.
CALL FUNCTION BDC_INSERT
EXPORTING
TCODE
= FK02
TABLES
DYNPROTAB = BDC_TAB. . . .
ENDDO.
CALL FUNCTION BDC_CLOSE_GROUP. . . .
CLOSE DATASET INFILE.
** This program is continued on the next slide **
17
Data Interfaces |
Dec-2008
Example #2 - Subroutines
FORM FILL_BDC_TAB.
REFRESH BDC_TAB.
PERFORM POPULATE_BDC_TAB
USING:
1 SAPMF02K
RF02K-LIFNR
RF02K-D0110
0106,
INREC-VENDNUM,
X,
1 SAPMF02K
LFA1-STRAS
BDC_OKCODE
0110,
INREC-STREET,
=UPDA.
ENDFORM.
Notice that the vendor number and street values are coming from the files
records read into the INREC structure.
18
Data Interfaces |
Dec-2008
Demonstration
Creation of a custom batch input session program for transaction XD02 (Change
Customer).
19
Data Interfaces |
Dec-2008
Practice
Creation of a custom batch input session program for transaction XD02 (Change
Customer).
20
Data Interfaces |
Dec-2008
Summary
Research Transaction
Data Interfaces |
Dec-2008
Questions
What are the function modules required to create a batch input session ?
In what sequence are they called ?
22
Data Interfaces |
Dec-2008