Application Development and Automation 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: 
Read only

Send e-mails

Former Member
0 Likes
536

Hi. I'm using the function SO_NEW_DOCUMENT_SEND_API1 for sending e-mails. In this function, the sender is the user who had been logged at the moment of send the e-mail.

I want to know if i could change this sender for another, to always send e-mails from the same sender, without care the logged user.

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
506

Hi,

the sender address can be changed via parameter SENDER_ADDRESS.

It is set to sy-uname (user who is running the program) by default, but I think you can change it to any user...

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data                    = ls_document_data
*     put_in_outbox                    = 'X'
*     SENDER_ADDRESS                   = 'USER_XY'
*     SENDER_ADDRESS_TYPE              = 'B'
     commit_work                      = 'X'
*   IMPORTING
*     SENT_TO_ALL                      =
*     NEW_OBJECT_ID                    =
*     SENDER_ID                        =
    TABLES
      packing_list                     = lt_packing_list
*     OBJECT_HEADER                    =
*     CONTENTS_BIN                     =
     contents_txt                     = lt_contents_txt
*     CONTENTS_HEX                     =
*     OBJECT_PARA                      =
*     OBJECT_PARB                      =
      receivers                        = lt_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.

4 REPLIES 4
Read only

Former Member
0 Likes
507

Hi,

the sender address can be changed via parameter SENDER_ADDRESS.

It is set to sy-uname (user who is running the program) by default, but I think you can change it to any user...

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      document_data                    = ls_document_data
*     put_in_outbox                    = 'X'
*     SENDER_ADDRESS                   = 'USER_XY'
*     SENDER_ADDRESS_TYPE              = 'B'
     commit_work                      = 'X'
*   IMPORTING
*     SENT_TO_ALL                      =
*     NEW_OBJECT_ID                    =
*     SENDER_ID                        =
    TABLES
      packing_list                     = lt_packing_list
*     OBJECT_HEADER                    =
*     CONTENTS_BIN                     =
     contents_txt                     = lt_contents_txt
*     CONTENTS_HEX                     =
*     OBJECT_PARA                      =
*     OBJECT_PARB                      =
      receivers                        = lt_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.

Read only

Former Member
0 Likes
506

hi,

even u can send mail using SO_OBJECT_SEND function module. In this Function Module if we change the FORWARDER = user name which you want to put.

This solves ur problem.

Read only

former_member156446
Active Contributor
0 Likes
506

if you can maintain a Ztable of user names and the email id.. and code in such a way to pick sender from that table and receivers also in it.. you can give access to end user to maintain that table using SM30.

Read only

Former Member
0 Likes
506

Hi Fiorella,

i don't think it's possible do achieve this with that function module. But instead of SO_NEW_DOCUMENT_SEND_API1 you could use function module SO_DOCUMENT_SEND_API1. It has a import parameter SENDER_ADDRESS which supplies the sending user.

Hope this helps!

Regards

Mark-Andru00E9

P.S, If you're interested in a newer object oriented way of sending emails you should take a look at this Weblog: [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/789] [original link is broken] [original link is broken] [original link is broken];