Skip to Content
avatar image
Former Member

Load and Display Multiple Images in a Web Dynpro Table

I am new to Web Dynpro and I am wondering if anyone can help me with an application that I am currently developing. I have a particular requirement to store images in a database table (not MIME repository) and then display them in a WD table element. An image can be of JPEG, PNG or TIFF format and is associated with an employee record.

I want to create a view in my application that displays multiple images in a table, one image per row. I want to do this using Web Dynpro for ABAP, not Java. I have looked into pretty much all examples available for Web Dynpro and came to the conclusion that Components such as WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS do not have any examples of images being stored in a database table and viewed in/from a Web Dynpro table element. Programs such as RSDEMO_PICTURE_CONTROL, DEMO_PICTURE_CONTROL and SAP_PICTURE_DEMO do not show this either.

The images to be displayed in the Dynpro table are to come from a z-type table, stored in a column of data type XSTRING (RAW STRING). So I would also like to know how to upload these images into this z-type table using ABAP code (not Java).

Your help would be greatly appreciated.

Kenn

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 27, 2009 at 08:22 PM
    10

    Hi Radhika,

    My apologies for "hijacking" this thread but I have the same problem as Ken. I have used your suggestions in this and previous posts and I can upload an image into my db table and then show it using the link in the filedownload component. However, my requirement is the same as Ken's I believe - I need to be able to show that image in the wd table w/o having the user to click on the link and showing that image in a separate page or section.

    Essentially, I want an image to be just another column in the wd table or alv and is visible immediately after image data (rawstring or xstring in context) is retrieved from the database table and bound to wd table in my application.

    Is this possible and if it is then how it's achieved?

    Best regards,

    Dino

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Dino,

      I have the similar requirement to upload and download the images .Can you please tell me how did you work out and can you tell how you done this with step by step procedure with Nodes/Attributes and if possible please send me the code too..

      Thanks in advance....

      Satish

  • avatar image
    Former Member
    Jul 16, 2009 at 04:13 PM

    Hi,

    You should use fileUpload and filedownload uielement.

    Firstly file upload

    1. Create a node FILEUPLOAD with 2 attributes filename type string and filecontent type XSTRING

    2. Place a fileupload uielement ib your view.

    3. Bind the Data property with filecontent attribute and filename property with filename attribute

    4. Create a button next to the fileupload uielement. Create OnAction method for this button.

    In this method place, read the content of the uploaded file and save it in your custom database table, use the following code,

    Data: l_node type ref to if_wd_context_node.
    
    l_node = wd_Context->get_child_node( 'FILEDOWNLOAD' ). " your node name
    l_node->get_static_attributes( importig static_attributes = ls_stru ). 
    " ls_stru-filecontent will have your image in XSTRING Format. Just save this in your custom table usig INSERT/MODFIY statements

    Now FileDownload Part,

    1. Under your node that is bound to the table, create an attribute CONTENT type XSTRING and NAME type STRING.

    2. Create a column in the table with cell editor as FILEDOWNLOAD.

    3. Bind the data property with the attribute CONTENT and text property with the attribute NAME.

    4. On in your Action method for Attach, fetch data from your custom table and pass it to the node using bind_table.

    Hope this helps!

    Regards,

    Radhika.

    Add comment
    10|10000 characters needed characters exceeded