Visit: José Antonio Campos Segura http://beginnerabap.blogspot.
com Contact: ja_c
amseg@hotmail.com Page 1 of 12 • • • • • • • • • • • Before You Begin. Exploring the Development Environment. Knowing such programs. Reports Defining Defining or programs or dialogue. Components of a Report. or di scover the object run-time program. o Introduction to the convention to name pro grams. Creating your first program. Exploring the source editor. o Using the Edi tor: Initial screen. or exploring the functionality of the source editor. Workin g with the SAP offering help or get help [F1]. or library Getting Help R3. Find Your Development Objects. Introduction to Data Dictionary R / 3. Exploring table s or structures. or view a table or structure definition. or display data from a table. Defining the fields or visualize. Understanding the Syntax of ABAP / 4. o Introduction to the SELECT statement. Knowing or Areas of Work or Introduction to the WHERE clause. or Working with system variables. Using the Operator or CH AIN. Use of the Judgement or SELECT SINGLE. code and documentation or formal com ment. Workshop. or questionnaire. or exercises with the Editor. or Exercise Prog ramming. Page 2 of 12 When you finish reading this, have learned to: • • • • • • • • Create and modify programs ABAP / 4 singles. Use standard functions the publisher of ABAP / 4. Us e F1 and support library of functions from R / 3. Use F1 and R / 3. Finding your programs using the object browser and editor. Display a table and its contents using the Data Dictionary. Use tables and SELECT statements. Stringing sentences using the operator CHAIN. Add comments to your programs and documentation. Before Before you begin, you should: • • Be familiar with programming languages like C, COBOL, or Visual Basic. For maximum benefit from these tutorials, it would be d esirable also had some experience in programming. Configure the interface as rec ommended in the tutorial, if not already done so. Remember, for better learning from tutorials, often these will come accompanied by a demonstration video format (SWF) Flash. December 3 page Exploring the Development Environment. An object of development (development object) is anything created by a programme r. Examples are development objects, screens, tables, views, structures, program s, data models, messages, and includes. The R / 3 System contains tools to creat e and test objects. These tools are the Workbench R / 3. To access any developme nt tool, we must go to the WorkBench. The Workbench contains the following tools to help create objects: • • • • • The software publisher ABAP / 4, where we can create and modify source code ABAP / 4 and other program components. The Dictio nary Data (Data Dictionary) where we can create tables, structures and views. Da ta modeling (Data Modeler) that we can document the relationships between the ta bles. The library of functions (Function library) where you can create function modules ABAP / 4 standard (which can be used in any program.) The designer of sc reens and menus we can create the interface of our programs (you can drag contro ls). It also has the following search tools and testing: • • • • • • Debugger ABAP / 4 (an extremely useful tool) SQL tracker tool used in SQL statements. The analyz er and optimizer performance of your programs at runtime. An automated test tool for regression testing. A search tool to locate objects pruned. The Workbench O rganizer (Workbench Organizer) to record changes in the objects to upload to pro duction. All objects are portable, you can have a copy of them in R / 3 system or another . This is very useful for moving objects from the development environment to pro duction environment. If the development environment works with an operating syst em and / or a different SGDB production environment, you can move all objects cr eated from one environment to another without making any changes to terms. (To s ee a list of hardware and operating systems, see table 1.1) Page 4 of 12 Knowing the types of programs There are two main types of programs, ABAP / 4: • • Reports (reports) Programs d ialog Defining Reports The purpose of a Report is reading data from the database and display them. The first screen is called the selection screen (selection screen). It contains fields that allow the user to enter criteria for the Report.For example, the Re port can display a list of customers with a given range (from 1 to Customer ID C ustomer ID 3). The second screen is the screen output (output screen). Contains the list of fields that we defined previously. (In our example show ID, Name and CIF) The selection screen is optional. Reports Not all have one. However, all g enerate a Listing Report. With these tutorials you will learn to create programs Reports. Defining Dialogue Programs Interactive software is more flexible than Reports and are more complex at the p rogramming level. They may contain several screens, and the sequence of screens can be changed dynamically at runtime. On each of the screens, you can put input fields (text boxes, checkboxes, etc.), Output fields, buttons. December 5 page Components of a Report The Reports ABAP / 4 are composed of five components: • • • • • Source Text Attributes Elements Documentation Variants Only the source code and attributes of the program are required. The other compo nents are optional. All objects and their components are stored in the database R / 3. For example, the source code for a report is stored in the table of the database dd010s. Knowing the Object Runtime All programs ABAP / 4 are interpreted, not compiled. The first time you run a pr ogram, the system automatically generates a runtime object. The runtime object i s preprocessed source code form. However, there is an executable that can run op erating system level. You need the R / 3 to be interpreted. The runtime object i s known as the program generator. If you change the source code, the runtime obj ect is automatically regenerated the first time you come back to run the program . December 6 page Naming our objects as standard The company you work for a client of SAP. Therefore, the programs you create in your company are called client programs. All client programs should be named fol lowing a convention predefined by SAP. These conventions are called customer nam e range. For software, the customer name range are 2-8 characters long and the p rogram's name start with the letter Y or Z. SAP reserves the lyrics to the X for their own programs. Take a moment to choose from three unique characters to ide ntify your favorite lyrics. Must begin with a Y or Z. For example, you can use y our Z followed by two initials (JA in my case). For example if you ask me "Devel oping the ABC program" would name ZJAABC. It is recommended that you begin to na me all the objects that go created with the same nomenclature as you follow thes e tutorials to zxx (ZJA in my case) because it will be easier to find your items at the time of searching. The nomenclature we adopt in this tutorial are: • The example programs shown in these tutorials are the following nomenclature zjaccn n, where CC is the number of tutorial (in this case you are reading the 01-Your first ABAP program) NN is a sequential number from 01 to 99. Page 7 of 12 Creating your first program When you walk into the R / 3 to create your first program ABAP / 4, the first sc reen shown is the main menu of SAP. From there, go to the Development Workbench, and from there to the editor. Enter the program name and we will create it. The first screen you see is the Program Attributes screen. Here enter the program a nd data storage. Now we can enter the code editor. In the code editor, type your source code, it saved, check and run the program. Watch the video that accompan ies this tutorial (the first program 01_Tu ABAP.swf) Follow these steps to creat e your first program: 1. From the main menu of R / 3, select Tools ABAP / 4 Development Workbench. 2. We double click on ABAP / 4. . Initial screen appears Editor December 8 page 3. In the Program field, type the name of the program is 0101 (ZJA0101, remember to use the nomenclature seen above). . Attributes screen is displayed, 4. Click the button programs button ABAP / 4. At least you have to fill in the required fields to continue, a title or brief d escription of program functionality: and the type of program is: Page 9 of 12 5. Lock Box Editor, activates a lock on the program so that it can not be change d by another user than the creator. Normally not used blocking programs, as when working in a company often have to modify code of a colleague or former employe e and vice versa. 6.To save the attributes of the program, please click the Cre ate Object Catalog screen Entry. . Appears . 7. Click the button 8. Select Utilities menu Settings page December 10 9. We show the configuration screen appearance of the Code Editor. 10. Select Mode With Back-End Line Numbering. Home December 11 11. Click the Transfer button. We have saved the configuration of the Editor. (T he setting is only needed it once) 12. Notes Line 1. If the sentence contains no Zxx0101 Report (ZJA0101 in my case), type the following: Report Zxx0101. 13. In line 2, write the sentence Write 'Hello World SAP. " Use single quotes and put a point at the end of the line. Write 'Hello World SAP. " 14. Click the Save but ton on the Standard toolbar. 15. To run your program, select Program Menu Or you can click Execute . Display a screen like the one the F8 key or click the icon below. This is the output of the Report, also known as List. Below I detail a list of possible errors and solutions that have been able to oc cur during the development of this first exercise. Problem When you click the Cr eate button, a message appears saying: When you press the button create a new wi ndow appears prompting you a key. Solution The name you used for your program st arts Z. Click the back button back and put a new name to your program. The name you used for your program returns does not begin with Z. Click the butt on back and put a new name to your program. Page 12 of 12