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: 

ALV: Subtotals in Custom Layouts

Former Member
0 Kudos

Hi all,

I am printing subtotals in ALV.

Under normal cases, it runs fine. However, there is a need to select custom layouts in the selection screen and then display.

When I select any custom defined layouts, the subtotals do not come anymore. Just normal ALV display without any sub total comes up.

Please let me know how to find out subtotals in custom layouts...

4 REPLIES 4

Former Member
0 Kudos

Hello,

try with this statement I_FIELDCAT-DO_SUM = 'SPACE'. use the property Do_sum.

Thanks,

santhosh

Former Member
0 Kudos

hi ,

for this you have to make 2 fileldcatalog one for the simple and other for the custom layout.

hope this helps

Regards

RItesh

Former Member
0 Kudos

Hi,

You have to do the changes in your code for displaying Sub-Total .

I am giving one example of code, i think it helps you.

REFRESH gt_sort.
  CLEAR wa_sort.
  wa_sort-fieldname = 'fieldname'.<-----that you want to sort and subtotal
  wa_sort-up = 'X'.
  wa_sort-subtot = 'X'.
  wa_sort-tabname = 'IT_OUTPUT'.
  APPEND wa_sort TO gt_sort.
 
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    i_callback_program         = g_repid
    i_callback_top_of_page  = 'TOP_OF_PAGE'
    is_layout                          = gt_layout
    it_fieldcat                         = it_fcat
    it_sort                           = gt_sort[]
    TABLES
      t_outtab                      = it_output

At last in field catalog pass  
wa_fcat-do_sum    = 'X'

I think this code solves your problem.

Furthermore i also have one program to show the comple subtotal and total.

Let me know if you want hat also or not.

Thanks.

Deepak Sharma

Former Member
0 Kudos

Hi,

Any luck with one of the suggestions???

Tell me if you want some more help.

Thanks.

Deepak Sharma