cancel
Showing results for 
Search instead for 
Did you mean: 

Cell Editor in ALV

former_member450029
Participant
0 Kudos

Hi experts,

I have created an ALV table in webdynpro and I had made few cells to Image by using below code.

       lr_image->set_source_fieldname( ls_column-id ).

        ls_column-r_column->set_cell_editor( lr_image ).

Now my requirement is I want this cell which is an image to change accordingly on user interaction.

Below is a small snippet...

Best Regards,

Eshwar

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member211591
Contributor
0 Kudos

Hi Eshwar,

with every user-action you have to change the value of field ls_column-id (because this fields decides which icon to display -> lr_image->set_source_fieldname( ls_column-id )).

Thus you have to change the value of this field within the internal table which is used to hold the tables data.

BR

iSD

former_member450029
Participant
0 Kudos

Hi Ismail,

First thing is I am unable to interact with the column which displays image.

How can I interact with an image in Webdynpro ALV column.

Best Regards,

Eshwar

amy_king
Active Contributor
0 Kudos

Hi Eshwar,

Instead of using an Image UI element, use a LinkToAction UI element and give it an imageSource property. The image will then be clickable and will execute upon click the action you specify.

With ALV, I believe you need to reset the ALV's bound data table to change the table's contents. See interface method SET_DATA of the SALV_WD_TABLE component. See also the demo component SALV_WD_TEST_SET_DATA.

Cheers,

Amy

former_member450029
Participant
0 Kudos

Hi Amy,

How to set image source property to the cell which is already a link to action.

Can I get any sample code.

BR,

Eshwar

amy_king
Active Contributor
0 Kudos

Hi Eshwar,


data lo_lta type ref to cl_salv_wd_uie_link_to_action.

create object lo_lta.

*  One or the other...

lo_lta->set_image_source( 'ICON_NAME' ).

lo_lta->set_image_source_fieldname( 'COLUMN_ID' ).

lo_column->set_cell_editor( lo_lta ).

Take a look at the demo component SALV_WD_TEST_IMAGE1 in your system for examples.

Cheers,

Amy

former_member450029
Participant
0 Kudos

Hi Amy,

This image comes from the database.

Initially image comes from the DB into Web UI in different format.

@OV@->icon_okay and @OO@->icon_dummy.

So, I have made these columns to images by using below code

         lr_image->set_source_fieldname( ls_column-id ).

        ls_column-r_column->set_cell_editor( lr_image ).

Now, I need to interact with these images. I have tried setting them with LinkToAction but not working.

You can see, when I use linktoaction @OV@->this will be displayed instead of an image.

When ever I interact with these images they must change from ICON_OKAY to ICON_DUMMY and vice versa.

Hope you understood.

BR,

Eshwar

amy_king
Active Contributor
0 Kudos

Hi Eshwar,

You need to convert the old 4-character icon ID, e.g., @OO@, to its corresponding icon name and use the icon name in your image source column. You can do this by a lookup in table ICON.

When you interact with your LinkToAction, change the icon name that is stored in the image source column then refresh the ALV data with a call to SET_DATA.

Cheers,

Amy

former_member450029
Participant
0 Kudos

Hi Amy,

This ain't working.

I have tried with first column, but both image and @ov@

data lr_link TYPE REF TO cl_salv_wd_uie_link_to_action.

         lr_column = lv_value->if_salv_wd_column_settings~get_column( ls_column-id ).

         create OBJECT lr_link.

         lr_link->set_text_fieldname( ls_column-id ).

         lr_column->set_cell_editor( lr_link ).

         lr_link->set_image_source( 'ICON_DUMMY' ).

         lr_link->set_image_source_fieldname( ls_column-id ).


BR,

Eshwar

amy_king
Active Contributor
0 Kudos

Hi Eshwar,

You have set a text field with the statement


         lr_link->set_text_fieldname( ls_column-id ).


So you are seeing a hyperlinked text (@OV@) in the column alongside the icon. If you don't want text alongside the icon, don't set a text field.

The following two statements are redundant. The first sets the image source explicitly and the second identifies a column where the image source is read from. Use one or the other but not both.


         lr_link->set_image_source( 'ICON_DUMMY' ).

         lr_link->set_image_source_fieldname( ls_column-id ).


Cheers,

Amy

former_member450029
Participant
0 Kudos

Hi Amy,

I do not want to pass image explicitly, it will come from DB.

BR,

Eshwar