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: 

Grouping the similar fields in the ALV report

mahabaleshwar_patil
Participant
0 Kudos

How to group the similar fields in ALV report as the below what must be the code.

Here clearing doc are same so 4 itsm are grouped under into one.


After that I want to calculate the sum of pls refer the below screen shot.

First Colum is groped into one and amount in summed and show in the output how to do that.


8 REPLIES 8

SimoneMilesi
Active Contributor
0 Kudos

Set SUM = 'X' in fieldcat for field "AMOUNT" and set "SORT" for Column "Clearing doc"

0 Kudos

in field cat ?

VenkatRamesh_V
Active Contributor
0 Kudos

Hi,

DATA :

      it_sort TYPE slis_t_sortinfo_alv,

      t_sort TYPE slis_sortinfo_alv.

  t_sort-fieldname = 'AUGBL'.

  t_sort-spos = 1.

  t_sort-up = 'X'.

  APPEND t_sort TO it_sort.

  CLEAR t_sort.

  call function 'REUSE_ALV_GRID_DISPLAY'

       exporting

            i_callback_program      = gd_repid

            i_callback_top_of_page  = 'TOP-OF-PAGE'  "see FORM

            is_layout               = gd_layout

            it_fieldcat             = fieldcatalog[]

            it_sort                 = it_sort[]

            i_save                  = 'X'

      tables

            t_outtab                = it_ekko

       exceptions

            program_error           = 1

            others                  = 2.

  if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
  •         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  endif.

endform.                    " DISPLAY_ALV_REPORT

Regards,

Venkat.

0 Kudos

can you please explain this in more detail ?

what about data in internal; table it_ekko

what about the table name ?

0 Kudos

Hi,

Hope  you are appending all values to the final internal table,  passing internal  table to alv  grid function

module.


add the following sort  syntax  for the clearing document.

in field catalog for the amount field.

wa_fcat-do_sum = 'X'. " it will display total at last.

but using sort syntax for the field augbl sub total for the field is displayed.

Hope it helpful.

Regards,

Venkat.

0 Kudos

wa_fcat-do_sum = 'X'. displays the whole row total but i have different requirement

raymond_giuseppi
Active Contributor
0 Kudos

First, execute The Consistency Check, and correct any inconsistency raised.

There, also display layout and look for field NO_MERGING, musy be initial

Then display your grid and thru menu remove every sort criteria and sort only on the field you want to group. What result do you get?

When (and if) okay, reexecute the consistency check and analyze the SORT internal table, so you should be able to code it.

NB: If Grid is input allowed, I fear you can no longer group fields.


Regards,

Raymond


matt
Active Contributor
0 Kudos

Rejected already, and now reposted three times. So now locked.

Post questions once in one place. If your post is rejected, don't post again.