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 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
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”.
7) Go back to your DOS command prompt.
Executing the Mass Upload Program for Employee Photos
Now that the photos are named correctly,
- 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.