How to Develop in Abap
Total Page:16
File Type:pdf, Size:1020Kb
HOW TO DEVELOP IN ABAP How to Develop in ABAP Applies to: SAP NetWeaver 7.0. For more information, visit the ABAP homepage. Summary This is the PDF version of the development blog series on SDN published in 2007 that gave an introduction to ABAP newbies who want to learn how to develop simple programs in ABAP. This PDF file does not contain the few blogs of the original series that explained how to install and administrate the ABAP demo version and how to import and export programs. This PDF document solely focuses on the many blogs that focused on development in ABAP. This is why the PDF file starts with blog 3 and has some gaps in the numbering. The main author of this blogs is Thomas Weiss but some blogs were written by other authors (Manfred Lutz, Hans Tillinger, Dirk Feeken). For more information read the original blogs. If you are interested in the comments and answers to the comments on the blogs you should read the original blogs on SDN. Otherwise this PDF file gives you an easy opportunity to work your way through the whole series. Author Bio Thomas Weiss has a Ph.D. in analytic philosophy. He worked as a professional writer before joining, in 2001, the SAP NetWeaver product management training team where his responsibilities included the e-Learning strategy for ABAP. After becoming more involved in writing ABAP material himself, he is now a member of the SAP NetWeaver Application Server Solution Management. One of his main interests lies in rolling out ABAP topics both for experts and for beginners by writing blogs in SDN. 1 Table of Contents WHY AND HOW THE SERVER MATTERS TO YOU AS A DEVELOPER: SERVER ARCHITECTURE AND WORK PROCESSES .................................................................................................................................. 4 ABAP Application Server for Newbies – Why and How the Server Matters to You as a Developer ....... 4 Developing on the Server .......................................................................................................................... 4 The Three-Layer Architecture ................................................................................................................... 5 Work Processes in Some Detail ................................................................................................................ 5 The Three Layer Architecture Continued.................................................................................................. 7 Summary .................................................................................................................................................... 8 MANY DEVELOPERS ON ONE CENTRAL SERVER - HOW DOES IT WORK? ......................................... 8 Many Developers on One Server – How Does It Work? ........................................................................... 8 Developing on a Central Server – The Way to Keep Your Sources in Sync ............................................ 9 Summary ...................................................................................................................................................10 NAVIGATION IN THE APPLICATION SERVER .........................................................................................10 A FIRST ‘HELLO-WORLD’ PROGRAM .....................................................................................................13 The Repository Browser – The Central Place in the ABAP IDE ..............................................................13 Packages ...................................................................................................................................................14 A Package for Local Objects ....................................................................................................................14 ‘Hello World’ as a Local Program .............................................................................................................14 Summary ...................................................................................................................................................18 CREATING A PROGRAM AND A PACKAGE - AN INTRODUCTION TO THE SAP CHANGE AND TRANSPORT SYSTEM ..............................................................................................................................18 Some Words of Motivation: Why Your Programs Deserve Better than Package $tmp..........................19 Creating a Package - the Chance to Get in Touch With the CTS ............................................................19 Creating a Package - the Details ..............................................................................................................19 The Concept of a Transport Layer ...........................................................................................................21 Some More Basic Concepts of the SAP Change and Transport System ...............................................22 Package Building Continued ....................................................................................................................25 Creating a Program Within a Package .....................................................................................................26 Outlook ......................................................................................................................................................27 A FIRST LITTLE BUSINESS PROGRAM ...................................................................................................28 The Aim: Our First Little Business Program............................................................................................28 How to Use the ABAP Documentation .....................................................................................................28 How to Get an Internal Table with the Line Type of a Database Table ...................................................29 Open SQL in ABAP ...................................................................................................................................30 Test Output of an Internal Table 1: A Loop and a Write-Statement ........................................................30 How to Get to Know the Properties of a Database Table ........................................................................31 What the List Output with the Write Statement Looks like .....................................................................31 Test Output of an Internal Table 2: A Dynamic Way to Output Any Internal Table ................................32 Test Output of an Internal Table 3: The Object Oriented Way ................................................................33 The Whole Code of the Three Alternatives – An Overview .....................................................................34 Summary ...................................................................................................................................................35 GETTING MORE FAMILIAR WITH THE ABAP DICTIONARY ...................................................................35 PARAMETERS and the Selection Screen ................................................................................................36 From the ABAP Dictionary to the Data Browser......................................................................................37 Data Element, Domain, and the Way They Interact .................................................................................39 At Last: The Source of Our Search Help ..................................................................................................40 Summary ...................................................................................................................................................41 DEBUGGING IN ABAP ..............................................................................................................................41 Defining a Custom Structure in a Program ..............................................................................................41 A Useful Addition to the SELECT Statement ...........................................................................................42 What Is Wrong With Our Program – We Start to Debug ..........................................................................43 The New ABAP Debugger – A Short Overview ........................................................................................43 Debugging Our Program ..........................................................................................................................44 Some Words on Efficient SQL Programming ..........................................................................................45 How to Use the ABAP Language Documentation Efficiently ..................................................................46 Summary ...................................................................................................................................................48 GET YOUR PROGRAM UP TO SPEED - OVERVIEW & INTRODUCTION ................................................48 The Programs to be Analysed ..................................................................................................................48 ABAP Runtime Analysis: Tool & Procedure ............................................................................................49 THE FOUNDATION OF AN APPLICATION - CREATING THE DATABASE TABLES ...............................53 The Contents of this Blog