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: 

How can I change the sender email id in SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Kudos

Hi,

I am using the FM "SO_NEW_DOCUMENT_ATT_SEND_API1" to send an E-Mail. I have to use the sender's E-Mail address as a general one ( Not to the SAP login user's id ). How to do this.

Please advice.

Thanks in advance.

15 REPLIES 15

former_member188685
Active Contributor
0 Kudos

Hi,

check this thread...

Regards

vijay

Former Member
0 Kudos

Hai Sabari

Check the following Code

DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.

DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: TAB_LINES LIKE SY-TABIX.

DATA L_NUM(3).

  • Creation of the document to be sent

  • File Name

DOC_CHNG-OBJ_NAME = 'SENDFILE'.

  • Mail Subject

DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.

  • Mail Contents

OBJTXT = 'Object text'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

  • Creation of the entry for the compressed document

CLEAR OBJPACK-TRANSF_BIN.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

APPEND OBJPACK.

  • Creation of the document attachment

LOOP AT ITAB_DATA.

CONCATENATE ITAB_DATA-PRODUCTOR

ITAB_DATA-VBELN

ITAB_DATA-POSNR

ITAB_DATA-MATNR INTO OBJBIN.

APPEND OBJBIN.

ENDLOOP.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'ORDERS'.

APPEND OBJHEAD.

    • Creation of the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'TXT'.

OBJPACK-OBJ_NAME = 'WEBSITE'.

OBJPACK-OBJ_DESCR = 'ORDERS.TXT'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

  • Completing the recipient list

  • target recipent

clear RECLIST.

RECLIST-RECEIVER = 'test@here.com'.

RECLIST-EXPRESS = 'X'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

  • copy recipents

clear RECLIST.

RECLIST-RECEIVER = 'secondtest@here.com'.

RECLIST-EXPRESS = 'X'.

RECLIST-REC_TYPE = 'U'.

RECLIST-COPY = 'X'.

APPEND RECLIST.

  • Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

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.

Thanks & regards

Sreenivasulu P

Former Member
0 Kudos

Hi sabari,

1. This FM will not allow for such thing.

It will use the email address which is tied to the user that is executing the program

2. We can override this

if we use SO_OBJECT_SEND function module.

regards,

amit m.

Former Member
0 Kudos

Hi Amit,

Can you please explain how can i over write using the FM "SO_OBJECT_SEND".

Thanks for your help.

0 Kudos

Hi again,

1. ORIGINATOR

ORIGINATOR_TYPE

2. These are two importing parameters in this FM.

3. There we can mention.

regards,

amit m.

former_member181962
Active Contributor
0 Kudos

Hi sabari,

YOu can pass the sender to this parameter SENDER of the SO_OBJECT_SEND function module.

Regards,

Ravi

0 Kudos

if you are are WAS6.10 (4.7) or above you can use cl_bcs class for emailing which is very flexible.

demo programs

BCS_EXAMPLE_1

BCS_EXAMPLE_2

BCS_EXAMPLE_3

BCS_EXAMPLE_4

BCS_EXAMPLE_5

BCS_EXAMPLE_6

and also check out this code sample.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5931ff64-0a01-0010-2bb7-ff2...

Regards

Raja

Former Member
0 Kudos

Hi again,

1. I just tried.

It works fantastic.

2. While calling the FM

just pass these additional parameters :

ORIGINATOR = 'USERXYZ'

ORIGINATOR_TYPE = 'B'

3. When u see in your Busines workplace inbox,

u will see

AUTHOR as USERXYZ.

regards,

amit m.

Former Member
0 Kudos

Hi,

I am sending an EMail as attachment using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'. This FM defaults the sender address as the SAP Login user Id. My requirement is to change the sender address.

How can I overwrite the sender mail address with the specific address using the FM SO_OBJECT_SEND.

Could you please explain.

Thanks for your time.

0 Kudos

hi again,

1. sorry for the confusion.

2. I meant to say that,

using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'

its not possible. It does not allow.

3. However, if we use

SO_OBJECT_SEND

for sending mails internally,

then we can use to put our own sender name.

regards,

amit m.

marius_page
Explorer
0 Kudos

Dear sabari g,

You will notice that fm "SO_NEW_DOCUMENT_ATT_SEND_API1" is very simple, and calls "SO_DOCUMENT_SEND_API1". This last fm allows you to specify a SAP user as sender.

I would suggest that you create a user in SAP, giving this user the generic e-mail address that you would like to use. Then copy the ABAP/4 source from "SO_NEW_DOCUMENT_ATT_SEND_API1" into your program as a subroutine. Change the call of "SO_DOCUMENT_SEND_API1" to use the special user as sender.

Regards,

Marius Page

Former Member
0 Kudos

Hi Sabri,

Simply Pass your Email Address in Sender Address.

While Pass Address Type as 'SMTP'

It will work...

Regards,

Ankit

former_member198900
Participant
0 Kudos

This message was moderated.