Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  SAP GUI User Dialogs →  Classic Lists →  Creating Lists →  HIDE 

Lists, HIDE Technique

This example demonstrates how to implement program-driven data passes for lists to the ABAP program using HIDE.

Other versions: 7.31 | 7.40 | 7.54

Source Code


TABLES: spfli, sbook.

DATA: num TYPE i,
      dat TYPE d.


  num = 0.

GET spfli.

  num += 1.
  WRITE: / spfli-carrid, spfli-connid,
           spfli-cityfrom, spfli-cityto.
  HIDE:    spfli-carrid, spfli-connid, num.


  CLEAR num.


  WRITE 'List of Flights'.
  WRITE 'CA  CONN FROM                 TO'.


  CASE sy-pfkey.
      WRITE sy-lisel.
    WHEN 'WIND'.
      WRITE:  'Booking', sbook-bookid,
           /  'Date   ', sbook-fldate.


  CASE sy-ucomm.
    WHEN 'SELE'.
      IF num NE 0.
        CLEAR dat.
        SELECT * FROM sbook WHERE carrid = spfli-carrid
                            AND   connid = spfli-connid.
          IF sbook-fldate NE dat.
            dat = sbook-fldate.
            WRITE / sbook-fldate.
            POSITION 16.
            POSITION 16.
          WRITE sbook-bookid.
          HIDE: sbook-bookid, sbook-fldate, sbook-custtype,
                sbook-smoker, sbook-luggweight, sbook-class.
        IF sy-subrc NE 0.
          WRITE / 'No bookings for this flight'.
        num = 0.
        CLEAR sbook-bookid.
    WHEN 'INFO'.
      IF NOT sbook-bookid IS INITIAL.
        WINDOW STARTING AT 30 5 ENDING AT  60 10.
        WRITE: 'Customer type   :', sbook-custtype,
             / 'Smoker          :', sbook-smoker,
             / 'Luggage weigtht :', sbook-luggweight UNIT 'KG',
             / 'Class           :', sbook-class.


At START-OF-SELECTION time, the status FLIGHT is set for the basic list. In the status FLIGHT, the function key F2 and a pushbutton are assigned the function code SELE (text SELECT). This means the event AT USER-COMMAND is triggered when the user double-clicks, presses F2, or chooses the pushbutton SELECT.

The three fields spfli-carrid, spfli-connid, and num are written to the Hide area while the basic list is created. After a line is selected, the details list defined for the function code SELE in AT USER-COMMAND is displayed. After the AT USER-COMMAND event, all fields of the selected line that were stored in the Hide area are loaded again. num is used to check whether a line from the actual list was selected. The details list is given the status BOOKING, where F2 is assigned the function code INFO (with the text Booking Information) The details list displays data which can be selected using the Hide fields of the basic list. For each list line displayed, the system stores additional information in the Hide area.

If the user selects a line of the details list, the system displays the stored information in a dialog box with the status WIND. For the WIND status, the default values are applied when the list status is synchronized. sbook-bookid is used to check whether a valid line was selected.

The program itself sets all page headers and the title bar of the dialog box.