BDC

What is BDC? • BDC stands for Batch Data Communication • BDC is a method of data entry • BDC simulates a user manually entering data through SAP, using the same screens and process that a user would; BDC does this entering of data as quickly as the system can handle it Examples of when BDC can be used • Payroll Area Changes (infotype 1) o This could happen if a company modifies its structure and combines two payroll areas (P1 and P2) into just P1. In this case, the BDC would search through personnel numbers, look for any infotype 1 records whose payroll area is P2, and change this payroll area to P1. • Pay Rate Increases (infotype 8) o This could happen if a company wants to give a pay raise to all employees in a certain group. In this case, the BDC would search through personnel numbers, look for personnel numbers meeting the proper criteria, and modify their pay rate information in infotype 8. • Basically any situation like the two above that are highly repetitive and whose changes are fairly uniform Why use BDC instead of a direct table update? • Data Security o SAP ensures that the user running the BDC has the proper authorizations to modify this data; a direct table update does not have this check • Data Integrity o SAP ensures the data being entered makes sense (for example, the beginning date of an infotype record (BEGDA) should always be before the ending date (ENDDA) • Record History o The most recent change can be tracked. Direct table update will bypass this feature that is on infotypes and tables. Two methods of using BDC • Writing the code yourself o This requires a good understanding of what is going on in the BDC o Advantage is that it is usually much cleaner and efficient o Disadvantage is that it takes longer to develop o User unable to identify specific errors in data o Does the update directly from the program, does not create a session that must be run from transaction SM35

unneeded code can sometimes be generated o Creates a session that must be run from SM35 before the update takes place. These four elements are key in instructing the BDC as to what to update. pressing F1. and selecting “technical info”. and to do this through a certain screen of a certain transaction (program name). . For example. clicking on the desired field. The BDC is instructed to update a certain field in a certain table. infotype 1. you could tell the BDC to update P0001BEGDA (table name and field name) through screen 2010 (screen number) of program name MP000100 (transaction PA30 for infotype 1).• Using the BDC recorder to generate the code for you (transaction SHDB) o Advantage is that it can be developed very quickly but usually requires a few minor modifications o Disadvantage is that extraneous. does NOT update directly from the program Important elements to BDC: • Program name • Screen number • Table name • Field name These can all be found by going to the desired transaction and screen (PA30. for example).

Writing BDC Code Without Transaction SHDB (To be accompanied by zbatch1 code) Important Elements • Internal Table T_BDC o Holds the instructions for the BDC • Form BUILD_BDC o Fills table T_BDC with instructions • Form BDC_SCREEN o Creates the instruction to begin input in a new screen • Form BDC_FIELD o Creates the instruction to input a new value in a certain field (or to process a certain OKCODE • Form SUBMIT_BDC o Submits the contents of table T_BDC as instructions for the BDC. . The F-KEY value for “create” is F6. The OKCODE for “change” is / 6. To code these instructions. For example. The OKCODE for “save” is /11. ZBATCH1 Program • Program is designed to change payroll areas ‘B1’. the OKCODE equivalent of an instruction is related to the instruction’s F-KEY value. The OKCODE for this would be /20. Generally. OKCODE’s are used. For example. The OKCODE for “change” is /5. ‘B2’. If an instruction’s F-KEY value has a shift + a number. • OKCODE’s o These are instructions such as “change”. the “overview” instruction’s F-KEY value may be shift + 8. “create”. • Program outputs successful personnel numbers as well as those with errors to the screen. the F-KEY value for “change” is F5. this generally means the OKCODE will be 12 + the number. or “save” that the user would normally indicate by clicking an icon at the top of the screen. and ‘M1’ into payroll area ‘W1’ in infotype 1. ‘MG’.

BDC Exercise • • • • Write a BDC program that will update infotype 16 (contract elements) through transaction PA30 Fill the field “initial entry date” with the current date Write the code for this program first without using the BDC recorder (transaction SHDB) Write the code for this program next by using the BDC recorder (transaction SHDB) .

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.