Software Development for SAP R/3
Springer-Verlag Berlin Heidelberg GmbH
Ulrich Mende Software Development for SAP R/3 Data Dictionary, ABAP/4, Interfaces With Diskette With 124 Figures and Many Example Programs i Springer
Dr. Ulrich Mende EDP Consultancy Senefelder Str. 7 15370 Fredersdorf/ Berlin, Germany u.mende.edv@t -online.de "SAP" is a registered trademark ofsap Aktiengesellschaft, Systems, Applications and Products in Data Processing, Neurottstrasse 16, 69190 Walldorf, Germany. The author and Springer Verlag gratefully acknowledge SAP 's kind permission to use its trademark in this publication. SAP AG is not the publisher of this book and is not responsible for it under any aspect of press law. In particular, R/3 and ABAP/4 are registered trademarks ofsap, and all screenshots in this book taken from these systems are subject to the copyright by SAP AG. Additional material to this book can be downloaded from http://extras.springer.com. ISBN 978-3-642-62971-6 ACM Computing Classification {1998): D.2 Library of Congress Cataloging-in-Publication Data Mende, Ulrich. (Softwareentwicklung für R/3. En~isch) Software development for SAP R/3 : data dictionary, ABAP/4, interfaces/ Ulrich Mende. p. cm. Includes bibliographical references and index. ISBN 978-3-642-62971-6 ISBN 978-3-642-57225-8 (ebook) DOI 10.1007/978-3-642-57225-8 1. SAP R/3. 2.ABAP/4 (Computer program language) 3. Client/server computing. I. Title HF5548.4.R2M4613 2000 650'.0285' 53769--dc21 99-32064 CIP This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer-Verlag. Violations are liable for prosecution under the German Copyright Law. Springer-Verlag Berlin Heidelberg 2000 Originally published by Springer-Verlag Berlin Heidelberg New York in 2000 Softcover reprint ofthe hardcover 1st edition 2000 The use of designations, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Cover design: Künkel + Lopka, Heidelberg SPIN 10685064-45/3142PS - 54 3 2 1 0
For my wife Ingrid and my daugther Julia
Preface The use of commercial standard software is increasing in importance throughout the world. With its R/3 product, SAP AG has brought the package on the market that provides the most comprehensive functionality. When standard solutions are used, there is, a priori, a conflict of aims between what the standard offers and the company-specific requirements. SAP counters this in the R/3 System by building a modular software that can be customized to meet the customer requirements. However, many users still see themselves forced to make in-house developments, to various degrees, to fit the R/3 System. Here they can use the ABAP Workbench that SAP supplies with every system. The present book targets those persons who need to perform these customer-oriented supplementary developments. It leads the reader through the fundamentals of software development within the R/3 System using the ABAP Workbench. These principles differ from other development environments, in particular, through their complexity and the close integration with the R/3 System. Because an installation for testing and training purposes on the PC at home is not an option, I considered a structured, understandable introduction to the material in the form of a book to be more important. If you initially read the book "offline" from an R/3 System, you will have it much easier later when you use the system directly. You will be familiar with new terms and their interrelationships. You can then concentrate on their form in the system-user interface and the operation of the system. I am grateful to the Mummert + Partner Consultancy AG, who provided me with generous background and technical support for this book project. In particular, I would like to thank my colleague, Rainer Illmann, who read the manuscript and provided important comments; Frank Wachtel, who wrote the programs and text parts in Chapter 6; Bernd Jastrow, who developed the transaction manager in Chapter 9; Jens Schotzig and Carola Rensen, who as administrators supported me and provided information for Chapter 2. My thanks also go to Anthony Rudd, who translated the text into English, and Axel FraBdorf, who adapted the data and sample programs into English. I would also like to thank Springer-Verlag, especially Hans Wossner, for the excellent cooperation. Berlin, January 2000 Ulrich Mende
Table of Contents 1 Introduction...... 1 1.1 Content and Aim of the Book... 2 1.2 Limitations... 3 2 R/3 Computer and Software Architecture... 5 2.1 Three-level Client-Server Architecture... 5 2.2 Software Architecture... 8 2.3 Operational Modes for Developers... 10 3 The Example - A Service System... 17 3.1 Logical Data Model... 18 3.2 Use of the Example... 19 4 Data Dictionary and Data Modeler... 21 4.1 Data Dictionary... 21 4.2 Data Modeler.... 36 5 Workbench... 41 5.1 Program Development Objects... 42 5.2 Primary Objects... 48 5.3 Use of the Workbench... 50 5.4 Important Workbench Tools... 53 6 ABAP/4 Fundamentals... 57 6.1 ABAP/4 Characteristics... 57 6.2 Internal Fields... 62 6.3 Output Instructions - WRITE, SKIP, UUNE, NEW-PAGE... 67 6.4 Control Instructions... 70 6.5 Field Strings... 80 6.6 Internal Tables... 86 6.7 User-Defined Data Types - TYPES... 96 6.8 Field Symbols - FIELD-SYMBOLS, ASSIGN... 98 6.9 Database Access Using Open SQL... 100 6.10 Database Access with Native SQL... 115
X Table of Contents 7 Interactive Reports... 119 7.1 Event Control... 119 7.2 Texts and Menus... 125 7.3 List Processing... 127 704 Group Change... 132 8 Advanced Programming Techniques... 137 8.1 Macros and Includes... 137 8.2 Subprogram Technique Using Forms... 139 8.3 Data Exchange Between Reports... 151 804 Logical Databases... 155 8.5 Function Groups and Function Modules... 166 8.6 Authorization Checks... 181 9 Development of Dialog Transactions... 183 9.1 Concept... 183 9.2 Dialog Program Components and Their Processing... 185 9.3 Screen Processing... 197 9 A Screen Flow Control... 201 9.5 Example 1: Hand Calculator... 205 9.6 Screen Layout Features... 210 9.7 Example 2: Two Table Controls on a Dynpro... 215 9.8 Database Operations... 221 9.9 Example 3: Updating Action... 223 9.10 Transaction Manager for Complex Business Transactions... 227 10 Background Processing... 241 10.1 Concept... 241 10.2 Interactive Processing with the Job Control... 242 10.3 Programming the Job Control - an Example... 249 loa Special Questions Concerning the Background Processing... 252 11 File Interfaces... 257 11.1 Read and Write Files on the Application Server... 257 11.2 Read and Write PC Files... 259 11.3 Processing of the Data from an ASCII File... 261 1104 Logical File Interfaces (LFI)... 267 12 Batch Input... 285 12.1 Concept... 285 12.2 Classic Batch Input Using Sessions... 287 12.3 Batch Input Using CALL TRANSACTION... 293
Table of Contents XI 13 Desktop Integration... 295 13.1 Remote Function Call (RFC)... 295 13.2 Desktop Integration with OLE... 301 14 Development Aids... 313 14.1 Pretty Printer and Program Checks... 313 14.2 Testing of Function Modules... 315 14.3 Dump Analysis... 317 14.4 Debugger... 318 14.5 SQL Trace... 321 14.6 Runtime Analyses... 321 Appendix... 325 A Important System Fields from the SYST Structure... 325 B Important Transaction Codes... 329 C Programs... 331 D Sample Tables... 333 E Diskette Contents... 340 Bibliography... 341 Index... 343