cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Properties dynamically for an ALV

Former Member
0 Kudos

Hi Everyone,

I have the below requirement. I have a ALV where there are 2 fields of type TIMS. When the value is not available its showing as 00:00:00. But the problem is when I export the same to excel I am getting that as 12:00:00 AM.

So I was asked to hide the element when there is no value for that fields.

I used the below code for the same.

IF time is initial.
            table_column = table_model->if_salv_wd_column_settings~get_column( id = 'OUTIME' ).
            text_view_ref = table_column->get_cell_editor( ).
            text_view ?= text_view_ref.

            CALL METHOD text_view->set_visible
              EXPORTING
                value = cl_wd_uielement=>e_visible-none.
endif.

The above code is changing the property for all the rows. I want to change only the rows where it is initial. I tried to use get_cell_variant method and struck with it. Can anyone help me with it?

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>The above code is changing the property for all the rows.

Yes that is exactly what it is intended to do. You are setitng a property of the cell editor that is used for the entire column. You would need to create a cell variant. The main cell editor would be vislble and the cell variant would not be visible. Then add another attribute to you context so that you can use this attribute to control which cell variant is used at the element level.

Former Member
0 Kudos

Hi Thomas,

Thanks for your response. Are there any reference material for the same?

I am new to this ALV concept and it would be great to have some material.

Former Member
0 Kudos

Vidhya,

Please search scn and google.there are lots of material available on this topic

Thanks

Bala Duvvuri

Former Member
0 Kudos

Below is the piece of code that I am using with reference to the material [http://help.sap.com/saphelp_nw70/helpdata/en/b6/b7bc68306049bd8500362ce52b6def/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/b6/b7bc68306049bd8500362ce52b6def/frameset.htm]

DATA: table_column       TYPE REF TO cl_salv_wd_column,
                      table_model       TYPE REF TO cl_salv_wd_config_table,
                      lr_input1          TYPE REF TO cl_salv_wd_uie_input_field,

            table_column = table_model->if_salv_wd_column_settings~get_column( id = 'OUTIME' ).

            CREATE OBJECT lr_input1
              EXPORTING
                value_fieldname = 'OUTIME'.

            table_column->set_cell_editor( lr_input1 ).

Whats the BUTTON_VIS field in the material above? how do I use that in my code?

Madhu2004
Active Contributor
0 Kudos

HI,

BUTTON_VIS is another field in the node. This may conatian the value abap_true or abap_false. This field is to determine if the button shold be visible or not in that row. For each row along with the data populate this filed on whether the filed should be visible or not.

Regards,

Madhu