cancel
Showing results for 
Search instead for 
Did you mean: 

ALV sort column problem

Former Member
0 Kudos

Hi all - I have an ALV with standard sort functionality in each column. Let's say that I have 20 rows with 5 columns, the first column has a record in every row but another column in some rows are empty but in other rows that column has data.

If I click the sort functionality (next to the label of the column) in a column that has empty spaces and values it will show the data sorted but the empty spaces are shown like a whole blank column (it losses the line that divided the rows) and it's kind of confusing, if the column is completely empty and I click sort of course nothing will get sort but the column looks all white (no lines at the row level)

Is there anyway that I can eliminate that white space and if is empty is empty I dont want to lose the line that divide the rows?

thanks!

Jason P-V

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jason,

just a guess: Maybe the records are grouped and that's why they don't show the lines in between?

If you set SET_GROUPING_ALLOWED to ABAP_FALSE, you can check whether this is the cause of you problem.

See also: [Sorting|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/9a/f54e893cf74ac1810ca951d8feb823/frameset.htm]

Hope this helps

Stefanie

Former Member
0 Kudos

Stefanie - THanks for your help, are you referring to SET_GROUP_AGGREGATION_ALLOW from Interface IF_SALV_WD_STD_FUNCTIONS?

I'm searching for SET_GROUPING_ALLOWED and I dont find it, if the one I mentioned above is not can you tell me in which Class or interface is that Method?

thanks!

Jason P-V

Former Member
0 Kudos

Stefanie - I find out in the document that you sent for reference the class and interface, thank you.

But now the issue is that is pointing to nothing, I'm doing something wrong?

DATA: L_SORT TYPE REF TO CL_SALV_WD_FIELD, LR_SORT TYPE REF TO IF_SALV_WD_SORT. LR_SORT ?= L_SORT. LR_SORT->SET_GROUPING_ALLOWED( ABAP_FALSE ).

do you know what I'm doing wrong?

why is dumping?

thanks!

Jason PV

Former Member
0 Kudos

hi

it might be dumping as in your mentioned code snippet you are not taking the reference of the field and so it will be intial

Try using the following code instead -

DATA: lo_cmp_usage            TYPE ref to if_wd_component_usage.
  DATA: lr_salv_wd_table        TYPE REF TO iwci_salv_wd_table.
 DATA: lr_function_settings    TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
 Data: lr_field_curr                   TYPE REF TO CL_SALV_WD_FIELD.
 
*create an instance of ALV component
  lo_cmp_usage =   wd_this->wd_cpuse_OVERVIEW_PAYMENT_ALV( ). "My ALV Usage Name OVERVIEW_PAYMENT_ALV
* if not initialized, then initialize
  if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage->create_component( ).
  endif.

* get ALV component
  lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_PAYMENT_ALV( ).
  lr_function_settings ? = lr_salv_wd_table->get_model( ).

        CALL METHOD LR_FUNCTION_SETTINGS->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD
          EXPORTING
            FIELDNAME = 'CON_CURR'  " ALV Column Name 
          RECEIVING
            VALUE     = lr_field_curr.

        CALL METHOD LR_FIELD_CURR->IF_SALV_WD_SORT~SET_GROUPING_ALLOWED ( exporting value = abap_false ).

Hope this helps

Former Member
0 Kudos

Thank you that solves the problem!!!!

PV

Former Member
0 Kudos

QUestion...Do I need to do this Field by FIeld or I can do the whole ALV at once?

thanks!

PV

Former Member
0 Kudos

Hi,

The code snippet mentioned by me works on field by field..

For this you can get reference of all the columns, loop at columns and then try the same.

I'm not sure but for whole ALV settings you can try using the method IF_SALV_WD_STD_FUNCTIONS~SET_GROUP_AGGREGATION_ALLOWED of CL_SALV_WD_TABLE. Just try callign this method with param abap_false.

Regards

Manas Dua

Answers (0)