Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
armandozaro
Advisor
Advisor
0 Kudos

Hello everyone

As you might know, since NW 7.31 it is possible to display the user photo of the initiator of a BPM Task, in the Stream View of BPM Inbox. It shows as it follows:

The photo which is shown is stored in the UME (User Management Engine).

On NW 7.31 and NW 7.40, the NetWeaver only provides the APIs to set the photo for each user, but does not provide a shipped UI in order to upload such a photo.

As of NW 7.5, the /useradmin application already have a User Interface to upload the photo for each user.


For NW 7.31 and NW 7.40, according to BPM Inbox documentation, a custom application can be developed to make the upload on versions prior to NW 7.5. This is stated at:

http://help.sap.com/saphelp_nw74/helpdata/en/d1/913a66f9d94b2aa103552f004d4213/content.htm?frameset=...


It’s important to mention that the method setPhoto described in this documentation receives as a parameter a byte array (byte[]).


Here is an example on how to retrieve a correct byte[] from an image residing in the file system:


File file = new File("C:\\<path>\\<to>\\<photo>");

byte[] buffer = new byte[4096];

ous = new ByteArrayOutputStream();

ios = new FileInputStream(file);

int read = 0;

while ((read = ios.read(buffer)) != -1) {

      ous.write(buffer, 0, read);

}

byte[] fileContent = ous.toByteArray();



After filling the fileContent variable with the resulting byte array, it can be passed as a parameter to the method setPhoto of the IUserMaint class object that you create.


In case the conversion to byte array is not properly made, the image might get corrupted and as a result the photo might not get displayed, and the following symbol is displayed instead:

Have that in mind in case you develop a custom UI and your photo is not appearing in BPM Inbox.

Regards,
Armando