cancel
Showing results for 
Search instead for 
Did you mean: 

Add different UI in each row based on conditions in ALV

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

I hope it is Hello not Hell

if i understand your question correctly, You want the first row of column to LinkToAction UI element and second row LinktoURL.

follow the link where it is nicely explained however he is making one row as text view and other as checkbox.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0e7461d-5e6c-2b10-dda9-9e99df4d1...

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved the issue i was following all the steps but was not setting the text for the link to action / link to url .

Former Member
0 Kudos

Hi,

i do not know how you have realized this. I think after you call the alv method set_data, you could get the configuration of the alv and loop through the columns and delete the column cell editors and rebind it with new editors based on your logic.

This is how i would base my logic. Of course it is not a simple everyday programming work. I would also suggest to have a look at FPM GUIBB list -alv .