How to display different icon within WDA alv table base on row data ?

Hi,
is that possible to display different icon for every row within ALV table depending on the row data ?
for instance if the status 'S' display ~Icon/SuccessMessage and 'E' display ~Icon/ErrorMessage ?
because base on this code below i only can set 1 icon for the whole row data.
LOOP AT lt_columns ASSIGNING <fs_column>.
    CASE <fs_column>-id.
      WHEN 'ICO'.
        CREATE OBJECT lr_caption.
           lr_caption->set_image_source( value = '~Icon/SuccessMessage').
           <fs_column>-r_column->set_cell_editor( lr_caption ).
    ENDCASE.
  ENDLOOP.
Thank you in advance.
Fernand

Hello,
Yes it is possible to display different images based on data.
For that what you can do is create one attribute 'STATUS' of type string in context node which you are mapping to ALV.
And fill that attribute with the path to image based on your requirement like for status 'S' set the attribute to ~Icon/SuccessMessage and if status is 'E', set it to ~Icon/ErrorMessage at runtime.
Now in the settings for ALV use the following code:
* Display icon in column seatsocc
  DATA: lr_column TYPE REF TO cl_salv_wd_column,
        lr_image TYPE REF TO cl_salv_wd_uie_image,
        lv_icon TYPE string.
  lr_column = lv_model->if_salv_wd_column_settings~get_column( 'SEATSOCC' ).
  CREATE OBJECT lr_image.
  lr_image->SET_SOURCE_FIELDNAME( 'STATUS' ).
  lr_column->set_cell_editor( lr_image ).
in the above code, column 'SEATSOCC' will be displayed as an icon.
Sample code to fill the attribute 'STATUS'
LOOP AT lt_flights INTO ls_flight.
    lv_seatsfree = ls_flight-seatsmax - ls_flight-seatsocc.
    IF lv_seatsfree = 0.
      ls_flight-status = 'ICON_RED_LIGHT'.
    ELSEIF lv_seatsfree <= 50.
      ls_flight-status = 'ICON_YELLOW_LIGHT'.
    ELSE.
      ls_flight-status = 'ICON_GREEN_LIGHT'.
    ENDIF.
    MODIFY lt_flights FROM ls_flight.
  ENDLOOP.
Hope this helps!
Regards,
Srilatha
Edited by: Srilatha M on Jun 25, 2010 12:02 PM

