2008 Mar 25 12:03 PM
Hi Friends
i have data in internal table
I have to group it according to age
i mean on age group
Which Needs to Display in ALV
so how should i group them in ALV
OUTPUT like this :
EMPNUM EMPLOYEENAME DATE OFBIRTH/AGE
AGE GROUP: 0-29
999999 DOE JANE A. 01/01/1980 27
999999 DOE JOHN A. 01/01/1980 28
TOTALS: EMP 2
AGE GROUP: 30-34
999999 DOE JANE A. 01/01/1980 32
999999 DOE JOHN A. 01/01/1980 33
TOTALS: EMP 2
AGE GROUP: 35-39
999999 DOE JANE A. 01/01/1980 37
999999 DOE JOHN A. 01/01/1980 36
2008 Mar 25 12:26 PM
Hi,
Do u wnat to display them in different blocks. If YES.
Group them in different itabs like
loop at itab into x_itab.
if age < 30.
append x_itab into itab1.
delete itab from x_itab.
elseif age LE 35 and age GE 30.
append x_itab into itab2.
.
.
.
endif.
endloop.
Use FM to display in blocks.
REUSE_ALV_BLOCK_LIST_DISPLAY
Regards,
Subbu
2008 Mar 25 1:33 PM
Hi Subba Reddy Alla
your suggestion is good
but i have 10 such groups
i cant use 10 internal tables for that
is thr any way for doing the same ?
2008 Mar 25 12:32 PM
Hi,
Add a new field type c of length 30 in the final internal table and do as below.
loop at itab.
if itab-age GE 20 or itab-age LE 29
move : 'Age group 20 to 30' to itab-newfield.
modify itab.
clear itab.
else.
"Repeat same logic for different age groups.
endif.
"Do subtotaling by new field of itab and age. And use gt_fieldcat-no_out = 'X' for newfield, so that newfield will not be displayed.
Thanks,
Sriram Ponna.
2008 Mar 26 5:09 AM