10-11-2012 8:23 PM
Is it possible to subtotal a non-numeric field in ALV reporting?
If so, is it possible in SALV or would I have to create a classical ALV?
I'm creating a count by group, but the customer doesn't want a column with a 1 in each row -- even if the correct subtotal is showing. However adding a column like this seems to be the only solution.It seems to me you need to have the numeric data type for any and all aggregation in ALV.
10-15-2012 7:05 PM
Here's what I ended up doing.
I declared Survey Count a string data type of the value of 1.
I declared a new internal table that had Survey Count and Group Responsible and used the COLLECT statement to get the subtotals.
Before I appended to the field catalog, I set wa-Survey Count to ' '. I then added my entries from the collected itab to the field catalog. This allows you to show the subtotal without having to show
I saved a layout that made this look good. Because it's not pretty if you don't put group responsible and survey count anywhere else but the first 2 columns.
10-11-2012 8:36 PM
hello,
This is a very basic example of subtotal in ALV. Check it and see how you can fit your requirement in.
http://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTAL+in+ALV
best regards,
swanand
10-12-2012 7:04 AM
10-12-2012 1:27 PM
Hi Indira,
I'm well familiar with that piece of code from SAPTechnical.com.
10-12-2012 1:29 PM
I think there's some confusion about what exactly my requirement is.
Here's my ALV output now.
Ticket # | Group Responsible | Survey Count | Date
| Group A | 5 |
101 | | 1 | 10/01/2012
102 | | 1 | 10/02/2012
103 | | 1 | 10/03/2012
104 | | 1 | 10/04/2012
105 | | 1 | 10/05/2012
Here's what I'm being asked to provide
Ticket # | Group Responsible | Survey Count | Date
| Group B | 4 |
111 | | | 10/01/2012
112 | | | 10/02/2012
113 | | | 10/03/2012
114 | | | 10/04/2012
Essentially I'm doing a row count by grouping rather than a subtotal per se. I'm being asked to hide the 1's, yet still achieve the same total at the parent/grouping level like a subtotal.
10-12-2012 1:40 PM
Did you try to create a TECH column intger with 1 value for each line, declare it as summed, and use the method get_subtotals in event after_refresh or top_of_page to copy the total of this column to the displayed column (the one with non-displayed 0 on line items)
Regards,
Raymond
10-15-2012 7:05 PM
Here's what I ended up doing.
I declared Survey Count a string data type of the value of 1.
I declared a new internal table that had Survey Count and Group Responsible and used the COLLECT statement to get the subtotals.
Before I appended to the field catalog, I set wa-Survey Count to ' '. I then added my entries from the collected itab to the field catalog. This allows you to show the subtotal without having to show
I saved a layout that made this look good. Because it's not pretty if you don't put group responsible and survey count anywhere else but the first 2 columns.
10-18-2012 12:09 PM
Hello:
If I understood, you added your collected subtotals like a data record into your ALV. Once the ALV is displayed, what about if user sort data by any field or want a different subtotal (by date for instance)?
Regards,
10-25-2012 6:26 PM
I wanted to used SALV's standard subtotal functionality - but the client didn't want to see the 1's.
You're right though that filtering or looking for another subtotal could mess the report up. Here's what I did. I changed the PF status to limit sorting. I also created a layout that showed the group and subtotal with other information indented.