Restrict access to sent emails in SOST SAP transaction

If you are sending emails out of SAP which contains sensitive data such as usernames and passwords, you may not want any user with access to the sap transaction SOST to view these details. In order to do this you could possibly delete the entries out of the SAP table where these are stored. A better method would be to change the abap code in the program which sends the email so that it sets the emails as private or confidential. If this is done anyone who tries to view the emails via SAP tcode SOST will get a restricted access message, saying that the email can not be viewed as it is confidential.

In-order to do this you simply have to set the SENSITIVTY field within the document_data parameter to the correct value.

document-SENSITIVTY = 'P'. "P equals Confidential
document-SENSITIVTY = 'E'. "E equals Private

* Populate the subject/generic message attributes
  w_doc_data-obj_langu = sy-langu.
  w_doc_data-obj_name  = 'SAPRPT'.
  w_doc_data-obj_descr = 'Email Subject'.
  w_doc_data-sensitivty = 'P'.
* Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            document_data              = w_doc_data
            put_in_outbox              = 'X'
            sender_address             = ld_sender_address
            sender_address_type        = ld_sender_address_type
            commit_work                = 'X'
       IMPORTING
            sent_to_all                = w_sent_all
       TABLES
            packing_list               = t_packing_list
            contents_bin               = t_attachment
            contents_txt               = it_message
            receivers                  = t_receivers
       EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.


<--SAP Email processing Home

Related Articles

Send email from SAP using ABAP code on sending data as an email attachment
Send external email from within ABAP program and include attachment
Email attachment from SAP and retain leading zeros mod in attached excel document
ABAP code to Retain leading zeros within XLS file (excel)
cl_bcs ABAP class interface to send emails from SAP
Sending Emails to external addresses from within a program using SAPconnect
Send external email from within ABAP program
SAPconnect Administration
Send SAP mail to specific users workplace inbox
Start send process from SAPconnect (Send mail to external address)
Setup PO external send to partner / vendor functionality for SAP purchase orders
SOST SAPConnect send requests transaction