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: 
Read only

Sort and MERGE data in columns

Former Member
0 Likes
3,188

Hi guys!

How can I sort and merge data in columns when I am using CALL METHOD go_grid->set_table_for_first_display.

I tried deleting almost all the standard buttons form the standard toolbar, and keeping just the "sort ascending" and "sort descending" ones.

But when I use them they do not merge the cells with the same value (they just sort the columns).

Do you happen to know a method or a way to do this thing? Is it necessary to use it_sort parameter?.

Here is the way I called the method.

CALL METHOD go_grid->set_table_for_first_display
     EXPORTING
       is_variant           = ls_vari
       i_save               = 'A'
       is_layout            = gs_layout
       it_toolbar_excluding = g_t_tlbr_excl
     CHANGING
       it_outtab            = gt_alv
       it_fieldcatalog      = gt_fcat.

   CALL METHOD go_grid->set_toolbar_interactive.
   CALL METHOD cl_gui_control=>set_focus
     EXPORTING
       control = go_grid.

   CALL METHOD go_grid->set_ready_for_input
     EXPORTING
       i_ready_for_input = 1.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,626

I also thought of something else....

As you can see in the image below in the alv display you can select one or more rows .

Maybe the sort is afected by this feature? What do you think?

9 REPLIES 9
Read only

Former Member
0 Likes
2,626

can you check the layout structure you are passing? The issue you are facing can happen if the below checkbox is ticked.

What I could not understand is why would you hide standard buttons to achieve this functionality.

Anyway, let me know if this worked for you.

Read only

0 Likes
2,626

Hi 

I tried, but it doesn't work.

The checkbox wasn't ticked, and when I created the fieldcatalog I did not check the no_cell_merging feature.

The idea is that I want to create a custom toolbar and I need a sort button.  

Any more ideas?

Read only

0 Likes
2,626

Please post a screenshot. One reason could be there is already some unique number sorted earlier.

eg. if you sort an ALV with RFQ number and date, since RFQ number is unique, dates can not be merged.

Anyway.

In case you want to create entire custom toolbar, you only need to add one funtion.

tool_wa_exclude  = cl_gui_alv_grid=>mc_fc_excl_all.
APPEND tool_wa_exclude  TO tool_it_exclude .


This will hide it all.

Read only

0 Likes
2,626

Yes I know that.

The Idea is that I hid most of the buttons and I kept the sort ones, but they don't work properly. When I click them the data gets sorted, but the cells with the same value in the column do not merge.. that is my problem...

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,625

Can you perform The Consistency Check and paste the layout here.

Regards,

Raymond

Read only

0 Likes
2,625

Here is the The Consistency Check.

Should I complete the layout with more features?

Read only

Former Member
0 Likes
2,627

I also thought of something else....

As you can see in the image below in the alv display you can select one or more rows .

Maybe the sort is afected by this feature? What do you think?

Read only

0 Likes
2,625

Oops, I just noticed

   CALL METHOD go_grid->set_ready_for_input
     EXPORTING
       i_ready_for_input = 1.

In mode input there wont be any merging, SAP will need to manage cells individually to allow update.

IMHO you should not be able to merge values in update mode.

Regards,

Raymond

Read only

0 Likes
2,625

Yes!

When I disable the input option the buttons do their job.

Thanks