Hello again,
We have a issue in how to upload the employee portrait in OrgChart 3.0 SP2. Our customer doesn't have the portraits in SAP server. They have it in a folder on another server.
According with my basic research, Nakisa could support this situation. My question is How???
1.- In Application-wide Settings > General Settings, there are two fields:
.- Portraits Path
.- Portraits Image Extension
I guess that in portrait path, we must fill it with the path "folder" (//folder/). The employee portrait are saved using their PERNR, so, should we configure the Details panel? How?
Unfortunately, the files are saved only with the numeric part, I mean: 1234.jpg, instead of 00001234.jpg. Is there a problem?
2.- The SAP RFC SAP_EMPLOYEE_PICTURE, also should we configure it? or the POS_Portrait_3L.xsl template??
I really want to know the behavior.
Best regards
Hi Emilio,
Sure, this is possible (even with the filename not having the leading zeros) and I have done it at a client before. If your application server is a Windows server then you can create a shared drive to the folder that contains the images. Then you can map this in the admin console (e.g. P:\ or P:\Photos\). In the details panel there should already be a section with the XSL so you need to make sure the field used is the Personnel number (PERNR?) and not the image url (URI).
You will need to customize the XSL (or copy it and create a new version) in order to add some code to remove the leading zeros from the Personnel ID field value. This should work:
<xsl:when test="starts-with(/cds/data/record/field[@name='PERNR'],'0')"> <xsl:call-template name="removeLeadingZeros"> <xsl:with-param name="originalString"> <xsl:value-of select="substring-after((/cds/data/record/field[@name='PERNR'],'0' )"/> </xsl:with-param> </xsl:call-template> </xsl:when>
Remember to change PERNR to the Personnel ID field if it is not PERNR.
Finding the XSL template might be tricky, but the best place to start is by looking at SAPPositionDetailConfiguration.xml in the ..\AppResources\detailconfiguration folder in your build folder.
Best regards,
Luke
Hello Luke, thanks for your reply
In order to edit the XSL template, this was what I did:
.- In my build folder (root/.system) I looked for the XML configuration file. Finally I found it and read it. I found a section into this tags: <presentation>EmployeePictureXSL</presentation>. I guess that the template is EmployeePictureXSL.. right?
.-Well, with this informations, I found these files:
\root\Templates
\root\.system\application\Templates
\root\.system\Admin_Config\__000__SAP_Live_GB\Picture (my build)
Which one should we edit? (Guess "\root\.system\application\Templates")
Thank and best regards
Edited by: Emilio Ciotta on Jan 29, 2012 8:36 PM
Hi Emilio,
I just checked and for the Live version the Position details panel uses the template SAPDirectEmployeePhotoXSL, found in ..\root\Templates_SAP. You should copy this file to ..\root\.system\Admin_config\<build>\.delta\root\Templates_SAP. If the root and/or Templates_SAP folder doesn't exist in the .delta folder then create it. Remember to use the same case for folders.
Make the necessary changes in the file. Please note that my previous code was sample code. Below is some code that should work in the XSL file. Replace:
<xsl:choose>
<xsl:when test="string-length(normalize-space(string(/cds/data/record[1]/field[@name=$fieldname]))) >0">
<img src="{/cds/data/record[1]/field[@name=$fieldname]}" class="PhotoSize" width="70" border="0" onerror="javascript:this.src='images/portraits/na.jpg'" />
</xsl:when>
<xsl:otherwise>
<img src="images/portraits/na.gif" class="PhotoSize" width="70" border="0"/>
</xsl:otherwise>
</xsl:choose>With:
<xsl:choose>
<xsl:when test="string-length(normalize-space(string(/cds/data/record[1]/field[@name=$fieldname]))) > 0">
<xsl:choose>
<xsl:when test="starts-with(/cds/data/record/field[@name='PERNR'],'0')">
<img src="{substring-after((/cds/data/record/field[@name='PERNR'],'0')}.jpg" class="PhotoSize" width="70" border="0" onerror="javascript:this.src='images/portraits/na.jpg'" />
</xsl:when>
<xsl:otherwise>
<img src="{/cds/data/record[1]/field[@name='PERNR']}.jpg" class="PhotoSize" width="70" border="0" onerror="javascript:this.src='images/portraits/na.jpg'" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<img src="images/portraits/na.gif" class="PhotoSize" width="70" border="0"/>
</xsl:otherwise>
</xsl:choose>
Good luck!
Luke
Hi Emilio,
What is the problem you have now?
Best regards,
Luke
Hi Luke,
Well, I have edited the template SAPDirectEmployeePhotoXSL as you said. In order to test the code, I saved several photos in ..root/images/portraits folder (with no leading zeros), then in AdminConsole (in general settings->Portrait Images Configurations) I filled the "Portraits Path" field with images/portraits/ value, and the "Portraits Image Extention" with the JPG value.
After that, in OrgChart when I click under any positions box, the Detail panel show me the employee profile but no the employee picture. Previously in this post you said "Remember to change PERNR to the Personnel ID field if it is not PERNR". Where I should do this?
Even in the ViewsPositions Hierarchyportrait, the Orgchart does not show the employee photo. Is there any other template for this that I must to edit?..
That's all for now..
Thank you and best regards
See your other post: [http://forums.sdn.sap.com/thread.jspa?messageID=11094063&tstart=0#11094063]
Hi Luke thanks for the reply,
I already changed the file, and also edit the XSL as you said, however, it does not working fine yet... The problem right now:
.- In OrgChart, the system dosen't show the employee picture, neither the typical red "X" appears.
The code in SAPDirectEmployeePhotoXSL:
<xsl:choose> <xsl:when test="string-length(normalize-space(string(/cds/data/record[1]/field[@name=$fieldname]))) > 0"> <xsl:choose> <xsl:when test="starts-with(/cds/data/record/field[@name='PERNR'],'0')"> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose>
Seem that something is missing between <xsl:when> or <xsl:otherwise> tags.. Am I right?
Part of the code in SAPPositionIncumbentsInfoDetailsConfig_Data.xml:
<fieldset max="0" name="7a3781cbd089444a881566972d153291"> <field name="Object_ID"/> </fieldset>
Could you please help me again?
Thanks and best regards
PS: It seem that the SDN message editor don't support 'img' tags...
HI Emilio,
Did you get this resolved or do you still need some assistance?
Best regards,
Luke
Hello Luke
Thanks for your offer...
Until now the code above is working fine... Your posts were very helpful, so, I have closed the thread days ago.
Thanks again Luke
Best Regards