Sending encrypted HRFORMS (e.g. Payslips) via Email

In the newer versions of SAP many forms are generated with the Adobe Document Services (ADS). Especially HR uses the ADS to generate the HRFORMS. HR usually sends confidential data like payslips or medical certificates and needs a protection of the attached PDFs. To protect the PDF it has to be encrypted.
The sample report Encryption of HRFORMS (ADS) and Sending it via email shows the general procedure:
  • Retrieve the payroll data for the HRFORM
  • Get the name of the form from a feature (PE03) - here HRFOR
  • Initialize the HRFORM
  • Process the HRFORM
  • Call the ADS (HRFORMS_CALL_PDF) to generate the PDF
  • Generate a password or use a stored password
  • Encrypt the PDF (RC4 or AES)
  • Determine the email addresses of the recipients (Basis - ADR6 or HR - Infotype 105/0010 )
  • Attach the encrypted PDF and send the mail

The following screenshots show it from the user perspective:

Start the report

Start of Report

Start of Report

After execution of report, we get some kind of log:

Result of Report

We find the result in transaction SOST:

Mail Overview

The mail contains the password and the PDF attachment:

When opening the PDF attachment the PDF reader prompts for a password

Open Mail

If the correct password is entered the PDF opens:

Open PDF

Some final remarks

The password can be generated or stored in SAP (e.g. custom subtype of infotype 105). If the password is generated, you should consider to send the password over a different channel to ensure the security of the PDF file. On the other hand a stored password has to be stored encrypted. You may use the public and private key of the SAP system (STRUST).

The recipients can be selected by variants, authorizations (AUTHORITY-CHECK OBJECT object for user), Organizational Management or other options, which have to be investigated directly on the customer system.