View difference between Paste ID: nJySUbUS and 5MwUW97b
SHOW: | | - or go back to the newest paste.
1
REPORT ZMMREP01_TEST.
2
TYPES : BEGIN OF ty_it,
3
        num,
4
        END OF ty_it.
5
6
DATA it TYPE TABLE OF ty_it WITH HEADER LINE.
7
8
do 3 TIMES.
9
  it-num = 1.
10
  APPEND it.
11
ENDDO.
12
13
DO 3 TIMES.
14
  it-num = 2.
15
  APPEND it.
16
ENDDO.
17
*BREAK-POINT.
18
LOOP AT it.
19
  AT new num.
20
    WRITE :/ 'NEW'.
21
  ENDAT.
22
  "
23
  WRITE :/ 'no at new and at end'.
24
  "
25
  at END OF num.
26
    WRITE :/ 'END'.
27
  ENDAT.
28
ENDLOOP.
29
30
TYPES: BEGIN OF TY_DATA, "user defined type
31
       ID TYPE N ,
32
       NAME TYPE CHAR20,
33
       SALARY TYPE I,
34
      END OF TY_DATA.
35
DATA : ITAB TYPE TABLE OF TY_DATA. "internal table
36
DATA : WA TYPE TY_DATA. "work area
37
38
WA-ID = 1.
39
WA-NAME = 'Sapnuts'.
40
WA-SALARY = 5000.
41
COLLECT WA INTO ITAB. "collect
42
CLEAR WA.
43
44
WA-ID = 2.
45
WA-NAME = 'SAPabap'.
46
WA-SALARY = 50000.
47
COLLECT WA INTO ITAB. "collect
48
CLEAR WA.
49
50
WA-ID = 1.
51
WA-NAME = 'Sapnuts'.
52
WA-SALARY = 15000.
53
COLLECT WA INTO ITAB. "collect
54
CLEAR WA.
55
56
LOOP AT ITAB INTO WA.
57
  WRITE:/ WA-ID, WA-NAME, WA-SALARY. "loop and display data
58
ENDLOOP.