on 09-14-2009 7:19 AM
Hello Experts,
Could you please help me on how to display a icon in any ALV.
Thanking You in Advance,
Tamanna k
Hi,
Can you be more specific...You want an icon in a ALV column/Cell or as a header....
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer these -
https://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproABAP-UsingUIelementsinALVcomponentcells
Regards,
Lekha.
Hi Tamanna,
You would have to basically change the cell editor of the column in which you want to display the icon into an Image. (CL_SALV_WD_UIE_IMAGE) You then specify the source of the image using either SET_SOURCE or SET_SOURCE_FIELDNAME. The process for doing this explained in detail in the link which Lekha has already passed you. (David Pietroniro's link)
If you however intend to set an icon & text within the same cell of the ALV then you need to change the cell editor of the desired ALV column into a Caption. (cl_salv_wd_uie_caption) The Caption has both a "image source" & "text" property. So you can just change the cell editor to a Caption & set these 2 properties to display both an icon & text within the same cell. Below is a code snippet explaining the same:
Regards,
Uday
METHOD build_alv .
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref.
DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
"*** Instantiate the used ALV Component
l_ref_cmp_usage = wd_this->wd_cpuse_my_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
"*** Get reference to the model
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table,
lr_config TYPE REF TO cl_salv_wd_config_table,
lr_caption TYPE REF TO cl_salv_wd_uie_caption.
FIELD-SYMBOLS <fs_column> LIKE LINE OF lt_columns.
l_ref_interfacecontroller = wd_this->wd_cpifc_my_alv( ).
lr_config = l_ref_interfacecontroller->get_model( ).
"*** Trying to set entire ALV table to editable
lr_table_settings ?= lr_config.
lr_table_settings->set_read_only( abap_false ).
"**** Set the UI elements.
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
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.
ENDMETHOD. ""BUILD_ALV
you can make one of the column in the ALV as the image type and assign the icon values (constants) to it.
bind the source f the image property to string attribute and set the value something like bnelow
lo_nd_tbl_as_led->set_attribute(
value = 'ICON_LED_RED'
name = 'INVALID' ).
this will be helping to create a green led icon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.