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: 

How to display the ALV output in a Group format

VenuAnumayam
Participant
0 Kudos

Hello Experts,

I have my current ALV report output like this:

GROUP DESCRIPTION
group1 adsfadsfadsfa
group1 lkjadsfjlajdsfla
group1 adsfadsfadsf
group1 adsfadsfadfa
group2 adsfadsfafaa
group2 oiueworuowe
group2 zxvzcxvzvcsd
group2 oiuqoewruqw

And I need to display the output of my ALV report in a group format like this:

GROUP DESCRIPTION
group1 adsfadsfadsfa
       lkjadsfjlajdsfla
       adsfadsfadsf
       adsfadsfadfa
group2 adsfadsfafaa
       oiueworuowe
       zxvzcxvzvcsd
       oiuqoewruqw

Can anybody please let me know if there is any sample program/thread/help etc.

I grealty appreciate your help.

Thanks.

1 ACCEPTED SOLUTION

rainer_hbenthal
Active Contributor
0 Kudos

Supply a sort table and set the layout to

data   alv_layout              type slis_layout_alv.  
alv_layout-cell_merge        = 'N'.

and supply the layout, too.

10 REPLIES 10

rainer_hbenthal
Active Contributor
0 Kudos

Supply a sort table and set the layout to

data   alv_layout              type slis_layout_alv.  
alv_layout-cell_merge        = 'N'.

and supply the layout, too.

0 Kudos

Hi Rainer,

Thanks for the reply. I am using container for the ALV Display.

So I wrote my code lie this:

sort t_data by zgroup zdesc  ( t_data is my output internal table) .

I have my ALV layout delcared like this:

data: alv_layout type lvc_s_layo.

So I have modified my code like this:

alv_layout-NO_MERGING  = 'X'.

But it did'nt work. Please let me know if I need make any other changes.

Thanks again.

0 Kudos

You should not sort your table inside ABAP, you should tell the ALV how and what to sort.

In the REUSE functionmodule there is an inconsitency that you have to supply N instead of X, so if its not working try Y or J instead of X.

Have a look at your ALV screen if you can switch on grouping afterwards. If this is working, it should be possible in the ABAP. IF Y or J as paramter is not working you need to debug...

0 Kudos

Thanks, Rainer.

I have taken out "sort" in my program and tried the "No_MERGE" with 'Y', 'J' , 'X' and 'N'. Nothing seems to be working though.

Can anybody plese help? Thanks.

Is there any "Demo" program available that I can look at? Thanks.

Edited by: ravi kumar on Feb 24, 2010 7:48 AM

0 Kudos

Hi Ravi,

Write following logic before calling the FM "REUSE_ALV_GRID_DISPLAY" and pass the gt_sort to it_sort parameter of the FM "REUSE_ALV_GRID_DISPLAY" .

 
  DATA:        ls_sort     TYPE slis_sortinfo_alv.

  ls_sort-spos = '01'.
  ls_sort-fieldname = 'GROUP'.
  ls_sort-tabname = 'gt_output'.
  ls_sort-up        = 'X'.
  append ls_sort to gt_sort.
  CLEAR ls_sort.

Regards,

Chandravadan

0 Kudos

Which class are you using in your container to display the ALV?

0 Kudos

Remove this NO_MERGING, it is the opposite of what you want.

Using the parameter IT_SORT(_LVC) or a variant display with a sort criterion, you do not need to sort the table passed as parameter, it also has no effect.

(Same solution for Class CL_GUI_ALV_GRID or FM REUSE_ALV_GRID_DISPLAY_LVC except the suffix of the SORT parameter name)

Regards,

Raymond

0 Kudos

If the table is not sorted in the ALV, it can not be grouped properly.

0 Kudos
Rainer Hübenthal 


Which class are you using in your container to display the ALV?

data:       alv_grid      type ref to cl_gui_alv_grid,

call method alv_grid->set_table_for_first_display
      exporting
        is_layout                     = alv_layout
      changing
        it_outtab                     = t_data[]
        it_fieldcatalog               = alv_fieldcat
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4.

VenuAnumayam
Participant
0 Kudos

Thanks.