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: 

Subtotal in ALV report

Former Member
0 Kudos

Hi everyone,

I have included 18 different reports into one reports.User can run any report by checking the check box of that report on selection screen.Outut of the report displays report no. alonfg with other fields as shown below:

Report no. Report description field 1 field 2........etc

1 abc

1 abc

1 abc

1 abc

2 def

2 def

2 def

No my requirement is to show total no. of each report as shown below :

Report no. Report description field 1 field 2........etc

1 abc

1 abc

1 abc

1 abc

Total: 4

2 def

2 def

2 def

Total: 3

i tried using subtotal but it doesnt work.....

waiting for your replies

1 ACCEPTED SOLUTION

Former Member
0 Kudos

tweak ur program,.

You mite be using an output table for 'REUSE_ALV_GRID_DISPLAY '.

Suppose having fields :

.Report number(25),

description(24),

For each report -at the final stage .(Might be after the loop is over)

Use describe itab statement to get the final report Count .

Append 'Total' - Count into Report number Field .

For next report as well.Same way get the count .

Appned each internal table to the final OUTPUT table for ALV.

so each time you will have a Seperate line for total with counts on the column 'Report number'.

6 REPLIES 6

Former Member
0 Kudos

tweak ur program,.

You mite be using an output table for 'REUSE_ALV_GRID_DISPLAY '.

Suppose having fields :

.Report number(25),

description(24),

For each report -at the final stage .(Might be after the loop is over)

Use describe itab statement to get the final report Count .

Append 'Total' - Count into Report number Field .

For next report as well.Same way get the count .

Appned each internal table to the final OUTPUT table for ALV.

so each time you will have a Seperate line for total with counts on the column 'Report number'.

0 Kudos

Hi boby,

Thats really nice logic but it wont solve my problem.

Because user can sort the report no. field .

0 Kudos

Ask user beforehand itself,in which format would they want the Report number field to be formatted- ascending/descending.

Make it done inside the program itself.and then go for Total logic.

Hope it solves your sorting issue.

Thanks!

Former Member
0 Kudos

first in fieldcatlog u can take do_sum = 'x'. this for grand total. depends on u r field

and then we have data declara type sortinfo_alv this slis type .

in that u can give sort-fieldname = for which field u can caliculate the subtotals

sort-subtot = 'x'.

sort-up = 'x' .

append sort into i_sort.

may be this one is helpful for u.

regards,

anji

Former Member
0 Kudos

wa_sort-fieldname = 'FIELD1'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.

Former Member
0 Kudos

Thanks everybody...