ABAP Dialog Programs

ABAP Dialog Programs are ABAP programming that accept user input and allow an interaction between the program and the user, using dialog boxes. Dialog programs are type ‘M’ programs or Module Pool programs. They have to be associated with a transaction code in which the initial screen is specified.

Using dialog programming, a user can interact with the program by entering data, selecting a menu item, by clicking on a data item or display button. Also, using dialog programming, a user may navigate back and forth in between screens.

How is a Dialog Program different from a Report Program?

In a report program, a user directly reads from a database without having the capability to make changes to the database. However, a dialog program allows a user to change the contents of a database and is far more interactive than a report program.

What does a Dialog Program consist of?

A report program has just one independent program which is unrelated to other objects. A dialog program however has several interdependent objects that do different things but serve a common purpose. These objects are linked by hierarchy to the main program and executed sequentially in accordance with the commands used in the main program.

Components of Dialog program 

Transaction code

The transaction code is created in the Repository Browser of ABAP Workbench, or can be created using the Transaction code SE93. The transaction code starts the screen sequence, by linking the ABAP program to an initial screen. The CALL SCREEN command is used to create the screen sequence from any point in the ABAP program.

Screens

An SAP system is actually a system of inter-related screens, each on leading to another. Screens can be created by the use of the Transaction code SE51 or by using the Screen Painter in the ABAP Workbench. Every screen is related to an ABAP program, consists of layouts and screen masks and is activated according to the screen flow logic. The layout determines the how the input and output fields are placed, as well as other graphical elements such as check boxes and radio buttons. A screen flow logic decides how the actual processing takes place.

GUI status

GUI status is used to control the menu bars, standard toolbar, application toolbar and can be created by using the Menu Painter in the ABAP Workbench.

ABAP Program

In SAP every screen and GUI status are related to an ABAP program, which has the dialog modules which are activated according to the screen flow logic. These modules also process the user input from the GUI status.

Screen Flow Logic

Screen Flow logic has the following events”

  • Process Before Output (PBO) event: processed before the screen is displayed
  • Process After Input (PAI) event: processed after a user action on the screen
  • Process on help request (POH): processed when F1 is pressed
  • Process on value request (POV): processed when F4 is pressed

Dynpro

A Dynpro is also called a Dynamic Program and consists of a screen together with its Flow logic. It is responsible for just one step of a Dialog Program.

ABAP Dialog Programs structure

ABAP Module Pool

An ABAP Module Pool is a collection of the all the components and dialog programs that we have discussed above.

Given below is a simple example of a Dialog Program that takes the input for two numbers and displays the sum on the screen. Here, we have only presented the ABAP program component.

[codesyntax lang=”abap” lines_start=”0″ title=”Dialog Program Example”]

*&---------------------------------------------------------------------*
*& Module Pool       ZADD2NOS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*


INCLUDE ZADD2NOS_TOP                            .    " global Data

DATA : VAR1 TYPE I,
       VAR2 TYPE I,
       RES TYPE I,
       TUCOMM LIKE SY-UCOMM.

* INCLUDE ZADD2NOS_O01                            .  " PBO-Modules
* INCLUDE ZADD2NOS_I01                            .  " PAI-Modules
* INCLUDE ZADD2NOS_F01                            .  " FORM-Routines

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0500  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0500 INPUT.

TUCOMM = SY-UCOMM.


CASE TUCOMM.

  WHEN 'ADDI'.

    RES = VAR1 + VAR2.

  WHEN 'CANC'.

    LEAVE PROGRAM.

ENDCASE.





ENDMODULE.                 " USER_COMMAND_0500  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_0500  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0500 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.


* MOVE : RES TO RES,
*        VAR1 TO VAR1,
*        VAR2 TO VAR2.

MOVE : VAR1 TO VAR1,
       VAR2 TO VAR2,
       RES TO RES.



ENDMODULE.                 " STATUS_0500  OUTPUT

[/codesyntax]

 Read more for SAP ABAP training tutorials that explains step by step with scenarios.