WD4A : Displaying images in ALV table

Hi,
Does anyone know how to display images in ALV tables in Webdynpro?

Hello,
You can define an attribute in the context with the type CHAR 30 and define it value like an icon from WDA (like ~Icon/GreenLed). And then you need to create an method to define the attributes of the column that will have the image like follows:
METHOD display_alv .
  DATA: lr_alv_usage       TYPE REF TO   if_wd_component_usage,
        lr_config          TYPE REF TO   cl_salv_wd_config_table,
        lr_col_header      TYPE REF TO   cl_salv_wd_column_header,
        lr_function_wd     TYPE REF TO   cl_salv_wd_function,
        lr_button          TYPE REF TO   cl_salv_wd_fe_button,
        lr_image           TYPE REF TO   cl_salv_wd_uie_image,
        lr_header          TYPE REF TO   cl_salv_wd_header,
        lr_uie_link        TYPE REF TO   cl_salv_wd_uie_link_to_action,
        lr_if_controller   TYPE REF TO   iwci_salv_wd_table,
        lr_function_set    TYPE REF TO   if_salv_wd_function_settings,
        lr_table_settings  TYPE REF TO   if_salv_wd_table_settings,
        lr_column_settings TYPE REF TO   if_salv_wd_column_settings.
  DATA: lt_columns         TYPE          salv_wd_t_column_ref,
        ls_column          TYPE          salv_wd_s_column_ref,
        lv_text            TYPE          string.
* Instantiate ALV Component
  lr_alv_usage = wd_this->wd_cpuse_all_alv( ).
  IF lr_alv_usage->has_active_component( ) IS INITIAL.
    lr_alv_usage->create_component( ).
  ENDIF.
* get reference to model
  lr_if_controller = wd_this->wd_cpifc_all_alv( ).
  lr_config        = lr_if_controller->get_model( ).
* modify visible rows
  lr_config->if_salv_wd_table_settings~set_visible_row_count( iv_rows ).
  lr_config->if_salv_wd_table_settings~set_selection_mode(
                                       wd_assist->co_alv_selmode ).
* create function
  lr_function_set ?= lr_config.
  lr_function_wd = lr_function_set->create_function(
                   wd_assist->co_func_det_nfe ).
  CREATE OBJECT lr_button.
*read text
  lv_text = wd_assist->read_text( iv_key = '002' ).
  lr_button->set_text( lv_text ).
  lv_text = wd_assist->read_text( iv_key = '001' ).
  lr_button->set_tooltip( lv_text ).
  lr_button->set_image_source( wd_assist->co_icon_seldet ).
  lr_function_wd->set_editor( lr_button ).
* set table header
  lr_table_settings ?= lr_config.
  lr_header = lr_table_settings->get_header( ).
  lv_text = wd_assist->read_text( iv_key = '003' ).
  lr_header->set_text( lv_text ).
  lv_text = wd_assist->read_text( iv_key = '004' ).
  lr_header->set_tooltip( lv_text ).
  lr_header->set_image_source( wd_assist->co_icon_list ).
  lr_column_settings ?= lr_config.
  lt_columns = lr_column_settings->get_columns( ).
  LOOP AT lt_columns INTO ls_column.
    CASE ls_column-id.
      WHEN 'ICON'.
        CREATE OBJECT lr_image.
        lr_image->set_source_fieldname( ls_column-id ).
        lr_image->set_tooltip_fieldname( 'ICON_TOOLTIP' ).
        ls_column-r_column->set_cell_editor( lr_image ).
      WHEN 'ID'.
        CREATE OBJECT lr_uie_link.
        lr_uie_link->set_text_fieldname( ls_column-id ).
        ls_column-r_column->set_cell_editor( lr_uie_link ).
      WHEN 'ICON_TOOLTIP' or 'LOGSYS'.
        ls_column-r_column->set_visible(
                           cl_wd_uielement=>e_visible-none ).
    ENDCASE.
*set header binding of medium description, otherwise title
    lr_col_header = ls_column-r_column->get_header( ).
    lr_col_header->set_ddic_binding_field(
                        if_salv_wd_c_column_settings=>ddic_bind_medium ).
  ENDLOOP.
