ARTIClE
Screens, Screen Sequences
This example shows you how screen sequences behave.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
Transaction DEMO_SCREEN_FLOW uses three screens. Screens 100 and
200 form a sequence. Screen 210 is a modal dialog box and is only called
if specific conditions are met:
Screen 100: The user enters flight data, chooses Continue to
request a detailed display of this data or ends the transaction.
Screen 200: The system displays all detail data for the flight in input
fields. The user makes any changes required by overwriting the data
displayed.
Screen 210: The modal dialog box appears only if the user attempts to
quit screen 200 by choosing Back or Exit without saving the values
modified. The dialog box allows the user to save the changes or cancel
the process.
This transaction is a good example of how a screen sequence is
implemented. To see how the modal dialog box is called, we have a closer
look at screen 200. When processing the BACK or EXIT
function codes, the PAI module must check if the flight data has
been changed since it was last displayed or saved. If this is the case,
screen 210 is to be called as a modal dialog box. The following sections
of the flow logic for screen 200 are relevant here:
PROCESS AFTER INPUT.
MODULE exit_0200 AT EXIT-COMMAND.
...
MODULE user_command_0200.
The system calls two dialog modules at the PAI event. The user
interface of transaction DEMO_SCREEN_FLOW offers the functions
Back , Exit , and Cancel as return commands. On
screen 200, however, the user is only to be provided with the
Cancel
command to quit the screen immediately and return to screen 100. The
corresponding function code is processed in module exit_200 . The
next screen in the sequence is dynamically set to 100 and processing of
screen 200 is ended immediately with LEAVE SCREEN . All other
function codes for screen 200 are processed in module
user_command_200 :
The Save function triggers a database update.
The Exit and Back functions call subroutine
safety_check . This subroutine searches for any unsaved data on the
screen and calls creen 210 if this is necessary.
If the Exit function is chosen (function code EXIT ), the
user leaves the transaction completely as the screen sequence is
dynamically ended using SET SCREEN 0 . If the function Back
(function code BACK) is chosen, screen 100 is dynamically set as the
next screen in the sequence using SET SCREEN 100 .
The subroutine safety_check first compares the current values of
the screen fields with the values saved. If these values match, the user
does not have to save the data, and the subroutine is ended. If the
values do not match, safety_check calls the modal dialog box of
screen 210. The dialog box asks the user whether the data should be
saved and returns the user's response as a function code in the field
ok_code . The static next screen of screen 210 is again screen
210. The processing logic (module user_command_210 ), however,
always sets the next screen dynamically to 0 with the result that
control passes back to the subroutine.
The following graphic summarizes the flow of the screen sequences in the
example:
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved