Course Overview

9 downloads 792 Views 48MB Size Report
An SAP Compass course - use it to learn, reference it for work. SAP NetWeaver ..... following packages BC400, BC402, BC405 and DNW7AW. The following ...
TAW10_1 ABAP Workbench Fundamentals SAP NetWeaver

Date Training Center Instructors Education Website

Instructor Handbook Course Version: 63 Course Duration: 10 Day(s) Material Number: 50089085 Owner: Christian Braun (D035329)

An SAP Compass course - use it to learn, reference it for work

Copyright Copyright © 2008 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. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Trademarks •

Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks of Microsoft Corporation.



IBM®, DB2®, OS/2®, DB2/6000®, Parallel Sysplex®, MVS/ESA®, RS/6000®, AIX®, S/390®, AS/400®, OS/390®, and OS/400® are registered trademarks of IBM Corporation.



ORACLE® is a registered trademark of ORACLE Corporation.



INFORMIX®-OnLine for SAP and INFORMIX® Dynamic ServerTM are registered trademarks of Informix Software Incorporated.



UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.



Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® and other Citrix product names referenced herein are trademarks of Citrix Systems, Inc.



HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.



JAVA® is a registered trademark of Sun Microsystems, Inc.



JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.



SAP, SAP Logo, R/2, RIVA, R/3, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other products mentioned are trademarks or registered trademarks of their respective companies.

Disclaimer THESE MATERIALS ARE PROVIDED BY SAP ON AN "AS IS" BASIS, AND SAP EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR APPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THESE MATERIALS AND THE SERVICE, INFORMATION, TEXT, GRAPHICS, LINKS, OR ANY OTHER MATERIALS AND PRODUCTS CONTAINED HEREIN. IN NO EVENT SHALL SAP BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES OF ANY KIND WHATSOEVER, INCLUDING WITHOUT LIMITATION LOST REVENUES OR LOST PROFITS, WHICH MAY RESULT FROM THE USE OF THESE MATERIALS OR INCLUDED SOFTWARE COMPONENTS.

g20085263049

About This Handbook This handbook is intended to complement the instructor-led presentation of this course, and serve as a source of reference. It is not suitable for self-study.

Typographic Conventions American English is the standard used in this handbook. The following typographic conventions are also used. Type Style

Description

Example text

Words or characters that appear on the screen. These include field names, screen titles, pushbuttons as well as menu names, paths, and options. Also used for cross-references to other documentation both internal (in this documentation) and external (in other locations, such as SAPNet).

2008

Example text

Emphasized words or phrases in body text, titles of graphics, and tables

EXAMPLE TEXT

Names of elements in the system. These include report names, program names, transaction codes, table names, and individual key words of a programming language, when surrounded by body text, for example SELECT and INCLUDE.

Example text

Screen output. This includes file and directory names and their paths, messages, names of variables and parameters, and passages of the source text of a program.

Example text

Exact user entry. These are words and characters that you enter in the system exactly as they appear in the documentation.



Variable user entry. Pointed brackets indicate that you replace these words and characters with appropriate entries.

© 2008 SAP AG. All rights reserved.

iii

About This Handbook

TAW10_1

Icons in Body Text The following icons are used in this handbook. Icon

Meaning For more information, tips, or background Note or further explanation of previous point Exception or caution Procedures

Indicates that the item is displayed in the instructor’s presentation.

iv

© 2008 SAP AG. All rights reserved.

2008

Contents Course Overview ............................................................................. vii Course Goals.................................................................................vii Course Objectives ............................................................................ x

Unit 1: The Big Picture ........................................................................1 The SAP Software Portfolio ................................................................. 3 SAP Release Strategy ..................................................................... 17 SAP NetWeaver ............................................................................ 28

Unit 2: Navigation ............................................................................ 41 Navigation in General ...................................................................... 43 Advanced Navigation in the SAP GUI ................................................... 60

Unit 3: The System Kernel.................................................................. 81 Principal Architecture of the SAP NetWeaver Application Server .................... 82 AS ABAP processes ...................................................................... 103

Unit 4: Communication and Integration Technologies .............................137 Cross-System Business Processes ..................................................... 139 Remote Function Calls and BAPIs ...................................................... 145 Enterprise Services-Oriented Architecture (Enterprise SOA)........................ 156 Web Services .............................................................................. 165

Unit 5: Flow of an ABAP Program .......................................................177 System Architecture and ABAP Programs ............................................. 178

Unit 6: Introduction to the ABAP Workbench ........................................195 Repository and Object Navigator ........................................................ 197 Developing Programs and Organizing Developments ................................ 209

Unit 7: Basic ABAP Language Elements...............................................247 Working with Elementary Data Objects ................................................. 248

2008

© 2008 SAP AG. All rights reserved.

v

Contents

TAW10_1

Unit 8: Modularization ......................................................................291 Modularization - Basics and Overview .................................................. 293 Modularization with Subroutines......................................................... 302 Modularization with Function Modules .................................................. 324 Modularization with Methods of Global Classes ....................................... 360 Modularization with Methods of Local Classes (Preview) ............................ 392

Unit 9: Complex Data Objects ............................................................403 Working with Structures................................................................... 404 Using internal tables....................................................................... 419

Unit 10: Data Modeling and Data Retrieval ............................................451 Data Modeling and Transparent Tables in the ABAP Dictionary .................... 453 Reading Database Tables ................................................................ 470 Authorization Check ....................................................................... 512

Unit 11: ABAP Open SQL ..................................................................533 ABAP Open SQL: Optimizing Statements.............................................. 534

Unit 12: Selection Screen..................................................................555 Generating and Designing the Selection Screen ...................................... 557 Input Checks and Variants................................................................ 584 Selection screen: Modifications at Runtime............................................ 596

Unit 13: Programs Calls and Data Storage Management .......................... 611 Programs Calls and Data Storage Management ...................................... 613

Unit 14: New Test Tools ....................................................................645 The Code Inspector ....................................................................... 646

Glossary .......................................................................................661 Index ............................................................................................669

vi

© 2008 SAP AG. All rights reserved.

2008

Course Overview This training course, lasting two weeks, provides a comprehensive and detailed introduction to the basics of ABAP programming and the ABAP Workbench tools. Furthermore, this course, along with TAW11 and TAW12, prepares you for certification for the SAP Certified Development Associate - ABAP - SAP NetWeaver 7.0.

Target Audience This course is intended for the following audiences: •

Development consultants and developers who are responsible for adapting and developing ABAP/ABAP Objects programs.

Course Prerequisites Required Knowledge • •

Solid data processing (DP) basic knowledge Sound programming experience with another programming language

Course Duration Details Unit 1: The Big Picture The SAP Software Portfolio SAP Release Strategy Exercise 1: SAP Release Strategy SAP NetWeaver

60 30 10 20

Minutes Minutes Minutes Minutes

Unit 2: Navigation Navigation in General Exercise 2: Logon and Screen Design Advanced Navigation in the SAP GUI Exercise 3: Calling Functions

40 10 60 30

Minutes Minutes Minutes Minutes

Unit 3: The System Kernel Principal Architecture of the SAP NetWeaver Application Server AS ABAP processes

60 Minutes 80 Minutes

Unit 4: Communication and Integration Technologies 30 Minutes Cross-System Business Processes

2008

© 2008 SAP AG. All rights reserved.

vii

Course Overview

TAW10_1

Remote Function Calls and BAPIs Exercise 4: Remote Function Calls and BAPIs Enterprise Services-Oriented Architecture (Enterprise SOA) Web Services Unit 5: Flow of an ABAP Program System Architecture and ABAP Programs Unit 6: Introduction to the ABAP Workbench Repository and Object Navigator Developing Programs and Organizing Developments Exercise 5: Organizing Developments Exercise 6: Developing a Simple ABAP Program Exercise 7: Create transactions Unit 7: Basic ABAP Language Elements Working with Elementary Data Objects Exercise 8: Basic ABAP Statements Exercise 9: Debugging Statements on Elementary Data Objects Unit 8: Modularization Modularization - Basics and Overview Modularization with Subroutines Exercise 10: Subroutines Modularization with Function Modules Exercise 11: Using a Function Module Exercise 12: Creating a Function Group Exercise 13: Creating and Using a Function Module Modularization with Methods of Global Classes Exercise 14: Using Global Static Methods Exercise 15: Creating Global Classes Exercise 16: Creating and Using Global Static Methods Modularization with Methods of Local Classes (Preview) Unit 9: Complex Data Objects Working with Structures Exercise 17: Working with Structures Using internal tables Exercise 18: Using internal tables

viii

© 2008 SAP AG. All rights reserved.

30 Minutes 10 Minutes 30 Minutes 30 Minutes 20 Minutes 45 Minutes 95 Minutes 5 Minutes 10 Minutes 10 Minutes 75 Minutes 30 Minutes 25 Minutes 10 Minutes 60 Minutes 30 Minutes 80 Minutes 20 Minutes 10 Minutes 30 Minutes 30 Minutes 20 Minutes 10 Minutes 30 Minutes 15 Minutes 30 Minutes 35 Minutes 90 Minutes 25 Minutes

2008

TAW10_1

Course Overview

Unit 10: Data Modeling and Data Retrieval Data Modeling and Transparent Tables in the ABAP Dictionary Exercise 19: Analyzing Transparent Tables in the ABAP Dictionary Reading Database Tables Exercise 20: Data Retrieval by Single Record Access Exercise 21: Data Retrieval Using a SELECT Loop Exercise 22: (Optional) Data Retrieval by Mass Access (Array Fetch) Authorization Check Exercise 23: Authorization Check Unit 11: ABAP Open SQL ABAP Open SQL: Optimizing Statements Unit 12: Selection Screen Generating and Designing the Selection Screen Exercise 24: Generating and Designing the Selection Screen Input Checks and Variants Exercise 25: Input Checks and Variants Selection screen: Modifications at Runtime Exercise 26: Selection screen: Modifications at Runtime

30 Minutes 20 Minutes 90 Minutes 20 Minutes 25 Minutes 25 Minutes 45 Minutes 10 Minutes 40 Minutes 40 Minutes 60 30 20 30

Minutes Minutes Minutes Minutes

40 Minutes

Unit 13: Programs Calls and Data Storage Management 40 Minutes Programs Calls and Data Storage Management 30 Minutes Exercise 27: ABAP Memory Unit 14: New Test Tools The Code Inspector Exercise 28: The Code Inspector

2008

© 2008 SAP AG. All rights reserved.

30 Minutes 30 Minutes

ix

Course Overview

TAW10_1

Course Goals This course will prepare you to: • • • •

Work with the ABAP Workbench tools Write your own simple ABAP programs Carry out database read accesses Develop simple reuse components (subroutines, function modules and methods) and use them in programs Program dynamic screen processing Program user dialogs using the different screen elements in the SAP system Describe the function of the ABAP Dictionary in the SAP system Define database objects and use them Create and administer user-defined data types Use the services in the ABAP Dictionary Understand how the ABAP Dictionary is linked to the development and runtime environments

• • • • • • •

Course Objectives After completing this course, you will be able to: • • • • • • • • • •

Describe the structure of an SAP system Use the ABAP Workbench tools Create and call subroutines, function modules and methods Write user-friendly dialog programs Implement and process screen elements in the SAP system Create a user interface for a program Use and describe the ABAP Dictionary and its services Model data and read data using SQL from the database Program in a performance-sensitive manner Use the Code Inspector

SAP Software Component Information The information in this course pertains to the following SAP Software Components and releases: •

x

ERP 6.1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Course Overview

Caution: It is imperative that you read these notes, even if you have already completed an earlier version of this course. If available, also read the list of the known errors for this course. If it exists, this list has deliberately been saved separately from this printed course on SAP Service Marketplace, so as to keep the course as up-to-date as possible while minimizing the technical effort necessary. Training courses recommended as preparation: • • • • • • • • •

SAPTEC BC400 BC401 BC402 BC405 BC410 BC412 BC414 BC430

1.

Learn the contents of this course incl. all items of the Online documentation for the respective subject areas; solve all exercises on your own at least once (without the help of model solutions, incl. all details and optional sections) Obtain answers to any questions you have about the course materials and the exercises. Develop your own presentation methods and run through each demonstration at least once yourself. Clear up any questions you have on these methods. Attend this course at least once when it is held by an experienced instructor and possibly supervise participants during an exercise yourself.

2. 3. 4. 5.

2008

© 2008 SAP AG. All rights reserved.

xi

Course Overview

TAW10_1

Training system: •

SAP NetWeaver 7.0 (Support Package 13 or higher) or higher (ABAP engine is sufficient). Your training administration should provide you with a system, including a client. If problems arise with the server assignment, create a CSS message under the component SR-KPS-ISM.



Either a Windows Terminal Server (WTS) or local PCs with SAP GUI 6.40 (patch level 21 or above) or higher installed. The internal connectivity to the training WTS farms can only be used within the SAP network infrastructure. Use the link http://wts.wdf.sap.corp:1080 to establish a connection to the training WTS farms. Choose your region (US, EMEA or APJ). Choose "Training - Zone". Connect to "Common Training" if no other WTS farm option is executed for the training course. Training courses at a customer site or in a third-party training center You can only establish a connection using the SAP Citrix Secure Gateway (SAP CSG) for training courses at the customer site. Therefore, you require a CSG user ID. The training department should have created the user ID for the course date. The training department sends you the data (user ID and password). Instructors and participants use the same CSG user ID for the training course. Use the link http://mywts.sap.com to establish a connection to the training WTS farms. Enter the CSG user ID and the password. Choose your region (US, EMEA or APJ). Choose "Training - Zone". Connect to "Common Training" if no other WTS farm option is executed for the training course.

Make all the preparations with regard to the following two points in accordance with the “ BC4XX - General Instructor Guide for ABAP Classes”. This is located under http://service.sap.com/curr-abap –>Additional Material. The required system preparations are described below. Data for exercises and demonstrations: As a rule, the necessary data has already been generated for your training client. If this is not the case, (for example, if your training course takes place at a customer’s site) you will have to run the data generation program SAPBC_DATA_GENERATOR. This will query you on the type and quantity of the data. Select the standard setting and set the indicator for Postings also cancelled. User IDs and initial passwords for participants: Unlike the application data, you must always generate the user IDs. Use the (locked) user ID TAW10_USER as a copy template.

xii

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Course Overview

Change requests for participants’ exercises: In the program used to generate user IDs (transaction ZUSR), you also have the option of creating a common change request that contains a task for each user generated in this way. Use it. Caution: Do not create any packages. Participants will do this as part of an exercise. Presentation: Make sure you can open the offline presentation for this training course (version 63). Example objects: All repository objects for this training course belong to the following packages BC400, BC402, BC405 and DNW7AW. The following naming conventions were used for the course objects: • • •

...BC400...XYD_...: Demonstration and example objects ...BC400...XYS_...: Model solutions ...BC400...XYT_...: Templates

In each case, XY is a two-character unit code. Caution: Never modify these standard objects. Create copies always, if you want to change something for demonstration purposes. Otherwise, you may cause errors in other objects, or prevent other courses from being held in this system. The same applies for your course participants! If, however, you use the correct copy template for their user IDs, they will probably not have the authorization to do so. General notes for the course: The time specifications are recommendations only. They contain sufficient time “intervals” for more detailed questions. However, you should bear in mind that the more participants learn, the more questions they tend to ask. It may also be that the learning group are not particularly homogenous. You must guarantee, in any case, that the entire content can be presented. We recommend keeping within the time limits right from the first chapters. The course materials should be suitable for participants to work through again after the course. This is why we provide extensive explanations and additional information. It is your task to pick out the most important statements in the material. The decisive factor should be the graphics that appear in the offline presentation and the aspects they represent. Similar principles apply to the objects of all packages. These packages contain more objects than you will need to present the course successfully. Much of the code is also available as source code extracts in the presentation or in participants’

2008

© 2008 SAP AG. All rights reserved.

xiii

Course Overview

TAW10_1

material (or both). It is up to you whether you want to discuss these in detail, use the demonstration objects themselves, or create similar objects during the presentation and use them. We recommend direct demonstration in the system. Additional notes for instructors: In addition to these general notes, you will find additional, more detailed notes in each unit and lesson. You will also find other short notes in the material wherever we think it necessary to ensure that the course is held successfully. Introductory phase at the start of the course: • • • • • •

Introduce yourself as the course instructor Organizational issues Introducing the participants (optional, depends on time available!) Overview of the course material References to more in-depth information Overview of the course content

Additional Information about Certification •

Open the browser and enter the following link: http://www.sap.com/services/education/certification/index.epx. Select the following criteria: SAP NetWeaver, Development, Developer/Development Consultant. Select the following option on the next page: SAP Certified Development Associate - ABAP - SAP NetWeaver 7.0, for more information.

Subsequent courses • •

xiv

TAW11 TAW12

© 2008 SAP AG. All rights reserved.

2008

Unit 1 The Big Picture

1

In this section, the participants should learn to evaluate how the primary course focus (SAP NetWeaver Application Server) relates to the “rest” of the SAP solutions (SAP NetWeaver, SAP Business Suite, and so on). Experience has shown that these topics are usually subject to frequent changes such as renaming, and so on. It is not always easy for customers and SAP employees alike to keep track of all changes. These materials were last updated in Q2 2008. You can use the following addresses to keep yourself up-to-date: • •

http://service.sap.com/releasestrategy http://smart.sap.corp:1080/smart

First of all, a lesson deals with the distinction between applications and components. Here it should be made clear that an SAP application (previously “solution”) technically consists of several components (SAP systems). After that, it is pointed out that all SAP applications are based on the same technology and integration platform: SAP NetWeaver. Do not deal with the individual SAP NetWeaver components in too much detail, but make it clear that SAP NetWeaver AS is a central part of almost every SAP system. That is, the functionality discussed in the course will usually be available in many SAP systems in the company. In the last lesson of the unit, we will try to document the SAP release strategy in a customer course. We strongly recommend that the instructor closely monitors updates or changes to the release strategy and mentions them in the course, if necessary.

Unit Overview This unit first provides an overview of the SAP solutions. You will then learn more about SAP’s release strategy. Finally, we will talk about the application and integration platform SAP NetWeaver.

Unit Objectives After completing this unit, you will be able to:

2008

© 2008 SAP AG. All rights reserved.

1

Unit 1: The Big Picture

• • • • • • •

TAW10_1

List the key components of the SAP solutions Explain the differences between an application and a component Describe the SAP software delivery process Explain the SAP maintenance strategy Find out when SAP software releases will become available Explain the basic concept of SAP NetWeaver Describe the central role played by the SAP NetWeaver Application Server

Unit Contents Lesson: The SAP Software Portfolio ................................................ 3 Lesson: SAP Release Strategy .................................................... 17 Exercise 1: SAP Release Strategy............................................ 25 Lesson: SAP NetWeaver ........................................................... 28

2

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 2

Lesson: The SAP Software Portfolio

The SAP Software Portfolio Lesson Duration: 60 Minutes

Lesson Overview This unit provides an introduction to the structure of SAP’s software solutions, at the center of which is the SAP Business Suite.

Lesson Objectives After completing this lesson, you will be able to: • •

List the key components of the SAP solutions Explain the differences between an application and a component

The aim of this introductory lesson is to provide participants with an overview of the SAP software portfolio. Some advantages are also introduced here. Make sure that, as part of this lesson, you show the participants the introduced areas on the SAP homepage: http://www.sap.com.

Business Example Your company plans to introduce SAP software. You, as a member of the project team, need an overview of the entire SAP portfolio.

Offers for Companies of All Sizes SAP offers a vast range of products for companies of all sizes. SAP has scalable products, ensuring that they can be adjusted to any size and adaptable to the continuously changing processes of a company.

2008

© 2008 SAP AG. All rights reserved.

3

Unit 1: The Big Picture

TAW10_1

Figure 1: Different Sizes - Different Products

The following offers are available to SMB customers:

SAP Business One SAP Business One is a comprehensive, integrated ERP application with an interface similar to Windows, which has been developed specifically for small and midsize companies. It distinguishes itself by simple navigation and expansion options, innovative Drag&Relate functions as well as integration with Microsoft Word and Excel. The software enables you to uniformly manage the most important business areas such as sales, distribution and finances with one single, integrated application. This enables SAP Business One to provide an up-to-date overview of your company’s most important data at any time. This information helps you meet customer requirements even quicker, an important prerequisite for profitable growth. SAP Business One is the ideal solution for small companies with less than 100 employees and 30 users who are looking for an affordable system that covers their core processes (such as finance, sales, customer service and operations), thus ensuring successful and profitable operations. The solution can be used as a local software or hosted by a partner with an average implementation time of less than one month. SAP Business One is sold exclusively through a global partner network of currently 1,300 certified and experienced partners. They offer 24 hour support, which also covers the more than 350 enhancements from independent software providers. SAP Business One is currently being used by more than 14,500 customers in over 40 countries. Note: For more information, go to http://www.sap.com/solutions/sme/businessone.

4

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: The SAP Software Portfolio

SAP Business ByDesign SAP Business ByDesign is based on an entirely newly developed, designed application platform. Business applications have been programmed anew from scratch based on a model. The interaction between applications and systems takes place via specified services or interfaces: Application-to-Application (A2A), Business-to-Business (B2B) as well as new UI interfaces. Standardized protocols, which are also simply referred to as Web Services, are used for this purpose. But this is not the definition of an Enterprise Service Oriented Architecture (Enterprise SOA). It is rather the modeling of the applications and the A2A, B2B and UI interfaces that distinguish an Enterprise SOA. SAP Business ByDesign is SAP’s latest solution for small and midsize companies with between 100 and 500, who want to use an on demand solution to improve their core processes and at the same time benefit from lower entry and operating costs. It is aimed, in particular, at midmarket companies who are not using integrated business software so far. A solution combines the advantages of an integrated, end-to-end application with the low risk potential and the low total operating costs of an on demand solution. An on demand solution that distinguishes itself through integrated service and support, adaptability and more user friendliness and also guarantees transparency and the observation of legal requirements - all this on the basis of an Enterprise SOA by design. SAP Business ByDesign the most complete, fully integrated on demand solution. More than a pure niche solution, it supports the requirements of midsize companies in all areas such as effective management of finances, human resources, projects, production as well as supplier and customer relationship management as well as regional and local legal requirements and compliance management as core design principles. It was not developed with the traditional categories of business applications or customer relationship management and others. It was rather developed for business processes in the entire company with user interfaces that are customized to the user roles. SAP Business ByDesign offers end-to-end processes for the work center of the future. Note: For more information, go to http://www.sap.com/solutions/sme/businessbydesign.

2008

© 2008 SAP AG. All rights reserved.

5

Unit 1: The Big Picture

TAW10_1

SAP Business All-in-One All software has to be adapted to the specific company. A midsize company with few employees and comparatively stable processes can use preconfigured SAP systems. SAP All-in-One is the brand name for vertical (industry-specific or country-specific) applications that are based on the technology of SAP NetWeaver and were developed in conjunction with SAP’s partners. SAP Business All-in-One is the ideal solution for small and midsize companies with very industry-specific requirements who have several divisions and a mature IT infrastructure. The solution can be used as a local software or hosted by a partner and is based on SAP ERP. It provides an industry-specific function portfolio based on SAP Best Practices. It is made available through 660 midmarket solutions by more than 1,000 partners. SAP Business All-in-One is affordable and can be planned and thanks to preconfigured business scenarios and implementation accelerators it can be implemented swiftly (4 to 16 weeks). SAP Business All-in-One is currently being used by more than 10,000 customers in over 50 countries. Note: For more information, go to http://www.sap.com/solutions/sme/businessallinone.

SAP Business Suite in Detail The SAP Business Suite, which has evolved from older R/3 releases or SAP systems, is not Enterprise SOA by design but by evolution. Put differently: the ability to use Enterprise Services will be “enabled” subsequently, but this was not a design principle from the start. Of course, SAP ERP 6.0 will also enable Enterprise SOA integration scenarios, especially by means of the XI Enterprise Service Repository. This remark is intended as background information for the instructor and should only be passed on to participants on request. The SAP Business Suite is an extended family of business applications that enables companies to manage their entire value chains. The included business applications provide users with consistent results throughout the entire company network and give your company the flexibility it needs in today’s dynamic market situations. The application consists of a number of different products that support cross-company processes. Note: For more information, go to http://www.sap.com/solutions/businesssuite.

6

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: The SAP Software Portfolio

SAP’s software portfolio is constantly extended, optimized, and tailored to the needs of the market and of customers. SAP has therefore, for example, developed many industry-specific applications over the years. The topic of integrating different business systems (even from different vendors and across company boundaries) has become increasingly important recently. Products for small to midsize businesses have also been added to SAP’s family of software solutions. The SAP Business Suite, a complete business software package that is unique worldwide, plays a central role. Many companies are already profiting from the comprehensive and flexible business applications with highly evolved functions: complete integration, industry-typical functions, unlimited scalability and smooth collaboration via the internet. The SAP Business Suite provides: • • • • •

A complete spectrum of business solutions A technological infrastructure that combines openness and flexibility with maturity and stability Interfaces for integrating non-SAP products Components that can be adapted to meet multiple business requirements Numerous industry-specific functions

The next graphic illustrates the key components of the SAP Business Suite:

Figure 2: SAP Business Suite: Architecture

2008

© 2008 SAP AG. All rights reserved.

7

Unit 1: The Big Picture

TAW10_1

Key components of the SAP Business Suite are: Business Process Platform (BPP) A Business Process Platform is the prerequisite for the deployment of a service-oriented architecture for business applications (Enterprise Service-Oriented Architecture, Enterprise SOA). The SAP BPP is composed of the following modules: SAP NetWeaver SAP NetWeaver is an open integration and application platform for all SAP applications and certain SAP partner applications. SAP NetWeaver is a web-based platform, which serves as the basis for the Enterprise SOA and enables the cross-company and technology-independent integration and coordination of employees, information and business processes. Thanks to open standards, information and applications from any source and based on any technology can be integrated. SAP NetWeaver is interoperable with the most important technological standards such as the Java 2 Platform, Java Enterprise Edition (Java EE) and Microsoft .NET. The platform provides a maximum of reliability, security and scalability ensuring that business processes that are critical for success run without problems. SAP applications The SAP Business Suite includes extensive, integrated applications, which customers can license completely or individually. More recent SAP applications use the Enterprise Service Repository, repository for processes and Enterprise Services. Enterprise Services map business processes using open standards. Both SAP NetWeaver and the SAP applications are continuously enhanced through Enhancement Packages. Enhancement packages are shipped at regular intervals in order to make it possible to respond to market requirements quicker and to provide additional benefits to customers and partners without the need to wait for the next major product release.

8

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: The SAP Software Portfolio

Composite Applications (xApps) SAP xApps are a portfolio of “Packaged Composite Applications”, which you can use to promote improvements and innovation in your company more easily. With their ability to combine existing, heterogeneous systems to form cross-functional processes, SAP xApps Composite Applications bring people, information, and business processes together to make your company more dynamic and competitive. This flexibility enables you to implement business-wide strategies more easily and efficiently. SAP xApps increase the value of existing investments in the core business area and maximize the return on strategic investments: employees, knowledge, products, business relationships, and information technology. You can use the SAP Composite Application Framework (CAF) to develop and run your own xApps. The following graphic provides an overview of the applications included in the SAP Business Suite.

Figure 3: SAP Business Suite: Included Applications

2008

© 2008 SAP AG. All rights reserved.

9

Unit 1: The Big Picture

TAW10_1

This graphic is still brand new (in Q3 2007) and differs significantly from earlier graphics. One reason was to bring the product view (“What SAP products are available?”) and the license view (“What can you buy=license from SAP?”) closer together. The following list should help to explain what is behind the individual terms. In SAPTEC one cannot expect the instructor to be an expert in all applications - but you should at least be able to provide a rough description of the individual applications. If they are still valid, the specified links provide additional information. Some of the applications introduced in the graphic are: •





Applications for Governance, Risk, and Compliance (GRC): Applications for governance (SAP GRC Repository), risk management (SAP GRC Risk Management) and compliance with legal requirements (SAP GRC Access Control, SAP GRC Process Control, SAP GRC Global Trade Services, SAP applications for environment, health, and safety compliance management, GRC composite applications by SAP and Cisco); for more information see http://www.sap.com/solutions/grc Applications for Performance Management: Applications for performance management (SAP Strategy Management, SAP Business Planning and Consolidation, SAP Business Profitability Management by Acorn, SAP xApp Analytics); for more information see http://www.sap.com/solutions/performancemanagement SAP Enterprise Resource Planning (SAP ERP): Applications for supporting resource planning across an entire enterprise – – – –

SAP ERP Human Capital Management SAP ERP Financials SAP ERP Operations ERP Corporate Services

For more information see http://www.sap.com/solutions/business-suite/erp •



10

SAP Customer Relationship Management (SAP CRM): Applications for end-to-end, customer-oriented business processes; for more information see http://www.sap.com/solutions/business-suite/crm SAP Supplier Relationship Management (SAP SRM): SAP SRM integrates strategic purchasing processes such as vendor qualification and vendor management, electronic invitations for tender and auctions

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: The SAP Software Portfolio







or contract management with the other core processes in your company and with the processes of your suppliers; for more information see http://www.sap.com/solutions/business-suite/srm SAP Supply Chain Management (SAP SCM): Applications for managing the entire logistical chain to synchronize supply and demand across company borders; for more information see http://www.sap.com/solutions/business-suite/scm SAP Product Lifecycle Management (SAP PLM): Applications for including internal and external partners directly in the operational product development and production processes; for more information see http://www.sap.com/solutions/business-suite/plm Industry Applications: Industry-specific applications – – – – – – – – – – – – – – – – – – – – – – – –

Banks Healthcare Universities and research institutes Internal & external security Public sector Insurance Service industry Wholesale Retail Logistics service providers Media industry Telecommunications Utilities industry Automobile industry Construction industry, engineering, construction and operations High tech and electronics industry Consumer products industry Aerospace and space industry Mechanical engineering Metal, wood and paper industry Mining Chemicals Life sciences Oil and gas industry

For more information see http://www.sap.com/industries

2008

© 2008 SAP AG. All rights reserved.

11

Unit 1: The Big Picture



TAW10_1

SAP xApps Composite Applications: Composite applications that cover several company solutions across persons, information and processes – – – – – – – –

SAP xApp Cost and Quotation Management (SAP xCQM) SAP xApp Integrated Exploration and Production (SAP xIEP) SAP xApp Lean Planning and Operations (SAP xLPO) SAP xApp Manufacturing Integration and Intelligence (SAP xMII) SAP xApp Product Definition (SAP xPD) SAP xApp Resource and Portfolio Management (SAP xRPM) SAP xApp Sales and Operations Planning (SAP xSOP) SAP xApp Spend Analytics (SAP xSA)

For more information see http://www.sap.com/xapps •

Applications for Information Workers: Applications granting employees access to company data and business processes anytime and anywhere – – –

Duet for Microsoft Office and SAP SAP Interactive Forms by Adobe SAP NetWeaver Enterprise Search

For more information see http://www.sap.com/solutions/informationworkers •

SAP NetWeaver: Open integration and application platform for all SAP applications – – – – – – – –

SAP NetWeaver Application Server SAP NetWeaver Business Intelligence SAP NetWeaver Exchange Infrastructure SAP NetWeaver Master Data Management SAP NetWeaver Mobile SAP NetWeaver Portal SAP Auto-ID Infrastructure SAP NetWeaver Identity Management

For more information see http://www.sap.com/platform/netweaver

12

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: The SAP Software Portfolio

Context of Applications and Components Numerous applications for business challenges are provided in the context of the SAP Business Suite. However, many applications have similar or identical requirements for business functions in subareas. Different applications therefore contain similar (software) components in parts. A component is the smallest, separately producible, deliverable, installable, and maintainable software unit. Components refer to, for example, an SAP ECC system, an SAP SCM system or also an SAP NetWeaver portal system. The graphic provides an overview of this hierarchy (components as building blocks of solutions) using the SAP SCM application as the example.

Figure 4: Applications and Components

Possibilities with SAP Business Suite To give you a clearer impression of the possibilities of the SAP Business Suite, you can see some of the business scenarios that are possible using SAP Business Suite from the following graphic.

2008

© 2008 SAP AG. All rights reserved.

13

Unit 1: The Big Picture

TAW10_1

Figure 5: Possible Business Scenario with SAP Business Suite

The SAP Business Suite offers many options for integrating your company-internal business processes and, likewise, integrating business partners’ systems. You can implement the integration of cross-enterprise processes using different technologies, such as with Application Link Enabling (ALE), using Electronic Data Interchange (EDI), through XML data exchange, or also using Composite Applications (xApps) and Web Services. Point out here that there is usually exactly one database that belongs to an SAP system. In the above graphic, the company (indicated using the content of the dotted ellipse in the middle) has four production SAP systems with four corresponding databases.

14

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: The SAP Software Portfolio

Facilitated Discussion Highlight the possibilities offered by SAP Business Suite.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. Which of the opportunities offered by the SAP Business Suite will you actually use in your company?

2008

© 2008 SAP AG. All rights reserved.

15

Unit 1: The Big Picture

TAW10_1

Lesson Summary You should now be able to: • List the key components of the SAP solutions • Explain the differences between an application and a component

Related Information For more information, see the following SAP Internet sites. All of these sites are freely available, a few require you to register free of charge. Please draw the participants’ attention to the Web site of your local SAP subsidiary, for example: http://www.sap.de.

• • • • •

16

Global SAP Homepage, http://www.sap.com SAP Help Portal, http://help.sap.com SAP Service Marketplace, http://service.sap.com SAP Info, http://www.sap.info SAP Insider Online, http://www.sapinsideronline.com

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 14

Lesson: SAP Release Strategy

SAP Release Strategy Lesson Duration: 30 Minutes

Lesson Overview This lesson explains what phases your SAP solution runs through over time until the next upgrade to a higher release as well as what maintenance duration is guaranteed for SAP products.

Lesson Objectives After completing this lesson, you will be able to: • • •

Describe the SAP software delivery process Explain the SAP maintenance strategy Find out when SAP software releases will become available

It should become clear to the participants how the SAP product they use will change over time, whether through corrections/enhancements or through upgrades. SAP supports these processes in many ways, not least through the SAP Solution Manager.

Business Example You want up-to-date information about the availability of releases of SAP solutions, in order to be able to make a good decision with regard to the purchase or upgrade of an SAP solution.

History of Selected Software Components This section provides a bit of history of a few selected software components. SAP is very good at confusing customers, for example, through constant renaming. This little section is supposed to “get” customers who are familiar with the names of older software components, on the one hand. On the other hand, this section is a good transition to the topic as to how SAP actually supplies customers with applications. Discuss only the structure of the latest ECC or SAP NetWeaver systems in detail because the rest of the slide is pretty much self-explanatory. An overly extensive history with all name changes over the last few years (for example sap.com => mySAP Business Suite => SAP Business Suite) can be rather confusing for customers

2008

© 2008 SAP AG. All rights reserved.

17

Unit 1: The Big Picture

TAW10_1

who do not know the history because they are just about to introduce the software. “Seasoned” SAP users or admins in contrast might find the overview slide very helpful for understanding the contexts.

Technical Basis (Application Server) Do not deal with the components of SAP NetWeaver in detail yet, this will be done in the next lesson. If the participants ask, tell them briefly that this is our integration platform. This term should have already been mentioned in the first lesson for the software portfolio. Back in the days when SAP basically offered two products (SAP R/2 and SAP R/3), the development of the (technical) basis was closely linked to application development. The release names of the SAP Basis corresponded to the SAP R/3 version, for example, SAP Basis 4.0B was the technical basis for SAP R/3 4.0B Around the turn of the millennium, the SAP portfolio grew significantly, new products were created that required more frequent changes and enhancements of the SAP Basis than SAP R/3. This marks the transition from the classical SAP Basis (last version: SAP Basis 4.6D) to SAP Web Application Server (SAP Web AS). New internet technologies (Internet Communication Manager from SAP Web AS 6.10 onwards) and the supplementing of the classical ABAP environment with Java/JEE (from SAP Web AS 6.20 onwards) were important milestones. SAP Web AS 6.40 forms the technical basis (“application platform”) of SAP NetWeaver 04. SAP NetWeaver offers extensive capabilities (such as Business Intelligence), which are all based on the application platform. As of SAP NetWeaver 7.0 (previously: SAP NetWeaver 2004s), the names and releases were adapted further, so now SAP NetWeaver 7.0 is based on SAP NetWeaver Application Server 7.00 (SAP NetWeaver AS).

ERP Core Functions The following graphic shows the historical development for the current SAP ERP Central Component (ECC 6.0):

18

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP Release Strategy

Figure 6: Evolution from SAP R/3 via SAP R/3 Enterprise to SAP ECC

As already mentioned, in times of SAP R/3, the technical basis and application development were interlinked, up to and including SAP R/3 4.6C. With SAP R/3 Enterprise (4.7), which is based on SAP Web AS 6.20, the concept of SAP R/3 Enterprise Extensions was introduced. A central application (previously: solution) of the SAP Business Suite is SAP ERP for Enterprise Resource Planning. The central software component of SAP ERP is SAP ERP Central Component (SAP ECC). SAP ECC 5.0 can thus be considered the technical successor of SAP R/3 Enterprise and is based on an SAP Web AS 6.40. At the time of creating this documentation, the current version is SAP ERP 6.0 (previously: SAP ERP 2005), which also includes an SAP ECC 6.0 and other components, which operates on the basis of SAP NetWeaver AS 7.00. Functional enhancements for the different software components are made available through enhancement packages. The SAP NetWeaver strategy was announced in spring 2003. Back then, SAP R/3 Enterprise was the latest SAP R/3 release. Formally, it belongs to the newly defined SAP NetWeaver but from a license perspective, there were individual system licenses, which did not automatically equate to an SAP NetWeaver license. Hence

2008

© 2008 SAP AG. All rights reserved.

19

Unit 1: The Big Picture

TAW10_1

the year information 2003 was set in brackets because it is only supposed to hint to a parallelism and no assignment. For SAP NetWeaver 2004 and 2004s in contrast, the entries in brackets point to name changes (old term in brackets). SAP NW AS 7.10 or SAP NetWeaver 7.1 are currently not used as the technical basis for an SAP ECC system. Other SAP NetWeaver components, such as SAP NW Process Integration (PI) and SAP NW Composition Environment (CE) already require this SAP NetWeaver release level.

Availability and Delivery SAP applications, SAP NetWeaver, Enhancement Packages and xApps are offered to customers in two phases.

Figure 7: Phases of Software Delivery by SAP

Restricted Shipment Phase New software releases are only available to a restricted number of customers whose increase is controlled. The Release to Customer date marks the start of the Restricted Shipment Phase.

20

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP Release Strategy

During the restricted shipment phase, the new software release passes through a standardized process, the Ramp-Up. Characteristics of the ramp-up process are: • • • • • •

Ramp-up is the name for the market introduction process of new products or new releases of SAP software. The software can be used for a productive implementation. During the ramp-up, the software is only available for a limited circle of customers, customers “apply” to SAP to participate in a ramp-up. The ramp-up serves to take customer wishes into consideration before the respective SAP software is generally available. Participants in the ramp-up are given direct contact to the SAP development and are provided with wide support in implementing the SAP software. A ramp-up usually takes about 6 months. Note: For more information about the ramp-up, see http://service.sap.com/rampup.

