‎2008 Aug 04 8:32 AM
Hi Experts,
I have an image stored in application server for eg d:\test.gif.
My requirement is to display the image from this path into a container in screen programming.
How can i achieve it. Kindly help.
I tried using load_picture_from_url method of class cl_gui_picture, its not working.
If i try to display an image from presentation server using this class and method its working fine. But my requirement is to display it form application server.
Help me on this.
Thanks and Regards
Naveen
‎2008 Aug 04 2:14 PM
Hi
To Download a File from Application Server
use the folloeing code
OPEN DATASET <filename>
FOR INPUT/OUTPUT/APPEND
IN TEXTMODE
ENCODING DEFAULT.
READ DATASET <filename> INTO <workarea>
CLOSE DATASET <filename>.
Cheers
Vikas C
‎2008 Aug 04 2:49 PM
First download the image to presentation server from application server and then Load the Image using your approach with the classes you mentioned.
‎2008 Aug 04 3:16 PM
Hi Naveen,
If the image that you are displaying is lying outside of the ABAP Application Server, you can use the above mentioned method. (load_picture_from_url).
But if the same document is lying in ABAP Application Server, then you can use the BDS ( Business Document Server ) to manage data. This is a new tool. Below is the link and sample demo code which will give you a good overview of the same.
PDF of the Business Document Server
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVBDS/BDS_STRUCTURE.pdf
Sample code of the BDS Implementation
http://www.sappro.com/download03.cfm?session=
The first link is place which will give u the sample code.
Thanks,
Samantak.
‎2008 Aug 05 3:52 PM
Hi Naveen,
Below is the code base which is used to upload a picture from the SAP Application Server.
TYPES pict_line TYPE x LENGTH 1022.
DATA l_mime_api TYPE REF TO if_mr_api.
DATA l_pict_wa TYPE xstring.
DATA l_pict_tab TYPE TABLE OF pict_line.
DATA l_length TYPE i.
DATA l_url TYPE c LENGTH 255.
l_mime_api = cl_mime_repository_api=>get_api( ).
l_mime_api->get(
EXPORTING i_url = '/SAP/PUBLIC/BC/ABAP/Sources/PLANE.GIF'
IMPORTING e_content = l_pict_wa
EXCEPTIONS OTHERS = 4 ).
IF sy-subrc <> 0.
RETURN.
ENDIF.
l_length = XSTRLEN( l_pict_wa ).
WHILE l_length >= 1022.
APPEND l_pict_wa(1022) TO l_pict_tab.
SHIFT l_pict_wa BY 1022 PLACES LEFT IN BYTE MODE.
l_length = XSTRLEN( l_pict_wa ).
ENDWHILE.
IF l_length > 0.
APPEND l_pict_wa TO l_pict_tab.
ENDIF.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGE'
subtype = 'GIF'
TABLES
data = l_pict_tab
CHANGING
url = l_url.
picture->load_picture_from_url(
EXPORTING url = l_url ).
picture->set_display_mode(
EXPORTING display_mode = picture->display_mode_stretch ).
The Entire code is available in the program DEMO_CFW.
Thanks,
Samantak.