

- How to password protect a zip folder pdf#
- How to password protect a zip folder zip file#
- How to password protect a zip folder code#
Lo_send_request->add_recipient( recipient ). Recipient = cl_cam_address_bcs=>create_internet_address( lv_email ). SELECT SINGLE usrid_long FROM pa0105 INTO lv_email WHERE pernr = wa_final-pernr AND subty ='0010' AND endda = '99991231'. Lo_send_request->set_sender( lo_sender ). Lo_sender = cl_cam_address_bcs=>create_internet_address( ). Lo_send_request->set_document( lo_document ). Lo_document = cl_document_bcs=>create_document(ĬONCATENATE 'YourPayslip_' gv_month gv_year INTO gv_subject1.ĬATCH cx_document_bcs INTO lx_document_bcs. Lo_send_request = cl_bcs=>create_persistent( ).ĬONCATENATE 'Dear' wa_final-ename INTO gv_message SEPARATED BY space.ĬONCATENATE gv_message ',' INTO gv_message.ĬONCATENATE 'Please find your payslip for the month of' gv_month gv_year 'attached with the mail.' INTO gv_message SEPARATED BY space.ĪPPEND 'For added security concerns, your payslip is protected by a unique password, which is your Civil ID number.' TO lt_message_body.ĪPPEND 'For added security concerns, your payslip is protected by a unique password, which is your Passport number.' TO lt_message_body.ĪPPEND 'HR Department' TO lt_message_body.ĬONCATENATE 'Your Payslip for' gv_month gv_year INTO gv_subject SEPARATED BY space.

ĭATA recipient TYPE REF TO if_recipient_bcs. ,lv_send TYPE ad_smtpadr VALUE TYPE os_boolean. ,lx_document_bcs TYPE REF TO cx_document_bcs ,lo_recipient TYPE REF TO if_recipient_bcs ,
How to password protect a zip folder pdf#
Now to attach the PDF file in an email when sending we need to convert the above LD_BUFFER data to HEX format using the below Call method XSTRING_TO_SOLIX: DATA content_hex TYPE solix_tab.ĬALL METHOD cl_bcs_convert=>xstring_to_solixīelow Logic is for Email to be sent with a PDF attachment from SAP to an employee DATA: lo_send_request TYPE REF TO cl_bcs * Begin Correction 1505368 ********************Ĭonvert the above BINARY data to XSTRING using the below function module: DATA: Now we need to send the above-encrypted PDF file to an email IDĬonvert the file to BINARY data using the below function module: sy-cprog = 'RC1TCG3Y'. *encrypting the file using passport number if no ID availableĬONCATENATE '-P' wa_final-passport_no l_file_zip l_file INTO v_dir_input SEPARATED BY space.ĭATA: t_result TYPE STANDARD TABLE OF btcxpm. *encrypting the file using some number- Civil ID here is social security ID, AAdhar ID country specificĬONCATENATE '-P' wa_final-civil_id l_file_zip l_file INTO v_dir_input SEPARATED BY space. " External command u have createdĬONSTANTS: c_extcom TYPE sxpgcolist-name VALUE 'ZDJ_ENCRYPTPDF', L_data_tab LIKE rcgrepfile OCCURS 10 WITH HEADER LINE,Ĭommand_list-name = 'ZDJ_ENCRYPTPDF'.

DATA: BEGIN OF command_list OCCURS 0.Ĭommandname LIKE sxpgcolist-name VALUE 'ZDJ_ENCRYPTPDF',ĭATA: v_dir_input TYPE sxpgcolist-parameters.
How to password protect a zip folder code#
Use the below source code and get external commands from Transaction SM69, and encrypt the file with a password using SXPG_COMMAND_EXECUTE Function module. Refer to the below screenshot for information to be maintained as part of the configuration.

Ĭonfigure the external command using the transaction SM69. WRITE : / 'operating system could not open file'. OPEN DATASET l_file FOR OUTPUT IN BINARY MODE. REPLACE ALL OCCURRENCES OF '''' IN l_file_zip WITH space. REPLACE ALL OCCURRENCES OF '''' IN l_file WITH space. DATA: l_file TYPE string,ĬONCATENATE '/tmp/' wa_final-pernr '''.PDF' INTO l_file.ĬONCATENATE '/tmp/' wa_final-pernr '''.zip' INTO l_file_zip. In the below scenario we are moving the file to /tmp/ directory in AL11 Transaction, One in. Move the PDF file to the Application server. I_tline TYPE TABLE OF tline WITH HEADER LINE,
How to password protect a zip folder zip file#
Without using any third-party tool, we can password protect the ZIP file (pdf file inside the ZIP folder) and send it via email using SAP. Normally, we have a scenario where we convert the OTF output of a Smartform, or a spool request to PDF. This blog describes the procedure to email a ZIP file (PDF file inside ZIP folder) with password protection, as an attachment.
