cancel
Showing results for 
Search instead for 
Did you mean: 

IMAGE IN ALV CELL

former_member199125
Active Contributor
0 Kudos

Hi Guys,

I have inserted image element as cell editor in alv column. But image is not coming. Check the below code and let me know where i did mistake.

DATA: LR_IMG3 TYPE REF TO CL_SALV_WD_UIE_IMAGE.

DATA: LO_COLUMN3 TYPE REF TO CL_SALV_WD_COLUMN.

LO_COLUMN3 = LO_VALUE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'PINFO' ).

CREATE OBJECT LR_IMG3.

LR_IMG3->SET_SOURCE_FIELDNAME( 'PINFO' ).

  • LR_IMG3->SET_HEIGHT_FIELDNAME( '20' ).

LO_COLUMN3->SET_CELL_EDITOR( LR_IMG3 ).

And what parameter i should pass to set_height_fieldname. ? I tried with 20px also, error saying 20px unknown.

Regards

Srinivas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Srinivas,

Try this...

data lo_cmp_usage type ref to if_wd_component_usage.
 
  lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
  if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage->create_component( ).
  endif. 
 
  DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
  lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv( ).
 
    DATA lo_value TYPE ref to cl_salv_wd_config_table.
    lo_value = lo_interfacecontroller->get_model(    ).

data col type ref to  CL_SALV_WD_COLUMN.
col = lo_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'IMAGE' ).
data image type ref to cl_salv_wd_uie_image.
CREATE OBJECT image.
 image->SET_SOURCE_FIELDNAME( 'IMAGE' ).
COL->SET_CELL_EDITOR( image  ).

Cheers,

Kris.

former_member199125
Active Contributor
0 Kudos

Kris,

My code is also same as your code. am not getting images. i am getting cell as image cell but not displaying my images.

check this code.

IF WT_PR-PINFO = '2'.

LS_NPREQUESTS-PINFO = 'CORRECT.JPEG' .

ELSE.

LS_NPREQUESTS-PINFO = 'WRONG.JPEG' .

ENDIF.

in above code both correct and wrong images are stored in mimes folder. but its not taking images. instead of images it dispalying cross ( X) mark. ( it means no image )

And any idea about height which i asked?

Regards

Srinivas

saravanan_narayanan
Active Contributor
0 Kudos

Hello Srinivas,

you need to mention the full path for the mime object. because the ALV is a different component, and the mime object is in our component wont be available in the AL V component.

so maintain the source value as '/sap/bc/webdynpro/sap/Z_TEMP/image.jpg'

Z_TEMP - is your component name and image.jpg is your mime object name.

hope this solves your problem.

BR, Saravanan

Former Member
0 Kudos

Hi Srinivas,

You have to give MIME object URL.

Please go through this...

Cheers,

Kris.