Let’s take a first look at an SAP ABAP program. The following section will look at the SAP System and introduce the ABAP Workbench. But before doing so, let’s take a look at the structure of an ABAP program.
Like many other programming languages, ABAP programs are normally structured into two parts.
The first is what is considered to be the Declaration section. This is where you define the data types, structures, tables, work area variables and the individual fields to be used inside the programs. This is also where you would declare global variables that will be available throughout the individual subsections of the program. When creating an ABAP program, you do not only declare global variables, but you also have the option to declare variables that are only valid within specific sections inside the programs. These sections are commonly referred to as internal Processing Blocks.
The Declaration part of the program is where you define the parameters used for the selection screens for the reports. Once you have declared tables, global variables and data types in the Declaration section of the program, then comes the second part of the ABAP program, where all of the logic for the program will be written. This part of an ABAP program is often split up into what are called Processing Blocks.
The Processing Blocks defined within programs can be called from the Dynpro processor, which were discussed previously, depending on the specific rules created within the program. These Processing Blocks are almost always just small sections of programming logic which allow the code to be encapsulated.
First Look
When logged into an SAP system it will look something similar to the image below.
The way the SAP GUI looks may vary, the menu to the side may be different, but here the display show a minimal menu tree which will be used throughout this book.
The first thing to do here is look at the ABAP Workbench. To access this, you use the menu on the left hand side. Open the SAP menu, choose Tools and open the ABAP Workbench, where there will be four different options.
The first thing to look at is a quick overview of how to run a transaction in SAP. There are two ways to do this. Firstly, if the overview folder is opened, any item which does not look like a folder itself, is a transaction which can be run. In this instance, we can see the Object Navigator:
Double click this, and the transaction will open:
To exit out of the transaction, click the Back button:
The second way of running a transaction is to enter the transaction code into the transaction code input area:
A useful tip to become familiar with the names of transactions is to look at the Extras menu –> open Settings and in the dialogue box which appears, select the option ‘Display technical names’ and click the ‘Continue’ icon:
The menu tree will be refreshed, and when the ‘Overview’ folder is opened, the transaction codes will be made visible. It is now possible to become familiar with them, and enter them directly into the transaction code input area:
Now, a step-by-step look will be taken through the major transactions of the ABAP Workbench to become familiar with, and use, as an ABAP developer.
ABAP Dictionary
One thing most programs will have in common is that they will read and write data to and from the Database tables within the SAP system. The ABAP Workbench has a transaction to allow the creation of Database tables, view the fields which make up these tables and browse the data inside. This is called the ABAP Dictionary. The ABAP Dictionary can be found by expanding the ABAP Workbench menu tree –> ‘Development’. The transaction code to run the ABAP dictionary directly is SE11:
ABAP Editor
The next and probably most commonly used part of the ABAP Workbench is the ABAP Editor, which much of this course will focus upon. The ABAP Editor is where all of the code is created, the logic built and, by using forward navigation (a function within an SAP system which will be discussed later), function modules defined, screens created and so on. The ABAP Editor can be found under the ‘Development’ menu, as shown above and with transaction code SE38.
Function Builder
The next important part of the Workbench is the Function Builder, which is similar to the ABAP Editor. Its main function is to define specific tasks that can be called from any other program. Interfaces are created in the Function Builder, where the different data elements and different types of tables are defined, that can be passed to and from the Function which is built. The Function Builder will be discussed a little later on, when the programs created are encapsulated into function modules. The Function Builder can be called with transaction code SE37.
Menu Painter
The next item to look at here is called the Menu Painter, which can be found in the ‘User Interface’ folder inside the ‘Development’ menu, or with transaction code SE41. This is a tool which can be used to generate menu options, buttons, icons, menu bars, transaction input fields, all of which can trigger events within the program. You can define whether events are triggered using a mouse click, or with a keyboard-based shortcut. For example, in the top menu bar here, the ‘Log off’ button can be seen, which can be triggered by using (Shift + F3):
Screen Painter
While the Menu Painter is used for building menu items, menu bars and so on, the next item on the list is the Screen Painter, transaction code SE51, which allows you to define the user input screen, meaning that you can define text boxes, drop-down menus, list boxes, input fields, tabbed areas of the screen and so on. It allows you to define the whole interface which the user will eventually use, and behind the initial elements that are put on the screen, you can also define the individual functions which are called when the user interacts with them.
Object Navigator
The last item to look at here is the Object Navigator, a tool which brings together all the previous tools, providing a highly efficient environment in which to develop programs. When building large programs, with many function modules, many screens, the Object Navigator is the ideal tool to use to navigate around the development. It can be found in the ‘Overview’ menu of the ABAP Workbench, with transaction code SE80.
These are the main features of the ABAP Workbench interacted with during this course. In the SAP menu tree, there are evidently many more transactions which can be used to help develop programs, but these cover the vast majority of development tools which will be used.