By Bernd Matzke
This tip is excerpted from ABAP/4: Programming the SAP R/3 System, by Bernd Matzke and published by Addison
If you want to enter more values in a screen program and the screen program does not have enough space, you can enter these values in a 'follow-on' screen program. To make it easier to work with this kind of screen program, the next screen is often displayed as multiply-nested dialog boxes. So that users do not have to run through all the screen programs step by step when they finish entering data, the closing function code is available in all the dialog boxes.
Screen program 400: ... CALL SCREEN 500 STARTING AT 10 10. * Subscreen 500 is called and processed. * The function is closed e.g. by function code DATU * (transfer data) and EABB (cancel) * The function code is stored in global field FCODE. * The function code in screen program 500 is not deleted. IF FCODE = 'DATU". CLEAR FCODE. "Only in the first dialog box SET SCREEN 0. ENDIF. ... DYNPRO 500: ... IF FCODE = 'DATU'. SET SCREEN 0. LEAVE SCREEN. ENDIF. ...
The statements shown above result in the following procedure:
Screen program 400 is to be called. This screen program is to be the first dialog box to be called from an initial screen. The lines shown above derive from the flow logic of screen program 400. Screen program 500 is called and processed, also as a dialog box. This screen program should contain the function keyes
COPY DATA (function code
CANCEL (EABB). The
COPY DATA key should allow you to return to the initial screen and therefore close all the dialog boxes at the same time. For this reason, the
FCODE in the screen program 500 is not deleted, but is passed on to screen program 400. There the
FCODE is evaluated immediately after the
CALL SCREEN statement and the screen program is closed. To preven undesirable side effects in the calling initial screen, the
FCODE is initialized beforehand.
If an abnormal end occurs over several levels, the statements are transferred from screen program 400 as appropriate into all the other screen programs. You can then of course only initialize
FCODE in the screen program that you have called from the initial screen.
To read more about ABAP/4: Programming the SAP R/3 System, click here.
This was first published in November 2001