Вы находитесь на странице: 1из 14

SAP BDC (BATCH DATA COMMUNICATION) PROJECT 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 ender !aster "ata into the appropriate ta#les in SAP. endor data can use either internal or external num#ering (this concept will #e discussed in the lecture). $our application will include logic that ta%es #oth scenarios into consideration. $ou will write this A&AP application as &"' program. (ood luc%) Part 1- Introduction "uring a typical conversion, a functional consultant will wor% with you (technical A&AP programmer) to define the fields that need to #e populated. The functional consultant will step through the transaction with you and identify the appropriate fields for the conversion. *n this scenario, * will serve as the +unctional 'onsultant and inform you of the fields needed for the conversion. (+or the following example, you will #e using the endor !aster screen !,-. or /ogistics !aterials !anagement Purchasing, !aster "ata endor Purchasing 'reate) Proceed to create a fictitious vendor in the system (no special characters). Specify 0/*1+2 as the account group. 3nce the functional consultant identifies the various fields for the conversion, you will need to capture the program name, screen num#er, transaction, and field4ta#le information. To do this, place your mouse pointer in the 0name2 field and press the +. (5elp) %ey.

+rom the 5elp Screen, locate and clic% on the #utton 0Technical *nfo2. The following window will appear6

+rom this window, record the Program 7ame, Screen 7um#er, Ta#le, and +ield 7ame. To get the transaction num#er, exit out of the window and go to the System Status command in the menu #ar. 7ote6 This data is typically recorded in a documentation template. +or this exercise, use the SAP 89A "ata#ase application (if it2s loaded on your machine) otherwise, record the info in your own custom template in :ord or 1xcel. Proceed to o#tain the technical information for the following fields6

endor 7ame Search Term 'ity ;ip4Postal 'ode 'ountry /anguage 'urrency The ta#le a#ove list the minimum re<uired fields for endor !aster "ata. +rom a logical perspective, you should as% yourself what fields are specific to SAP. Specific SAP fields will generally not #e populated from your external data source (#ecause some fields in SAP already have data and you wouldn2t expect it from the legacy system). 3nce all your fields are defined, you would typically give these field re<uirements to a 0legacy2 person to extract the appropriate data set for the data conversion.

7ote6 any SAP defined field will contain logic #ehind it (e.g. drop down arrows indicate multiple values=this info will not #e found in legacy system). A good <uestion to as% the functional consultant would #e if there is any 0default2 values for a field. *n reference to internal 9 external num#ering (this topic will #e discussed in class) the account group drives the vendor num#er. This is imperative to %now in advance. *f you have experience from the functional side or have used the *!( tool, you can find out the different account groups and num#ering schemes #ased upon the following menu path in the *!(6 +inancial Accounting A>4AP endor Accounts !aster >ecords Preparation for 'reating endor !aster 'reate 7um#er Allocate ? >anges (specify internal4external num#ers).

*f the client doesn2t have a preference, use *nternal. *mportant Account (roups6

,>1" @ internal SAP num#ering /*1+ @ external vendor num#ering 5ere is a scenario for you to consider when performing a data conversion6 The company you are consulting for has a legacy system containing .--- vendors. The company has recently performed an analysis of open P32s (Purchase 3rders). The analysis results indicate there are open P32s for A-- vendors. +or the data conversion, these A-- vendors will use external vendor num#ering (so there2s no conflict with invoice matching). The remaining vendors without open P32s will #e assigned internal vendor num#ering. The legacy programmer has provided you with A separate files. 3ne file contains a list of vendors with open P32s, while the other file contains a list of vendors without outstanding P32s. $our tas% is to write an A&AP &"' program that imports the data in the text files to the appropriate A&AP ta#les. "on2t forget, your program needs to contain logic to determine if the text file is for internal4external vendor num#ering. Part 2 Process *n part two, you will use #atch functions within SAP. The ta#le #elow lists the different transaction codes to get started with setting up your #atch recording. Transactions6 Transaction S5"& S!BC Description &atch *nput >ecording (records a #atch session) &atch *nput *nitial Screen (to review recorded #atch sessions)

To #egin, go to transaction S5"&.

7ame the recording session DE&"'EFF (where FF is the last two num#ers of your assigned logon id). +rom the menu #ar, select Recording Create. +or the transaction code, enter !,-. (the initial vendor master create screen).

$our #atch recording session in now initiated. To #egin, enter in a fictitious vendor as performed in Part . of this project.

+rom the 'reate endor6 Address screen, input the following fields (remem#er, these are the minimum re<uired endor !aster "ata fields for our data conversion)6

+rom the next page, select GS" as currency type (this may not #e an option).

$our #atch input recording session should resem#le the following6

After you record the #atch session, generate the program #ased upon what was recorded (very similar to a !acro). Start #y going #ac% to transaction S5"&. 'lic% on the overview tool#ar icon, or press +H.

/oo% for your session recording and clic% once on the line item. :hen your session is highlighted, clic% on 0(enerate Program2 from the tool #ar. 7ame your program Z_BDC_ (where FF is the last two digits of your assigned login id).

At the attri#utes screen, fill in the appropriate values=.you may use the following as a guideline (notice the application is type6 !)6

After the attri#utes have #een filled out, review the generated A&AP4I code6

7otice all the perform statements that have #een coded for you. PART 3 Editing the Code The last part of this project involves editing the code of the generated A&AP4I &"' program. This program needs to upload the files the legacy programmer has provided you, as well as code any special logic. To finish the program, you will need to create an internal ta#le that will store all the values that need to #e populated in the endor !aster "ata ta#le (/+A.). $ou will need to setup a Parameters statement to accept the import files. +inally, you will need to write special logic to get the desired output. *f the &"' program is not currently open, go to the A&AP :or%#ench and open the &"' program. After the reports statement, use the ta#les statement to call two ta#les6

Ta!"e Description /+A. endor !aster "ata >/(>AP Structure used when uploading4downloading file formats 7ext, use the parameters statement to accept the input of the text file (path)6
parameters: p_file like rlgrap-filename.

'reate an internal ta#le that contains the structure of the import file.
data: begin of itab occurs 10, vendor like lfa1-lifnr, name like lfa1-name1, city like lfa1-ort01, zip like lfa1-pstlz, end of itab.

7ote6 ma%e sure you use the data dictionary to #ecome familiar with the /+A. ta#le and its fields. >eview the text files that will #e used for the upload. 7otice the space that is separating each value. To account for the space in the import file, use the following varia#les (data o#ject)6
%t&is represents a tab in a file

data: wf_record( 0!, wf_split type " value #0$#.

8uestion6 what do you thin% 0#dcrecxx2 is referring to from your codeJ After the 0StartKofKSelection2 statement, place a new su#routine that gets the data from the input file6
perform get_data.

Tip6 you can #o$!"e%c"ic& on the getEdata name and A&AP4I will automatically generate the re<uired entries in your code to initialiDe the su#routine. After the form 0getEdata2 statement, use the open dataset command to get the text file6
open dataset p_file in te"t mode.

do.

>eview the following "o Statement (we will go over this command in lecture).
read dataset p_file into wf_record. if sy-subrc ne 0. e"it. else. split wf_record at wf_split into itab-vendor itab-name itab-city itab-zip. append itab.

enddo.

endif.

The last statement in your program (#efore 0endform.2) should #e6


close dataset p_file.

After the openEgroup statement, start looping your program.


loop at itab. %start looping t&roug& all all records from file

Gse the ta#le #elow to replace the &"' +ield values with the values from the internal ta#le6 Ori)ina" *a"$e ;&"'T1STFF >+-A,K,T3,, &"' Test &or<ueD FF &"'T1 &everly 5ills M-A.. C+an)e to *a"$e ita#Kvendor. >efer to *f statement #elow ita#Kname. ita#KnameL-(C). ita#Kcity. ita#KDip.

BDC 'ie"# Na(e >+-A,K/*+7> &"'E'G>S3> /+A.K7A!1. /+A.KS3>T/ /+A.K3>T-. /+A.KPST/;

To determine the type of group, use the following if statement6


if itab-vendor ' space. perform bdc_field else. perform bdc_field endif. using #()0*+-+,-++# #kred#. using #()0*+-+,-++# #./0)#.

After the statement6


perform bdc_transaction using #1+01#.

>efresh the data with the command6

refres& bdcdata. % clear all records in table, not 2ust &eader record

Press ', or E-ec$te to run the program6

:hen your program runs, use the following parameters (ma%e sure you chec% the .eep Session c+ec& !o-)6

'lic% on E-ec$te.

*f you are successful with executing the program, you could expect the following screen6

Test the results of your program #y going to transaction SM/0.

*f you forget the name of your session, clic% on the o1er1ie2 #utton. $ou should #e a#le to see your session in the 0Session still to e !rocessed2 area.

Do$!"e%c"ic& on your session6

'lic% on Process.

The system will now wal% you through the #atch process for your text file. 7otice the values that are given to each field during this wal% through. *n the future, you may run this process in 0&ac%ground2 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. :hen the #atch process completes, you will see the following window6

To chec% the log, go #ac% to SM/0 and clic% overview. Select your session and clic% on 3o) from the tool#ar.

$ou will see the results from your successful #atch input6

That2s all fol%s)

Вам также может понравиться