09-20-2005 2:32 PM
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
09-20-2005 2:40 PM
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
10-20-2005 5:49 PM
09-20-2005 2:54 PM
09-21-2005 5:04 AM
09-21-2005 5:53 AM
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.
10-21-2005 2:35 PM
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.
10-21-2005 2:44 PM
&----
*& 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