Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

A copy or blind carbon copy of all emails that gets generated from SAP SRM

Former Member
0 Kudos

Hi All,

My Requirement is :

A copy or blind carbon copy of all emails that gets generated from SRM ( P2P / S2C ) should be sent to support@XYZ.com.uk. This is to maintain history of all emails that gets generated from SRM.

Please help me to achieve the requirement.

Thanks & Regards,

Ramesh Kmar Singh

9 REPLIES 9

Former Member
0 Kudos

Hi Ramesh,

You can use the auto forwarding feature of SAP.

If we want to send mails to external mail ID, we follow two approaches

First, maintain User mail ID in SU01, communication method as INT and Go to So16->mail sys grp->send to home add of users.

This will automatically send mails to external mail ID maintained in SU01.

Secondly, maintain automatic forwarding and mails would be sent to external mail ID.

SO you can use any of the approach above to send mail.

For more details

http://help.sap.com/saphelp_nw04/helpdata/EN/6c/69c264418d11d1896e0000e8322d00/content.htm

Regards

0 Kudos

Hi Mohammed,

Thank you for the quick response. As of now the set requirement is to 'BCC' all the mails to

support@XYZ.com.uk. which are been triggered for any recipient( and not forwarding) in SAP SRM system. Please let me know your thought on that.

Do I have to go for any enhancement or for any custom report to accomplish the requirement.

If yes then which prog.

Thanks,

Ramesh Kumar Singh

former_member184569
Active Contributor
0 Kudos

For all the mails that are send using the FM SO_NEW_DOCUMENT_ATT_SEND_API1, you can make the following enhancement. (You can go to this FM and see the where used list to start with)


The mail sending FM: SO_NEW_DOCUMENT_ATT_SEND_API1 has a tables structure RECEIVERS (LIKE SOMLRECI1).

In structure SOMLRECI1 there are fields COPY & BLIND_COPY.

Just pass 'X' to these fields for the emails ID support@xyz.com.uk and append to the receivers table parameter of the FM.

0 Kudos

Hi Susmitha,

Thanks a lot for the valuable reply. I have enhanced the FM SO_NEW_DOCUMENT_ATT_SEND_API1 with the following code in the bottom -

Sending mail as CC to receiver

RECEIVERS-RECEIVER = 'support@xyz.com.uk'. " the recipient mail id
RECEIVERS-REC_TYPE = 'U'.
RECEIVERS-COPY = 'X' . " this will send the receiver as cc
append RECEIVERS .

Sending mail as BCC to receiver

RECEIVERS-RECEIVER = ' support@xyz.com.uk'. " the recipient mail id
RECEIVERS-REC_TYPE = 'U'.
RECEIVERS-BLIND_COPY = 'X' . " this will send the receiver as bcc
append RECEIVERS

