You are on page 1of 310
Helps to Reach ; wit) edi TN ad ABAP/4 The Complete Reference About the Author Ganapati Adimulam is an SAP Technical Consultant. Having nearly four years of Experience in the SAP Domain, several successful implementation, and a background in training and technical documentation has afforded him many opportunities to observe all aspects of SAP implemestation. Mr. Ganapati did his M.C.A in 2002. He started his SAP career in 2003 March. He has worked for corporate giants like CGEY (CapGemini Ernest & Young), Infosys and Satyam Computers and also for many other international clients as both onsite and off- shore Vechnical consultant. terest is in SAP training domain, he has turiied into SAP training services after relieving from the corporate biggies. He is présently\ offering excellent waining services in SAP through eMax Technologies, He: is -also%ay efor imparting SAP tiaining to the corporate consultants. He is a big talk atnor porate as a very good SAP corporate trainer. E As his basi “ From eMAX Technologies. ACKNOWLEDGEMENTS . Doing a book of this magnitude requires a team effort, Every task is completely successful if and only if we acknowledge the efforts contributed by the individual persomel. We acknowledge our sincere thanks to out Honorable Director, eMax Technologies, Mr. Rama Rao for his continuous guidance, support and co-operation through this project. I want to take this opportunity to thank the entire management, beloved students and friends and several other individuals of ¢Max Technologies inreviewing and assuring the quality checks of the accomplishments at every stage of this projeet, Finally I would like to extend my sincere thanks to my family members from the bottom of my heart, Ganapati Adinutam, _ INDEX 1. BDC Programming 22, 72 2. SAP SCRIPT | _81 3. MODULE Programming 60 4.LSMW “ey 27 5.working with Files 29. 1. BDC Programming 1. Introduction to BDC Programming 2. Call Transaction Method a. Processing Errors 3. Session Method a. For Single transaction b. For Multiple Transactions in One Session 4. Handling Table Control in BDC we Direct Input BDC (Batch Data Communication) We Never Compromise in Quality, Would You? Page | of 22 By G BDC (Batch Data Communication) _ It is One of the Data Transfer Method. Data transfer methods are divided as Outbound and Inbound. Outbound: Transfer the data from the Source system to Target System(External/Internal) Outbound is a data transfer from SAP to SAP / Non SAP. Note: Source System is always SAP Inbound: Data ivanster from External System into SAP. i.e. Inbound is a technique to transfer the Data from SAP/Non-SAP into SAP Note: Target System is always SAP. sap * SAP Non-SaP. |_——~ Note: BDC is an Inbound Data transfer Technique. About Data Transfer in R/3 System When a company decides to implement the SAP R/3 to manage business-critical data, it Usually does not start fiom a no-data situation. Normally, a SAP R/3 project comes in to replace or complement to an existing application In the process of replacing current application and transferring application data, two Situations might secur napati Adimulam eMax Technologies,Ameerpet, Hyderabad Ph No :+91 40 -65976727, Cell No : 99484 44808,98490 34399, www.emastech.com BDC (Batch Data Communication) ‘We Never Comprom Quality, Would You? 1. The first is when application data to be replaced is transferred at once and only once. 2. The second situation is to transfer data periodically from external system to SAP and Vice versa. ‘There is a period of time when information has to be transferred from existing Application, to SAP R/3, and often this process will be repetitive. Prema Seeasaen £xternal system Cl SAP System SAP data For reasons of efficiency, large volumes of data cannot be transferred manually from an external system into the R/3 System. A data transfer is required that transfers the data automatically in the Background, ‘The SAP system offers Three methods for transferring data into SAP Systems From non-SAP Systems or legacy system. 1, SESSION METHOD 2. CALL TRANSACTION 3, DIRECT INPUT. Note: Both Session Method and Call Transaction, We call BACH INPUT Methods. Where as Direct Inputs are standard programs to post the data into SAP. , Advantages offered by BATCH INPUT method: [ 1. Can process large data volumes in batch Can be planned and submitted in the background 3. No manual interaction is required when data is transferred. Page 2 of 22 By Ganapati Adimulam ‘Max Technologics,Ameerpet,Hyderabad Ph No :+91 40 65976727, Cell No : 99484 44808,98490 34399, www.emaxtech.com BDC (Batch Data Communication) We Never Compromise in Quality, Would You? Note : To implement one of the supported data transfers, you must often w: ‘the program that Exports the data from your non-SAP/SAP System. This program. known as a“data teansfer” program must map the data from the external system into the data structure required by she SAP batch input program, Writing a Data Transfer Program involves following prerequis 1. Analyzing transaction Rien hia as SAP Transaction ontine Analyzing transaction Involves following steps. © Which fields require input i.e., mandatory Which fields you can allow defaulting to standard values. The names. Types and lengths of the fields that are used by a transaction. * Check whether some fields will need conversion of their data types and/or data lengths, Most of the data from the external system must be converted into SAP format. We call this “formatting” the data. © Sereen number and name of module pool program behind that particular transaction To analyze a transaction, do the following * Start the transaction by menu or by entering the transaction code in the command Box * Step through the transaction, by entering the data will be required for processing your batch input data, © Oneach screen, note the program name and sereen (dynpro) number. ( dynpro = dyn + pro, Dyn = screen, Pro = number) Page 3 of 22 By Ganapati Adimulam Max Technologies,Ameerpet.Hyderabad Ph No :#91 40 -65976727, Cell No : 99484 44808,98490 34399, www. maxtech.com BDC (Batch Data Communication) We Never Compro Quality, Would You? © youcan get the program name anil sereen number by pressing FI on any field or button on the screen. the Technical info pop-up shows not only the field information but also the program and screen. Note : Repeat the Procedure of finding the Program Name, Screen no, Field Name and their data type and length for each field on each sereen for all the fields. Note: At the end of analyzing the transaction code, we should have all the screen and fields Details So that we can write the DATA TRANSFER program, Note : Since it is very difficult to collect all the sereen and field details by pressing F1 -> Technical Infornsation on each field when we have multiple screens and more fields , So SAP provided one transaction SHDB to record all the Screen and Field Details along with the Function ) « Cadloc The SHDB transaction ,records all the screen, field and OK_Code details for any transaction. 2.Declaring internal tables. First internal table similar to structure like Input Plat file(T_DATA) Second internal table(IT_BDCDATA) like DDIC Structure BDCDATA. (to maintain the screen and field details). Third internal table(IT_BDCMSGCOLL) like DDIC Structure BDCMSGCOLL. (This Internal table is required Only we work with Call Transaction to process “ the Errors in call transaction), 3. Transferring data from flat file to internal table(IT_DATA). ‘This depends on the source of the File Source of file Presentation server Application server Page 4 of 22 By Ganapati Adimulam ‘eMax Technologies, Ameerpet,Ayderabad Ph No :+91 40 -65976727, Cell No : 99484 44808,98490 34399, www.emaxtech.com BDC (Batch Data Communication) ‘We Never Compromise in Quality, Would You? Call fuction module: “GUI_UPLOAD: Reading from file into Input Step 1 : open file. Filename = “file name + path’ Step 2 : Read record by record Output from file append wo = “internal table to store the data from file’ . Step 3 : close file 4. Population of BOCDATA into the Internal Table(IT_BDCDATA) And Process the transaction using the IT_BDCDATA For Each record in IT_DATA. ie For each record in IT_DATA(Loop at IT_DATA). A) At the beginning of each new screen, we must maintain the module pool name . the screen number and a lag WA_BDCDATA-PROGRAM = . WA_BDCDATA -DYNPRO = . WA_BDCDATA -DYNBEGIN ='X', APPEND WA_BDCDATA TO IT_ BDCDATA. CLEAR WA_BDCDATA. B) For each field to which you want to assign values, insert an entry in the intemal table IT_BDCDATA. Specify the technical field name and the field content WA_BDCDATA-FNAM = . WA_BDCDATA-FVAL = . APPEND WA_BDCDATA TO IT_BDCDATA. CLEAR WA_BDCDATA. Now specify which action is to be executed in this screen. You must determine the triggered function code and assign this with the field FVAL. Note that the character'/” should always be placed before the function key number The character '=' must be placed before all other function codes, Assign value BDC_OKCODE 10 the field FNAM. WA_BDCDATA-ENAM = ‘BDC_OKCODE’. Page 5 of 22 By Ganapati Adimulam ‘Max Technologies,Ameerpet,Hlyderabad Ph No :+91 40 65976727, Cell No : 99484 44808,98490 34399, www.emaxtech.com

You might also like