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: 

Interesting ALV

Former Member
0 Kudos

I have dispalyed few fields in ALV report. First field is WERKS and afterwords AMOUNT comes in picture I want amount to de summed on change of WERKS.

How to do this in ALV? DO_SUM gives sum of whole column but I want at every new werks it should dispaly sum of amount. How to do it?

1 REPLY 1

naimesh_patel
Active Contributor
0 Kudos

You need to implement the SORT table for the ALV.

  DATA: ls_sort TYPE slis_sortinfo_alv.
  DATA: xt_sort TYPE slis_t_sortinfo_alv.

  ls_sort-fieldname = 'WEKRS'.
  ls_sort-spos = 1.
  ls_sort-up = 'X'.
  ls_sort-sub_tot = 'X'.     " << For subtotal
  APPEND ls_sort TO xt_sort.
  CLEAR ls_sort.

Than pass this table to ALV's IT_SORT parameter alongwith other parameters.

      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program      = l_repid
.....
      it_sort                 = Xt_sort

Regards,

Naimesh Patel