Review of Basic Dialog Programming Techniques
You use the Screen Painter and the Menu Painter to create and design screen templates and screen programs.
You define the processing logic in an ABAP/4 program (module pool).
Data structures are defined in the ABAP/4 Dictionary. You can access these structures from the ABAP/4 program and when defining screen fields.
The dialog processor controls the flow of your dialog program.
To create a screen, take the following steps:
Define the basic features of a screen (screen attributes)
Design the screen layout (in the fullscreen editor)
Define the field attributes (field list)
Write the screen flow logic
The most important ABAP/4 program components are found in the following objects:
Global data or Dictionary structures in the TOP include program (data declarations)
PBO (Process Before Output) module
PAI (Process After Input) module
Subroutines (if required)
The screen flow logic is divided into two events for each screen:
The PROCESS BEFORE OUTPUT event (PBO) is executed before the screen is displayed.
The PROCESS AFTER INPUT event (PAI) is executed after the user has pressed ENTER.
The system processes the modules in an event sequentially.
In each module, control passes from the dialog processor to the ABAP/4 processor. After processing, control is returned to the dialog processor.
When all the PBO modules have been processed, the contents of fields in the ABAP/4 work area are copied to the identically named fields in the screen work area.
Before the PAI module is processed, the contents of fields in the screen work area are copied to the identically named fields in the ABAP/4 work area.
Create your program (ABAP/4 module pool) using the ABAP/4 Development Workbench.
A customer dialog program should have the format SAPMZxxx or SAPMYxxx.
Initially, the TOP include program contains only the PROGRAM statement. You can then add all the necessary data declarations and TABLES statements (global data).
If you are using includes, the system proposes names according to the following rule: The first five characters are the same as the last five characters of the program name. The sixth character identifies the contents of the include - . O for PBO modules, F for FORM routines (subroutines) -, while the seventh and eighth characters are 01, apart from the TOP include. Examples: The TOP include for the ABAP/4 module pool SAPMTALA would be MTALATOP; The include for the PAI modules of the same program would be MTALAI01.
Note:
Please define your objects in this chapter as local private objects.
From the object list, you create the desired screens for your module pool.
To do this, the system takes you into the Screen Painter.
After entering the screen number, you maintain the screen attributes. Here, you enter a short text, choose the screen type and specify the number of the next screen.
To design screens, you use the Screen Painter.
The interface of the graphical Screen Painter contains easy-to-use functions for defining the various screen elements (. input/output fields, field texts, boxes, etc.). You choose each screen element and position it on the screen using the mouse.
To delete screen elements, you select the element with the mouse and then choose Delete.
To move screen elements, you use the mouse to drag the element to the required position.
Note:
From Release , the graphical Screen Painter is supported by Windows NT, Windows 95 and UNIX. If you are using other operating systems, you use the alphanumeric Screen Painter.
There are six field list views available for maintaining the screen field attributes. Alternatively, you can define them from one of the lists. Attribute maintenance for one field is also possible in the fullscreen editor.
In the Screen Painter, you use external data types. The external data types of fields that you select from the ABAP/4 Dictionary are displayed in the ‘Format’ column. In the case of fields (templates) that do not have any ABAP/4 Dictionary reference, you define an external data type yourself.
You can find out the correspondence of external data types to internal data types (. ABAP/4 data types) by referring to the documentation on the ABAP/4 key word TABLES. Examples are as follows: ABAP/4 Dictionary data type ABAP/4 data type CHAR C NUMC N
You specify define your MODULE statements in the flow logic.
If you choose a module by double-clicking, the system creates suitable MODULE ... ENDMODULE statements in the appropriate include program. This is known as forwards navigation.
If no include program exists, the system will create one if you wish. It also inserts an INCLUDE statement in the main program.
The ABAP/4 MODULE statements for PBO modules contain the addition OUTPUT, while the MODULE statements for PAI modules contain the addition INPUT.
In dialog processing, data is passed between the screens and the ABAP/4 program at runtime. The system performs this communication automatically, but you must use identical names in the screens and the module pool.
Define the relevant fields as global data in the TOP include program. To do this, you process either the TOP include program as a whole or the sections concerning global data or Dictionary structures. Even then, the TOP include program is still implicitly in control.
You can start an ABAP/4 dialog program ("transaction") by specifying a transaction code.
Customer transactions must begin with Z or Y.
The system stores your specifications in the table TSTC. (Instead of creating a transaction from the object list, you can maintain the table itself.)
Each pushbutton must have a function code.
When the user presses a pushbutton, the PAI module is triggered.
When the user calls a function (by means of a pushbutton, menu entry or function key), the function code appears in the field which you enter in the field list with the predefined attributes of length 4 and format OK. This is known as the OK code field.
To be able to react to a function code in the ABAP/4 module pool, you define an identically named OK code field. This contains the current function code after the field has been transported.
You are recommended to use a backup version of the OK code field to avoid sending a screen that already has a function code.
© SAP AG BC410 ABAP/4 Development Workbench 1- PAGE 15