Unrestricted shipment phase The second phase of the delivery is called unrestricted shipment phase. After the Default Release Date all customers can request the new software without restrictions. The respective latest, generally available version of SAP software is called Default Release. When SAP customers order software from SAP, they are usually given the current default release.

Maintenance Your maintenance contract includes Support Packages, which are provided by SAP via the SAP Service Marketplace. Support Packages solve (component-dependent) problems that can result when using the SAP software. SAP provides these Support Packages at certain intervals.

2008

© 2008 SAP AG. All rights reserved.

21

Unit 1: The Big Picture

TAW10_1

5-1-2 Maintenance Strategy

Figure 8: 5-1-2 Maintenance Strategy

Since 2004, SAP has been offering a new maintenance strategy for all products that are based on SAP NetWeaver. This 5-1-2 maintenance strategy offers maintenance for five years for the mainstream maintenance, followed by one year extended maintenance for a maintenance fee of two percent more and, optionally, another two years for a maintenance fee which is four percent more than the standard maintenance fee. Software installed at customer locations can transit into the phase of customer-specific maintenance. We distinguish the following three phases of maintenance: Mainstream maintenance Mainstream maintenance starts from the release to customer point in time and usually ends 5 years after the default release date. Extended maintenance Customers can extend the support period (in which corrections or legal changes are taken into account) for an increased maintenance fee (+2% for 1 year, +4% for 2 years).

22

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP Release Strategy

Customer-specific maintenance From a certain point in time during the lifecycle of a release, this release is no longer adjusted to meet external requirements. Such requirements are, for example, the implementation of legal changes or the support of new technologies. The time in question is marked by the end of extended maintenance or the end of mainstream maintenance, if no extended maintenance is offered. Customer-specific maintenance starts at this point in time. Note: See http://service.sap.com/maintenance for additional information on the maintenance strategy. SAP note 52505 deals specifically with the particularities of customer-specific maintenance.

Upgrade You should think about upgrading to the latest release when your SAP software is approaching the end of its mainstream maintenance, at the latest. During an upgrade of your SAP software, you can generally skip one or more of the software releases (of your application) that have appeared in the meantime. For example, an upgrade from SAP R/3 4.6C to SAP ERP 6.0 is technically possible, even though you change product during this upgrade (from SAP R/3 to SAP ERP). SAP offers upgrade paths for SAP applications, SAP NetWeaver, Enhancement Packages, xApps and Content Shipments. There might be cases in which an upgrade requires several steps (especially due to technical restrictions). Note: For more information on upgrade, see http://service.sap.com/upgrade.

2008

© 2008 SAP AG. All rights reserved.

23

Unit 1: The Big Picture

24

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

21

Lesson: SAP Release Strategy

Exercise 1: SAP Release Strategy Exercise Duration: 10 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Name some information sources of the SAP Service Marketplace

Business Example You want to determine the standard maintenance period for the SAP ERP 6.0 application and the point in time at which the next Support Package Stack will be available.

Task: Maintenance Information Determine some maintenance information via the SAP Service Marketplace. You use the SAP Service Marketplace to find out the end of the standard maintenance for the SAP ERP 6.0 application and to find out when the next Support Package Stack for the applications in your SAP ERP 6.0 system will be released.

2008

1.

When does the maintenance contract for the SAP ERP 6.0 application end?

2.

When is the next Support Package Stack for SAP NetWeaver 7.0 scheduled?

© 2008 SAP AG. All rights reserved.

25

Unit 1: The Big Picture

TAW10_1

Solution 1: SAP Release Strategy Task: Maintenance Information Determine some maintenance information via the SAP Service Marketplace. You use the SAP Service Marketplace to find out the end of the standard maintenance for the SAP ERP 6.0 application and to find out when the next Support Package Stack for the applications in your SAP ERP 6.0 system will be released. 1.

When does the maintenance contract for the SAP ERP 6.0 application end? a)

Look at these addresses • •

http://service.sap.com/releasestrategy http://service.sap.com/pam

to answer the question: March 2013. 2.

When is the next Support Package Stack for SAP NetWeaver 7.0 scheduled? a)

Look at this address •

http://service.sap.com/sp-stacks

to answer the question: Choose the SP Stack Calendar link at the bottom of the page and determine the planned calendar week.

26

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP Release Strategy

Lesson Summary You should now be able to: • Describe the SAP software delivery process • Explain the SAP maintenance strategy • Find out when SAP software releases will become available

Related Information • • • • •

2008

http://www.sap.com/solutions http://service.sap.com/releasestrategy http://service.sap.com/rampup http://service.sap.com/maintenance http://service.sap.com/upgrade

© 2008 SAP AG. All rights reserved.

27

Unit 1: The Big Picture

Lesson: 24

TAW10_1

SAP NetWeaver Lesson Duration: 20 Minutes

Lesson Overview This lesson explains the central role of the SAP NetWeaver Application Server in SAP NetWeaver.

Lesson Objectives After completing this lesson, you will be able to: • •

Explain the basic concept of SAP NetWeaver Describe the central role played by the SAP NetWeaver Application Server

This lesson is very important because it explains the SAP NetWeaver and SAP NetWeaver Application Server technology to the participants.

Business Example You want to find out more about SAP NetWeaver and the role that the SAP NetWeaver Application Server (SAP NetWeaver AS) plays in SAP NetWeaver.

SAP NetWeaver The SAP NetWeaver technology platform is designed for the flexible, step-by-step and efficient introduction of important IT processes in companies. Thanks to the high level of integration of the individual platform functions, its openness and the use of industry standards, the integration and application platform contributes significantly towards reducing the total cost of ownership (TCO) across the entire system landscape. SAP NetWeaver represents the technical basis of the SAP Business Suite, SAP xApps Composite Applications and other, partly industry-specific SAP applications. SAP NetWeaver is also the technical basis for the forward-looking, service-oriented architecture for business applications (enterprise SOA). In an enterprise SOA, the application functions are made available in the form of enterprise services. These are web services that can be combined flexibly and used for business purposes. They are provided by different providers through data networks and communicate with other applications using open, standardized interfaces.

28

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP NetWeaver

SAP NetWeaver integrates and connects people, information and business processes across technologies and companies. It enables companies to adjust to changes quickly. SAP NetWeaver ensures that a company’s crucial business processes are reliable, safe and scaleable. Furthermore, SAP NetWeaver enables companies to maximize the benefits from the current software and systems. Non-uniform integration technologies are consolidated and predefined business content is provided thus reducing the amount of manual work required. SAP NetWeaver is based on a technology using industry standards and can be enhanced with popular development tools such as Java 2 Platform, Enterprise Edition (J2EE), Microsoft .NET and IBM WebSphere. Not all SAP applications are based on SAP NetWeaver, in particular SAP Business One. If participants ask about the interoperability of .NET and WebSphere, you can point to these two areas in http://sdn.sap.com under SAP NetWeaver → Platform and Operations.

IT Practices and IT Scenarios With SAP NetWeaver 7.0, SAP departs from the layered structure of SAP NetWeaver and moves towards IT practices and scenarios. Demo: On your SAP country site (for example, to www.sap.de) under Platform → SAP NetWeaver → SAP Business Maps point out IT Practices and IT Scenarios. For SAP NetWeaver 7.1 more terminology changes are planned...

2008

© 2008 SAP AG. All rights reserved.

29

Unit 1: The Big Picture

TAW10_1

Figure 9: IT Practices and IT Scenarios

SAP NetWeaver enables you to implement IT processes in a range of solution methods, called IT practices. For each practice, SAP NetWeaver supports a range of key IT activities, which can be performed using the integrated components of the platform. The focus here is not on system and technological components but on the IT and business goals of the company. IT practices enable you to reach your company’s goals in individual and manageable projects, that is, in sequential steps and according to their importance. IT practices refer to, for example, the increase of user productivity through improved, cross-company collaboration, personalized access to applications and data and optimized knowledge management. IT practices show how SAP NetWeaver can be used to solve certain IT problems by means of IT scenarios. For each IT practice, SAP NetWeaver supplies corresponding IT scenarios, which act as implementation guides. The aim of the IT scenarios is to help you as a customer, partner or service provider with the installation, configuration and operation of SAP NetWeaver as well as the operation of SAP applications, customer-specific applications and the implementation of your defined IT scenarios.

30

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP NetWeaver

SAP NetWeaver Layers The correct term: The four SAP NetWeaver layers consist of central functions (such as the portal). Key components like the SAP NetWeaver Portal provide these central functions.

Note: All SAP NetWeaver component like the Portal, for example, have the name SAP NetWeaver as the prefix since the SAP NetWeaver Release 7.0. That is, the SAP Enterprise Portal is now called SAP NetWeaver Portal SAP NetWeaver Component

Previous Designation

SAP NetWeaver

SAPBasis

SAP NetWeaver Application Server

SAP Web Application Server

SAP NetWeaver Mobile

SAP Mobile Infrastructure

SAP NetWeaver Portal

SAP Enterprise Portal

SAP NetWeaver Business Intelligence

SAP Business Information Warehouse

SAP NetWeaver Exchange Infrastructure SAP NetWeaver Exchange Infrastructure SAP NetWeaver Composite Application Framework

2008

SAP Composite Application Framework

© 2008 SAP AG. All rights reserved.

31

Unit 1: The Big Picture

TAW10_1

Figure 10: SAP NetWeaver: Capabilities



People Integration People integration ensures that your employees have access to the information and functions that they need in order to perform their activities quickly and efficiently. The functions of the SAP NetWeaver Portal are the most important in this context. SAP NetWeaver Mobile serves as the universal platform for company mobility and supports SAP solutions for Mobile Business.



Information Integration This integration layer provides access to all structured and non-structured information in your company. The key areas of information integration are mostly formed by SAP NetWeaver Business Intelligence, Knowledge Management, as a component of SAP NetWeaver Portal and SAP NetWeaver Master Data Management. All aforementioned key areas provide comprehensive options for uniform access to distributed information in a company. What is meant by “structured” information? This generally refers to SAP data or data from an SAP system. All other information is referred to as unstructured. This does not mean that this data does not have a structure - of course it can have a structure - but it does not have an SAP-specific structure.



Process Integration Process integration ensures that business processes work across system borders in a landscape of heterogeneous systems. The SAP NetWeaver Exchange Infrastructure (SAP XI) plays a crucial role here and connects SAP systems and non-SAP systems. It mainly uses open standards from the XML and Java world to do so.



Application Platform The SAP NetWeaver Application Server provides a proven infrastructure for operating business applications that are based on key technologies such as J2EE or ABAP. Besides the runtime environment for J2EE and ABAP applications, the corresponding development tools are also shipped and help you implement your applications. Open standards, browser-based access to applications and web services complete the application platform and serve as an important instrument for the enterprise service architecture.

Beyond these four steps and in parallel to them, SAP NetWeaver offers Lifecycle Management and the Composite Application Framework:

32

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP NetWeaver

Lifecycle Management Lifecycle Management supports design, development, deployment and change management of the entire solution and thus meets the requirements in the security, design and modeling, testing and systems environment management areas. Composite Application Framework The Composite Application Framework (CAF) is integrated into SAP NetWeaver and enables SAP and its partner to use tools, frameworks, rules and methods to create new applications that are based on business processes across function areas.

SAP NetWeaver Application Server (SAP NetWeaver AS) Almost every SAP system is based on SAP NetWeaver AS and uses it as the runtime environment. Together with the database, SAP NetWeaver AS is the the application platform of SAP NetWeaver.

Figure 11: SAP NetWeaver AS as the Basis for SAP Systems

2008

© 2008 SAP AG. All rights reserved.

33

Unit 1: The Big Picture

TAW10_1

Figure 12: SAP NetWeaver Application Server

SAP NetWeaver AS is the logical result of the further development of the SAP Application Server Technology (previously: SAP Basis), whereby special attention is paid to web-based applications. SAP NetWeaver AS offers: • • • • • •

34

A reliable and extensively tested runtime environment, which has been developed further continuously over more than ten years A framework for executing complex business processes that meet the highest security standards A reliable and user-friendly development environment Support for open standards, including HTTP, HTTPS, SMTP, WebDAV, SOAP, SSL, SSO, X.509, Unicode, HTML, XML and WML High scalability Support for different operating system and database platforms

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP NetWeaver

Since the applications delivered by SAP do not always require both runtime environments, that is, ABAP and Java, there are different installation options for SAP NetWeaver AS. These are: • • •

2008

SAP NetWeaver AS ABAP:Complete infrastructure in which ABAP-based applications can be developed and used. SAP NetWeaver AS Java:Complete infrastructure in which J2EE-conform applications can be developed and used. SAP NetWeaver AS ABAP+Java: Complete infrastructure in which ABAP-based and J2EE-based applications can be developed and used. This installation emphasizes the seamless Java ABAP integration.

© 2008 SAP AG. All rights reserved.

35

Unit 1: The Big Picture

TAW10_1

Facilitated Discussion The discussion should illustrate the strengths and advantages of SAP NetWeaver.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. Which advantages do SAP customers gain by using SAP NetWeaver?

36

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: SAP NetWeaver

Lesson Summary You should now be able to: • Explain the basic concept of SAP NetWeaver • Describe the central role played by the SAP NetWeaver Application Server

Related Information For more information, see the following sections: • •

2008

http://www.sap.com/netweaver. http://service.sap.com/it-scenarios

© 2008 SAP AG. All rights reserved.

37

Unit Summary

TAW10_1

Unit Summary You should now be able to: • List the key components of the SAP solutions • Explain the differences between an application and a component • Describe the SAP software delivery process • Explain the SAP maintenance strategy • Find out when SAP software releases will become available • Explain the basic concept of SAP NetWeaver • Describe the central role played by the SAP NetWeaver Application Server

38

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

33

Test Your Knowledge

Test Your Knowledge 1.

The following solutions are provided by SAP: Choose the correct answer(s).

□ □ □ □ □ 2.

2008

A B C D E

SAP Business Change Enabler (SAP BCE) SAP Product Lifecycle Management (SAP PLM) SAP Customer Relationship Management (SAP CRM) SAP Supply Chain Management (SAP SCM) SAP Strategic Organization Planning (SAP SOP)

SAP guarantees certain maintenance periods for SAP NetWeaver-based products. The mainstream maintenance can be extended by paying increased maintenance fees. How many years will an SAP product be maintained in total, if you are willing to pay a maintenance fee increased by 2% for a part of the maintenance time?

© 2008 SAP AG. All rights reserved.

39

Test Your Knowledge

34

TAW10_1

Answers 1.

The following solutions are provided by SAP: Answer: B, C, D SAP BCE and SAP SOP are imaginary products. The others are real SAP applications.

2.

SAP guarantees certain maintenance periods for SAP NetWeaver-based products. The mainstream maintenance can be extended by paying increased maintenance fees. How many years will an SAP product be maintained in total, if you are willing to pay a maintenance fee increased by 2% for a part of the maintenance time? Answer: The software product is maintained 6 (5 + 1) years in this case.

40

© 2008 SAP AG. All rights reserved.

2008

Unit 2 Navigation

35

Since many course participants will be seeing an SAP system for the first time, it is important that they all receive a good grounding in the basics that will enable them to access system functions efficiently. You should pay particular attention to the developers and system administrators during this unit. They are the ones who will often need to call up functions that are unfamiliar to them in the course of their work. To find these functions, administrators will need to know how to use the command field (for example, search_sap_menu) and table TSTCT.

Unit Overview In this unit, you will learn how to use the SAP GUI to navigate in SAP systems. You will also learn how to get help when you are working in SAP systems.

Unit Objectives After completing this unit, you will be able to: • • • • • • •

Log on to the system successfully List some variants of the SAP GUI Log off from the system successfully Use various methods to start SAP system functions Create a list of favorites Use the help functions Describe the standard menus System and Help.

Unit Contents Lesson: Navigation in General ..................................................... 43 Procedure: Changing the Initial Password ................................... 50 Procedure: Changing the Changed Password Again....................... 51

2008

© 2008 SAP AG. All rights reserved.

41

Unit 2: Navigation

TAW10_1

Procedure: Log off via the Menu Bar ......................................... 55 Exercise 2: Logon and Screen Design ....................................... 57 Lesson: Advanced Navigation in the SAP GUI .................................. 60 Exercise 3: Calling Functions .................................................. 71

42

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 36

Lesson: Navigation in General

Navigation in General Lesson Duration: 40 Minutes

Lesson Overview This lesson provides an overview of the different navigation options in SAP systems and you will learn basic navigation commands using the SAP GUI for Windows as the example.

Lesson Objectives After completing this lesson, you will be able to: • • •

Log on to the system successfully List some variants of the SAP GUI Log off from the system successfully

After completing this lesson, the participants should be able to log on to the system without errors and name and use the basic elements of an SAP GUI screen as well as log off from the system correctly. Course ADM100 covers how to configure SAP logon.

Business Example You want to find out which options are generally available to your users to access SAP systems.

Different User Interfaces in the SAP Environment There are numerous different types of SAP systems, such as “classical” ERP systems, but there are also other system types like Portal or Business Information Warehouse systems, for example. Depending on what they are used for, these different system types do offer rather different user interfaces. The following list names some frequently used access technologies, which end users of these system (so not “technicians”) use frequently.

2008

© 2008 SAP AG. All rights reserved.

43

Unit 2: Navigation

TAW10_1

Examples of Different Access Technologies for a Small Selection of SAP System Types SAP Product

Typical Access Technology

SAP ERP (with SAP ECC)

SAP GUI for Windows (GUI = Graphical User Interface)

SAP NetWeaver BI 7.0 Browser-based interface (different browsers possible) BEx Analyzer (additionally requires Excel on the front-end) SAP Business ByDesign

Browser-based interface (different browsers possible)

SAP Business All-in-One

SAP NetWeaver Business Client

Please note that the above list does not cover all SAP products are and that not all possible (!) access technologies are listed in all cases. For example, an SAP ECC system can also be accessed by browser or using the SAP GUI for Java; SAP NetWeaver BI is also accessible by SAP GUI for Windows and so on. The following display will be limited to the most popular access technology, the SAP GUI. The presentation interface, SAP GUI (Graphical User Interface) enables the user to interact with the SAP system and enter or display data. SAP GUI implements the graphical user interface using the functions provided by the relevant presentation environment. SAP GUI is based on the Windows Style Guide and is available for several platforms, providing the same functions for each. If you learned to use SAP GUI on one platform, you can use the system on another platform exactly the same as before, with the exception of a few small platform-specific GUI attributes. There are different variants of the SAP GUI, which can all be operated in the same way, irrespective of the underlying platform. The following types of SAP GUI are available: • • •

SAP GUI for the Windows environment SAP GUI for the Java Environment SAP GUI for HTML Note: In the above list, the official terms of the SAP GUI are used; these are only available in English. Colloquially, the following terms are used synonymously (in the same order): SAP GUI for Windows, Java GUI and Web GUI. Please note that these are not the “official SAP terms” but are used frequently nonetheless.

44

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Navigation in General

Caution: The above variants of the SAP GUI are suitable only for working with ABAP-based SAP systems (including the SAP GUI for the Java Environment). Java-based SAP applications are accessed using a browser. SAP GUI for the Windows environment (abbreviated to SAP GUI for Windows) is the SAP GUI implementation in a Microsoft Windows environment. SAP GUI for Windows is written in C or C++, runs on Windows-based platforms, and supports all transactions in an SAP system. The data flow between the presentation layer and the application layer does not consist of prepared screens, but rather of logical, compact information about control elements and user input (DIAG protocol). The volume of data transferred for each screen change is generally a few KB. You can therefore also easily connect presentation servers over WANs. SAP GUI for the Java Environment (abbreviated to: SAP GUI for Java) is written in Java and is the platform-independent implementation of SAP GUI. Like SAP GUI for the Windows environment, this GUI also uses the DIAG protocol, so the volume of data transferred for each screen change is also generally only a few KB and you can easily connect presentation servers over WANs. You can either install SAP GUI on the front end, or alternatively you can install it on a terminal server and access it using terminal clients. SAP GUI for HTML consists of the Internet Transaction Server (ITS) in the Application Server ABAP (short: AS ABAP) on the server side and a Web browser on the client side. The ITS is required to convert the SAP GUI data flow already in the AS ABAP into HTML and back. In this case, an HTML data stream is exchanged between the Internet Communication Manager of the AS ABAP and the front-end. The primary advantage of the SAP GUI for HTML is the simpler installation on the front-end; a browser installation suffices. The following graphic shows the various alternatives and the flow of communication with the AS ABAP dispatcher. If it is available and you know how to access it, you could at this point call up SAP GUI for the Java Environment (for example on a WTS) for the training system you are using and, once you have logged on, carry out a transaction in it (for example, SM50). You could do the same for the HTML GUI in the browser, so that the participants get to see the various types of GUI.

2008

© 2008 SAP AG. All rights reserved.

45

Unit 2: Navigation

TAW10_1

Figure 13: Alternative types of SAP GUI

Note: You can find further information on the various SAP GUI alternatives in the following SAP Notes: • • • •

SAP Note 66971: front-end platforms supported SAP Note 314568: functions not available with SAP GUI for HTML SAP Note 146505: SAP GUI for the Java environment SAP Note 138869: SAP GUI on the Windows Terminal Server

Logging on to the System Most of the solutions shipped by SAP can be accessed using the SAP GUI (SAP Graphical User Interface). For the sake of simplicity, further descriptions refer to the SAP GUI for the Windows environment. SAP provides another program for starting the front-end: SAP Logon. When you call up SAP Logon, it displays a list of SAP systems for which you can start the logon process. This list is taken from a file on the front end: saplogon.ini. This file is usually centrally preconfigured and provided for end users. During logon, the SAP Logon program also enables logon load distribution using the resources available for the system selected.

46

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Navigation in General

Figure 14: The SAP Logon program

When logging on to an SAP system, you will be prompted to enter the user and password, among other things. If you have implemented a Single Sign-On (SSO) solution, you may not need to enter this information. When you log on, you also select a certain client of the SAP system; this field is usually already filled appropriately. Hint: A client usually represents a company in an SAP system. This means that if an SAP system has several clients, then several companies can be represented and simultaneously active in that system. The client has a corresponding key field in the tables of the database used by that SAP system. When working in a client, you only have access to business data from the same client. Clients therefore correspond to independent business entities. When logging on, you can select a logon language supported by that system. SAP systems can support a large number of languages, the minimum being English and one other selected language. The number of installed languages determines which languages your system supports. On the logon screen, you also have the option of using the New password pushbutton to change your password, at the most once per day. Your system administrator can add additional text to your logon screen. To do so, follow the SAP-Hinweis 205487 - Eigener Text auf dem SAPGui Anmeldebild. Note: SAP Notes contain detailed information on certain functions or corrections for known errors in SAP products. You can access SAP Notes through, for example, the SAP Service Marketplace on the Internet, using a valid user (S-user) and password: http://service.sap.com/notes.

2008

© 2008 SAP AG. All rights reserved.

47

Unit 2: Navigation

TAW10_1

In the course of one logon to a system, you can work in several sessions (processing windows of an SAP system) simultaneously. Your system administrator can use a system parameter to define how many sessions are permissible for each logon to the SAP system. For more details please see the SAP-Hinweis 12466 Anmeldebeschränkungen im R/3. The parameter rdisp/max_alt_modes is used for this purpose. Six windows are the default. The parameter cannot be set user-specifically but applies for all users of the system or the logon instance.

Figure 15: The logon screen for an SAP system

User data is stored in the system by client, that is, you can, for instance, log on to client 100 in your system, but you will not have a user for client 200, even if your system has a client 200. The data for a particular user within a client is called the user master record. Multiple logons to SAP systems are logged. This is for reasons of both security and licensing. If the same user logs on more than once, then for each subsequent logon, the system displays a warning message that offers the user the following three options:

48

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Navigation in General

Multiple logons are logged in table USR41_MLD.

• • •

Close all existing session(s) and log on again Keep existing session(s) open, and open an additional session (this is recorded in the log). Terminate this logon

Changing the Password Use the initial password assigned to you when you log on to the system for the first time. During the first login, you are prompted to save a changed password. For security reasons it makes sense to change the password occasionally.

2008

© 2008 SAP AG. All rights reserved.

49

Unit 2: Navigation

43

TAW10_1

Changing the Initial Password 1.

Enter your new password twice, whereby you activate both input fields in sequence by means of mouse-click or tab button. Please note that numerous rules regarding the structure of a password can be set up for your system.

Figure 16: Dialog Box for Changing the Password

2.

50

Finally, choose

to save your new password.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

44

Lesson: Navigation in General

Changing the Changed Password Again Prerequisites Hint: Users can change their password no more than once a day on the initial screen. In contrast, user administrators with authorization for transaction SU01 can change a user’s password as often as they want. Actually, the administrator can only assign new initial passwords.

Procedure 1.

On the logon screen of the SAP system, enter your data and your current password.

2.

On the top left, click the New Password pushbutton.

3.

Change your password as described above and save your data.

