Você está na página 1de 4

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

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, unneeded code can sometimes be generated o Creates a session that must be run from SM35 before the update takes place; 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, infotype 1, for example), clicking on the desired field, pressing F1, and selecting technical info. These four elements are key in instructing the BDC as to what to update. The BDC is instructed to update a certain field in a certain table, and to do this through a certain screen of a certain transaction (program name). For example, 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).

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. OKCODEs o These are instructions such as change, create, or save that the user would normally indicate by clicking an icon at the top of the screen. To code these instructions, OKCODEs are used. Generally, the OKCODE equivalent of an instruction is related to the instructions F-KEY value. For example, the F-KEY value for change is F5. The OKCODE for change is /5. The F-KEY value for create is F6. The OKCODE for change is / 6. The OKCODE for save is /11. If an instructions F-KEY value has a shift + a number, this generally means the OKCODE will be 12 + the number. For example, the overview instructions F-KEY value may be shift + 8. The OKCODE for this would be /20. ZBATCH1 Program Program is designed to change payroll areas B1, B2, MG, and M1 into payroll area W1 in infotype 1. Program outputs successful personnel numbers as well as those with errors to the screen.

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)

Você também pode gostar