Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Add different UI in each row based on conditions in ALV

Hell All,

i am working on dynamic ALV in which i have created 3 methods 1. which creates the columns 2. Which sets the data into teh created columns. 3. which does teh alv customizations.

So now my requirement is based on some condition i want to change the UI element

eg

i have

column1 column2 column3

1 link_to_action name

2 link_to_url name2

so based on the condition i would like to display the ui elements as above.

I was able to do till this end so far..

1.in create_columns method i created a column call cell_varaint

2 when i was passing data into the columns

'when column1'

IF colum1 = 1.

<field> = 'link_to_url'

else.

<f_field> = ' '.

endif.

when 'column2'

CREATE OBJECT lr_link_to_actn.

  • <ls_column>-r_column->set_cell_editor( lr_link_to_actn ).

*

  • CREATE OBJECT l_cv.

  • l_cv->set_key( value = 'LINK_TO_URL').

  • l_cv->set_editor( value = lr_lnk_to_url ).

  • <ls_column>-r_column->add_cell_variant( r_cell_variant = l_cv ).

  • <ls_column>-r_column->set_sel_cell_variant_fieldname( 'cell_varaint).

so now i am able to get only empty column with no data into it ... and my cell varaint column shows me the values like LINK_to_URL or space.

I am sure tht some where i am missing something...

Please tell me the correct procedure to use it...

Regards,

Sana.

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question