Different system parameters with the prefix login/* influence the password response in the SAP system. Parameter login/password_expiration_time, for example, specifies after which number of days the user has to change his password.

Screen Structure You can, for example, use transaction GUIT to demonstrate the different screen elements. On the individual screens of this transaction, examples of input fields, pushbuttons, radio buttons and checkboxes are illustrated. Screen 700 shows frequently used icons in the SAP system. System table ICON contains all icons and their technical names. The behavior of the navigational arrows in transaction GUIT is also instructive: The green arrow (Back) is not active whereas the yellow and red arrows still work. You can also close transaction GUIT by entering command /n. The instructor can also use other transactions to demonstrate the screen elements. Once you have logged on successfully, the initial screen of the SAP system appears; this screen is also known as the SAP Easy Access screen.

2008

© 2008 SAP AG. All rights reserved.

51

Unit 2: Navigation

TAW10_1

The SAP Easy Access screen is the default initial screen in SAP systems. The left side of the screen contains a tree hierarchy of the menus available to you in the SAP system; you can use the right side of the screen to display your company logo. This graphic is made available centrally by your system administrator and cannot be customized by individual users.

Figure 17: SAP Easy Access

You can find a detailed description of how to configure the graphic in SAP Easy Access under Extras → Administration information (if you have the correct authorization). Please note that the graphic is stored in the system and transported to the front end every time a user logs on. Although it is transported in compressed form, the graphic should not exceed 20 KB. You can also prevent the graphic from being displayed by either choosing the setting Low Speed Connection in the SAP Logon program (see SAP-Hinweis 161053 - Benutzung des SAPGUI im WAN), or by using Extras → Settings in the SAP Easy Access screen. A typical screen (with some common elements) appears if you choose System → User Profile→ Own Data and then the Defaults tab page. You will then see this screen with the data for your own user:

52

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Navigation in General

Figure 18: Screen Elements in SAP GUI

An SAP user interface can contain the following simple screen elements, for example: • • • • •

Command field Menu bar, system function bar, title bar, application toolbar, status bar Check boxes Radio buttons Tab

You can start applications directly by entering their transaction code in the command field, which is usually hidden. You can find the transaction code for an application either in the overview menu on the SAP Easy Access screen, in the status bar (see below), or in the application itself under System → Status. The Menu bar is the top line of any dialog window in the SAP system. The menus shown here depend on which application you are in. These menus may also contain cascading menus.

2008

© 2008 SAP AG. All rights reserved.

53

Unit 2: Navigation

TAW10_1

The pushbuttons in the standard toolbar are shown on every SAP screen. If they are not available in an application, pushbuttons that you cannot use on that screen are deactivated. If you place the cursor over a pushbutton for a short time, the system displays a flag with the name or function of the pushbutton. If appropriate, the corresponding function key setting is also displayed. The title bar is the function that you are currently in. The application toolbar shows the pushbuttons available in the application that you are currently in. The Status bar displays information on the current system status, such as warnings and errors. You can also change the display variant to show, for example, the transaction code of the transaction you are currently in. Within a field group check boxes allow to select several options at the same time. With radio buttons you can only select one option. A tab organizes several subscreens to improve clarity. Input fields and pushbuttons are additional screen elements.

Logging off from the System You should log off the system when you have finished your work in the SAP system. You have several options for doing this:

54

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

47

Lesson: Navigation in General

Log off via the Menu Bar 1.

In the menu bar, select System → Log off. in the SAP Easy Access Hint: Alternatively, click the yellow arrow menu or enter the /nend command in the command field. If several sessions are open, the yellow arrow only closes the active window. The dialog field for logging off only appears in the last window. Caution: The /nex command immediately terminates your logon without querying the dialog windows first. All sessions of your terminal session are closed and entries that have not been saved are lost!

2.

A Log off Dialog Box appears and tells you that you will lose data that has not been saved when you log off.

Figure 19: Log off Dialog Box

3.

To log off, choose Yes. Hint: From the perspective of the Windows operating system, an SAP session is a normal application. Hence, you can also close SAP sessions with the means of the operating system, such as by using the key combination Alt+F4. When you close the last window of your session, the dialog box is also displayed.

2008

© 2008 SAP AG. All rights reserved.

55

Unit 2: Navigation

56

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

49

Lesson: Navigation in General

Exercise 2: Logon and Screen Design Exercise Duration: 10 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Use the SAP GUI for Windows to logon to the SAP system and navigate

Business Example You want to work in an SAP system.

System Data System: Client: User ID: as SAPTEC-##) Password: the relevant user. Set up instructions:

The training system assigned to you (such as DEV) The client assigned to you (such as 100) The user name that you have given the participants (such The password that you have given the participants for None

Task: Logging on to the System and Initial Tasks Log on to the training system and carry out some basic exercises in the system. The menu paths refer to the SAP standard menu. Hint: Use the logon data provided by your instructor. 1.

Start the SAP Logon program and create a new entry according to the information given by your instructor. Choose the Logon pushbutton. Enter the client, user name, initial password, and logon language supplied by the instructor. When you log on for the first time, enter a new password of your choice twice in the window that appears.

2008

2.

What is the maximum number of parallel sessions (windows of the SAP system) that you can open using System → Create Session?

3.

What is the name of the function you reach if you choose Tools → Administration → Monitor → System Monitoring → User Overview? What transaction code could you use to call this transaction instead of the menu?

© 2008 SAP AG. All rights reserved.

57

Unit 2: Navigation

TAW10_1

Solution 2: Logon and Screen Design Task: Logging on to the System and Initial Tasks Log on to the training system and carry out some basic exercises in the system. The menu paths refer to the SAP standard menu. Hint: Use the logon data provided by your instructor. 1.

Start the SAP Logon program and create a new entry according to the information given by your instructor. Choose the Logon pushbutton. Enter the client, user name, initial password, and logon language supplied by the instructor. When you log on for the first time, enter a new password of your choice twice in the window that appears. a)

2.

What is the maximum number of parallel sessions (windows of the SAP system) that you can open using System → Create Session? a)

3.

Follow the instructions in the exercise.

This training system should allow you to open up to 6 sessions.

What is the name of the function you reach if you choose Tools → Administration → Monitor → System Monitoring → User Overview? What transaction code could you use to call this transaction instead of the menu? a)

The function is called User List (see the entry in the title bar). You can find the relevant transaction code using System → Status; in this case, the code is SM04. You can also choose to display the transaction code for an active transaction in the status bar. Alternatively, you can permanently display the transaction codes in the SAP Easy Access menu. Choose Menu bar → Extras → Settings and activate the field Display Technical Names. A fourth option would be to display the details by choosing Menu Bar → Extras → Technical details. For this, the corresponding menu entry would first have to be selected with the mouse.

58

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Navigation in General

Lesson Summary You should now be able to: • Log on to the system successfully • List some variants of the SAP GUI • Log off from the system successfully

Related Information •

2008

For more information, see the following online documentation: Help → SAP Library → Introduction to the SAP System.

© 2008 SAP AG. All rights reserved.

59

Unit 2: Navigation

Lesson: 52

TAW10_1

Advanced Navigation in the SAP GUI Lesson Duration: 60 Minutes

Lesson Overview In this lesson you will learn about various ways of calling functions in SAP systems. In addition, different selection options and help functions are introduced. Finally, you will learn about how to work with list outputs.

Lesson Objectives After completing this lesson, you will be able to: • • • •

Use various methods to start SAP system functions Create a list of favorites Use the help functions Describe the standard menus System and Help.

During the course of this lesson, you should explain to the participants the various options for calling functions using either the mouse or the keyboard. Pay particular attention to navigation using transaction codes. There is a simple method for administrators to create their own lists of transaction codes: select the entries required for the list from the table TSTCT and save them in Excel. The easiest way of doing this is to use the function System → List → Save → Local file. You will often be asked how to create transaction code lists: This is the answer. End users do not need to create transaction code lists in this way, since they have their role-based menus at their disposal, which contain the functions required for that role, normally about 10 to 15. The significance of the user menus and the option of switching to the SAP menu are also covered in this lesson.

Business Example You want to know how functions can be started in the SAP system and what help the system provides you with.

User Menu and SAP Menu The SAP Access menu is automatically displayed after logging on; it represents the standard access point to an SAP system for the SAP GUI for Windows. The navigation bar in the left part of the screen contains a clear tree structure, consisting of

60

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

menu entries and favorites’ entries. You can adjust the favorites’ area in particular to your needs. The entries of the SAP menus and the user menus can only be changed by system administrators. SAP and area menus can be processed using SE43. The user menus are bound to authorization roles. The latter are processed using PFCG.

Figure 20: Favorites list and user menu

The end user can switch from the role-based user menu to the SAP standard menu (if the system settings allow this). Hint: System administrators can use table USERS_SSM to determine whether or not users are allowed to switch between the SAP menu and their user menus. If both menus are disallowed, then the user menu is still displayed. The availability of the user or SAP menu does not affect a user’s authorizations. This means that a user can always call authorized functions using a transaction code, independent of the menu structure. The role-based user menu is created on the basis of the role(s) assigned to the user and transferred to the front end. This means that it makes sense to keep roles as small as possible because large roles could take a long time to transfer to the front end in certain circumstances. If a user has several roles assigned, then some functions can be

2008

© 2008 SAP AG. All rights reserved.

61

Unit 2: Navigation

TAW10_1

repeated in different parts of the role-based user menu. If you do not want these to appear twice, see SAP-Hinweis 357693 - Redundanzvermeidung im Easy Access (and the other notes listed therein) for information on identifying and deleting duplicates, and related questions. Hint: As long as you have the appropriate authorization, you can also display user menus other than the ones assigned to you in your user master record. To do this, choose Other menu. Use Create role to start the role maintenance transaction, PFCG. The user and SAP menus can be structured in a pretty complex way. It is then difficult to remember the exact path for the transaction you are looking for. As long as the transaction has not been copied into the favorite area, you can find it more easily with special search transactions. The transactions SEARCH_SAP_MENU and SEARCH_USER_MENU search the corresponding menus for the predefined text pattern. The search result is prepared in a list view from which you can take the navigation path. The transactions found cannot be started directly with a double-click. A further search option for SAP menu entries is the transaction SDMO, which also allows you to search for a text pattern. A (technically out-of-date) dynamic menu is generated, from which the transactions found can be started with a double-click.

Favorites Management In addition to the area menu or SAP menu, the user is also provided with functions in the favorites’ area. Links to frequently used transactions, web links or files can be stored in the favorites’ area. The users’ favorites’ entries are in the system tables SMEN_BUFFC and SMEN_BUFFI. Administrators can access these table to make changes and thereby change or delete the favorites of large user groups. The favorites list thus contains references to SAP system functions or links to internet content or to files on the end user’s front-end computer. The favorites list, which is initially empty, can be edited by each end user in accordance with his or her preferences; you can only view your own favorites list. Since data on the favorites is stored within the SAP system, each user might have different collections of favorites in different systems.

62

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

Possible instructor demo: Demonstrate the download of your own favorites menu. Save the data, for example, under C:\temp\fav.txt on your front-end PC. After that, delete the complete favorites list. Now upload the favorites from the file you have just saved into the system again.

Hint: Complete favorites menus, incl. the folder structures, can be easily copied by uploading or downloading from one SAP system to another. The downloaded favorites menus are stored temporarily on the front-end PC.

The upload and download of favorites requires the corresponding authorizations for the authorization object S_GUI. It could be that the user does not have authorization in the productive customer system to upload. To improve the structuring, sort the favorites in own folders. You can edit favorites in the SAP Easy Access screen using the menu entry Favorites. The Favorites menu gives you the option of adding a function from the user (or SAP) menu to your personal favorites list by selecting the function and choosing Favorites → Add. Here, the menu path is also written with the text of the favorites entry to a limited extent. If you have highlighted a menu entry using the mouse, you can copy the selected node in the favorites’ area by right-hand mouse click. Alternatively, you can also drag the elements from the menu area using the mouse and store them in the favorites’ area (Drag&Drop). You can add URLs or links to files to your list of favorites by choosing Favorites → Add other objects. Click on the triangle symbol to the left of the file symbol to expand or collapse the list of favorites. Hint: To change the name of a transaction in Favorites, highlight the corresponding favorites entry and select the menu path Favorites → Change. You can change and save the text in the dialog box that opens. You can delete favorites’ entries that you no longer need. In doing so, the link to the corresponding function is deleted from your favorites’ list. If you want to delete the entire Favorites menu, highlight the entry Favorites and right-click to call up the available context menu. Choose Delete all favorites.

2008

© 2008 SAP AG. All rights reserved.

63

Unit 2: Navigation

TAW10_1

Calling Up Functions You have several options for navigating in an SAP system: • • •

Entering transaction codes in the OK Code field By choosing items from menus in the menu bar By choosing items from the favorites list or from the user or SAP menus

Figure 21: Various navigation options

You can reach the menus in the menu bar by simply using the key combination Alt+ (# corresponds to the underlined letter of the selected menu item) or Alt and cursor navigation using the arrow keys on the keyboard. You can use the keyboard to get to the SAP Easy Access screen or the OK Code field and call system functions from there. Hint: Use the following keys to navigate using the keyboard: • • •

TAB moves from one field element to the next within a field group. Ctrl + TAB goes from one field group to the first element of the next field group. Ctrl + / goes directly to the OK Code field.

You can find further shortcuts using Customizing of local layout (Alt+F12)→ SAP GUI Help.

64

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

When the OK Code field is active (also known as command field), you can use the F1 key to display possible entries for this important field. The following entries are possible: • • • • • • •

/n to cancel the current transaction /nXXXX to call transaction XXXX directly from another transaction. Without the prefix you can only call XXXX from the SAP Easy Access screen. /o to display an overview of sessions /oXXXX to call transaction XXXX in a new session directly from another transaction /nend to end the logon session with a confirmation dialog box /nex to end the logon session without a confirmation dialog box /i to delete the session you are currently using Note: The OK Code field is an exception in that choosing the F4 key does not display the input help. The F4 key in the OK Code field lists the last 15 different entries in the OK Code field. This list is stored in the registry on the front end and is valid for all sessions on the front end (regardless of the system used).

Help Options The SAP system provides you with various help options, which will be introduced in the following section.

F1 Help You can use the F1 key to display an explanation of fields, menus, functions and messages. The F1 help also displays technical information on the relevant field. There you will find the parameter ID that you can use when setting user-specific default values for input fields that are also linked to the parameter ID. You can also display interesting information by, for example, calling the F1 help for the OK Code field.

2008

© 2008 SAP AG. All rights reserved.

65

Unit 2: Navigation

TAW10_1

Figure 22: The F1 help

You can also use other buttons in the Performance Assistant dialog box to display information on the selected field. One of the most important pieces of information, besides the link to the context-sensitive Application Help, is the link to the Technical Information. Choose this to display detailed information, such as the parameter ID assigned to the field. You can use parameters to set defaults for frequently used input fields; to do this, the parameters are stored with the desired values in the user master record. Note: You may need to activate the Performance Assistant first using the menu Help → Settings → F1 Help.

F4 Help You can choose F4 to display possible input values. You can also call up the F4 help for a field using the button immediately to the right of the selected field. If a field contains a checkmark symbol, you can only proceed to the next step in that application after entering a permitted value (required entry). You can use transaction or screen variants, or Customizing to mark fields as mandatory or optional, hidden or filled with hidden standard values.

66

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

Figure 23: The F4 help

The F4 help displays a list of possible entries for a field. If there are a large number of possible entries, a separate selection screen is displayed. If there is a long hit list, the F4 help only displays as many entries as the user has specified on the F4 Help tab page under Help → Settings. The default value for the maximum number of displayed hits is 500. Take the time to familiarize yourself with the other settings you can make here. Hint: Users can also create personal values lists. An S&D employee who is only responsible for Munich, for example, only wants to see the Munich clients and defines a corresponding personal value list. However, despite this, the employee still has the option at all times of switching to the total view of all customers or of updating or completely deleting the values list.

Demonstrate how you create a personal list of values using SU3 as an example for the possible entries of the logon language, Fixed values tab page. Enter DE and EN in your personal values list. Demonstrate the effect when you call up the possible entries again after creating the personal list.

SAP Library (Online Documentation) The SAP Library is a useful aid to getting to know system functions. It allows you to access the online documentation. The information stored here does not simply describe how to use system functions, it also explains system architecture concepts,

2008

© 2008 SAP AG. All rights reserved.

67

Unit 2: Navigation

TAW10_1

gives examples of how you can configure various processes, and warns you about possible user errors and their consequences. The online documentation also contains several tips and tricks to help you carry out common tasks more easily and quickly.

Figure 24: The SAP Library

Hint: You can also access the SAP Library on the Internet. Call the address http://help.sap.com. You can access the full product documentation for all releases here; a user-friendly full-text search by solution is also available.

The System and Help Menus The System and Help menus are always available with the same options on every screen in an SAP system. The System menu allows you to access various system functions. This menu also contains functions that you can only access using this menu (and not in any other way). You can log off using System → Log off, and display useful information on your system and the function you are currently using, such as the transaction code, by choosing System → Status.

68

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

Figure 25: The System and Help menus

You can use the Help menu to access the system documentation. You can also display the Release Notes and configure the standard settings for your F4 Help. However, you will mostly use the Help menu to navigate to the specific section of the documentation relevant for your current work in the current context. The context-sensitive help is also called Application Help. The tool for accessing the documentation as a whole is the SAP Library.

2008

© 2008 SAP AG. All rights reserved.

69

Unit 2: Navigation

70

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

61

Lesson: Advanced Navigation in the SAP GUI

Exercise 3: Calling Functions Exercise Duration: 30 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Familiarize yourself with various ways of calling functions and navigating in the system

Business Example You want to call functions.

System Data System: Client: User ID: Password: the relevant user. Set up instructions:

The training system assigned to you (such as DEV) The client assigned to you (such as 100) The user name you have been given (such as SAPTEC-##) The password that you have given the participants for None

Task 1: Various Ways of Calling Up the User Overview Who is currently logged on to the training system? 1.

Call the transaction for displaying a list of users who are logged on. Select from the SAP standard menu Tools → Administration → Monitor → System Monitoring → User Overview.

2.

Quit the user overview by using either the F3 key or the Back button in the standard toolbar. Now enter sm04 in the command field on the SAP Easy Access screen. This takes you directly to the user overview.

Task 2: Optional: Creating a Favorites Menu Save often-used transactions in a favorites menu. 1.

Expand the SAP menu to the user overview: Tools → Administration → Monitor → System Monitoring → User Overview. Highlight the transaction entry with the mouse.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

71

Unit 2: Navigation

TAW10_1

Then select Favorites → Addin the menu bar. The transaction is saved in the favorites’ area. 2.

Add the following transactions to the Favorites menu without expanding the SAP menu first: RSPFPAR, SEARCH_SAP_MENU, SEARCH_USER_MENU

3.

Can you distinguish between favorites’ entries by the method used to insert them?

4.

Create a folder with the title Search Options in which you can store both search transactions.

5.

Find out how often and where in the SAP menu the transaction for the user overview is stored. Transaction

Path in the SAP menu

SM04 SM04 SM04

Task 3: Optional: Using F1 and F4 Help Use the technical information of the F1 help. 1.

72

Find out in which table of your SAP system the transaction codes are stored. To do so, use the dialog input field for entering a start transaction, here: SAP Easy Access Extras → Set start transaction.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

Solution 3: Calling Functions Task 1: Various Ways of Calling Up the User Overview Who is currently logged on to the training system? 1.

Call the transaction for displaying a list of users who are logged on. Select from the SAP standard menu Tools → Administration → Monitor → System Monitoring → User Overview. a)

2.

For the solution, see the question.

Quit the user overview by using either the F3 key or the Back button in the standard toolbar. Now enter sm04 in the command field on the SAP Easy Access screen. This takes you directly to the user overview. a)

For the solution, see the question.

Task 2: Optional: Creating a Favorites Menu Save often-used transactions in a favorites menu. 1.

Expand the SAP menu to the user overview: Tools → Administration → Monitor → System Monitoring → User Overview. Highlight the transaction entry with the mouse. Then select Favorites → Addin the menu bar. The transaction is saved in the favorites’ area. a)

See exercise text. Hint: Alternatively, you can use Drag&Drop or the context menu to copy transactions into the favorites’ area. The context menu is opened by a right-hand mouse click.

2.

Add the following transactions to the Favorites menu without expanding the SAP menu first: RSPFPAR, SEARCH_SAP_MENU, SEARCH_USER_MENU a)

Then select Favorites → Insert transactionin the menu bar. Enter the desired transaction in the dialog box and save the data. This process must be executed for every transaction individually.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

73

Unit 2: Navigation

TAW10_1

3.

Can you distinguish between favorites’ entries by the method used to insert them? a)

4.

Create a folder with the title Search Options in which you can store both search transactions. a)

5.

Yes, when inserting with previous selection in the menu, a part of the path information of the menu access is stored as a favorites text.

Choose Favorites → Insert file. Name the file Search Options. Then, drag both search transactions (SEARCH_SAP_MENU, SEARCH_USER_MENU) into the file using the mouse.

Find out how often and where in the SAP menu the transaction for the user overview is stored. Transaction

Path in the SAP menu

SM04 SM04 SM04 a)

Start the search transaction SEARCH_SAP_MENU. In the dialog box, enter SM04 and start the search. Transaction SM04 is stored a total of three times in the SAP menu. In the same way, you can now search in the user menu. Transaction

Path in the SAP menu

SM04

Tools → Administration → Monitor → System Monitoring → User Overview

SM04

Tools → Administration → Monitor → Performance → Exceptions/User → Active User → Local User

SM04

Tools → CCMS → Control/Monitoring → Performance → Exceptions/User → Active User → Local User

Continued on next page

74

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Advanced Navigation in the SAP GUI

Task 3: Optional: Using F1 and F4 Help Use the technical information of the F1 help. 1.

Find out in which table of your SAP system the transaction codes are stored. To do so, use the dialog input field for entering a start transaction, here: SAP Easy Access Extras → Set start transaction. a)

2008

You can get this information by calling up the F1 help in the dialog box to enter the start transaction. Then branch to the technical information. The table is called TSTC.

© 2008 SAP AG. All rights reserved.

75

Unit 2: Navigation

TAW10_1

Lesson Summary You should now be able to: • Use various methods to start SAP system functions • Create a list of favorites • Use the help functions • Describe the standard menus System and Help.

Related Information •

76

Documentation: You can find extended help for SAP Easy Access under Help → Application help.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Unit Summary

Unit Summary You should now be able to: • Log on to the system successfully • List some variants of the SAP GUI • Log off from the system successfully • Use various methods to start SAP system functions • Create a list of favorites • Use the help functions • Describe the standard menus System and Help.

2008

© 2008 SAP AG. All rights reserved.

77

Unit Summary

78

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

69

Test Your Knowledge

Test Your Knowledge 1.

You can only work in one window (session) at a time in an SAP system. Determine whether this statement is true or false.

□ □ 2.

True False

Which of the following statements accurately describe a client in an SAP system? Choose the correct answer(s).

□ □ □ □ 3.

A B C D

A client represents a completely independent business entity. A client has its own database. A client corresponds to a customer. A client may represent an entire company.

The following strings are valid entries in the command field: Choose the correct answer(s).

□ □ □ □ □ □

2008

A B C D E F

/nend /nex ?SM04 /nsm04 From SAP Easy Access: SM04 From SAP Easy Access: search_sap_menu

© 2008 SAP AG. All rights reserved.

79

Test Your Knowledge

70

TAW10_1

Answers 1.

You can only work in one window (session) at a time in an SAP system. Answer: False Within one logon, it is possible to work in several windows (sessions) in parallel.

2.

Which of the following statements accurately describe a client in an SAP system? Answer: A, D The data for all clients in an SAP system is stored within a single common database. This data is nevertheless divided by client so that different companies can be administered and controlled in different clients. A client is “not” a customer within an SAP system.

3.

The following strings are valid entries in the command field: Answer: A, B, D, E, F You can enter valid transaction codes directly on the SAP Easy Access screen. If you are in another function, you need to enter /n in front of the transaction code. /nend and /nex are two different logoff options. ?SM04 is not a valid entry. search_sap_menu is a valid entry; it creates a search screen for entries in the SAP menu.

80

© 2008 SAP AG. All rights reserved.

2008

Unit 3 The System Kernel

71

This is a pivotal unit in this course. It explains the most important terms for SAP NetWeaver AS ABAP and AS Java. The process types of the SAP NetWeaver Application Server are discussed and important concepts are explained. Participants need the information in this unit if they are to understand the content of more advanced courses. You should therefore make sure that you plan enough time for this unit. The lesson for AS ABAP is more detailed than the lesson for AS Java since most SAP business applications are programmed in ABAP and are thus processed on the AS ABAP. AS Java is usually used for executing the user interfaces. Nonetheless, it is possible to program business applications for AS Java, of course.

Unit Overview This unit provides a detailed insight into how the SAP system processes user requests. You will learn about the different process types of the SAP NetWeaver Application Server and how they work.

Unit Objectives After completing this unit, you will be able to: • • • • • •

Outline simple client/server configurations Name the processes of the SAP NetWeaver Application Server Define the term instance and recognize the characteristics of a central instance Understand how AS ABAP works List the AS ABAP processes and describe their purpose Describe how requests to AS ABAP are processed

Unit Contents Lesson: Principal Architecture of the SAP NetWeaver Application Server... 82 Lesson: AS ABAP processes ..................................................... 103

2008

© 2008 SAP AG. All rights reserved.

81

Unit 3: The System Kernel

Lesson: 72

TAW10_1

Principal Architecture of the SAP NetWeaver Application Server Lesson Duration: 60 Minutes

Lesson Overview This lesson introduces the principal architecture of SAP systems. Based on simple client/server configurations, the individual processes of the SAP NetWeaver Application Server are introduced and the term instance is defined. We will also explain the architecture of the different types of SAP NetWeaver Application Server.

Lesson Objectives After completing this lesson, you will be able to: • • •

Outline simple client/server configurations Name the processes of the SAP NetWeaver Application Server Define the term instance and recognize the characteristics of a central instance

The lesson is intended as an introduction to the processes on an SAP NetWeaver Application Server (AS). To illustrate the processes, the instructor of this lesson can configure an SAP system with ready made stickers on the pin board together with the participants (see http://service.sap.com/curr-adm, file SAP Stickers 700). First you could, for example, set up a three-tier client/server architecture with several instances on different hosts. You can then assign an ABAP dispatcher to each instance. Then you can give an overview of all the work process types and the services with the tasks they perform. You could let the participants decide which processes to configure on which instance. Once you have completed the configuration on the pin board, you can discuss the configuration that the participants have chosen (for example, taking downtime prevention into account), demonstrating the advantages of configuring a central instance (if the participants have not already configured the system in this way). This scenario can then be transferred to the AS Java and the central service instance can be explained.

Business Example In the course of implementing an SAP system, you need to establish the architecture of SAP systems and how you are going to distribute the required SAP system processes among the available hardware.

82

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

Introduction SAP systems are used for mapping business processes or business applications. These applications should be implemented independent of the hardware environment used (operating system, database) to the greatest extent possible. To do so, SAP NetWeaver provides two different runtime environments: an ABAP runtime environment (usage type AS ABAP) and a Java runtime environment (usage type AS Java). ABAP (Advanced Business Application Programming) is a programming language developed by SAP. Many business applications of an SAP system are written in ABAP. ABAP has been optimized for developing highly-scalable business applications. Customers can use the ABAP Workbench for developing completely new applications as well as enhancing and modifying SAP standard applications. In doing so, the entire, mighty infrastructure of the AS ABAP can be used, which also supports the creation of the most complex applications by large groups of developers. The Application Server ABAP provides the runtime environment for programs written in ABAP. SAP not only provides a runtime environment for ABAP programs but also a runtime environment for Java programs. AS Java is an application server according to the Java 2 Enterprise Edition (J2EE) standard. The Java programming language was first introduced by Sun Microsystems Inc.™ in 1995. Java is an object-oriented and platform-independent programming language that has spread across many areas. The Java concept enables the development of a large range of different application types - from classical applications to applets used in websites to client/server applications. Java 2 Platform Enterprise Edition (J2EE) is a vendor standard for a whole range of software components that are primarily created in the Java programming language. Sun uses the J2EE compatibility test to ensure that the specifications of Java 2 Enterprise Edition are observed. The purpose of this specification is to provide a generally accepted framework for using modular components to develop distributed, multi-level applications. With the J2EE specification, Sun wants to ensure that conform Web applications run on all J2EE compatible servers. According to the J2EE specification the application logic is packaged in Enterprise JavaBeans (EJB). They represent Java program components. A container implicitly provides the components with the services of the runtime environment. AS Java 7.0 (and also 6.40) is J2EE 1.3 compliant. Based on the specification, the actual Java application server is often called J2EE Engine. With release 7.1 the AS Java will also be Java 5 EE compliant.

2008

© 2008 SAP AG. All rights reserved.

83

Unit 3: The System Kernel

TAW10_1

Client and Server: Terminology Definition The participants need to be able to differentiate between hardware-oriented and software-oriented views. To ensure that the participants have completely understood this section, you could, at the end, ask if the sentence “Several application servers can run on one application server” makes sense, and what exactly it means. Before we discuss various client/server configurations in the context of SAP systems, we first need to define the concepts client and server. There are basically two ways of doing this. In the hardware-oriented view, the term server means the central server in a network that provides data, memory, and resources for the workstations (clients). In the software-oriented view, client and server are both defined at the process level (service). A service in this context is a service provided by a software component. This software component can consist of a process or a group of processes (such as a SAP Web Application Server) and is then called a server for that service. Software components that use a service are called clients. At the same time, clients can also be servers for other specific services. The following graphic clarifies the two approaches to the definitions.

Figure 26: Hardware-Oriented View and Software-Oriented View

84

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

In the context of SAP systems, the terms client and server are generally used as defined in the software-oriented view.

Client/Server Configuration for SAP Systems The participants should learn about the different configuration option and, in particular, recognize the significance of a special hardware layer for application server processes (scalability, logon load balancing). The following processes are often used for operating business application software: • • •

Presentation processes (for example, for displaying screens) Application processes (for example, for executing application programs) Database processes (for example, for managing and organizing database data)

When you are installing and configuring an SAP system, you need to decide how you are going to distribute the required processes among the available hardware. There are various ways of doing this, some of which are described in more detail below. Configurations are either single-tier or multi-tier, depending on the number of hardware layers used (see the following graphic). The SAP ECC system is an example of business application software. •

• •

2008

In single-tier configurations, all processing tasks (database, application and presentation processes) are performed by one computer. This is classic mainframe processing. Two-tier configurations are usually implemented using special presentation servers that are responsible solely for formatting the graphical interface. In a three-tier configuration, each layer runs on its own host. Many different application servers can simultaneously work with the data of a database server.

© 2008 SAP AG. All rights reserved.

85

Unit 3: The System Kernel

TAW10_1

Figure 27: Simple Client/Server Configurations

Single-tier configurations are generally used for tests and demonstrations (for example, an SAP system on a laptop). If many users want to work on a system configured in this way, then the extra hardware costs for each additional user become greater than the costs associated with implementing additional hardware levels (for example, moving the presentation processes to other hosts). The two-tier configuration with distributed presentation processes (as shown in the previous graphic) can maintain good performance for a significantly higher number of users, without substantially increasing the hardware costs. The load resulting from the presentation processes is distributed to the various front-end computers and so does not influence the performance of the database host. However, if the number of users exceeds a certain upper limit, the central host, on which both application and database processes run, risks becoming a bottleneck. To prevent this, you can improve the performance of the SAP system by distributing the application-layer processes to several hosts. Another advantage of adding a hardware layer specifically for application processes is that it facilitates scalability. If the number of SAP users in a system increases over time, negatively affecting system performance, then this problem can, in most cases, be solved simply by adding another host for application processes. An alternative two-tier configuration is to install powerful desktop systems and to use these for presentation and applications (two-tier client/server). These configurations are especially suited to applications with high processor demands (for

86

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

example, simulations or for software developers), but are not implemented in the SAP environment, other than for test purposes, due to the additional administration required. In the SAP Business Suite environment, more complex client/server configurations consisting of more than three tiers are both theoretically possible and used in practice. An additional level could be a web server, for example. At this point you could show the participants which configuration is used for the course (normally a two-tier configuration with distributed presentation). To do this, use transaction SM51 followed by the menu path System → Status, and the message that the SAP GUI process is running locally on the front-end, for example. You can start placing stickers on the pin board at this point. Pin on the three architectural levels and the required hardware (e.g. 3 PCs at presentation level, 2 hosts at application level and 1 host at database level).

The Instance The section starts with the definition of the term instance for the SAP NetWeaver AS. Clearly explain terms central instance and central services instance as well.

An instance is an administrative unit that combines SAP system components providing one or more services. The services provided by an instance are started or stopped together. You use a common instance profile to set parameters of all the components of an instance. Each instance has its own buffer areas. An instance runs on one physical computer, but there can be multiple instances on one computer. An instance is identified by the system ID (SID) and the instance number. Hint: The terms (SAP) instance and Application Server are often used synonymously.

2008

© 2008 SAP AG. All rights reserved.

87

Unit 3: The System Kernel

TAW10_1

Figure 28: Instances of an SAP System (Example)

When you install an SAP system, you already have the option of separating the processes at application level from those at database level. This means that the database for an SAP system can be installed and operated on a separate physical computer, separated from the instances of the SAP system. There is exactly one database for each SAP system. The database usually has the same system ID (DB ID) as the SAP system. The central instance of the SAP system is distinguished by the fact that it offers services that no other instance of the system offers. For the AS ABAP, these are the Message Server and the Enqueue work process (see below). For the AS Java you can recognize the central instance by the Software Deployment Manager (SDM). The central services instance provides central services of the AS Java, the Message Service and the Enqueue Service (see below). For the AS ABAP, these services can also be moved to the ABAP central services instance for high availability reasons. These AS ABAP systems therefore no longer have a central instance. All other instances of the system are typically called dialog instances. If the central instance and the database (and for the AS Java also the central services instance) are installed on the same computer, this is referred to as a central system.

88

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

Processes of the SAP NetWeaver Application Server The SAP runtime system consists of a large number of parallel processes that work together. Here, you can distinguish between the runtime environment for ABAP (AS ABAP) and the runtime environment for Java (AS Java) .

AS ABAP Processes

Figure 29: AS ABAP Processes

2008

© 2008 SAP AG. All rights reserved.

89

Unit 3: The System Kernel

TAW10_1

In the AS ABAP, these processes on every application server include the dispatcher as well as a number of work processes depending on the hardware resources: • •



The dispatcher distributes the requests to the work processes. Dialog work processes fulfill all requests for the execution of dialog steps triggered by an active user. Every dispatcher requires at least two dialog work processes. Spool work processes pass sequential data flows on to printers. At least one spool work process is required for each SAP system. It is possible to configure more than one spool work process for each dispatcher. This spool work process is also required if there is no printing in the system, for example, to store lists generated in the context of background process in TemSe.





Update work processes execute update requests. Similarly to spool work processes, you need at least one update work process per SAP system, and you can configure more than one per dispatcher. Background work processes execute programs that run without interacting with the user. You need at least two background work processes for each SAP system. You can configure more than one background work process for each dispatcher. For the “normal” operation of the SAP system, a single background process would suffice. However, for an upgrade or during an import of ABAP transport requests, two background work processes are required.



The enqueue work process administers the lock table in the shared memory. The lock table contains the logical database locks of the ABAP runtime environment of the SAP system. Only one enqueue work process is needed for each system. If more than one enqueue work process has to be configured, this must be configured on the same instance as the first enqueue work process as both work processes have to access the same lock table.

Hint: The Internet Graphics Server (IGS) is missing in this graphic. If there are any questions about this or you with to mention the IGS, here’s some information on the IGS:

90

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

The Internet Graphics Server (IGS) is an infrastructure that application developers can use to display graphics in an internet browser with minimal effort. The IGS is integrated into the different SAP UI technologies from HTML GUI to Web Dynpro ABAP/Java and offers a server architecture where data from an SAP system or another source can be used for generating graphical and non-graphical output. With SAP Web AS 6.40, the IGS is available as a fixed component of SAP Web AS and will be installed with every SAP Web AS installation (both for systems based on AS ABAP and for systems based on AS Java). With SAP Web AS 6.20 there already is a standalone engine on Windows 32 bit computers, you can thus choose between the standalone and the integrated IGS for SAP Web AS 6.40. From SAP NetWeaver AS 7.00 however, only the integrated IGS version should be used. The IGS basically consists of 3 parts: • • •

Multiplexer (Mux), which administers incoming/outbound connections and distributes the enquiries to the appropriate port watchers. Port watchers, which connect to the Mux via TCP/IP and are the host application for the IGS interpreter Interpreters, the plug-ins for the IGS, which take care of the generation of graphics and content. There are several interpreters available for different types of graphics and content

You can use the following tools to administer the IGS: • •

For AS ABAP ABAP: Report GRAPHICS_IGS_ADMIN or transaction SIGS, where the report was encapsulated. For AS Java: Web interface access using the URL http://(hostname):(port), whereby the Host Name is the name of the computer on which the IGS is installed and the Port is the port of the HTTP listener.

If you want to demonstrate the IGS in the SAPTEC course, the easiest thing to do is to call up transaction SIGS (or report GRAPHICS_IGS_ADMIN). On the start page, confirm the suggested RFC destination. This takes you to the initial page for the IGS. SAP Note 454042 provides a more detailed description of the IGS. To summarize, you can say that the dispatcher of an AS ABAP instance manages different types of work processes: dialog, update, background, enqueue and spool work processes. These work processes take on different tasks when executing the business procedures in the SAP system.

2008

© 2008 SAP AG. All rights reserved.

91

Unit 3: The System Kernel

TAW10_1

The administrator of an SAP system can use profile parameters to configure the number of different work processes.

Hint: The type and number of the work processes to be started for each instance is configured using the SAP system profile parameter. The following table summarizes the relevant profile parameters. Type

Use

profile parameter

DIA

Responsible for dialog requests

rdisp/wp_no_dia

UPD

Responsible for update

rdisp/wp_no_vb

UPD2

Exclusively responsible for less time-critical update (optional)

rdisp/wp_no_vb2

BGD

Executes background jobs

rdisp/wp_no_btc

SPO

Processes output requests

rdisp/wp_no_spo

ENQ

Responsible for locks

rdisp/wp_no_enq

This is only a selection of relevant dispatcher parameters. For lock mechanisms, for example, there are dedicated enque/* parameters. SAP Note 39412 contains additional information on the topic of how many ABAP work processes you can and should configure. In addition to the work processes, the ABAP runtime system provides additional services (these are not work processes) for internal and external communication: •





92

The Message Server (MS) handles communication between the distributed dispatchers within the AS ABAP, thereby enabling scalability of several parallel application servers. The message server is configured only once per SAP system. The gateway reader (GW) enables communication between SAP systems, or between SAP systems and external application systems. There is one per dispatcher. The Internet Communication Manager (ICM) enables the communication with the SAP system using web protocols such as HTTP. The ICM receives requests from the client and forwards them to the SAP system for processing. In an ABAP+Java system (see below), it recognizes whether the request is a call for the AS ABAP or the AS Java and forwards the request accordingly. It can also direct HTTP requests from an SAP system to a Web server and send the response back to the SAP system. You can configure a maximum of one ICM process per application server (software-based view).

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

AS Java Processes

Figure 30: AS Java Processes

2008

© 2008 SAP AG. All rights reserved.

93

Unit 3: The System Kernel

TAW10_1

The following processes exist in AS Java: • •

The dispatcher distributes incoming requests to the server processes. The server process executes the Java applications. Every server process is multi-threaded and can thus process a large number of requests in parallel (in contrast to the ABAP work processes). For each dispatcher there is at least one server processes and there can be up to 16 server processes. It is for this reason that generally there are a lot less Java server processes configured per Java dispatcher than work processes are configured for each ABAP dispatcher. Due to port reasons a maximum of 16 Java server processes can be configured for each instance.





The Java message service manages a list of Java dispatchers and server processes. It is responsible for the communication within the Java runtime environment. The Java enqueue service manages logical locks that are set by the executed Java application program in a server process. Just like in the ABAP environment, every developer is responsible for requesting locks from the enqueue service and releasing them in the Java environment.



The Software Deployment Manager (SDM) is the standard tool used to install Java software components on the SAP Web AS Java.

Types of SAP NetWeaver AS Depending on the application or product used, different types of application server are installed.

94

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

Figure 31: Possible Types of SAP NetWeaver AS

Quickly point out the different installation options of the SAP NetWeaver AS. Stress that the option chosen generally depends on the SAP system to be installed. If you install an SAP NetWeaver Portal, an AS Java is installed, whereas an AS ABAP+Java is installed if you install an SAP NetWeaver PI. In the installation of an SAP NetWeaver BI, in contrast, an AS ABAP-based BI system and a separate AS Java-based BI Java system are installed. The graphic only shows the minimal installation (that is, the central instance). • • •

2008

AS ABAP system: Complete infrastructure in which ABAP-based applications can be developed and used. AS Java system: Complete infrastructure for developing and using J2EE-based applications. AS ABAP+Java system:Complete infrastructure in which ABAP-based and J2EE-based applications can be developed and used. Such a system should only be installed if explicitly required by the application. For example, SAP NetWeaver PI 7.0 or SAP Solution Manager 4.0

© 2008 SAP AG. All rights reserved.

95

Unit 3: The System Kernel

TAW10_1

One of the main characteristics of the SAP NetWeaver AS is that ABAP tables, programs and application data is stored in the ABAP schema of the database while Java data is stored in the Java schema. Here, the ABAP runtime environment can access the ABAP schema of the database, and the Java runtime environment can access the Java schema. In the ABAP+Java system, the different runtime environments communicate directly via the SAP Java Connector (JCo).

AS ABAP Architecture In AS ABAP, the central instance is distinguished by the fact that the message server and the enqueue work process run there. All other instances of the system are usually called dialog instances. Alternatively, the instances are also named after the services provided. The services that an application server can provide are determined by the type of work processes it has. An application server can then take on several roles, for example, as a dialog server and simultaneously as an update server, if it provides several dialog work processes and at least one update work process. Note: An overview of the AS ABAP instances is available in SM51 (in SAP Easy Access under Tools → Administration → Monitor → System Monitoring→ Servers. You can use the transaction SM50 to display an overview of the work processes on the instance that you are logged on to; you can also display this overview by choosing Tools → Administration → Monitor → System Monitoring → Process Overview on the SAP Easy Access screen.

Figure 32: AS ABAP Architecture

96

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

At this point, you can show participants transaction SM51 in the system and briefly mention the instances and services that are available there. If you wish, you can also point out the option of branching from SM51 to SM04 (user overview) and SM50 (process overview). You can see to which instance you are logged on under System → Status. If you explain the work process distribution in SM50, it is useful to point out that there is a V2 type update work process (UP2). Additional information on this follows in the introduction of the individual processes. The ABAP message server provides the AS ABAP with a central message service for internal communication (for example, for starting updates, requesting and removing locks, triggering background requests). The message server also provides information on which instances of the system are currently available. The ABAP dispatchers of the individual application servers communicate via the ABAP message server, which is installed exactly once per SAP system. When you log on to the AS ABAP using the SAP GUI for Windows or the SAP GUI for Java using logon groups, the message server performs a load distribution of users to the available instances. This load distribution, which takes place during the logon procedure, is also known as logon load balancing. After the load distribution by the message server, the SAP GUI communicates directly with the dispatcher. The user remains logged on to this instance until he logs off again. Note: An overview of users who are logged on the the instance to which you are also logged on, is available using transaction SM04 (Tools→ Administration → Monitor → System Monitoring→ User Overview). You can see to which instance you are logged on under System → Status. If you are accessing the AB ABAP via web protocols such as HTTP using the browser, the Internet Communication Manager (ICM) receives the request. This forwards the request to the dispatcher of its instance. Communication from other SAP systems via Remote Function Call (RFC) is accepted by the Gateway Reader (GW).

2008

© 2008 SAP AG. All rights reserved.

97

Unit 3: The System Kernel

TAW10_1

AS Java Architecture In AS Java, the central instance is distinguished by the fact that the Software Deployment Manager (SDM) runs there. The central services Message Service (MS) and Enqueue Service (ES) run in the central services instance (CS instance). All other instances of the system are usually called dialog instances. Note: The entirety of the Java environment (all processes and the database scheme) is also referred to a Java cluster, and the individual processes (dispatcher and server) as nodes of the Java cluster. You can get an overview of started Java processes (Java dispatcher and Java server processes as well as SDM) via the system information of the Java runtime environment ((http://:/sap/monitoring/SystemInfo, for example http://twdf1234.wdf.sap.corp:50000 → System Information) You can show the participants the AS Java system information. You require an appropriately authorized user in the Java stack to display the system information.

Figure 33: AS Java Architecture

98

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

Analogous to the AS ABAP, the message service of the AS Java provides a central message service for internal communication. The Java message service also provides the information which instances and nodes of the AS Java are available. Each node of the Java cluster can communicate directly with the message service. In the AS Java, the enqueue service holds logical locks. Each node of the Java cluster can communicate directly with the enqueue service. When the AS Java is accessed using a browser, the Java dispatcher receives requests, which are then processed by the server processes.

AS ABAP+Java Architecture For the AS ABAP+Java (meaning ABAP and Java processes in the same SAP system, under the same system ID), the same architectural principles apply as for separate AS ABAP and AS Java systems. However, there are some particularities because both runtime environments are integrated with each other in this case. Note: The AS ABAP+Java is often called “add-in installation” because it is possible to install an AS ABAP first and then supplement it with the AS Java at a later point in time.

Figure 34: AS ABAP+Java Architecture

2008

© 2008 SAP AG. All rights reserved.

99

Unit 3: The System Kernel

TAW10_1

The central instance of an AS ABAP+Java system can be recognized by the following processes: ABAP-MS, enqueue work process and SDM. The central services of the Java runtime environment (Java-MS, Java-ES) are also provided in the Java central services instance here. All other instances are usually called dialog instances. Since both runtime environments are capable of answering requests via web protocols, the Internet Communication Manager must now decide whether the request is addressed to the ABAP or the Java runtime environment. It decides this by means of the URL of the request. In case of a request to the ABAP runtime environment, for example, the call of an ABAP web dynpro, the ICM forwards the request to the ABAP dispatcher and the work processes respond to the request. If the request is a request for the Java runtime environment, for example, the call of a Java Server Page (JSP), the ICM forwards the request to the Java dispatcher and one of the server processes responds to the request. In an AS ABAP+Java system, data is also kept in separate database schemas (but in the same database installation). That is, work processes can only access ABAP data and server processes can only access Java data. In the data exchange, both runtime environments then communicate using the SAP Java Connector (JCo). This communication is necessary, for example, if billing data that is stored in the ABAP data schema is supposed to be displayed in a Java user interface. The SAP JCo is integrated into the AS Java and is also used when an AS Java system has to communicate with a remote AS ABAP system. The SAP JCo provides the SAP RFC protocol for the Java environment. The JCo is also available in a separate installation, for example, to connect non-SAP products in Java with SAP ABAP systems.

Another special feature of the AS ABAP+Java is the joint user storage. In this case, the User Management Engine (AS Java) uses the users from AS-ABAP.

100

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Principal Architecture of the SAP NetWeaver Application Server

Facilitated Discussion

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions.

2008

© 2008 SAP AG. All rights reserved.

101

Unit 3: The System Kernel

TAW10_1

Lesson Summary You should now be able to: • Outline simple client/server configurations • Name the processes of the SAP NetWeaver Application Server • Define the term instance and recognize the characteristics of a central instance

102

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 89

Lesson: AS ABAP processes

AS ABAP processes Lesson Duration: 80 Minutes

Lesson Overview This lesson discusses how the SAP NetWeaver Application Server ABAP (AS ABAP) works. The processes are introduced and it is is explained how they work.

Lesson Objectives After completing this lesson, you will be able to: • • •

Understand how AS ABAP works List the AS ABAP processes and describe their purpose Describe how requests to AS ABAP are processed

This lesson introduces the processes of AS ABAP. The different tasks of the different processes are introduced. After this lesson, the participants should know the basic mechanisms and processes in AS ABAP. This is not about describing every detail of the different functions.

Business Example Your company has decided to implement SAP ERP. The business core functions such as accounting in SAP ERP are processed by the ABAP runtime environment. For the employees in the different, rather technical departments (development, systems administration, work preparation, security and so on) it is therefore important that they understand how AS ABAP works in more detail.

Processing of Requests in AS ABAP Clearly point out to participants who already know about the classical ABAP runtime environment that classical transactions, such as the displaying of customers by means of transaction FD03 still happen exclusively via the ABAP runtime environment. The existence of a Java runtime environment does not mean that precisely this application is now implemented by means of the SAP GUI as well as in a Java-based way. Which runtime environment (ABAP or Java) and which user interface (SAP GUI, Web Dynpro ABAP/Java, BSP / JSP) must to be used always depends on the selected application.

2008

© 2008 SAP AG. All rights reserved.

103

Unit 3: The System Kernel

TAW10_1

The users can log on to the SAP system using either the SAP GUI or a Web client (browser). When logging on via the SAP GUI, user requests are processed by the ABAP runtime environment, when logging on via a browser, processing can be done by the ABAP or the JAVA runtime environment, depending on the request.

Processing Requests by the SAP GUI If necessary, you can also talk about the necessity of buffer synchronization and the applied procedure when you introduce the buffers and their significance. The participants should learn about the general procedure for a user request in the SAP system. In doing, only the case of an internal user (with SAP GUI) is discussed here. This section does not cover integration of browsers using the ICM. Users logon via the (ABAP) message server (load balancing) or they logon directly on the ABAP dispatcher, the work processes execute the user entries. The processing of a user request in AS ABAP, as outlined in the graphic, involves different processes on all three layers (presentation, application and database layer):

Figure 35: Processing a User Request

104

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

The screen entries of a user are accepted by the SAP presentation program SAP GUI (SAP Graphical User Interface), converted to an internal format and forwarded to AS ABAP. The (ABAP) dispatcher is the central process of AS ABAP. It manages the resources for the applications written in ABAP in coordination with the respective operating system. The main tasks of the ABAP dispatcher include the distribution of the requests to “its” work processes, the integration of the presentation layer and the organization of communication transactions. The dispatcher first saves the processing requests in request queues and then processes them according to the “first in, first out” principle. The ABAP dispatcher distributes the requests one after the other to the available work processes. Data is actually processed in the work process, although the user who created the request using the SAP GUI is not always assigned the same work process. There is no fixed assignment of work processes to users. To process user requests it is often necessary to read data from the ABAP schema of the database or to write to it. For this, every work process is connected directly to the ABAP schema of the database. The user with which the work processes log on to the database is the user to whom the database schema (all tables of AS ABAP) “belongs”. Up to release 4.6C, this user was called SAPR3. After that, the user name was changed to SAP so that several SAP systems could be operated in one database. You can look up this user in the SAP system under System → Status. For AS Java, the user (the database schema) is called SAPDB. Once the process is complete, the result from the work process is sent via dispatcher back to the SAP GUI. The SAP GUI interprets this data and generates the output screen for the user. The buffers help to speed up processing of user requests. Data that is often read but seldom changed (for example, programs or Customizing data such as clients, currencies or company codes) can be kept as a copy of the database content in the shared memory of the application server. This means that the data does not have to be read from the database every time it is needed, but can be called very quickly from the buffer. Each instance has its own buffers. During initialization of the SAP system, the dispatcher executes the following actions (amongst others): Read system profile parameters, start work processes, logon to the message server.

2008

© 2008 SAP AG. All rights reserved.

105

Unit 3: The System Kernel

TAW10_1

Figure 36: Process Flow for Requests

At this point it might help the participants if you point out that all work processes are based on the same kernel file, disp+work.exe, that is, all work processes – regardless of their type – have an identical structure. Work processes execute the process logic of application programs. In addition to internal memory, a work process has a task handler that coordinates the actions within a work process, software processors and a database interface. The dynpro processor executes the screen flow logic of the application program, calls processing logic modules, and transfers field content to the processing logic. The actual processing logic of ABAP application programs is executed by the ABAP interpreter. The screen processor tells the ABAP processor which subprogram needs to be executed, depending on the processing status of the screen flow logic.

106

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Since release 7.0, the ABAP work process has been capable of hosting a Java VM as well. This function has nothing to do with AS Java or the J2EE technology. If this function has be activated in AS ABAP, you see the message type VMC in SM51. For more information about the VM Container see the SAP NetWeaver Library under SAP NetWeaver by Key Capability → Application Platform by Key Capability → Platform-Wide Services → SAP Virtual Machine Container. The dialog work process selected by the dispatcher, performs a roll-in of the user context first. That is, the data that contains the current processing status of a running program as well as data that characterizes the user is made known to the work process. The work process then processes the user request, which may involve, for example, requesting data from the database or from the buffers in the shared memory. Once the dialog work process has processed the dialog step, the work process returns the result, rolls the user context back out to the shared memory, and is now available again for a new user request from the request queue. The result is transferred to the SAP GUI and the user sees the new screen. Memory management and the roll-in/roll-out process: The memory management system differentiates between main memory areas that are available exclusively to one particular work process, and memory areas that can be used by all work processes. The memory space used exclusively by a work process stores session-specific data that must be kept for longer than the duration of a work step. This data is automatically made available to the process at the start of a dialog step (rolled in) and saved at the end of the dialog step (rolled out). This data includes data that characterizes the user (user context), such as authorizations, administrative information, and other data for the ABAP and screen processors that has been collected in previous dialog steps for the active transaction. There are also additional memory areas for all processes in the shared memory for, among other things, the factory calendar and screen, table, and program buffers.

Database Interface of AS ABAP This section should give the participants an understanding of ABAP Open SQL as platform-independent SQL. It should be pointed out to them that their own developments will loose their platform independence if they use ABAP Native SQL.

2008

© 2008 SAP AG. All rights reserved.

107

Unit 3: The System Kernel

TAW10_1

Relational Database Management Systems (RDBMS) are generally used to manage large sets of data. An RDBMS saves data and relationships between data in the form of two-dimensional tables. These are known for their logical simplicity. Data, tables, and table relationships are defined at database level in the database catalog (the data dictionary) of the RDBMS. Within the SAP programming language ABAP, you can use ABAP Open SQL (SQL = Structured Query Language, database query language) to access the application data in the database, regardless of the RDBMS used. The database interface, which is part of every work process of AS ABAP, translates Open SQL statements from ABAP into the corresponding SQL statements for the specific database used (Native SQL). This allows ABAP programs to be database-independent. Note: ABAP Open SQL is a database query language based on the (ISO) SQL standard that also contains enhancements that are not included in the standard. When interpreting Open SQL statements, the SAP database interface checks the syntax of these statements and ensures the optimal utilization of the local SAP buffers in the shared memory of the application server. Data that is frequently required by the applications is stored in these buffers so that the system does not have to access the database server to read this data. In particular, all technical data, such as ABAP programs, screens, and ABAP Dictionary information, as well as a number of business administration parameters, usually remain unchanged in an operational system and are therefore ideally suited to buffering.

Figure 37: Database Query Flow

108

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Furthermore, native SQL commands can be used directly in ABAP, that is, without using the local buffers and without the database interface interpreting the commands. You can do this by including the commands in an EXEC SQL. - END EXEC. bracket in the ABAP program. The ABAP Interpreter does not check the syntax of any commands within this bracket. If you use native SQL, you can no longer maintain the platform independence of the affected programs. If there is more than one instance then there is also more than one buffer. You may therefore need synchronize buffers from time to time. At this point you have the option of discussing the problems with the buffer synchronization: What can cause inconsistent buffers? How often should you synchronize the buffers? What possible solutions are there? (Only buffer data that is changed rarely and also read frequently, if at all.) Who decides whether and which table contents are buffered? The developer!

Processing Dialog Requests The execution of dialog requests is characterized by the following : • •



A program dialog step is assigned to one specific dialog work process during execution. The individual dialog steps for a program consisting of several screens can be executed by different dialog work processes during program runtime. This is called work process multiplexing. A dialog work process sequentially processes dialog steps for various users and programs.

This is illustrated by the following figure.

2008

© 2008 SAP AG. All rights reserved.

109

Unit 3: The System Kernel

TAW10_1

Figure 38: Dialog Work Process Multiplexing

SAP application programs differentiate between user interaction and processing logic. The user actions are technically realized using screens, also called dynpros (from dynamic programs), which consist of a screen image and the underlying flow logic. The dynpro processor of the work process executes the screen flow logic of the application program, calls processing logic modules, and transfers field content to the processing logic. The screen flow logic itself is further divided into PBO (Process Before Output), which is processed before the screen image is sent, and PAI (Process After Input), which is processed after a user interaction on the screen. The PAI part of a dialog step logically belongs to the preceding screen image, while the PBO part logically belongs to the subsequent screen image. The actual processing logic of ABAP programs is executed by the ABAP interpreter. The screen processor tells the ABAP processor which subprogram needs to be executed, depending on the processing status of the screen flow logic. If, during a dialog step, data needs to be exchanged with the database or the buffers, then this exchange takes place through the database interface, which enables access to database tables, ABAP programs or the ABAP Dictionary among other things.

110

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

If appropriate, you can roughly calculate, together with the participants, how many dialog processes can usefully be configured in an SAP system (taking into account the number of active users, the average processing time for a dialog step in the system and the frequency with which users send requests to the system).

Transactional Processing in AS ABAP This section is supposed to explain the difference between a database transaction and the transaction in AS ABAP. Building on the participants’ knowledge of work process multiplexing, you need to clarify that an ABAP transaction can consist of several database transactions. You can use this lesson to prepare participants for the introduction of the SAP lock concept and asynchronous updates and explain the background to these two concepts.

The Term Transaction You need to explain the ACID concept. You may find it helpful to illustrate your explanation using a transaction of your choice. The ACID concept is not an SAP invention but a general requirement for transactional systems. Transactions are processing units grouped to provide specific units. They have four principal characteristics. The initial letters of these characteristics together form the acronym ACID . • • • •

Atomic Consistent Isolated Durable

Atomic means that a transaction is either fully successful or does not have any effects at all. If a transaction-oriented system goes down, you need to ensure that inconsistent, partial results are not stored. Consistent means that the system status changes from one that is accurate and consistent in business terms to another that is also accurate and consistent in business terms.

2008

© 2008 SAP AG. All rights reserved.

111

Unit 3: The System Kernel

TAW10_1

Isolated means that the changes made within a transaction can only be seen by other transactions, even those that run simultaneously, after the final confirmation (“Commit”). The results of a transaction are durable because after the final confirmation they are stored permanently in the database.

Database Transactions and ABAP Transactions Every work process is connected to a specific communication partner at database level for the duration of an SAP instance’s runtime. Work processes cannot exchange communication partners at runtime. This is why a work process can only make changes to the database within one database transaction. A database transaction is, in accordance with the ACID principle, a non-divisible sequence of database operations, at the beginning and end of which the dataset on the database must be consistent. The beginning and end of a database transaction are defined by a commit command (“database commit”) to the database system. During a database transaction (between two commit commands), the database system itself ensures that the dataset is consistent. The database system itself takes on the task of restoring the dataset to its previous state after a transaction has terminated with an error (“rollback”). Business transactions are processing units grouped to provide a specific function; these processing units execute changes to the database that are consistent and make sense in business terms. Typical examples are credit and debit updates, which only make sense together, or creating an order and reserving the relevant materials. Correspondingly, an AS ABAP transaction is defined as a non-divisible business process that must either be executed completely or not at all. AS ABAP transactions are implemented as sequences of logically related dialog steps that are consistent in business terms. Every user dialog step is represented by one screen image.

112

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Figure 39: Relationship between database transactions and SAP transactions

SAP transactions are not necessarily executed within one single dialog work process. Within a transaction that changes data on the database, the user requests database changes using the displayed individual screens. Once the transaction is complete, the changes must result in a consistent database status. The individual dialog steps can be processed by different work processes (work process multiplexing), and each work process sequentially handles dialog steps for unrelated applications. Applications whose dialog steps are executed by the same work process one after the other cannot run within the same database transaction if they are not related to each other. Therefore, a work process must start a new database transaction for each dialog step. The relationship between database transactions and SAP transactions is illustrated in the graphic “Relationship between database transactions and SAP transactions”.

Lock Management You need to demonstrate to the participants the need for a lock mechanism to achieve data consistency at the database level, and also that the lock management provided by database management systems is not sufficient. You need to introduce the participants to transactions SM12 and SM04. To ensure data consistency within an SAP system, you must ensure that data records cannot be accessed and changed by more than one user at any one time. To do this, the SAP system has its own lock management concept.

2008

© 2008 SAP AG. All rights reserved.

113

Unit 3: The System Kernel

TAW10_1

From a database perspective, every dialog step forms a physical and logical unit: the database transaction. The database lock administration can only coordinate this type of database transaction. From an SAP point of view, however, this is not sufficient, because SAP transactions, which are formed from a sequence of logically related work steps that are consistent in business terms, are generally made up of several dialog steps. SAP systems need to have their own lock management. This is implemented using the enqueue work process. This also ensures that the platform-independence of the lock management is maintained. The SAP lock concept works on the principle that SAP programs make lock entries for data records to be processed in a lock table. Lock entries can only be made if none already exist for the table entries to be locked. The enqueue work process manages the logical lock of the SAP transactions in the lock table. The lock table is located in the main memory of the instance with the enqueue work process. Note: The instance whose main memory contains the lock table is also known as the enqueue server.

Figure 40: Lock Management in AS ABAP

114

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

If a user wants change access to data, the executing dialog work process requests a lock (to do so, the application developer must program this request explicitly). When a lock object is successfully activated in the ABAP Dictionary, the system generates an ENQUEUE function module and a DEQUEUE function module with the respective name: ENQUEUE_ DEQUEUE_ The developer then uses these function modules in the application program to request and release locks. If a dialog request is processed on the enqueue server, the dialog work process can access the lock table directly. It now checks whether a new lock can be generated; that is, whether there is a collision with locks that have already been set. If a lock can be set, the dialog work process creates it and the user (lock owner) is given the lock key. The lock key is kept in the user context in the shared memory. If the dialog work process that processes the user request and the enqueue work process are not running on the same instance, these two work processes communicate through the message server. In this case, the lock request is forwarded from the dialog work process to the enqueue work process via the dispatchers and the message server. The enqueue work process now checks whether a lock can be set. If this is possible, the lock is set by the enqueue work process and the lock key transferred to the requesting dialog work process via dispatcher and message server. When the lock is requested, the system checks whether the requested lock conflicts with existing entries in the lock table. If the lock table already contains corresponding entries, the lock request is refused. The application program can then inform the user that the requested operation cannot currently be executed. In order for the system to execute lock requests, the lock object must be defined in the ABAP Dictionary. The lock object contains one or more tables whose entries are to be locked. You can define a lock mode for a lock object.

2008

© 2008 SAP AG. All rights reserved.

115

Unit 3: The System Kernel

TAW10_1

The application developer can choose between different lock modes: •







Write locks (lock mode Exclusive); the lock data can be edited only by one user. The requests for another write lock and another read lock are rejected. A write lock protects the locked objects against all types of other transactions. Only the same lock owner can set the lock again (cumulate). Read locks (lock mode Shared); several users can have read access to the locked data at the same time. The requests for additional read locks are accepted, even if they are from other users. A write lock is rejected. Enhanced write locks (lock mode eXclusive noncumulative); while write locks can be successively requested and released by the same transaction, an enhanced write lock can only be requested once, even by the same transaction. All other requests for locks are rejected. Optimistic locks (lock mode Optimistic); optimistic locks respond like read lock at first and can be changed to write locks. An optimistic lock is set if the user displays the data in change mode. Optimistic locks on the same object do not collide. If the user wants to save the (changed) data, the optimistic lock must be changed to a write lock (mode E). (This fails if someone set a non-optimistic lock on the object before.) Other optimistic locks on the object are deleted in the process.

Locks set by an application program are either released by the application program itself or by the update program once the database has been changed. Locks that have been passed on to an update work process in this way are also written to a file at operating system level and can therefore be restored if the enqueue server goes down. Transaction SM12 (Tools → Administration → Monitor → Lock Entries) displays the locks that are currently set. If a lock has already been inherited to the update process, the backup flag has also been set. Such a lock will also be included in the lock table again after restarting the enqueue server. For older releases (< 7.0), SM12 displayed the locks set by the update work process in blue. With SAP NetWeaver AS ABAP 7.00, you can display the details on the lock entry in transaction SM12. If the backup flag is set here, this corresponds to the earlier blue locks. There are basically two ways of deleting locks held by users: • •

116

Ending the user session in the user overview (transaction SM04 or Tools → Administration → Monitor → System Monitoring → User Overview) Manually deleting the lock entries in SM12

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

The first method (ending the user session) also results in the original lock owner leaving the transaction and thereby releasing all locks held; the second method (manually deleting using SM12) merely deletes the lock entry from the lock table. This theoretically enables several users to change the same data records simultaneously. Caution: Before deleting locks using transaction SM04, system administrators must first check whether the user who owns the lock is still logged on to the system. You should only delete lock entries with transaction SM12 if the lock owner is no longer logged on to the system but still owns the lock (for example, if the connection between SAP GUI and the SAP system has been broken because the user has switched off his or her front-end computer without logging off from the system).

At this point you could show the participants the existing lock entries in transaction SM12 (these locks could, for example, have resulted from user data being changed in SU01). It may also be helpful to draw the participants’ attention to the consequences of deleting a lock entry manually. If you also demonstrate deleting a user session in SM04, you must draw the participants’ attention to the fact that – if they do this themselves – they must never delete the sessions of users participating in other courses who are also logged on to the same training system. You can check this in the system log (SM21).

Standalone Enqueue Server / ABAP Central Services For reasons of high availability, the enqueue work process together with the ABAP message server can also be detached from the central instance and installed as an ABAP central services instance (ASCS). Go to the SAP NetWeaver Library for more details: SAP NetWeaver by Key Capability→ Application Platform by Key Capability → ABAP Technology → Client/Server Technology → The SAP Lock Concept (BC-CST-EQ) → Standalone Enqueue Server

Update In the SAP system, a business process is mapped using an SAP transaction that can contain several screen changes (for example, the creation of an order). Data changes effected by this process are supposed to be executed completely or not at all in the database. If the operation is terminated during the transaction or an error occurs, the transaction is not supposed to make any database changes at all. The SAP update system, which is described below, takes care of this. The update system also offers increased security, performance and restorability in the execution of database changes.

2008

© 2008 SAP AG. All rights reserved.

117

Unit 3: The System Kernel

TAW10_1

Figure 41: The principle of asynchronous updates

The updating system is a technology which allows SAP transactions to off-load time-intensive database changes. These are then carried out asynchronously in special update work processes. It also circumvents the roll-back problems caused by the difference in the conception of the logical unit of work (LUW) in an SAP transaction and in the database. If, during a dialog work process, data temporarily stored for processing is passed to an update work process for further processing, the dialog work process does not wait for the update request to be completed: the update is asynchronous (not simultaneous). The asynchronous update process is illustrated in the graphic “The Principle of Asynchronous Updates”. The dialog part is completed with the ABAP command COMMIT WORK; the update part of the transaction starts: the update server transfers the update request to an update work process. Here, each dialog step corresponds to a database transaction (which is executed either completely or not at all in the database and there completed with a COMMIT command). The update part of the SAP transaction is executed in a database transaction. It is only then that the data is copied to the application tables.

118

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Figure 42: The asynchronous update process

2008

© 2008 SAP AG. All rights reserved.

119

Unit 3: The System Kernel

TAW10_1

If users want to change a data record in an SAP transaction, they call the corresponding transaction in the dialog, make the appropriate entries on the screens and then initiate the update process by saving the data. This process triggers the following steps: 1.

2.

3.

4.

5.

6.

7.

The program locks the data record for other users. The program does this by addressing the enqueue work process (using the message server if appropriate). The enqueue work process makes the relevant entry in the lock table or (if another user has already locked the data) informs the user that the data record cannot currently be changed. If the enqueue work process succeeded in writing the lock entry to the lock table, it passes the lock key it created to the user, the program reads the record to be changed from the database and the user can change the record on the screen image of the SAP transaction. In the active dialog work process, the program calls a function module using CALL FUNCTION ... IN UPDATE TASK and writes the change request to database update tables. These are also called VB* tables, because their names begin with “VB”. They act as temporary memory and store the data to be changed until it can be collected and written to the application tables in the database (in a single database transaction). At the end of the dialog part of the transaction (for example, when the user saves the data – possibly after completing other dialog steps), the program initiates the close of the transaction with the COMMIT WORK statement. The work process that is handling the active dialog step completes the update header and triggers an update work process. Based on the information (key of the update order, lock key) transferred from the dialog work process, the update work process reads the log records that belong to this SAP transaction from the VB* tables. The update work process transfers the changes marked and collected in the VB* tables to the database as a change request and evaluates the database response. If the changes were successfully written to the target tables, the update work process triggers a database commit after the last change to the database and deletes the entries from the VB* tables. If an error occurs, the update work process triggers a database rollback, leaves the log records in the VB* tables and marks them as defective. The lock entries in the lock table are reset.

Behind the VB* tables, there are BHDR (update headers), VBMOD (update modules), VBDATA (update data) and VBERROR (possible error information); the table structures can be displayed using the ABAP Dictionary (transaction SE11).

120

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

You could at this point demonstrate asynchronous updates on the system. To do this, open two sessions and arrange them next to each other on the screen: in one session, call the process overview transaction SM50 (if your system has several instances, make sure that you are logged on to the instance on which the update work process is configured). In the other session, in transaction SA38, call report VBTST300 (update test program) with parameters U (update), no. of COMMIT WORKS = 1, No. of func. per update = 5000 (leave the other parameters unchanged) . Once you have pressed the Execute pushbutton, go to the session with the process overview and keep refreshing it to show that a dialog work process is active to start with. Once the dialog part is finished, the message “update test finished” is displayed in the SA38 session, and the update part of the transaction starts in SM50 in the UPD process. Note: The application developer decides whether and how to use asynchronous updates while programming the transaction. Besides the asynchronous update, there are some other update techniques (for example, synchronous or local). To increase performance further, application developers can configure different types of updates: •





time-critical, primary V1 updates. They are relevant to objects that have a controlling function in the SAP system, such as a change to the material stock or an order creation. non-time-critical, secondary V2 updates that depend on the V1 updates. These are, for example, purely statistical updates such as the calculation of results. non-time-critical updates that are collected and processed at a later point in time (collective run).

The V1 modules for an SAP transaction are processed sequentially in a single update work process. If your SAP system has a work process for V2 updates (type UP2), then V2 modules will only be updated there. Once it has successfully completed processing, the V1 update work process releases the relevant locks again. This means that the “normal” update work processes are available again more quickly for time-critical V1 updates, and that the relevant lock entries are deleted sooner. If you have not configured any V2 update work processes, then the V1 work process handles all updates. In the collective run, the modules are not updated automatically but only when a special report (report RSM13005) triggers the update. All calls of the function modules are then collected, aggregated and updated at once. In doing so they are handled like V2 update modules.

2008

© 2008 SAP AG. All rights reserved.

121

Unit 3: The System Kernel

TAW10_1

If an error occurs during an update, then processing of the active update component terminates. Users can be notified automatically by express mail when an update terminates. If a dialog work process terminates whilst writing data to the VB* tables, the tables will contain data that will not be updated. These entries can be automatically deleted the next time you start the system or they can be deleted manually. The application tables remain unchanged. An asynchronous update may terminate for a variety of reasons. If, for example, several attempts are made to enter the same data record (using insert) in a table, this triggers the exception condition “Duplicate Key” in the coding because an entry already exists in the table under this key. Therefore, the corresponding data record cannot be written to the database table more than once. At this point you could show the participants how the SAP system reacts when an update terminates (if you have made the preparations described at the beginning of this lesson). To do this, call report VBTST300 in transaction SA38 with parameters U (=update), No. of COMMIT WORKS = 1, No. of func. per update = 1 (leave the other parameters unchanged). This updates the database and should run without any problems. Then you can call the same program with the same parameters (except with I instead of U). The program will now try to insert an entry in the database that already exists there. As a result, at the next user interaction after you run the program (you may need to wait a second!), the system sends an express document with the title “Update was terminated”. This is a message from the update work process. Once you have received the message, you can display the update record that caused the error in SM13; you also have the option of branching from here to the short dump. You may find that several defective update records are displayed in SM13, since several courses may be using the same system simultaneously. Caution: You can use this demonstration to create defective update records that the participants can then display in the exercises. When an update terminates, the system sends an express mail to the user who triggered the update. Any additional steps must be carried out by the system administrator. Transaction SM13 (update requests) provides system administrators with analysis tools to handle terminated updates. Once the error that caused the termination has been corrected (for example, hardware damage repaired), the end user should restart the processing.

122

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Print SAP systems provide a wide variety of options for representing business and other data. This data, created and formatted in a dialog step, can then be sent to printers and other output interfaces (fax, e-mail, and so on). A printer must first be set up in the system before it can be addressed. You can select a printer that has already been set up by choosing the print icon (Ctrl + P), then using the F4 help. A standard printer is usually set as default in your user profile. Once a printer has been set up, the SAP system has all the information it needs to be able to create a spool request. A spool request contains information on the data to be output, its formatting, and the printer model used. The spool request generated is stored in the TemSe (temporary sequential file). Hint: Spool requests can be created by dialog work processes or by background work processes. Spool work processes do not create spool requests.

Figure 43: Printing in AS ABAP

2008

© 2008 SAP AG. All rights reserved.

123

Unit 3: The System Kernel

TAW10_1

Show how a spool request and an output request are generated. In a transaction with list output (such as SM50) choose Print (Ctrl+P). In the following dialog window, choose an output device such as LP01 and choose Continue. Confirm the dialog box. You have now created a spool request. On this screen, choose System → Own Spool Requests. Information on the spool request you have just created (and poss. others as well) is displayed. To view the output requests for a spool request, select the spool request and click the Output requests (F5) pushbutton. The message you receive for your spool request is “List contains no data”. Go back to the previous screen and choose Print directly for your spool request. This creates an output request that you can now display. As you can see from the graphic Spool processing in an SAP system, a spool work process formats the data specified in the spool request and creates an output request. The output request contains all data in an appropriate format for the printer. This data can either be passed on to an appropriate operating system spool process locally (on the same computer) or remotely (over a network connection). Note: In an SAP system, the connection between a spool work process and the operating system spool process is known as the access method. There are more access methods than displayed above. These are the two most commonly used access methods for connecting printers to SAP systems. In this context, remote or local do not refer to the physical location of the output but to the place where the spool work process is “connected” to the operation system spool process. For print processing, the best performance is achieved by sending the data to be printed to the operating system as soon as possible. You do this using the local access method. The operating system then performs all remaining tasks, such as queuing and data transfer to the selected printer. Hint: One minor but indispensable requirement for printing from SAP systems is that each selectable printer allows printing at operating system level. You can display your own spool and output requests via System → Own Spool Requests (transaction SP02). Via System → User Profile→ Own Data (transaction code SU3) you can specify personal settings for printing on the Defaults tab page in the Spool Control section.

124

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Course ADM100 provides additional information on printing an also on setting up printers in AS ABAP.

Background processing SAP background processing is a method for automating routine tasks and for optimizing the use of your organization’s SAP computing resources. In background processing, you instruct the R/3 System to run programs for you. You can use background processing to execute long-running or resource intensive programs at off peak times. You can use it to assign the system the task to execute reports and programs. There is no strain on your dialog resources and reports running in the background are not subject to the runtime restrictions of dialog processing (termination of the program after a runtime of ten minutes). The segregation of background processing to special work processes gives you an additional dimension for separating background processing and interactive work. Normally, background processing and interactive work in the system take place at different times. For example, the system is used interactively during the day and background processing takes place at night. You can use background work processes to separate background processing and interactive work also by servers because background jobs are only executed on servers that offer background processing.

2008

© 2008 SAP AG. All rights reserved.

125

Unit 3: The System Kernel

TAW10_1

Figure 44: Scheduling Background Tasks (Jobs)

First of all, show how an ABAP program is executed in the dialog: Start transaction SA38 and run program RSUSR000. A list of all users who are logged on is output (see also AL08). Then use SA38 to schedule the same program in the background. Display the job using System → Own Jobs and then call up the spool list for the job. The end user can usually schedule the program to be started in the background as a job from the application transaction. The job then “waits” for the planned execution time in the job scheduling table. If the time has come and free background work processes are available, the job is distributed to a background work process by the background scheduler and then executed. User can display the result in the application transaction or, in case of list generating programs, look at the spool request belonging to the job (see Printing section). To display your own jobs, choose System → Own Jobs (transaction code SMX). The system administration and the work preparation have access to a tool for scheduling different types of background takes with transaction SM36 (Tools → CCMS → Background Processing→ Define Jobs). The system-wide monitoring of jobs takes place with transaction SM37 (Tools → CCMS → Background Processing→ Jobs - Overview and Administration).

126

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

For cross-system scheduling and monitoring of background tasks, you can use SAP Central Process Scheduling (SAP CPS) and other licensed partner products. Course ADM100 provides further insight into background processing.

Communication via the Gateway Each instance of an AB ABABP system contains a gateway. It is used for the communication between work processes of different instances or SAP systems as well as work processes and external programs. The gateway reader (usually just called gateway) is the main process of the gateway system. The dispatcher starts it and checks it periodically.

Figure 45: Gateway Communication

2008

© 2008 SAP AG. All rights reserved.

127

Unit 3: The System Kernel

TAW10_1

The graphic illustrates various possible communication channels. But it can also be interpreted this way: The non-SAP system starts a business process and queries data from the SAP CRM system, this in turn queries data from an SAP ECC. The response it returned in the same way. In the communication between instances of a system or systems using remote function call (RFC) or CPIC, the gateway is always involved. If a dialog work process has to establish an RFC connection to a remote system in the context of a request, for example, to fetch customer data, it uses the gateway, which then takes care of the communication with the remote system. The gateway forwards the request to the gateway of the remote system. The remote gateway transfers the request to the dispatcher. This in turn forwards the request to one of its work processes, which the communicates directly with “its” gateway. Inbound RFC connection are therefore always received by the gateway. Outbound connections are initiated by the work process. In transaction SMGW, the connections of the gateway can be monitored. Installing a standalone gateway is also possible. This is sometimes required for integrating non-SAP applications.

Processing Web Requests Web requests are received by the Internet Communication Manager (ICM). These HTTP(S) requests can be processed either in the ABAP work process (for example, ABAP web dynpro applications) or forwarded to AS Java in an AS ABAP+Java system (for example, Java web dynpro applications). The ICM can use the URL to decide to where it forwards the request (if it cannot reply to the request from its cache).

128

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Figure 46: Processing a Web Request

As a demonstration, you can call up the URL of the ICM in the browser. The ULR is http://:. For example: http://twdf1234.wdf.sap.corp:8000. By default, the ICM HTTP port is 80$$, whereby $$ is the instance number. If no port answers the ICM you can look up the port under parameter icm/server_port_0 SMICM via Goto→ Parameter → Display. Call up the URL http://:/sap/public/info (calls an ABAP function module) and then http://: (call up the AS Java homepage). This is an easy way to demonstrate the distribution of requests via the ICM. If the request is to the Java runtime environment, it is sent to the Java dispatcher (2b), which then forwards it to a Java server process (3b). The Java server process then refers to the database’s Java schema, if applicable, and uses the Java dispatcher process to send the response back to the ICM. Finally, the ICM sends the response from the SAP system to the user who sent the request (5). In contrast to ABAP, where there are different types of work processes (dialog, update, background...) for different types of tasks, the Java server process offers several services simultaneously (for example, HTTP provider service, JDBC connector service, locking adapter service). Based on the type of user request, the Java dispatcher for an instance selects a Java server process on which the “appropriate” services are configured.

2008

© 2008 SAP AG. All rights reserved.

129

Unit 3: The System Kernel

TAW10_1

If the request is to the ABAP runtime environment, the ICM forwards it to the ABAP dispatcher (2a), which then handles it like a typical SAP GUI request (see previous section). The work process that processes the enquiry now communicates directly with the ICM (4a). The ICM returns the response to the user who sent the request (5). If, at this point, participants ask whether in the case of several instances, several server/port combinations must also be released for external access, you can refer to the SAP Web Dispatcher. The SAP Web dispatcher (or another load balancer) is used to distribute HTTP requests across all instances of an SAP system. It is the central point of entry to the SAP system from the internet. For each incoming request, it must decide on the instance to which it forwards the request. The architecture and configuration of the SAP Web dispatcher are discussed in course ADM102.

130

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: AS ABAP processes

Facilitated Discussion

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions.

2008

© 2008 SAP AG. All rights reserved.

131

Unit 3: The System Kernel

TAW10_1

Lesson Summary You should now be able to: • Understand how AS ABAP works • List the AS ABAP processes and describe their purpose • Describe how requests to AS ABAP are processed

132

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Unit Summary

Unit Summary You should now be able to: • Outline simple client/server configurations • Name the processes of the SAP NetWeaver Application Server • Define the term instance and recognize the characteristics of a central instance • Understand how AS ABAP works • List the AS ABAP processes and describe their purpose • Describe how requests to AS ABAP are processed

2008

© 2008 SAP AG. All rights reserved.

133

Unit Summary

134

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

113

Test Your Knowledge

Test Your Knowledge 1.

What are the advantages of a three-tier client/server configuration as compared to a single-tier or two-tier configuration? Choose the correct answer(s).

□ □ □ □ 2.

A B C D

Simpler scalability Simpler administration Load balancing possible None of the above

Which AS ABAP process receives the user request? Choose the correct answer(s).

□ □ □ □ 3.

A B C D

Work Process dispatcher Server process SAP GUI

Which work process types are there in an AS ABAP system? Choose the correct answer(s).

□ □ □ □ □ □ □ 4.

A B C D E F G

Dialog work process Message Server Update work process Internet Communication Manager (ICM) Background work process Enqueue work process Spool work process

Which of the following processes belong to AS Java? Choose the correct answer(s).

□ □ □ □ □

2008

A B C D E

Server (process) Internet Communication Manager (ICM) Software Deployment Manager (SDM) dispatcher Java Connector (JCo)

© 2008 SAP AG. All rights reserved.

135

Test Your Knowledge

114

TAW10_1

Answers 1.

What are the advantages of a three-tier client/server configuration as compared to a single-tier or two-tier configuration? Answer: A, C Implementing an additional hardware layer for application processes makes it easier to adapt an SAP system if the number of users changes (scalability), and to assign user groups to specific application servers (software-oriented view), (load balancing). The additional hardware layer does not, however, reduce the administrative workload.

2.

Which AS ABAP process receives the user request? Answer: B The dispatcher receives the user request on the AS ABAP and passes it on to an available work process. The SAP presentation program, SAP GUI, is not part of the application server (software-oriented view), and the server process is an AS Java process.

3.

Which work process types are there in an AS ABAP system? Answer: A, C, E, F, G All of the above processes can in theory be configured on an AS ABAP. However, not all of the above processes are work processes. The message server and ICM process are not work processes.

4.

Which of the following processes belong to AS Java? Answer: A, C, D The ICM is not an AS Java process but an AS ABAP process. The Java Connector is part of AS Java but is not an independent process.

136

© 2008 SAP AG. All rights reserved.

2008

Unit 4 Communication and Integration Technologies

115

The participants are confronted with a very large number of new terms in this unit, and it is your job, as the instructor, to make sense of these terms and, above all, to set priorities. RFC is still the primary technology used for SAP system connections, although new options for linking systems are increasing in significance. XML data exchange between companies by means of HTTP, cross-system workflow scenarios, and custom-built Web applications are among the topics that are attracting ever more attention from customers.

Unit Overview There is a vast array of methods for connecting SAP systems with other systems, and optimizing processes within a system. Many of the available technologies are briefly introduced in this unit, and you should get an idea of the various uses for each.

Unit Objectives After completing this unit, you will be able to: • • • • • • • • • •

2008

Name various cross-system business processes Explain the ideas behind the ALE concept List various interface technologies used by SAP systems Describe the process for a Remote Function Call Explain the significance and use of business objects and their BAPIs Make a Remote Function Call Explain the evolution from SAP R/3 to SAP ERP and the Enterprise SOA Describe the significance of the Web services within the Enterprise SOA Explain Web services Describe UDDI and WSDL

© 2008 SAP AG. All rights reserved.

137

Unit 4: Communication and Integration Technologies

TAW10_1

Unit Contents Lesson: Cross-System Business Processes .................................... 139 Lesson: Remote Function Calls and BAPIs ..................................... 145 Exercise 4: Remote Function Calls and BAPIs............................. 153 Lesson: Enterprise Services-Oriented Architecture (Enterprise SOA)....... 156 Lesson: Web Services ............................................................. 165

138

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 116

Lesson: Cross-System Business Processes

Cross-System Business Processes Lesson Duration: 30 Minutes

Lesson Overview This lesson explains the fundamentals of the Application Link Enabling (ALE) concept.

Lesson Objectives After completing this lesson, you will be able to: • •

Name various cross-system business processes Explain the ideas behind the ALE concept

This lesson aims to give the participants an understanding of the significance of cross-system business processes and the need to link them using ALE.

Business Example Your company wants to implement an Internet sales scenario in the context of the SAP CRM solution.

The Significance of Cross-System Business Processes Let’s start by defining cross-system business processes, using common situations as examples. For example, it may be the case that within a company, the human resources system is separate from the rest of the business software system. Obviously, the systems cannot be completely separate, since the accounting system needs the employees’ wage data. In this situation, you need cross-system business processes to exchange the relevant data. Cross-system business processes are used, for example, if two companies collaborate closely and send joint orders to a vendor. The companies’ business IT systems need to communicate with each other to consolidate the quantities to be ordered. In this case, the business process does not just cross system boundaries, but also company boundaries. An additional example is the transfer of a limited quantity of specific data, for example, the electronic transfer of account statement data from a bank to a company.

2008

© 2008 SAP AG. All rights reserved.

139

Unit 4: Communication and Integration Technologies

TAW10_1

Recent developments suggest that the significance of cross-system business processes will continue to increase rapidly.

Application Link Enabling (ALE) Application Link Enabling is a means of creating and operating distributed applications. The basic concept of Application Link Enabling is to ensure operation of a distributed, yet integrated system landscape. This involves business-controlled message exchange using consistent data across loosely linked application systems. The applications are integrated through synchronous and asynchronous communication, not through a central database. Systems that use ALE to exchange data can be located at the same company, or they may belong to different companies. One of the characteristics of ALE is that different systems are linked in business terms through secure and consistent data transfer.

Figure 47: Business process distribution using ALE

You could also describe ALE as being composed of the elements: who exchanges which data when, with whom, and by what means.

140

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Cross-System Business Processes

Implementing ALE therefore requires that you clarify the following points in detail: 1. 2. 3. 4. 5. 6.

Identify the business process and the objects involved Identify the information to be transmitted Specify the format for the data to be transferred Decide on the transfer technology to be used Decide on the transfer type Specify the destination of the data transfer

The following table contains examples for implementing ALE: Data Synchronization in the Business Process – an Example Process

Internet Sales with SAP CRM

Identify the information to be transmitted

Order data from the SAP CRM System, which is to be passed to an ERP backend

Format of the data

IDoc format

Transfer technology

by RFC

Transfer type

asynchronously, every 60 seconds

Objective

Provide goods and/or services for sale in the Internet

The data is often identified within the SAP system using a business object and its Business Application Programming Interfaces (BAPIs). A BAPI is a method of a business object, for example, the material master record. A permissible method could be creating or changing the material master data. BAPIs normally enable you to edit all data belonging to the object. The IDoc format describes the structure of “intermediate documents”. There are various kinds of IDoc formats for different types of data to be exchanged. Alternatively, you can use ALE to transfer data in an agreed XML format. You can select your preferred data transfer technology within the constraints imposed by the system. For example, you can transfer data by Remote Function Call (RFC) or using HTTP or HTTPS. There are two basic types of transfer: synchronous and asynchronous. Synchronous transfer means that the data is transferred at the time of creation or change. You can start asynchronous transfers at intervals of your choice.

2008

© 2008 SAP AG. All rights reserved.

141

Unit 4: Communication and Integration Technologies

TAW10_1

There are very few restrictions on the systems that can be linked. The systems involved must have the technical capability to receive the communications (RFC-enabled, HTTP-enabled) and interpret the format transferred (IDoc, XML). SAP systems of different releases can be linked using ALE.

142

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Cross-System Business Processes

Facilitated Discussion The aim of this discussion is to make customers aware of cross-system business processes in their own companies.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. Which cross-system business processes do you (the participants) use?

2008

© 2008 SAP AG. All rights reserved.

143

Unit 4: Communication and Integration Technologies

TAW10_1

Lesson Summary You should now be able to: • Name various cross-system business processes • Explain the ideas behind the ALE concept

Related Information • •

144

BIT300 and BIT350 are more advanced training courses on ALE. You can find additional information on the topic of ALE on the SAP Service Marketplace using the quick link /ibf (and then under Ibf in Detail => Integration Scenarios).

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 121

Lesson: Remote Function Calls and BAPIs

Remote Function Calls and BAPIs Lesson Duration: 30 Minutes

Lesson Overview This lesson provides an overview of the interface technologies available to you in the SAP system, while focusing on the significance of RFCs and BAPIs.

Lesson Objectives After completing this lesson, you will be able to: • • • •

List various interface technologies used by SAP systems Describe the process for a Remote Function Call Explain the significance and use of business objects and their BAPIs Make a Remote Function Call

This lesson gives the participants an overview of the various interface technologies available. You need a thorough understanding of RFCs (transactions SE37 and SM59), and of the BOR and BAPIs.

Business Example You need to integrate existing applications with SAP applications. The interfaces available in the standard system are of particular interest here.

Overview of Interfaces SAP systems have interfaces at different communication levels. These range from highly technical connection options, for example, using the TCP/IP protocol or CPI-C, to highly specialized interfaces designed for business objects, such as BAPIs or the IDoc interface used in the ALE environment. All higher interfaces, that is, those that access business objects or processes, use the same technology, the Remote Function Call (RFC).

2008

© 2008 SAP AG. All rights reserved.

145

Unit 4: Communication and Integration Technologies

TAW10_1

Figure 48: Interfaces technologies used in SAP systems

SAP systems use the following interface technologies that are listed in the above graphic: • • • • • • • • • • • •

146

ALE: Application Link Enabling BAPI: Business Application Programming Interface CPI-C: Common Program Interface Communication EDI: Electronic Data Interchange HTTP: HyperText Transfer Protocol LU 6.2: Logical Unit Type 6.2 RFC: Remote Function Call OLE: Object Linking and Embedding SMTP: Simple Mail Transfer Protocol SOAP: Simple Object Access Protocol TCP/IP: Transmission Control Protocol / Internet Protocol XML: Extensible Markup Language

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Remote Function Calls and BAPIs

Remote Function Call The Remote Function Call interface is an SAP interface protocol based on CPI-C and TCP/IP. It simplifies the programming of communication processes between different systems. RFCs enable you to call and execute predefined functions in a remote system – or within the same system. RFCs manage the communication process, parameter transfer and error handling. RFC describes an interface, not the programming language in which the function runs. You can also use RFCs to call functions in non-SAP systems. The procedure for RFC communication between two SAP systems is that the calling system uses an RFC definition in the system called to access a specific function. This function is normally a remote-enabled function module. You can also, depending on the release, use RFC to call functions in SAP R/2 systems.

Figure 49: RFC connection possibilities

2008

© 2008 SAP AG. All rights reserved.

147

Unit 4: Communication and Integration Technologies

TAW10_1

If you want to start external programs remotely, you need an RFC interface outside the SAP system. This could be, for example, a simple Dynamic Link Library (DLL). Every RFC interface is bidirectional, so external programs can also use RFC to access functions in SAP systems. Note: All function modules (including those that are remote-enabled) are created, together with their import and export parameters, using the Function Builder. You can call the Function Builder via Tools→ ABAP Workbench → Development → Function Builder or using transaction code SE37. To call an RFC module from an SAP system, you need to know the import and export parameters (defined in the Function Builder), and there must be a technical connection between the two systems. This connection is called an RFC connection or an RFC destination. You can manage your RFC connections via Tools → Administration → Administration → Network → RFC Destinations or using transaction SM59.

Figure 50: Remote Function Call in detail

In the above graphic you can see, on the left side, the calling system, in which an RFC destination named DEST has been created. An RFC destination in transaction SM59 should not be confused with an SAP system, since an RFC connection can

148

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Remote Function Calls and BAPIs

only point to one specific client in an SAP system. These are therefore also referred to as connections between logical systems; this term is used, above all, in the ALE environment. This also means that you can have at least as many RFC connections between two systems as there are clients in the target system. Since you can specify a logon user for the destination in each RFC connection, you can therefore also access clients in the target system several times, for example, with a different logon user each time. If you need a bidirectional RFC connection between two systems, that is, that the system called can also execute RFC modules in the calling system, then you need to set up an equivalent second RFC connection in the system called. Hint: When you are defining RFC destinations, RFC connections are • •

Addressed to one client, when they are pointing at an SAP system Accessible from all clients in the system

In ABAP, you use RFCs to call a function module in another system as follows: CALL FUNCTION DESTINATION EXPORTING ... IMPORTING ... The function to be executed in the target system is named. The name of the target must refer to one of the RFC connections available. When you are creating an RFC connection, you can specify logon data for the target system; if you do not do this, you need to enter logon parameters when you start the RFC. Exporting and Importing are used to pass parameters to the target function and to receive the returned parameters. The function called in the target system is executed using the user ID entered for the connection. Note: You can also create RFC connections for which the user of the user making the call is used in the target system. That means different users can use the same connection in the target system. This procedure is also called Trusted RFC. It is, of course, a prerequisite that identical users are created in the source and target systems. Trusted RFC is explained in the course ADM960 - Security in SAP System Environments. The RFC has become the most important interface in the SAP environment. Some special RFC modules, which follow certain conventions, are also known as BAPIs (Business Application Programming Interfaces).

2008

© 2008 SAP AG. All rights reserved.

149

Unit 4: Communication and Integration Technologies

TAW10_1

BOR and BAPIs A Business Application Programming Interface (BAPI) is a standardized programming interface that facilitates internal and external access to business processes and data in SAP systems. BAPIs are defined in the Business Object Repository as methods of SAP business objects and enable an object-oriented view of business data in an SAP system. Functions that can be called using BAPIs are normally implemented and stored in the ABAP Workbench Function Builder as RFC-enabled function modules. You can display an overview of available BAPIs in the BOR, for example, by activating the Business Object Repository pushbutton in the Business Object Builder (Tools → ABAP Workbench → Development → Business Object Builder), transaction SWO1. You can access the BOR directly using transaction code BAPI.

Figure 51: BOR and BAPIs

150

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Remote Function Calls and BAPIs

BAPIs, which represent methods for business objects in an SAP system, are used in a variety of contexts. Here are some possible uses for BAPIs: • • • • •

2008

To link business processes across system boundaries (for example, when using ALE) Used by SAP to integrate various solutions in the framework of SAP Business Suite To connect an SAP system to the Internet Used in conjunction with SAP Business Workflow To connect to external programs

© 2008 SAP AG. All rights reserved.

151

Unit 4: Communication and Integration Technologies

TAW10_1

You must make sure beforehand that you are familiar with the execution of the following demonstration. If possible, avoid executing this function using the dummy RFC connection “NONE”; instead, with the participants, create a connection in transaction SM59. You could also prepare this beforehand. Hint: This demonstration consists of two parts that the participants will then do themselves in the exercises. The first part concerns itself with a simple presentation of the BOR using a documentation call for a BAPI as an example. The second part is rather more complex, as it introduces BAPI usage with the Function Builder. 1. 2. 3. 4. 5. 6.

Follow the path mentioned above for the BOR, or call transaction BAPI directly. Choose the Alphabetical tab page. Search for the business object “USER”. From the BAPIs available for this business object, select the “Change” BAPI. Display the documentation for this BAPI. Now switch to the USER.Display BAPI. Go to the Tools tab page and choose the Function Builder. Then choose Display. You can now see the source code for the BAPI in the Function Builder.

7.

Press Test/Execute (or the F8 key). Specify NONE as the RFC target system entry; this refers to your own system. Enter your own user name. Choose Execute (or the F8 key). As a result, your user data, requested by the RFC from the BAPI, is displayed.

8.

Once you have confirmed this screen, the result screen for the query is displayed. You can view the return code and the response time for your query. This response time includes the time you took to view the user data display. Note: BAPIs are created and tested in exactly the same way as other function modules, using the Function Builder, transaction SE37, and are then defined as BAPIs in the BOR.

152

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

129

Lesson: Remote Function Calls and BAPIs

Exercise 4: Remote Function Calls and BAPIs Exercise Duration: 10 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Understand how to use BAPIs

Business Example You require data from another system.

System Data System: Client: User ID: as SAPTEC-##) Password: the relevant user. Set up instructions:

The training system assigned to you (such as I30) The client assigned to you (such as 802) The user name that you have given the participants (such The password that you have given the participants for None

Task: Using a BAPI Use a BAPI to display the address data for your user in the system. 1.

Start the overview transaction for the Business Object Repository.

2.

Find the method USER.Change. Display the documentation for this method.

3.

Call the Function Builder for the USER.Display method. You can now see the source code for the BAPI in the Function Builder.

4.

Execute this BAPI for your user with the RFC destination NONE.

5.

Once you have confirmed the dialog box, the result screen for the query is displayed. You can view the return code and the response time for your query.

Result In this example, the export parameter for the calling side was the user “in the other system”, the import parameter was the receipt of the dialog box. From the point of view of the function called, the import parameter was the user name and the export parameter was the dialog box.

2008

© 2008 SAP AG. All rights reserved.

153

Unit 4: Communication and Integration Technologies

TAW10_1

Solution 4: Remote Function Calls and BAPIs Task: Using a BAPI Use a BAPI to display the address data for your user in the system. 1.

Start the overview transaction for the Business Object Repository. a)

2.

Choose Tools → ABAP Workbench → Development → Business Object Builder and choose Business Object Repository (transaction BAPI). If you are following the Business Object Builder menu path, then select BAPI in the dialog box.

Find the method USER.Change. Display the documentation for this method. a)

Use the Alphabetical tab page and look for the User business object. From the BAPIs available for this business object, select the USER.Change BAPI. Use the appropriate tab page to display the documentation for this BAPI on the right side of the screen.

3.

Call the Function Builder for the USER.Display method. You can now see the source code for the BAPI in the Function Builder. a)

4.

Switch to the USER.Display BAPI. Choose the Tools tab page, followed by the Function Builder. Then choose Display.

Execute this BAPI for your user with the RFC destination NONE. a)

Press Test/Execute (F8). Specify NONE as the RFC target system entry; this refers to your own system. Enter your user name on the query screen. Choose Execute. As a result, your user data, requested by the RFC from the BAPI, is displayed.

5.

Once you have confirmed the dialog box, the result screen for the query is displayed. You can view the return code and the response time for your query. a)

The return code for your query is displayed as the value for the export parameter Return.

Result In this example, the export parameter for the calling side was the user “in the other system”, the import parameter was the receipt of the dialog box. From the point of view of the function called, the import parameter was the user name and the export parameter was the dialog box.

154

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Remote Function Calls and BAPIs

Lesson Summary You should now be able to: • List various interface technologies used by SAP systems • Describe the process for a Remote Function Call • Explain the significance and use of business objects and their BAPIs • Make a Remote Function Call

Related Information For information about additional interfaces, go to the following address: https://service.sap.com/connectors.

2008

© 2008 SAP AG. All rights reserved.

155

Unit 4: Communication and Integration Technologies

Lesson: 132

TAW10_1

Enterprise Services-Oriented Architecture (Enterprise SOA) Lesson Duration: 30 Minutes

Lesson Overview This lesson aims to highlight the main differences between the software solutions SAP R/3 and SAP ERP as well as the significance of the Enterprise Services-oriented Architecture (Enterprise SOA).

Lesson Objectives After completing this lesson, you will be able to: • •

Explain the evolution from SAP R/3 to SAP ERP and the Enterprise SOA Describe the significance of the Web services within the Enterprise SOA

The instructor should be familiar with all links (and their content) on the Service Marketplace mentioned in this lesson.

Business Example You want to understand the development of SAP R/3 after SAP ERP and the Enterprise SOA, in order to be able to fully use the advantages that these offer to your company.

Enterprise Resource Planning to Date With ERP software, that is, software for controlling and processing business-related company processes, SAP has set standards worldwide. The central idea behind the software, namely the real-time processing of different business processes in a company and their implementation in the successful solutions SAP R/2 and SAP R/3 has made SAP into a company that is active worldwide. SAP R/3 was complemented by other solutions from SAP, such as SAP CRM, SAP SCM and SAP SRM. In the past years, SAP has strongly increased the value of its own application platform and has consolidated this platform with the SAP NetWeaver, combining herein the technical foundations for all SAP solutions.

156

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Enterprise Services-Oriented Architecture (Enterprise SOA)

With SAP NetWeaver, all future SAP applications (including the SAP ERP 6.0 application / solution, for example) are provided with the basic functions, including those from other components; for example, functions of the SAP Business Information Warehouse. The development of SAP R/2 after SAP R/3 and other solutions from the past years were characterized by different factors. Primary differences, but also common features of SAP R/2 and SAP R/3 • • • • • •

In common: real-time processing of business processes In common: use of ABAP as a programming language, optimized for implementation in business software In common: constantly increasing features (during the maintenance period) by functions newly created by SAP In common: adjustability of mapped processes to company-specific activities In common: all information in a central database Difference: host-based system on client-server-based system

Thus, the change from SAP R/2 to SAP R/3 (and other “new” software from SAP) primarily meant a change in the technical infrastructure and in the design of the user interface. However, applications were mainly developed “in the same way”. What now?

Enterprise Resource Planning and the Enterprise SOA in the Future With SAP ERP 6.0, SAP is taking the first steps towards business applications that build on an Enterprise SOA. The tasks, which SAP R/3 systems and other SAP software fulfill in companies worldwide, naturally also have to be fulfilled in the future. That means that the Enterprise SOA will not make any basic changes to these processes. What are the core characteristics of an Enterprise SOA? In the usual Client Server Architecture, the business process data are in the system database, the application processes run on application servers and are made available via predefined interfaces. Business processes that do not belong to the classic SAP world can be integrated more easily using interfaces. The processes are very often integrated via “human integrators”. To do this, the employees of the company must know when they have to call up what systems for data maintenance in the company’s business processes.

2008

© 2008 SAP AG. All rights reserved.

157

Unit 4: Communication and Integration Technologies

TAW10_1

Different business applications exchange data directly via the database. For example, a financial transaction may, under certain circumstances, access an HR-related table in which data was updated from an HR transaction shortly before. In the context of Enterprise SOA, however, the financial application would request the HR data via a specific application-to-application (A2A) interface and not simply retrieve the data from the database with an SQL access. In the Enterprise SOA, by comparison, there are role-based user interfaces, which act as central entry points for employees of the company to carry out their work using different applications in different systems. New process steps that are provided as Enterprise Services and whose data can be saved in totally different databases, can be integrated using general standards into the process world of the company with minimal effort. With the help of cross-system process definitions and process control through workflow, the amount of work for “human integrators” can be reduced. The central idea of ESOA is that data and application functions can be merged to create reusable enterprise services. To achieve this, ESOA is modeled on the lean manufacturing model used in the automotive industry. There, lean manufacturing means that subsystems of automobiles (brakes, drive axle, motor, steering mechanism) are standardized in such a way that they can be used and put together by different manufacturers. This means that the components of a car no longer have to originate exclusively from the respective manufacturer. Lean Manufacturing not only applies to the automobile industry, but it is very advanced there. From an IT point of view, ESOA should place a company in a similar position to an automobile manufacturer. The intricate web of applications that has been implemented corresponds to the thousands of components in conventional automobile production, while the components of an ESOA platform mirror the standardized components in the automotive industry. The IT industry is only in its beginnings here. Components, which deserve this name rudimentarily (as not completely standardized) exist mainly for basic technologies, for example, the relational databases or technologies for web servers and browsers. As an example of the only rudimentary “componentization”, you can mention that databases, despite all common factors, e.g. in SQL dialect or in the way in which procedures are composed, can still be very different.

158

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Enterprise Services-Oriented Architecture (Enterprise SOA)

Figure 52: Client-Server Architecture Versus Enterprise SOA

The individual steps within an enterprise service can be linked via standardized, specially developed interfaces. This involves application-to-application (A2A), business-to-business (B2B) and user interface (UI) interfaces. A2A interfaces refer to links within a business application, B2B interfaces refer to links between different business applications. These designed interfaces make up the actual core of the Enterprise SOA. All the requirements for the business application are developed top-down on the basis of component modeling, including the necessary A2A and B2B interfaces. The aim here is for there to be no functions in the system that do not originate from the model. The interfaces resulting from the modeling can be implemented using standardized protocols. Although it is a major simplification, the technical implementations of the interfaces with standard protocols are referred to as Web services. What is a Web Service as opposed to an Enterprise Service? Enterprise SOA is often mistakenly thought of as the result of Web services. However, this is an oversimplification and virtually incorrect. The core of Enterprise SOA is a model design of the necessary functions, including the required A2A, B2B and UI interfaces or services. From a technical perspective, it could also involve a Web

2008

© 2008 SAP AG. All rights reserved.

159

Unit 4: Communication and Integration Technologies

TAW10_1

service. In theory, the system should only contain business functions that arise from the modeling. This is an ideal state that could never be achieved in practice, because ad hoc programming and adjustments will always be necessary. Furthermore, there is a practical necessity to link to external applications that are not specified in detail in the modeling. The interfaces necessary for this case could be referred to as application-to-external interfaces (A2X) but they are generally known as Web services. This involves the detailed description of an API. A classic example would be an ABAP BAPI. You could almost say that an A2X Web service contradicts the Enterprise SOA’s model design because the Web service can be used to implement links to external business functions that were not planned in the model but that are necessary. This contradiction is both an opportunity and a challenge at the same time. SAP Business ByDesign – the SAP software for small and mid-sized companies – was based on Enterprise SOA from the start. The SAP Business Suite, on the other hand, is “only” service enabled. The necessary enterprise services are provided via the Enterprise Services Repository in XI’s Integration Repository. SAP ERP was not Enterprise SOA from the start, it has become so by evolution. To summarize again: the essence of Enterprise SOA is based on modeling the application with the special A2A, B2B and UI interfaces or services resulting from the modeling. The fact that Web services are also technically used here is of secondary importance. Enterprise SOA and the use of Web services should never be thought of as synonymous.

The instructor can develop the following table. It should aid participants to understand Enterprise SOA in relation to ALE. ALE distribution model corresponds to ...

Enterprise SOA

Business process corresponds to ...

Enterprise Service

Remote Function Call (RFC) corresponds to ...

B2B and Web service

ALE was, in a way, always Enterprise SOA but with SAP techniques. The “true” Enterprise SOA uses open standards. Enterprise Services describe the larger business logic. An Enterprise Service does not address detail functions, but a complete, industry-specific process that can consist of many small individual steps. All actions together form the Enterprise Service, which thus provides a context-oriented business process logic. Web Services , by comparison, are small modular applications, which run within the framework of Internet technologies and which are generally called up as a detail function within

160

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Enterprise Services-Oriented Architecture (Enterprise SOA)

applications or Enterprise Services. Standards were agreed to describe the call-up of Web Services. (Web Service Description Language (WSDL), Simple Object Access Protocol (SOAP), Universal Description, Discovery, and Integration (UDDI)).

Figure 53: Enterprise SOA and Web Services

Hint: You can find more information on Web Services at http://www.w3c.org/2002/ws. Enterprise SOA can be characterized using the following key ideas: Characteristics of the Enterprise SOA (ESOA) • • • •

An Enterprise SOA application is generally implemented across systems. An Enterprise SOA application is created in ABAP or in Java. An Enterprise SOA application generally has no “own” database. New functions are entered “outside” of existing systems (for Enterprise SOA applications).

The availability of Enterprise Services provides many new options.

2008

© 2008 SAP AG. All rights reserved.

161

Unit 4: Communication and Integration Technologies

TAW10_1

Enterprise Services enable ... • • •

... the efficient creation of new applications without having to modify the underlying system. ... very high flexibility in the configuration of business processes, also “in operation”. ... the simplified creation of applications that use the functions of several systems.

SAP will extensively offer the functions of our own software products as enterprise services and design additional new applications on the basis of these. At the same time, you will have the opportunity here to design and use new and flexible business processes across systems without having to intervene in your business systems. Of course, the Enterprise SOA also provides you with new possibilities, such as linking functions of SAP systems with the functions of enterprise or Web services from other providers via the Internet.

162

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Enterprise Services-Oriented Architecture (Enterprise SOA)

Facilitated Discussion No facilitated discussion

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. No questions

2008

© 2008 SAP AG. All rights reserved.

163

Unit 4: Communication and Integration Technologies

TAW10_1

Lesson Summary You should now be able to: • Explain the evolution from SAP R/3 to SAP ERP and the Enterprise SOA • Describe the significance of the Web services within the Enterprise SOA

Related Information • •

164

http://service.sap.com/erp http://www.sap.com/germany/plattform/enterprisesoa/index.epx

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 138

Lesson: Web Services

Web Services Lesson Duration: 30 Minutes

Lesson Overview This lesson provides you with an introduction to the subject of Web services.

Lesson Objectives After completing this lesson, you will be able to: • •

Explain Web services Describe UDDI and WSDL

Web Services are modular function programs that can be combined flexibly. Web Services, together with WSDL, can be described as software interfaces, rather than web-capable applications. However, Web services can also be used from the Web browser, but this on its own is not their main characteristic. In the instructor’s demo the Web service system information, for example, is called up in an ABAP program. SAP prefers the development of enterprise services that can be the total or combination of individual Web services. Flexible, modular programming will complement monolithic software architectures to a great extent in the future, at least according to consulting companies based on current surveys.

Business Example Your company wants to technically realize online services using Web services.

Web Services - A Short Introduction The SAP NetWeaver Application Server is also a development platform for Web services. A Web service is a service that essentially provides a program interface (API). In practice, the Web service is made available via Internet protocols and the application based on it is often operated using a Web browser, although this is not the actual definition of a Web service. Web services are the technical basis for making individual functions of an application directly available. Here, the existing function of an application can be addressed via standardized access protocols and content can also be exchanged in a structured form. In this way, cross-application functions, which are sold by SAP as complete units for the business process under the name of Packaged Composite Application (SAP xApps) can also be developed flexibly. The combination of several granular

2008

© 2008 SAP AG. All rights reserved.

165

Unit 4: Communication and Integration Technologies

TAW10_1

services, in the sense of self-contained business scenarios, is called an enterprise service. In the SAP NetWeaver Application Server, the following basic standards for Web services are implemented: • •

eXtensible Markup Language (XML) Simple Object Access Protocol (SOAP) SOAP describes a protocol that you can use to call up Web services in distributed system landscapes. SOAP uses HTTP as a transport protocol. An SOAP message has a header with the additional information and a body with the actual message.



Web Service Description Language (WSDL) WSDL is a meta language that is used to describe the function of a Web service. Functions, parameters and return codes in particular are described in a machine-readable form. WSDL is standardized by the World Wide Web Consortium (W3C); see the following URL: http://www.w3c.org/TR/wsdl.html



Universal Description, Discovery, and Integration (UDDI) is a directory service for dynamic Web services. A directory of Web services is provided via an SOAP interface. The information here is highlighted in white, yellow and green pages. You can find more information on UDDI at: http://www.uddi.org. SAP itself also operates a UDDI server at http://uddi.sap.com, on which Web services can be registered and searched for.

Web Services and the SAP NetWeaver Application Server Web services can already be developed in the SAP system from release SAP NetWeaver Application Server 6.20, however, the development tools have been considerably enhanced for release 6.40. Thus, an existing, remote-capable function module from the Function Builder can be transformed (transaction SE37) into a Web service. A Web service is a module that can be used flexibly in different applications. The creator publishes the service in a publicly accessible UDDI directory. The customer can then search directly for Web services in the UDDI directory. For reasons of clarity, the demo scenario does not go into how Web services are published in a UDDI directory.

166

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Web Services

Figure 54: Outline of a Web Service Scenario

Technically, once a Web service has been defined, it can be called up in different ways. For example, it can be called from an ABAP program or from a Business Server Page. The instructor can present the Web service ZSYSINFO as a demonstration; this service shows you the following system data: SID, host name of the DB server and operating system of the DB server. This Web Service can be called up from a) the ABAP program ZSYSINFO and b) from the Business Server Page ZSYSINFO. The BSP is not public, please logon with the group user SAPTEC-##. The following outlines how a Web service is created from an RFC-capable ABAP function module. Precise instructions on how to set up the Web service are not necessary in SAPTEC, as the Web service has already been set up in the training system. However, if you the instructor are interested in this topic, you can look at the SAPNW and BC416 courses or the online documentation for the necessary setup procedures. All important details should be mentioned here, so that the settings can also be checked in case of errors. The Web service ZSYSINFO was created in transaction SE37 (display mode: Utilities → Other Utilities → Generate Web Service → From Function Module) for function module RFC_SYSTEM_INFO. The virtual interface is called Z_WS_INTF_SYSINFO. In transaction SICF, you can display the ICF node /sap/bc/srt/rfc/sap/ZSYSINFO generated for the Web service or activate

2008

© 2008 SAP AG. All rights reserved.

167

Unit 4: Communication and Integration Technologies

TAW10_1

it manually, if necessary (however, it is not possible to test the Web service from SICF because default.htm is expected as the start page here and not start.htm, as implemented). The WSDL file is generated in transaction WSADMIN (highlight Web Service and choose the path Web Service → WSDL (where SAP Features can be included in the WSDL file; in some cases, it may be necessary to log on to the SAP system again here). The following are entered in transaction SE80: client proxy object ZWS_CO_ZSYSINFO (if necessary, under the local objects of the internal user; using the right-hand mouse button, click the path Create → Enterprise Service/WebService → Proxy Object as source URL/HTTP Definition and enter the URL of the WSDL page), the ABAP program ZSYSINFO and the Business Server Page ZSYSINFO. In transaction LPCONFIG, the logical port ZSYSINFO for proxy class ZWS_CO_SYSINFO is defined and activated as a default port. • •



168

The service provider generates the Web service from a function module, for example. A URL and the WSDL file are also generated. The service requester creates a proxy object that refers to the URL of the Web service. Next, an ABAP class that matches the proxy object is generated and a logical port is assigned. The proxy object is written to and integrated into an executable program (for example, in ABAP) and called up there.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Web Services

Facilitated Discussion Show the significance of Web services for the future IT landscape and for future business scenarios.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. Do you intend to use Web services soon? What implementation options do you see for Web services in your company?

2008

© 2008 SAP AG. All rights reserved.

169

Unit 4: Communication and Integration Technologies

TAW10_1

Lesson Summary You should now be able to: • Explain Web services • Describe UDDI and WSDL

170

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Unit Summary

Unit Summary You should now be able to: • Name various cross-system business processes • Explain the ideas behind the ALE concept • List various interface technologies used by SAP systems • Describe the process for a Remote Function Call • Explain the significance and use of business objects and their BAPIs • Make a Remote Function Call • Explain the evolution from SAP R/3 to SAP ERP and the Enterprise SOA • Describe the significance of the Web services within the Enterprise SOA • Explain Web services • Describe UDDI and WSDL

2008

© 2008 SAP AG. All rights reserved.

171

Unit Summary

172

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

143

Test Your Knowledge

Test Your Knowledge 1.

Application Link Enabling (ALE) allows you to: Choose the correct answer(s).

2.



A



B



C



D



E

Exchange data only between SAP systems, as long as they have the same release status Exchange data across system boundaries, but only for SAP applications Exchange data between collaborating enterprises, using certain formats and technologies The communication between different systems of your system landscape Update your order data using the appropriate BAPI, only once every 24 hours

The following interfaces or communication options are supported by SAP systems: Choose the correct answer(s).

□ □ □ □ □ □ 3.

A B C D E F

HTTP (HyperText Transfer Protocol) SMTP (Simple Mail Transfer Protocol) RFC (Remote Function Call) BAPIs (Business Application Programming Interfaces) XDTP (Extended Data Transfer Protocol) STP (SAP Transfer Protocol)

You can use BAPIs to: Choose the correct answer(s).

4.

□ □ □

A B C



D

Request data from an SAP system Pass data to an SAP system Transfer SAP screen images to third-party applications (such as Microsoft Word) Access business processes in SAP systems

You access BAPIs in SAP systems using an RFC interface. Determine whether this statement is true or false.

□ □

2008

True False

© 2008 SAP AG. All rights reserved.

173

Test Your Knowledge

5.

TAW10_1

Business

Programming Interfaces are specialized modules. They are accessed using the interface. They are created and managed using the Builder.

Fill in the blanks to complete the sentence.

174

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

145

Test Your Knowledge

Answers 1.

Application Link Enabling (ALE) allows you to: Answer: C, D ALE is a very powerful method of exchanging data between systems. These systems may be located within the same company, or they may be distributed between several companies. The data is transferred by RFC in a previously defined format. The transfer type may be synchronous or asynchronous.

2.

The following interfaces or communication options are supported by SAP systems: Answer: A, B, C, D From an SAP system, you can communicate with other systems using, for example, HTTP, SMTP, RFC, or BAPIs. XDTP and STP do not exist.

3.

You can use BAPIs to: Answer: A, B, D You can use BAPIs to access business processes in an SAP system and to request and transfer data between systems. GUI functions cannot be transferred to third-party products.

4.

You access BAPIs in SAP systems using an RFC interface. Answer: True BAPIs are nothing other than special, remote-enabled function modules. They can therefore also be addressed using RFCs.

5.

Business Application Programming Interfaces are specialized function modules. They are accessed using the RFC interface. They are created and managed using the Function Builder. Answer: Application, function, RFC, Function You can start the Business Object Repository using transaction code BAPI, and the Function Builder using transaction code SE37.

2008

© 2008 SAP AG. All rights reserved.

175

Unit Summary

176

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

Unit 5 Flow of an ABAP Program

147

See introductory instructor’s note in the lesson.

Unit Overview The unit overview lists the individual lessons that make up this unit.

Unit Objectives After completing this unit, you will be able to: • •

Describe the SAP NetWeaver Application Server architecture Describe how a simple dialog program is executed by the ABAP runtime system

Unit Contents Lesson: System Architecture and ABAP Programs ............................ 178

2008

© 2008 SAP AG. All rights reserved.

177

Unit 5: Flow of an ABAP Program

Lesson: 148

TAW10_1

System Architecture and ABAP Programs Lesson Duration: 20 Minutes

Lesson Overview In this lesson you will learn how a simple dialog program is executed by the SAP NetWeaver Application Server.

Lesson Objectives After completing this lesson, you will be able to: • •

Describe the SAP NetWeaver Application Server architecture Describe how a simple dialog program is executed by the ABAP runtime system

The idea is to give the participants a first impression of how the ABAP runtime system works, using two demonstration programs, and at the same time explain at what time during the course the individual aspects should be discussed in more detail.

Business Example Your task here is to explain the SAP NetWeaver Application Server architecture as well as the execution of ABAP programs.

178

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

System Architecture and ABAP Program

Figure 55: Client/Server Architecture of the SAP NetWeaver Application Server

The SAP NetWeaver Application Server has a modular architecture that follows the software-oriented client/server principle. In the SAP NetWeaver Application Server, presentations, application logic, and data storage can be assigned to different systems. This serves as the basis for the scalability of the system. The lowest level is the database level. Here data is managed with the help of a relational database management system (RDBMS). This data includes, apart from application data, the programs and the metadata that the SAP System requires for self-management. The ABAP programs run at the application server level, that is, both the applications provided by SAP and the ones you develop yourself. The ABAP programs read data from the database, process it, and store new data there if necessary. The third level is the presentation server level. This level contains the user interface where each user can access the program, enter new data, and receive the results of a work process.

2008

© 2008 SAP AG. All rights reserved.

179

Unit 5: Flow of an ABAP Program

TAW10_1

The technical distribution of software is independent of its physical location on the hardware. Vertically, all levels can be installed on top of each other on one computer or each level on a separate computer. Horizontally, the presentation and application servers can be divided among any number of computers. The horizontal distribution of database components, however, depends on the type of database installed.

Figure 56: Excerpt for an ABAP Program

We can simplify this graphic for most of the topics that will be discussed during this course. The interaction between one user and one ABAP program will be of primary interest to us during this course. The exact processes involved in user dispatching on an application server are secondary to understanding how to write an ABAP program. Therefore, we will be working with a simplified graphic that does not explicitly show the dispatcher and the work process. Certain slides will, however, be enhanced to include these details whenever they are relevant to ABAP programming. ABAP programs are processed on the application server. The design of user dialogs and database accesses is of particular importance when writing application programs. In the following section, we will discuss the basic process that takes place when an ABAP program is executed. To do this, we will use a program with which the user enters an airline ID (such as “LH”) and sees details of the airline displayed as a result.

180

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

Execute the transaction BC400RCAR here. Do not discuss the source code of the underlying program BC400_GSD_CARRIER at this point.

Figure 57: View for the User

The average user is only interested in the business process, and how data can be entered or displayed. The technical aspects of the program are of minor interest here. Users does not need to know the precise process flow of an ABAP program. The SAP system is like a "black box" to them. By contrast, developers need to understand both the interplay between the server levels and the process flow when programs are executed in order to develop their own programs.

2008

© 2008 SAP AG. All rights reserved.

181

Unit 5: Flow of an ABAP Program

TAW10_1

Figure 58: Interplay Between Server Levels and Program Flow

Once the user performs a user action, for example by choosing Enter, a function key, a menu function, or a pushbutton, control is passed from the presentation server to the application server. If a further user dialog is triggered from within the ABAP program, the system transmits the screen, and control is once again passed to the presentation server. Normally, a program is not made up of a single block, but of several units. This is known as modularization. Many of these modularization units can be used in more than one program, which is why they are often termed reuse units. A good program should have at least the database accesses encapsulated in such reuse units. This creates a division between the design of the user dialog and the database accesses. It is then possible to user the same database accesses for different user dialogs. Now show the source code for the program BC400_GSD_CARRIER. Point out the method call, double-click to navigate to the method and show the SELECT statement there.

182

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

Process Flow of a Program with Selection Screen and List

Figure 59: Program Start

Whenever a user logs on to the system, a screen is displayed. From this screen, the user can start an ABAP program through the menu path.

2008

© 2008 SAP AG. All rights reserved.

183

Unit 5: Flow of an ABAP Program

TAW10_1

Figure 60: System Loads Program Context

In this case, 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 all this program information from the Repository, which is a special part of the database. The sample program has a selection screen as the user dialog, a variable and a structure as data objects, and one ABAP processing block. The list used to display the data is created dynamically at runtime. The ABAP runtime system controls the subsequent program flow.

184

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

Figure 61: Runtime System Sends Selection Screen

Since 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 has not finished entering data in the input fields. Selection screens allow users to enter selection criteria required by the program for it to continue.

2008

© 2008 SAP AG. All rights reserved.

185

Unit 5: Flow of an ABAP Program

TAW10_1

Figure 62: Input Values Are Inserted into Data Objects

As soon as the user has finished entering data on the selection screen, he or she can trigger further processing of the program by choosing Execute. 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. If the entries made by the user do not have the correct type, an error message is automatically triggered. The user must correct his/her entries.

186

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

Figure 63: Reuse Unit Loading

A reusable unit is called in the processing block that encapsulates the database access. The reuse unit is a special processing block in an individual program. The actual example shows a method in a global class. When the reuse unit is called, the program in which it is contained is also read from the Repository and loaded to the application server.

2008

© 2008 SAP AG. All rights reserved.

187

Unit 5: Flow of an ABAP Program

TAW10_1

Figure 64: Reuse Unit Is Called

In the call, the required data is transferred to the called program, after which the reuse unit is executed. The execution is synchronous, which means that the calling program waits until the reuse unit has been processed completely.

Figure 65: Program Requests Data Record from the Database

188

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

In the example program, read access to the database is programmed in the reuse unit. Correspondingly, information about the database table to be accessed and the row in the table to be read is passed on to the database.

Figure 66: Database Supplies the Data Record

The database returns the requested data record to the program and the runtime system ensures that this data is placed in the appropriate data objects. If a single record is accessed, this data object is usually a structure that contains relevant components for all the required database fields.

2008

© 2008 SAP AG. All rights reserved.

189

Unit 5: Flow of an ABAP Program

TAW10_1

Figure 67: Reuse Unit Returns the Data

This concludes the processing of the reuse unit and control is returned to the calling program, which resumes immediately after the call. When the system exits the reuse unit, the data that was read from the database is written to a corresponding data object for the calling program, from where it can be processed further.

190

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

Figure 68: Runtime System Sends the List

After the reuse unit has been called, the ABAP processing block receives statements for structuring the list with which the result is to be displayed. After the processing block finishes, the runtime system sends the list as a screen to the presentation server. Show the source code for the program BC400_GSD_CARRIER again and point out how the user dialogs are structured with the PARAMETERS and WRITE statements. Depending on the level of knowledge the participants already have, you could demonstrate the dialog transaction BC400MCAR here too (module pool SAPMBC400_GSD_CARRIER). This transaction implements the same business application, but with the aid of dynpros. Show that although the user dialog is structured in a different way, the fundamental principle remains the same. Above all, the reuse unit for the database access is the same. Show the source code for the PAI module in dynpro 100 for this.

2008

© 2008 SAP AG. All rights reserved.

191

Unit 5: Flow of an ABAP Program

TAW10_1

Facilitated Discussion Any questions can now be discussed.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions.

192

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: System Architecture and ABAP Programs

Lesson Summary You should now be able to: • Describe the SAP NetWeaver Application Server architecture • Describe how a simple dialog program is executed by the ABAP runtime system

2008

© 2008 SAP AG. All rights reserved.

193

Unit Summary

TAW10_1

Unit Summary You should now be able to: • Describe the SAP NetWeaver Application Server architecture • Describe how a simple dialog program is executed by the ABAP runtime system

Related Information ... Refer to the article “Overview of Application Program Components” in the online documentation.

194

© 2008 SAP AG. All rights reserved.

2008

Unit 6 Introduction to the ABAP Workbench

163

See the introductory instructor notes in the lessons.

Unit Overview The unit overview lists the individual lessons that make up this unit.

Unit Objectives After completing this unit, you will be able to: • • • • • • •

Describe the structure of the Repository Name and use the search tools of the Repository Use the Object Navigator for displaying Repository objects Name and use the utilities for orderly software development Create packages Create programs Create transactions

Unit Contents Lesson: Repository and Object Navigator ....................................... 197 Lesson: Developing Programs and Organizing Developments............... 209 Procedure: Creating Packages ............................................... 213 Procedure: Creating an ABAP Program..................................... 217 Procedure: Creating Transactions ........................................... 226 Procedure: Adding Transactions to your Personal Favorites ............. 227 Exercise 5: Organizing Developments ...................................... 231 Exercise 6: Developing a Simple ABAP Program.......................... 235

2008

© 2008 SAP AG. All rights reserved.

195

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Exercise 7: Create transactions .............................................. 239

196

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 164

Lesson: Repository and Object Navigator

Repository and Object Navigator Lesson Duration: 45 Minutes

Lesson Overview This lesson contains a short description of the Repository and a brief overview of the most important components of the ABAP Workbench. It presents the Object Navigator as a central development tool.

Lesson Objectives After completing this lesson, you will be able to: • • •

Describe the structure of the Repository Name and use the search tools of the Repository Use the Object Navigator for displaying Repository objects

In this lesson, two different aspects should be considered: On the one hand, the participants are confronted by many new SAP-specific terms very quickly. On the other hand, they also learn how to handle the search tools of the ABAP Workbench. Both aspects affect the whole of the remainder of the course: Terms and working techniques constantly come up during the course.

Business Example You are to describe the structure of the Repository, use suitable tools to search for Repository objects and analyze their structure.

2008

© 2008 SAP AG. All rights reserved.

197

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Introduction to the Repository

Figure 69: The Cross-Client Capability of the Repository

The Repository consists of all system development objects - programs, function modules, definitions of database tables, and so on. In the Repository, you have objects delivered by SAP as well as objects defined by the customer. The Repository is in the database and is always independent of the client, which means that a Repository object can be accessed from any client and looks the same in each client in the system. As well as the Repository, the database also contains application and Customizing data which is normally client-dependent. This means that every data record is assigned to a particular client and can normally only be read and changed by users who have logged on to that particular client.

198

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Repository and Object Navigator

Figure 70: Structure of the Repository

The Repository is subdivided according to application components. Within an application component (e.g., MM) there are several packages containing relevant objects for a more detailed logical subdivision. Whenever a Repository object is created, it must be assigned to a package. Some Repository objects can have subobjects that are themselves Repository objects. Furthermore, Repository objects can reference other Repository objects.

Search Tools in the Repository The Repository Information System is suitable for the random (that is, not application-specific) search for Repository objects, such as all programs by a certain developer or all function modules that were changed after a certain date.

2008

© 2008 SAP AG. All rights reserved.

199

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 71: The Repository Information System

You get to the Repository Information System from the SAP Easy Access Menu by choosing Tools → ABAP Workbench → Overview → Information System. When you double-click a certain object type, a selection screen appears allowing you to limit your search.

200

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Repository and Object Navigator

Figure 72: SAP Application Hierarchy

You use the application hierarchy for the application-specific search for Repository objects. There, the hierarchy of the application components is depicted in the form of a tree structure. From the SAP Easy Access Menu, you can easily branch to the SAP application hierarchy by choosing Tools → ABAP Workbench → Overview → Application Hierarchy → SAP. Expanding a component node displays all the packages that are assigned to the corresponding component. You can now select any subtree using the Select button and then navigate directly to the Repository Information System using the Information System button. The system remembers all relevant packages of the selected subtrees and automatically enters them in the selection screen of the information system. This allows you to carry out a search in the previously selected applications.

2008

© 2008 SAP AG. All rights reserved.

201

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Working With the Object Navigator

Figure 73: ABAP Workbench Tools

The ABAP Workbench includes all tools required for creating and editing Repository objects. These tools cover the entire software development cycle. The most important tools are: • • • • • •

The ABAP Editor for editing source code The ABAP Dictionary for editing database table definitions, central data types, and so on The Screen Painter for configuring screens (screens together with functions for user dialogs) The Menu Painter for designing user interfaces (menu bar, standard toolbar, application toolbar, function key settings) The Function Builder for maintaining function modules The Class Builder for maintaining global classes and interfaces

You can call each of these tools explicitly and then load a Repository object for processing. But it is much more elegant and convenient to access them using the Object Navigator. You can have the requested Repository objects listed in this central development tool. All you have to do to edit one of them is to double-click to select it. The corresponding tool is called automatically and includes the selected Repository for displaying or editing.

202

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Repository and Object Navigator

Figure 74: Screen Layout in the Object Navigator

The Object Navigator screen is split into two areas: • •

The navigation area for displaying a hierarchical object list A tool area for displaying and editing a development object using the appropriate tool

You can display or hide the navigation area (“Fullscreen on/off ”). In both areas, you can choose the functions using a context menu, which you access using the right mouse button (or left mouse button if you have set your mouse for left-handed users). The context menu offers only those functions which have been designed for the respective object.

2008

© 2008 SAP AG. All rights reserved.

203

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 75: Working with the Navigation Area

Object lists are displayed in the navigation area. For example, if you choose to display a package there, all of the Repository objects belonging to the specified package are listed. Double-clicking a listed object lets you display or edit it. You can navigate between the object lists that have been previously displayed in the current Object Navigator session (blue arrows). You can add frequently used object lists to your favorites.

204

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Repository and Object Navigator

Figure 76: Functions in the Tool Area

In the tool area, a Repository object is displayed in the corresponding tool. You can navigate between the objects that have been previously displayed in the current Object Navigator session (blue arrows). Furthermore, you can also display a subwindow with the previous navigation history. When you double-click an object in the navigation history, it is displayed in the tool area.

2008

© 2008 SAP AG. All rights reserved.

205

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 77: Synchronizing the Navigation and Tool Areas

Navigation in the navigation area is independent of navigation in the tools area. This allows both areas to be used in a flexible manner. If necessary, you can synchronize both areas as follows: • •

You can display an object in the tool area by double-clicking in the navigation area or by using the corresponding context menu function of the object. You can display the object list of an object that you are currently editing in the tool area by choosing Display Object List in the navigation area.

To create a new object, you can use the context menu for an object type in the corresponding object list. Alternatively, you can use the Edit Object or Other Object ... buttons to create any objects you want.

206

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Repository and Object Navigator

Facilitated Discussion Any questions can now be discussed.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. See list of objectives

2008

© 2008 SAP AG. All rights reserved.

207

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Lesson Summary You should now be able to: • Describe the structure of the Repository • Name and use the search tools of the Repository • Use the Object Navigator for displaying Repository objects

208

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 175

Lesson: Developing Programs and Organizing Developments

Developing Programs and Organizing Developments Lesson Duration: 95 Minutes

Lesson Overview In this lesson you will learn how to create new Repository objects, special packages, programs and transaction codes. You will also learn how change requests in the ABAP Workbench are used in the SAP environment to organize development projects and ensure consistent transport of changes to the productive systems.

Lesson Objectives After completing this lesson, you will be able to: • • • •

Name and use the utilities for orderly software development Create packages Create programs Create transactions

We believe that you learn how to work with the development environment most effectively by doing actual development.

Business Example As part of a development project, you have to create a new package and a new ABAP program and make this program available to users by way of a transaction code.

2008

© 2008 SAP AG. All rights reserved.

209

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Organizing Developments

Figure 78: Transporting Development Objects

Development projects are carried out in a development system. The development objects edited or created in a project are transported to subsequent systems (test and/or production system) on project completion. At the start of a development project the project manager creates a change request, in which he or she names the employees of this project, in the Transport Organizer or directly in the ABAP Workbench. The Transport Organizer then creates a task for each project employee in the change request. When a development object is edited or created, the relevant employee assigns this to the change request. The object is entered into the task of the employee. Thus, all repository objects that an employee works on during a development project are collected within his or her task.

210

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Figure 79: Organization of a Development Project in the Change Request

Organizing a development project using a change request offers the following advantages: • •



Each employee can track and check his or her project-specific activities. The respective development objects can be processed by all employees involved in the project. For those developers who do not belong to the project team, the repository objects remain locked until the project is completed (=change request is released). The joint transport of the development objects processed in the project at the time of project completion (= release of the change request) is automatically ensured by assigning the objects to the change request. The transport route of the involved packages (in which development took place) specifies to which subsequent system they are transported.

Unlike packages that distinguish between Repository objects in a logical and functional way, change requests are project-related and therefore delimit the objects over a period of time. Thus, although a program always belongs to only one package, it can - at different times - belong to different projects.

2008

© 2008 SAP AG. All rights reserved.

211

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Show the request that was created for the course as an example.

212

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

178

Lesson: Developing Programs and Organizing Developments

Creating Packages 1.

Navigate to the Object Navigator. You now have two options: a) In the navigation area, choose the object type Package and enter the name of the package in the input field below. (Make sure you comply with the customer namespace conventions.) Choose Enter. If the specified package does not already exist, the system branches to a dialog for creating a package. b) Choose Edit Object on the initial screen of the Object Navigator. In the dialog box, search for the option of specifying a package and enter the name of the package. Afterwards, click the button for creating the object (F5). Hint: In SAP R/3 Release 4.6, packages are still called development classes. However, they are handled in an almost identical manner to the one described here. There is one minor limitation under Release 4.6a/b: The only option you have for creating a development class is that described in 1b).

2.

Create the attributes of the package to be created.

Figure 80: Setting Package Attributes (Example)

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

213

Unit 6: Introduction to the ABAP Workbench

TAW10_1

The attributes have the following meaning (detailed information can be obtained by using the field help, F1 pushbutton): Application Component Determine the location of the package within the application hierarchy by specifying the corresponding application component. software component For customer developments you should enter HOME as the software component. Transport Layer If you are executing your own developments, you must set up a transport layer for customer developments, which must be specified here. The transport layer determines if the objects of this package are to be transported to a subsequent system and, if so, to which system. Package Type You can choose between three package types: • • •

Standard package (can contain Repository objects and other packages) Main package (can only contain other packages) Structure package (can only contain main packages)

Continued on next page

214

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Figure 81: Specifying a Transport Route

3.

Assign the package to a change request. You can display all change requests in which you have a task using the My Tasks pushbutton. Simply select the relevant request by double-clicking.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

215

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 82: Assignment to a Change Request

Note: The system takes care of the exact assignment for your task. Hint: All repository objects that are created or changed must be assigned to the change request of the respective project. A change request has already been created for the project “Exercises for Training Participants BC400” in this training course. Each group of the course has a task within this change request.

Create a package with the name ZBC400_00 and assign it to a new, small change request with 2 tasks. Then you can do the corresponding exercise.

Develop ABAP programs In this section you will learn how to create programs and transactions in the ABAP Workbench. You will also learn about the purpose of program activation.

216

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

182

Lesson: Developing Programs and Organizing Developments

Creating an ABAP Program 1.

Navigate to the Object Navigator. Three options are available: a) In the navigation area, choose the object type Program and enter the name of the program in the input field below. (Comply with the customer namespace conventions.) Confirm with Enter. If the program does not exist, the system goes to the dialog that lets you create a program. b) Display the package where you want to create the program. You can branch to the dialog for creating a program via the context menu for the package or the Programs node. c) Choose the Edit Object button on the initial screen of the Object Navigator. In the dialog box, look for the option for specifying a program and enter the name of the program. Afterwards, click the button for creating the object (F5).

2.

In this training course, remove the flag for With TOP Include. (Otherwise, your source code would be distributed to several programs.)

3.

Change the title to a self-explanatory short text and, within this course, always choose Executable Program as the program type. All other program attributes are optional. Refer to the F1 help for details.

Figure 83: Creating an ABAP Program

2008

© 2008 SAP AG. All rights reserved.

217

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Introduction to the ABAP Programming Language The ABAP Programming Language ... • • • • • •

Is typed Enables multi-language applications Enables SQL access Has been enhanced as an object-oriented language Is platform-independent Is upward-compatible

It is especially designed for dialog-based business applications. To support the type-specific processing of data, type conversions and type casting are supported. Using translatable text elements, you can develop multi-language applications. The Open SQL standard embedded in ABAP allows direct database accesses. ABAP Objects is the object-oriented enhancement of the ABAP programming language. The ABAP syntax is platform-independent. This means that it always has the same meaning or function, irrespective of the relational database system and operating system for the application and presentation server. Applications implemented in ABAP will also be able to run in future releases (upward compatibility of the language).

218

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Figure 84: General ABAP Syntax I

For ABAP syntax, the following applies in general: • • • • • •

ABAP programs are comprised of individual sentences (statements). The first word in a statement is called an ABAP keyword. Each statement ends with a period. Words must always be separated by at least one space. Statements can be indented as you wish. With keywords, additions and operands, the ABAP runtime system does not differentiate between upper and lowercase. Hint: Although the ABAP runtime system does not differentiate between upper and lowercase, it has become customary to write keywords and their additions in uppercase letters and operands in lowercase. This form of representation will also be used in this course. For indentations and for converting uppercase/lowercase letters, you can use the Pretty Printer (the correspondingly labeled button in the Editor). You can use the following menu path in the Object Navigator to make a user-specific setting for the Pretty Printer: Tools → Settings → ABAP Editor → Pretty Printer.

2008

© 2008 SAP AG. All rights reserved.

219

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 85: General ABAP Syntax II

• • • •

Statements can extend beyond one line. You can have several statements in a single line (though this is not recommended). Lines that begin with an asterisk * in the first column are recognized as comment lines by the ABAP runtime system and are ignored. Double quotations marks " (“inverted commas”) indicate that the remainder of a line is a comment.

You can combine consecutive statements with an identical beginning into a chained statement: • • •

Write the identical beginning part of the records followed by a colon. After the colon, list the end parts of the statements (separated by commas). Blank spaces and line breaks are allowed before and after the separators (colons, commas, periods). Hint: Note that this short form merely represents a simplified form of syntax, and does not offer an improvement in performance. As is otherwise the case, the ABAP runtime system processes each of the individual statements.

220

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Figure 86: Keyword Documentation in the ABAP Editor

There are various ways of navigating to the documentation for an ABAP statement: • •

The F1 key takes you directly to the documentation for the statement on which the cursor is positioned. The i button with the description Help on ... takes you to a dialog box where you can enter the required ABAP statement.

Create a small WRITE ’Hello World’ program. Assign it to your demo package and to the small demo request. You can use this program to demonstrate the following topics such as “active/inactive source”.

The ABAP Editor There are several editors you can use to develop ABAP programs, depending on the release and Support Package level. The choice of editor is user-specific and is made in the Object Navigator by following the menu path Utilities → Settings → ABAP Editor. The latest editor (Front-End Editor (New)) offers a number of new options and easy-to-use additional functions in comparison with the classic editor (Front-End Editor (Old)). It was developed for SAP NetWeaver 7.0. It can also be imported by Support Package for SAP Web Application Server 6.40 and SAP Web Application Server 6.20 (SP 18 or SP 59).

2008

© 2008 SAP AG. All rights reserved.

221

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 87: The previous ABAP Editor

Figure 88: The New ABAP Editor

222

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Some of the important options provided by the new editor: • • • • • •

You can choose different display colors for different objects in the source code. Fonts and font sizes can be set for each individual user. Blocks of source code (loops, conditional branches) can be compressed for display to provide a better overview. You can use bookmarks in order to find relevant points in the source code faster. Displaying line numbers and the current nesting improves orientation. Once you have typed a few characters, the editor automatically suggests complete words for ABAP keywords and data objects. This considerably reduces the actual amount of typing required.

Activating Programs

Figure 89: Inactive and Active Development Objects

Whenever you create a development object, or change and then save it, the system first stores only one inactive version in the Repository. After that, you have an active version and an inactive version of the object. At the end of your object development, you have to activate the inactive “editing version” of the object. This version becomes the new active version of the object.

2008

© 2008 SAP AG. All rights reserved.

223

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Note that the request release and hence the transport of the developed objects are only possible if all objects in the request have been activated. If your program is available in both versions (active and inactive), you can switch between the displays of these two versions by using the corresponding button in the editor. Whenever you activate a program, the system displays a list of all inactive objects that you have processed: Your worklist. Choose those objects that you wish to activate with your current activation transaction. The activation of an object includes the following functions: • • • •

Saving the object as an inactive version Syntax or consistency check of the inactive version Overwriting the previously active version with the inactive version (only after a successful check) Generating the relevant runtime object for later executions, if the object is a program.

Figure 90: Generating Runtime Objects

224

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

When you generate a development object, the system creates a separate runtime object (LOAD compilation) and also stores it in the Repository. This generated version is the version that is executed (interpreted) at runtime. If your program has an inactive version as well as an active version, you can get both versions to run as follows: •



If you start your program using the context menu of the navigation area or by means of a transaction, the active version is used. This means that the LOAD generated for the last activation is executed. By contrast, if you start the inactive version loaded to the editor using the F8 button, a temporary runtime object is generated from it and executed.

This way it is possible to continue the development of a repository object without changing the current system status. All changes to the development object become “visible” system-wide only when the object is activated. Demonstrate the above contents with the program you created earlier and allow the participants to do the corresponding exercise afterwards.

Create transactions Only transactions can be included in a role menu and in a user’s favorites. Hence, if you want to place a program there, you must create a transaction that represents the program and integrate this in the menu. Alternatively, you can start the program by entering the transaction code in the command field.

2008

© 2008 SAP AG. All rights reserved.

225

Unit 6: Introduction to the ABAP Workbench

191

TAW10_1

Creating Transactions 1.

In the Object Navigator, display the object list for your program.

2.

In the navigation area, use the context menu of the program to choose Create → Transaction.

3.

Enter the required transaction code. (Make sure you comply with the customer namespace conventions.) Assign a short text and choose the label Program and Selection Screen (Report Transaction) .

4.

On the next screen, enter the name of the program and choose Professional User Transaction. Under GUI enabled set the indicator SAP GUI for Windows.

Figure 91: Creating a Transaction

226

5.

Save the transaction.

6.

Since each transaction is a Repository object, you must assign it to a package and to a change request on the following screens.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

192

Lesson: Developing Programs and Organizing Developments

Adding Transactions to your Personal Favorites 1.

Navigate to the initial screen (SAP Easy Access menu).

2.

In the Favorites context menu, choose Insert Transaction.

3.

In the dialog box that appears, enter the required transaction code.

Figure 92: Inserting a Transaction Code into the Personal Favorites

Result The short text of the transaction now appears under the Favorites and you can start the corresponding program by double-clicking. Create a transaction for your example program and add it to your personal favorites. Make the participants do the corresponding exercise.

Closing Development Projects Once a project employee has completed the required development task, he or she carries out a quality check and releases the task within the change request.

2008

© 2008 SAP AG. All rights reserved.

227

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Figure 93: The Developer Releases his Task

The corresponding object entries as well as the change locks of the object for third parties that were automatically set at the start of project are transferred from the task to the request. However, all project employees can still edit these objects. Once all the tasks in a change request have been released, the project manager carries out the final check for the objects and releases the change request. This concludes the project.

228

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Figure 94: Closing the Project by Releasing the Request (Project Manager)

When the request is released, all object locks that belong to the request are removed. Copies of the developed objects are exported to the system’s own transport directory where they stay until the system administrator imports them to their intended target system. Another copy of the exported development objects is stored in the system’s own version database. Release your Little Demo Request.

2008

© 2008 SAP AG. All rights reserved.

229

Unit 6: Introduction to the ABAP Workbench

230

© 2008 SAP AG. All rights reserved.

TAW10_1

2008

TAW10_1

195

Lesson: Developing Programs and Organizing Developments

Exercise 5: Organizing Developments Exercise Duration: 5 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Create packages • Assign changes in Repository objects to a change request

Business Example You are a developer for an airline group and are given the task of developing evaluation programs for several airline companies. To group the Repository objects together logically and transport them, you have to create a package.

Task 1: Log on to the training system. 1.

First log on to the operating system, then log on to the training system. To do so, use the client, user name and initial password given to you by your instructor.

2.

Enter a new personal password.

Task 2: Create a package named ZBC400_##, where ## stands for the group number given to you by your instructor. 1.

Open the Object Navigator and create the package there.

2.

On the dialog box that appears, enter a short description for your package. Assign the package to the application component CA and the software component HOME. Take the default value for all the other input fields in the dialog box.

3.

In the following dialog box, assign the package to a change request. Use the change request in which the instructor has already created a task for your user. Hint: To determine this request, choose the Own Requests pushbutton.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

231

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Result You have successfully created your own package. Assign all the Repository objects that you create in the following exercises to this package and use the same change request in each case.

232

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Solution 5: Organizing Developments Task 1: Log on to the training system. 1.

First log on to the operating system, then log on to the training system. To do so, use the client, user name and initial password given to you by your instructor. a)

2.

Carry out this step in the usual way.

Enter a new personal password. a)

Carry out this step in the usual way.

Task 2: Create a package named ZBC400_##, where ## stands for the group number given to you by your instructor. 1.

Open the Object Navigator and create the package there. a)

2.

On the dialog box that appears, enter a short description for your package. Assign the package to the application component CA and the software component HOME. Take the default value for all the other input fields in the dialog box. a)

3.

Perform this step as described in the participants’ handbook.

Perform this step as described in the participants’ handbook.

In the following dialog box, assign the package to a change request. Use the change request in which the instructor has already created a task for your user. Hint: To determine this request, choose the Own Requests pushbutton. a)

Perform this step as described in the participants’ handbook.

Result You have successfully created your own package. Assign all the Repository objects that you create in the following exercises to this package and use the same change request in each case.

2008

© 2008 SAP AG. All rights reserved.

233

Unit 6: Introduction to the ABAP Workbench

234

© 2008 SAP AG. All rights reserved.

TAW10_1

2008

TAW10_1

199

Lesson: Developing Programs and Organizing Developments

Exercise 6: Developing a Simple ABAP Program Exercise Duration: 10 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Create, edit, save, and process ABAP programs • Check ABAP programs for correct syntax • Test and activate ABAP programs

Business Example You are to create an ABAP program that allows simple user input and outputs information to a screen.

Task 1: In your package, create an executable program named ZBC400_##_HELLO. 1.

Create the program ZBC400_##_HELLO without a “TOP include”.

2.

Make sure that the correct program type Executable Program is proposed in the next dialog box and set the status of the program to a meaningful value.

Task 2: Edit the program. Enable the user to enter a name on the selection screen that will be output later in the list, together with the text “Hello”. 1.

Define an input field (parameter) on the selection screen: PARAMETERS pa_name TYPE string.

2008

2.

Implement the output of any text in the list, for example, the text “Hello World!”. To do this, use the ABAP statement WRITE.

3.

Make sure that the following is output in a new line (statement NEW-LINE).

4.

Then implement the output of the text “Hello” and the output of the name that the user has entered. Instead of using two separate statements for this, use a chained statement.

5.

Check your program for syntax errors. Test and activate it.

© 2008 SAP AG. All rights reserved.

235

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Solution 6: Developing a Simple ABAP Program Task 1: In your package, create an executable program named ZBC400_##_HELLO. 1.

Create the program ZBC400_##_HELLO without a “TOP include”. a)

2.

Carry out this step as described in the participants’ handbook.

Make sure that the correct program type Executable Program is proposed in the next dialog box and set the status of the program to a meaningful value. a)

Carry out this step as described in the participants’ handbook. Set the program status to Test Program.

Task 2: Edit the program. Enable the user to enter a name on the selection screen that will be output later in the list, together with the text “Hello”. 1.

Define an input field (parameter) on the selection screen: PARAMETERS pa_name TYPE string. a)

2.

Implement the output of any text in the list, for example, the text “Hello World!”. To do this, use the ABAP statement WRITE. a)

3.

See source code excerpt from the model solution.

Make sure that the following is output in a new line (statement NEW-LINE). a)

4.

See source code excerpt from the model solution.

See source code excerpt from the model solution.

Then implement the output of the text “Hello” and the output of the name that the user has entered. Instead of using two separate statements for this, use a chained statement. a)

See source code excerpt from the model solution.

Continued on next page

236

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

5.

Check your program for syntax errors. Test and activate it. a)

Perform this step as described in the participants’ handbook. Use the Check (Ctrl+F2), Direct (F8) and Activate (Ctrl+F3). pushbuttons

Result Source code excerpt from the model solution: *&---------------------------------------------------------------------* *& Report

BC400_GSS_HELLO

*&---------------------------------------------------------------------* REPORT

bc400_gss_hello.

PARAMETERS: pa_name TYPE string.

WRITE ’Hello World!’.

NEW-LINE.

WRITE: ’Hello’, pa_name.

2008

© 2008 SAP AG. All rights reserved.

237

Unit 6: Introduction to the ABAP Workbench

238

© 2008 SAP AG. All rights reserved.

TAW10_1

2008

TAW10_1

203

Lesson: Developing Programs and Organizing Developments

Exercise 7: Create transactions Exercise Duration: 10 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Create transactions • Define transaction codes as personal favorites

Business Example Users in your company should be able to start their ABAP programs as transactions or define them as personal favorites.

Task 1: Create a report transaction (suggested name: ZBC400_##_HELLO) with which you can start your executable program ZBC400_##_HELLO. 1.

Create the new transaction in your package. Enter a short description and select the appropriate transaction type (start object).

2.

Refer to the program that is to be executed. Choose the correct transaction classification and make sure that it is GUI enabled.

3.

Save and test the transaction.

4.

Confirm that the program can now be started by entering the transaction code in the command field.

Task 2: Include the new transaction in your personal favorites in the SAP Easy Access menu.

2008

1.

Open the SAP Easy Access menu, choose the function Insert Transaction under Favorites and enter the transaction code.

2.

Execute your program by double-clicking the new favorite entry.

© 2008 SAP AG. All rights reserved.

239

Unit 6: Introduction to the ABAP Workbench

TAW10_1

Solution 7: Create transactions Task 1: Create a report transaction (suggested name: ZBC400_##_HELLO) with which you can start your executable program ZBC400_##_HELLO. 1.

Create the new transaction in your package. Enter a short description and select the appropriate transaction type (start object). a)

2.

Refer to the program that is to be executed. Choose the correct transaction classification and make sure that it is GUI enabled. a)

3.

Carry out this step as described in the participants’ handbook. Make sure that the transaction is classified as a Professional User Transaction and set it as GUI enabled for SAP GUI for Windows at least.

Save and test the transaction. a)

4.

Make sure that you select Program and Selection Screen (Report Transaction) as the start object.

Use the

and

pushbuttons for this purpose.

Confirm that the program can now be started by entering the transaction code in the command field. a)

Carry out this step in the usual way.

Task 2: Include the new transaction in your personal favorites in the SAP Easy Access menu. 1.

Open the SAP Easy Access menu, choose the function Insert Transaction under Favorites and enter the transaction code. a)

2.

Execute your program by double-clicking the new favorite entry. a)

240

Carry out this step as described in the participants’ handbook. Carry out this step in the usual way.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Developing Programs and Organizing Developments

Lesson Summary You should now be able to: • Name and use the utilities for orderly software development • Create packages • Create programs • Create transactions

2008

© 2008 SAP AG. All rights reserved.

241

Unit Summary

TAW10_1

Unit Summary You should now be able to: • Describe the structure of the Repository • Name and use the search tools of the Repository • Use the Object Navigator for displaying Repository objects • Name and use the utilities for orderly software development • Create packages • Create programs • Create transactions

Related Information ... Refer to the online documentation for each tool.

242

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

207

Test Your Knowledge

Test Your Knowledge 1.

Repository objects are not client-specific. Determine whether this statement is true or false.

□ □ 2.

True False

Customer objects can be included in SAP packages. Determine whether this statement is true or false.

□ □

True False

3.

Which two tools are used for searching for Repository objects? When should each search tool be used?

4.

You must create a new application program for each language used in the system. Determine whether this statement is true or false.

□ □ 5.

2008

True False

What is a chained statement?

© 2008 SAP AG. All rights reserved.

243

Test Your Knowledge

6.

TAW10_1

When is the transport of development objects for a development request triggered? Choose the correct answer(s).

□ □ □ □

244

A B C D

When an object is saved When an object is activated When a task is released When a request is released

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

209

Test Your Knowledge

Answers 1.

Repository objects are not client-specific. Answer: False Repository objects are cross-client objects and can therefore be used system-wide.

2.

Customer objects can be included in SAP packages. Answer: False Customer objects must be assigned to customer packages.

3.

Which two tools are used for searching for Repository objects? When should each search tool be used? Answer: Repository Information System (for application-independent searches) and the SAP Application Hierarchy (for application-related searches)

4.

You must create a new application program for each language used in the system. Answer: False Only the texts belonging to the program need to be translated. This topic will be discussed later on in the training session.

5.

What is a chained statement? Answer: An abbreviated form of notation for several statements that have the same beginning.

6.

When is the transport of development objects for a development request triggered? Answer: D

2008

© 2008 SAP AG. All rights reserved.

245

Unit Summary

246

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

Unit 7 Basic ABAP Language Elements

211

See the introductory instructor notes in the lessons.

Unit Overview The unit overview lists the individual lessons that make up this unit.

Unit Objectives After completing this unit, you will be able to: • • •

Define elementary data objects (simple variables) Use basic ABAP statements with elementary data objects Execute and analyze programs in debugging mode

Unit Contents Lesson: Working with Elementary Data Objects................................ 248 Exercise 8: Basic ABAP Statements......................................... 275 Exercise 9: Debugging Statements on Elementary Data Objects ....... 281

2008

© 2008 SAP AG. All rights reserved.

247

Unit 7: Basic ABAP Language Elements

Lesson: 212

TAW10_1

Working with Elementary Data Objects Lesson Duration: 75 Minutes

Lesson Overview In this lesson you will become familiar with the difference between data types and data objects (first only the elementary ones) and you will learn how to define and use these in a program. You will also learn some basic ABAP statements. Furthermore, you will find out how to use the ABAP Debugger for analyzing a program flow.

Lesson Objectives After completing this lesson, you will be able to: • • •

Define elementary data objects (simple variables) Use basic ABAP statements with elementary data objects Execute and analyze programs in debugging mode

This lesson discusses basic terms and concepts that are the same in all modern programming languages. The aim is to emphasize the ABAP-specific aspects. However, it could be that your participants’ level of knowledge is less than required. In this case, you will have to proceed more slowly in this lesson. This lesson offers a basic introduction to working with the ABAP Debugger, knowledge which is then gradually supplemented with other aspects (such as modularization, call stack, structure contents, and internal tables) in the lessons that follow.

Business Example You are supposed to use simple variables in your programs and edit these with simple statements. Furthermore, you want to use the ABAP Debugger to find the semantic errors in your programs.

Data Types and Data Objects A formal variable description is called a data type. By contrast, a variable or constant that is defined concretely by means of a data type is called a data object.

248

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Using Data Types The following graphic shows how data types can be used:

Figure 95: Using Data Types

Defining Data Objects The type of a data object defines its technical (and possibly also semantic) properties. Definition of interface parameters The type of an interface parameter determines the type of the actual parameter that is transferred when the modularization unit is called. Definition of input/output fields The type of an input/output field can provide further information in addition to the technical characteristics, such as the field and value input help. In this lesson we will focus on how to use types for defining program-internal variables.

ABAP Standard Types Let’s have a look at the ABAP standard types predefined by SAP (implemented types) first. They are divided into two groups: Complete and incomplete types. The following implemented ABAP standard types are complete. This means that they already contain a type-specific, fixed length specification:

2008

© 2008 SAP AG. All rights reserved.

249

Unit 7: Basic ABAP Language Elements

TAW10_1

Complete ABAP Standard Types D Type for date(D), format: YYYYMMDD, length 8 (fixed) T Type for time (T), format: HHMMSS, length 6 (fixed) I Type for integer (I), length 4 (fixed) F Type for floating point number (F), length 8 (fixed) STRING Type for dynamic length character string XSTRING Type for dynamic length byte sequence (HeXadecimal string) The following standard types do not contain a fixed length (incomplete). When they are used to define data objects, you therefore still need to specify the length of the variable. Incomplete ABAP Standard Types C Type for character string (Character) for which the fixed length is to be specified N Type for numerical character string (Numerical character) for which the fixed length is to be specified X Type for byte sequence (HeXadecimal string) for which the fixed length is to be specified P Type for packed number (Packed number) for which the fixed length is to be specified. (In the definition of a packed number, the number of decimal points may also be specified.)

250

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

For more information about predefined ABAP types, refer to the keyword documentation for the TYPES- or DATA statement.

Local Data Types Using standard types, you can declare local data types in the program that can then be more complete or complex than the underlying standard types. Local data types only exist in the program in question and hence can only be used there. The declaration is made using the TYPES statement.

Figure 96: Declaring Local Types

Hint: There is an alternative syntax for specifying the length with the LENGTH addition that you will often find in older programs. Here, the length is specified in parentheses directly after the name of the type. Examples include: TYPES gty_c_type(3) TYPE c. TYPES gty_p_type(3) TYPE p DECIMALS 2. To improve the readability of your program, you should no longer used this obsolete syntax.

2008

© 2008 SAP AG. All rights reserved.

251

Unit 7: Basic ABAP Language Elements

TAW10_1

Global Data Types A data type defined in the ABAP Dictionary is called global as it can be used throughout the entire system (that means in the entire SAP system in question).

Figure 97: Global Data Types in the Dictionary

In this lesson, we will only describe the data elements and use them as field types. The other global data types are used later in this course.

Definition of Variable Data Objects In the previous section we saw that there are three categories of data types in total:standard, local and global. We now want to use these types to define variables (data objects).

252

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Figure 98: Defining Data Objects

Data objects are always defined with the DATA key word. You can use an ABAP standard type, a local type, or a global type to type a data object. You can refer to an already defined data object when defining additional variables (LIKE addition).

2008

© 2008 SAP AG. All rights reserved.

253

Unit 7: Basic ABAP Language Elements

TAW10_1

Figure 99: Examples of the Definition of Elementary Data Objects

You can use the VALUE addition to preassign the value of an elementary data object. Hint: In the DATA statement, you also have the option of specifying the length in parentheses after the name of the variable, for example: DATA gd_myvar(15) TYPE c. DATA gd_myvar_p(4) TYPE p DECIMALS 2. Here too, it is recommended that for the sake of readability, you use the LENGTH addition. If the length specification is missing from a variable definition, a default length for the (incomplete) standard type is drawn (length 1 for types C, N and X, and length 8 for type P). If the length specification is missing altogether, the standard type C is used. The "DATA gd_myvar." statement without a type and length specification therefore defines a type C variable with length 1. Hint: To improve readability, you should avoid this option of an implicit type or length specification.

254

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

For more details, refer to the keyword documentation for the TYPES- or DATA statement.

Literals, Constants and Text Symbols

Figure 100: Literals and Constants (Fixed Data Objects)

Fixed data objects have a fixed value, which is already fixed when the source text is written and cannot be changed at runtime. Literals and constants belong to the fixed data objects. You can use literals to specify fixed values in your programs. There are numeric literals (specified without quotation marks) and text literals (specified with quotation marks). The figure above shows some examples of literals. You define constants using the CONSTANTS statement. Their type is defined similarly to the definition of elementary data objects. The VALUE addition is mandatory for constants. This is how you define the value of the constants. Hint: If possible, avoid literals completely when using statements. Use constants and text symbols instead. This makes it considerably easier to maintain your program.

2008

© 2008 SAP AG. All rights reserved.

255

Unit 7: Basic ABAP Language Elements

TAW10_1

Figure 101: Text Symbols

A very important principle in ABAP development is multilingual capability. This means that when texts are displayed on the user interface, the logon language of the current user is taken into account. The use of text literals in this context is critical, since the literal only exists in one version in the source code, and is therefore language-independent. You should therefore only create language-dependent texts as text literals for testing purposes. For productive programs that should be executable with different logon languages, the ABAP programming language provides so-called text symbols. Text symbols each belong to a particular program and can be used in it directly. They are stored outside the source code in their own Repository object, the text pool for the program. Text symbols can be translated into different languages and each stored with a language indicator in the text pool (see the above graphic). If the program accesses a text symbol when it is executed, the system automatically takes account of the logon language of the user and supplies the text in this language. A text symbol is identified by means of a three character alphanumeric ID xxx. To use a text symbol in your program, you need to address it as TEXT-xxx, where xxx stands for the three character text symbol ID.

256

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

In order to make specifying a text symbol more intuitive you can also use the following syntax instead of TEXT-xxx: ’...’(xxx). Here, ’...’ should be the text of the text symbol in the original language of the program. There are two options for defining text symbols for your program: • •

From the ABAP Editor, choose Goto → Text Elements → Text Symbols, or You address the text symbol in your source code using the syntax described above and double-click its ID. (Forward navigation).

To translate the text symbols of your program choose Goto → Translation from the menu in the ABAP Editor. Hint: Remember that text elements also have to be activated.

Comparison: Local and Global Data Types

Figure 102: Local vs. Global Data Types

2008

© 2008 SAP AG. All rights reserved.

257

Unit 7: Basic ABAP Language Elements

TAW10_1

Local data types can only be used in the program where they are defined. Global data types, in contrast, can be used throughout the entire system. Apart from that, the latter also have the following advantages: • •



The system-wide usability of global types increases the system’s consistency and their reusability reduces the amount of maintenance required. In the ABAP Dictionary you have the option of generating a where-used list for a global data type. The where-used list lists the Repository objects that use the data type in question. In addition to the technical information, global data types can also contain semantic information that corresponds to the business descriptions of the objects to be defined. They can then also be used for designing screen displays (for example, the short description on the left of the input field).

Local data types should be used only if used exclusively in the program where they are defined and if semantic information does not matter for the definition of the corresponding data objects.

Basic ABAP Statements In this section you will learn how to fill elementary data objects with values and perform calculations in ABAP. You will also be given an introduction to the constructions you can use to control the program flow dependent on the content of the data objects.

258

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Value Assignments

Figure 103: Value Assignments

When the program is started, the program context is loaded into a memory area of the application server and memory is made available for the data objects defined in the program. Every elementary data object is pre-assigned the type-specific initial value, except if a different value was set using the VALUE addition. You can use the MOVE statement to transfer the contents of a data object to another data object. The following two syntax variants have the same effect: • •

MOVE gd_var1 TO gd_var2. gd_var2 = gd_var1.

If both data objects gd_var1 and gd_var2 are of different types, then there is a type conflict. In this case, a type conversion is carried out automatically, if a conversion rule exists. For detailed information on copying and the conversion rules, refer to the keyword documentation for the MOVE statement. The CLEAR statement resets the contents of a data object to the type-related initial value. For detailed information on the initial values for a particular type, refer to the keyword documentation for the CLEAR statement.

2008

© 2008 SAP AG. All rights reserved.

259

Unit 7: Basic ABAP Language Elements

TAW10_1

Calculations and Arithmetic Expressions

Figure 104: Calculations

In ABAP you can program arithmetic expressions nested to any depth. Valid operations include: • • • • • • •

+ * / ** DIV MOD

Addition Subtraction Multiplication Division Exponentiation integral division without remainder Remainder after integral division

Caution: Parentheses and operators are ABAP keywords and must therefore be separated from other words by at least one space. Several functions for different data types are predefined in the ABAP runtime environment. For example, the following statement provides the current length of the content of a character variable. gd_length = STRLEN( gd_cityfrom ).

260

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

In the case of functions, the opening parenthesis is part of the function name. The rest must again be separated by at least one space. In general, the standard algebraic rules apply to the processing sequence: Expressions in parentheses come first, then functions, then powers, then multiplication/division, and finally addition/subtraction. For detailed information on the available operations and functions, refer to the keyword documentation for the COMPUTE statement.

Conditional Branches and Logical Expressions

Figure 105: Conditional Branches

2008

© 2008 SAP AG. All rights reserved.

261

Unit 7: Basic ABAP Language Elements

TAW10_1

In ABAP you have two ways to execute different sequences of statements, depending on certain conditions: •



In the IF construct you can define any logical expressions as check conditions. If the condition is met, the system executes the relevant statement block. Otherwise, the condition specified in the next ELSEIF branch (several branches are possible) is checked. If none of the specified conditions are fulfilled, the ELSE branch is executed - provided it exists. ELSEIF and ELSE branches are optional. For detailed information on formulating a logical expression refer to the keyword documentation on the IF statement. You can use the CASE construct to clearly distinguish cases. The content of the field specified in the CASE part is checked against the data objects listed in the WHEN branches to see whether they match. If the field contents match, the respective statement block is processed. If no comparison is successful, the system executes the OTHERS branch if it is available. Except for the first WHEN branch, all further additions are optional.

In both constructs the condition or match check happens sequentially from the top down. As soon as the statement block of a branch has been executed, the system immediately jumps to ENDIF or ENDCASE. Hint: If you want to implement similarity checks between a field and different values, you should use the CASE-construct in preference to the IF-statement, as it is more transparent and performs better. The following shows several simple examples of using the IF statement.

262

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Figure 106: Examples: IF Statement

Negations are usually formulated by placing the NOT operator before the logical expression. When negating the IS INITIAL query, you can use the special IS NOT INITIAL query. Hint: The formulation IF NOT var IS INITIAL is permitted too, but is not as readable and should therefore be avoided. IF and CASE structures can, of course, be nested in any way you wish. You have to make sure that the logic of every structure is correct here. The inner structures in particular must be closed neatly before the system returns to the external logic, for example: IF . ... IF . ... ENDIF. ENDIF.

2008

© 2008 SAP AG. All rights reserved.

263

Unit 7: Basic ABAP Language Elements

TAW10_1

Loops

Figure 107: Loops

There are four loop constructs in ABAP. In the DO- and WHILE loops, the system field SY-INDEX contains the number of the current loop pass. Hence, querying this system field only makes sense within a loop. In nested loops, SY-INDEX always contains the loop pass number of the loop in which it is located. Unconditional/index-controlled loops The statement block between DO and ENDDO is executed continuously until the loop is left using termination statements such as EXIT. You also have the option of specifying the maximum number of loop passes; otherwise you may get an endless loop. Header-Controlled Loops The statement block between WHILE and ENDWHILE is continuously executed until the specified condition is no longer met. The condition is always checked before executing the statement block.

264

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Read Loops You can use the SELECT loop to read several entries of a database table in succession. In an internal table (table variable in the program), the same read function is implemented with the LOOP loop.

System Fields In the previous sections, several data objects were presented that you can use in ABAP source code without declaring them explicitly beforehand (for example, sy-datum, sy-index). The runtime system uses these system fields to provide the application program with information about the actual system status. Several interesting system fields are illustrated in the following graphic:

Figure 108: Some Interesting System Fields

Other system fields will be discussed in due course in the following lessons. You will find a complete list of system fields in the keyword documentation under the term “System Fields”. Caution: To access system fields in your programs, use read access only.

2008

© 2008 SAP AG. All rights reserved.

265

Unit 7: Basic ABAP Language Elements

TAW10_1

Write access can result in the loss of important information for program parts that follow on from this. Furthermore, you have no control over when the ABAP runtime system changes the content again and thus overwrites the values you have set.

Figure 109: Return Code of an ABAP Statement

One of the most important system fields is the field sy-subrc. With many statements, it is filled by the ABAP runtime system with the corresponding return code to indicate whether the statement could be executed successfully. The value zero means that the statement was executed successfully. Read the keyword documentation for the respective statements to find out if and how this return value is set in individual cases. This is a good point to carry out the first exercise in this lesson (“calculator exercise”)

266

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Dialog Messages

Figure 110: Dialog Messages

You use the MESSAGE statement to send dialog messages to the users of your program. When you do this, you must specify the three digit message number and the message class. Message number and message class clearly identify the message to be displayed. You use the message type to specify where the message is to be displayed. You can test the display behavior for the different message types by means of the DEMO_MESSAGES demo program that is delivered with the SAP standard system. If the specified message contains placeholders, you can supply them with values from your program by using the WITH addition. Instead of the placeholders, the transferred values then appear in the displayed message text. For further information on the syntactical alternatives to the MESSAGE statement, refer to the keyword documentation.

2008

© 2008 SAP AG. All rights reserved.

267

Unit 7: Basic ABAP Language Elements

TAW10_1

If you have used a WRITE statement to output an error message in one of the programs you created previously, you can now replace this with MESSAGE, with messages 050 and 051 from the message class BC400, for example. Use message type i and explain that this can be improved later on using event control.

Working with the ABAP Debugger

Figure 111: Execute a program in debugging mode

The program BC400_DED_DEBUGGER from the package BC400 is a suitable choice for demonstrating debugging. Alternatively, you can also debug a program with a selection screen, in order to activate the Debugger after the selection screen using /h. There are several options for starting a program in debugging mode from within the Object Navigator: a) In the navigation area for the selected program, choose the context menu Execute → Debugging.

268

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

b) In the editor area, select the requested program line from which you wish to debug. Choose the Set/Delete breakpoint button. Afterwards, start the program by choosing F8 or in the navigation area via the context menu Execute → Direct. (The above-described setting of a breakpoint in the editor is only possible for active source texts.)

Figure 112: Switching to Debugging Mode at Runtime

If you want to “debug” a certain function of a program, first start the program without the Debugger and then switch to debug mode immediately before executing the function (e.g. pushbutton). There are two ways of doing this: a) Choose System → Utilities → Debugging ABAP (or screen). b) Enter /h in the command field in the standard toolbar and press Enter.

2008

© 2008 SAP AG. All rights reserved.

269

Unit 7: Basic ABAP Language Elements

TAW10_1

Figure 113: ABAP Debugger: Single Step and Field Contents

In the Debugger, you can choose single step processing to execute the program statement by statement. Furthermore, you can display data objects and their current content in the variable display. Simply enter the name of the data object there or copy them by double-clicking on corresponding data objects in the source code. Only the classic debugger is available with SAP Web Application Server 6.40 and below. With higher release levels you can use both the new and the classic debugger. You can switch easily from the new to the classic ABAP Debugger while debugging by choosing Debugger → Switch to Classic ABAP Debugger from the menu. In the classic debugger you can display the contents of up to eight data objects. To do this, proceed as you would with the new debugger.

270

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Figure 114: ABAP Debugger: Breakpoints

In the new debugger, you can set a breakpoint with a single click before the line in the source code (in the classic debugger you do this with a double-click). You can also set a breakpoint for specific ABAP statements: Breakpoints → Breakpoint at → Statement. If you choose Continue, the program is executed up to the next breakpoint. The set breakpoints are only valid for the current debugger session. However, if you press Save, the breakpoints will stay in place for you for the duration of your current SAP session.

2008

© 2008 SAP AG. All rights reserved.

271

Unit 7: Basic ABAP Language Elements

TAW10_1

Figure 115: ABAP Debugger: Tracing Data Changes

Watchpoints are breakpoints that depend on the field content. If you set a watchpoint without specifying a relational operator/comparative value on a field and choose Continue, then the program is executed until the content of the field changes. However, if you have specified the relational operator and comparative value, then - once you choose Continue - the program will be executed until the specified condition is met. In the classic debugger you can set a maximum of only 10 watchpoints. However, you can link them in the same way as in the new debugger using a logical operator (AND or OR).

272

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Figure 116: ABAP Debugger: Changing Field Contents

If you want to change the content of a field during debugging, double-click on the pencil icon in the variable display. The value is then ready for input. Now change the field value and confirm this by choosing ENTER. The value is now changed while the debugger is running. In the classic debugger you can change the content directly in the field view. You then click on the pencil icon to accept the changed value.

2008

© 2008 SAP AG. All rights reserved.

273

Unit 7: Basic ABAP Language Elements

TAW10_1

Figure 117: Additional Functions of the New Debugger

A number of useful functions have been added in the new debugger (most, however, were first incorporated with the SAP NetWeaver 7.0 release). In the Object Navigator you can determine which debugger you want to use as standard by choosing Utilities → Settings → ABAP Editor → Debugging. The participants should do the debugger exercise here.

274

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

239

Lesson: Working with Elementary Data Objects

Exercise 8: Basic ABAP Statements Exercise Duration: 30 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Define elementary data objects • Assign values • Implement conditional branching • Perform calculations

Business Example You are to create a simple ABAP program for the four basic calculation types. You must be able to enter the values and the arithmetic operator on a selection screen. The result should be displayed in a list. Template: None Solution: BC400_DOS_COMPUTE

Task 1: Create a program. 1.

Create the executable program ZBC400_##_COMPUTE without a TOP include and assign it to your package.

Task 2: Define a selection screen with three input parameters. 1.

Define two input parameters for integers as operands (suggested names: pa_int1, pa_int2) and one as an arithmetic operator of one character in length (suggested name:pa_op). Use the ABAP keyword PARAMETERS to do this.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

275

Unit 7: Basic ABAP Language Elements

TAW10_1

Task 3: Implement the basic calculation types and output the result in a list. 1.

Create an elementary data object (suggested name: gv_result) using the DATA statement for the calculation result. Define it as a packed number type of 16 digits in length and two decimal places.

2.

Calculate the result dependent on the specified arithmetic operator. Use the CASE statement for a case distinction.

3.

Output the result in a list using the WRITE statement. If you want to output texts in the process, make sure that these texts can be translated and are displayed as language-dependent. Hint: Create text symbols and use these instead of literals.

Task 4: Catch any errors that may occur. 1.

Display an error message on the list if the user has specified an invalid arithmetic operator. Use the IF statement for checking. Use a translatable text.

2.

Display an error message on the list if the user tries to divide by zero.

Task 5: Activate and test your program.

276

1.

Activate your program.

2.

Test your program.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Solution 8: Basic ABAP Statements Task 1: Create a program. 1.

Create the executable program ZBC400_##_COMPUTE without a TOP include and assign it to your package. a)

Perform this step in the same way as in the previous exercises.

Task 2: Define a selection screen with three input parameters. 1.

Define two input parameters for integers as operands (suggested names: pa_int1, pa_int2) and one as an arithmetic operator of one character in length (suggested name:pa_op). Use the ABAP keyword PARAMETERS to do this. a)

See source code excerpt from the model solution.

Task 3: Implement the basic calculation types and output the result in a list. 1.

Create an elementary data object (suggested name: gv_result) using the DATA statement for the calculation result. Define it as a packed number type of 16 digits in length and two decimal places. a)

2.

Calculate the result dependent on the specified arithmetic operator. Use the CASE statement for a case distinction. a)

3.

See source code excerpt from the model solution.

See source code excerpt from the model solution.

Output the result in a list using the WRITE statement. If you want to output texts in the process, make sure that these texts can be translated and are displayed as language-dependent. Hint: Create text symbols and use these instead of literals. a)

See source code excerpt from the model solution.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

277

Unit 7: Basic ABAP Language Elements

TAW10_1

Task 4: Catch any errors that may occur. 1.

Display an error message on the list if the user has specified an invalid arithmetic operator. Use the IF statement for checking. Use a translatable text. a)

2.

See source code excerpt from the model solution.

Display an error message on the list if the user tries to divide by zero. a)

See source code excerpt from the model solution.

Task 5: Activate and test your program. 1.

Activate your program. a)

2.

In the ABAP Editor toolbar, choose the

pushbutton.

Test your program. pushbutton.

a)

In the ABAP Editor toolbar, choose the

b)

Supply the selection screen parameters with values and choose

c)

Check the result. Test the message output in the event of an error too.

.

Result Source code excerpt from the model solution: *&---------------------------------------------------------------------* *& Report

BC400_DOS_COMPUTE

*& *&---------------------------------------------------------------------* *& *& Simple calculator *&---------------------------------------------------------------------* REPORT

bc400_dos_compute.

PARAMETERS: pa_int1

TYPE i,

pa_op

TYPE c LENGTH 1,

pa_int2

TYPE i.

DATA gv_result TYPE p LENGTH 16 DECIMALS 2.

Continued on next page

278

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

IF ( pa_op = ’+’ OR pa_op = ’-’ OR pa_op = ’*’ OR pa_op = ’/’ AND pa_int2 0 ).

CASE pa_op. WHEN ’+’. gv_result = pa_int1 + pa_int2. WHEN ’-’. gv_result = pa_int1 - pa_int2. WHEN ’*’. gv_result = pa_int1 * pa_int2. WHEN ’/’. gv_result = pa_int1 / pa_int2. ENDCASE.

WRITE: ’Result’(res), gv_result.

ELSEIF pa_op = ’/’ AND pa_int2 = 0.

WRITE ’No division by zero!’(dbz).

ELSE.

WRITE ’Invalid operator!’(iop).

ENDIF.

2008

© 2008 SAP AG. All rights reserved.

279

Unit 7: Basic ABAP Language Elements

280

© 2008 SAP AG. All rights reserved.

TAW10_1

2008

TAW10_1

245

Lesson: Working with Elementary Data Objects

Exercise 9: Debugging Statements on Elementary Data Objects Exercise Duration: 25 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Execute a program in the Debugger • Set breakpoints in the Debugger • Set content-dependent breakpoints (watchpoints) • Change field contents during debugging

Business Example You are given a program and have to use the Debugger to work out its semantic behavior.

Task 1: Execute the program BC400_DED_DEBUG_EXERCISE in debugging mode and trace the content of GV_COUNT. 1.

Start the program BC400_DED_DEBUG_EXERCISE in debugging mode by way of the object list in the Object Navigator.

2.

First check the content of the data objects in the program at the start. To do this, include all the data objects defined in the program and the system field SY-INDEX in the variable view. Take a look at the typing of the fields too.

Task 2: Analyze the WHILE loop by setting breakpoints and tracking the content of GV_COUNT and SY-INDEX. 1.

Follow the program flow in single steps until you have run through the WHILE loop twice. In each case, track how the field contents change.

2.

Set a breakpoint at the statement that assigns a new value to the data object Continue to restart the program and observe the GV_COUNT. Choose changes to the field contents. Repeat the final step until the program has run its course and the list is displayed. Continued on next page

2008

© 2008 SAP AG. All rights reserved.

281

Unit 7: Basic ABAP Language Elements

3.

TAW10_1

Execute the program again in debugging mode. Now analyze the change to the data object GV_COUNT by creating a watchpoint for the field. Choose Continue to restart the program and observe the change to the content of the data object and the system field SY-INDEX.

Task 3: Analyze the nested DO loops by setting a breakpoint at the WRITE and EXIT statements. 1.

Restart the program in debugging mode. Set breakpoints at all WRITE and EXIT statements in the program (choose Breakpoints → Breakpoint at → Breakpoint at Statement). Analyze how the contents of the loop counters GV_IDX_OUTER and GV_IDX_INNER change, the information that is output, and when it is output.

2.

What effect does the EXIT statement have in a loop?

Task 4: Use the Debugger option to change the program flow in such a way that the last statement in the program is executed too. 1.

282

Execute the last statement in the program. Use the option of changing the content of data objects in debugging mode.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Solution 9: Debugging Statements on Elementary Data Objects Task 1: Execute the program BC400_DED_DEBUG_EXERCISE in debugging mode and trace the content of GV_COUNT. 1.

2.

Start the program BC400_DED_DEBUG_EXERCISE in debugging mode by way of the object list in the Object Navigator. a)

Display the program in the Object Navigator, right click on the program and choose Execute → Debugging.

b)

Alternatively, in the editor, you can also set a breakpoint at the first executable statement.

First check the content of the data objects in the program at the start. To do this, include all the data objects defined in the program and the system field SY-INDEX in the variable view. Take a look at the typing of the fields too. a)

In the source code in the Debugger, double-click on each of the fields GV_COUNT, GV_IDX_INNER, GV_IDX_OUTER and SY-INDEX. Scroll to the right of the variable display in order to display the field types.

Task 2: Analyze the WHILE loop by setting breakpoints and tracking the content of GV_COUNT and SY-INDEX. 1.

Follow the program flow in single steps until you have run through the WHILE loop twice. In each case, track how the field contents change. a)

2.

You can carry out the single step analysis by choosing Debugger → Single pushbutton, or the F5 key. Step, the

Set a breakpoint at the statement that assigns a new value to the data object Continue to restart the program and observe the GV_COUNT. Choose changes to the field contents. Repeat the final step until the program has run its course and the list is displayed. a)

Click once in the first column in front of the value assignment to set a breakpoint there.

b)

Choose Debugger → Continue from the menu, the

pushbutton, or F8. Continued on next page

2008

© 2008 SAP AG. All rights reserved.

283

Unit 7: Basic ABAP Language Elements

3.

TAW10_1

Execute the program again in debugging mode. Now analyze the change to the data object GV_COUNT by creating a watchpoint for the field. Choose Continue to restart the program and observe the change to the content of the data object and the system field SY-INDEX. a)

To access the Debugger, repeat the first step in this exercise.

b)

Position the cursor on the data object GV_COUNT in the source code displayed in the Debugger. Click on the Watchpoint pushbutton and confirm the dialog box that appears with .

c)

To restart the program, choose

Continue.

Task 3: Analyze the nested DO loops by setting a breakpoint at the WRITE and EXIT statements. 1.

2.

Restart the program in debugging mode. Set breakpoints at all WRITE and EXIT statements in the program (choose Breakpoints → Breakpoint at → Breakpoint at Statement). Analyze how the contents of the loop counters GV_IDX_OUTER and GV_IDX_INNER change, the information that is output, and when it is output. a)

To access the Debugger, proceed as before.

b)

In the Debugger, choose Breakpoints → Breakpoint at → Breakpoint at Statement and enter the WRITE statement in the dialog box that appears. Confirm the dialog box that appears with .

c)

Choose

Continue and analyze the program flow.

What effect does the EXIT statement have in a loop? Answer: The EXIT statement causes the system to cease processing the current DO loop.

Continued on next page

284

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Working with Elementary Data Objects

Task 4: Use the Debugger option to change the program flow in such a way that the last statement in the program is executed too. 1.

Execute the last statement in the program. Use the option of changing the content of data objects in debugging mode. a)

Set a breakpoint at the last IF statement and choose Continue to run the program to this point.

b)

Include the field GV_IDX_INNER in the variable view. Double-click the icon in the variable view. Change the field value from 6 to 5 and confirm the change by choosing Enter.

c)

Restart the program by choosing either Single Step or Continue. Note: Alternatively, you can also execute the last statement using the Goto Statement function. In debugging mode, place the cursor on this line at any event and choose Debugger → Goto Statement.

2008

© 2008 SAP AG. All rights reserved.

285

Unit 7: Basic ABAP Language Elements

TAW10_1

Lesson Summary You should now be able to: • Define elementary data objects (simple variables) • Use basic ABAP statements with elementary data objects • Execute and analyze programs in debugging mode

286

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Unit Summary

Unit Summary You should now be able to: • Define elementary data objects (simple variables) • Use basic ABAP statements with elementary data objects • Execute and analyze programs in debugging mode

Related Information ... Refer to the online documentation for the relevant ABAP statements.

2008

© 2008 SAP AG. All rights reserved.

287

Unit Summary

288

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

253

2008

Test Your Knowledge

Test Your Knowledge 1.

Which of the ABAP standard types are numeric?

2.

Is it possible to define other types in addition to the standard types? If yes, where?

3.

Which ABAP keyword do you use to define local types?

4.

In which system field will you find the loop counter for the DO and WHILE loops, respectively?

© 2008 SAP AG. All rights reserved.

289

Test Your Knowledge

254

TAW10_1

Answers 1.

Which of the ABAP standard types are numeric? Answer: I, F, P N is not a numeric type, but the type for character strings that may contain decimal numbers only.

2.

Is it possible to define other types in addition to the standard types? If yes, where? Answer: Yes, in the ABAP Dictionary (global types) and in the program (local types).

3.

Which ABAP keyword do you use to define local types? Answer: TYPES

4.

In which system field will you find the loop counter for the DO and WHILE loops, respectively? Answer: SY-INDEX

290

© 2008 SAP AG. All rights reserved.

2008

Unit 8 Modularization

255

See the introductory instructor notes in the lessons.

Unit Overview The unit overview lists the individual lessons that make up this unit.

Unit Objectives After completing this unit, you will be able to: • • • • • • • • • • • • • • •

2008

Name the basic modularization techniques Define subroutines Call subroutines Analyze the execution of subroutines in debugging mode Search for function modules Acquire information on the functionality and use of function modules Call function modules in your program Create a function group Create a function module Explain the role of BAPIs and identify their special properties Explain the basic terms of object-oriented programming Acquire information about the function and use of global classes and their methods Call methods of global classes in your programs Create global classes Create and implement simple methods in global classes

© 2008 SAP AG. All rights reserved.

291

Unit 8: Modularization



TAW10_1

Describe how local classes are defined, implemented and used

Unit Contents Lesson: Modularization - Basics and Overview................................. 293 Lesson: Modularization with Subroutines........................................ 302 Exercise 10: Subroutines...................................................... 317 Lesson: Modularization with Function Modules................................. 324 Exercise 11: Using a Function Module ...................................... 343 Exercise 12: Creating a Function Group .................................... 351 Exercise 13: Creating and Using a Function Module ...................... 353 Lesson: Modularization with Methods of Global Classes...................... 360 Exercise 14: Using Global Static Methods .................................. 377 Exercise 15: Creating Global Classes ....................................... 383 Exercise 16: Creating and Using Global Static Methods.................. 385 Lesson: Modularization with Methods of Local Classes (Preview) ........... 392

292

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 257

Lesson: Modularization - Basics and Overview

Modularization - Basics and Overview Lesson Duration: 10 Minutes

Lesson Overview In this lesson you will learn why it makes sense to store parts of programs in modularization units. You will also gain an overview of the various modularization options in ABAP programs.

Lesson Objectives After completing this lesson, you will be able to: •

Name the basic modularization techniques

Participants with programming experience should have no problems with this lesson. It is often the case, however, that some participants are unfamiliar with the idea and advantages of modularization units. This lesson is aimed at those participants. The instructor should therefore ascertain at the start of this lesson whether a basic introduction is practical or necessary.

Business Example An employee in quality assurance has discovered than many program parts are frequently repeated. Your task is to find out which modularization techniques can be implemented.

2008

© 2008 SAP AG. All rights reserved.

293

Unit 8: Modularization

TAW10_1

Modularization Technique

Figure 118: Options for Using Modularization Units

A modularization unit is a part of a program in which a particular function is encapsulated. You store part of the source code in a module to improve the transparency of the program as well as to use the corresponding function in the program several times without having to re-implement the entire source code on each occasion (see above graphic). The improvement in transparency is a result of the program becoming more function-oriented: It divides the overall task into subfunctions, which are the responsibility of corresponding modularization units. Modularization makes it easier to maintain programs, since you only need to make changes to the function or corrections in the respective modularization units and not at various points in the main program. Furthermore, you can process a call “as a unit” in the Debugger while executing your program and then look at the result. This usually makes it easier to find the source of the error.

294

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization - Basics and Overview

Local Program Modularization

Figure 119: Local Program Modularization

At this point, do not answer questions from the participants regarding the actual implementation in detail. A precise explanation of the syntax and so on is provided in another lesson. In principle, it is also possible to call a subroutine of an external program (see the online documentation for external program calls). You should not explain this technique in detail in order to avoid confusion. If participants nevertheless address this issue, refer them to the online documentation. You should also point out that this technique contradicts the principle of encapsulating data and functions and should therefore not be used. There are two techniques for local program modularization in the ABAP programming language: • •

Subroutines, also known as form routines Methods in local classes

With both local modularization techniques, modularization units are only available in the program in which they were implemented. To call the local module, no other program must be loaded to the user context at runtime. Local classes, methods and

2008

© 2008 SAP AG. All rights reserved.

295

Unit 8: Modularization

TAW10_1

subroutines can have the same name in different programs without this resulting in conflicts. This is because the source code for the programs is handled separately in the main memory of the application server. Hint: For historical reasons it is technically possible to call a subroutine from another program too. You should not use this option, however, since this technique contradicts the principle of encapsulation of data and functions.

Global Modularization

Figure 120: Global Modularization

Give just a general description of the techniques here too. A precise explanation will be provided in another lesson.

296

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization - Basics and Overview

There are also two techniques for global modularization in the ABAP programming language: • •

Function modules that are organized in function groups Methods in global classes

Globally defined modularization units can be used by any number of programs at the same time. The globally defined modularization units are stored centrally in the Repository and loaded when required (in other words, when called) into the context of the calling program.

Encapsulating Data

Figure 121: Separating Data

This slide shows the encapsulation of data using a function group and a global class, since data can be encapsulated most effectively with them. Point out, however, that the local modularization techniques encapsulate data too. A detailed explanation of this will be given in another lesson.

2008

© 2008 SAP AG. All rights reserved.

297

Unit 8: Modularization

TAW10_1

Ideally, the modularization units that are called do not use the data objects of the calling program directly. This applies the other way round too: Data in the modularization units should not be changed directly by the calling program. This principle is known as data encapsulation. Data encapsulation is an important aid in developing transparent, maintainable source code. It makes it far easier to comprehend whereabouts in the program the contents of data objects were changed. In addition, it is easier to ensure that data within the modularization units is changed consistently if, for example, the contents of several data objects within a modularization unit are mutually dependent. We will take as an example a modularization unit in which a series of invoice documents are processed. Serious consequences would arise if different invoice numbers were entered for invoice items that belonged to one another. If open external access to individual invoice items were possible, this is what could occur. It would then be difficult for those responsible for the modularization unit to determine the cause of the data inconsistency.

Data Transports, Parameters and Interface

Figure 122: Data Transports Between the Program and the Modularization Unit

298

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization - Basics and Overview

The interface and signature are illustrated by means of the function group and global class on this slide too. You should point out, however, that the techniques of local modularization also have an interface or signature. A detailed explanation of this will be given in another lesson. Parameters are used to exchange data between the program and the module. The total number of parameters in a modularization unit is termed the interface or signature. The parameters available are determined when you define the modularization unit. Parameters are differentiated on the basis of whether they are used to pass data to the modularization unit (importing parameters), return data from the modularization unit to the caller (exporting parameters), or pass data to the modularization unit and return the data after it has been changed (changing parameters). Hint: With subroutines (form routines), only changing parameters and the very specialized using parameters are available, which severely restricts your options for controlling the data transport. This is another good reason for using local classes for local program modularization where possible.

2008

© 2008 SAP AG. All rights reserved.

299

Unit 8: Modularization

TAW10_1

Facilitated Discussion Here you have an opportunity to explain any open issues that remain.

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions. See list of objectives

300

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization - Basics and Overview

Lesson Summary You should now be able to: • Name the basic modularization techniques

2008

© 2008 SAP AG. All rights reserved.

301

Unit 8: Modularization

Lesson: 264

TAW10_1

Modularization with Subroutines Lesson Duration: 60 Minutes

Lesson Overview In this lesson you will learn how to employ subroutines in ABAP programs. Furthermore, you will learn how the interface of a subroutine is used to pass parameters and how the different transfer types are used.

Lesson Objectives After completing this lesson, you will be able to: • • •

Define subroutines Call subroutines Analyze the execution of subroutines in debugging mode

Modularization with subroutines is one of the oldest programming techniques in ABAP. It has a whole range of shortcomings, in particular when used to encapsulate data and pass parameters. It is therefore important to point out to the participants that they should not create subroutines in new programs if it can be avoided. They should use local classes for local modularization instead. Nevertheless, you should still explain the basic required knowledge in this lesson and practice how to create and use subroutines. There are still a large number of old programs in which subroutines were used for modularization. The participants will not be able to understand these programs unless they know something about subroutines.

Business Example You need to structure your program and encapsulate source code that is executed several times in a subroutine.

302

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Internal Program Modularization with Subroutines

Figure 123: Simple Example of a Subroutine

Show the example on the slide in a simple report and call the list output several times. If you have any participants on the course who have already heard of include technology and want to know more about it, you can explain it briefly. However, you should emphasize that the main program and relevant includes are interpreted as a large single program for the ABAP interpreter at runtime. A subroutine is a modularization unit within a program. For the ABAP interpreter, it is always part of the main program. No parameters are used in the above example, which makes the subroutine call very simple to structure. A subroutine normally uses values from data objects and returns values too. The next graphic demonstrates how these variables can be used in the subroutine.

2008

© 2008 SAP AG. All rights reserved.

303

Unit 8: Modularization

TAW10_1

Parameter Definition for Subroutines

Figure 124: Passing Parameters - Visibility of Global Variables

If variables were defined in the main program, these are visible globally within the program and can be changed at any point on the entire program. This means that subroutines that are defined within the main program can change them too.

304

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Figure 125: Passing Parameters - Defining an Interface

You can address all (global) variables defined in the main program from a subroutine. However, in order to call a subroutine with different data objects for each situation, you do not use global variables in the subroutine but placeholders. These are replaced with the required global variables when the subroutine is called. These placeholders are called formal parameters and together form the subroutine interface. You have to declare the interface when you define the subroutine. When the subroutine is called, formal parameters must be specialized by means of corresponding global variables (actual parameters), in order to reference the subroutine processing to real variables. This assignment of actual parameters to formal parameters when calling a subroutine is called parameter passing.

2008

© 2008 SAP AG. All rights reserved.

305

Unit 8: Modularization

TAW10_1

Figure 126: Ways of Passing Interface Parameters

The way these main program variables are passed to the formal parameters of the subroutine is called the pass type and is specified for each parameter in the interface of the subroutine. There are three pass types for subroutines: call by value A copy is made of the actual parameter. This copy is assigned to the formal parameter. Any value assignments to the corresponding formal parameter in the subroutine therefore refer only to the copy of the actual parameter and not the original. You use this pass type to make the value of a global variable available to the subroutine (in the form of a variable copy) without making it possible to change the respective global variable (protecting the original). Please note, however, that creating copies, especially for large internal tables, can be time-consuming.

306

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

call by value and result The same applies for this pass type as for “call by value”. However, at the regular end of the subroutine, the value that was changed to this point in the copy is written back to the original. If the program is prematurely terminated by a STOP-statement or a type E user message, the writing back of the value is suppressed. You use this pass type to transfer the value of a global variable to the subroutine and to write the fully processed final value of the copy back to the original. Note, however, that it can be time-consuming to create copies and write back values, especially for large internal tables. call by reference The actual parameter is assigned directly to the formal parameter. This means that value assignments to the formal parameter are carried out directly on the actual parameter. You use this pass type if you want to run subroutine processing directly on the specified actual parameter. It is a useful way of avoiding the time-consuming creation of copies for large internal tables.

Figure 127: Defining and Calling Subroutines

2008

© 2008 SAP AG. All rights reserved.

307

Unit 8: Modularization

TAW10_1

Structure of a subroutine • • • •

A subroutine is introduced with FORM. You specify the name and the interface of the subroutine after FORM. The statements of the subroutine then follow. The ENDFORM statement concludes the subroutine.

In the interface definition you list the formal parameters of the subroutine (here: f1, f2, f3) and type them if necessary. The required pass type has to be specified for each parameter: call by value You list each of the formal parameters that should have the pass type “Call by Value” (here: f1) with the VALUE prefix under USING.(Refer to the above graphic for the syntax.) call by value and result You list each of the formal parameters that should have the pass type “Call by Value and Result” (here: f2) with the VALUE prefix under CHANGING. (Refer to the above graphic for the syntax.) call by reference You list each of the formal parameters that should have the pass type “Call by Reference” (here: f3) without the VALUE prefix under CHANGING. (Refer to the above graphic for the syntax.) Hint: A parameter without the VALUE prefix, but placed in the USING section also has the pass type “Call by Reference”. However, this declaration syntax only makes sense for formal parameters that are passed to larger internal tables, which are not to be changed in the subroutine (documentation via USING) but are to be passed using “Call by Reference” in order to avoid making time-consuming copies. When the subroutine is called, the actual parameters to be transferred without the VALUE-prefix are specified under USING or CHANGING. The order of specification determines their assignment to the formal parameters. In the example in the above graphic, a is passed to f1, b to f2, and c to f3.

308

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Figure 128: Typing the Interface Parameters

As a demonstration here, enhance the calculator with a percentage calculation function (see model solution BC400_MOS_SUBROUTINE). The participants will reproduce this later in an exercise. A formal parameter is typed generically if it is typed using TYPE ANY, or not typed at all. Actual parameters of any type can be transferred to such a parameter. At runtime, the type of the actual parameter is determined and assigned to the formal parameter (type inheritance) when the subroutine is called. However, if the statements in the subroutine are not suited to the inherited type, a runtime error may occur (type conflict). Hence, generic typing should only be used if the type of the actual parameter has yet to be determined when the program is created or if it can vary at runtime (dynamic programming). You implement the concrete typing of a formal parameter by specifying a global or built-in type in the TYPE addition. In doing so, you determine that only actual parameters of the specified type can be passed to the subroutine. A violation of the type consistency between formal and actual parameters is already picked up in the syntax check. This increases the stability of your program as type conflicts in statements within the subroutine are prevented.

2008

© 2008 SAP AG. All rights reserved.

309

Unit 8: Modularization

TAW10_1

If you type with the standard types P, N, C or X, the missing characteristic “field length” is only passed on from the actual parameter to the formal parameter at runtime. You achieve complete typing with these types (that is, including the field length) by defining and specifying locally defined types. Hint: You will be introduced to structures and internal tables in a subsequent lesson. Formal parameters for such data objects must always be typed in order for their components to be accessed within the subroutine.

Figure 129: Typing the Interface Parameter for Structures and Internal Tables

310

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Local and Global Data Objects

Figure 130: Visibility of Global and Local Data Objects

Variables defined in the main program are global data objects. They are visible (can be addressed) in the entire main program as well as in every subroutine called. Variables defined within a subroutine are called local since they only exist in the relevant subroutine - just like formal parameters. Memory space for formal parameters and local data objects is only allocated when the subroutine is called and is released again after execution. The formal parameters and local data objects of a subroutine cannot have the same names. If there is a global data object with the same name as a formal parameter or a local data object, the formal parameter or local data object is addressed within the subroutine and the global data object is addressed outside the subroutine. This is the so-called shadow rule: Within a subroutine the local data object “shadows” the global one with the same name.

2008

© 2008 SAP AG. All rights reserved.

311

Unit 8: Modularization

TAW10_1

You have the opportunity to show the demo program BC400_MOD_LOCAL_VARIABLES and debug it here. Demonstrate how in the first case it is possible to access the global data object directly, and in the second case how the global data object is shadowed. To clearly label your program-internal objects you should, for example, use the following prefixes for subroutines: g... for “global data objects” p... for “using parameters” c... for “changing parameters” l... for “local data objects”

Figure 131: Syntax Example: Local Auxiliary Variables for Rounding

In the syntax example above, the result of the percentage calculation should be rounded internally to the nearest whole number with one decimal place, but nonetheless returned with two decimal places. To do this, you create a local variable with only one decimal place and store the result of the calculation there first. The runtime system automatically rounds the result to the nearest whole number in accordance with the available number of decimal places. When you then copy the result to the return parameter, a zero is merely added for the second decimal place.

312

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Calling Subroutines

Figure 132: Implementing a Subroutine Call

The PERFORM-statement for calling a subroutine can be generated into your source code. First, define the subroutine and then save your main program. The newly-defined subroutine appears in the navigation area. Move it to the required call point in your program by drag and drop. All you have to do now is replace the formal parameters in the generated source code with corresponding actual parameters. (Alternatively, you can also implement the generation of the call using the “Pattern” pushbutton in the ABAP Editor.) The advantage of generating the call is that it is impossible to forget or mix parameters.

2008

© 2008 SAP AG. All rights reserved.

313

Unit 8: Modularization

TAW10_1

Modularization Units in the Debugger

Figure 133: Subroutines in Debugging Mode

If the current statement is a subroutine call, you can execute the entire subroutine without stopping by choosing Execute . Processing only stops once the subroutine has been completed. In contrast, you can use Single Step to stop at the first statement of the subroutine and trace its operations in more detail. If the current statement is located in a subroutine, you can execute the rest of the subroutine without stopping by choosing Return. Processing only stops once the subroutine has been completed. All the Debugger control functions (single step, execute, return, and continue) are also available in the classic ABAP Debugger with the same meaning.

314

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Figure 134: Debugging - Call Stack

Under the Standard tab page in the Debugger you can see from which programs the subroutine was called. The tool for this is the Call Stack.

2008

© 2008 SAP AG. All rights reserved.

315

Unit 8: Modularization

316

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

279

Lesson: Modularization with Subroutines

Exercise 10: Subroutines Exercise Duration: 30 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Create subroutines • Use the subroutine interface to pass data

Business Example Modify your calculator program for the basic calculation types so that you can perform another form of calculation (percentage calculation) in a subroutine. Template: BC400_DOS_COMPUTE Solution: BC400_MOS_SUBROUTINE

Task 1: Copy your program ZBC400_##_COMPUTE or the template and give it the name ZBC400_##_SUBROUTINE. 1.

Copy your program or the template.

Task 2: Create a subroutine (suggested name: CALC_PERCENTAGE) that carries out a percentage calculation using two input parameters and returns the result. The value of the first parameter should be determined as a percentage of the second parameter if the value of the second parameter represents 100%. 1.

At the end of your program, create a subroutine for percentage calculation.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

317

Unit 8: Modularization

2.

TAW10_1

Define two USING parameters for transferring the operands (suggested name: PV_ACT and PV_MAX) as well as a CHANGING parameter for returning the result (suggested name: CV_RESULT). Type the parameters appropriately to the corresponding global data objects in the main program. Hint: You cannot use implicit typing for the return parameters (TYPE p LENGTH 16 DECIMALS 2). Declare a local program type at the start of your program with the TYPES statement instead. You can then use this for the actual parameter and the formal parameter.

3.

Implement the percentage calculation in the subroutine. Make sure that you avoid the error of division by zero. In this case, output a warning text on the list.

Task 3: Extend the main program so that you call a new subroutine if the user has entered the arithmetic operator “%”. 1.

Extend the IF or CASE structure with a branch that is processed if the parameter contains the value “%”.

2.

In this branch, call the subroutine and supply the parameters with suitable actual parameters. Hint: Generate the subroutine call by using the drag and drop function in the navigation area or the Pattern pushbutton.

Task 4: Test and debug your program.

318

1.

Execute your program and check the result.

2.

Follow the program flow with the Debugger. Use the function keys or pushbuttons to exit or skip the subroutine.

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

Solution 10: Subroutines Task 1: Copy your program ZBC400_##_COMPUTE or the template and give it the name ZBC400_##_SUBROUTINE. 1.

Copy your program or the template. a)

Display your template in the navigation area of the Object Navigator.

b)

Right click on the selected program to open the context menu and choose Copy....

c)

In the dialog box that follows, enter the name of the target program and Copy. confirm your entry with

d)

Select all parts of the program using the Copy. with

e)

Assign this program to your package and your request in the usual way.

pushbutton and confirm this

Task 2: Create a subroutine (suggested name: CALC_PERCENTAGE) that carries out a percentage calculation using two input parameters and returns the result. The value of the first parameter should be determined as a percentage of the second parameter if the value of the second parameter represents 100%. 1.

At the end of your program, create a subroutine for percentage calculation. a)

2.

See source code excerpt from the model solution.

Define two USING parameters for transferring the operands (suggested name: PV_ACT and PV_MAX) as well as a CHANGING parameter for returning the result (suggested name: CV_RESULT). Type the parameters appropriately to the corresponding global data objects in the main program. Hint: You cannot use implicit typing for the return parameters (TYPE p LENGTH 16 DECIMALS 2). Declare a local program type at the start of your program with the TYPES statement instead. You can then use this for the actual parameter and the formal parameter. a)

See source code excerpt from the model solution.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

319

Unit 8: Modularization

3.

TAW10_1

Implement the percentage calculation in the subroutine. Make sure that you avoid the error of division by zero. In this case, output a warning text on the list. a)

See source code excerpt from the model solution.

Task 3: Extend the main program so that you call a new subroutine if the user has entered the arithmetic operator “%”. 1.

Extend the IF or CASE structure with a branch that is processed if the parameter contains the value “%”. a)

2.

See source code excerpt from the model solution.

In this branch, call the subroutine and supply the parameters with suitable actual parameters. Hint: Generate the subroutine call by using the drag and drop function in the navigation area or the Pattern pushbutton. a)

See source code excerpt from the model solution.

Task 4: Test and debug your program. 1.

Execute your program and check the result. a)

2.

Carry out this step in the usual way.

Follow the program flow with the Debugger. Use the function keys or pushbuttons to exit or skip the subroutine. a)

Perform this step as described in the course materials.

Result Source code extract: *&---------------------------------------------------------------------* *& Report

BC400_MOS_SUBROUTINE

*

*&---------------------------------------------------------------------* REPORT

bc400_mos subroutine.

TYPES gty_result TYPE

p LENGTH 16 DECIMALS 2.

Continued on next page

320

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Modularization with Subroutines

PARAMETERS: pa_int1

TYPE i,

pa_op

TYPE c LENGTH 1,

pa_int2

TYPE i.

DATA gv_result TYPE gty_result.

IF ( pa_op = ’+’ OR pa_op = ’-’ OR pa_op = ’*’ OR pa_op = ’/’ AND pa_int2 0 OR pa_op = ’%’ ). CASE pa_op. WHEN ’+’. gv_result = pa_int1 + pa_int2. WHEN ’-’. gv_result = pa_int1 - pa_int2. WHEN ’*’. gv_result = pa_int1 * pa_int2. WHEN ’/’. gv_result = pa_int1 / pa_int2. WHEN ’%’. PERFORM calc_percentage USING pa_int1 pa_int2 CHANGING gv_result.

ENDCASE.

WRITE: ’Result:’(res), gv_result. ELSEIF

pa_op = ’/’

AND

pa_int2 = 0.

WRITE: ’No division by zero!’(dbz). ELSE. WRITE: ’Invalid operator!’(iop). ENDIF.

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

321

Unit 8: Modularization

TAW10_1

*&---------------------------------------------------------------------* *&

Form

calc_percentage

*&---------------------------------------------------------------------* *

calculate percentage value

*----------------------------------------------------------------------* *

-->PV_ACT

actual value

*

-->PV_MAX

maximum value

*

Appropriate note to user, for example. Hint: As well as the technique described, you also have the possibility of controlling access to entire programs and transactions using authorizations. However, such checks should only be considered as additions to, and not substitutions for the explicit authorization check by the developer. Under normal circumstances, the definition of authorization objects is part of data modeling and the creation of database tables. Since we access an existing data model in this course, we use the authorization object S_CARRID that belongs to this data model. Implementing the authorization concept is one of the tasks of the developer who programs access to the database tables. The subsequent steps, such as defining the authorizations and profiles and designing the user master records, belong to the tasks of the administrator.

2008

© 2008 SAP AG. All rights reserved.

515

Unit 10: Data Modeling and Data Retrieval

TAW10_1

Figure 219: Displaying Authorization Objects

Before you can implement the required authorization check in your program, you must first determine the structure (the fields) of the respective authorization concept. An object usually consists of the ACTVT (activity) field and one other field, which specifies the data type to be protected (i.e., material number, airline and so on.) The values of these authorization fields specify what the user is authorized to do. You can display an authorization object directly in the ABAP Workbench (for example, by using the Other Object ... pushbutton, or the Other tab page). You can also use transaction SU21. You will also get an overview of all the authorization objects created in the system here. The following graphic shows how an authorization check is implemented.

516

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Authorization Check

Figure 220: Authorization Check (Syntax Example)

For the authorization check in the program, you specify the authorization that is to be checked in the master record of the current user. The authorization is specified by specifying the authorization object, its fields, as well as the appropriate field values. Refer to the syntax in the above graphic. In our example, there is a check as to whether the user has authorization for the S_CARRID object, in which the field CARRID (airline) contains the airline entered by the user, and the field ACTVT (activity) contains the value ’03’ (display). After the AUTHORITY-CHECK statement, you should check the return code sy-subrc and monitor further processing of your program accordingly. Hint: If you do not want to carry out a check for a field, either do not enter it in the AUTHORITY-CHECK statement or enter DUMMY as the field value. DUMMY is a predefined description entered without quotation marks. An example of a suppressed field check: When a change transaction is called, the system should always check immediately whether the user has any change authorization for any airline. If the check fails, an appropriate message is to be output to the user immediately. Such a check can be implemented with the following syntax: AUTHORITY-CHECK OBJECT ’S_CARRID’ ID ’CARRID’ DUMMY ID ’ACTVT’

2008

FIELD ’02’.

© 2008 SAP AG. All rights reserved.

517

Unit 10: Data Modeling and Data Retrieval

TAW10_1

Figure 221: Implementing Authorization Checks in Programs

In order to avoid spelling errors in object and field names, you should have the AUTHORITY-CHECK statement generated into your source code using the Pattern button. After this, maintain the field values and implement the evaluation of sy-subrc. Now ask the participants to carry out the exercise.

518

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

475

Lesson: Authorization Check

Exercise 23: Authorization Check Exercise Duration: 10 Minutes

Exercise Objectives After completing this exercise, you will be able to: • Implement authorization checks

Business Example You want to develop a program in which data for the flight model is read from the database. Access to the data for this model is controlled using authorizations in the authorization object S_CARRID. You therefore need to perform an authorization check. To make the authorization check reusable, you encapsulate it in a function module. Template: None Solution: BC400_DDS_AUTH_CHECK (function module)

Task 1: Create a function group, if one does not already exist. 1.

Create a new function group in your package (suggested name: ZBC400_##).

Task 2: Create a new function module in the function group. Maintain the interface for the function module in such a way that it imports an airline ID and an activity for the authorization check. Create two exceptions for the confirmation; one in case no authorization exists and another in case the caller has specified an invalid activity. 1.

Create a new function module in your function group (suggested name: Z_BC400_##_AUTH_CHECK).

Continued on next page

2008

© 2008 SAP AG. All rights reserved.

519

Unit 10: Data Modeling and Data Retrieval

2.

TAW10_1

Create a separate import parameter for the airline ID and activity (suggested names: IV_CARRID and IV_ACTIVITY). To type the data element, choose S_CARR_ID and ACTIV_AUTH. Hint: The correct data elements are defined in the authorization object. To do this, open the authorization object S_CARRID in display mode and choose the input help (F4 help) for one of the authorization fields. You will find the relevant data element (second column) for each authorization field (first column) here.

3.

Create two (classic) exceptions (suggested names: NO_AUTH and WRONG_ACTIVITY).

Task 3: Implement an authorization check in the source code for the authorization object S_CARRID. Raise an exception if •

the authorization does not exist



the caller has not specified any of the relevant activities.

1.

Implement an authorization check for the authorization object S_CARRID. Supply the authorization fields with the import parameters for the function module. Evaluate the return value (sy-subrc) and raise an exception if the authorization is missing. Hint: You should use the Pattern function, since the authorization check is very intolerant of typos and errors with the use of upper/lowercase characters.

2.

Before the authorization check, make sure that the caller has specified only one of the the relevant activities. If necessary, raise an exception. Hint: The relevant activities are defined in the authorization object. To do this, open the authorization object in display mode and choose the Permitted Activities pushbutton at the bottom of the screen.

Continued on next page

520

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Authorization Check

Task 4: Activate and test your function module.

2008

1.

Activate the function module.

2.

Test your function module.

© 2008 SAP AG. All rights reserved.

521

Unit 10: Data Modeling and Data Retrieval

TAW10_1

Solution 23: Authorization Check Task 1: Create a function group, if one does not already exist. 1.

Create a new function group in your package (suggested name: ZBC400_##). a)

In the navigation area, open the context menu for the package and choose Create → Function Group.

b)

Enter the name of the function group and a short text and choose

c)

Assign the function group to your package and your request in the usual way.

Save.

Task 2: Create a new function module in the function group. Maintain the interface for the function module in such a way that it imports an airline ID and an activity for the authorization check. Create two exceptions for the confirmation; one in case no authorization exists and another in case the caller has specified an invalid activity. 1.

2.

Create a new function module in your function group (suggested name: Z_BC400_##_AUTH_CHECK). a)

In the navigation area, open the context menu for your function group and choose Create → Function Module.

b)

Enter the name of the function module and a short text and choose

Save.

Create a separate import parameter for the airline ID and activity (suggested names: IV_CARRID and IV_ACTIVITY). To type the data element, choose S_CARR_ID and ACTIV_AUTH. Hint: The correct data elements are defined in the authorization object. To do this, open the authorization object S_CARRID in display mode and choose the input help (F4 help) for one of the authorization fields. You will find the relevant data element (second column) for each authorization field (first column) here. a)

Open the Import tab page. Enter the names of the parameters and the data types.

Continued on next page

522

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Authorization Check

3.

Create two (classic) exceptions (suggested names: NO_AUTH and WRONG_ACTIVITY). a)

Open the Exceptions tab page. Enter the names of the exceptions and a short text. Do not set the Exception Classes indicator.

Task 3: Implement an authorization check in the source code for the authorization object S_CARRID. Raise an exception if •

the authorization does not exist



the caller has not specified any of the relevant activities.

1.

Implement an authorization check for the authorization object S_CARRID. Supply the authorization fields with the import parameters for the function module. Evaluate the return value (sy-subrc) and raise an exception if the authorization is missing. Hint: You should use the Pattern function, since the authorization check is very intolerant of typos and errors with the use of upper/lowercase characters. a)

2.

See source code excerpt from the model solution.

Before the authorization check, make sure that the caller has specified only one of the the relevant activities. If necessary, raise an exception. Hint: The relevant activities are defined in the authorization object. To do this, open the authorization object in display mode and choose the Permitted Activities pushbutton at the bottom of the screen. a)

See source code excerpt from the model solution.

Task 4: Activate and test your function module. 1.

Activate the function module. a)

In the Function Builder toolbar, choose the

pushbutton. Continued on next page

2008

© 2008 SAP AG. All rights reserved.

523

Unit 10: Data Modeling and Data Retrieval

2.

TAW10_1

Test your function module. a)

In the Function Builder toolbar, choose the

b)

Supply the import parameters with values and choose

c)

Check the result.

pushbutton. .

Hint: Check the raising of the exception if an error occurs too.

Result Source code extract from the model solution: FUNCTION bc400_dds_auth_check. *"---------------------------------------------------------------------*"*"Lokale Schnittstelle: *"

IMPORTING

*"

REFERENCE(IV_CARRID) TYPE

*"

REFERENCE(IV_ACTIVITY) TYPE

*"

S_CARR_ID ACTIV_AUTH

EXCEPTIONS

*"

NO_AUTH

*"

WRONG_ACTIVITY

*"---------------------------------------------------------------------CASE iv_activity. WHEN ’01’ OR ’02’ OR ’03’.

AUTHORITY-CHECK OBJECT ’S_CARRID’ ID ’CARRID’ FIELD iv_carrid ID ’ACTVT’

FIELD iv_activity.

IF sy-subrc 0. RAISE no_auth. ENDIF.

WHEN OTHERS. RAISE wrong_activity. ENDCASE. ENDFUNCTION.

524

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Authorization Check

Lesson Summary You should now be able to: • Explain the SAP authorization concept • Implement authorization checks

2008

© 2008 SAP AG. All rights reserved.

525

Unit Summary

TAW10_1

Unit Summary You should now be able to: • Explain the purpose and the benefits of using a data model in application development • Describe the SAP flight data model • Describe the meaning and the structure of a transparent table • List different methods for searching relevant database tables • Program read access to specific columns and rows within a particular database table • List different methods for read accesses to several database tables • Explain the SAP authorization concept • Implement authorization checks

Related Information ... Refer to the online documentation in the ABAP Dictionary and for the relevant ABAP statements.

526

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

483

Test Your Knowledge

Test Your Knowledge 1.

You can define variables in the program using Dictionary types (descriptive elements) Determine whether this statement is true or false.

□ □ 2.

True False

Database tables are stored together with their content in the ABAP Dictionary Determine whether this statement is true or false.

□ □

True False

3.

What do you call the description of a database table in the ABAP Dictionary and what name does it have?

4.

What is defined with the statement "DATA myvar TYPE dbtab." if dbtab is a transparent table? Choose the correct answer(s).

□ □ □ □ 5.

2008

A B C D

A copy of the database table dbtab An internal table with the same structure as the database table dbtab An internal table with the same content as the database table dbtab A structure variable with the same structure as a dbtab row

Why should "Open SQL" be generally used for database accesses instead of "Native SQL?

© 2008 SAP AG. All rights reserved.

527

Test Your Knowledge

TAW10_1

6.

Which statement is used to read a single record from a database table?

7.

Does the client limitation have to be specified in the WHERE clause of a SELECT statement if the database table to be read has the client field?

8.

What is the name of the high-performance technique that one should use to load the content of a database table into an internal table?

9.

In which system field do you find the number of the records read using SELECT? Choose the correct answer(s).

□ □ □ □

A B C D

SY-SUBRC SY-TABIX SY-DBCNT SY-INDEX

10. Which technique should be used for reading records that belong together from several database tables? This technique performs considerably better than nested SELECT statements.

528

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Test Your Knowledge

11. Which of the following statements concerning authorization checks are correct? Choose the correct answer(s).



A



B



C



D

In the SELECT statement, the corresponding authorization check is already integrated. The SELECT statement functions without any problem, even if the user does not have the appropriate authorization for the read process. To protect data from unwanted access, an authorization check must be implemented in the program. An authorization check must always be implemented in the program.

12. Which ABAP statement is used to implement an authorization check and where is the check result to be found?

13. Which of the following statements concerning authorization and authorization checks are correct? Choose the correct answer(s).

2008

□ □

A B

□ □

C D

An authorization object has fields and field values. An authorization is a real characteristic of an authorization object that is, an authorization object with field values. There are authorization objects in the user master record. There are authorizations in the user master record.

© 2008 SAP AG. All rights reserved.

529

Test Your Knowledge

486

TAW10_1

Answers 1.

You can define variables in the program using Dictionary types (descriptive elements) Answer: True You can use Dictionary types for typing variables.

2.

Database tables are stored together with their content in the ABAP Dictionary Answer: False Only descriptions of database tables are stored in the ABAP Dictionary.

3.

What do you call the description of a database table in the ABAP Dictionary and what name does it have? Answer: A database table description in the ABAP Dictionary is called a transparent table. It has the same name as the database table.

4.

What is defined with the statement "DATA myvar TYPE dbtab." if dbtab is a transparent table? Answer: D The specified syntax defines only a structure variable since a transparent table is specified for the type. This table basically describes the row structure of the corresponding database table.

5.

Why should "Open SQL" be generally used for database accesses instead of "Native SQL? Answer: Because Open SQL is independent of the relational database system used.

6.

Which statement is used to read a single record from a database table? Answer: SELECT SINGLE

530

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Test Your Knowledge

7.

Does the client limitation have to be specified in the WHERE clause of a SELECT statement if the database table to be read has the client field? Answer: No; if the client limitation is missing, only records of the executing client are read - that is, the client in which the program is called.

8.

What is the name of the high-performance technique that one should use to load the content of a database table into an internal table? Answer: Array Fetch

9.

In which system field do you find the number of the records read using SELECT? Answer: C

10. Which technique should be used for reading records that belong together from several database tables? This technique performs considerably better than nested SELECT statements. Answer: Table join 11. Which of the following statements concerning authorization checks are correct? Answer: B, C

12. Which ABAP statement is used to implement an authorization check and where is the check result to be found? Answer: AUTHORITY-CHECK / SY-SUBRC 13. Which of the following statements concerning authorization and authorization checks are correct? Answer: B, D

2008

© 2008 SAP AG. All rights reserved.

531

Unit Summary

532

TAW10_1

© 2008 SAP AG. All rights reserved.

2008

Unit 11 ABAP Open SQL

489

ABAP Open SQL plays a central role in developing high-performance applications. This unit takes a detailed look. This unit is based strongly on the corresponding topics in course BC490 - ABAP Performance Tuning and supplements the information from the preceding unit. In this course, we will concentrate on the things that developers should know before they start a development project. with the aim of detecting and avoiding performance problems early on, during the development phase.

Unit Overview In this unit, we will introduce the ABAP Open SQL statements and examine them according to performance aspects.

Unit Objectives After completing this unit, you will be able to: • •

Use important SQL statements efficiently Optimize application logic to achieve the best possible performance

Unit Contents Lesson: ABAP Open SQL: Optimizing Statements ............................ 534

2008

© 2008 SAP AG. All rights reserved.

533

Unit 11: ABAP Open SQL

Lesson: 490

TAW10_1

ABAP Open SQL: Optimizing Statements Lesson Duration: 40 Minutes

Lesson Overview This lesson deals with the optimization of application logic in general and the correct use of important, frequently used SQL statements in detail.

Lesson Objectives After completing this lesson, you will be able to: • •

Use important SQL statements efficiently Optimize application logic to achieve the best possible performance

Make liberal use of demonstrations to loosen up the presentation. Give the participants the opportunity to practice and verify what you have explained. Encourage discussion! Point out that there is no such thing as a 100% solution. There are often practical uses for even the most improbable strategy.When in doubt, always program and test different strategies!

Business Example Mr. Jones, a software developer at a major corporation that uses SAP, is supposed to develop a new business application to analyze mass data. He knows that reading data is a runtime-critical operation. Therefore, Mr. Jones wants to take advantage of the ABAP Open SQL functions to optimize the SQL statements in his application.

534

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

SQL statements: Basics

Figure 222: Optimizing the Application Logic

Correct use of the SELECT command is critical to optimizing the performance of application logic. In addition, other SQL statements – as well as the overall program logic – have to be optimized. Multiple reads of the same data, as well as using identical statements, is unnecessarily processing-intensive, and should be avoided whenever possible. Instead, you could buffer the data in internal tables, or buffer database tables in general.

2008

© 2008 SAP AG. All rights reserved.

535

Unit 11: ABAP Open SQL

TAW10_1

Figure 223: Identical and Identically Structured Statements

Using identical SELECT statements is sub-optimal, because the same data records have to be read repeatedly. In such cases, you should use buffering strategies. As the above example shows, using identically structured SELECT statements – with different contents of string literals or variables – is also unnecessarily performance-intensive. In the example, part of database table SFLIGHT could be buffered in an internal table, and subsequent accesses of the result set could be served from that internal table. Global buffering of the data is also possible. ABAP features a variety of programming techniques for doing so, such as shared objects as of SAP Web AS 6.40.

536

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Figure 224: Missing WHERE Condition

In the first example, an SQL statement is specified without a WHERE condition. Statements like this can have dramatic effects on the overall performance of an SAP system. In general, SQL statements involving master data and transaction data should never be formulated without a selective WHERE condition. In the second example, the CHECK statement is used to filter data records, but after they have been transferred to the application server. Accordingly, many records were read from table SBOOK – which would have to be transported over the network in a three-tier client/server system architecture – and then discarded within the SELECT clause. This is very processing-intensive – for the network, the database, and overall system performance. To reduce the number of data records that have to be transferred, you should specify a sufficiently selective WHERE clause in each SQL statement. A SELECT statement without a WHERE condition is an indication of a design error in the program. Especially when selecting from large, important transaction tables (such as BKPF, BSEG, COBK, COEP, LIPK, MKPF, VBAK, and VBAP), you have to make sure that the number of selected records does not become too large, or even remains constant over time. SELECT statements that return approximately the same amount of data over time are also called stable WHERE conditions. If the number of read data records grows quickly over time, the statement is considered to be unstable. Accordingly, you should always favor WHERE clauses - for example, a query of RESERVED or CANCELLED in table SBOOK would be relatively stable compared to queries of CARRID or

2008

© 2008 SAP AG. All rights reserved.

537

Unit 11: ABAP Open SQL

TAW10_1

CONNID. Because this table contains bookings, you have to expect it to grow quickly over time. In contrast, the number of cancelled or reserved records would not grow as quickly. The RESERVED flag is deleted during a booking, for example, which means the number of records read for an access with RESERVED = ’X’ will remain relatively constant, making RESERVED = ’X’ a stable WHERE condition.

Figure 225: Favor the Use of Indexes

Favor the use of indexes. If index fields are filled with values from left to right, the database can form the result set faster, because less search effort is required. Gaps at the end of the index (that is, the fields further to the right) are less critical than gaps at the beginning. If the index is missing important fields, the system has to read a large number of index/table blocks, which will worsen performance significantly. In some cases, the database optimizer may even skip the index search, and read the entire database table sequentially instead (FULL TABLE SCAN).

538

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Figure 226: SELECT Condition: Field List or *

When you use SELECT *, more data than is necessary is often transferred from the database server to the application server. If you only need the contents of a few columns, you should always specify the table fields individually in a field list. If it helps reduce the number of fields to be selected, the field list is always useful. In the first example, you read all the columns in the table and pass them on to the application server, although only some of the columns are needed. Accordingly, the transfer effort increases along with the amount of data transferred. The INTO CORRESPONDING FIELDS OF addition in the second example copies the field contents to target fields with the same names. This copy operation is more performance-intensive than left-aligned copying into a suitable work area or internal table using INTO or INTO TABLE. The same applies to APPENDING CORRESPONDING FIELDS OF and APPENDING TABLE..

2008

© 2008 SAP AG. All rights reserved.

539

Unit 11: ABAP Open SQL

TAW10_1

Figure 227: Filling Internal Tables with Array Fetch

The same number of data records has to be transferred from the database server to the application server for both a SELECT loop and an array fetch. Because the transfer is always made in blocks of 32K each, the same transfer effort (number of fetches) is required for both variants. Still, the array fetch is preferable to the SELECT loop, because the records are transferred by record from the database interface to the ABAP program in the SELECT loop, whereas the records are passed on to the ABAP program in a block with array fetch.

540

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Figure 228: Using UP TO n ROWS

There are two ways to read a fixed number of records: You can transfer the records to the application server and discard the ones you do not need in the SELECT loop. The better method, however, is to use SELECT UP TO n ROWS and only transfer the desired number of data records from the database to the application. In the first version, system field SY-DBCNT is queried within the SELECT loop, which is cancelled when a certain number of data records has been read. As a result, the last transferred 32K block may unnecessarily be transferred completely. In the second version, if you explicitly specify UP TO n ROWS, only the required entries are read and transferred from the database to the database interface.

2008

© 2008 SAP AG. All rights reserved.

541

Unit 11: ABAP Open SQL

TAW10_1

Figure 229: Aggregation

You can use aggregation functions (COUNT, SUM, MAX, MIN, AVG) to perform calculations in the database. This is only useful, however, if it significantly reduces the number of data records to transfer. In the first example, an ABAP LOOP statement runs over an internal table for aggregation. To do this, however, every record that fulfills the WHERE condition has to be read from the database first. The result is then calculated in the LOOP. In the second example, the result is calculated directly in the database, and only the results records are transferred. Hint: Accordingly, either strategy can be used. You will have to decide which one is better on a case-by-case basis. Please also note that aggregation functions always bypass SAP table buffers (which can be a disadvantage when buffered tables are involved). When you use aggregation function AVG, you should use data type F (floating point number) for the target field. When you use aggregation function SUM, you should use a data type for the target field that is longer than the data type of the source field, to deal with overflows.

542

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

For further information about using aggregation functions, please refer to the documentation.

Accessing Multiple Tables It is often necessary to read related data from several tables. Below you will find various techniques that can be used for these accesses. JOIN and VIEW are definitely the most important.

JOIN and VIEW To read data that is distributed across multiple tables, you have to create a link between the functionally dependent tables. The corresponding logical database operator is called a JOIN. You can use either VIEWS in the ABAP Dictionary or ABAP joins to implement a JOIN. In theory, you can also use nested SELECT statements to implement a join. If you use nested SELECT statements, however, you must expect an adverse effect on performance, especially if the outer table contains a large number of entries. As you can see in the Explain SQL output, a record is read from the inner table for each record in the outer table. Instead of nested SELECT statements, use one of the techniques listed above to read from more than one database table. Database views and joins in ABAP Open SQL are discussed below.

2008

© 2008 SAP AG. All rights reserved.

543

Unit 11: ABAP Open SQL

TAW10_1

Figure 230: Nested SELECT Statements and Join Formation

To implement a join, you can use database views as views in the ABAP Dictionary or ABAP joins, as illustrated above. Attributes and Benefits of Database Views • • • • •



544

You can use views in other programs too. There are where-used lists and search functions (SE84 / SE81) to find existing views quickly. Like database tables, you can buffer views (technical settings). Fields common to both tables (join fields) are only transferred from the database to the application server once. The view is implemented in the ABAP Dictionary as an inner join. This means no data is transferred if the inner table does not contain any entries that correspond to the outer table. If you do not want to use an inner join to read from a text table, for example (which cannot deal with situations in which the join results do not contain any records, because no entry is available in a certain language), use an ABAP left outer join (see Left Outer Join).

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Figure 231: Example: Inner/Outer Join

You can generally derive the logic of the INNER JOIN and OUTER JOIN from the intended result set. An INNER JOIN corresponds to the result set that only considers the records from the outer table for which suitable data records exist in the inner table (on the left in the above example). A LEFT OUTER JOIN corresponds to the result set that contains all the records from the outer table, regardless of whether or not suitable records exist in the inner table. If no suitable records exist in the inner table, the fields of the inner table are set to ZERO values in the result set. The tables involved in a JOIN are called base tables. The result of a join can be a projection (column selection) or a selection (line selection). Because not all of the databases supported by SAP support the standard syntax for ON conditions, restricted syntax must be used to ensure that only JOINs that return the same result set on all database systems are allowed.

2008

© 2008 SAP AG. All rights reserved.

545

Unit 11: ABAP Open SQL

TAW10_1

Restrictions for Outer Join • • • • •

You can only have a table or a view to the right of the JOIN operator; you cannot have another JOIN expression Only AND can be used as a logical operator in an ON condition Every comparison in the ON condition must contain a field from the table on the right None of the fields in the table on the right can appear in the WHERE conditions of the LEFT OUTER JOIN For further information about implementing JOIN functions, please refer to the ABAP documentation.

Figure 232: Example: ABAP Inner Join

A disadvantage of using ABAP joins is that the statement is more complex than a Dictionary view, where the syntax of the SELECT statement (specifically, the FROM clause) corresponds to a regular table access.

546

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Also note that ABAP joins always bypass the table buffer, which of course is only a disadvantage for joins involving buffered tables. . Hint: A disadvantage of both ABAP joins and Dictionary views is that redundant data from the outer table appears in the result set if there is a 1:n relationship between the outer and inner tables. This can considerably increase the amount of data transferred from the database. For this reason, you should use a field list with a join to identify only those fields that you really need. The runtime of a join formation is highly dependent on the database optimizer, especially when the join involves more than two tables. However, it is usually faster than using nested SELECT statements.

We recommend performing the exercise with the joins in the next part. The participants can choose whether they want to create a join or a view in the DDIC. Because a triple join will probably overwhelm many of the participants, refer them to the documentation, which contains perfect example coding. The documentation contains an example of a triple join in the FROM clause of the SELECT statement.

Hint: Do not provide any analysis or comments about the join, as this is exactly what the participants are supposed to do! You should merely lead the participants to the conclusion and let them work out the solution for themselves. The result of the JOIN in the SQL trace will amaze the group; when you discuss the exercise, be sure to focus on the reduction in the number of data packages that resulted from the JOIN! It is also possible to build a Dictionary view instead of the join. In theory, the view should offer the same performance.

2008

© 2008 SAP AG. All rights reserved.

547

Unit 11: ABAP Open SQL

TAW10_1

SUBSELECT and SUBQUERY

Figure 233: Subselects / Subquerys

A subquery is a query within a SELECT, UPDATE, or DELETE statement. It is formulated in the WHERE or HAVING clause to check whether the data in various database tables or views possess certain attributes. A SELECT statement with a subquery has a more restricted syntax than a SELECT statement without a subquery: SELECT … FROM dbtab [WHERE ...] [GROUP BY ...] [HAVING ...]. If the subquery returns exactly one value, the usual comparison operators aside from LIKE and BETWEEN can be used. If a subquery is used with a comparison operator instead of with EXISTS, then the SELECT clause of the subquery can only contain a single column, which can be a field in the database table or an aggregate expression. In the second example above, the subquery is supposed to return several lines, each with one value. If you want to compare all the returned values, you have to use IN. Subqueries whose WHERE condition contains fields from the main query are called correlated subqueries. If subqueries are nested, each subquery can use

548

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

all the fields from the higher-level subqueries in the hierarchy. You should also formulate positive subqueries whenever possible. Negative formulations may result in performance-intensive database analyses if no adequate index is available. Hint: In many cases, you can also use a join to obtain the desired result of a subquery; the join is usually easier to read. No blanket statements can be made about the performance of subqueries. If you want to use subqueries, be sure to test them comprehensively beforehand. Of course, avoiding database accesses in the first place is the most effective way to reduce database load. You can do this by taking table contents that have already been read and saving them in an internal table (with type SORTED or HASHED, if possible). In many cases, the application logic does not permit the use of joins. If you still need to read data from multiple tables in such cases, you can use a separate internal table to buffer the read data.

Read on Demand and Buffering

Figure 234: Read on Demand and Buffering

2008

© 2008 SAP AG. All rights reserved.

549

Unit 11: ABAP Open SQL

TAW10_1

In the above example, the intention is to read the suitable data from SCUSTOM (customer master data) from table SBOOK within a SELECT loop. You can accomplish this with a SELECT SINGLE statement or a read routine. If you use SELECT SINGLE in this constellation, you would execute identical SQL statements. You should therefore encapsulate the reading of SCUSTOM data records in a read routine. In the above example, the table contents read from SCUSTOM are buffered in an internal table. Before the database is accessed, the system checks whether the corresponding table entry has already been read. The information that no appropriate entry exists in the database is also buffered in the internal table (in the EXIST field). If the information will be buffered within the program and does not have to be reused, the read routine can be a subroutine. If you want to buffer in an internal session for multiple programs (call sequence), you should use a function module. Accordingly, buffering table contents can be a very effective tool. We recommend performing the “read on demand” exercise in the next part. Discuss the slide beforehand. Repeat the exercise, and then discuss the various options for accessing multiple tables (including the buffering options) with the group.

Hint: Different results may occur depending on the training system, data volume, and data distribution. This is not a problem, however; in fact, it is intended, because you will discuss and appraise the possible scenarios with the group afterwards.

550

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Addition ... FOR ALL ENTRIES

Figure 235: SELECT ... FOR ALL ENTRIES

SELECT .. FOR ALL ENTRIES was created in OPEN SQL at a time when it was not yet possible to perform database JOINs (this was not supported for all SAP-approved DBMS). The connection between the inner and outer database tables is created in ABAP. If you want to replace nested SELECT statements with FOR ALL ENTRIES, this only eliminates the nesting and its disadvantages partially. In general, you bundle the inner SELECT statements into packages, for example, of 5 statements each. This reduces the transfer effort required and avoids identical SQL statements. The access sequence is defined in the ABAP coding, like for nested SELECT statements. As mentioned above, if you use FOR ALL ENTRIES, you have to make sure that the driving table is not blank and does not contain any duplicate entries. As in the case of nested SELECT statements, the decision of whether an INNER JOIN or OUTER JOIN is also made in ABAP for SELECT .. FOR ALL ENTRIES. If you want to read large data volumes, only in exceptional cases should you use FOR ALL ENTRIES.

2008

© 2008 SAP AG. All rights reserved.

551

Unit 11: ABAP Open SQL

TAW10_1

Facilitated Discussion

Discussion Questions Use the following questions to engage the participants in the discussion. Feel free to use your own additional questions.

552

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: ABAP Open SQL: Optimizing Statements

Lesson Summary You should now be able to: • Use important SQL statements efficiently • Optimize application logic to achieve the best possible performance

2008

© 2008 SAP AG. All rights reserved.

553

Unit Summary

TAW10_1

Unit Summary You should now be able to: • Use important SQL statements efficiently • Optimize application logic to achieve the best possible performance

554

© 2008 SAP AG. All rights reserved.

2008

Unit 12 Selection Screen

509

For the presentation of this unit, you should know the sequence of the ABAP events such as INITIALIZATION, START-OF-SELECTION and so on.

Unit Overview In this unit, ABAP commands for generating a selection screen, as well as other additions and techniques are presented. ABAP events that belong to the selection screen (such as AT SELECTION-SCREEN), are discussed. The creation of variants is dealt with in the same way as the dynamic changing of selection screens.

Unit Objectives After completing this unit, you will be able to: • • • • • • • • • • •

2008

Explain the purpose of selection screens Create input fields with PARAMETERS Create input fields with SELECT-OPTIONS Design the selection screen Define additional selection screens Define subscreens Define a tabstrip within a selection screen Implement input checks for selection screens Create variants for a selection screen Create pushbuttons on the selection screen Program changes to the selection screen at runtime

© 2008 SAP AG. All rights reserved.

555

Unit 12: Selection Screen

TAW10_1

Unit Contents Lesson: Generating and Designing the Selection Screen..................... 557 Exercise 24: Generating and Designing the Selection Screen ........... 575 Lesson: Input Checks and Variants .............................................. 584 Procedure: Creating Variants with Dynamic Date Calculation............ 590 Exercise 25: Input Checks and Variants..................................... 591 Lesson: Selection screen: Modifications at Runtime........................... 596 Exercise 26: Selection screen: Modifications at Runtime................. 601

556

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: 510

Lesson: Generating and Designing the Selection Screen

Generating and Designing the Selection Screen Lesson Duration: 40 Minutes

Lesson Overview In this lesson, you will see how a selection screen is created and designed and how entries are checked. Finally, you will see how screen elements can be changed at runtime.

Lesson Objectives After completing this lesson, you will be able to: • • • • • • •

Explain the purpose of selection screens Create input fields with PARAMETERS Create input fields with SELECT-OPTIONS Design the selection screen Define additional selection screens Define subscreens Define a tabstrip within a selection screen

Business Example You are a programmer at ABC Travel. Your manager wants to see flight data for ABC Airways. Your task is to write a program with a user-friendly selection screen to meet the requirements of the manager.

2008

© 2008 SAP AG. All rights reserved.

557

Unit 12: Selection Screen

TAW10_1

Selection Screen Overview

Figure 236: Selection screen: Overview

Selection screens serve as the interface between the program and the user and are used to limit the amount of data to be read from the database. You can use the declarative language elements PARAMETERS and SELECT-OPTIONS to generate a default selection screen (screen 1000) with input-ready fields. Logical databases supply selection screens whose concrete appearance is dependent on the specified node name (NODES ). (See unit “Logical databases” for more detail). Selection screen versions offer a subset of the default selection screen. In addition to the default selection screen, you can create additional selection screens using SELECTION-SCREEN BEGIN OF ... and call them using CALL SELECTION-SCREEN. Create variants to save selection screen values that are used repeatedly. The variant can be recalled for use whenever it is needed. If a report runs with a selection screen in the background, a variant is required.

558

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Generating and Designing the Selection Screen

Creating Fields in the Selection Screen

Figure 237: Declaring Fields with PARAMETERS

The PARAMETERS statement is a declarative language element. As in the case of the DATA statement, you can declare parameters with TYPE or LIKE. The system generates input-ready fields in the selection screen. The names of the PARAMETERS fields can be up to eight characters long. You can maintain selection texts using the menu path Goto → Text Elements → Selection Texts. With the DEFAULT addition, you can set a default value for a PARAMETERS statement. If you assign a MEMORY ID , the system retrieves the current value from the SAP memory and outputs it on the screen automatically. The SAP memory is a user-specific memory area where simple data values (for example, the key of an airline) are saved to SET/GET parameters for the duration of a user session. SET/GET parameters are identified by a name (maximum 20 characters long). You can find out the name of a relevant SET/GET parameter by going to the Technical Information in an output field using Help(F1) → Technical Information. In the Parameter ID field, you will find the name of the SET/GET parameter as it is proposed in the data element being used If you declare mandatory fields ( OBLIGATORY addition), users cannot leave the selection screen until these fields contain entries.

2008

© 2008 SAP AG. All rights reserved.

559

Unit 12: Selection Screen

TAW10_1

The automatic check by the ABAP Dictionary is deactivated by default for report selection screens. However, if you make reference to a dictionary object that has a foreign key established, VALUE CHECK ensures that entries are checked for validity. You can generate parameters as checkboxes (AS CHECKBOX). As a result, you create a one-character field that contains (space) or “X”. You can evaluate the contents of the checkboxes in IF/ENDIF structures. You can also generate a group of radio buttons for the selection screen using the addition RADIOBUTTON GROUP . The name of a radio button group can have a maximum of four characters. Only one radio button in a group can be active; it can be evaluated in program processing. You can evaluate the contents of radio buttons using a CASE/ENDCASE control structure. The radio button you chose has the value “X”, all others have the value (space). If you have not assigned a value to any of the radio buttons, the system will automatically select the first radio button when it displays the selection screen. You can use the MODIF ID addition to simplify dynamic modifications to the selection screen (for more information, see unit “Selection Screen: Modifications at Runtime”).

Figure 238: Selections with SELECT-OPTIONS

SELECT-OPTIONS is a declarative language element with the same eight character naming restriction as PARAMETERS. In contrast to PARAMETERS, SELECT-OPTIONS allows a range of values as well as complex selections instead of just a single input field.

560

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Generating and Designing the Selection Screen

SELECT-OPTIONS generates an internal table with a standard structure and a header line. The table has four columns: sign (indicator meaning including or only), option (relational operator), low (lower limit) and high (upper limit). As with PARAMETERS, you can maintain selection texts using the menu path Goto → Text Elements → Selection Texts. After the parameter FOR, you specify the field against which the system should check the selection entries. This field must be declared, for example, in a DATA or NODES statement. Both the high and low fields (high and low) inherit the attributes of the referenced field. Each line of the selection table formulates a condition using a relational operator. The following values are possible: Possible Values for SIGN and OPTION

SIGN OPTION

Value

Meaning

I

Include

E

Exclude

EQ

Equal

NE

Not Equal

LE

Less or Equal

LT

Less Than

GE

Greater or Equal

GT

Greater Than

BT

Between

NB

Not Between

CP

Contains Pattern

NP

Contains Pattern not

The selection set S consists of all includes (I1, ..., In) minus all excludes (E1, ..., Em). If no values are entered in the SELECT-OPTIONS object, the system returns all lines from the database (“Nothing is everything”).

2008

© 2008 SAP AG. All rights reserved.

561

Unit 12: Selection Screen

TAW10_1

Figure 239: SELECT-OPTIONS with Multiple Selection Criteria

When the user makes entries in a SELECT-OPTIONS object, the system populates the internal table automatically. To change the default entries for the table fields sign and option, choose Edit → Selection Options. The system offers all the alternatives that are appropriate for the selection. If the traffic light is green for Select, there is an I (inclusive) in the SIGN column while the red traffic light indicates E (exclusive). To delete a table entry, choose Edit → Delete Selection Criterion. Every selection criterion can be used to make multiple selections unless otherwise defined . If multiple selections are present, the color of the arrow changes from white to green.

562

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Generating and Designing the Selection Screen

Figure 240: Syntax of the SELECT-OPTIONS Statement

Additions to the SELECT-OPTIONS statement are: •



• • • •

2008

DEFAULT enables you to set default values for the parameters low or low and high. You can use OPTION and SIGN to set default values for option and sign that differ from the default values. If you assign a MEMORY ID , the system retrieves the current value from the SAP memory, automatically outputs it to the screen, and writes it back again when you exit the screen (including any changes you might have made). LOWER CASE suppresses conversion of the entry into uppercase, provided that the domain allows this or typing was carried on ABAP type C. OBLIGATORY generates a required entry field. A checkmark appears in the entry field in the selection screen, and the user must enter a value. NO-EXTENSION suppresses the multiple selection option. NO INTERVALS suppresses the upper interval limit (-high) on the selection screen. You can use the additional screen Multiple selection to enter intervals.

© 2008 SAP AG. All rights reserved.

563

Unit 12: Selection Screen

TAW10_1

Dynamic Preassignment of the Selection Screen

Figure 241: ABAP Events in the Selection Screen Environment

The event LOAD-OF-PROGRAM runs if the machine code is loaded to the main memory, that is, right at the beginning of the program execution. At this point, the default values of the input fields are not yet evaluated. Therefore, the dynamic preassignment of input fields is not recommended at this point since the default values would overwrite the preassignments. AT SELECTION-SCREEN OUTPUT runs immediately before the selection screen is displayed and AT SELECTION-SCREEN runs immediately after the selection screen is displayed. Since you can display the selection screen multiple times (for ENTER, for example), the system can also process those event blocks multiple times.

564

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Generating and Designing the Selection Screen

Figure 242: Initializing the Selection Screen

The system only processes the INITIALIZATION event once in each executable program. You can supply default values for the selection screen fields of a report, as well as those for a logical database, during this event. You can use F1 Help (Technical help) to determine the names of the selection fields if a logical database is attached to the program.

2008

© 2008 SAP AG. All rights reserved.

565

Unit 12: Selection Screen

TAW10_1

Figure 243: Filling Internal Tables with Header Lines

The SELECT-OPTIONS FOR statement always generates one internal table with a header line. This actually creates two data objects: a table body named and a work area (the header line), also named . Fill in the work area with suitable values, then use the APPEND command to add it to the table body as a separate line. The selection screen can also be supplied with values in the AT SELECTION-SCREEN OUTPUT event. This event happens just before the selection screen is displayed and may run several times.

566

© 2008 SAP AG. All rights reserved.

2008

TAW10_1

Lesson: Generating and Designing the Selection Screen

Designing the selection screen

Figure 244: Designing the Selection Screen I

You can use the SELECTION-SCREEN statement to design the layout of the selection screen. You can use the BEGIN OF BLOCK addition to group logically-related screen elements and WITH FRAME to frame them. Frames can be nested to a maximum depth of five. For accessibility reasons, you should assign a heading to the block. The title can be declared as either text-xxx or as a field name of up to eight characters. In the second case, you set the text at runtime in the INITIALIZATION event. Before designing a selection screen, you should become familiar with the screen design guidelines shown in transaction BIBS.

2008

© 2008 SAP AG. All rights reserved.

567

Unit 12: Selection Screen

TAW10_1

Figure 245: Designing the Selection Screen II

You can display multiple parameters and comments on the same screen line. To do so, you must include them between SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END OF LINE. The COMMENT addition enables you to include texts. Comment texts must always have a format (position and output length). The position can be set using a data field or pos_low or pos_high. The last two are the positions for the upper and lower limits of the field SELECT-OPTIONS on the selection screen. The