Das fertige Programm

Dies ist Teil 7 von 11 der Serie Interaktive Liste

Hier steht der komplette Quelltext für den ersten Workshop “Interaktive Liste”. Sie können den Quelltext frei verwenden und an Ihre Bedürfnisse anpassen.

REPORT z_tt_ws_interaktive_liste NO STANDARD PAGE HEADING
                                 LINE-SIZE 132
                                 LINE-COUNT 65.


***********************************************************************
***                                                                 ***
*** Generierung von Flugdaten:                                      ***
***    Report S_FLIGHT_MODEL_DATA_GENERATOR                         ***
***    Report SAPBC_DATA_GENERATOR                                  ***
***    Transaktion BC_DATA_GEN                                      ***
***                                                                 ***
***********************************************************************

***********************************************************************
***                                                                 ***
***                                                                 ***
***                 
https://tricktresor.com                      ***
***                                                                 ***
***                                                                 ***
***********************************************************************

*———————————————————————*
*
* Programm:       [ Workshop: Interaktive Liste ]
* Autor:          [ Enno Wulff ]
* Datum:          [ Juni.2004 ]
* Sinn und Zweck:
” Dieser Report dient zum Verständnis interaktiver Listen. Der Report
” unterstützt die Funktionen
” – Individueller Listenkopf
” – Aktionen nach Klick auf ein Listenelement
” – Info-Popup (Legende)
” – Listrefresh
*———————————————————————*


TYPE-POOLS: icon.

*———————————————————————*
* Konstanten
*———————————————————————*

CONSTANTS:
  k_icon_green(4)  VALUE icon_led_green,
  k_icon_red(4)    VALUE icon_led_red,
  off  TYPE i      VALUE 0,
  on   TYPE i      VALUE 1.

DATA:
  k_info_green(30),
  k_info_red(30).

*———————————————————————*
* Variablen
*———————————————————————*

DATA:
  t_scarr   LIKE scarr   OCCURS 0 WITH HEADER LINE,
  t_spfli   LIKE spfli   OCCURS 0 WITH HEADER LINE,
  t_sflight LIKE sflight OCCURS 0 WITH HEADER LINE,

  l_status(4),                                              “Liststatus
  l_quickinfo(30),            “Infotext für das Icon
  l_hotspot,                  “Hotspot an/aus
  l_popup_aktiv,              “Popup aktiv ja/nein
  l_actual_line TYPE systaro. “Aktuelle Zeile (für Refresh)

*———————————————————————*
* Selektionsbild
*———————————————————————*

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS:
  s_carrid FOR t_scarr-carrid,
  s_carrnm FOR t_scarr-carrname.
SELECTION-SCREEN END   OF BLOCK 1.

*———————————————————————*
* Init
*———————————————————————*

INITIALIZATION.
  k_info_green = ‘Detaildaten vorhanden'(q01).
  k_info_red   = ‘Keine Detaildaten vorhanden'(q02).


*———————————————————————*
* Programmstart
*———————————————————————*

START-OF-SELECTION.

  PERFORM selektion.
  PERFORM listausgabe.


*———————————————————————*
* User-Command
*———————————————————————*

AT USER-COMMAND.

  l_actual_line = sy-staro.

  CASE sy-ucomm.
    WHEN ‘REFR’.
      PERFORM selektion.
      PERFORM listausgabe.
    WHEN ‘LEGENDE’.
      PERFORM legende.
  ENDCASE.

*———————————————————————*
* Doppelklick
*———————————————————————*

AT LINE-SELECTION.
  CASE sy-lsind.
    WHEN 1.
      PERFORM detail_1.
    WHEN 2.
      PERFORM detail_2.
  ENDCASE.

*———————————————————————*
* Seitenkopf / Listüberschrift
*———————————————————————*

TOP-OF-PAGE.

  PERFORM top_of_page.

TOP-OF-PAGE DURING LINE-SELECTION.

  PERFORM top_of_page.


*———————————————————————*
*       FORM selektion                                                *
*———————————————————————*

FORM selektion.

  SELECT * FROM scarr INTO TABLE t_scarr
   WHERE carrid   IN s_carrid
     AND carrname IN s_carrnm.

  IF sy-subrc = 0.
    SORT t_scarr.
    SELECT * FROM spfli INTO TABLE t_spfli
      FOR ALL ENTRIES IN t_scarr
    WHERE carrid = t_scarr-carrid.

    SORT t_spfli.

    SELECT * FROM sflight INTO TABLE t_sflight
       FOR ALL ENTRIES IN t_spfli
     WHERE carrid = t_spfli-carrid
       AND connid = t_spfli-connid.

    SORT t_sflight.

  ENDIF.

ENDFORM.

*&———————————————————————*
*&      Form  listausgabe
*&———————————————————————*

FORM listausgabe.

*** Verzweigungslistenzähler muss auf Null gesetzt werden, damit nicht
*** beim Aktualisieren eine neue Verzweigungsliste erzeugt wird.

  sy-lsind = 0.

