SAP-ABAP supports two types of programs - Report Program and Dialog Program. Module pool program can be called dialog programming. If ABAP program demands user input, Dialog programming is used.
Module pool program has different modules which contains different logic for different screen. Any number of screens can be developed by module pool programming. Every screen has a logic which runs at the back end. Module pool program can be executed by Transaction Code only.
Difference between Report and Dialog Programs
A report is a program that typically reads and analyzes data in database tables without changing the database.
A dialog program allows you to work interactively with the system and to change the contents of the database tables. Each dialog program has a certain sequence of screens that are processed by the system one after the other.
The components of a dialog program are:
1) Transaction codeThe transaction code starts a screen sequence.You create transaction codes in the Repository Browser in the ABAP Workbench or using Transaction SE93.A transaction code is linked to an ABAP program and an initial screen.You can start a screen sequence from any ABAP program using the CALL SCREEN statement.
2) ScreensEach dialog in an SAP system is controlled by one or more screens.You create screens using the Screen Painter in the ABAP Workbench through transaction SE51Each screen belongs to an ABAP program.These screens consist of a "screen mask" or "layout" and its flow logic. The screen has a layout that determines the positions of input/output fields and other graphical elements such as checkboxes and radio buttons. A flow logic determines the logical processing within screen.
3) GUI statusEach screen has a GUI status(es) which are independent components of a program.This controls the menu bars, standard toolbar, application toolbar , with which the user can choose functions in the application.You create them in the ABAP Workbench using the Menu Painter.
4) ABAP ProgramEach screen and GUI status in the R/3 System belongs to one ABAP program.The ABAP program contains the dialog modules that are called by the screen flow logic, and also process the user input from the GUI status.ABAP programs that use screens are also known as dialog programs.In a module pool (type M program); the first processing block to be called is always a dialog module. However, you can also use screens in other ABAP programs, such as executable programs or function modules. The first processing block is then called differently; for example, by the runtime environment or a procedure call. The screen sequence is then started using the CALL SCREEN statement.
5) Screen Flow Logic
In the Object Browser, the module pool code belongs to one of the following categories:
Global fields: data declarations that can be used by all modules in the module pool
PBO modules: modules that are called before displaying the screen
PAI modules: modules that are called in response to the user input
Subroutines: subroutines that can be called from any position within the module pool
By default, the system divides a module pool into one or several include programs. An include program can contain several modules of the same type (only PBO modules or only PAI modules).
Events in Dialog Program
This event is triggered before the screen is displayed. The processing of screen before the display of screen is done in this event. For example , filling in default values in the screen fields.
This event is responsible for processing of screen after the user enters the data and clicks the pushbutton. The processing of screen can include displaying another screen, or just displaying list or quitting the transaction itself and many more things. Usually it is displaying another screen. These operations can be carried out in the PAI event. OKCODE plays an important role in this operation.
Process on value request is triggered when the user clicks F4 key. You can handle this event when the user presses F4 key by writing code for the same in module pool program. Normally when the user presses F4, list of possible values is displayed. The standard list produced by system is adequate for applications you develop yourself. However, you can also have the option of setting up your own documentation and lists of possible values that are more detailed.
Normally when the user places the cursor on the field and presses F1 function key, the system displays its own Help for that particular field. You can add your own functionality to the Help button by writing code for the same in the POH event.
6) DynproA screen together with its Flow logic is called a Dynpro ("Dynamic Program" since the screen flow logic influences the program flow)Each dynpro controls exactly one step of your Dialog Program.The screens belonging to a program are numbered. The screen flow sequence can be either linear or cyclic. From within a screen chain, you can even call another screen chain and, after processing it, return to the original chain. You can also override the statically-defined next screen from within the dialog modules of the ABAP program.
7) ABAP Module PoolOn a PBO or PAI event a Dynpro calls an ABAP dialog program. Collection of such programs is called the ABAP module pool.For example modules called at the PAI event are used to check the user input and to trigger appropriate dialog steps, such as the update task.All dynpros to be called from within one transaction refer to a common module pool.
Structure of a Dialog Program
Process Flow for a Dialog Program