Skip to Content
0
Former Member
Jun 03, 2008 at 07:05 AM

help to apend to table

18 Views

Hi,

i have internal table like that and i wont to do pivot like e.g. .

i reward

pernr      orgeh       sick_days        sum
 
123        5555            3                   7
123        5555            4                   7
456        6666            7                  16
456        6666            1                  16
456        6666            8                  16
789        5656            3                  6
789        5656            3                  6

i wont :

pernr       123       123      456     456     456         789       789 
orgeh      5555     5555    6666   6666   6666         5656    5656
sick_days  3         4         7         1        8            3          3
sum           7         7        16       16      16           6          6

what is the Best way to do that?

i have here the part of the solution but i wont to move it to other internal table and do it in *WRITE * statement.

LOOP AT itab2 INTO data_rec.

col = 1.

LOOP AT data_rec-pernr INTO fld_rec.

WRITE AT col fld_rec-fld RIGHT-JUSTIFIED NO-ZERO.

col = col + 10.

ENDLOOP.

NEW-LINE.

col = 1.

LOOP AT data_rec-orgeh INTO fld_rec.

WRITE AT col fld_rec-fld RIGHT-JUSTIFIED NO-ZERO.

col = col + 10.

ENDLOOP.

NEW-LINE.

col = 1.

LOOP AT data_rec-sick INTO fld_rec.

WRITE AT col fld_rec-fld RIGHT-JUSTIFIED NO-ZERO.

col = col + 10.

ENDLOOP.

NEW-LINE.

col = 1.

LOOP AT data_rec-sum INTO fld_rec.

WRITE AT col fld_rec-fld RIGHT-JUSTIFIED NO-ZERO.

col = col + 10.

ENDLOOP.

ENDLOOP.

Regards