Start of Content Area

Calling Screens from List Processing  Locate the document in its SAP Library structure

To call a screen from list processing, use the statement

CALL SCREEN nnnn.

This inserts a screen sequence into the program flow as described in the section Calling Screen Sequences. The list processor passes control to the dialog processor.

The context from the time of the call is retained. If you call a screen sequence during processing of a particular list level, it is processed until the end of a screen with next screen 0. Then the dialog processor returns control to the list processor, and processing carries on after the CALL SCREEN statement.

Example

Example

The following program is connected to the logical database F1S.

REPORT demo_call_screen_from_list.

NODES  spfli.
TABLES demo_conn.

DATA: ok_code LIKE sy-ucomm,
      save_ok LIKE sy-ucomm.

TOP-OF-PAGE.
  WRITE 'List lf Flights'(001) COLOR COL_HEADING.
  ULINE.

GET spfli FIELDS carrid connid.
  WRITE: / spfli-carrid, spfli-connid.
  HIDE:    spfli-carrid, spfli-connid.

END-OF-SELECTION.
  CLEAR:   spfli-carrid, spfli-connid.

AT LINE-SELECTION.
  CHECK not spfli-carrid is initial.
  demo_conn-carrid = spfli-carrid.
  demo_conn-connid = spfli-connid.
  CALL SCREEN 100.
  CLEAR: spfli-carrid, spfli-connid.

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
    WHEN OTHERS.

      SELECT  SINGLE *
        FROM  sflight
        INTO  CORRESPONDING FIELDS OF demo_conn
        WHERE carrid = demo_conn-carrid AND
              connid = demo_conn-connid AND
              fldate = demo_conn-fldate.

        IF sy-subrc ne 0.
          MESSAGE e047(sabapdocu).

        ELSE.
          SET SCREEN 200.
        ENDIF.

  ENDCASE.
ENDMODULE.

MODULE status_0200 OUTPUT.
  SET PF-STATUS 'SCREEN_200'.
ENDMODULE.

MODULE user_command_0200 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE  save_ok.
    WHEN 'BACK'.
      LEAVE TO SCREEN 100.
    WHEN 'SAVE'.

      ...             "e.g. update records in database
      MESSAGE i888(sabapdocu) WITH text-002.
      SET SCREEN 0.
  ENDCASE.

ENDMODULE.

When you run the program, you can enter selections on the selection screen of the logical database, after which a basic list is displayed.

If you select a list line, the AT LINE-SELECTION event is triggered, and screen 100 is called. The contents of two of the screen fields are set in the ABAP program. The layout of screen 100 is:

This graphic is explained in the accompanying text

and its flow logic is:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.

PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  FIELD demo_conn-fldate MODULE user_command_0100.

You can enter a flight date for the flight that you chose from the list. If you then choose Continue, the corresponding data is read from table SFLIGHT, and screen 200 is set as the next screen. The layout of screen 200 is:

This graphic is explained in the accompanying text

and its flow logic is:

PROCESS BEFORE OUTPUT.
  MODULE status_0200.

PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  MODULE user_command_0200.

The user can change and save data for the selected flight. (The programming for the database update is not shown in this example.)

After the screen has been processed, the next screen is set to 0, concluding the screen sequence. The system returns to the basic list.

Equally, if you choose Back (function code BACK) on either of the two screens, control returns to the basic list.

 

 

End of Content Area