Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member751463
Participant
Introduction 

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.

Requirement

The requirement is to send a password protected PDF file from ECP to external email id.

Solution

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.

https://blogs.sap.com/2012/07/06/email-pdf-attachment-with-password-protection/

https://blogs.sap.com/2014/09/03/password-protect-a-pdf-file/

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.

Steps

  • 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



Iflow


Please check the below blog if you want to get detail on how to send file in ECP

https://blogs.sap.com/2020/07/03/how-to-transfer-files-into-sftp-using-abap-program/

There are open source scripts available to password protect the pdf file which can used in CPI.

Conclusion

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.

Thanks,

Aditya.
1 Comment
Labels in this area