Werte hoch-/ runterzählen

In einer Liste können Werte recht einfach durch Verwendung von „HOTSPOT“ und „AT LINE-SELECTION“ hoch- bzw- heruntergezählt werden. Das Beispielprogramm zeigt, wie das geht.
Werte durch Klicken hoch- oder runterzählen
Beispielreport
report zzenno16 NO STANDARD PAGE HEADING.
include <icon>.
data: feld(30),
zeile like sy-lilli,
pos_Wert type i,
begin of test occurs 20,
name(15),
wert type i,
end of test.
constants:
minus(4) value icon_column_left,
plus(4) value icon_column_right.
START-OF-SELECTION.
test-name = ‚Carsten‘. test-wert = 1. append test.
test-name = ‚Peter‘. test-wert = 2. append test.
test-name = ‚Karen‘. test-wert = 0. append test.
test-name = ‚Hedwig‘. test-wert = 1. append test.
perform ausgabe.
form ausgabe.
sy-lsind = 0.
loop at test.
if sy-tabix = 1.
write: / ‚Spieler‘, 24 ‚Punkte‘.
uline.
endif.
write: / test-name, at pos_wert test-wert,
at 30 minus as icon hotspot on,
at 33 plus as icon hotspot on.
hide test.
endloop.
endform.
at line-selection.
get cursor field feld line zeile.
read table test with key name = test-name.
if sy-subrc = 0.
case feld.
when ‚MINUS‘.
if test-wert > 0.
subtract 1 from test-wert.
modify test index sy-tabix.
perform ausgabe.
endif.
when ‚PLUS‘.
if test-wert < 8.
add 1 to test-wert.
modify test index sy-tabix.
perform ausgabe.
endif.
endcase.
endif.
- ALV-Grid Tabelle direkt ändern - 3. März 2023
- Subscreen-Bereiche anzeigen - 23. Februar 2023
- Komplexe Datenobjekte editieren - 23. Januar 2023