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: 

EMAIL to external server like Yahoo through SAP

Former Member
0 Kudos

Hi all,

I want to send a mail to the vendor when a PO is created through SAP. Please tell me what is the procedure to follow to do it and what all are the setings need to be done in SAP to send Email through SAP to external server like yahoo, rediff etc.

Thanks

7 REPLIES 7

Former Member
0 Kudos

1. If you are on release 620 you have to configure the SMTP node with an email server (like Exchange). Refer to OSS Note# 455140

2. You have to set a communication strategy for the output message. Refer OSS Note# 191470

rgds,

Manohar E

0 Kudos

Thanks Sri. I was exactly looking for a note like this.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface

and

/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface

Former Member
0 Kudos

was you able to solve it or it is stll an issue

regards

Former Member
0 Kudos

Hi,

if you have a standard print program associated with your PO sapscript,then populate the structure ITCPO with field ITCPO-TDNEWID = 'X'.This will create a new spool request each time you create a PO.Then populate the title of the spool with your PO number using field ITCPO-TDCOVTITLE = EKKO-EBELN.You can make use of this unique PO number in the spool title to run the BDC for tr.SP01.Then go to tr.SP01>tick the spool no>Go to menu Spool Request

>forward>send using sap office-->give the recipient name.The SMTP settings are to be maintained.

I hope this will help you.

-Milind.

Former Member
0 Kudos

Hi,

Use exit Exit_sapl_mereq_006 and use the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send the mail.See Fm docu for more help.

Hope this will be useful for u.

Thanks,

Vamsi.

Former Member
0 Kudos

&----


*& Form F_SEND_MAIL

&----


  • Send the mail to corresponding user

----


FORM F_SEND_MAIL.

DATA : LV_TABLE_LINES LIKE SY-TABIX. " table index

CLEAR: V_MSG1, IT_RECLIST.

REFRESH IT_RECLIST.

*-popualate email ids

IT_RECLIST-RECEIVER = V_UNAME.

IT_RECLIST-REC_TYPE = 'B'.

IT_RECLIST-SAP_BODY = C_X.

IT_RECLIST-EXPRESS = C_X.

*-append receiver table

APPEND IT_RECLIST.

CLEAR IT_RECLIST.

*-populate document attributes

CLEAR: X_DOC_CHNG.

X_DOC_CHNG-OBJ_NAME = 'Error'(M01).

X_DOC_CHNG-OBJ_DESCR = 'ERROR REPORT'(M02).

*-populate body text

IT_OBJTXT = 'Error file is attached'(M03).

APPEND IT_OBJTXT.

*-document size

CLEAR : LV_TABLE_LINES.

DESCRIBE TABLE IT_OBJTXT LINES LV_TABLE_LINES.

READ TABLE IT_OBJTXT INDEX LV_TABLE_LINES.

X_DOC_CHNG-DOC_SIZE =

( LV_TABLE_LINES - 1 ) * 255 + STRLEN( IT_OBJTXT ).

*-populate packing list for body text

CLEAR IT_OBJPACK-TRANSF_BIN.

IT_OBJPACK-HEAD_START = 1.

IT_OBJPACK-HEAD_NUM = 0.

IT_OBJPACK-BODY_START = 1.

IT_OBJPACK-BODY_NUM = LV_TABLE_LINES.

IT_OBJPACK-DOC_TYPE = C_DOCTYP.

APPEND IT_OBJPACK.

CLEAR IT_OBJPACK.

*-populate object header

IT_OBJHEAD = 'INET TO SAP Error Report'(M04).

APPEND IT_OBJHEAD.

CLEAR IT_OBJHEAD.

*--for attachment ---start

*-populate object bin table for attachment

*-column header

LOOP AT IT_MAIL.

IT_OBJBIN = IT_MAIL.

APPEND IT_OBJBIN.

CLEAR IT_OBJBIN.

ENDLOOP.

*-get total no.of lines of Object table(attachment)

CLEAR : LV_TABLE_LINES.

DESCRIBE TABLE IT_OBJBIN LINES LV_TABLE_LINES.

*-populate object header

IT_OBJHEAD = 'Report'(M05).

APPEND IT_OBJHEAD.

CLEAR IT_OBJHEAD.

*-packing list for attachment

IT_OBJPACK-TRANSF_BIN = C_X.

IT_OBJPACK-HEAD_START = 1.

IT_OBJPACK-HEAD_NUM = 1.

IT_OBJPACK-BODY_START = 1.

IT_OBJPACK-BODY_NUM = LV_TABLE_LINES .

IT_OBJPACK-DOC_TYPE = C_DOCTYP .

IT_OBJPACK-OBJ_NAME = 'ABCD'.

IT_OBJPACK-OBJ_DESCR = 'ERROR REPORT'(M02).

IT_OBJPACK-DOC_SIZE = LV_TABLE_LINES * 255.

APPEND IT_OBJPACK.

CLEAR IT_OBJPACK.

*--code for attachment -- end

*-Sending the document

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = X_DOC_CHNG

PUT_IN_OUTBOX = C_X

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

PACKING_LIST = IT_OBJPACK

OBJECT_HEADER = IT_OBJHEAD

CONTENTS_BIN = IT_OBJBIN

CONTENTS_TXT = IT_OBJTXT

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

RECEIVERS = IT_RECLIST

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

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 INTO V_MSG1.

MESSAGE I000 WITH V_MSG1.

ENDIF.

Hope this code will be useful