Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report Z_EASY_LIST *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT Z_EASY_LIST .
*######################################################################*
*
* BLOCK: DATA DEFINITIONS
*
*######################################################################*
* define the tables from the abap dictionary
*-------------------------------------------
TABLES: sflight, scarr.
* create a data type flugdaten containing all
* necessary information
*--------------------------------------------
TYPES: BEGIN OF flugdaten,
flugnr TYPE sflight-connid,
airline TYPE scarr-carrname,
plane TYPE sflight-planetype,
date TYPE sflight-fldate,
END OF flugdaten.
* create the data objects for the internal table
* and the workarea
*-----------------------------------------------
DATA tab_flugdaten TYPE STANDARD TABLE OF flugdaten.
DATA wa_flug TYPE flugdaten.
PARAMETERS: p_carr TYPE sflight-carrid.
*######################################################################*
*
* BLOCK: START-OF-SELECTION
*
*######################################################################*
START-OF-SELECTION.
*---------------------------*
* SELECT STATEMENT
* read the general flight
* data and fill internal
* table
*---------------------------*
SELECT f~connid c~carrname f~planetype f~fldate
FROM sflight AS f
INNER JOIN
scarr AS c
ON f~carrid = c~carrid
INTO TABLE tab_flugdaten
WHERE f~carrid = p_carr.
* this is to format the color of the heading
*-------------------------------------------
FORMAT COLOR COL_HEADING INTENSIFIED ON.
* print a header for the list
*------------------------------
WRITE 'Ausgabeliste'.
WRITE: / 'list created:', sy-datum.
FORMAT COLOR COL_HEADING INTENSIFIED OFF.
* print the column headers for the list
*---------------------------------------
WRITE: /1 'Flug'(001), 10 'Airline', 30 'Planetype', 50 'Flight Date'.
* loop at the internal table and write every line
* to the screen
*-------------------------------------------------
LOOP AT tab_flugdaten INTO wa_flug.
WRITE: / wa_flug-flugnr UNDER 'Flug', wa_flug-airline UNDER
'Airline', wa_flug-plane UNDER 'Planetype', wa_flug-date
UNDER 'Flight Date'.
ENDLOOP.
*######################################################################*
*
* BLOCK: AT LINE-SELECTION
*
*######################################################################*
AT LINE-SELECTION.
PERFORM detailanzeige.
**create a dataobject for an index
**---------------------------------
*
* DATA i TYPE sy-lsind.
* i = sy-lsind.
*
** read the selected line from the internal table
** and print data
**------------------------------------------------
*
* READ TABLE tab_flugdaten INTO wa_flug INDEX i.
*
* WRITE: / 'Sie haben folgenden Flug ausgewählt:'.
* WRITE: / 'Gewählte Flugnummer:', wa_flug-flugnr.
* WRITE: / 'Gewählte Airline:' , wa_flug-airline.
* WRITE: / 'Flugzeugtyp:', wa_flug-plane.
* WRITE: / 'Datum des Fluges:' , wa_flug-date.
*######################################################################*
*
* FORM: DETAILANZEIGE
*
*######################################################################*
FORM detailanzeige.
DATA wa_flug1 TYPE sflight.
SELECT SINGLE *
FROM sflight
INTO wa_flug1
WHERE connid = wa_flug-flugnr AND
fldate = wa_flug-date.
WRITE: / wa_flug1-fldate, wa_flug1-planetype.
ENDFORM.
Schau dir mal den Befehl HIDE an. Damit kannst du Werte verdeckt in der Listzeile ablegen. Bei PICK der Listzeile werden die Werte dann zurück in die Variablen transportiert.M hat geschrieben:Es wäre nett wenn mir hier jemand sagen könnte wie ich das mache, dass ich die Selektion der Liste weiterverwenden kann.