Hi,
yesterday i write this question and i have answer and its working great the problem is i dont understand the lines(in answer) :
col = col + 10.
col = 1.
way he do that?
Regards
i have internal table like that and i wont to do pivot like e.g. .
i have
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 simple way to do that?
the answer:
DATA:
BEGIN OF myrec,
pernr(10) TYPE n,
orgeh(10) TYPE n,
sick(10) TYPE n,
sum(10) TYPE n,
END OF myrec,
itab LIKE STANDARD TABLE OF myrec.
DATA:
BEGIN OF fld_rec,
fld(10) TYPE n,
END OF fld_rec,
BEGIN OF data_rec,
pernr LIKE STANDARD TABLE OF fld_rec,
orgeh LIKE STANDARD TABLE OF fld_rec,
sick LIKE STANDARD TABLE OF fld_rec,
sum LIKE STANDARD TABLE OF fld_rec,
END OF data_rec,
itab2 LIKE STANDARD TABLE OF data_rec.
DATA: col TYPE i.
START-OF-SELECTION.
PERFORM load_itab.
LOOP AT itab INTO myrec.
APPEND myrec-pernr TO data_rec-pernr.
APPEND myrec-orgeh TO data_rec-orgeh.
APPEND myrec-sick TO data_rec-sick.
APPEND myrec-sum TO data_rec-sum.
ENDLOOP.
APPEND data_rec TO itab2.
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.