Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

display in alv according to age group

Former Member
0 Kudos
123

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

4 REPLIES 4

Former Member
0 Kudos
90

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

0 Kudos
90

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 ?

Former Member
0 Kudos
90

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.

Former Member
0 Kudos
90

any update on this?