Cursoabap 01

También podría gustarte

Está en la página 1de 422
| LLL | HE BC400 ABAP Workbench Concepts and Tools BC400 Release 640 02.02.2006 BC400 ABAP Workbench Concepts and Tools Copyright. ABAP Workbench ms Course Pretequisites Target group... Course Overview. Course Goals... Course Objectives, Table of Contents I Table of Contents IL... Main Business Scenario... Important Database Tables fer the FlightDe Data Model Program Flow in an ABAP Program... ss Program Flow of an ABAP Program: Unit Objectives... System Architectureand ABAP Program. Client/Server Architecture Excerpt for an ABAP Program... ‘View for the User.. Interaction Between Server Layets nunsnsno ‘Sample Program with Selection Sereen and List Program Start 7 System Loads Program Context. Runtime System Sends Selection Screen Input Values Are Inserted into Date Objects. Program Requests Data Revord from Database Database Returns Data Record to Program... Runtime Systerr Sends List. Course Content. Assignment Overview I. Assignment Overview II Program Flow of an ABAP Program: Unit i Summary Introduction to the ABAP Workbench... sv Introduction to the ABAP Workbench:Unit Objectives. Introduction to the R/3 Repository. ‘The R/3 Repository. “ Structure ofthe R/3 Repository... SAP Applicatien Hierarchy... 3 Repository Information System. ‘Working With the Object Navigator ABAP Workbench Tools Screen Structure in the Object Navigator. ‘Working with the Navigation Area... ‘Navigation in the Tool Area.. Synchronization of Navigation and Tool Areas. Ornanizing Developments ‘Transporting Repository Objects Schaduling a Development Project. Project Representation inthe Workhench Organizer. Fxample: Creating Development Classes Assignment to. aChange Request. Developing ABAP Programs Features of the ABAP Programming Language.. General ABAPSyntax 1 General ABAPSyntax Il Return Value After ABAP Statement, Creating an ABAD Programm Keyword Documentation in the ABAF Editor... Inactive and Active Development Objects Gonerating Runtime Objects Creating Transaction Codes Adding a Transaetion Code to the SAP PFaxy A ‘Access Menu Introduction to the ABAF Workhench Unit Summary ABAP Workbench Exercises... ABAP Workbench Solutions. Introduction to the ARAP Dictionary Introduction to the ARAP Dictionary Unit Objectives Data Modeling Flight Data Movtel for ARAP Training Courses, Relational Data Model Converting Using Transparent Tables. Technical Structure of Transparent Table ‘Transparent Tables inthe ABAP Dictionary. Structures in the ARAP Dictionary Using Global Structures for Data Objects Using Glohal Structures for Dialogs WALD Introduction to the ARAP Dictionary:{nit Summary. ABAP Dictionary Exercises. ABAP Dictionary Solutions, Basie ABAP Language Elements, Rasie ARAP Language Flements: Unit Objectives. Data Types and Data Okjects Using Data Types, Local and Global Data Types. Defining Data Objects. Defining Elementary Data Objects Fixed Data Objects... Basic ABAP Statements, ‘Value Assignments, : Calculations, Conditional Branching. Loops. Dialog Messages Runtime Behavior of Dialog Message Using the ARAP Debugger. Fxoenting a Program in Debugging Mode. Switching to Debugging Mode at Runtime: ‘Dehugsing Mode: Single Step and Field Contents Dehuaging Mode: Breakpoints Debugging Mode: Tracing Data Changes. ‘Working with Structures. Definition of Structures with Global Types Definition of Structures with Local Types. Addressing Structure Components Copying Structure Components with the Same Name. Structures in Debugging Mode ‘Working with Internal Tables. Internal Tables. Attributes of Internal Tables. Connoetion Between Table Kind and Access Type Definition of Internal Tables with Global Types: Definition of intemal Tables with Tocal Types Overview: Typing Stmetured Data Objects Overview: Accessing’ Overview: Processing Sets of Records Syntax Example: Filling Line by Line. ‘Syntax Example: Reading Contents Using a Loop Syntax Example: Reading Using the Index. Syntax Fxample: Reading Using the Key Operations on the Whole Internal Table . Syntax Example: Sorting a Standard Table. Internal Tables in Debugging Mode ‘Comparison: Intemal Tables with without Header Lines.. Basic ABAP Language Elements: Unit Summary. ABAP Language Elements Exercise ABAP I anguage Flements Solutions Data Retrieval Data Retrieval: Unit Objectives Querying the Database . Searching for Database Tables Reading Datahave Tables. Programming Datahase Read Access. Reading by Single Record Access Reading Several [ines Using.a Loop. Reading Several Lines Using an Array Fetch INTO Clause: Target Structure Suitable furField List. INTO Clause: Same-Name Fields of Field List in the Target Stricture Selecting Data From Client-Specific Tables Performance; Secondary Index Authorization Checks... 1 Authorization Checksin ABAP Programs Authorization Objects and Authorizations.. Syntax: Authorization Check w Implementing Authorization Checks Preview . Reading Linkable Database Tables. Dictionary View and ABAP Join... Proview: Reusable Components for Data Retrieval. Preview: Database Accesses Initiating Changes. Data Retrioval: Summary Data Retrieval Exerebes Data Retrival Solutions Internal Program Modularization with Subroutines. Internal Program Modularization with Subroutines: Unit Objectives... Calls and Interfaces a ‘Ways of Passing Interface Parameters Passing Interface Parameters: Syntax Interface Parameters: Specified and Inherited Tynes. Interface Parameters: Specifying Types for Structures and Internal Tables... Visibility of Glohal and Local Data Objects ‘Syntax Example: Passing an Internal Table. Calling Subroutines Subroutines in Debugging Mode. Internal Program Modnlarization with Subroutines Unit, Modularization Exercises. ‘Modularization Solutions. ‘The ABAP Runtime System ‘The ABAP Runtime System: Unit Okjectives Possible Elements inan ABAP Program Fxample: ABAP Program with Several Event Blocks and a Selection Screen. Sample Program Runtime Behavior Event Block Characteristies.. ‘The ABAP Runtime System: Unit ‘User Dialog List. User Dialog List: Unit Objectives. List Attributes ‘Standard List Functions List Headers in the Defanlt Page Header “Multilingual Capability of Lists... Lists in Executable Program: Creating Detail Liss Detail Lists: Navigat Syntax Example: Simple Detail List. Fxample: Detail List ‘Ruffering Global Data inthe Hide Area Line Selection. . Syntax Example: Additional Data for Slested Line . User Dialog List: Unit Summary User Dialog List Exercise: User Dialog List Solutions, User Dialog Selection Seren. User Dialog List: Unit Objectives... Use of Selection Sereens.. Overview: Selection Sereen Attributes. Selection Seroen Attributes. Fatoring Value Seti. Using the Semantie Information of Glotal Type Selection Texts. Variants... vs Single Fialdc PARAMETERS) Effect of the PARAMETERS Statement. Runtime Behavior and Data Transport: Parameters... Using Parameters When Accessing the Database ‘Value Sets (SELECT-OPTIONS). Effect of the SELECT-OPTIONS Statement. Runtime Behavior and Data Transport: Selection Options: 10-16 Using Selection Options When Accessing the Database, Selection Screen Events. Selection Screen Events. Frror Dialogs in ATT SELECTION-SCREEN Syntax Fxample: Selection Sereen Authorization Check. ‘User Dialog List: Unit Summary. Selection Sereen Exercises. Selection Sereen Solutions. User Dialogs: Sereene sro User Dialog Screen Unit Objectives. Serven Attributes. o Options for Calling Screens. Application Example: Destination ‘Components for Serean Processing. Editing Window in the Graphical Layout Editor Example of Level 1; Create Sereen. Creating a Screen: Screen Attributes Input Fields with Reference to Fields of a Dictionary Structure... Changing the Element Attributes of a Field: Attribute Window. Example Level 2: Displaying Data Screen Interface. Data Transport from the Program to the Sereen Data Transport from the Sereen to the Program. Data Transport in the Program Example.. Implementing the Sample Program. Syntax: Sample Program with Data Transport, Example Level 3: Assigning Pushbuttons.. Runtime Behavior When User Chooses a Pushbutton Defining Pushbuttons / Assigning Function Codes... Making the Command Field Usable. Calling Madules.. Evaluating the Function Code for PAL. Creating Modules Using Forward Navigation ‘Next Seren: CALL SCREEN Statement. ‘Next Screen: Set Staticaly... ‘Next Screen: Set Dynamically... ‘Syntax Example: Evaluating the Function Codes... Runtime Behavior for Special Situation: NoFuneton Code Is Assigned tthe ENTER Key. Solution Option:Deleting the Command Field for PBO User Dialog Screen: Unit Summary... Soren Exercises... Sereens Solutions... Interfaces... Interfaces: ‘Uni Objectives Overview: Seren, Objective: Example Program Inerice Create Status as Setting a Status for Each Sereen References te Subobjects Creating GUI Statuses for Lists Adjusting Statuses. “ Status in the Menu Painter: Function Keys: Statuses in the Menu Painter: Menu Bar... Including Existing Elements Setting Functions to Active ot Inactive inthe Status, Creating a GUI Title for @ Seren Interfaces: Unit Summary Interfaces Exercises. Interfaces Solutions. Outlook: Developing Internet Applications. Outlook: Developing Internet Applications... Aim: ABAP Program User Dialogs in a Web Browser Internet Transaction Server.. ITS Programming Models. SAPGUI for HTML and Eay Web Transaction Creating EWT Transaction Codes, Creating an Internet Service for EWT. Creating Templates Publishing an Internet Service... ‘Testing the Weh Transaction Outlook: Developing Internet Applications. Cross-Program Modularization Crose-Program Mi ‘Working with Funetion Modules Function Mole — Function Grom. Data Flow Withina Funetion Group ularization; Unit Objectives... Faample: Transmitting a Standard Dialog Integration ofthe Standard Dialog, Searehing for Funetion Modules. Analysis ofa Funetion Module Interface. Documentation and Testing von MLL Calling a Funetion Module. Implementation of a Fumetion Mode Call. Handling of Fxeeptions ‘Working with Methods Classes and Odjects Creating Objects and Calling Methods Examples of Standard Classes: EnjoySAP Controls. Example of Usage: ALV Grid Control Programs Using ALV Grid Control 114-20 Objects and Classes for ALV Geid Control, ~ on vn MOL Custom Control Container: Constructor Method. wold 22 ALV Grid Control: Important Methods. (Creating a Sereen Flemen Defining Reference Variables (Creating Instances. Calling Methods. ‘Working with BAPIs. siness. Application Programming Interface. RADI Usage Standardized BAPIs.. Finding BAPI Funetion Modus: (Characteristics of a BAPI Function Module. Calling a BAPI Funetion Module from an ABAP Program 1434 Cross-Program Modularizaton; Unit Summary Cross-Program Modularization Exercises. Cross-Program Modularization Selutions. Software Logistics and Software Adjustment, Sofiware Logisties and Software Adjustment: Unit Objectives. Organization of Development and Transport, Assigning Transport Routes. Joint Transport Assignment Developers Tasks at Find of Development Process Project Manager's Tasks at Find of Development Process... Originals and Copies Corrections and Repairs. ‘Modifications During Upgrade Enhancement of Standard Software Overview: Software Adjustment Possibilities, Enhancement Concept Using the Function Module Exit as an Fxample logs: Further Fnhancement Examples. Fahaneing User Di Registering Developers in the SSCR Software Logistics and Software Adjustment: Unit Snmmary Appendis. Program Types... Programs of. ‘TOP Include... Standard Includes for Funetion Gronps Data Types, Data Okjeets, and Statements Structures and internal Tables Can be Nested. ‘Type Groups in the ABAP Dictionary. ‘Type Comersion, Logical Expressions. Overview: Termination Statements, ‘The MESSAGE Statement, Message Classes, and Messages. Sclf-Fxplanatory Messages or Messages with Tang Texts: Meseages with Placeholder... Creating Message Clases and Messages. Colors/Teons'Symbols in Lists Dynamic Sereen Sequence.. Exceptions for Function Modules 5. Logical Databases. Reading Logically Dependent Data Logical Databases... : Controlling an LDB from Within a Program. Event Blocks in Logical Databases. 16-23 Syntax Example: Event Sequence. 116-24 Summary 116-25 Preview . 116-26 Extemal Data Transfer I. Extemal Data Transfer I Update... 16.28 16-29 Copyright 2005 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. © SAP AG 2004 1m Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors, 1m Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. = IBM, DB2, DB? Universal Database, OS/2, Parallel Sysplex, MVS/ESA. AIX, S/390, AS/400, 05/390, (05/400, iSeries, pSeries, xSeries, Series, 20S, AFP. Intellizent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation in the United States andior other countries. 1m Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/L, and Motif are registered trademarks of the Open Group. 1m Citrix. ICA. Program Neighborhood. MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of itrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C#), World Wide Web Consortium, Massachusetts Institute of Technology. 1m Java is a registered trademark of Sun Microsystems, Ine. 1m JavaScript isa registored trademark of Sun Microsystems, Inc, used under license for technology invented and implemented by Netscape. 1m MaxDB is a trademark of MySQL AB, Sweden. 1m SAP, R13, mySAP, mySAP.com, xApps, xApp, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other conntriesall over the world. All other prodinet and service names mentioned are the trademarks oftheir respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. 1m These materials ae subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only ‘warranties for SAP Group produets and services are those that are set forth in the express warranty statements accompanying such products and services, ifany. Nothing herein should be construed as constituting an additional warranty. ABAP Workbench | BC404 3 days fee rr] | BC410 days Paci rd | sciay ea [[fsceso anys | MBCA) 2 days zs aa aR | eceeence pe [eo BCat4 days | BC490 BCAI5 2 days BC425 3 days Bcat2 3 days Aadays BC400 Sdays © SAPAG 980 1Ts070 ‘SAP Internet’ 2days. ‘Transaction Server: Administration iTs110 2 days Developing Web Scenarios ‘and MiniApps using ITS Flow Logic: 178150 days. Corporate Identity Design Cele ale TCT © Programming knowledge © Contents of SAPS50 training course (Basis Technology) © SAP AG 2001 Breet y © Participants: Members of project team © Length: 5 days © SAP AG 2001 ‘The training materials are not teach-yourself programs. They complement the course instructor's explanations. On the sheets, there is space for yon to write down additional information. = There may not be time during the course itself for you to complete all the exercises. The exercises are intended as additional examples of the topics discussed during the course. Participants can also use them as an aid to enhancing their knowledge afler the course has finished. Course Overview Contents: Course Goals Course Objectives Course Content Main Business Scenario Important Database Tables for the Flight Data Model eoeee © sar Ac 201 (OSAPAG BCA0 eT fer eT merer ly At the conclusion of this unit, you will be able to: © Explain the basics of the ABAP programming language, includin, = Basle syntax elements = Different types of user dialogs = How to read database accesses © Describe the various uses of the ABAP Workbench, including: = Support through development tools = Support In organization and transport © SAP AG 2001 (OSAPAG BCA0 13 leecher At the conclusion of this course, you will be able to: © Create an ABAP program containing user dialogs and database accesses © Describe the different types of development objects and their typical uses © Use appropriate tools to create basic examples for the Repository objects introduced in the course © SAP AG 2001 (OSAPAG BCA0 13 Bree Cuca Unit 4 Introduction Unit2 Program Flow in an ABAP Program Unit3 Introduction to the ABAP Workbench Unit4 Introduction to the ABAP Dictionary Unit5 Basic ABAP Language Elements Unité Data Retrieval Unit7 Internal Program Modularization with Subroutines Unit8 The ABAP Runtime System Unit9 User Dialog List Unit 10 User Dialog Selection Screen © SAP AG 2001 (OSAPAG BCA0 4 Sree Cica Unit 11 Unit 12 User Interface User Dialog Screen Unit 13 Perspective: Development of Internet Applications Unit 14 Cross-Program Modularization Unit 15 Software Logistics and Software Adjustment Appendix © SAP AG 2001 (OSAPAG BCA0 13 ETD ete Utd I] inthis course, you will develop several Destination airport programs designed to assist travel agencies. y ‘Some of their typical needs include: 9 Determining flight connections on specific dates Departure city © Processing bookings for specific flights ‘© Evaluating additional flight information, such as @ Price Capacity Destination city © SAP AG 2001 (OSAPAG BCA0 16 erst) © SAP AG 2001 PU ec M Em Ra: ec) Airline ID Airline name Local currency of airline Airline 1D Flight connection ID Country key for departure city Departure city Departure airport Country key for arrival city Destination city Destination airport Airline ID Flight connection ID Flight date Price Currency Maximum number of seats on flight Current number of occupied seats on flight ‘You will refer to this information as you do the exercises throughout this course, (OSAPAG BOAO iy errs ae aetit Contents: © System Architecture and ABAP Program © Sample Program with Selection Screen and List © sar Ac 201 (OSAPAG BCA0 2 Program Flow of an ABAP Program: Unit eyes bd At the conclusion of this unit, you will be able to: © Describe the architecture of the R/3 System © Describe how to execute a simple dialog program using the ABAP runtime system © SAP AG 2001 (OSAPAG BCA0 2 CUP ect eur PA) aerial ) MM system Architecture and ABAP Program ae aeons © SAP AG 2001 (OSAPAG BCA0 24 pet alae cla) Presentation Server Layer Application Server Layer Database © SAP AG 2001 Wi The R/3 System has a modular sohware architecture that follows software-oriented client/server principles. The R/3 System allocates the presentation, application logic, and data storage to different computers. This serves as the basis for the sealability of the R/3 System, The lowest level is the database level Here data is managed with a relational database ment system (RDBMS). In addition to application data, the database contains the programs and the metadata that the R/3 System requires for self-management. HM ABAP programs (both the applications provided by SAP and the ones you develop yourseli) run at the application server level The ABAP programs read data from the datahase level, process the data, and possibly store data there. The presentation server level contains the user interface through which each user can access the program, enter new data, and display the results of a work process. The technical distribution of software is independent of its physical location on the hardware. All levels can be installed vertically (on top of each other on one camputer) or each level can he installed on a separate computer. The presentation and application servers can be divided horizontally among any number of computers. The horizontal distribution of database components, however, depends on the type of database installed (OSAPAG BOAO 24 re aU act ea Presentation Server Layer + Work Process Application ABAP Program Server Layer Database PAG 2001 W This graphic can be simplified for most topes discussed during this course. The interaction between asingle user and a single ABAP program will be of primary interest to us during this course. I The exact processes involved in user dispatching on an application server are secondary to understanding how to write an ABAP program. Therefore, we will work with a simplified sraphic that does not explicitly show the dispatcher and the work process. Certain slides will, however, include these details whenever they are relevant to ABAP programming, 1 ABAP programs are processed on the application server. The des database dialogs is, therefore, of particular importance when writ of user dialogs and application programs, (OSAPAG BOAO 2 SR lm eee Presentation Server Layer Application Black Box Server Layer i Most users are only interested in how a business transaction flows and how to enter data into and display data from a transaction. The technical aspects of programming are less interesting. ‘The user does not need to know the precise flow of the ABAP program on the application server. To the average user, the SAP system is like a "black box." WM Technically speaking, there are three different types of screens: dynamic sereens or dynpros, selection screens, and lists. Each type of screen provides different services. The developer's task is to select for each user dialog exactly those types that are most suitable for the accomplishment of the tasks concerned. For this reason, developers should have precise knowledge of the technical aspects. (OSAP AG BC400 26 Ce Te TRC CE a ey ‘ABAP Program ABAP Processing Block ABAP Processing Block m Once the user performs a user action (selecting Enter, a function key, a menu function or a pushbutton, for example), control is passed from the presentation server to the application server. m Only certain parts of the ABAP program are processed. = Ifa further user dialog is triggered from withinthe ABAP program, the system transmits the screen and passes control once again to the presentation server, (OSAPAG BCA0 2 Sample Program with Selection Screen and List Roun ue nL adie ead » ae aeons © SAP AG 2001 (OSAPAG BCA0 28 eee is Repository Whenever a user logs on to the system, a screen is displayed. From this sereen, the user ean start an ABAP program via a menu path or by entering a transaction code. (OSAPAG BCA0 2 Cnr ar eke cs Program Start Processing Block FC Tec) 1H The system first loads the program context onto the application server. The program context contains memory areas for variables and complex data objects, information on the screens for user dialogs, and ABAP processing blocks. The runtime system gets the program information from the Repository, which is a special part of the database. The sample program has a selection sereen as the user dialog, a variable and a structure as data objects, and one ABAP processing block. The list that is used to display the data is created dynamically at run time. The ABAP runtime system controls the subsequent program flow. (OSAPAG BCA0 210 Runtime System Sends Selection Screen 'ABAP Program Data Objects ABAP Processing Block 'm Because the program contains a selection screen, the ABAP runtime system sends it to the presentation server. The presentation server controls the program flow for as long as the user enters data in the input fields. im Selection sereens allow users to enter selection criteria required by the program. (OSAPAG BCA0 2 Input Values Are Inserted into Data Objects Program Processing Block FC Tec) mAs soon as the user has finished entering data on the selection sereen, he or she can trigger further processing of the program by selecting Execute. tm The entered data is automatically placed in its corresponding data objects in the program and the ABAP runtime system resumes control of processing. In our simple program example, there is only one ABAP processing block. The ABAP runtime system triggers sequential processing of this ABAP processing block. m Ifthe entries made by the user do not have the correct type, an error message is triggered automatically. The user must correct the entries. (OSAPAG BCA0 212 Ce ts Se Cre eye er) Program ABAP Processing Block FC Tec) 1M Within the ABAP processing block, a read access to the database is programmed, The program passes to the datahase information ahout which database table to access and which line in the table to read, (OSAPAG BCA0 23 rie ler w Cee Reel R CoM ares cy Program Processing Block FC Tec) m The database returns the requested data record to the program and the runtime system ensures that this data is stored in the appropriate data objects. m Ifa single record is accessed, this data object is usually a structure that contains components for all the required database fields. (OSAPAG BCA0 24 Runtime System Sends List 'ABAP Program Data Objects ABAP Processing Block 1m The layout of the subsequent list display was also programmed into the processing block. After completion, the runtime program sends this list asa screen to the presentation server. (OSAPAG BCA0 2s Course Content Roun ue nL adie ead Sample Program with Selection Screen and List © SAP AG 2001 (OSAPAG BCA0 216 Unit 1 Unit 2 Unit 3 Unit 4 Unit 5 Unit 6 Unit 7 Unit 8 Unit 9 Unit 10 CU ATC a Which Components of an ABAP Program Are Discussed and in Which Chapter? Introduction Program Flow in an ABAP Program Introduction to the ABAP Workbench Introduction to the ABAP Dictionary Basic ABAP Language Elements Data Retrieval Internal Program Modularization with Subroutines The ABAP Runtime System User Dialog List User Dialog Selection Screen © SAP AG 2001 (OSAPAG BOAO Unit 11 Assignment Overview II User Dialog Screen Unit 12 User Interface Unit 13 Perspective: Development of Internet Applications Unit 14. Cross-Program Modularization Unit 15 Software Logistics and Software Adjustment Appendix © sap Ae 201 (OSAPAG BOAO 218 ena ee Claes ee ea You are now able to: © Describe in basic terms the architecture of the R/3 System © Describe in basic terms the execution of a simple dialog program using the ABAP runtime system BOAO 219 Introduction to the ABAP Workbench Contents: Introduction to the R/3 Repository Working with the Object Navigator e ° © Organizing Developments e Developing an ABAP Program © sar Ac 201 (OSAPAG BCA0 i © SAP AG 2001 rele RGCw yt aie Unit Objectives At the conclusion of this unit, you will be able to: ° Describe the structure of the R/3 Repository and its search tools Use the Object Navigator for your development work Name and use the utilities for orderly software development Create development classes, ABAP programs, and transaction codes (OSAPAG BOAO Introduction to the R/3 Repository ) Reto Working with the Object Navigator Cee meae Developing ABAP Programs © SAP AG 2001 (OSAPAG BCA0 33 BIER Cres ia Presentation Server Layer Application Server Layer | [Cross-client Client-specific Database ScaliCey) Customizing tables ‘ The database contains applicationand Customizing tables that are usually client-specific, = The database also contains the R/3 Repository. The ABAP Dictionary is part of the R/3 Repository m= TheR/3 Repository contains all the development objects, for example, programs, definitions of database tables, or central data type definitions Development objects are therefore also known as Repository objects. m Repository objects are never elient-specific; therefore, they can be viewed and used in all clients. (OSAPAG BCA0 x4 re RR UPR Ctr crag Repository Objects Development Classes tf Function Modules Programs E i The R/3 Repository is subdivided according to application components. = Each application component is further divided into logical subdivisions called development classes. m= Repository objects are ofien made up of sub-objects that are themselves Repository objects. i When you create a Repository object, you must assign it to a development class. © SAP AG 2001 (OSAPAG BCA0 33 Nee Ny CA” Cross-Application Components Gi AC Accounting - General Gi FI Financial Accounting [| — _FBAS Financial Accounting Basis L i IF-LC Consolidation Gi) TRS Treasury GH CO Controlling fess pereesesese {ntormaton sytem Development class Selected subtree © SAP AG 2001 = The structure of the application components is shown in the application hierarchy, From the SAP Easy Access menu, you access the application hierarchy by choosing Tools > ABAP Workbench — Overview ~ Arplication Hierarchy. 1m The application components are displayed in a tree structure in the application hierarchy. Expanding a component displays all the development classes that are assigned to that component. fm You can select a subtree or branch and navigate from the application hierarchy to the R/3 Repository Information System. The system then collects all development classes for the branch selected and passes them to the Repository Information System. (OSAPAG BCA0 36 Ce oe Meu SC ABAP Dictionary D © Basic objects 2) Database tables Views 2 Data elements Structures Table types D @ other objects b © Fields ZO) Programming Function Builder Program Library Prog. environment © Program sub-objects 7D, ABAP objects Class library Components of classes © Components of interfaces Environment © SAP AG 2001 You can use the Repository Information System to search for specific Repository objects. search criteria are available for the various Repository objects. = Which objects are to be found using the Repository Information System depends on how you get there: ‘© From within the application hierachy, select the /:formation system (double-click the selected application component or development class). This filters the the respective Repository objects. ‘+ From the SAP Easy Access menu, choose Tools» ABAP Workbench -» Overview > li formation system. The system lists all the Repository Objects available for searching. (OSAPAG BCA0 37 Working With the Object Navigator Mtkkdices » Working with the Object Navigator Cee meae Developing ABAP Programs © SAP AG 2001 (OSAPAG BCA0 38 CNTR Debugger Screen Painter [ety Object Navigator ABAP Dictionary Function Builder [| | Class Builder © SAP AG 2001 = The ABAP Workbench contains different tools for editing Repository objects. These tools can be used throughout the entire software developmenteycle. The most important tools for creating and editing Repository objects are as follows: = TheABAP Editor for editing source text ™ The ABAP Dictionary for processing database table definitions, central data types, and more m The Screen Painter for configuring screens (screens with functions for user dialogs) m= Menu Painter for designing the user interface (menu bar, standard toolbar, application toolbar) (sce Interfaces) m= The Funetion Builder for processing function modules, tm The Class Builder for processing central classes You can start these tools in three ways: © Directly from the Easy Access menu, © Using the Object Navigator. This has a tree diagram of all objects within a development class or program. Double-click on an object to start the respective tool. + By double-clicking from one tool to the next, and back again. (OSAPAG BCA0 39 Screen Structure in the Object Navigator ‘Size of display area can be changed © SAP AG 2001 @ The Object Navigator screen is divided into two areas: ‘A navigation area for displaying an object lst as a hierarchy tree + A tool area for displaying and editing a development object using the correct tool @ You can display or hide the hierarchy area, You can select functions from a context menu in both screen areas. You are given a choice of only those functions that are provided for displaying or editing the object to which you are pointing. Right-click on the object to open the context menu, (OSAP AG BC400 310 Working with the Navigation Area Application Hierarchy Development Class Program Development Class Function Group Class / Interface BC400 Internet Service Local Objects ese wo La] ©) ‘SAPBC400WBD_GETTING_ST/ ‘SAPBC400WBT_GETTING ABAP Editor — Pretty Printer (OSAPAG BCA0 32 General ABAP Syntax II i comments By comments — Bicomments ... DATA wa_scarr TYPE scarr. START-OF-SELECTION. SELECT * FROM scarr Hi coments . INTO CORRESPONDING FIELDS OF wa_scarr NEW-LINE. WRITE] wa_scarr-carridl] wa scarr-carzn: re walscarr-urif] ee ENDSELECT. esirnscet fm Use an asterisk (*) to introduce comment lines. The ABAP runtime system ignores the comment line. tm Ifyou want to enter a comment in the middle of a started line, enter double quotes. You can combine consecutive statements with an identical beginningiinto a single chained statement: * Close the identical beginning part with a colon. + Separate individual elements that come after the colon by commas. * Use blank spaces and line breaks before and afier the separators (colons, commas, and periods). ‘+ The ABAP runtime system considers the individual parts of a chained statement to be single statements, (OSAPAG BCA0 3B Return Value After ABAP Statements PARAMETERS pa_carr TYPE scarr-carrid. DATA wa_scarr TYPE scarr. START-OF-SELECTION. SELECT SINGLE * FROM scarr INTO CORRESPONDING FIELDS OF wa_scarr WHERE carrid = pa carr. arr-carrname, carr-url. ELSE. WRITE ‘Sorry, no data found!" ENDIF. © SAP AG 2001 @ With several ABAP statements, the ABAP runtime system writes a return code into the system field. sy-subre o indicate how successfully the statement was executed = The return code zero (0) means tat the statement was successful. m Read the documentation for the respective statements to find out whether and how this return code is set in individual cases. (OSAPAG BCA0 34 ete ey lars ed (exe ea (ea ar eae eel nae : : rogram, Application Fixed point arithmetic m From the Olject Navigator, you can create a program using one of the following options: ‘ Inthe navigation area, choose Programas the object type and enter a program name. Be sure to comply with the customer namespace conventions. Ifthe program does not exist, the system displays the dialog sequence that lets you create a program. (This procedure is possible only as of | Release 4.6C.) * Display the development class for which you wantto create the program, Start the dialog sequence for creating a program using the development class context menu or the Program node. * Select Other ol ject... or Edit ol ject Select the Program ol jects tab and enter the name. Select Create. m In this course, deselect With Tep Include (by removing the check mark from the checkbox). (If you don’t do this, your source text would be disiributed to several programs.) m Change the ttle to a meaningful short text. Choose Test program as the program status for all ABAP courses. (QSAPAG BC400 325 Keyword Documentation in the ABAP Editor W You can locate keyword documentation for an ABAP statement by: “Pointing to a statement and selecting F/ to go directly to the documentation for the statement “Selecting formation to go to a selection window for the various views of the keyword documentation. M Choose Help — SAP Library 9 BC Basis Components to access extensive online documentation on all the tools and topics that relate to the ABAP Workbench, (QSAPAG BC400 326 Ree Peel surah) scr ‘Saved, for development and testing Program 1, active version Program 3, inactive version © SAP AG 2001 = Whenever you create a development object, or change and then save it, the system stores an inactive version only in the R/3 Repository. = Before a Repository object is available on a system-wide basis, it must first be available as an active version. This active version of your program will be used whenever a user wants to execute your program, = If your program is available in both versions, you can switch fiom one version to the other in display mode, @ Whenever you activate a program, the system first displays a list of all inactive objects that you have processed. This is called the worklist. If you continue to activate the program, the following happens: ‘* The system saves the program, that i, it stores or overwrites the inactive version. ‘© The system performs a syntax check. ‘© The system stores the active version or overwrites it (OSAPAG BCA0 32 MDUUUCke) scr s for developmentitesting Program 3, inactive version eum Cnc ues acy Paes Poin ca Pema m When you generate a development object, the system creates (compiles) a separate runtime object (LOAD) and stores it in the R/3 Repository. 1m This generated version is then the version that is executed (interpreted). m Generation takes place automatically, but it can be triggered explicitly tm If, for example, a user wants to execute your program and there is still no generated version, the system will use the active version for generation fm You can, however, determine which version you want to execute: * To execute the active version, start your program fiom the navigation area, ‘* To execute the inactive version, test an executable program from the ABAP Editor. The system temporarily creates a generated version. wm In this way, development can continue without changing the current system status. All changes to the development abject become visible system wide only when the program is activated again. With inactive versions, you have a local, separate view of the R/3 Repository, which provides the basis for 1 local runtime system, (OSAPAG BCA0 328 Creating Transaction Codes Create Report Transaction © Professional User Transaction © Easy Web transaction © SAP AG 2001 @ Ifyou want to include a program in role menus or in the Favorites in your SAP Easy Access menu, ‘you must assign a transaction code to it = In the Object Navigator, display the object ist for your program, Right-click the program name and choose Create ~» Transaction. Comply with the customer namespace conventions. = Choose Program and Selection Screen (Report Transaction) ifthe program is an executable program, @ On the next screen, enter the name of the program. Choose Pre fessional User Transaction, m= Save the transaction code, @ Since cach transaction code is a Repository object, you must assign it to a development class and to a. change request on the following screens. (OSAPAG BCA0 309 Adding a Transaction Code to the BGS ec eu) Cum) SAP Easy Access [& Enter Transaction Manually z00Gs © SAP AG 2001 @ To include a transaction code in the your role menu favorites: Display the initial screen (SAP Easy Access menu). * Choose Favorites —> Insert transaction. + Enter a transaction code in the dialog box = The transaction code short text appears under the Favorites node. You can start the appropriate program from the context menu for this new node. (QSAPAG BC400 330 © SAP AG 2001 ink ek Gor Gk LC curin Unit Summary You are now able to: © Describe the structure of the R/3 Repository and its search tools © Use the Object Navigator for your development work © Name and use the utilities for orderly software development © Create development classes, ABAP programs, and transaction codes (OSAPAG BOAO 331 “£47 ctl. Exercises Unit: Introduction to the ABAP Workbench Topic: Organizing Developments At the conclusion of these exercises, you will be able to: © Create a development class ‘© Assign changes in Repository objects to a change request As.a developer for an airline group, you are given the task of developing, evaluation programs for several airline companies. To group the Repository objects together logically and transport them, ‘you must create a development class. User name: Will be announced by the instructor. Development class: 2BC400_## Change request: Will be announced by the instructor. ## stands for the two-digit group number. 1-1 Log on to the operating system and then to the specified SAP R/3 training system using the user name the instructor has given you. Enter a new personal password. 1-2 Create the development class 28C400_##. Assign it to the change request the instructor has given you. 1-3 From now on, a development n all your Repository objects in the following exercises to this, \s and this change request. (OSAPAG BOAO 332

También podría gustarte