Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Classic Lists →  Displaying Lists →  LEAVE TO LIST-PROCESSING 

Calling Lists from Within Screen Processing

The example shows how to switch from screen processing to list processing.

Other versions: 7.31 | 7.40 | 7.54

Source Code

REPORT demo_leave_to_list_processing .

TABLES demo_conn.

DATA: wa_spfli TYPE spfli,
      flightdate TYPE sflight-fldate.

CALL SCREEN 100.

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

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100.
  CALL SCREEN 500.
  SET SCREEN 100.
ENDMODULE.

MODULE call_list_500 OUTPUT.
  LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
  SET PF-STATUS space.
  SUPPRESS DIALOG.
  SELECT  carrid, connid, cityfrom, cityto
    FROM  spfli
    WHERE carrid = @demo_conn-carrid
    INTO  CORRESPONDING FIELDS OF @wa_spfli.
    WRITE: / wa_spfli-carrid, wa_spfli-connid,
             wa_spfli-cityfrom, wa_spfli-cityto.
    HIDE: wa_spfli-carrid, wa_spfli-connid.
  ENDSELECT.
  CLEAR wa_spfli-carrid.
ENDMODULE.

TOP-OF-PAGE.
  WRITE text-001 COLOR COL_HEADING.
  ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.
  WRITE sy-lisel COLOR COL_HEADING.
  ULINE.

AT LINE-SELECTION.
  CHECK NOT wa_spfli-carrid IS INITIAL.
  SELECT  fldate
    FROM  sflight
    WHERE carrid = @wa_spfli-carrid AND
          connid = @wa_spfli-connid
    INTO  @flightdate.
    WRITE / flightdate.
  ENDSELECT.
  CLEAR wa_spfli-carrid.

Description

In this example, the system branches to list processing while screen 100 is being processed. The screen layout of screen 100 has a single input field, the component CARRID of the structure SDYN_CONN from the ABAP Dictionary. The flow logic of screen 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE status_0100.
PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  MODULE user_command_0100.

In the PAI module user_command_0100, CALL SCREEN is used to call screen 500. Screen 500 encapsulates a basic list. The flow logic of this screen is as follows:

PROCESS BEFORE OUTPUT.
  MODULE call_list_500.
PROCESS AFTER INPUT.

The module call_list_500 defines the basic list and branches to the list display. Since the system branches to the next screen 0 after returning from the list display, screen 500 represents a screen sequence with a single screen only. When list processing is completed, the system returns to after the callpoint in user_command_0100.

Selecting a line in the basic list creates a details list. The event block for AT LINE-SELECTION has been programmed for this purpose. In addition, the page headers for the basic and details list are defined in the event blocks for TOP-OF-PAGE and TOP-OF-PAGE DURING LINE-SELECTION.

Since only one list system is used in this program, separate control during list event processing is not necessary.