But the issue is I am not able to see if the CC and BCC mail sent to support@xyz.com.ukor not in tcode SOST. Only the primary recipient('To') is getting displayed. Let me know your thought on that. Do we only get the display of primary recipient??  ( My limitation is that i can't check  the support@xyz.com.uk mail inbox)

Also is FM SO_NEW_DOCUMENT_ATT_SEND_API1/ SO_DOCUMENT_SEND_API1 is being used by all sap standard program  to send the email (eg PO/Invoice)??

0 Kudos

Well, just for checking, you can give your email id in the BCC and see if its coming.

Some options you could try are:

In the receivers structure, there are the following notification fields, you can set them to receive notification to the sender.

  • NOTIF_DEL
If this flag is activated ('X'), the sender receives confirmation when the recipient receives the document. He or she also receives a message if the document could not be delivered. This flag should only be activated for external sending, since internal sending is synchronous. Confirmation is only supported by a small number of mail systems, however. For example: X.400 and SAP SAP.
  • NOTIF_READ
If this flag is activated ('X'), the sender is notified as soon as the recipient has read the document. This flag should only be activated for external sending, since internal sending is synchronous. Read notification is only supported by a small number of mail systems, however. For example: X.400 and SAP SAP.
  • NOTIF_NDEL
If this flag is activated ('X'), the recipient receives a message if the document could not be delivered to the recipient. This flag should only be activated for external sending, since internal sending is synchronous. The message is only supported by a small number of mail systems, however. For example: X.400 and SAP SAP.

Also there is a return code for each address in the recievers table.

  • RETRN_CODE
When the recipient has received the document, the function module enters the value '0' in this field. If the document is not successfully recieved, a value unequal to '0' is entered in the field

This can be checked for each row in the receiver table after the FM.

Also, to see if the document was sent to all receivers, then the sy-subrc of the FM can be checked and exception can be captured.

Exceptions

TOO_MANY_RECEIVERS
Too many recipients were specified. The active user does not have authorization to send to this number of recipients.
DOCUMENT_NOT_SENT
The document could not be sent. It was not delivered to any of the specified recipients.


* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
     EXPORTING
          DOCUMENT_DATA = DOC_CHNG
          PUT_IN_OUTBOX = 'X'
          COMMIT_WORK   = 'X'
     TABLES
          PACKING_LIST  = OBJPACK
          OBJECT_HEADER = OBJHEAD
          CONTENTS_BIN  = OBJBIN
          CONTENTS_TXT  = OBJTXT
          RECEIVERS     = RECLIST
     EXCEPTIONS
          TOO_MANY_RECEIVERS = 1
          DOCUMENT_NOT_SENT  = 2
          OPERATION_NO_AUTHORIZATION = 4
          OTHERS = 99.
CASE SY-SUBRC.
  WHEN 0.
    WRITE: / 'Result of the send process:'.
    LOOP AT RECLIST.
      WRITE: / RECLIST-RECEIVER(48), ':'.
      IF RECLIST-RETRN_CODE = 0.
        WRITE 'sent successfully'.
      ELSE.
        WRITE 'not sent'.
      ENDIF.
    ENDLOOP.
  WHEN 1.
    WRITE: / 'no authorization to send to the specified number of'              'recipients!'.
  WHEN 2.
    WRITE: / 'document could not be sent to any of the recipients!'.
  WHEN 4.
    WRITE: / 'no authorization to send !'.
  WHEN OTHERS.
    WRITE: / 'error occurred during sending !'.
ENDCASE.

0 Kudos

Hi Susmith,

Thanks for your help. I can't put my email id to test because as per the dev box setting(basis setting) only mail can be send to recipient    support@xyz.com.uk only....:)

As per your suggestion i have enhanced FM SO_NEW_DOCUMENT_ATT_SEND_API1/ SO_DOCUMENT_SEND_API1 with above logic. That is working fine for the custom reports where FM SO_NEW_DOCUMENT_ATT_SEND_API1/ SO_DOCUMENT_SEND_API1 is being called.

But in standard SAP application program to send email, I think these FM's SO_NEW_DOCUMENT_ATT_SEND_API1/ SO_DOCUMENT_SEND_API1 are not been used. For eg:

if I put a break point in the above FM's and create a mail through T-Code SBWP and try to process it in tcode 'SOST'.,The debugger is not getting triggered.   

former_member184672
Participant
0 Kudos

Hi Ramesh,

             Please be informed that all the outgoing mails from the SAP system is routed through the SOST queue. You can view the mail details using the tcode SOST. You can have a word with your basis team to send a copy or blind copy of these mails to another recipient, in your case 'support@XYZ.com.uk', provided you have an appropriate sort key to segregate these mails like a common sender mail ID or sender username. There must be settings available with the basis team to re-route the mails. If not, you will have to enhance the standard SOST program to accomplish your requirement.

SOST uses the methods associated with the standard class CL_BCS to send the mails. You can add an additional blind copy recipient object for sending the the mail copy. The code snippet to achieve this is as follows:

DATA: lv_mailbcc          TYPE ad_smtpadr,

      lo_send_request        TYPE REF TO cl_bcs,

      lo_recipient_bcc       TYPE REF TO if_recipient_bcs.

lv_mailcc  = 'support@XYZ.com.uk'.

* Create recipient bcc object

        lo_recipient_bcc = cl_cam_address_bcs=>create_internet_address( lv_mailbcc ).

* Add recipient cc object to send request

        lo_send_request->add_recipient(

                         i_recipient   = lo_recipient_bcc

                         i_blind_copy  = 'X' ).

Thanks & Regards,

Sarath.

0 Kudos

Hi Sarath,

Thanks for this very vital information. Can you please pin point me the 'Method' in 'CL_BCS Class' in which I should  write the code (Enhancement) so that it will automatically pickup the the  'support@XYZ.com.uk as BCC.

0 Kudos

Hi Ramesh,

     There is no single point of modification for editing the receiver list in SOST as there are mainly two ways in which you can send mails using the two buttons as shown in the below screenshot; the first button for repeating the send procedure and the second button for sending the mails from SOST queue.

 

Therefore you need to add your recipients to methods pertaining to both the buttons.

  1. For repeat send procedure the recipient list is being filled in the form 'copy_and_resend' of the standard program RSSOSOSTSTAT. 'SR_NEW' is the send request object and 'CUR_TABLE' contains your email attributes. So you can probably implement your condition check and add a new recipient object to the 'SR_NEW' request in this sub-routine.
  2. For send from the second button is processed in the function module SX_OBJECTS_SEND_ARFC. Here you can see the call to the function 'SO_RECIPIENTS_FOR_SEND_GET' to retrieve the recipient list to the internal table rec_list.

You can perhaps add one more recipient to this table as per your requirement.


You need to debug the routines to properly identify the various attributes in the mail and the key in your code accordingly.


Hope this be helpful for you in arriving at a solution to your problem.


Thanks & Regards,

Sarath.