ENDMETHOD.
Here will be showed an icon (column ICON) and an link (column ID).
Regards,

Similar Messages

  • How to display images in a table column?

    Hi,
    In a VC model, I have to display images in a table column for each record found.
    How can this be done?
    Regards,
    Nitin

    Hi Nitin,
    It can be done by adding to the table the Image control (can be found under Advanced Controls in the Compose panel).
    In the URL property (in the Configure panel of the Image control) you can define any expression that will return the image URL. For example:
    ="http://hosting.site.url/"&@ImageNameField
    Regards,
    Udi
    Edited by: Udi Cohen on Jun 11, 2008 1:39 PM

  • Displaying images in ADF Table

    I have a column in table of type blob. I created entity and view against it. In view type of attribute is blobdomain (by default). Now when i drop that view on form to create table, it places control inputText for blob. I want to ask how i can display images in ADF table column?

    Check this post:
    Re: multi-row block with many image-java-beans
    How to display the content of a BLOB column in a ADF/BC pages ?
    and this might be helpful too:
    http://www.pascalalma.net/2008/04/22/oracle-adf-medior-rendering-images-based-on-blob-columns/
    Regards,
    ~Krithika

  • Displaying image from database table.

    Hi All,
       I am very new to Web Dynpro ABAP.
      I am developing an application to display an image in "Image" UI Element.
      For this I have one table consisting of fields image id, image data and image name. here image id is primary key field.
    Now i want to display an image from that table in "Image" UI Element. For this i am using "Filedown load" UI element.
    But by using filedownload ui element i can diaplay image in another new page.
    But my requirement is to display image in the same web page without creating a new one.
    (I want to display the image in "Image" UI element without storing that image in MIME objects.)
    Can anyone help me.
    Thanks in Advance!
    Regards,
    Sreelakshmi.

    What you describe is completely possible.  Since you have the image data (XSTRING) in the context you have everything you need.  You don't need to store the content into the MIME Repository, but you do need to get it somewhere where it has an externally accessible URL.  Remember you need to supply image UI element with a URL.  This URL is processed on the client side by the web browser.  Therefore just giving it a path to the context won't work as that isn't externally accessible.
    I would suggest instead that you place the image content into the ICM cache temporarily.  This lets you basically generate a temporary URL for the image that can be used by the Image UI element. 
    Here is some example code that pushes images into the ICM Cache:
    ****Create the cached response object that we will insert our content into
      DATA: cached_response TYPE REF TO if_http_response.
      CREATE OBJECT cached_response
        TYPE
          cl_http_response
        EXPORTING
          add_c_msg        = 1.
       try. " ignore, if compression can not be switched on
          call method cached_response->set_compression
            exporting
              options = cached_response->co_compress_based_on_mime_type
            exceptions
              others  = 1.
        catch cx_root.
      endtry.
    ****set the data and the headers
      DATA: l_app_type TYPE string.
      DATA: l_xstring TYPE xstring.
          cached_response->set_data( me->gx_content ).
          l_app_type = me->gx_mimetype
      cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                         value = l_app_type ).
    ****Set the Response Status
      cached_response->set_status( code = 200 reason = 'OK' ).
    ****Set the Cache Timeout - 60 seconds - we only need this in the cache
    ****long enough to build the page and allow the Image on the Client to request it.
      cached_response->server_cache_expire_rel( expires_rel = I_CACHE_TIMEOUT ).
    ****Create a unique URL for the object
      DATA: guid TYPE guid_32.
      CALL FUNCTION 'GUID_CREATE'
        IMPORTING
          ev_guid_32 = guid.
      CONCATENATE i_path '/' guid '.' i_format INTO r_url.
    ****Cache the URL
      cl_http_server=>server_cache_upload( url      = r_url
                                           response = cached_response ).

  • Display Images from  HTMLDB_APPLICATION_FILES Table?

    How do I display images from the HTMLDB_APPLICATION_FILES Table?
    Are the contents full available potentially for display? Or only after I have written them to another display?
    Please advise what I need to do or what corrections below is required:
    The calling procedure is a item in a SELECT statement as part of a report query:
    <P>
    <(img src="#OWNER#.download_HAF_file?p_file=  ' || nvl(ID,0) || ' height="50" width="50" )>, HAFimg<P>
    The Procedure is a adaptation of the Chapter 8 Exercise of the 2 day developer guide:
    CREATE OR REPLACE PROCEDURE "DOWNLOAD_HAF_FILE" (p_file IN NUMBER) AS
         v_mime VARCHAR2(48);
         v_length NUMBER;
         v_file_name VARCHAR2(2000);
         Lob_loc BLOB;
    BEGIN
         SELECT MIME_TYPE, BLOB_CONTENT, NAME, DBMS_LOB.GETLENGTH(BLOB_CONTENT)
         INTO v_mime, lob_loc, v_file_name, v_length
         FROM HTMLDB_APPLICATION_FILES
         WHERE ID = p_file;
         -- set up HTTP header
         -- use an NVL around the mime type and
         -- if it is a null set it to application/octect
         -- application/octect may launch a download window from windows
         owa_util.mime_header( NVL(v_mime,'application/octet'), FALSE );
         -- set the size so the browser knows how much to download
         htp.p('Content-length: ' || v_length);
         -- the filename will be used by the browser if the users does a save as
         htp.p('Content-Disposition: attachment; filename="'||SUBSTR(v_file_name,INSTR(v_file_name,'/')+1)|| '"');
         -- close the headers
         owa_util.http_header_close;
         -- download the BLOB
         wpg_docload.download_file( Lob_loc );
    END Download_HAF_File;
    /Message was edited by:
    luddite1812

    I believe you put HTML "pre" tags around your quote (with square brackets, I can't type them here because they'll be escaped).
    If the example below looks formatted then using "pre" works, if not...then ignore me ;)
    begin
      select
        count(*)
      into
        v_count
      from big_table;
    end;

  • To Display Image in Alv Grid....

    Hello Gurus,
    I want to display an image/icon ( custom icon ) in the ALV grid.
    I know to display standard icons in ALV. But i dont know how to store custom icons in the system.
    I want to display an icon or image depending upon certain conditions. i need to display these images/icons for each row of the ALV grid.
    Please let me know if i can show images or icons ( not standard ) for each row in ALV grid.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 25, 2008 10:20 AM

    check out CL_GUI_PICTURE and the demo programs
    SAP_PICTURE_DEMO
    SAP_PICTURE_DEMO_ICON
    RSDEMO_PICTURE_CONTROL
    you can fit the picture in to the control with the following modes.
    DISPLAY_MODE_FIT
    other options
    DISPLAY_MODE_NORMAL
    DISPLAY_MODE_STRETCH
    DISPLAY_MODE_NORMAL_CENTER
    DISPLAY_MODE_FIT_CENTER
    Regards
    Raja

  • How to display images in a table

    Hi all,
        I have to display five different images in five rows of a table.For this purpose i am trying to create a node element with value attribute.How can i set an image to the
    node.If it is possible to set an image to the node then i can bind it dynamically to the table.Is it correct way?
    Otherwise give me guidance to solve this problem.
    Thanks&Regards
        Satyam

    Designtime:
    Context:
    Value node "Rows" (cardinality 0:N)
    Attribute "ImageURL": string
    UI elements:
    Table.dataSource = "Rows".
    TableColumn, table cell editor = Image
    Image.source = "Rows.ImageURL"
    Runtime:
    for (int i = 0; i < 5; ++i)
      IRowsElement row = wdContext.nodeRows().createRowsElement();
      wdContext.nodeRows().addElement(row);
      row.setImageURL(<URL of image at index i>);
    If you put the image files inside folder src/mimes/components/<name-of-component>, you can use the filename as URL.
    Armin

  • Buffer displayed records for ALV Table

    Dear Experts,
    when showing large tables (whide structures, many records) I'm facing the issue of reloading times, when a user scrolls down the ALV. I guess this relates to rebuffering the records from the AppServer to the GUI. Is there any way on setting up how many records are loaded initially?
    Thanks a lot in advance,
    Peter

    what is the actual problem ... you might thing that it is feature not a bug.
    The ALV sends only some records to the frontend and reloads others when they are really needed to be displayed.
    What would you like to change?
    Maybe your problem is only a bad sort! Try to sort in a way that the most interesting records come with the initial load. Or try to select better in way that your result is smaller. These are simple examples, but maybe it can guide you in the direction to a proper solution.
    Siegfried

  • Display Image in ALV

    Hi Gurus,
      Am developing ALV report using OOPS. In that i have to insert company logo. By using the below code it is coming good
    CREATE OBJECT CONTAINER
         EXPORTING
          CONTAINER_NAME = 'PICTURE'.
       CREATE OBJECT PIC
         EXPORTING
          PARENT = CONTAINER.
       CALL METHOD pic->set_display_mode
         EXPORTING
           display_mode = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER
        EXCEPTIONS
          ERROR        = 1
          others       = 2
    CALL METHOD pic->load_picture_from_url
      EXPORTING
        url    = 'file://D:\kk.GIF'
    IMPORTING
       RESULT =
    EXCEPTIONS
       ERROR  = 1
       others = 2
    But here am hardcoding the url of the logo. Instead of that upload the image into SAP and how to insert that logo in that screen? Can anyone give me suggestions regarding this.
    Points will be awarded
    Thanks
    Ravi

    Hi
    In the transaction OAOR, you should be able to insert your company Logo.
    GOTO - OAOR (Business Document Navigator)
    Give Class Name - PICTURES Class Type - OT..... then Execute
    It will show you the list, then select ENJOYSAP_LOGO.
    On that list, you will find one control with a "create" tab.
    Click std. doc types.
    Select SCREEN and double-click.
    It will push FILE selection screen.
    Select your company logo (.gif) and press OK.
    It will ask for a description- for instance: "company logo".
    It will let you know your doc has been stored successfully.
    You can find your logo under ENJOYSAP_LOGO->Screen->company logo.
    Just run your ALV program, you should find your company logo in place of the EnjoySAP logo.
    FORM TOP-OF-PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = HEADING[]
    I_LOGO = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID ='GT_LIST_TOP_OF_PAGE'.
    ENDFORM. "TOP-OF-PAGE
    Here 'ENJOYSAP_LOGO' will replace by ur created logo.
    Refer this link
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm
    http://www.sap-img.com/abap/alv-logo.htm
    http://www.sap-img.com/fu002.htm
    Re: Logo on Login screen
    Re: To change image into main menu of sap
    Reward points for useful Answers
    Regards
    Anji

  • Image in ALV table

    Hello All,
    I have a AVL table with some data in it, but one of the columns of the AVL table I want to put an image.
    Is that possible?
    How do I do that?
    Thanks & Regards,
    Chris Bogers

    Hi,
    It is possible to insert image.
    Refer the code below :
    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 = l_value->if_salv_wd_column_settings~get_column( 'STATUS' ).
    CREATE OBJECT lr_image.
    lr_image->SET_SOURCE_FIELDNAME( 'STATUS' ).
    lr_column->set_cell_editor( lr_image ).

  • Refer to MIME image in ALV Table

    Hello All,
    I know now how to refer to an image in the AVL Table.
    But I want to refer to the MIME image.
    The filename is not enough?
    Anyone an idea?
    Thanks & Regards,
    Chris Bogers

    Hi,
    1. Here you have to mention the URL where your mime objects are stored.
    data: mime_repository type ref to if_mr_api,
          content type xstring,
          mime_type type string,
          url type string value 'SAP/BC/WebDynpro/SAP/ZTREE/s.bmp'.
    mime_repository = cl_mime_repository_api=>get_api( ).
    call method mime_repository->get
    exporting i_url = url
    importing e_content = content  e_mime_type = mime_type.
    2. Finally you have the value in an XString which you can bind to the context attribute.
    DATA lo_el_context TYPE REF TO if_wd_context_element.
      DATA ls_context TYPE wd_this->element_context.
    * get element via lead selection
      lo_el_context = wd_context->get_element( ).
    * set single attribute
      lo_el_context->set_attribute(
        name =  `CONTENT`
        value = content ).
    Note : CONTENT is my context attribute binded to image UI.

  • How to display image on alv display screen

    Hi All,
    I am using "REUSE_ALV_GRID_DISPLAY" function module for display a simple report.
    I want to add a logo also on that output screen. Can anyone tell me how i can do that?
    Thanks and Regards,
    Nidhi Srivastava.

    Yes.
    But you have to paint the image after the native component has painted the text, to avoid the native component from erasing your image. Something like this should work.
    class MyTextField extends TextField implements Runnable
       public void paint(Graphics g)
          super.paint(g);
          new Thread(this).start();
       public void run()
          Thread.yield();
          Graphics g = getGraphics();
          g.drawImage(....)

  • Crystal Reports Image box does not display images.

    Post Author: xbhavesh
    CA Forum: .NET
    i have CR report which has a Imagebox to display images from db table. i am storing the images in a table as path. in my dev machine when i load the .aspx page with the crystal report it shows the image in the box but when i run it from the web server the image does not show.
    even from the .rpt file i get the image and all data.
    anyone know how can i get this working?
    the images are stored in a mapped network drive and the version of cr is XI R2.

    Please post to Business One forum

  • Image in a Table

    Hi,
    I have a requirement in which I have to display a text and a imgae in single table coloumn, row.
    My image is coming from a image server as a URL.
    When I am trying to concatinate the 2 (text and image), the column is displaying the URL of the image and not the image.
    Has any one come across such problem, please help.
    Regards,
    Pranay

    hi
    in addition to above context
    check this
    how to display images in a table
    http://help.sap.com/saphelp_nw04s/helpdata/en/5d/ad884118aa1709e10000000a155106/frameset.htm
    bvr

  • How can I change column name in ALV table in WebDynpro ABAP?

    Hi Everyone,
    I have created an ALV table in WebDynpro ABAP. I have created a context node and added the required attributes there - for the ALV display.
    Now I want to change one columnn name of the ALV table.... Currently it is showing the description of the data element, which I don't want to show. I cannot create a new DE only for this purpose.
    Please let me know how can I change the name of the column.
    Regards

    Hi,
    This may help you to define your own column text in the ALV Table of webdynpro.
    see the below code.
    Here 'STATUS_ICON' is the column of the the output display of the ALV Table of webdynpro.
    "change the label of the report.
    DATA: lr_weeknum TYPE REF TO cl_salv_wd_column.
    CALL METHOD l_value->if_salv_wd_column_settings~get_column
    EXPORTING
    id = 'STATUS_ICON'
    RECEIVING
    value = lr_weeknum.
    SET THE LABEL OF THE COLUMN
    DATA: hr_weeknum TYPE REF TO cl_salv_wd_column_header.
    CALL METHOD lr_weeknum->get_header
    RECEIVING
    value = hr_weeknum.
    CALL METHOD lr_weeknum->set_resizable
    EXPORTING
    value = abap_false.
    hr_weeknum->set_prop_ddic_binding_field(
    property = if_salv_wd_c_ddic_binding=>bind_prop_text
    value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
    set the text of the column
    CALL METHOD hr_weeknum->set_text
    EXPORTING
    value = 'C Form'.
    regarads,
    balu

Maybe you are looking for

  • CS4 project easily fit on disk and now doesn't, but no changes   ??

    Greetings, I'm sort of new to Encore so I apologize in advance if this is stupid. I built a project that easily fit on a DVD, using abougt 3.3 gb, and I was successful at creating disks using both the DVD Folder and ISO Image method. Nothing at all h

  • Spry Horizontal Menus - strage background in non-submenu button

    Hi All, The page I am refering to is posted to: http://visionbyamit.com/avital/index2.html As you will see, there are two typs of buttons in this horizontal menu bar; ones with a dropdown submenu and ones without. The problem here is: that the button

  • How to export PDF from email to adobe reader on iPad

    I received PDF file in email that I'm opening on my iPad. Opened into Safari browser. Now how do I export or import into my documents folder in installed adobe reader on my iPad?

  • Regading SE06 and SCC4 central monitoring

    Hi Guru's, We have multiple production systems (say 5) , is there any way to run scan these systems to find any of these systems are open for changes thru SE06 and SCC4 or any est known methods to do or any solution thru solution manager? Vinay Edite

  • All Business Partners via JCo

    Hello @all, I´m testing some things with the Business One Java Connector. At the moment I try to get a list of all Business Partners. But I can´t find a class or method I can use for. Can anyone help me? Thanks a lot.