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: 

How to show total at top of entries in internal table for report and make it colorful?

aliimran_uppal
Participant
0 Kudos

How to get the following desired result in. I am creating and want to show total at top of all the amounts.

From this  
A            3
A            2
A            5
B            8
B            2
B            5
C            1
C            4
C            5
C            5
C            10
To This......


total-A      10 
A            3
A            2
A            5
total-B      15 
B            8
B            2
B            5
total-C      25 
C            1
C            4
C            5
C            5
C            10

I am creating ALV report and I want to show the data in above format.

4 REPLIES 4

loyd_enochs3
Participant
0 Kudos

Calculate the totals, insert the total line into the ALV itab and sort as needed prior to displaying the ALV to the users.

Of course, the user who reads the ALV may have the ability to reorder your report and undo that work. So you might want to disable the users' options of manipulating the output ALV.

0 Kudos

Thanks for the answer and If i want to show as it is. and how can i manipulate in the internal table.

raymond_giuseppi
Active Contributor

In most ALV grid classes there is an option in layout for totals before detail (e.g. is_layout-totals_bef or totals_before_items) and in sort table parameters you can define level of subtotals, use search tool, many many samples in forum and SAP demo reports already exist.

monalisa_biswal
Contributor
0 Kudos

Define another internal table to store totals by using collect statement, then append lines from total internal table to your main internal table and finally sort by the fieldname.