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 list refresh after change of field visibility (set_technical)

Former Member
0 Kudos
807

Dear all,

in a ALV list i hide some collums with method cl_salv_column_table-set_technical. If the user presses a butten, i like to show the hidden columns, but the filelds are still hidden. I called the method cl_salv_table->refresh and i tryed method cl_salv_table->set_data, but no effect. Only if i destroy the ALV Object the hidden fields are shown. How can i show the hidden fields without creating the ALV new?

Here a short code fragment:


  IF r_dock_cont_top IS INITIAL.                      "Reference to Dynprocontainer
    CREATE OBJECT r_dock_cont_top
      EXPORTING
        side      = r_dock_cont_top->dock_at_top
        extension = '250'.

    TRY.
        CALL METHOD cl_salv_table=>factory
          EXPORTING
            r_container  = r_dock_cont_top
          IMPORTING
            r_salv_table = r_salv_top
          CHANGING
            t_table      = <t_alv_top>.
      CATCH cx_salv_msg .
    ENDTRY.
    PERFORM alv_field_visibility.                      "hide collumns SET_TECNICAL = TRUE
    r_salv_top->display( ).

  ELSE.
    PERFORM alv_field_visibility.                       "show hidden collumns SET_TECNICAL = FALSE
    CALL METHOD r_salv_top->set_data         " no effect
      CHANGING
        t_table = <t_alv_top>.
*    r_salv_top->refresh( refresh_mode = if_salv_c_refresh=>full ). " no effect
  ENDIF.

Thanks for Answer!

Wolfgang

Edited by: Wolfgang Boehm on Jan 5, 2012 11:36 AM

1 ACCEPTED SOLUTION

Harsh_Bansal
Contributor
0 Kudos
183

Hi,

you used set_technical = true to hide the columns.

Did you try set_technical = false to make them visible??

Apart from this, there is another method available in same class -

Set_visible

Try using this.

Regards,

Harsh Bansal

6 REPLIES 6

Harsh_Bansal
Contributor
0 Kudos
184

Hi,

you used set_technical = true to hide the columns.

Did you try set_technical = false to make them visible??

Apart from this, there is another method available in same class -

Set_visible

Try using this.

Regards,

Harsh Bansal

0 Kudos
183

Hello Harsh,

thank you, you are right, i did it like you said .But your solution does'nt work:


FORM alv_field_visibility_set
  USING ib_list_status TYPE boolean
        ir_colt        TYPE REF TO cl_salv_columns_table
        iv_col_name    TYPE fieldname.

  DATA:
    lr_col  TYPE REF TO cl_salv_column_table.

  TRY.
      lr_col ?= ir_colt->get_column( iv_col_name ).
    CATCH cx_salv_not_found.
  ENDTRY.

  IF ib_list_status = false.
    TRY.
        CALL METHOD lr_col->set_technical( true ).
      CATCH cx_salv_data_error.
    ENDTRY.

  ELSE.
    TRY.
      CALL METHOD lr_col->set_visible( true ).
        catch cx_salv_data_error.
    ENDTRY.
  ENDIF.
ENDFORM.                    " ALV_OO_VISIBILITY_SET

Edited by: Wolfgang Boehm on Jan 5, 2012 12:09 PM

Edited by: Wolfgang Boehm on Jan 5, 2012 12:11 PM

0 Kudos
183

Hello,

Instead of

TRY.
    CALL METHOD lr_col->set_visible( true ).
  CATCH cx_salv_data_error.
ENDTRY.

Try,

TRY.
    CALL METHOD lr_col->set_technical( if_salv_c_bool_sap=>false ).
  CATCH cx_salv_data_error.
ENDTRY.

I feel that although you're setting the visibility attribute as true, but technical attribute is still true & hence you do not see the column.

BR,

Suhas

0 Kudos
183

Hello Suhas,

thanks a lot, this is the solution! But it seems not ligical to me, to hide one statement, to unhide two statments. Neverless, it runs!


    IF ib_list_status = false.
    TRY.
        CALL METHOD lr_col->set_technical( true ).
      CATCH cx_salv_data_error.
    ENDTRY.

  ELSE.
    TRY.
        CALL METHOD lr_col->set_technical( false ).
      CATCH cx_salv_data_error.
    ENDTRY.
    TRY.
        CALL METHOD lr_col->set_visible( true ).
      CATCH cx_salv_data_error.
    ENDTRY.
  ENDIF. 

Regards,

Wolfgang

0 Kudos
183

Hello Suhas,

i liked to close this thread to click on solved to your post, but i clicked on the wrong butten and i can't undo it. Please replay to this message so i will give you 10 points.

Regards,

Wolfgang

0 Kudos
183

Done.

Thomas