*** Liststatus setzen
  SET PF-STATUS ‘LISTE’.

*** Ausgabe der Tabelle
  LOOP AT t_scarr.
    READ TABLE t_spfli WITH KEY carrid = t_scarr-carrid BINARY SEARCH.
    IF sy-subrc = 0.
      l_status    = k_icon_green.
      l_quickinfo = k_info_green.
      l_hotspot   = on.
    ELSE.
      l_status    = k_icon_red.
      l_quickinfo = k_info_red.
      l_hotspot   = off.
    ENDIF.

    WRITE: / l_status AS ICON QUICKINFO l_quickinfo HOTSPOT = l_hotspot,
             t_scarr-carrid,
             t_scarr-carrname,
             t_scarr-url(40).
    HIDE t_scarr.

  ENDLOOP.

  CLEAR t_scarr.

*** Liste bei Neuaufbau wieder positionieren
  SCROLL LIST TO FIRST PAGE LINE l_actual_line INDEX 1.

ENDFORM.                    ” listausgabe

*———————————————————————*
*       FORM detail_1                                                 *
*———————————————————————*

FORM detail_1.

  CHECK NOT t_scarr IS INITIAL.
  LOOP AT t_spfli WHERE carrid = t_scarr-carrid.
    WRITE: / t_spfli-connid,
             t_spfli-countryfr,
             t_spfli-cityfrom,
             t_spfli-airpfrom,
             t_spfli-countryto,
             t_spfli-cityto,
             t_spfli-airpto,
             t_spfli-fltime.
    HIDE t_spfli.
  ENDLOOP.
  CLEAR: t_spfli, t_scarr.

ENDFORM.

*———————————————————————*
*       FORM detail_2                                                 *
*———————————————————————*

FORM detail_2.

  CHECK NOT t_spfli IS INITIAL.
  LOOP AT t_sflight WHERE carrid = t_spfli-carrid
                      AND connid = t_spfli-connid.
    WRITE: / t_sflight-carrid,
             t_sflight-connid,
             t_sflight-fldate,
             t_sflight-price,
             t_sflight-currency,
             t_sflight-planetype,
             t_sflight-seatsmax,
             t_sflight-seatsocc,
             t_sflight-paymentsum.
  ENDLOOP.

ENDFORM.

*———————————————————————*
*       FORM top_of_page_header                                       *
*———————————————————————*

FORM top_of_page_header.

  WRITE: / ‘HEADER’, AT sy-linsz space.

ENDFORM.

*———————————————————————*
*       FORM top_of_page_detail_1                                     *
*———————————————————————*

FORM top_of_page_detail_1.

  WRITE: / ‘Positionsdetail’, AT sy-linsz space.

ENDFORM.

*———————————————————————*
*       FORM top_of_page_detail_2                                     *
*———————————————————————*

FORM top_of_page_detail_2.

  WRITE: / ‘Detail 2’, AT sy-linsz space.

ENDFORM.

*&———————————————————————*
*&      Form  top_of_page
*&———————————————————————*

FORM top_of_page.

  CHECK l_popup_aktiv = space.
  ULINE.
  FORMAT COLOR COL_HEADING INTENSIFIED ON.

  CASE sy-lsind.
    WHEN 0.
      PERFORM top_of_page_header.
    WHEN 1.
      PERFORM top_of_page_detail_1.
    WHEN 2.
      PERFORM top_of_page_detail_2.
  ENDCASE.

  FORMAT COLOR OFF         INTENSIFIED OFF.
  ULINE.

ENDFORM.                    ” top_of_page

*———————————————————————*
*       FORM legende                                                  *
*———————————————————————*

FORM legende.

  DATA:
    l_popup_breite TYPE i VALUE 70,
    l_popup_hoehe  TYPE i VALUE 10,
    l_popup_x1     TYPE i VALUE 10,
    l_popup_x2     TYPE i,
    l_popup_y1     TYPE i VALUE 10,
    l_popup_y2     TYPE i.

  l_popup_x2 = l_popup_x1 + l_popup_breite.
  l_popup_y2 = l_popup_y1 + l_popup_hoehe.

  SET PF-STATUS space.
  SET TITLEBAR ‘LEGENDE’.
  l_popup_aktiv = ‘X’.

  WINDOW STARTING AT l_popup_x1 l_popup_y1
           ENDING AT l_popup_x2 l_popup_y2.
  NEW-PAGE LINE-SIZE l_popup_breite LINE-COUNT 0.
  WRITE AT /1(l_popup_breite) sy-uline.
  WRITE: / ‘|’, ‘Legende’, AT l_popup_breite ‘|’.
  WRITE AT /1(l_popup_breite) sy-uline.
  WRITE: AT /2 k_icon_green AS ICON, k_info_green,
         AT /2 k_icon_red   AS ICON, k_info_red.
  l_popup_aktiv = space.

ENDFORM.

 

 

 

Enno Wulff
Series Navigation<< DatenselektionListausgabe >>

Leave a Comment