Hallo Thomas erstemals danke für die Hilfe
ich hab jetzt alles schon doppelt dreifach vierfach überprüft und das passt meiner meinung nach alles
ich habe ein eigenes custom control für die zweite liste ...
müsste alles passen.
ích kopiert einfach mal das ganze coding rein, ist eigentlich eh noch nicht viel code.
*&---------------------------------------------------------------------*
*& Report ZNPF_STURZPROT_AUSWERT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT znpf_sturzprot_auswert.
TABLES: nbew,
n2text,
y0000039.
*---------------------------------------------------------------------*
* Declaration für interne Tabellen
*---------------------------------------------------------------------*
TYPES: BEGIN OF list_ort,
ort(15) TYPE c,
anzahl type i,
END OF list_ort.
TYPES: BEGIN OF list_zeit,
zeit(15) TYPE c,
anzahl type i,
END OF list_zeit.
DATA: liste_ort TYPE STANDARD TABLE OF list_ort,
wa_liste_ort TYPE list_ort,
liste_zeit TYPE STANDARD TABLE OF list_zeit,
wa_liste_zeit TYPE list_zeit.
DATA: fieldcat_ort TYPE lvc_t_fcat.
DATA: fieldcat_zeit TYPE lvc_t_fcat.
DATA: first_run TYPE c.
DATA: container TYPE REF TO cl_gui_custom_container,
alv_list_ort TYPE REF TO cl_gui_alv_grid,
alv_list_zeit TYPE REF TO cl_gui_alv_grid.
DATA: container_zeit TYPE REF TO cl_gui_custom_container.
DATA: layout TYPE lvc_s_layo.
DATA: layout_zeit TYPE lvc_s_layo.
*Screen für die Selektion
SELECTION-SCREEN BEGIN OF SCREEN 1111 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-007.
PARAMETERS: p_einri LIKE tn01-einri DEFAULT '0001' OBLIGATORY.
SELECT-OPTIONS s_datum FOR nbew-bwidt DEFAULT sy-datum OBLIGATORY.
SELECT-OPTIONS s_orgfa FOR nbew-orgfa.
SELECT-OPTIONS s_orgpf FOR nbew-orgpf.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN END OF SCREEN 1111.
*&SPWIZARD: FUNCTION CODES FOR TABSTRIP 'ZNPF_STURZPROT'
CONSTANTS: BEGIN OF c_znpf_sturzprot,
tab1 LIKE sy-ucomm VALUE 'ZNPF_STURZPROT_FC1',
tab2 LIKE sy-ucomm VALUE 'ZNPF_STURZPROT_FC2',
tab3 LIKE sy-ucomm VALUE 'ZNPF_STURZPROT_FC3',
tab4 LIKE sy-ucomm VALUE 'ZNPF_STURZPROT_FC4',
tab5 LIKE sy-ucomm VALUE 'ZNPF_STURZPROT_FC5',
tab6 LIKE sy-ucomm VALUE 'ZNPF_STURZPROT_FC6',
END OF c_znpf_sturzprot.
*&SPWIZARD: DATA FOR TABSTRIP 'ZNPF_STURZPROT'
CONTROLS: znpf_sturzprot TYPE TABSTRIP.
DATA: BEGIN OF g_znpf_sturzprot,
subscreen LIKE sy-dynnr,
prog LIKE sy-repid VALUE 'ZNPF_STURZPROT_AUSWERT',
pressed_tab LIKE sy-ucomm VALUE c_znpf_sturzprot-tab1,
END OF g_znpf_sturzprot.
DATA: ok_code LIKE sy-ucomm.
*&SPWIZARD: OUTPUT MODULE FOR TS 'ZNPF_STURZPROT'. DO NOT CHANGE THIS LI
*&SPWIZARD: SETS ACTIVE TAB
MODULE znpf_sturzprot_active_tab_set OUTPUT.
znpf_sturzprot-activetab = g_znpf_sturzprot-pressed_tab.
CASE g_znpf_sturzprot-pressed_tab.
WHEN c_znpf_sturzprot-tab1.
g_znpf_sturzprot-subscreen = '0101'.
Perform ort_alv_liste_erzeugen.
PERFORM sel_ort.
WHEN c_znpf_sturzprot-tab2.
g_znpf_sturzprot-subscreen = '0102'.
Perform zeit_alv_liste_erzeugen.
PERFORM sel_zeit.
WHEN c_znpf_sturzprot-tab3.
g_znpf_sturzprot-subscreen = '0103'.
WHEN c_znpf_sturzprot-tab4.
g_znpf_sturzprot-subscreen = '0104'.
WHEN c_znpf_sturzprot-tab5.
g_znpf_sturzprot-subscreen = '0105'.
WHEN c_znpf_sturzprot-tab6.
g_znpf_sturzprot-subscreen = '0106'.
WHEN OTHERS.
*&SPWIZARD: DO NOTHING
ENDCASE.
ENDMODULE. "ZNPF_STURZPROT_ACTIVE_TAB_SET OUTPUT
*&SPWIZARD: INPUT MODULE FOR TS 'ZNPF_STURZPROT'. DO NOT CHANGE THIS LIN
*&SPWIZARD: GETS ACTIVE TAB
MODULE znpf_sturzprot_active_tab_get INPUT.
ok_code = sy-ucomm.
CASE ok_code.
WHEN c_znpf_sturzprot-tab1.
g_znpf_sturzprot-pressed_tab = c_znpf_sturzprot-tab1.
WHEN c_znpf_sturzprot-tab2.
g_znpf_sturzprot-pressed_tab = c_znpf_sturzprot-tab2.
WHEN c_znpf_sturzprot-tab3.
g_znpf_sturzprot-pressed_tab = c_znpf_sturzprot-tab3.
WHEN c_znpf_sturzprot-tab4.
g_znpf_sturzprot-pressed_tab = c_znpf_sturzprot-tab4.
WHEN c_znpf_sturzprot-tab5.
g_znpf_sturzprot-pressed_tab = c_znpf_sturzprot-tab5.
WHEN c_znpf_sturzprot-tab6.
g_znpf_sturzprot-pressed_tab = c_znpf_sturzprot-tab6.
WHEN OTHERS.
*&SPWIZARD: DO NOTHING
ENDCASE.
ENDMODULE. "ZNPF_STURZPROT_ACTIVE_TAB_GET INPUT
START-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
*&--Setzen des Status für den Screen-----------------*
SET PF-STATUS 'SCREEN_100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
*&--entsprechend des ausgelösten Funktionscodes die Methoden aufrufen
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0100 INPUT.
*&---------------------------------------------------------------------*
*& Form SEL_ORT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM sel_ort.
DATA: iy0000039 TYPE TABLE OF y0000039.
DATA: wa_y0000039 TYPE y0000039,
wa_ndoc TYPE ndoc.
DATA: i3 TYPE i,
i4 TYPE i,
i5 TYPE i,
i6 TYPE i,
i7 TYPE i,
i8 TYPE i.
CLEAR: wa_y0000039,
wa_ndoc,
wa_liste_ort,
liste_ort.
CHECK NOT s_datum IS INITIAL.
SELECT * FROM y0000039 INTO TABLE iy0000039
WHERE pfsp01zpn IN s_datum.
SORT iy0000039 BY dokar doknr DESCENDING dokvr DESCENDING.
DELETE ADJACENT DUPLICATES FROM iy0000039 COMPARING dokar doknr.
LOOP AT iy0000039 INTO wa_y0000039.
* ermitteln der oe's
SELECT SINGLE * FROM ndoc INTO wa_ndoc
WHERE dokar = wa_y0000039-dokar
AND doknr = wa_y0000039-doknr
AND dokvr = wa_y0000039-dokvr
AND doktl = wa_y0000039-doktl.
* list-i1 = list-i1 + 1. " gesamtanzahl
* oe nicht beachten
IF s_orgfa EQ wa_ndoc-orgfa OR
s_orgpf EQ wa_ndoc-orgpf.
ELSE.
* Flur
IF wa_y0000039-pfsp01or1 = 'X'.
i3 = i3 + 1.
ENDIF.
* Zimmer
IF wa_y0000039-pfsp01or2 = 'X'.
i4 = i4 + 1.
ENDIF.
* Tagesraum
IF wa_y0000039-pfsp01or3 = 'X'.
i5 = i5 + 1.
ENDIF.
* Bad
IF wa_y0000039-pfsp01or4 = 'X'.
i6 = i6 + 1.
ENDIF.
* Toilette
IF wa_y0000039-pfsp01or5 = 'X'.
i7 = i7 + 1.
ENDIF.
* sonstiger Ort
SELECT SINGLE * FROM n2text
WHERE dokar = wa_y0000039-dokar
AND doknr = wa_y0000039-doknr
AND dokvr = wa_y0000039-dokvr
AND doktl = wa_y0000039-doktl
AND doktab = 'Y0000039'
AND dokfld = 'PFSP01ORSL'
AND dokocc = '0'
AND tlng GT 0.
IF sy-subrc = 0.
i8 = i8 + 1.
ENDIF.
ENDIF.
ENDLOOP.
wa_liste_ort-ort = 'Flur'.
wa_liste_ort-anzahl = i3.
APPEND wa_liste_ort TO liste_ort.
CLEAR wa_liste_ort.
wa_liste_ort-ort = 'Zimmer'.
wa_liste_ort-anzahl = i4.
APPEND wa_liste_ort TO liste_ort.
CLEAR wa_liste_ort.
wa_liste_ort-ort = 'Tagesraum'.
wa_liste_ort-anzahl = i5.
APPEND wa_liste_ort TO liste_ort.
CLEAR wa_liste_ort.
wa_liste_ort-ort = 'Bad'.
wa_liste_ort-anzahl = i6.
APPEND wa_liste_ort TO liste_ort.
CLEAR wa_liste_ort.
wa_liste_ort-ort = 'Toilette'.
wa_liste_ort-anzahl = i7.
APPEND wa_liste_ort TO liste_ort.
CLEAR wa_liste_ort.
wa_liste_ort-ort = 'Sonstiger Ort'.
wa_liste_ort-anzahl = i8.
APPEND wa_liste_ort TO liste_ort.
CLEAR wa_liste_ort.
perform alv_ausgabe_ort.
ENDFORM. "sel_ort
*&---------------------------------------------------------------------*
*& Form SEL_ZEIT
*&---------------------------------------------------------------------*
* text *
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM sel_zeit.
DATA: iy0000039 TYPE TABLE OF y0000039.
DATA: wa_y0000039 TYPE y0000039,
wa_ndoc TYPE ndoc.
DATA: i3 TYPE i,
i4 TYPE i,
i5 TYPE i,
i6 TYPE i,
i7 TYPE i,
i8 TYPE i.
CLEAR: wa_y0000039,
wa_ndoc,
wa_liste_zeit,
liste_zeit.
CHECK NOT s_datum IS INITIAL.
SELECT * FROM y0000039 INTO TABLE iy0000039
WHERE pfsp01zpn IN s_datum.
SORT iy0000039 BY dokar doknr DESCENDING dokvr DESCENDING.
DELETE ADJACENT DUPLICATES FROM iy0000039 COMPARING dokar doknr.
LOOP AT iy0000039 INTO wa_y0000039.
* ermitteln der oe's
SELECT SINGLE * FROM ndoc INTO wa_ndoc
WHERE dokar = wa_y0000039-dokar
AND doknr = wa_y0000039-doknr
AND dokvr = wa_y0000039-dokvr
AND doktl = wa_y0000039-doktl.
* list-i1 = list-i1 + 1. " gesamtanzahl
* oe nicht beachten
IF s_orgfa EQ wa_ndoc-orgfa OR
s_orgpf EQ wa_ndoc-orgpf.
ELSE.
IF wa_y0000039-pfsp01zpuu GE '000001' AND
wa_y0000039-pfsp01zpuu LE '060000'.
i3 = i3 + 1.
ENDIF.
IF wa_y0000039-pfsp01zpuu GE '060001' AND
wa_y0000039-pfsp01zpuu LE '120000'.
i4 = i4 + 1.
ENDIF.
IF wa_y0000039-pfsp01zpuu GE '120001' AND
wa_y0000039-pfsp01zpuu LE '180000'.
i5 = i5 + 1.
ENDIF.
IF wa_y0000039-pfsp01zpuu GE '180001' AND
wa_y0000039-pfsp01zpuu LE '240000'.
i6 = i6 + 1.
ENDIF.
ENDIF.
ENDLOOP.
wa_liste_zeit-zeit = '00:01 - 06:00'.
wa_liste_zeit-anzahl = i3.
APPEND wa_liste_zeit TO liste_zeit.
CLEAR wa_liste_zeit.
wa_liste_zeit-zeit = '06:01 - 12:00'.
wa_liste_zeit-anzahl = i4.
APPEND wa_liste_zeit TO liste_zeit.
CLEAR wa_liste_zeit.
wa_liste_zeit-zeit = '12:01 - 18:00'.
wa_liste_zeit-anzahl = i5.
APPEND wa_liste_zeit TO liste_zeit.
CLEAR wa_liste_zeit.
wa_liste_zeit-zeit = '18:01 - 24:00'.
wa_liste_zeit-anzahl = i6.
APPEND wa_liste_zeit TO liste_zeit.
CLEAR wa_liste_zeit.
perform alv_ausgabe_zeit.
ENDFORM. "sel_zeit
*&---------------------------------------------------------------------*
*& Form alv_ausgabe_ort
*&---------------------------------------------------------------------*
* ALV-Liste refreshen
*----------------------------------------------------------------------*
FORM alv_ausgabe_ort.
call method alv_list_ort->refresh_table_display.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form alv_ausgabe_zeit
*&---------------------------------------------------------------------*
* ALV-Liste refreshen
*----------------------------------------------------------------------*
FORM alv_ausgabe_zeit.
call method alv_list_zeit->refresh_table_display.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form ort_alv_liste_erzeugen
*&---------------------------------------------------------------------*
* ALV-Liste wird aufgebaut und befüllt
*----------------------------------------------------------------------*
form ort_alv_liste_erzeugen.
IF container IS INITIAL.
*--Fieldkatalog für ALV-Listen setzen--------------
PERFORM fill_fieldcat_ort.
CREATE OBJECT container
EXPORTING
container_name = 'CUST_ORT'.
CREATE OBJECT alv_list_ort
EXPORTING
i_parent = container
i_name = 'Ort'.
* Layout des ALV definieren
layout-grid_title = 'Ort'.
layout-sel_mode = 'A'.
layout-zebra = 'X'. "Streifenmuster
* layout-no_toolbar = 'X'. "Toolbar ausblenden
CALL METHOD alv_list_ort->set_table_for_first_display
EXPORTING
is_layout = layout
CHANGING
it_fieldcatalog = fieldcat_ort
it_outtab = liste_ort.
CALL METHOD alv_list_ort->set_frontend_layout
EXPORTING
is_layout = layout.
ENDIF.
endform.
*&---------------------------------------------------------------------*
*& Form zeit_alv_liste_erzeugen
*&---------------------------------------------------------------------*
* ALV-Liste wird aufgebaut und befüllt
*----------------------------------------------------------------------*
form zeit_alv_liste_erzeugen.
IF container_zeit IS INITIAL.
*--Fieldkatalog für ALV-Listen setzen--------------
PERFORM fill_fieldcat_zeit.
CREATE OBJECT container_zeit
EXPORTING
container_name = 'CUST_ZEIT'.
CREATE OBJECT alv_list_zeit
EXPORTING
i_parent = container_zeit
i_name = 'Zeit'.
* Layout des ALV definieren
layout_zeit-grid_title = 'Zeitpunkt'.
layout_zeit-sel_mode = 'A'.
layout_zeit-zebra = 'X'. "Streifenmuster
* layout_zeit-no_toolbar = 'X'. "Toolbar ausblenden
CALL METHOD alv_list_zeit->set_table_for_first_display
EXPORTING
is_layout = layout_zeit
CHANGING
it_fieldcatalog = fieldcat_zeit
it_outtab = liste_zeit.
CALL METHOD alv_list_zeit->set_frontend_layout
EXPORTING
is_layout = layout_zeit.
ENDIF.
endform.
*&---------------------------------------------------------------------*
*& Form fill_fieldcat_ort
*&---------------------------------------------------------------------*
* fieldcat_ort muss die struktur der Daten übergeben werden
*----------------------------------------------------------------------*
FORM fill_fieldcat_ort.
DATA: wa_fc TYPE LINE OF lvc_t_fcat.
CLEAR fieldcat_ort.
wa_fc-fieldname = 'ORT'.
wa_fc-inttype = 'C'.
wa_fc-outputlen = '15'.
wa_fc-coltext = 'Ort des Sturzes'.
APPEND wa_fc TO fieldcat_ort.
wa_fc-fieldname = 'ANZAHL'.
wa_fc-inttype = 'I'.
wa_fc-outputlen = '10'.
wa_fc-coltext = 'Anzahl'.
APPEND wa_fc TO fieldcat_ort.
ENDFORM. " fill_fieldcat_ort
*&---------------------------------------------------------------------*
*& Form fill_fieldcat_zeit
*&---------------------------------------------------------------------*
* fieldcat_zeit muss die struktur der Daten übergeben werden
*----------------------------------------------------------------------*
FORM fill_fieldcat_zeit.
DATA: wa_fc TYPE LINE OF lvc_t_fcat.
CLEAR fieldcat_zeit.
wa_fc-fieldname = 'ZEIT'.
wa_fc-inttype = 'C'.
wa_fc-outputlen = '15'.
wa_fc-coltext = 'Zeit des Sturzes'.
APPEND wa_fc TO fieldcat_zeit.
wa_fc-fieldname = 'ANZAHL'.
wa_fc-inttype = 'I'.
wa_fc-outputlen = '10'.
wa_fc-coltext = 'Anzahl'.
APPEND wa_fc TO fieldcat_zeit.
ENDFORM. " fill_fieldcat_ort