Code: Alles auswählen.
LOOP AT lt_test INTO ls_test.
IF lv_name_alt <> ls_test-name.
WRITE: / ls_test-name, 20 ls_test-buper USING EDIT MASK '____.__' .
CLEAR: lv_stunden_full,
lv_stunden_fakt,
lv_stunden_fahr,
lv_stunden_sonst.
ENDIF.
REPLACE ',' IN ls_test-fahrzeiten WITH '.'.
REPLACE ',' IN ls_test-sonst_stunden WITH '.'.
REPLACE ',' IN ls_test-fakt_stunden WITH '.'.
lv_stunden = ls_test-fahrzeiten + ls_test-sonst_stunden + ls_test-fakt_stunden.
lv_stunden_full = lv_stunden_full + lv_stunden.
lv_stunden_sonst = lv_stunden_sonst + ls_test-sonst_stunden.
lv_stunden_fahr = lv_stunden_fahr + ls_test-fahrzeiten.
lv_stunden_fakt = lv_stunden_fakt + ls_test-fakt_stunden.
WRITE: /30 lv_stunden_fahr,lv_stunden_sonst,lv_stunden_fakt,
lv_stunden_full.
lv_name_alt = ls_test-name.
Also laut Code macht er das ja:Thomas R. hat geschrieben:warum nutzt Du nicht die Gruppenwechsel (vorher sortieren, Feldreihenfolge muss passen).
Code: Alles auswählen.
IF lv_name_alt <> ls_test-name.
...
lv_name_alt = ls_test-name.
Code: Alles auswählen.
CLEAR ls_test2.
LOOP AT lt_test INTO ls_test.
IF ls_test2-name NE ls_test-name AND ls_test2 IS NOT INITIAL.
* Ausgeben von ls_test2
ENDIF.
ls_test2 = ls_test1.
ENDLOOP.
* Ausgeben von ls_test2
Code: Alles auswählen.
LOOP AT lt_test INTO ls_test.
IF lv_name_alt <> ls_test-NAME OR lv_buper <> ls_test-buper.
WRITE: / ls_test-NAME, 20 ls_test-buper USING EDIT MASK '____.__' .
ENDIF.
IF ls_test2-name NE ls_test-name.
WRITE : / lv_stunden_full.
CLEAR: lv_stunden_full.
ENDIF.
lv_name_vnw = ls_test-name.
lv_buper = ls_test-buper.
ls_test2 = ls_test.
REPLACE ',' IN ls_test-fahrzeiten WITH '.'.
REPLACE ',' IN ls_test-sonst_stunden WITH '.'.
REPLACE ',' IN ls_test-fakt_stunden WITH '.'.
lv_stunden = ls_test-fahrzeiten + ls_test-sonst_stunden + ls_test-fakt_stunden.
lv_stunden_full = lv_stunden_full + lv_stunden.
ENDLOOP.
WRITE:/ lv_stunden_full.
Code: Alles auswählen.
REPORT zrt_test.
*---- Rate man mit Rosendahl die Struktur
TYPES:
BEGIN OF lst_test,
name type char20,
buper type buper,
fahrzeiten type char5,
sonst_stunden type char5,
fakt_stunden type char5,
END OF lst_test.
DATA:
ls_test TYPE lst_test,
lt_test TYPE SORTED TABLE OF lst_test "hier kann man diskutieren ob standard und sort oder sorted Table
WITH NON-UNIQUE KEY name buper,
lv_stunden type i,
lv_stunden_full type i,
lv_stunden_fakt type i,
lv_stunden_fahr type i,
lv_stunden_sonst type i.
*---- Testdaten
ls_test-name = 'Mitarbeiter1'.
ls_test-buper = '201201'.
ls_test-fahrzeiten = '0,00'.
ls_test-sonst_stunden = '0,00'.
ls_test-fakt_stunden = '1,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter1'.
ls_test-buper = '201201'.
ls_test-fahrzeiten = '0,00'.
ls_test-sonst_stunden = '1,00'.
ls_test-fakt_stunden = '0,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter1'.
ls_test-buper = '201201'.
ls_test-fahrzeiten = '0,00'.
ls_test-sonst_stunden = '0,00'.
ls_test-fakt_stunden = '4,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter2'.
ls_test-buper = '201201'.
ls_test-fahrzeiten = '0,00'.
ls_test-sonst_stunden = '0,00'.
ls_test-fakt_stunden = '1,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter2'.
ls_test-buper = '201201'.
ls_test-fahrzeiten = '0,00'.
ls_test-sonst_stunden = '1,00'.
ls_test-fakt_stunden = '6,00'.
insert ls_test into table lt_test.
*--- Testdaten Periode 2
ls_test-name = 'Mitarbeiter1'.
ls_test-buper = '201202'.
ls_test-fahrzeiten = '1,00'.
ls_test-sonst_stunden = '2,00'.
ls_test-fakt_stunden = '3,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter1'.
ls_test-buper = '201202'.
ls_test-fahrzeiten = '4,00'.
ls_test-sonst_stunden = '5,00'.
ls_test-fakt_stunden = '6,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter1'.
ls_test-buper = '201202'.
ls_test-fahrzeiten = '7,00'.
ls_test-sonst_stunden = '8,00'.
ls_test-fakt_stunden = '9,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter2'.
ls_test-buper = '201202'.
ls_test-fahrzeiten = '3,00'.
ls_test-sonst_stunden = '2,00'.
ls_test-fakt_stunden = '1,00'.
insert ls_test into table lt_test.
ls_test-name = 'Mitarbeiter2'.
ls_test-buper = '201202'.
ls_test-fahrzeiten = '0,00'.
ls_test-sonst_stunden = '1,00'.
ls_test-fakt_stunden = '2,00'.
insert ls_test into table lt_test.
*---- Beispiel - möglichst nah an der Vorgabe 1
LOOP AT lt_test INTO ls_test.
AT NEW buper.
WRITE: / ls_test-name, 20 ls_test-buper USING EDIT MASK '____.__' .
CLEAR: lv_stunden_full,
lv_stunden_fakt,
lv_stunden_fahr,
lv_stunden_sonst.
ENDat.
REPLACE ',' IN ls_test-fahrzeiten WITH '.'.
REPLACE ',' IN ls_test-sonst_stunden WITH '.'.
REPLACE ',' IN ls_test-fakt_stunden WITH '.'.
lv_stunden = ls_test-fahrzeiten + ls_test-sonst_stunden + ls_test-fakt_stunden.
lv_stunden_full = lv_stunden_full + lv_stunden.
lv_stunden_sonst = lv_stunden_sonst + ls_test-sonst_stunden.
lv_stunden_fahr = lv_stunden_fahr + ls_test-fahrzeiten.
lv_stunden_fakt = lv_stunden_fakt + ls_test-fakt_stunden.
AT END OF buper.
WRITE: /30 lv_stunden_fahr,lv_stunden_sonst,lv_stunden_fakt,
lv_stunden_full.
ENDAT.
ENDLOOP.