Wednesday, June 10, 2009

Calling ABAP Dialog Modules

The main task of the screen flow logic is to call dialog modules in an ABAP program. You can do this using the MODULE statement, which can be programmed in the four possible event blocks of screen flow logic. In the PBO event, you can use this statement to call any dialog module in the ABAP program that has been defined using

MODULE OUTPUT.
...
ENDMODULE.

In the PAI, POH, and POV events, you can use the statement to call any dialog module in the ABAP program that has been defined using

MODULE [INPUT].
...
ENDMODULE.

It is technically possible to have two dialog modules with the same name in the same program, one defined using OUTPUT, the other with INPUT. However, this is not recommended.

Since dialog modules in an ABAP program can be called from more than one screen, you can program functions that you need in several screens centrally in a single module. For example, it is usual to copy the contents of the OK-code field into an auxiliary variable and then reset the field in all PAI events. You could program this task in a single module that you would then call from the PAI event of all screens.

If you need to distinguish between screen numbers in a dialog module, you can use the system field SY-DYNNR, which always contains the number of the current screen. This would allow you, for example, to analyze the function code in a single PAI module and then control the further program flow according to the screen number and function code.

The actual screen sequence is as follows:

This graphic is explained in the accompanying text

The screen display is prepared in the PBO event. The flow logic calls the corresponding ABAP dialog modules. Then, the screen is displayed. When this happens, control passes from the application server to the SAPgui. The screen accepts user input until the user triggers the PAI event. The control then returns to the application server. The program processes user input by calling the corresponding ABAP dialog modules. After the PAI processing is complete, the PBO processing of the next screen starts. The PAI processing and the PBO processing of the next screen form a single dialog step on the application server. The current screen remains visible until the PBO of the next screen is complete, but is not ready for input.

There are various ways of calling the dialog modules in the flow logic. The syntax of the flow logic allows you to call dialog modules conditionally, and to control the transfer of data between the screen and the ABAP program.

No comments:

Blog Archive