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.

/wp-content/uploads/2014/10/imge_570262.png

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Simon Ludwigs

    Dear Daniel,

    thank you a lot for the blog entry. Do you have a Fiori App in place to upload the user image to the HCM system? I think it could be also possible that the user make his own picture with the smartphone camera 🙂

    (0) 
  2. Kiran B

    Hi Daniel,

    its a very helpfull blog but could be please tell us how to achieve the same in Netweaver 7.4 SP12 Fiori launchpad in java stack portal?

     

     

     

    Regards

    Kiran B

    (0) 
    1. Michael Appleby

      Unless you are asking for clarification/correction of some part of the Document, please create a new Discussion marked as a Question.  The Comments section of a Blog (or Document) is not the right vehicle for asking questions as the results are not easily searchable.  Once your issue is solved, a Discussion with the solution (and marked with Correct Answer) makes the results visible to others experiencing a similar problem.  If a blog or document is related, put in a link.  Read the Getting Started documents (link at the top right) including the Rules of Engagement. 

       

       

      NOTE: Getting the link is easy enough for both the author and Blog.  Simply MouseOver the item, Right Click, and select Copy Shortcut.  Paste it into your Discussion.  You can also click on the url after pasting.  Click on the A to expand the options and select T (on the right) to Auto-Title the url.

       

       

      Thanks, Mike (Moderator)

      SAP Technology RIG

      (0) 
  3. Nuno Vilar

    Hello,

    We also not have the JAM, and we want to see the image of the employee near to the options.

    Any one did to implement this suggestion from Daniel? In our case the method GET_STREAM from the class CL_SMI_ODATA_SRV_702 is not called.

    Regards

    Nuno Vilar

     

    (0) 
  4. Poornima Chepur

    Nuno, were you able to figure it out finally? Can you please tell what you did to get the pic to show up?  CL_SMI_ODATA_SRV_702 is deprecated, so it’s not called anymore.

    (0) 
  5. Rafael Moreno Hermosilla

    Hello,

    Is there a way to find a logic same as Daniel explains ??
    I realize that the logic that Daniel comments it’s now deprecated, but I wonder if exists some other way to avoid the use of SAP Jam (Some BADI or something like that where you can enhance the current flow and get the user photo).

    Thanks in advance.

    Rafa.

    (0) 

Leave a Reply