cancel
Showing results for 
Search instead for 
Did you mean: 

Employee Photo Display

0 Kudos

Hi SDN Gurus,

I want to display employee photo in my custom webdynpro abap application. Im using Document Area as blank, Storage type as SAP System Database and Rep. Sub-Type as Normal and Content Table is SDOKCONT1 in tcode OAC0.

I have written a FM to output the photo from table SDOKCONT1 which is of data type LRAW.

though im not able to get the image in Webdynpro component.

Are there any alternate ways or work arounds for this? Please help as i just want to display employee photo in my webdynpro application anyhow.

Appreciate your help.

Regards,

Vinayak

Edited by: vinayak landge on Mar 28, 2011 3:27 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

HAve a look at this wiki.

[http://wiki.sdn.sap.com/wiki/display/WDABAP/DisplayEmployeeImageinABAPWebDynproApplication|http://wiki.sdn.sap.com/wiki/display/WDABAP/DisplayEmployeeImageinABAPWebDynproApplication]

abhimanyu_lagishetti7
Active Contributor
0 Kudos

DATA:gx_mimetype TYPE string VALUE 'JPG'.

data lv_url type string.

****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,

i_cache_timeout TYPE i VALUE '300'.

cached_response->set_data( lv_raw ).

l_app_type = 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 ).

DATA LR_PHOTO TYPE REF TO if_wd_context_node.

DATA ls_PHOTO TYPE IG_COMPONENTCONTROLLER=>ELEMENT_PHOTO.

DATA: i_path TYPE string VALUE '/sap/public',

i_format TYPE string VALUE 'JPG'.

****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 Lv_URL.

****Cache the URL

cl_http_server=>server_cache_upload( url = Lv_URL

response = cached_response ).

lv_raw is the raw string of the image.

lv_url is the URL bind this to Image UI element source property.

Former Member
0 Kudos

hi vinayak,

with Mime Objects u cn upload doc , jpeg, or giff files from our local system into the webdypnpro system .

You can even try creating the MIME objects in webdynrpo abap .Right click on ur component->mime object->import

In the transaction sicf/bc/webdynpro , u cn check your component name there you can view the mime objects created by you .

Please go through this..

http://help.sap.com/saphelp_crm50/helpdata/en/46/bb182fab4811d4968100a0c94260a5/content.htm

Cheers,

Kris.