Application Development and Automation 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

Former Member
0 Kudos
130

Hi Guyz,

I am trying an interactive ALV program where i am getting total and subtotal by clicking the SUMMATION buttons on Application tool bar. I want to it should show the field name as TOTAL and SUB-TOTAL there in the output screen.

Q>How to handle the sub-totals and the total fields in ALV.

I want to do it using TYPE POOLS : SLIS .

Any new ideas to solve this is also welcome.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
109

hi Sam!!!!

do this way ..

  t_fieldcat-tabname = tabname.
  t_fieldcat-fieldname = fieldname.
  t_fieldcat-seltext_m  = seltext_m.
  IF do_sum = 'X'.
    t_fieldcat-datatype = 'CURR'.
  ENDIF.
  t_fieldcat-do_sum = do_sum.
  APPEND t_fieldcat TO it_fieldcat.
  CLEAR t_fieldcat.

  t_sort-fieldname = 'VAR1'.
  t_sort-tabname = 'IT_OUTPUT'.
  t_sort-spos = 1.
  t_sort-up = 'X'.
  t_sort-subtot = 'X'.
  APPEND t_sort TO it_sort.
  CLEAR t_sort.

  t_sort-fieldname = 'VAR3'.
  t_sort-tabname = 'IT_OUTPUT'.
  t_sort-spos = 2.
  t_sort-up = 'X'.
  APPEND t_sort TO it_sort.
  CLEAR t_sort.

3 REPLIES 3

former_member181962
Active Contributor
0 Kudos
109

For the fields for which you want to get the subtotals and totals, you have to fill the fieldcatalog parameter DO_SUM = 'X'. The totals would appear automatically.(the field should be numeric thogh).

c_fieldcat-do_sum = 'X'. "for all those fields for which you want the total.

You should also fill the sort table information to get the subtotals according to grouping.

Refer the BCALV_TEST_LIST_EVENTS program.

Regards,

Ravi

Former Member
0 Kudos
109

u can use at new statement of that field and after that u can call FM resue_alv_list_display.

then check u r answer

regards

vijay

Former Member
0 Kudos
110

hi Sam!!!!

do this way ..

  t_fieldcat-tabname = tabname.
  t_fieldcat-fieldname = fieldname.
  t_fieldcat-seltext_m  = seltext_m.
  IF do_sum = 'X'.
    t_fieldcat-datatype = 'CURR'.
  ENDIF.
  t_fieldcat-do_sum = do_sum.
  APPEND t_fieldcat TO it_fieldcat.
  CLEAR t_fieldcat.

  t_sort-fieldname = 'VAR1'.
  t_sort-tabname = 'IT_OUTPUT'.
  t_sort-spos = 1.
  t_sort-up = 'X'.
  t_sort-subtot = 'X'.
  APPEND t_sort TO it_sort.
  CLEAR t_sort.

  t_sort-fieldname = 'VAR3'.
  t_sort-tabname = 'IT_OUTPUT'.
  t_sort-spos = 2.
  t_sort-up = 'X'.
  APPEND t_sort TO it_sort.
  CLEAR t_sort.