Technology evolves in a rapid pace in this modern era. ECP is a niche skill in the world of Human capital management. In ECP, we need to password protect attachments while sending the sensitive data .Otherwise It will create privacy related non compliance issues. This blog will explain the process to send password protected PDF file ECP to external email id.
The requirement is to send a password protected PDF file from ECP to external email id.
In ERP system, we can send password protected file with or without third party software. But we have to use command line to make it happen. We have to use the below function module to run the command line.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
Please check below blogs on how to send password protected PDF fine in ERP system.
But in ECP, we can not execute command line. So we need to follow different approach for that.
We have to use CPI to password protect the PDF file.
- First we need to convert the data into PDF format. For eg if we are reading the data from spool, then use the below function module to covert the data to PDF. CALL FUNCTION ‘CONVERT_OTFSPOOLJOB_2_PDF’
- We need to write the data to a temp file in application server and then read the file from application server for proper formatting of PDF data.
- We have to convert the data to BASE64 format using SCMS_BASE64 _ENCODE_STR function module
- We need to send the data to CPI.
- We need to use the class CL_HTTP_CLIENT=>CREATE_BY_DESTINATION to instantiate the object.
- Fill the headers and set the URI by CL_HTTP_UTILITY=>SET_REQUES_URI
- We will send PDF file attachment data in base64 and password information along with the email id.
- Get the http response and mark it successful if the the response code is 200
Please check the below blog if you want to get detail on how to send file in ECP
There are open source scripts available to password protect the pdf file which can used in CPI.
CPI is the key to integration in ECP. There are also public API available in Adobe to encrypt the PDF file. Do let me know if this was helpful and share if you think it is useful. Please do reach out to me if you need any further clarifications.