cancel
Showing results for 
Search instead for 
Did you mean: 

cl_salv_wd_column->set_visible

Former Member
0 Kudos

Hi everybody,

i have a little problem and hope that anybody can help me.

We have a WebDynpro. Ther is shown a tale mit employees. This table is an ALV. When i click on an employess the WebDynpro showns a second ALV. Ther i would that some columns not visible. I do this with this:

IF aproz_merker IS INITIAL.

lr_column = lr_column_settings->get_column( 'APROZ' ).

lr_column->set_visible( cl_wd_uielement=>e_visible-none ).

ENDIF.

But the column is shown. When i click in this second table in "Filter" the column is not visible.

What should i do that the column are from the start not visible?

i hope my problem is understanding.

Thanks

Best regards

Markus

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
lt_columns = lr_column_settings->get_columns( ).

  LOOP AT lt_columns INTO ls_column.
    CASE ls_column-id.
      WHEN 'APROZ'.
             ls_column-r_column->set_visible(
             cl_wd_uielement=>e_visible-none ).

    ENDCASE   .
  ENDLOOP  .

try this!

Former Member
0 Kudos

Hi,

my problem is not that the coding is false.

the coding that i use is ok but i don´t know where i schoul use it. i can´t do it in the method WDDOINIT because i have data after i select an employee. When i do it in the method WDDOPOSTPROCESSING than the columns are visible after i click for example on filter in the ALV not from the beginning.

i hope you understand it.

Regards

Markus

Former Member
0 Kudos

Place this code in the action that you have created when you click an employee or in the method where you call/instantiate your second alv ?

Regards,

Radhika.

Former Member
0 Kudos

Method: WDDOPOSTPROCESSING

METHOD wddopostprocessing .

*

**... check ALV component usage

DATA: lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.

DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.

DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.

  • Jahreskalender Statistik

DATA lo_nd_jahr_stats TYPE REF TO if_wd_context_node.

DATA lo_el_jahr_stats TYPE REF TO if_wd_context_element.

DATA ls_jahr_stats TYPE wd_this->element_jahr_stats.

DATA lt_jahr_stats TYPE TABLE OF wd_this->element_jahr_stats.

  • navigate from <CONTEXT> to <JAHR_STATS> via lead selection

lo_nd_jahr_stats = wd_context->get_child_node( name = wd_this->wdctx_jahr_stats ).

lo_nd_jahr_stats->get_static_attributes_table( IMPORTING table = lt_jahr_stats ).

IF lt_jahr_stats[] IS NOT INITIAL.

DATA: azeit_merker TYPE c,

aproz_merker TYPE c,

uzeit_merker TYPE c,

uproz_merker TYPE c.

LOOP AT lt_jahr_stats INTO ls_jahr_stats.

IF ls_jahr_stats-azeit IS NOT INITIAL.

azeit_merker = 'X'.

ENDIF.

IF ls_jahr_stats-aproz IS NOT INITIAL.

aproz_merker = 'X'.

ENDIF.

IF ls_jahr_stats-uzeit IS NOT INITIAL.

uzeit_merker = 'X'.

ENDIF.

IF ls_jahr_stats-uproz IS NOT INITIAL.

uproz_merker = 'X'.

ENDIF.

ENDLOOP.

lr_salv_wd_table_usage = wd_this->wd_cpuse_alv_jahr_stats( ).

IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.

lr_salv_wd_table_usage->create_component( ).

ENDIF.

*

lr_salv_wd_table = wd_this->wd_cpifc_alv_jahr_stats( ).

wd_this->r_table = lr_salv_wd_table->get_model( ).

DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.

DATA: lr_column TYPE REF TO cl_salv_wd_column.

lr_column_settings ?= wd_this->r_table.

IF azeit_merker IS INITIAL.

lr_column = lr_column_settings->get_column( 'AZEIT' ).

lr_column->set_visible( cl_wd_uielement=>e_visible-none ).

  • wd_this->r_table->if_salv_wd_column_settings~create_column( id = 'AZEIT' ).

ENDIF.

IF aproz_merker IS INITIAL.

lr_column = lr_column_settings->get_column( 'APROZ' ).

lr_column->set_visible( cl_wd_uielement=>e_visible-none ).

  • wd_this->r_table->if_salv_wd_column_settings~delete_column( id = 'APROZ' ).

ENDIF.

IF uzeit_merker IS INITIAL.

lr_column = lr_column_settings->get_column( 'UZEIT' ).

lr_column->set_visible( cl_wd_uielement=>e_visible-none ).

  • wd_this->r_table->if_salv_wd_column_settings~create_column( id = 'UZEIT' ).

ENDIF.

IF uproz_merker IS INITIAL.

lr_column = lr_column_settings->get_column( 'UPROZ' ).

lr_column->set_visible( cl_wd_uielement=>e_visible-none ).

  • wd_this->r_table->if_salv_wd_column_settings~create_column( id = 'UPROZ' ).

ENDIF.

*

lr_table_settings ?= wd_this->r_table .

ENDIF.

ENDMETHOD.

Regards

Markus

Former Member
0 Kudos

can you help me with the coding?

Former Member
0 Kudos

Hi,

I have following code for one of my application and it works fine for me:

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .

l_ref_interfacecontroller = wd_this->wd_cpifc_alv_itab( ).

data:

l_value type ref to cl_salv_wd_config_table.

l_value = l_ref_interfacecontroller->get_model( ).

  • access columns

data: lcr_column_settings type ref to if_salv_wd_column_settings,

lcr_column_header TYPE REF TO cl_salv_wd_column_header,

lcr_column type ref to cl_salv_wd_column.

lcr_column_settings ?= l_value.

lcr_column = l_value->if_salv_wd_column_settings~get_column( 'TMART' ).

lcr_column->SET_VISIBLE( CL_WD_UIELEMENT=>E_VISIBLE-NONE ).

Thanks.

AS.

Former Member
0 Kudos

Hi experts!

i have the same problem and i don't know what happend. I set in WDDOINIT method which columns a want see and that set is OK. I have two web dynpro applications.When a fire one, in the browser i see the selected columns, that's ok. But when a fire the other one, i see all columns.

Can you help me please?

Thaks for advcance

Micaela

arjun_thakur
Active Contributor
0 Kudos

Hi Markus,

Refer to the code given by Abhimanyu in this thread: https://forums.sdn.sap.com/click.jspa?searchID=25613385&messageID=5475902.

I hope it helps.

Regards

Arjun