Skip to Content
avatar image
Former Member

How to upload images on WebDynpro(ABAP) screens

Hello All,

Could any one please help on how to create/change the image (jpeg/any file) dynamically on WebDynpro screen. I have seen couple of examples for uploading the text files in WDR_TEST_EVENTS, WDR_TEST_WEB_ICONS, but not found any standard program that explains about uploading images.

Requirement: User has to select any image/thumbnail from local PC and it should be displayed on main screen, it's not only from MIME directory.

We have the same logic in BSP Application (CFX_RFC_UI) to upload the thumbnail but am not sure whether we can use the same logic in WDC or not?

I have seen the same logic for WebDynpro (JAVA) here:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71

I would really appreciate if you could provide me the code/process ASAP.

Thanks & Regards,

Hari.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 20, 2007 at 12:53 AM

    You still have to use the File_Upload UI element. This element has a property MimeType. Find out the MimeType for a Image and bind a attribute of this value to the MimeType attribute.

    I think uploading a image is smae as uploading any other file using File_Upload UI element. Only thing is you have to specify the MimeType for Images.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 01:21 AM

    Hi,

    Use FileUpload, give the MimeType as GIF or JPEG. You will get the image as XSTRING, in the attribute of the Node, the data property of FIleUpload is bound to....

    You then have to convert XTRING back to image... I foulf following sample code...

    try it....

    graphic_table is the table with field XSTRING and contains the Image uploaded in XSTRING format

    DATA:h_picture TYPE REF TO cl_gui_picture,

    h_pic_container TYPE REF TO cl_gui_custom_container.

    DATA: graphic_url(255),

    graphic_refresh(1),

    g_result LIKE cntl_true.

    DATA: BEGIN OF graphic_table OCCURS 0,

    line(255) TYPE x,

    END OF graphic_table.

    DATA: graphic_size TYPE i.

    CALL FUNCTION 'DP_CREATE_URL'

    EXPORTING

    type = 'image'

    subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'

    size = graphic_size

    lifetime = cndp_lifetime_transaction "'T'

    TABLES

    data = graphic_table

    CHANGING

    url = graphic_url.

    CREATE OBJECT h_pic_container

    EXPORTING container_name = 'LOGO'.

    CREATE OBJECT h_picture EXPORTING parent = h_pic_container.

    CALL METHOD h_picture->load_picture_from_url

    EXPORTING

    url = graphic_url

    IMPORTING

    RESULT = g_result.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 01:55 AM

    I meet the same as problem with you. I ask some expert from SAP. They tell me to give up this thinking. You put the files into the server file system so that the server file system isn't assurance the file to be safe. So I have to change my idear. I put the file to the mime type repository to display it in the main page.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 03:57 PM

    follow-up.

    Add comment
    10|10000 characters needed characters exceeded