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: 

CL_SALV_TABLE sort without merging

Former Member
0 Kudos
2,742

Hi all

Does anyone know how to manage a sort using the SALV factory method (cl_salv_table) - WITHOUT the sort fields merging, i.e. the same function as with field NO_MERGING in LVC_S_FCAT using old style ALV?

The sorts all work fine using the following:

DATA: lr_salv_sorts TYPE REF TO cl_salv_sorts.

....

lr_salv_sorts->add_sort( EXPORTING columnname = 'YEAR'

position = '1'

sequence = '2'

subtotal = ' ' ).

However, the sort fields are all merged - you used to be able to switch this off using NO_MERGING in LVC_S_FCAT.....

I need to switch this merging off for ALV OM

Many thanks in advance.

12 REPLIES 12

naimesh_patel
Active Contributor
0 Kudos
823

SALV doesn't handle NO_MERGING.

Check the method GET_LVC_LAYOUT of the Class CL_SALV_CONTROLLER_METADATA which fills the Layout. This method doesn't fill the NO_MERGING option.

One way to achieve this is using the ALV Display Layout. You can set the default Layout with the option Display > Without cell merging during sorts Set.

Regards,

Naimesh Patel

Edited by: Naimesh Patel on Jun 8, 2010 10:17 AM

0 Kudos
823

Hi

Thanks for this, did you mean the following?

cl_salv_controller_metadata=>get_lvc_layout( CHANGING s_layout = lv_lvc_s_layo ).

lv_lvc_s_layo-no_merging = 'X'.

cl_salv_controller_metadata=>set_lvc_layout( EXPORTING s_layout = lv_lvc_s_layo ).

It still merges sort fields, sorry if I've mis-understood.

Thanks

0 Kudos
823

NO. I just provided the class & method for your reference to understand the where SALV doesn't handle the NO_MERGING.

Regards,

Naimesh Patel

0 Kudos
823

Hi

This is clear now, thanks for the help.

Points awarded.

Thanks

Former Member
0 Kudos
823

This is great - thanks for the help

Daniele_Sgi
Participant
0 Kudos
823

Hi,

there's some news, see Note 1818083 - ALV layout: Merging behavior in object model

0 Kudos
823

Hi,

I implemented the note and set the display setting set_no_merging to TRUE but still the sorted cells are merged.

0 Kudos
823

Yes, I know

I have opened a "SAP Message Number" for this issue.

Daniele_Sgi
Participant
0 Kudos
823

Note 1818083 - ALV layout: Merging behavior in object model

Reply to Notification from SAP:

<<This method does only influence the display of ALV grids in their own conatiner. It can not influence the display of fullscreen grids because of techical reasons. We will update the documentation to clarify the use of this method. To solve this problem please pass a container to the factory method of
class cl_salv_table.>>


Harsh9
Participant
0 Kudos
823

Hello folks,

I am having a similar issue. I did the sorting part using cl_salv_sorts which merged the columns on which I applied sorting. But at the same time I don't want columns in the merged fashion. I tried below piece of code to set no merging but it didn't work.


    data: lv_s_layout type lvc_s_layo.

    call method cl_salv_controller_metadata=>get_lvc_layout
      changing
        s_layout = lv_s_layout.

    lv_s_layout-no_merging = 'X'.

    call method cl_salv_controller_metadata=>set_lvc_layout
      exporting
        s_layout = lv_s_layout.


Any help..

Regards,

Harsh

823

Hi,


I had the same issue and solved it with a little workaround.

You can copy the values from the column you want to sort by into a another field which you are going to hide on the Screen. Then you can sort by that hidden field.

Regards,

Tommy

ultimate_kapoor
Explorer
823

Hi,
You can achieve this by using the display settings instead of sorts or layout setting.

DATA: lo_display TYPE REF TO cl_salv_display_settings.

lo_display = co_alv->get_display_settings( ).

lo_display->set_no_merging( value = 'X' ).