Professional Documents
Culture Documents
BDC
BDC
Overview
This project will provide a general overview of a data conversion scenario with SAP.
Specifically, you will use a text file (.csv format) and import Vender Master Data into the
appropriate tables in SAP. Vendor data can use either internal or external numbering (this
concept will be discussed in the lecture). Your application will include logic that takes
both scenarios into consideration. You will write this ABAP application as BDC
program. Good luck!
Part 1- Introduction
During a typical conversion, a functional consultant will work with you (technical ABAP
programmer) to define the fields that need to be populated. The functional consultant
will step through the transaction with you and identify the appropriate fields for the
conversion. In this scenario, I will serve as the Functional Consultant and inform you of
the fields needed for the conversion.
(For the following example, you will be using the Vendor Master screen MK01 or
Logistics Materials Management Purchasing, Master Data Vendor
Purchasing Create)
Proceed to create a fictitious vendor in the system (no special characters). Specify
LIEF as the account group.
Once the functional consultant identifies the various fields for the conversion, you
will need to capture the program name, screen number, transaction, and field/table
information. To do this, place your mouse pointer in the name field and press
the F1 (Help) key.
From the Help Screen, locate and click on the button Technical Info. The
following window will appear:
From this window, record the Program Name, Screen Number, Table, and Field
Name. To get the transaction number, exit out of the window and go to the
System Status command in the menu bar.
Vendor Name
Search Term
City
Zip/Postal Code
Country
Language
Currency
The table above list the minimum required fields for Vendor Master Data. From a logical
perspective, you should ask yourself what fields are specific to SAP. Specific SAP fields
will generally not be populated from your external data source (because some fields in
SAP already have data and you wouldnt expect it from the legacy system). Once all
your fields are defined, you would typically give these field requirements to a legacy
person to extract the appropriate data set for the data conversion.
Note: any SAP defined field will contain logic behind it (e.g. drop down arrows
indicate multiple valuesthis info will not be found in legacy system).
A good question to ask the functional consultant would be if there is any default
values for a field.
The company you are consulting for has a legacy system containing 1000 vendors. The
company has recently performed an analysis of open POs (Purchase Orders). The
analysis results indicate there are open POs for 200 vendors. For the data conversion,
these 200 vendors will use external vendor numbering (so theres no conflict with invoice
matching). The remaining vendors without open POs will be assigned internal vendor
numbering. The legacy programmer has provided you with 2 separate files. One file
contains a list of vendors with open POs, while the other file contains a list of vendors
without outstanding POs.
Your task is to write an ABAP BDC program that imports the data in the text files to the
appropriate ABAP tables. Dont forget, your program needs to contain logic to determine
if the text file is for internal/external vendor numbering.
Part 2 Process
In part two, you will use batch functions within SAP. The table below lists the different
transaction codes to get started with setting up your batch recording.
Transactions:
Transaction Description
SHDB Batch Input Recording (records a batch session)
SM35 Batch Input Initial Screen (to review recorded batch sessions)
To begin, go to transaction SHDB.
Name the recording session z_BDC_XX (where XX is the last two numbers of
your assigned logon id). From the menu bar, select Recording Create.
For the transaction code, enter MK01 (the initial vendor master create screen).
From the next page, select USD as currency type (this may not be an option).
After you record the batch session, generate the program based upon what was recorded
(very similar to a Macro).
Start by going back to transaction SHDB. Click on the overview toolbar icon, or
press F8.
Look for your session recording and click once on the line item. When your
session is highlighted, click on Generate Program from the tool bar. Name your
program Z_BDC_XX (where XX is the last two digits of your assigned login id).
At the attributes screen, fill in the appropriate values.you may use the following
as a guideline (notice the application is type: M):
After the attributes have been filled out, review the generated ABAP/4 code:
Notice all the perform statements that have been coded for you.
If the BDC program is not currently open, go to the ABAP Workbench and open
the BDC program. After the reports statement, use the tables statement to call two
tables:
Table Description
LFA1 Vendor Master Data
RLGRAP Structure used when uploading/downloading file formats
Next, use the parameters statement to accept the input of the text file (path):
Create an internal table that contains the structure of the import file.
Note: make sure you use the data dictionary to become familiar with the LFA1
table and its fields.
Review the text files that will be used for the upload. Notice the space that is
separating each value. To account for the space in the import file, use the
following variables (data object):
data: wf_record(80),
wf_split type x value '09'. "this represents a tab in a file
After the Start-of-Selection statement, place a new subroutine that gets the data
from the input file:
perform get_data.
Tip: you can double-click on the get_data name and ABAP/4 will automatically
generate the required entries in your code to initialize the subroutine.
After the form get_data statement, use the open dataset command to get the text
file:
Review the following Do Statement (we will go over this command in lecture).
do.
read dataset p_file into wf_record.
if sy-subrc ne 0.
exit.
else.
split wf_record at wf_split into itab-vendor itab-name itab-
city
itab-zip.
append itab.
endif.
enddo.
The last statement in your program (before endform.) should be:
loop at itab. "start looping through all all records from file
Use the table below to replace the BDC Field values with the values from the
internal table:
if itab-vendor = space.
perform bdc_field using 'RF02K-KTOKK'
'kred'.
else.
perform bdc_field using 'RF02K-KTOKK'
'LIEF'.
endif.
Click on Execute.
If you are successful with executing the program, you could expect the following screen:
Test the results of your program by going to transaction SM35.
If you forget the name of your session, click on the overview button. You should
be able to see your session in the Session still to be processed area.
Double-click on your session:
Click on Process.
The system will now walk you through the batch process for your text file. Notice the
values that are given to each field during this walk through. In the future, you may run
this process in Background mode if you are importing thousands of records, rather than
just a few. This is a good test to see if your program can successfully run the text file.
When the batch process completes, you will see the following window:
To check the log, go back to SM35 and click overview. Select your session and
click on Log from the toolbar.
You will see the results from your successful batch input: