In some presentation from SAP I saw a little user picture on the right top corner near the name.
Today I invest a little bit time to find how does it works.
In the default the picture is show from the SAP JAM Account :
Social Media Integration - User Interface Add-On for SAP NetWeaver - SAP Library
But in our company we have no SAP JAM.
So I searched for a solution to integrate a image from the hcm system.
The solution I found in two default classes:
Enable JAM Integration
Class CL_SMI_COLLAB_PLATF_CHECKER
Method: IS_JAM_CONFIGURED
Gateway Class for the image (GETSTREAM):
Class : CL_SMI_ODATA_SRV_702
Method : GET_STREAM
First I have enhanced the class CL_SMI_COLLAB_PLATF_CHECKER in the method IS_JAM_CONFIGURED.
"return True"
METHOD IOW_YCL_SMI_COLLAB_PLATF_CHEC~IS_JAM_CONFIGURED.
*"------------------------------------------------------------------------*
*" Declaration of Overwrite-method, do not insert any comments here please!
*"
*"class-methods IS_JAM_CONFIGURED
*" returning
*" value(RV_IS_JAM_CONFIGURED) type ABAP_BOOL .
*"------------------------------------------------------------------------*
rv_is_jam_configured = abap_true.
ENDMETHOD.
Next I enhanced the class CL_SMI_ODATA_SRV_702
if iv_source_name = 'Member' and it_navigation_path is not initial and lines( it_navigation_path ) = 1.
field-symbols <ls_navigation_segment> like line of it_navigation_path.
read table it_navigation_path index 1 assigning <ls_navigation_segment>.
if <ls_navigation_segment>-nav_prop = 'ProfilePhoto'.
* " Obtain the member's id.
* data lv_member_id type cl_sm_integration_mpc_ext=>ts_member-id.
* lv_member_id = get_first_key( it_key_tab ).
" Get the member's profile photo.
field-symbols <lr_stream> type /iwbep/if_mgw_appl_srv_runtime=>ty_s_media_resource.
create data er_stream type /iwbep/if_mgw_appl_srv_runtime=>ty_s_media_resource.
data lv_picture type XSTRINGVAL.
CALL FUNCTION 'YFIORI_GET_IMAGE' DESTINATION 'HCM_SYSTEM'
IMPORTING
EV_PICTURE = lv_picture
.
assign er_stream->* to <lr_stream>.
<lr_stream>-mime_type = 'image/jpg'.
<lr_stream>-value = lv_picture.
* move mo_smi_odata_srv_helper->get_member_profile_photo( lv_member_id ) to <lr_stream>.
endif.
else.
* raise_operation_not_supported( ).
endif.
On the HCM System I wrote a little function to get the user image and return this image as xstring to gateway system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
10 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 |