Skip to content

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

Calling Lists from Dynpro Processing

This example shows how to switch from dynpro 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

This example switches to list processing while processing dynpro 100. The screen layout of dynpro 100 has a single input field, the component CARRID of the structure SDYN_CONN from ABAP Dictionary. The flow logic of dynpro 100 is:

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 dynpro 500. Dynpro 500 encapsulates a basic list. It has the following flow logic:

PROCESS BEFORE OUTPUT.
  MODULE call_list_500.
PROCESS AFTER INPUT.

The module call_list_500 defines the basic list and switches to list processing. After returning from the list display, the system branches to the next dynpro 0, which means that dynpro 500 represents a dynpro sequence with only one dynpro. When list processing is complete, the system goes back to a point after the call point in user_command_0100.

If the user selects a line on the basic list, a details list appears. This is done using the event block AT LINE-SELECTION. The program also contains event blocks for TOP-OF-PAGE and TOP-OF-PAGE DURING LINE-SELECTION, which define page headers for both the basic list and details list.

Since there is only one list system in this program, there is no need for case distinctions within the list events.