Skip to Content
0
Former Member
Jul 01, 2009 at 11:03 AM

uploading and displaying image

63 Views

Hi Experts,

I am very new to web dynpro ABAP. I am trying to learn how to upload image and display that image in the same page.

I searched in SDN threads, and find this steps to upload and displaying in a web page.

*********

You can use fileUpload and file download Uielements

Follow these steps:

1. Create a node 'FILEUPLOAD' with 2 attributes

a) FILECONTENT type XSTRING

b) FILENAME type STRING

2. create a node 'FILEDOWNLOAD' with 1 attribute

a) DOWNLOAD type XSTRING

3. Goto the layout tab

a) Place a fileupload uielement and a button next to it for uploading the image

b) Bind the Data property with the attribute 'FILECONTENT' and filename property with the attribute 'FILENAME'

c) Place a filedownload uielement on the layout

d) Bind the data property of thr filedownload uielement with the attribute 'DOWNLOAD'

4.Create create an action for the button, the Event 'onAction'.

5. In this method write the following code to read the content and set the download attribute

data: l_node type ref to if_wd_context_node.

data: l_content type xstring.

l_node = wd_context->get_child_node( ' FILEUPLOAD' ).

l_node->get_attribute( exporting name = 'FILECONTENT'

importing value = l_content ). " l_content will be your image in xstring format

data: l_node1 type ref to if_wd_context_node.

l_node1->wd_context->get_child_node( ' FILEDOWNLOAD' ).

l_node1->set_attribute( exporting name = 'DOWNLOAD'

value = l_content ) . " retrieved frm above

*************

I followed above steps , But am getting empty page while deploying.

I didn't import image into MIME objects.

Can anyone Help me.

Thanks in Advance!

Regards,

Sreelakshmi.

Edited by: sreelakshmi.B on Jul 1, 2009 4:34 PM