cancel
Showing results for 
Search instead for 
Did you mean: 

ALV: Show icon + text in the same cell?

daniel_humberg
Contributor
0 Kudos

Can I show an icon and a textview in the same cell in an ALV?

(in other words: can there be two cell editors for a ALV column?).

What about an editable input field and an icon in the same cell?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Daniel,

Unfortunately SAP has only foreseen one celleditor per cell.

So you will need two cells, one for the icon and one for the textview or inputfield.

If this would have been possible, i think the method to set the cell editor would have had the option to provide more than one cell editor.

Regards,

Jos

Answers (1)

Answers (1)

Former Member
0 Kudos

You can use the CL_SALV_WD_UIE_CAPTION cell editor, which allows you to show an icon and a text in one cell.

Former Member
0 Kudos

Hi Jörg,

That's true for a non-editable text, but what if you would like to edit the text?

A caption can't be edited... So seems to me that that is impossible.

Regards,

Jos

Former Member
0 Kudos

Correct, that is impossible, because the only cell editor for editing text is the InputField (CL_SALV_WD_UIE_INPUT_FIELD). You can not add an icon to this cell editor.

But the initial question was, how to display a <b>textview</b> with an icon.

Regards ,

Joerg

Former Member
0 Kudos

Hi Jörg,

You are quite right.

My remark was not to question yours but just to complete the answer towards Daniel.

Thanks for your remark by the way, cause it was helpful to me too!!

Regards,

Jos

daniel_humberg
Contributor
0 Kudos

I would need both, a textview and a icon, as well as an inputfield and an icon.

But having at least one of them is also already nice.

Regards,

Daniel

Former Member
0 Kudos

Could you folks let me know how do I move forward using the class CL_SALV_WD_UIE_CAPTION for setting the text and Icon in ALV display. I am using CL_GUI_ALV_GRID.

Please help me out in getting a solution for this.

I want both Text and Icon in all cells in a column.

Regards,

Siva

Former Member
0 Kudos

Could you folks let me know how do I move forward using the class CL_SALV_WD_UIE_CAPTION for setting the text and Icon in ALV display. I am using CL_GUI_ALV_GRID.

Please help me out in getting a solution for this.

I want both Text and Icon in all cells in a column.

Regards,

Siva

Former Member
0 Kudos

Hi I too need the sample code for this..

uday_gubbala2
Active Contributor
0 Kudos

Hi Mayank,

Its easy. Once you obtain the reference of your desired column create an instance of the & then set it to the cell editor. Check the code fragment below:

data: lr_caption        TYPE REF TO cl_salv_wd_uie_caption.

  LOOP AT lt_columns ASSIGNING <fs_column>.
    CASE <fs_column>-id.
      WHEN 'CHECK'.
         CREATE OBJECT lr_caption.
         lr_caption->set_image_source( value = '~Pictogram/3People' ).
         lr_caption->SET_TEXT( value = 'My Text!' ).

        <fs_column>-r_column->set_cell_editor( lr_caption ).
    ENDCASE.
  ENDLOOP.

In the snippet above am changing the cell editors of column by name CHECK to contain a pictogram by name "People" & a static text "My Text". So now all my cells under the CHECK column would contain both the pictogram & the text.

Regards,

Uday

Former Member
0 Kudos

Hi Uday,

can your coding use in alv with fieldcat ?

My problem is, that I need in one cell icon + text in alv, but for alv output I use fieldcat.

What specification muss field in fieldcat to have, for good funcionality ?

Thanks

Jozef