Mass Uploading Employee Photos

Recently, I was working with a client to identify an efficient way to mass upload employee photos to PA30 as part of the cut-over process. After some research on the internet, I’ve learned that there are many people who are familiar with the OAOH transaction to attach one photo to one employee.  However, it appears that most people seem to think it is necessary to write a custom Z Program to perform a mass upload of employees’ photos to SAP while this is unnecessary, as SAP provides a standard program that will do this. Of course, SAP requires you to follow a specific naming format, but there’s an easy way around that as well!

In order to use the standard program OA_UPLOAD_AND_LINK  to upload employee photos to SAP, the file servers must be set up and configuration must be complete before files can be uploaded. You can use the OAOH transaction to upload and attach a photo to an employee to test the configuration is already set up correctly.

Renaming Employee Photos

In order to use SAP’s standard delivered program to mass upload employees’ photo to SAP, the name of the photos must start with the 8 digit employee number, for example “00091014 Tinker Bell.jpg.”   However, if that is not the naming convention of your company’s employee photos today, there’s a quick and easy way to rename the files in Window using a few quick tricks.

1)      List the current name of all the photos into an Excel spreadsheet. You can do this easily by executing a few commands in DOS.

Click Start and enter “cmd” in the field to run the DOS command prompt:

2)      In the command prompt, navigate your way to the directory where the files are stored using the “cd command.”

  • To go up one level using “cd ..” For example, to go from the “msey” directory to the “Users” directory:
  • To list all the directories available, use the “dir” command
  • To go deeper into a folder, use the “cd foldername.” For example, to go from the “Users” directory  to the “msey”:

3)      Using the redirect function in DOS, list all the names of all the photo files in a .csv.

  • Once you’re in the folder where all the photos are stored, enter the following prompt: dir/b *.FileExtension > TargetFileName.csv
  • For example, all my photos are in JPG format and I want the names of the files to be listed in FileName.csv
  • This file has now been created:
  • The file will only contain one column with the name of all the “.jpg” files in that directory:

4)      SAP needs the file name to be the employee ID.  Using a combination of the “Left” and “CONCATENATE” functions in Excel, you can rename the files too, but only the 8 digit employee ID and file extension. In this example, I used the formula “=CONCATENATE(“000”, LEFT(A1, 5), “.jpg”)”:

5)      The next thing you’ll want to do is to generate the DOS command line that is required to rename the file from column A to column B. In order to do that, you’ll need to add the command “ren” and the double quotes around the file names like this ren “old file name.jpg” “new file name.jpg”.

6)      Copy and paste the DOS command prompt into a text file and save it as a .bat file. Save it in the same folder as the employee photos.   For example, “Rename.bat”.

7)      Go back to your DOS command prompt.

8)      On a command line, type in the name, for example: Rename.bat. A line entry will be created for each file it is renaming, like this:

9)      If you do a “DIR”, you will see the files have been renamed:

Executing the Mass Upload Program for Employee Photos

Now that the photos are named correctly,  you can execute the mass upload program in SAP to upload the photos to the employees.

1)      In SAP, execute transaction code SE38 and execute program “OA_UPLOAD_AND_LINK”

2)      This is what the program screen will look like:

  • File Paths for Documents, ie: C:\Users\msey\Documents\SAP\Pictures-Copy.  All the photos in this directory will be uploaded based on the employee ID that’s in the file name.
  • File Name Extension: the extension of the photos (ie JPG, GIF, etc).
  • Processing on Front End: Process the photo in the foreground.
  • Business Object: PREL for Employee Document.
  • Document Type: HRICOLFOTO for colour photos.
  • Do Not Delete Files: Check this if you do not want the files to be deleted after the upload.  If this is not checked, the files will be deleted after upload.
  • Check Only: Do not actually commit to the upload. Test only.
  • Check if Object Exists: Check if employee already exists.
  • End with First Error:  Stop process after the first error.
  • Object Check Method: EXISTENCECHECK.
  • Store and Link Photo: selected.

3)      Execute the program. Once executed, you will receive a report displaying the details of the upload:

4)      If you review the employee in PA30, you will now see their photos attached:

This entry was posted in Talk Techie to Me and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s