This website is not affiliated with, sponsored by, or approved by SAP AG.

ALV Subtotals - row expand/collapse functionality

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

ALV Subtotals - row expand/collapse functionality

Postby stanc » Tue Jul 03, 2007 3:26 am

Hi All,
I hope somebody can help.
I have created a report that produces an ALV report using set_table_for_first_display. The problem is I want to calculate percentages at the subtotal line (as well as outputting other fields). I have spent a couple of days going through most of the posts on here but I am suffering the same problem that somebody else had and no solution was posted. I'm using the get_subtotals method to obtain the subtotals and updating the subtotals table OK with my values but those changes are not appearing in the ALV grid. If somebody knows a way of forcing the new values to display I would appreciate it.

Failing that I can do all the calculations I need within the program and output the subtotal lines manually. The problem is I also need the expand and collapse functionality that the subtotal line provides (i.e. the icon etc) the format of the ALV tree does not provide what I'm really looking for, so if anybody knows how to do this I would appreciate it.

Thanks in advance
Posts: 20
Joined: Wed Nov 01, 2006 11:58 am

ALV Subtotals - row expand/collapse functionality

Postby agilles » Thu Jul 05, 2007 2:50 pm


I am having a similar problem. I too can update the subtotal table with the proper percentage, but I am unable to force the change to the grid. I am also using the GET_SUBTOTALS method. Any help would be appreciated.

Posts: 3
Joined: Tue Oct 25, 2005 11:00 am

Postby RCRNancy » Fri Jul 06, 2007 5:22 pm

I had the same problem. I was only able to modify a percentage total/subtotal in an ALV List. As I understand it, it does not work with a grid. Hope this is helpful.

form alv_before_line_output using p_lineinfo type slis_lineinfo.

if p_lineinfo-endsum ne space.
itab-field2 = itab-field3 / itab-field4 * 100.
itab-field1 = 'Grand Total'.

if p_lineinfo-subtot ne space.
itab-field2 = itab-field3 / itab-field4 * 100.
itab-field1 = 'Sub Total'.

Posts: 6
Joined: Mon Jun 04, 2007 11:54 am
Location: Texas

Postby newbie82 » Thu Jul 12, 2007 12:26 pm


i am having the same problem and i am so desperate since there is no solution.

i trying to do it with the program while filling the internal table to pass to ALV. Has anyone got a sample on how to do it manually so that i can compare it with mine

unfortunately i wont be able to collapse the rows
Posts: 72
Joined: Mon Jul 09, 2007 12:42 pm

Postby m@t » Thu Jul 12, 2007 12:52 pm

To get this functionality, you should forget ALV, and just write your own list program.

Of course, you'll lose all the nice functionality you get for free with ALV. Hmm. have you considered offering your users a choice - nice ALV functionality, or collapse/expand functionality. I can just about believe the former is a must have business requirement. But certainly not the latter.

TULY Image The quality of answers is roughly proportional to the quality of the question.

The downside of being better than everyone else is that people tend to assume you're pretentious.
Posts: 4120
Joined: Thu Sep 04, 2003 7:37 am
Location: Switzerland

Re: ALV Subtotals - row expand/collapse functionality

Postby Meggycat » Mon Oct 20, 2014 8:40 am

ALV may not be Input enabled to get the possibility to collapse / expand the subtotals.
and the grid must be created with option "Application Events " = false

So you Need
CALL METHOD po_grid->set_ready_for_input
i_ready_for_input = 0.


i_appl_events = ' '
i_parent = po_container
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4

Br Magdalena
Posts: 1
Joined: Mon Oct 20, 2014 8:30 am

Return to ABAP

Who is online

Users browsing this forum: Google Adsense [Bot] and 11 guests


This website is not affiliated with, sponsored by, or approved by SAP AG.