Send eMail per FUBA aus SAP
Hello,
I would like to send a mail in csv to User with internet. I dont have errors but I did not get a email. Commit_work is X. In TA SCOT is no entry.
Can somebody help?
Thanks a lot.
My code:
FUNCTION z_test_mail2.
""Lokale Schnittstelle:
Testprogramm für Fubau-Mailversand mit Attachment
SO_NEW_DOCUMENT_ATT_SEND_API1
DATA: lt_objpack TYPE TABLE OF sopcklsti1,
ls_objpack TYPE sopcklsti1,
lt_objhead TYPE TABLE OF solisti1,
ls_objhead TYPE solisti1,
lt_objbin TYPE TABLE OF solisti1,
ls_objbin TYPE solisti1,
lt_objtxt TYPE TABLE OF solisti1,
ls_objtxt TYPE solisti1,
lt_reclist TYPE TABLE OF somlreci1,
ls_reclist TYPE somlreci1,
ls_document_data TYPE sodocchgi1,
lv_tab_lines TYPE sy-tabix,
commit_work LIKE sonv-flag VALUE 'X'.
*PARAMETERS:
DATA: p_send TYPE xflag.
Erstellen des zu versendenden Dokuments
ls_document_data-obj_name = 'AuswertungZaehlpunkt'.
ls_document_data-obj_descr = 'Auswertungen'(t01).
ls_objtxt = 'Sehr geehrte Damen und Herren,'(t02).
APPEND ls_objtxt TO lt_objtxt.
ls_objtxt = 'Anbei finden Sie das Dokument zu Ihrer gewünschten Auswertung.'(t03).
APPEND ls_objtxt TO lt_objtxt.
ls_objtxt = 'Die Datei wurde als Anlage beigefügt.'(t04).
APPEND ls_objtxt TO lt_objtxt.
DESCRIBE TABLE lt_objtxt LINES lv_tab_lines.
READ TABLE lt_objtxt INTO ls_objtxt INDEX lv_tab_lines.
ls_document_data-doc_size = ( lv_tab_lines - 1 ) * 255 + STRLEN( ls_objtxt ).
Erstellen des Eintrags zum komprimierten Dokument
CLEAR ls_objpack.
ls_objpack-transf_bin = ''.
ls_objpack-head_start = 1.
ls_objpack-head_num = 0.
ls_objpack-body_start = 1.
ls_objpack-body_num = lv_tab_lines.
ls_objpack-doc_type = 'RAW'.
APPEND ls_objpack TO lt_objpack.
Erstellen der Anlage für das Dokument
(Man stelle sich die Daten in gt_objbin im BMP-Format angegeben vor)
ls_objbin = ' O/ '. APPEND ls_objbin TO lt_objbin.
ls_objbin = ' '. APPEND ls_objbin TO lt_objbin.
ls_objbin = ' / '. APPEND ls_objbin TO lt_objbin.
DESCRIBE TABLE lt_objbin LINES lv_tab_lines.
ls_objhead = '0VTYPE_TXT.CSV'(t05). APPEND ls_objhead TO lt_objhead.
Erstellen des Eintrags zur komprimierten Anlage
CLEAR: ls_objpack.
ls_objpack-transf_bin = 'X'.
ls_objpack-head_start = 1.
ls_objpack-head_num = 1.
ls_objpack-body_start = 1.
ls_objpack-body_num = lv_tab_lines.
ls_objpack-doc_type = 'csv'.
ls_objpack-obj_name = 'ANLAGE'(t06).
ls_objpack-obj_descr = 'Auswertung'(t07).
ls_objpack-doc_size = lv_tab_lines * 255.
APPEND ls_objpack TO lt_objpack.
Füllen der Empfängerliste
CLEAR ls_reclist.
ls_reclist-receiver = 'sgoetbi2b.info'(t08).
ls_reclist-rec_type = 'U'.
APPEND ls_reclist TO lt_reclist.
ls_reclist-RECEIVER = 'DLI-NEUREICH'.
ls_reclist-REC_TYPE = 'P'.
APPEND ls_reclist to lt_reclist.
Versenden des Dokuments
IF p_send = 'X'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_document_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
CASE sy-subrc.
WHEN 0.
WRITE: / 'Ergebnis des Sendevorgangs:'(t09).
LOOP AT lt_reclist INTO ls_reclist.
WRITE: / ls_reclist-receiver(48), ':'.
IF ls_reclist-retrn_code = 0.
WRITE 'erfolgreich versendet'(t10).
ELSE.
WRITE 'nicht versendet'(t11).
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Keine Berechtigung, an die angegebene Anzahl Empfänger zu senden !'(e01).
WHEN 2.
WRITE: / 'Dokument konnte an keinen Empfänger gesendet werden!'(e02).
WHEN 4.
WRITE: / 'Keine Berechtigung zum Senden !'(e03).
WHEN OTHERS.
WRITE: / 'Fehler beim Senden aufgetreten !'(e04).
ENDCASE.
ENDIF. " p_send = 'X'
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.
Unfortunately I only have the program. The reaction has been my colleague. I've assumed that the program creates the csv file and is appended.
Try this, I had the wrong code:
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(AN_EMPFAENGER) TYPE CHAR0064 OPTIONAL
*" VALUE(CC_EMPFAENGER) TYPE CHAR0064 OPTIONAL
*" VALUE(ANHANG_DATEN) TYPE Z_ANHANG_TABELLEN_TYP OPTIONAL
DATA: objpack LIKE STANDARD TABLE OF sopcklsti1 .
*DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: objpack_line LIKE LINE OF objpack .
DATA: objhead LIKE STANDARD TABLE OF solisti1 .
*DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: objhead_line LIKE LINE OF objhead.
DATA: objbin_line TYPE z_anhang_zeile.
DATA: objbin LIKE STANDARD TABLE OF objbin_line.
*DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
" LIKE LINE OF OBJBIN.
DATA: ergebnis_header TYPE znstws4,
ergebnis_daten TYPE znstws4,
ergebniscode_t TYPE int2,
ergebniscode_i TYPE int2,
wa_ergebnis LIKE LINE OF ergebnis_header,
ergebnis_daten_l LIKE LINE OF ergebnis_daten.
DATA: count TYPE int2,
anzahl_spalten TYPE int2,
count_t(2) TYPE c,
feld(30) TYPE c,
temp_feld(40) TYPE c .
FIELD-SYMBOLS: cr_lf.
CALL FUNCTION 'Z_4_BERICHT'
EXPORTING
lieferantennummer = 'AT900119'
zeitraum_art = 'M'
jahr = '2008'
monat = '08'
auswertungs_art = 'LASTGANG'
IMPORTING
ergebnis_liste_header = ergebnis_header
ergebnis_liste_daten = ergebnis_daten
ergebniscode_technisch = ergebniscode_t
ergebniscode_inhalt = ergebniscode_i.
Erstellen des zu versendenden Dokuments
*Verwendung als??????
doc_chng-obj_name = 'Datenversand'.
*Mail-Titel
doc_chng-obj_descr = 'Datenversand vom WebService'.
objtxt_line = 'Die Daten für den Monat mm'.
APPEND objtxt_line TO objtxt.
objtxt_line = 'Die CSV-Datei wurde im Anhang beigefügt.'.
APPEND objtxt_line TO objtxt.
DESCRIBE TABLE anhang_daten LINES tab_lines.
tab_lines_t = tab_lines.
CONCATENATE 'Die Datei enthält: ' tab_lines_t 'Datenzeilen.'
INTO objtxt_line SEPARATED BY space .
*OBJTXT_line = 'Die Datei enthält x tausend Datenzeilen.'.
APPEND objtxt_line TO objtxt .
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines INTO objtxt_line .
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt_line ).
Erstellen des Eintrags zum komprimierten Dokument
CLEAR objpack_line-transf_bin.
objpack_line-head_start = 1.
objpack_line-head_num = 0.
objpack_line-body_start = 1.
objpack_line-body_num = tab_lines.
objpack_line-doc_type = 'RAW'.
APPEND objpack_line TO objpack.
Erstellen der Anlage für das Dokument
LOOP AT ergebnis_header INTO wa_ergebnis.
*zur vereinfachung werden 5 erste befüllte spalten angenommen
IF wa_ergebnis-feld_5 IS NOT INITIAL.
CONCATENATE wa_ergebnis-feld_1 wa_ergebnis-feld_2 wa_ergebnis-feld_3
wa_ergebnis-feld_4 wa_ergebnis-feld_5
INTO objbin_line SEPARATED BY ';' .
count = 5.
ENDIF.
IF wa_ergebnis-feld_6 IS NOT INITIAL.
CONCATENATE objbin_line wa_ergebnis-feld_6
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF wa_ergebnis-feld_7 IS NOT INITIAL.
CONCATENATE objbin_line wa_ergebnis-feld_7
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF wa_ergebnis-feld_8 IS NOT INITIAL.
CONCATENATE objbin_line wa_ergebnis-feld_8
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF wa_ergebnis-feld_9 IS NOT INITIAL.
CONCATENATE objbin_line wa_ergebnis-feld_9
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF wa_ergebnis-feld_10 IS NOT INITIAL.
CONCATENATE objbin_line wa_ergebnis-feld_10
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
*es werden nur die ersten 10 felder abgefragt,
*werden grössere dateien versendet, mit mehr spalten,
*sind hier erweiterungen vorzunehmen
CONCATENATE objbin_line cr_lf
INTO objbin_line .
anzahl_spalten = count.
ENDLOOP.
*kopfzeile wegschreiben
APPEND objbin_line TO objbin .
CLEAR: objbin_line, wa_ergebnis.
LOOP AT ergebnis_daten INTO wa_ergebnis.
*zur vereinfachung werden 5 befüllte spalten angenommen
CONCATENATE wa_ergebnis-feld_1 wa_ergebnis-feld_2 wa_ergebnis-feld_3
wa_ergebnis-feld_4 wa_ergebnis-feld_5
INTO objbin_line SEPARATED BY ';' .
count = 5.
IF count <= anzahl_spalten.
CONCATENATE objbin_line wa_ergebnis-feld_6
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF count <= anzahl_spalten.
CONCATENATE objbin_line wa_ergebnis-feld_7
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF count <= anzahl_spalten.
CONCATENATE objbin_line wa_ergebnis-feld_8
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF count <= anzahl_spalten.
CONCATENATE objbin_line wa_ergebnis-feld_9
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
IF count <= anzahl_spalten.
CONCATENATE objbin_line wa_ergebnis-feld_10
INTO objbin_line SEPARATED BY ';' .
count = count + 1.
ENDIF.
*es werden nur die ersten 10 felder abgefragt,
*werden grössere dateien versendet, mit mehr spalten,
*sind hier erweiterungen vorzunehmen
SHIFT objbin_line LEFT DELETING LEADING ' ' .
CONCATENATE objbin_line cr_lf
INTO objbin_line .
APPEND objbin_line TO objbin .
CLEAR objbin_line.
ENDLOOP.
DESCRIBE TABLE objbin LINES tab_lines.
objhead_line = 'daten_20101116.csv'.
APPEND objhead_line TO objhead.
Erstellen des Eintrags zur komprimierten Anlage
objpack_line-transf_bin = 'X'.
objpack_line-head_start = 1.
objpack_line-head_num = 1.
objpack_line-body_start = 1.
objpack_line-body_num = tab_lines.
objpack_line-doc_type = 'CSV'.
objpack_line-obj_name = 'ANLAGE'.
objpack_line-obj_descr = 'Daten für den Monat MM'.
objpack_line-doc_size = tab_lines * 255.
APPEND objpack_line TO objpack.
Füllen der Empfängerliste
Empfänger bestimmen
reclist_line-receiver = 'mailadress'.
reclist_line-receiver = an_empfaenger.
reclist_line-rec_type = 'U'.
APPEND reclist_line TO reclist.
*weitere empfänger
RECLIST_line-RECEIVER = 'mailadress'.
RECLIST_line-REC_TYPE = 'U'.
APPEND RECLIST_line to RECLIST.
Versenden des Dokuments
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: / 'Ergebnis des Sendevorgangs:'.
LOOP AT reclist INTO reclist_line.
WRITE: / reclist_line-receiver(48), ':'.
IF reclist_line-retrn_code = 0.
WRITE 'erfolgreich versendet'.
ELSE.
WRITE 'nicht versendet'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Keine Berechtigung, an die angegebene Anzahl Empfänger',
'zu senden !'.
WHEN 2.
WRITE: / 'Dokument konnte an keinen Empfänger gesendet werden !'.
WHEN 4.
WRITE: / 'Keine Berechtigung zum Senden !'.
WHEN OTHERS.
WRITE: / 'Fehler beim Senden aufgetreten !'.
ENDCASE.
Edited by: Sarina Goral on Nov 24, 2010 2:10 PM
Similar Messages
-
Send email to a non-sap email address
Hi,
I have to send a notification when one of the condition occurs. I have to send email based on the role of the users, i.e first find the email addresses of the users based on the role and then send email to their non-sap email addresses(like the company outlook email). Can someone tell me the detailed steps need to be followed here..
Thanks in advance,
Henry.hi David,
WELCOME TO SDN
Use FM <b>SO_NEW_DOCUMENT_SEND_API1.</b>
SAP Send mail via ABAP functions SO_NEW_DOCUMENT_SEND_API1
This abap mail sending program demonstrate how you can send a mail to the user SAP Office mailbox.
REPORT ZSEND .
TABLES: KNA1.
data for send function
DATA DOC_DATA LIKE SODOCCHGI1.
DATA OBJECT_ID LIKE SOODK.
DATA OBJCONT LIKE SOLI OCCURS 10 WITH HEADER LINE.
DATA RECEIVER LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
WRITE:/ KNA1-KUNNR, KNA1-ANRED.
send data internal table
CONCATENATE KNA1-KUNNR KNA1-ANRED
INTO OBJCONT-LINE SEPARATED BY SPACE.
APPEND OBJCONT.
ENDSELECT.
insert receiver (sap name)
REFRESH RECEIVER.
CLEAR RECEIVER.
MOVE: SY-UNAME TO RECEIVER-RECEIVER,
'X' TO RECEIVER-EXPRESS,
'B' TO RECEIVER-REC_TYPE.
APPEND RECEIVER.
insert mail description
WRITE 'Sending a mail through abap'
TO DOC_DATA-OBJ_DESCR.
CALL FUNCTION <b>'SO_NEW_DOCUMENT_SEND_API1'</b>
EXPORTING
DOCUMENT_DATA = DOC_DATA
IMPORTING
NEW_OBJECT_ID = OBJECT_ID
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = RECEIVER
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.
http://sapr3.tripod.com/abap011.htm
Regards,
Santosh
Note: Reward Points if helpful -
Error in sending email to users(outside sap)
Hello experts,
We just transported my program to QAS server and I just tested it now if my program to send messages to emails outside works. Unfortunately, it doesn't. I am using FM SO_NEW_DOCUMENT_SEND_API1 and the sy-subrc = 2 whcih means document not sent. Also, there is window that popped up that says
Database error for <ADDR_PERS_COMP_COMM_GET> <0>
Again, thank you guys for all your help and take care!Hi,
Check this
Sending mail To Standard SAP MAIL Box
http://www.sap-img.com/abap/sending-email-with-attachment.htm
SCOT settings
http://www.sap-img.com/basis/basis-faq.htm
Sending External email through SAP
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm\
http://www.sap-img.com/abap/sending-email-with-attachment.htm
Sample Code
Sending External email through SAP
What is the FM for sending the external email through SAP by attaching layout set to it?
These are the FM for sending external email :-
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
How to send a report to an external mail-id?
<b>
Try this sample code :-</b>
REPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = '[email protected]'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
<b>
2nd Program</b>
REPORT ZSENDEXTERNAL.
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.
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
Mail Contents
OBJTXT = 'Minimum bid : $250000'.
APPEND OBJTXT.
OBJTXT = 'A representation of the pictures up for auction'.
APPEND OBJTXT.
OBJTXT = 'was included as attachment.'.
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
(Assume that the data in OBJBIN is in BMP format)
*OBJBIN = ' \O/ '. APPEND OBJBIN.
*OBJBIN = ' | '. APPEND OBJBIN.
*OBJBIN = ' / \ '. APPEND OBJBIN.
*DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'PICTURE.BMP'.
*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 = 'BMP'.
*OBJPACK-OBJ_NAME = 'PICTURE'.
*OBJPACK-OBJ_DESCR = 'Representation of object 138'.
*OBJPACK-DOC_SIZE = TAB_LINES * 255.
*APPEND OBJPACK.
Completing the recipient list
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
*RECLIST-RECEIVER = 'SAPUSERNAME'.
*RECLIST-REC_TYPE = 'P'.
*APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = '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 'The document was sent'.
ELSE.
WRITE 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
Message was edited by: Manoj Gupta -
Sending email in SAP with attachments
Hi ,
Is there any tcode which we can send email with attachements in SAP.
Thanks,
RakeshHi Balaji,
I am looking to send an email to user with attachment of my report in SAP without using broadcasting facility in BW.Wecan send an email though SO01 ,but I can't send attachments through this transaction.
I am also looking for to schedule it biweekly in a month.Please let me know if these options if you have seen before.
Thanks,
Rakesh -
Trouble with SAPconnect / sending email in ABAP-code
Hi,
with the code below I try to send an email from ABAP outside
to an mail-account in the internet.
I'll get no error/exceptions but the mail will be not send
to the internet-mail-account.
In Transaktion SCOT I checked the SAPconnect-Node "INT"-"SMTP".
There is a mailserver with the right IP und the right Port. So I don't understand
what could be the problem!?
Can anybody help me and say me why the code below doesn't works?
Best wishes!
* For API
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
data: mailrec type table of somlrec90 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test'.
append mailtxt.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
endif.
* Start the send process using the following statement
submit rsconn01 with mode = 'int' and return.
Message was edited by:
sebastian eckesSAP is a robust system, which gives many facilities in the form of Function Modules (FMs) for connecting to external systems or for use within the system. With a clever use of these FMs we can achieve a lot of things through ABAP code.
This article focuses on ways to send E-mails and SAP Mails using ABAP code.
Firstly SAP Mail
A SAP mail is a mail internal to the SAP system. It is a very good forum to exchange information with other users. Using a SAP mail in ABAP code facilitates exchange of automatic messages at various stages of the business process. It is easy to use and saves many hassles involved in using workflows for exchanging messages.
The ABAP code to send a sap mail is built around the FM SO_OBJECT_SEND which has the following pattern.
call function 'SO_OBJECT_SEND'
exporting
EXTERN_ADDRESS = ' '
FOLDER_ID = ' '
FORWARDER = ' '
OBJECT_FL_CHANGE = ' '
OBJECT_HD_CHANGE = ' '
OBJECT_ID = ' '
OBJECT_TYPE = ' '
OUTBOX_FLAG = ' '
OWNER = ' '
STORE_FLAG = ' '
DELETE_FLAG = ' '
SENDER = ' '
CHECK_ALREADY_SENT = ' '
importing
object_id_new =
sent_to_all =
tables
OBJCONT =
OBJHEAD =
OBJPARA =
OBJPARB =
receivers =
PACKING_LIST =
ATT_CONT =
ATT_HEAD =
NOTE_TEXT =
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
others = 21.
In the next article we will understand the main parameters and table interfaces of the FM.
Import Parameters Name and Description Field name Field function
Object_hd_change (structure) Contains the process to be done when SAP mail is marked for execution.When the Execute Icon in the SAP mail is clicked the corresponding object is executed vmtyp D for dialog module F for function moduleR for reportT for transactionU for transaction with export
Acnam Name of the object which is to be executed, like name of transaction/report
Skips X to execute first screen in background
Objsns Indicates sensitivity of the object. P for private objectF for functional objectO for confidential objectC for company confidential objectSensitivity level is restricted to O for documents in shared folders
Objla Language of the document E for Englishsy-langu for system language
Objnam Name of the document
Objdes Short description (Title) of the document
Objsrt Name of the sort field. This is used to group documents based on certain criteria
Object_type Type of document to be sent with mail RAW for raw text (default) DOC for word file XLS for excel fileAll classes can be used except for folders (FOL) and distribution lists (DLI)
Outbox_flag X to indicate that mail should also be stored in outbox of the user after sending (default )
Owner Sap login of the user responsible for transmission
Table Parameters Name and Description Field Name Field function
Objcont Table to hold the body of the mail Line Text lines up to 255 characters
Objhead Table to hold number of lines in the body of the mail, i.e size of the table in lines Line Text lines up to 255 characters
Objpara Table to hold the set/get parameters to be transferred to the processing element Name Name of the parameter. Only first three characters are used
Option Not used
Low Value of the parameter in name
High Not used
Objparb Table to hold information for mails to which a certain processing type is assigned. For a report or transaction with transfer of values to global memory, the table has to contain the parameters with relevant values. The memory id is taken from the first row. For a FM or dialog module, data in table will be transferred as table parameter msgdial Name For report or transaction with transfer of values to global memory, the field for first row should hold the name of the memory id used for export and the other rows should hold the parameter names. For FM or dialog module this field should hold the values as per the usage of the module
Value For report or transaction with transfer of values to global memory, the field for first row should remain empty and the other rows should hold values of the parameters. For FM or dialog module this field should hold the values as per the usage of the module
Receivers Table to hold recipient details Recnam SAP login of the recipient. Append all the recipients to this table
Sndcp X for sending mail as a copy
Sndex X for sending as express document. This will prompt a logged on recipient saying that he or she has received an express mail
Recesc B for SAP user E for external email addressU for unix address
Export Parameters Name and Description Field name Field function
Object_id_new Contains object id of document created during send process
Sent_to_all X indicates that document was sent to all recipients. Flag is not activated if sending fails in one or more cases
Main Exceptions Name and Description Description
Too_much_receivers Number of recipients is greater than number for which sender is authorised to send
Object_not_sent Document was not delivered to any of the recipients
Object_not_exist Document class specified does not exist or cannot be sent
Object_no_authorisation Document could not be sent as one of the required authorisations does not exist
Parameter_error Invalid combination of parameter values transferred to FM
X_error Internal error occurred
Once all the parameters and table interfaces are properly filled, call the function module to send the SAP mail to the recipient inbox.
Care should be taken to report the status of execution of the function module to the user using one of the exceptions defined (refer function module pattern above)
Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly. The next article covers sending E-mails using ABAP.
Sending Email to a non-SAP system:
Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly.
Sending an email to the Microsoft Inbox is a way of interacting with a non SAP system through ABAP code and hence is very interesting. A fair knowledge of UNIX shell scripting is assumed here.
The ABAP code to send an email to Microsoft inbox revolves around following UNIX script
Echo "From:" "<"$1">" > <unix file path name>
Echo "To:" "<"$2">" >> <unix file path name>
Echo "Subject:" "<"$3">" >> <unix file path name>
Cat $4 >> <unix file path name>
Uuencode $5 $6 >> <unix file path name>
Cat <unix file path name> | /usr/sbin/sendmail f $fraddr $toaddr
(Note : the commands in the above script can be case sensitive. Check the actual case on the unix installation in question)
Let us understand the various parts of the above script.
$1 = Sender email address
$2 = Recipient email address
$3 = Subject of the email
$4 = Path of unix server file having email body
Form email body as an internal table in ABAP program, download it to a unix server file
$5 = Path of unix server file to be sent as email attachment
$6 = Name to be given to the attachment (like test1.doc, test1.xls). The corresponding Microsoft icon
will be shown in the email for the type of file attached ( Word document, excel document etc)
The script builds a temporary file and pipes the file to the sendmail command to achieve the mission.
This script can be invoked from SAP to send the mail to the intended recipient. Store this small script on the unix server. (Assume script name is sndmail )
To do this we should define a link in the SAP system between a customized command and this unix script.
The FM to define a customized command in SAP system has the following pattern.
call function 'SXPG_CALL_SYSTEM'
exporting
commandname =
PARAMETERS = ' '
importing
status =
tables
exec_protocol =
exceptions
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
others = 12.
In the next article we will understand the main parameters and table interfaces of the FM.
Import Parameters Name and Description Field name Field function
Commandname Name of unix shell script or command to be executed by SAP Name of unix shell script to be invoked
Parameters The parameters to be sent to unix shell script ($1, $2 etc). Send parameters as a concatenated string separated by space and length not exceeding 128 characters For eg in UNIX environment the above shell script would be executed as Sndmail [email protected] [email protected] Trial /home/test.doc testmail.We will be simulating this command using the FM from SAP system
Table Parameters Name and Description Field Name Field function
Exec_protocol (structure) Table to get messages from unix server after shell script is executed Length Length of the message from external program i.e unix
Message Log message from external program i.e unix
Export Parameters Name and Description Field name Field function
Status Contains the status of execution of external program Scheduling status of external program i.e unix
Once the above FM is invoked with the necessary parameters the unix program sendmail will send a mail to the inbox of the recipient in Microsoft.
The restriction on the parameter string length of 128 characters can be removed to make way for very long email addresses and subjects. Build the parameters into an internal table and download it as a file on the unix server. Instead of passing each parameter individually, pass the unix server path of this file as the parameter to the unix shell script (sndmail mentioned above). Modify the shell script to read every line of this parameter file as variables to be used in the shell script.
In the next article we will see an example of the ABAP code you can use to send SAP Mails.
REPORT ZTSAPMAIL.
DATA: X_OBJECT_TYPE LIKE SOOD-OBJTP.
DATA: BEGIN OF X_OBJECT_HD_CHANGE.
INCLUDE STRUCTURE SOOD1.
DATA: END OF X_OBJECT_HD_CHANGE.
DATA: BEGIN OF X_OBJCONT OCCURS 10.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJCONT.
DATA: BEGIN OF X_OBJHEAD OCCURS 0.
INCLUDE STRUCTURE SOLI.
DATA: END OF X_OBJHEAD.
DATA: BEGIN OF RAW_HEAD.
INCLUDE STRUCTURE SORH.
DATA: END OF RAW_HEAD.
DATA: BEGIN OF X_RECEIVERS OCCURS 0.
INCLUDE STRUCTURE SOOS1.
DATA: END OF X_RECEIVERS.
PARAMETERS: RECEIVER LIKE X_RECEIVERS-RECNAM. " Name
*BUILD MESSAGE HEADER
MOVE 'Sort field goes here' TO X_OBJECT_HD_CHANGE-OBJSRT. " Sort field
MOVE 'Name of the object goes here' TO X_OBJECT_HD_CHANGE-OBJNAM. " Name
MOVE 'Document title goes here' TO X_OBJECT_HD_CHANGE-OBJDES. " Title
MOVE 'F' TO X_OBJECT_HD_CHANGE-OBJSNS. " Functional OBJECT
MOVE 'E' TO X_OBJECT_HD_CHANGE-OBJLA. " Language
Object type of the new document
MOVE 'RAW' TO X_OBJECT_TYPE.
CLEAR X_OBJCONT.
MOVE 'Contents of mail' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
CLEAR X_OBJCONT-LINE. APPEND X_OBJCONT.
MOVE 'More contents' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
MOVE 'Still more contents'
to x_objcont-line.
APPEND X_OBJCONT.
MOVE ' ' TO X_OBJCONT-LINE.
APPEND X_OBJCONT.
Specific header (Dependent on the object type, here RAW)
REFRESH X_OBJHEAD.
DESCRIBE TABLE X_OBJCONT LINES RAW_HEAD-RAWSIZ.
MOVE RAW_HEAD TO X_OBJHEAD.
APPEND X_OBJHEAD.
*RECEIVERS table
CLEAR X_RECEIVERS.
REFRESH X_RECEIVERS.
MOVE RECEIVER TO X_RECEIVERS-RECNAM. " Name
MOVE 'B' TO X_RECEIVERS-RECESC. " Receiver type
MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy
MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT
APPEND X_RECEIVERS.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = 'OUTBOX'
forwarder = x_forwarder
object_fl_change = x_object_fl_change
OBJECT_HD_CHANGE = X_OBJECT_HD_CHANGE
object_id = x_object_id
OBJECT_TYPE = X_OBJECT_TYPE
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
store_flag = x_store_flag
importing
object_id_new = x_object_id_new
sent_to_all = x_sent_to_all "May need to use
TABLES
OBJCONT = X_OBJCONT
OBJHEAD = X_OBJHEAD
objpara = x_objpara
objparb = x_objparb
RECEIVERS = X_RECEIVERS.
REPORT ZTUNIXMAIL.
DATA : TO_ADDRESS LIKE SY_LISEL,
FROM_ADDRESS LIKE SY-LISEL,
SUBJECT LIKE SY-LISEL,
ATTACHMENT_NAME LIKE SY_LISEL,
DATA_FILE_PATH LIKE SXPGCOLIST-PARAMETERS,
BODY_FILE_PATH LIKE SXPGCOLIST-PARAMETERS.
DATA : BEGIN OF INT_EMAIL_ATTACH OCCURS 0,
TXTLINE CHAR(255),
END OF INT_EMAIL_ATTACH.
DATA : BEGIN OF INT_EMAIL_BODY OCCURS 0,
TXTLINE CHAR(255),
END OF INT_EMAIL_BODY.
CLEAR : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
REFRESH : INT_EXEC_PROTOCOL,INT_EMAIL_ATTACH,INT_EMAIL_BODY.
INT_EMAIL_ATTACH-TXTLINE = 'Put all attachment text in this table'.
APPEND INT_EMAIL_ATTACH. CLEAR INT_EMAIL_ATTACH.
INT_EMAIL_BODY-TXTLINE = 'Put all attachment text in this table'.
APPEND INT_EMAIL_BODY. CLEAR INT_EMAIL_BODY.
CONCATENATE TO_ADDRESS
FROM_ADDRESS
SUBJECT
BODY_FILE_PATH
DATA_FILE_PATH
ATTACHMENT_NAME
INTO V_PARAMETERS.
IF NOT INT_EMAIL_ATTACH[] IS INITIAL.
OPEN DATASET DATA_FILE_PATH FOR OUTPUT IN TEXT MODE.
LOOP AT INT_EMAIL_ATTACH.
TRANSFER INT_EMAIL_ATTACH-TXTLINE TO DATA_FILE_PATH.
ENDLOOP.
CLOSE DATASET DATA_FILE_PATH.
ENDIF.
IF NOT INT_EMAIL_BODY[] IS INITIAL.
OPEN DATASET BODY_FILE_PATH FOR OUTPUT IN TEXT MODE.
LOOP AT INT_EMAIL_BODY.
TRANSFER INT_EMAIL_BODY-TXTLINE TO BODY_FILE_PATH.
ENDLOOP.
CLOSE DATASET BODY_FILE_PATH.
ENDIF.
CALL FUNCTION 'SXPG_CALL_SYSTEM'
EXPORTING
COMMANDNAME = 'Z_EMAIL' - Command calling unix script
PARAMETERS = V_PARAMETERS
importing
status = ''
TABLES
EXEC_PROTOCOL = INT_EXEC_PROTOCOL
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
OTHERS = 12.
regards,
srinivas
<b>*Reward points for useful answers*</b> -
Workflow is not sending emails
Hello everyone!
I've created a workflow that sends emails on status change of a sales order. Everything works fine in development system, but emails is not sent in QAS system. Workflow is not returning any errors and works as expected but in SOST transaction there is no email processing. What I am missing here? Maybe some configuration?
Configuration of the workflow is the same as in development.
System is SAP CRM 7.0
Regards, Alex.
Edited by: Alexander Milshtein on Jul 22, 2011 7:55 AMHi,
First check if it is even possible to send emails.
from anywhere in SAP just go to system-->short message
Then send it as a mail (I'm not sure if you should use remote, or internet address I'm guessing internet)
Then check if a mail was created at all.
Kind regards, Rob Dielemans -
Hi,
i got a email functionality requirement , i need to send the report output to recipient inbox as an attachment, through outlook.
i know how to send email from sap, but through outlook i am not aware,
how to send email through outlook.
can any one please help me.
Thanks In Advance
raagatiHi,
check below link.
How to send email from outlook to SAP inbox -
Send email with PDF attachements (Smartform/SAP script)
Hello All,
I have 3 existing programs A, B & C whose output is in SAP Script/Smartform. Now I need to create new program D which needs to execute program A, B & C and then convert their smartform/SAP script output into PDF format and send email with attachements (PDF files). Any pointers how I can proceed. Thanks a lot.hi Sarita,
v_ctrlparams-no_dialog = 'X'.
v_ctrlparams-getotf = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Smartform name'
IMPORTING
fm_name = v_func_mod.
CALL FUNCTION v_func_mod
EXPORTING
control_parameters = v_ctrlparams
IMPORTING
job_output_info = v_joboutput
TABLES
t_nonsigner = t_nonsigner.
fill the document
doc_chng-obj_name = 'Descriptoipn'.
Fill the subject line
doc_chng-obj_descr = 'Manpowe'.
doc_chng-obj_descr = 'Reminder .
doc_chng-sensitivty = 'P'.
Fill the content of the mail
objcont = 'Dear all,'.
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
objcont =
'The manpower sign-off is pending for the list of employees as per th' &
'e attached sheet.'
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
objcont =
'Please click on the following link for the manpower sign-off:'.
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
DESCRIBE TABLE objcont LINES entries.
READ TABLE objcont INDEX entries.
doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).
Creating 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 = entries.
objpack-doc_type = 'RAW'.
APPEND objpack.
Creating the document attachment
(Assume the data in OBJBIN are given in BMP format)
LOOP AT v_joboutput-otfdata INTO wa_otfdata.
APPEND wa_otfdata TO objbin.
CLEAR wa_otfdata.
ENDLOOP.
DESCRIBE TABLE objbin LINES tab_lines.
objhead = 'NonSignerDetails.otf'. APPEND objhead.
Creating 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 = 'OTF'.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'NonSignerDetails'.
objpack-doc_size = tab_lines * 255.
APPEND objpack.
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 = objcont
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
hope this will help u..
regards,
Santosh Thorat -
Broadcasting to send an email per project dynamically ?
Hi all,
The requirement of the business is the following :
We want to send in an automated way a report to all PM (Project Manager) managing project in which they are in charge of.
Every PM will receive 1 email per project he is in charge of.
In standard broadcaster, we have the option u201Cbroadcast data burstingu201D but it unables to do dynamically, that is to say we do not know in advance project manager name. Each time we want to test, we have to select le Project Manager name.
Following are the steps :
1. We have created a query (A) with the required results and Infoobject 0Project Manager (ZXRESP) in drilldown. We have added an info-object email-address as attribute to info-object 0Project Manager (ZXRESP)
2. We have created a new setting of type bursting -.
a. On tab 'Recipient Determination' ->'Characteristic for Recipient Determination ' use 'Filter Document by Characteristic Value ' and select '0Project Manager ' as Characteristic
b. 'Attribute for Recipient Determination' - Infoobject-emailaddress and 'Attribute Value Is '-->E-Mail address
3. In section 'Selection of the Characteristic Values ' we have chosen u201CBy Following Selectionu201D and have to select project manager name. We would like to avoid this step manually but use in automatically way
If the fact to choose 'By Control Query' and use a variant to provide the necessary parameter can accomplish the requirement ? Do you have any solution for that ? Thank you in advance.
All help are welcomed.
Regards,
KevdinCheck this blog:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/20d671c6-b377-2d10-7488-b75841c389a3
Here we are creating a program and running it in background and that populates the values of the date variables.
I think you can use the same to populate your varialbles.
Please do close the thread if that answers your questions. Please help us keep the forums clean and open useful information only.
For more information search on help.sap.com and you will get lots of material.
Regards.
Den -
Cannot Send Email from SAP Business One
Hi Experts
I have configured SAP Email Services from the Mailer Service and Customer can send emails all the while,
Now I have an Issue for One User,
Iam using the Same Machine, Same Database with Manager Login, I can send Email from SAP with Attachments
But When I use another Super user the system is not delivering the Email and it Goes to the Sent box (but not delivered)
Have anyone encountered the Issue before
Please hep to solve this issue permanently
Thanks and Regards
Vinodh Kumar MohanHi Vinodh Kumar Mohan,
If the email can be found in Sent box, it must be delivered already.
The problem could be on the email recipient side. It may go to the junk mail.
Thanks,
Gordon -
Send email from SAP using SMTP-AUTH
Dear all,
I would like to send email from SAP to external SMTP server using authenticated method.
Can I set up this scenario with SAPConnect?
Or are there any other methods to set up this scenario?
Thanks, Regards,
FendhyHi,
You dont need anu authentication to be set :
Just follow below steps :
Simple steps to do the SMTP configuration :
1. Use transaction SCOT
3. Double Click on SMTP
4. You will get a window and fill in description
5. Tick the "Node in use" box
6. Enter the hostname of the email exchange server
7. Mail port will be 25
8. Click on the button next to Internet called "Set"
9. You will get another window, in the "address area" box, enter *
10. Click the green check button to exit the second window
11. Click the green check button to exit the main window
12. From top menu: Settings -> Default Domain
13. in the small box that appears enter the domain name which is the last part after the @ sign. The domain name would be company.com
14. You need to define a job to process the email, from top menu: View -> Jobs
15. From top menu: Job -> Create
16. Enter a name
17. Click on "INT" in the list then "Schedule job" button
18. Enter start date and time, then click on "Schedule Periodically" button
19. Enter something like every 10 minutes.
20. the configuration is now complete. To test it, you need to have an email defined in your user id properties. Use SU01 for that.
21. Use transaction SO00
22. Put Title, and text in the body, then enter your email address below, the recepient type would be "internet address"
23. After a maximum of 10 minutes you should get the email address.
Regards,
Nirmal.K -
Send email from SAP with more than one attachment
Hi all,
How can i send email with more than one attachment and different types of document(doc,pdf,etc.) from SAP to external?
Besr regards,
MunurHi,
I use :
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
the main problem with different attachemts is to genereate the packing_list.
the packing list is a kind of description of the data table... where ist the start of an image, end, size...
"Creation of the entry for the compressed attachment
objpack-transf_bin = 'X'. " it could be an image
objpack-head_num = lv_head_num_count . " inital 1 each att add 1
objpack-head_start = 1. " fix
objpack-body_start = gv_startnum. " table with attachments 1. line one
objpack-body_num = tab_lines. " how many lines are in the table of attachment
objpack-doc_size = tab_lines * 255. " size of the attachment...
objpack-doc_type = lv_typ . " 'JPG'.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = lv_stripped_name " name of the JPG
APPEND objpack.
APPEND LINES OF lt_goscontent TO gt_maildata. " data Table...
bestreg
robert -
How to send automatic EMail from SQL or SAP B1
hi experts as we are using SQL as DB i ned to send E-mails from sap system automatically but from SBO mailer or Scheduler is not working from my side now i was planning to send emails from SQL can any one help me how to send emails automatically from SAP business one or from SQL
Hi
In SQL under Management\Database Mail
You can configure account you use to send mails from SQL
Then you can prepare procedure that will send mail
for example
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Hurtpol',
@recipients = '[email protected]',
@query = 'select isnull(syncherror,'''') collate polish_ci_as
from np.dbo.OITM
where U_SynchStatus=''Failed''',
--@body = @tresc,
@subject = 'synch error'
read about sp_send_dbmail -
To send an email from outlook to SAP user in SAP
Hi,
Is it possible to send an email from outlook to SAP user in SAP?
Regards,
MizanHi Mizan......
Yes off course it is possible.
Generally how we put the CC to our ionternal users like you have to put their email address while sending mail through SAP viq outlook.
The mail will go from SAP but via. outlook and user will receive the mail in Outlook Integration and not inside B1.......
If you want it in B1 then instead of sending mail you can send the same by choosing option Int......
Regards,
Rahul -
Trigger to Send Seperate Emails per Address on New Subscricption Insert
Hi Everyone,
I am trying to create a trigger that, on insert into and delete from a email_subscription table, will send an email to our MailMan server to subscribe or unsubscribe a member for each email address they have. The problem is I am not sure how to get the information form the other two related tables required to compose the message(s).
The tables are:
Email_Subscription (Member, Email_List)
Email (Member, Email)
EmailList (EmailListID, Email_List)
(where Email_Subscription.Member = Email.Member and Email_Subsciption.Email_List = EmailList.EmailListID)
A Member can have zero or more Email addresses but can only have one Email Subscription per Email List.
So this code:
utl_mail.send(
'[email protected]', --From
EmailList.Email_List || '[email protected]', --To
'', --BCC
'', --CC
'subscribe nodigest address=' || Email.Email, --Subject (subscribe on insert, unsubscribe on delete)
'', --Message
'text/plain; charset=us-ascii', --Email type
3); --Priority
Should be executed for each address the member has when a new email subscription is entered for them or to put it another way, the code should be run for each result of this query:
Select E.email, EL.email_list
From emaillist EL, email E
Where :NEW.member = E.member
And :NEW.email_list = EL.emaillistid
I know how to write a trigger that will insert a record once into another table but cannot work out how to run code for multiple records from related tables.
BTW I am using Oracle XE running on Windows 2003 and Utl_mail is set up and tested.
Any help is much appreciated.Welcome to OTN.
I'm not sure sending a mail through trigger is at all a good option or not though it sounds rational but would like to share some thoughts.
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.08
satyaki>
satyaki>
satyaki>create table email_subq
2 (
3 sr_no number(5),
4 s_name varchar2(40),
5 s_mail varchar2(60)
6 );
Table created.
Elapsed: 00:00:01.02
satyaki>
satyaki>create table send_mail_log
2 (
3 recipient_name varchar2(40),
4 email_id varchar2(60)
5 );
Table created.
Elapsed: 00:00:00.00
satyaki>
satyaki>create or replace trigger subsq_notifier
2 before insert on email_subq
3 for each row
4 begin
5 insert into send_mail_log values(:new.s_name,:new.s_mail);
6 end;
7 /
Trigger created.
Elapsed: 00:00:00.09
satyaki>
satyaki>
satyaki>insert into email_subq values(1,'SATYAKI','[email protected]');
1 row created.
Elapsed: 00:00:00.01
satyaki>
satyaki>select * from email_subq;
SR_NO S_NAME S_MAIL
1 SATYAKI [email protected]
Elapsed: 00:00:00.00
satyaki>
satyaki>select * from send_mail_log;
RECIPIENT_NAME EMAIL_ID
SATYAKI [email protected]
Elapsed: 00:00:00.00
satyaki>
satyaki>insert into email_subq values('A1','BILLY','[email protected]');
insert into email_subq values('A1','BILLY','[email protected]')
ERROR at line 1:
ORA-01722: invalid number
Elapsed: 00:00:00.01
satyaki>
satyaki>select * from email_subq;
SR_NO S_NAME S_MAIL
1 SATYAKI [email protected]
Elapsed: 00:00:00.00
satyaki>
satyaki>select * from send_mail_log;
RECIPIENT_NAME EMAIL_ID
SATYAKI [email protected]
Elapsed: 00:00:00.00
satyaki>
satyaki>rollback;
Rollback complete.
Elapsed: 00:00:00.00
satyaki>
satyaki>select * from email_subq;
no rows selected
Elapsed: 00:00:00.00
satyaki>
satyaki>select * from send_mail_log;
no rows selected
Elapsed: 00:00:00.00Now, check the last part. If user somehow rollback it - still your mail will be send to the recipient which might be annoying for the user - i guess. ;)
So, my suggestion would be do not implement this kind of mailing approach through trigger. You can store them in any intermediate table and then after thorough verification you can send the mail using any job or scheduler that available in your version.
Regards.
Satyaki De.
Maybe you are looking for
-
How to migrate from BE6000 to Communications Manager
Dear forum members, first of all, I'am tired. I have been on a long journey from the day we bought our Cisco Unified Communication system until now. Technically everything worked just fine, right from the beginning until now. But starting from the fi
-
NLS_DATE_FORMAT in DB trigger
Hi all, I have a problem with NLS_date_format, there exists in database such a trigger CREATE OR REPLACE TRIGGER TR_MZDR1_BRIU BEFORE INSERT OR UPDATE OF col2 ,col3, col4, col5, col6 on MAN_TAB1 FOR EACH ROW begin IF INSERTING THEN select SEQ_id11.ne
-
What exactly is balance in Oracle Payroll. Can someone give an example pls
Hi I am a newbie to Oracle Payroll. Could some one xplain what exactly is balance in Oracle Payroll. Can someone give an example pls. Is there any link which would be useful to clearly explain this.
-
Why is serial number suddently invalid?
Having used PS4 for years and having installed it on several computers, I suddently have an "invalid" serial number. After hours on "chat" and finally by phone I was told that my serial number had been "invalidated". I was instructed to go back to
-
In CS3 and apparently CS4 there was an option when exporting out an epub to not optimize/do-anything to the image files. In CS5 it insists on not only resaving them, but also inexplicably re-naming the files. So my perfectly taylored and optimized im