Code: Alles auswählen.
REPORT ZPTARBPLDAT001.
TABLES: PLMZD,
PLKOD,
PLPOD,
STKO.
* Deklaration der internen Tabelle für die Daten.
TYPES: BEGIN OF TYP_DATEN,
MATNR LIKE MARA-MATNR, "Materialnummer
MAKTX LIKE MAKT-MAKTX, "Materialkurztext
ARBPL LIKE PLKOD-ARBPL, "Arbeitsplatz
PLNSTATU LIKE PLKOD-STATU, "Status Plan
KOMPO LIKE PLMZD-BOMAT, "Komponente
STCKLST LIKE PLMZD-STLNR, "Stücklistennummer
STCKSTAT LIKE STKO-STLST, "Status Stückliste
END OF TYP_DATEN.
DATA: INT_DATEN TYPE TYP_DATEN OCCURS 10 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK DATEN WITH FRAME TITLE TEXT-001.
PARAMETERS: ARBPL LIKE PLPOD-ARBPL OBLIGATORY.
PARAMETERS: PLSTATUS LIKE PLKOD-STATU DEFAULT 'K' OBLIGATORY.
SELECT-OPTIONS KOMPON FOR PLMZD-BOMAT OBLIGATORY.
PARAMETERS: STSTATUS LIKE STKO-STLST.
SELECTION-SCREEN END OF BLOCK DATEN.
* Plantyp N wird als Default und
* das aktuelle Datum als Stichtag gesetzt
INITIALIZATION.
PN_PLNTY = 'N' .
PN_DATUV = SY-DATUM.
PN_WERKS-LOW = '0001'.
* Ausblenden einiger Eingabefelder der log. DB PNM
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME = 'PN_PLNTY' OR
SCREEN-NAME = '%_PN_PLNTY_%_APP_%-TEXT' OR
* SCREEN-NAME = '%_PN_MATNR_%_APP_%-OPTI_PUSH' OR
* SCREEN-NAME = '%_PN_MATNR_%_APP_%-VALU_PUSH' OR
SCREEN-NAME = '%_PN_WERKS_%_APP_%-OPTI_PUSH' OR
SCREEN-NAME = '%_PN_WERKS_%_APP_%-VALU_PUSH' OR
* SCREEN-NAME = '%_PN_MATNR_%_APP_%-TEXT' OR
* SCREEN-NAME = 'PN_MATNR-LOW' OR
SCREEN-NAME = '%_PN_WERKS_%_APP_%-TEXT' OR
SCREEN-NAME = 'PN_WERKS-LOW' OR
SCREEN-NAME = '%_PN_DATUV_%_APP_%-TEXT' OR
SCREEN-NAME = 'PN_DATUV' OR
SCREEN-NAME = '%_PN_PLNNR_%_APP_%-TEXT' OR
SCREEN-NAME = '%_PN_PLNNR_%_APP_%-OPTI_PUSH' OR
SCREEN-NAME = 'PN_PLNNR-LOW' OR
SCREEN-NAME = '%_PN_PLNNR_%_APP_%-TO_TEXT' OR
SCREEN-NAME = 'PN_PLNNR-HIGH' OR
SCREEN-NAME = '%_PN_PLNNR_%_APP_%-VALU_PUSH' OR
SCREEN-NAME = '%_PN_PLNAL_%_APP_%-TEXT' OR
SCREEN-NAME = '%_PN_PLNAL_%_APP_%-OPTI_PUSH' OR
SCREEN-NAME = 'PN_PLNAL-LOW' OR
SCREEN-NAME = '%_PN_PLNAL_%_APP_%-TO_TEXT' OR
SCREEN-NAME = 'PN_PLNAL-HIGH' OR
SCREEN-NAME = '%_PN_PLNAL_%_APP_%-VALU_PUSH' OR
SCREEN-NAME = 'PN_WERKS-HIGH' OR
SCREEN-NAME = 'MAT' OR
SCREEN-NAME = '%CP05008_1000' OR
SCREEN-NAME = 'PN_ALL' OR
SCREEN-NAME = '%CP01013_1000' OR
SCREEN-NAME = 'PN_ALT' OR
SCREEN-NAME = '%CP02018_1000' OR
SCREEN-NAME = '%CP03023_1000' OR
SCREEN-NAME = 'PN_CAP' OR
SCREEN-NAME = '%CP04030_1000' OR
SCREEN-NAME = 'NOT_MAT' OR
SCREEN-NAME = '%CP06037_1000' OR
SCREEN-NAME = 'PN_MEHRS' OR
SCREEN-NAME = '%CP07042_1000' OR
SCREEN-NAME = 'PN_STLAL' OR
SCREEN-NAME = 'PN_STLAN' OR
SCREEN-NAME = 'PN_CAPID'.
* SCREEN-NAME = 'PN_MATNR-HIGH'.
SCREEN-INVISIBLE = '1'.
SCREEN-INPUT = '0'.
SCREEN-OUTPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
GET PLKOD.
CLEAR INT_DATEN.
CHECK PLKOD-STATU EQ PLSTATUS.
MOVE PLKOD-STATU TO INT_DATEN-PLNSTATU.
MOVE PLKOD-STLNR TO INT_DATEN-STCKLST.
GET PLPOD.
CHECK PLPOD-ARBPL EQ ARBPL.
MOVE PLPOD-ARBPL TO INT_DATEN-ARBPL.
GET PLMZD.
CHECK PLMZD-BOMAT IN KOMPON.
MOVE PLMZD-BOMAT TO INT_DATEN-KOMPO.
APPEND INT_DATEN.
END-OF-SELECTION.
* Falls der Status der Stückliste gegeben ist, so wird die Auswahl auf
* diese beschränkt.
IF STSTATUS NE ''.
LOOP AT INT_DATEN.
SELECT SINGLE STLST FROM STKO INTO INT_DATEN-STCKLST WHERE STLNR EQ
INT_DATEN-STCKSTAT.
ENDLOOP.
DELETE INT_DATEN WHERE STCKSTAT =''.
ENDIF.
WRITE: / 'Ausgabe der Daten:'.
SKIP.
LOOP AT INT_DATEN.
* BREAK-POINT.
WRITE: / INT_Daten-MATNR, "Materialnummer
INT_DATEN-MAKTX, "Materialkurztext
INT_DATEN-KOMPO, "Komponente
INT_DATEN-PLNSTATU, "Planstatus
INT_DATEN-ARBPL. "Arbeitsplatz
ENDLOOP.
* Nun müssen die Materialkurztexte hinzugelesen werden...
LOOP AT INT_DATEN.
SELECT SINGLE MAKTX FROM MAKT INTO INT_DATEN-MAKTX WHERE MATNR EQ
INT_DATEN-KOMPO.
ENDLOOP.