Similar Messages

  • How to display different icon, for different node of jtree

    Hi All,
    How to display different icon, for different node of jtree

    you haven't responded to my last post here: [http://forums.sun.com/thread.jspa?threadID=5323190&messageID=10382676#10382676|http://forums.sun.com/thread.jspa?threadID=5323190&messageID=10382676#10382676]

  • How to set different Icons for Jtreenode

    How to set different Icons for Jtreenode,i want to set icons for jtreenode,not only for leaf,open,closeicon,i hope that each node has a different icon.Thanks!

    you need to check for the node value within a renderer, then assign an icon based on what you expect to get back.
    check out this page. http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

  • How to display an image in an alv grid in each corresponding row?

    Hi,
    please tell me how to  display an image in an alv grid in each corresponding row, like;;
    tony            23   newyork      <image>
    Mkitharyan  63   washington  <image>
    NOT BY HOTSPOTS/URL.

    you can put image in each cell you want:
    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  ).

  • How to set different icons for different windows which is seen in the top left corner?

    Hi
    How to set different icons for different windows which is seen in the top left corner? I know when building exe there is a option to edit icons or add icons and that icon is default for all the windows in the project. But i want different icons for different windows which is possible in VB.
    Is there any way to set icon by calling any dlls.
    Thanks & Regards
    Samuel J
    [email protected]

    Hi Sam,
    no problem. See the attachment.
    Mike
    Attachments:
    TestIcon_LV85.zip ‏44 KB

  • How to display the icons of apk files in windows explorer

    How to display the icons of apk files(android apps) in windows explorer by default in windows 7 and windows 8.1 ?

    Believe it or not; The answer is found by searching the internet.  One solution is to install an application called BlueStacks player which appears to install an Android VM for playing Android apps.  I'm sure there are other solutions, but the
    BlueStacks player looks exactly like mu Moto G screen.  The apps icons are displayed in Windows Explorer with BlueStacks installed.
    http://www.bluestacks.com/app-player.html
    I searched the internet for open apk file on pc
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • How to display different fonts in same indicator in labVIEW

    hi 
       i want to know how to display different fonts in same string indicator at run time in labVIEW 8.2
    Regards
    Abhishek Verma

    Hi ABHI VERMA,
    see this http://digital.ni.com/public.nsf/allkb/6BD344ACA4DEE20A8625692700737E16 
    Mike

  • How can we set icon to a tree table

    Hi ADF Experts,
    The below is regarding skinning of af:tree table component.
    How can we set icon to a tree table
    Below is the af:tree component. When I run the application I see all the parent and child nodes as folder icon. My question is how can set a file icon to the elements present inside a parent node.
      <af:treeTable value="#{pageFlowScope.MerchandizeTreeModel.productTreeModel}"
                                      id="tt1" var="row"
                                      rowSelection="multiple"
                                      horizontalGridVisible="false"
                                      verticalGridVisible="false">
                          <f:facet name="nodeStamp">
                            <af:column sortable="false" headerText=""
                                       rowHeader="true" id="c11" width="200">
                     <af:panelGroupLayout id="pgl0">
       <af:image source="/images/folder.png" shortDesc="foldericon"
                                id="i1"/>
                      <af:outputText value="#{row.groceryItems}" id="ot11"/>
    </af:panelGroupLayout>
                            </af:column>
                          </f:facet>
                        </af:treeTable>
    Thanks in advance,
    Animesh

    Hi Experts,
    I am having a tree table component in adf. I have set a folder image for the parent node. How can we set a document image for contents inside a parent node.
    Thanks,
    Biswa

  • How to Display IMAGE BLOB stored in a table in a html region APEX

    Need to know how to display an image stored in a table in a HTML APEX Region.
    Please

    Hi
    Please explain what you mean by it doesn't work?
    Are there errors messages, at what point, how far did you get and exactly what did you do????
    Please provide more information.
    Thanks
    Ben

  • How to display print icon in alv block display

    hi all,
    in my alv block display i have to display some icons as print, print preview, find, sort,change layout e.t.c
    if any one knows do let me know, if possible send the code.
    i have searched the forum for this query but i could'nt get the answer.

    Hi,
    check the link.
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/how%252bto%252bkeep%252ban%252beye%252bon%252baggregates%252bin%252byour%252bsystem
    Regards
    Rajesh Kumar

  • How to display different Splash Screen depending on the Locale?

    Hi,
    I have a splash screen which is working fine.
    I want to display different spalsh screen depending on the locale the user has.
    Is this possible.
    I can display different Title,Description and the text of the short-cut icon on desktop and startup Menu based on the locale by mentioning it in the JNLP and altering my browser settings. I am not able to use the icon and splash screen corresponding to the specified locale. How to do this?
    EX:
    <information>
    <title> In english</title>
    <description> In english</description>
    <shortcut online="true">
    <!-- create desktop shortcut -->
    <desktop/>
    <menu submenu="My Project in English language"/>
    </shortcut>
    *<icon kind="shortcut" href="images/icon_english.gif"/>
    <icon kind="splash" href="images/splash_english.jpg"/>*
    <!-- locale="nl-NL" specifies dutch -->
    </information>
    <information locale="nl-NL">
    <title> In Dutch</title>
    <description>In Dutch</description>
    <shortcut online="true">
    <!-- create desktop shortcut -->
    <desktop/>
    <menu submenu="My Project in Dutch language"/>
    </shortcut>
    *<icon kind="shortcut" href="images/icon_dutch.gif"/>
    <icon kind="splash" href="images/splash_dutch.jpg"/>*
    </information>
    *Now here i am not getting the splash_dutch screen for the locale "nl-NL"(Dutch) and i am getting splash_english screen.
    Can we acheive this?*

    Hi anjali...
    I have problem with splash screen..
    here is my jnlp file
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/MyProject">
         <information>
              <title>MyProject1.0</title>
              <vendor>none</vendor>
              <description>Application Launcher For MyProject1.0</description>
              <description kind="short"></description>
              <offline-allowed />
              <icon kind="splash" href="images/Splash_MyProject.jpg" width="560" height="300"/>
         </information>
         <resources>
              <jar href="SwingApplication/mysql-connector-java-5.0.6-bin.jar" />
              <jar href="SwingApplication/MyProject1.0.jar" main="true"/>
              <jar href="SwingApplication/liquidlnf.jar" />
              <j2se version="1.6+" java-vm-args="-Xms32M -Xmx256M " />
         </resources>
         <security>
              <all-permissions/>
         </security>
         <application-desc main-class="com.mobius.ui.MainWindow">
              <argument>production%0%3#com.mysql.jdbc.Driver#MyProject4%jdbc:mysql://10.100.1.89:3306/MyProject4%MyProject%info123#MyProject2%jdbc:mysql://10.100.1.89:3306/MyProject2%MyProject%info123</argument>
         </application-desc>
    </jnlp>my post is in
    http://forum.java.sun.com/thread.jspa?threadID=5298381
    http://forum.java.sun.com/thread.jspa?threadID=5298466
    I am in big problem Help me...
    Edited by: arunnprakash on May 22, 2008 1:28 PM
    Edited by: arunnprakash on May 22, 2008 1:28 PM

  • How to Use different icons for JTree in the same level

    Hi guys, i come cross a problem with JTree. The module need a JTree which need to represent items in the same level using different icons. For example:
    [Icon for Root]Root
    |
    |_____________[Icon for Table] TABLES
    |
    |_____________[Icon for Index] INDEXS
    |
    |_____________[Icon for Views] VIEWS
    As i know, the default behavior for JTree is using the same icon for all leaves and
    the same icon for all node that has children. How can i achieve that?
    Thansk a lot!

    subclass DefaultTreeCellRenderer. if you overwrite the method below, then you can set the icon to whatever you want....!
        public Component getTreeCellRendererComponent(JTree tree, Object value,
                                    boolean sel,
                                    boolean expanded,
                                    boolean leaf, int row,
                                    boolean hasFocus) {
         String         stringValue = tree.convertValueToText(value, sel,
                               expanded, leaf, row, hasFocus);
            this.tree = tree;
         this.hasFocus = hasFocus;
         setText(stringValue);
         if(sel)
             setForeground(getTextSelectionColor());
         else
             setForeground(getTextNonSelectionColor());
         // There needs to be a way to specify disabled icons.
         if (!tree.isEnabled()) {
             setEnabled(false);
             if (leaf) {
              setDisabledIcon(getLeafIcon());
             } else if (expanded) {
              setDisabledIcon(getOpenIcon());
             } else {
              setDisabledIcon(getClosedIcon());
         else {
             setEnabled(true);
             if (leaf) {
              setIcon(getLeafIcon());
             } else if (expanded) {
              setIcon(getOpenIcon());
             } else {
              setIcon(getClosedIcon());
            setComponentOrientation(tree.getComponentOrientation());
         selected = sel;
         return this;
        }

  • How to display different Time Statement forms in ITS service PZ04

    Hi all,
    I am working on a underlyinge R/3 4.7 system and are working with standalone ITS and ESS 50.4. I am posting this question to find out if any of you has experience with my problem.
    The business wishes to use the ITS transation PZ04 standard and wish to be able to display different Time Statement forms in the transaction through customized variants for the report(RPTEDT00) that the PZ04 transaction executes. In the IMG it is posted that one variant has to be created called HRESS_TEDT00 and this works, but restricts the PZ04 transaction to always be called with this variant and therebye the same Time Statement form every time.
    I then by debugging found that the underlying ABAP code processed from SAP standard has a variable VARIANT that is hardcode to = HRESS_TEDT00.
    The question is: Is there anyway to setup the PZ04 transaction so that it can be dynamic decided which variant should be used, f.ex. from persons subarea from infotype 0001?
    Looking forward to here if anybody can help.
    Regards,
    Allan Brauer

    hi allan,
    cud u plz help me how to sort out this problem actually in mu company the same scenario is here need to be display pe51 form instead of standard hrforms.....
    plz help me how will i replace this "hrforms with pe51"..

  • JTable : How to display an icon near the column name ?

    Hi all,
    I'd like to display an icon near the column name of my JTable when an user click on the column; the icon specify the sorting applied to the data of JTable.
    I know that i have to write a render, but how ?
    Cheers.
    Stefano

    Hi all,
    I found the solution at http://exampledepot.com/egs/javax.swing.table/IconHead.html
    Cheers anyway.
    Stefano

  • How to display the icon as folder in tree table representation

    Hi,
    I am displaying the hierarchical structure for one table in which the expanding comes like normal ">". But i want to make it like folder icon.How is it possible plz suggest me.
    Thanks,
    Harsh

    The folder icons are added in the node stamp of the tree table.
    <f:facet name="nodeStamp">
      <af:column headerText="Directory Name" width="200" sortable="true" rowHeader="unstyled"
      sortProperty="name" id="c2">
      <af:panelGroupLayout id="pgl2">
      <af:image source="#{directory.icon}" id="nodeIcon"
      inlineStyle="margin-right:3px; vertical-align:middle; height:16px; width:16px;"
      shortDesc="directory"/>
      <af:outputText id="directoryStamp" inlineStyle="vertical-align:middle" value="#{directory.name}"/>
      </af:panelGroupLayout>
      </af:column>
      </f:facet>
    You can see the full source if you click the 'view source' link in the menu bar of the demo.
    Timo

Maybe you are looking for