PO creation & send mail
Hai,
I am new to workflow area.
I would like to create workflow for PO creation & send mail. can any body guide me for this?
Any documentation please send me.
With Regards,
Jaheer.
Hi Jaheer,
In Basic Data you have to give the Start Event. For that You Use Standard Bus 2012 and "Changed/Created" Event.
After that, you have to Double click the "Undefined Step Size" and Choose "Send Mail" step Types.
Then Give Any text to the body of the mail and also Give the User Name Who receives the mail.
Save and activate and then Check the mail in Business workplace(sbwp).
Thanks.
Reward If Helpful.
Similar Messages
-
Sending Mail on the Failure of Outbound IDOC Creation
Hi Experts
I Have a requirement to send mail on failure of Outbout creation . Any standard report exists ?
Any sample programmes
Thanks and regards
RMPI think what you are asking for is possible, but I'm not sure how. Try posting this question on the Process Integration forum (PI uses iDocs), I'm sure someone will know the answer.
-
Sending mails when save button clicked on KS01 - Cost Center creation
I Want to send a email to my officials when i entered the data and click a saved button in KS01 after or before creating Cost Center..
Hi Ravi,
The package for ks01 is KBAS.
In this u have exit COOMKS02 before saving.
So write logic to send mail in the function module of this user exit which is triggered before saving.
Regards,
Vineesh. -
Sending mail to OUTLOOK from SAP when error encountered in MM creation
Hi ,
I am able to send a message to SAP inbox which i can view from SBWP. But as well i need to send mail to the OUTLOOK .How can i send this OUTLOOK .
I have configured the mail id in SCOT.
Even i configured in SCOT with BASIS team i m not able to send mail to outlook.I even checked in SOST their is no entry in that .
Is their a need for writing separate logic for sending mail to OUTLOOK as well?
Regards,
Ranjith ,
+91-8431858286.HI Modak,
Please help me in getting out of this error encountered during a sample workflow thing.
Here is the requirement I need to send a OUTLOOK mail from SAP.If the user accepts the workflow task then mail need to send a recipient ,stating that he accepthed the request.
Below I designed that task.
In send Mail step I added the recipent thing as stated below.But I was unable to send mail to OUTLOOK .In this I am not even getting notification in my SBWP in SAP INBOX. -
How to send Mail in case of Output Determination - Transmission medium 5
Dear Friends,
I have a below requirement.
- Create custom output type having Transmission medium 5, which triggers on creation of order.
- Write driver program attached to that output type that sends e-mail to the person who has created the order.
- Mail contain information regarding pricing for individual line item wise.
I have gone through many posts but not sure about process of generate the mail in case of Transmission medium 5.
My query is:
Do we require to write FM (SO_NEW_DOCUMENT_ATT_SEND_API1) to send e-mail to respective person or it will take care by system (Transmission medium 5)?
If FM not required then how can we write code that triggers the mail to specific mail ID?
NilayYes, for your custom requirement you will have to create a Z report.
LIke your requirement must be to put something specific in mail body or attach something with mail. All this will not be catered by the standard report maintained against your output type and transmission medium.
As i understand for any output type a message is triggerd and stored in database table (like NAST) and then these requests are picked by standard report (like RSNAST00). These reports then in return call the Program/form maintained against the ouptut type and transmission medium (table TNAPR).
So i would suggest that create a custom report and use the FM for sending mails. These FMs are pretty simple to use. Find a sample code in the below link:
[http://wiki.sdn.sap.com/wiki/display/ABAP/SendExternalMailwithattachment] -
Cannot Send Mail from my iPhone 4s
I am no longer able to send out replies or new emails from my phone, this is very recent and I have tried everything I know of.. But I am not THAT tech-savvy.
So, anyways, when I go to send an email or reply to one, I get a pop-up box that says "Cannot Send Mail - The username or password for "said"-hotmail account is incorrect." So then I go to the settings enter my correct password for my hotmail account, it accepts it, and try again. Same pop-box appears, even though my password and username are both correct. I know that they are correct because I am able to receive email with no problems at all.
Is this a fixable problem or should I call Apple or take my phone in directly to them and have one of the techs look at it ?
Thanks;
OdyssyProblems with sending mail is rooted in the settings for the SMTP server. There are places in this that say the username and password are optional, but normally are required by many email providers. Go back into the SMTP server settings and check all of the areas. I also agree with Doctor9fan to check your SSL settings. If you cannot get it to work like this, then remove the account from the device and add it back. As you complete the creation, make sure the account verifies. You can also check the Microsoft site to make sure settings are correct for Hotmail.
-
I have been emailing pictures from my ipad to my computer and have been going along nicely and now when I went to send 5 pictures to my computer from my ipad I am getting a message that says " cannot send mail The message was rejected by the server" cannot understand why this is happening and have not been able to fix. Now when I try to send pictues even to another email address I am getting the same message.
Help.Email may not be the best way to move pictures.
There are lots of ways of moving files.
A simple and popular way to copy files and share files among your devices.
https://www.dropbox.com/
"Box lets you store all of your content online, so you can access, manage and share it from anywhere. Integrate Box with Google Apps and Salesforce and access Box on mobile devices" Rated the most secure cloud storage by SkyHigh Networks.
https://www.box.com/
Using iTunes to transfer files:
http://support.apple.com/kb/HT4094?viewlocale=en_US&locale=en_US
Files Connect -- "Cloud Storage services like Dropbox, MobileMe iDisk, Google Docs/Picasa, Facebook photos, FTP, SFTP, WebDAV ... AFS (Apple File Shares) SMB (Windows shares) protocols"
https://itunes.apple.com/us/app/files-connect/id404324302?mt=8
Windows File server
http://itunes.apple.com/us/app/filebrowser-access-files-on/id364738545?mt=8
"The kiteworks mobile file sharing solution provides secure creation, viewing, and sharing of enterprise content on smartphones and tablets while providing IT and security teams the administrative controls to manage user privileges and access rights necessary to ensure enterprise security and compliance." " Includes choice of private cloud on-premise."
http://www.accellion.com/solutions/mobile-enablement/mobile-file-sharing
"Dukto is a simple application that allows you to share files between devices connected to the same (wireless) LAN network."
http://www.tidal.it/?page_id=309&lang=en
http://www.msec.it/blog/?page_id=11 -
Send mail to non-sap using bapi's
hi friends,
Can any one please help me how to send mail from sap to non-sap systems using bapi's.plesae help me .i want the procedure and code
regards
srikanth.vHi,
Use this sample Code...
REPORT ZSENDMAIL.
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.
in this code....Internal table IF RECLIST-RETRN_CODE is not 0,then the mail is not send to the recipient, so if you want the undeliverable mail for a perticular recipient then call the same function module SO_NEW_DOCUMENT_ATT_SEND_API1 with undeliverd message to whom want to receive the undeliverd message.
hope this solves your problem -
Problem in sending mail with PDF attachment
Hi all,
Kindly check this code..
I neeed to send the smartform as a PDF attachment..
PDF generated form of smartform is generated successfully..
<b>but PDF going as attachment is showing errors in opening</b> .
Please help me to solve this issue as soon as possible
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
doc_chng-doc_size = tab_lines * 255.
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
DESCRIBE TABLE objbin LINES tab_lines.
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = tab_lines * 255 .
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'SMART'.
objpack-obj_descr = 'test'.
APPEND objpack.
Completing the recipient list
target recipent
CLEAR reclist.
reclist-receiver = '[email protected]'.
reclist-express = 'X'.
reclist-rec_type = 'U'.
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
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 99.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
ajithHello Ajith,
Use this Code.
Internal Table declarations
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST1'
importing
fm_name = v_form_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
Fehlerhandling
if sy-subrc <> 0.
endif.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body
Title and Description
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
Attachment
(pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
append i_objpack.
clear i_reclist.
i_reclist-receiver = '[email protected]'.
i_reclist-rec_type = 'U'.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_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 helped reward points
Vasanth -
SO_OBJECT _SEND or SO_NEW_DOCUMENT_SEND_API1 to send mail
I am facing the problem in sending mail while using FMs SO_OBJECT _SEND
Or
SO_NEW_DOCUMENT_SEND_API1.
Am I missing some thing while passing. Codes were attached here with this mail.
Could you please suggest me Which parameters I missed while supplying to FM.
None of the codes are working.
Could you please suggest me which one is preferable.
======================================
REPORT ZCONSOLIDATED_02.
DATA : GS_MAIL_HEADER LIKE SOOD1.
DATA: GT_MAIL_CONTENT TYPE STANDARD TABLE OF SOLI WITH HEADER LINE.
DATA: GT_RECEIVER_LIST TYPE STANDARD TABLE OF SOOS1 WITH HEADER
LINE.
*-- Fill Mail Header
PERFORM FILL_MAIL_HEADER.
Populate the document_data
PERFORM FILL_DOCUMENT_DATA.
Populate the reciever table
PERFORM POPULATE_RECIEVER.
Call the function module to send the emails
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
OBJECT_HD_CHANGE = GS_MAIL_HEADER
OBJECT_TYPE = 'RAW'
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
ORIGINATOR_TYPE = 'U'
TABLES
OBJCONT = GT_MAIL_CONTENT
RECEIVERS = GT_RECEIVER_LIST
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.
*& Form FILL_MAIL_HEADER
text
form FILL_MAIL_HEADER .
CLEAR GS_MAIL_HEADER.
GS_MAIL_HEADER-OBJLA = 'E'.
GS_MAIL_HEADER-OBJNAM = 'Dedicated SO change'(041).
GS_MAIL_HEADER-OBJSNS = 'P'.
GS_MAIL_HEADER-OBJPRI = '2'.
CONCATENATE 'Dedicated SO'
'GT_VBAP-VBELN'
'LV_PO_NUMBER'
' - Change'
INTO GS_MAIL_HEADER-OBJDES
SEPARATED BY SPACE.
endform. " FILL_MAIL_HEADER
*& Form FILL_DOCUMENT_DATA
text
form FILL_DOCUMENT_DATA .
GT_MAIL_CONTENT-LINE = 'Size PO QTY Recieved QTY' .
APPEND GT_MAIL_CONTENT.
GT_MAIL_CONTENT-LINE = 'Size PO QTY Recieved QTY' .
APPEND GT_MAIL_CONTENT.
endform. " FILL_DOCUMENT_DATA
*& Form POPULATE_RECIEVER
text
form POPULATE_RECIEVER .
CLEAR : GT_RECEIVER_LIST[],
GT_RECEIVER_LIST.
GT_RECEIVER_LIST-RCDAT = SY-DATUM.
GT_RECEIVER_LIST-RCTIM = SY-UZEIT.
GT_RECEIVER_LIST-SNDPRI = '1'.
GT_RECEIVER_LIST-SNDEX = 'X'.
GT_RECEIVER_LIST-RECNAM = 'U-'.
GT_RECEIVER_LIST-RECESC = 'U'.
GT_RECEIVER_LIST-SNDART = 'INT'.
GT_RECEIVER_LIST-SORTCLASS = '5'.
GT_RECEIVER_LIST-RECEXTNAM = 'LV_SMTP_ADDR'.
APPEND GT_RECEIVER_LIST.
endform. " POPULATE_RECIEVER
ORRRRRRR
Report SEND_MAIL .
*& Form SEND_MAIL *
This routine is to send mail to concerned DL. *
form SEND_MAIL .
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
data: mailrec type table of somlrec90 with header line.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test mail'.
maildata-obj_langu = sy-langu.
Loop at your ITAB here and append the row of ITAB
to mailtxt.
mailtxt-line = 'This is a test for send mail'.
append mailtxt.
mailrec-receiver = 'name at the ratecompany.com'.
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.
endform. " SEND_MAILHi,
Check this code.
DATA: p_title(50),
em_body LIKE solisti1 OCCURS 10 WITH HEADER LINE,
v_sysdate(12),
v_systime(10).
DATA : attach_rec TYPE i.
DATA: "objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
"objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
"doc_chng LIKE sodocchgi1,
"tab_lines LIKE sy-tabix.
*_ Start of E-mail content.
APPEND em_body.
CLEAR v_sysdate.
em_body = 'Thanks,'.
'Note: This is System generated message. Please do not reply'.
APPEND em_body.
IF sy-sysid <> 'P01'.
CONCATENATE 'Exp Compliance Notification' sy-sysid ':' vbak-vbeln
INTO p_title SEPARATED BY space.
ELSE.
CONCATENATE 'Export Compliance Notification order' vbak-vbeln
INTO p_title SEPARATED BY space.
ENDIF.
PERFORM SEND_MAIL_SUPPORT TABLES EM_BODY USING P_TITLE.
Creation of the document to be sent
doc_chng-obj_name = 'Materials'.
*DOC_CHNG-OBJ_DESCR = 'Please check the error message'(002).
doc_chng-obj_descr = p_title.
APPEND LINES OF em_body TO 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.
DESCRIBE TABLE imail107 LINES attach_rec.
IF attach_rec GE '1'.
*Start of email attachement of internal table conversition
objbin-line =
'Item Material Number Ans1 Ans2 Ans3 Signed by'.
APPEND objbin.
CLEAR objbin.
LOOP AT imail107 INTO wa_mail107.
exp-record+0(06) = wa_mail107-posnr.
exp-record+8(26) = wa_mail107-matnr.
exp-record+30(2) = wa_mail107-zans01ind.
exp-record+39(2) = wa_mail107-zans02ind.
exp-record+47(2) = wa_mail107-zans03ind.
exp-record+54(35) = wa_mail107-name1.
objbin-line = exp-record.
APPEND objbin.
CLEAR: objbin, exp-record.
ENDLOOP.
APPEND LINES OF imail107 TO objbin.
objbin-line =
'Answers: 1 = Disagreed 2 = Agreed'.
APPEND objbin.
CLEAR objbin.
*end of email attachement of internal table conversition
DESCRIBE TABLE objbin LINES objpack-body_num.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-doc_size = objpack-body_num * 255.
objpack-doc_type = 'DOC'.
objpack-obj_descr = 'Materials'. " Description
APPEND objpack. CLEAR objpack.
ENDIF.
*_ Receiver
reclist-receiver = zsd100-zdata.
reclist-rec_type = 'U'.
reclist-copy = 'X'.
APPEND reclist.
CLEAR reclist.
ENDSELECT.
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.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
REFRESH: objpack,
objhead,
objbin,
objtxt,
reclist.
clear: doc_chng. -
Sending mail to GROUP ID when a process chain fails.
Hi All,
Can one suggest me, how to send a failure/success mail to a Group mial id when a process chain fails.
I am awere about sending mails to individual mail id's when a any process fails or succed. I want to know the group ID creation part & how to tag the same SOCT.
Thanks in advance.
BR,
Kiron.hi,
The Distribution List/Group_id is created in SO23 transaction.
hope it is helpful to u
thanks -
Can't Send Mail with Same Outgoing Server
I have 2 Roadrunner accounts that use the same outgoing smtp server. In order for me to send email (receiving POP email is not a problem), I have to set the outgoing server for port 25, no SSL and no authentication. I can get one of the accounts to work. But, when I try to set up the 2nd roadrunner account with the same settings on the same outgoing server, I get an error from OSX mail telling me the following:
"Could not save the changes
The servers marked with alert icons are in conflict and cannot be saved. Two servers cannot share the same address and authentication settings. Resolve the conflicts and try again."
Can someone help me figure out how to get around this? I'd really like to send mail from my accounts.
Thanks!Venom51 wrote:
I have 2 Roadrunner accounts that use the same outgoing smtp server. In order for me to send email (receiving POP email is not a problem), I have to set the outgoing server for port 25, no SSL and no authentication. I can get one of the accounts to work. But, when I try to set up the 2nd roadrunner account with the same settings on the same outgoing server, I get an error from OSX mail telling me the following:
"Could not save the changes
The servers marked with alert icons are in conflict and cannot be saved. Two servers cannot share the same address and authentication settings. Resolve the conflicts and try again."
Welcome to Apple's discussion groups.
Perhaps I'm missing something, but can't you have both accounts use the same SMTP server? If you're still trying to create the second account using the account creation wizard, I'd try giving it dummy SMTP information, then change it to use the real SMTP server once the account is created. -
Sending mail attachment as XML file
Hi Experts,
I have a XML in an ITAB.
I want to send this data as a mail attachment, any body help, if any one have sample code please send me.
Thanks,
Regards
Venkathi
chk the sample code
REPORT ZMAIL_XLS NO STANDARD PAGE HEADING.
Data for mailing purpose
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 required for preparing XLS type attachment
DATA: V_TABS TYPE X VALUE '09',
V_NEW_LINE TYPE X VALUE '0D'.
START-OF-SELECTION.
Prepare data to send
PERFORM PREPARE_DATA.
Send mail with XLS attachment
PERFORM SEND_MAIL.
*& Form send_mail
form send_mail.
Creation of the document to be sent
DOC_CHNG-OBJ_NAME = 'TEST'.
DOC_CHNG-OBJ_DESCR = 'TEST MAIL WITH XLS
ATTACHMENT'. "mail subject
OBJTXT = 'Test mail with XLS attachment'.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
APPEND OBJTXT.
OBJTXT = 'Please double click the attachment to
verify'.
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.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'Sample XLS attachement'. "
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 = 'XLS'.
OBJPACK-OBJ_NAME = 'TEST'.
OBJPACK-OBJ_DESCR = 'Test.XLS'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
Completing the recipient list
For sending mail to Internet Address
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
For sending mail to SAP user ID
RECLIST-RECEIVER = 'fing087'.
RECLIST-REC_TYPE = 'B'.
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 :/ 'MAIL SENT....'.
WHEN 1.
WRITE :/ 'TOO MANY RECEIVERS'.
WHEN 2.
WRITE :/ 'DOCUMENT NOT SENT'.
WHEN 4.
WRITE :/ 'NO SEND AUTHORIZATION'.
WHEN OTHERS.
WRITE :/ 'ERROR OCCURED WHILE SENDING
MAIL'.
ENDCASE.
endform. " send_mail
*& Form PREPARE_DATA
FORM PREPARE_DATA.
CONCATENATE 'NAME'
'ADDRESS'
'PHONE'
INTO OBJBIN-LINE
SEPARATED BY V_TABS.
APPEND OBJBIN.
CLEAR OBJBIN.
CONCATENATE 'Hajira'
'MIG-2022'
'23025487'
INTO OBJBIN-LINE SEPARATED BY V_TABS.
CONCATENATE V_NEW_LINE OBJBIN-LINE INTO
OBJBIN-LINE .
APPEND OBJBIN.
CLEAR OBJBIN.
CONCATENATE 'Faiz'
'MIG-2022'
'23025487'
INTO OBJBIN-LINE SEPARATED BY V_TABS.
CONCATENATE V_NEW_LINE OBJBIN-LINE INTO
OBJBIN-LINE .
APPEND OBJBIN.
CLEAR OBJBIN.
ENDFORM. " PREPARE_DATA
**reward if helpful
regards,
madhumitha -
Hi experts,
Can any body tell me what settings need to be done in SAP System while sending an email thru an ABAP pgm.
RegardsHI,
*& Report ZLAXMI_ALVMAIL2 *
REPORT ZLAXMI_ALVMAIL2 MESSAGE-ID ZZ .
TABLES: MARA, MAKT.
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 document to be sent.
DOC_CHNG-OBJ_NAME = 'Mailing List'.
DOC_CHNG-OBJ_DESCR = 'Materials report'.
*type declarations
*To store material data
TYPES: BEGIN OF T_MARA,
MATNR TYPE MARA-MATNR,
PSTAT TYPE MARA-PSTAT,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
MEINS TYPE MARA-MEINS,
END OF T_MARA.
*--To store Material Description
TYPES: BEGIN OF T_MAKT,
MATNR TYPE MAKT-MATNR, " Material Number
MAKTX TYPE MAKT-MAKTX, " Material Description
END OF T_MAKT.
TYPES: BEGIN OF T_FINAL,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
PSTAT TYPE MARA-PSTAT,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
MEINS TYPE MARA-MEINS,
END OF T_FINAL.
*Internal table declarations.
*--Internal Table to store Material Description
DATA: IT_MAKT TYPE STANDARD TABLE OF T_MAKT,
*--Internal Table to store Material details
IT_MARA TYPE STANDARD TABLE OF T_MARA,
IT_OBJTXT TYPE STANDARD TABLE OF SOLISTI1 , "object text
IT_OBJPACK TYPE STANDARD TABLE OF SOPCKLSTI1 ,
" attachment table
IT_OBJBIN TYPE STANDARD TABLE OF SOLISTI1 ,
" binary table
IT_OBJHEAD TYPE STANDARD TABLE OF SOLISTI1 ,
" object header table
*--Internal Table to hold Final records to download/display
IT_FINAL TYPE STANDARD TABLE OF T_FINAL.
DATA: IT_RECLIST TYPE STANDARD TABLE OF SOMLRECI1. "Workarea for internal table
DATA: X_MAKT TYPE T_MAKT, "Work area for IT_MAKT
X_MARA TYPE T_MARA, "Work area for IT_MARA
X_FINAL TYPE T_FINAL, "Work area for IT_FINAL
V_TEXT(255) TYPE C.
*--Work area for all the internal tables used
DATA : WA_OBJPACK TYPE SOPCKLSTI1,
WA_OBJHEAD TYPE SOLISTI1 ,
WA_OBJBIN TYPE SOLISTI1 ,
WA_OBJTXT TYPE SOLISTI1 ,
WA_RECLIST TYPE SOMLRECI1 .
CONSTANTS: C_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
*selection screen.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
SELECTION-SCREEN: END OF BLOCK B1.
*at selection screen.
*AT SELECTION-SCREEN.
PERFORM VALIDATE_SCREEN.
*start of selection.
START-OF-SELECTION.
PERFORM GET_MARA_DETAILS.
PERFORM GET_MAKT_DETAILS.
PERFORM FINAL_DATA.
*end of selection
END-OF-SELECTION.
PERFORM SEND_MAIL_DATA.
PERFORM DISPLAY_DATA.
*& Form validate_screen
text
--> p1 text
<-- p2 text
*FORM VALIDATE_SCREEN .
DATA: LV_MATNR TYPE MARA-MATNR.
IF NOT S_MATNR[] IS INITIAL.
SELECT MATNR INTO
LV_MATNR
UP TO 1 ROWS
FROM MARA
WHERE MATNR IN S_MATNR.
ENDSELECT.
ENDIF.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Invalid material'.
ENDIF.
*ENDFORM. " validate_screen
*& Form get_mara_details
text
--> p1 text
<-- p2 text
FORM GET_MARA_DETAILS .
SELECT MATNR
PSTAT
MTART
MBRSH
MEINS
INTO TABLE IT_MARA
FROM
MARA WHERE
MATNR IN S_MATNR.
IF SY-SUBRC <> 0.
MESSAGE I000 WITH 'No doc found'.
ENDIF.
SORT IT_MARA BY MATNR.
DELETE ADJACENT DUPLICATES FROM IT_MARA COMPARING MATNR.
ENDFORM. " get_mara_details
*& Form get_makt_details
text
--> p1 text
<-- p2 text
FORM GET_MAKT_DETAILS .
SELECT MATNR
MAKTX
FROM MAKT
INTO TABLE IT_MAKT
FOR ALL ENTRIES IN IT_MARA
WHERE MATNR = IT_MARA-MATNR AND
SPRAS = SY-LANGU.
ENDFORM. " get_makt_details
*& Form final_data
text
--> p1 text
<-- p2 text
FORM FINAL_DATA .
LOOP AT IT_MARA INTO X_MARA.
CLEAR X_FINAL.
READ TABLE IT_MAKT INTO X_MAKT WITH KEY MATNR = X_MARA-MATNR.
IF SY-SUBRC = 0.
X_FINAL-MAKTX = X_MAKT-MAKTX.
ENDIF.
X_FINAL-MATNR = X_MARA-MATNR.
X_FINAL-PSTAT = X_MARA-PSTAT.
X_FINAL-MTART = X_MARA-MTART.
X_FINAL-MBRSH = X_MARA-MBRSH.
X_FINAL-MEINS = X_MARA-MEINS.
APPEND X_FINAL TO IT_FINAL.
ENDLOOP.
ENDFORM. " final_data
*& Form send_mail_data
text
--> p1 text
<-- p2 text
FORM SEND_MAIL_DATA .
WA_RECLIST-REC_TYPE = 'B'.
WA_RECLIST-EXPRESS = 'X'.
WA_RECLIST-RECEIVER = 'DEV02'.
APPEND WA_RECLIST TO IT_RECLIST.
CONCATENATE 'MATERIAL DATA'(021)
SY-DATUM INTO DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
*--Mail body
CONCATENATE 'MATERIAL DESCRIPTION'(022) 'ATTACHMENT' INTO WA_OBJTXT SEPARATED BY SPACE.
APPEND WA_OBJTXT TO IT_OBJTXT.
DESCRIBE TABLE IT_OBJTXT LINES TAB_LINES.
READ TABLE IT_OBJTXT INTO WA_OBJTXT INDEX TAB_LINES .
DOC_CHNG-DOC_SIZE =
( TAB_LINES - 1 ) * 255 + STRLEN( WA_OBJTXT ).
*-populate packing list for body text
WA_OBJPACK-HEAD_START = 1.
WA_OBJPACK-HEAD_NUM = 0.
WA_OBJPACK-BODY_START = 1.
WA_OBJPACK-BODY_NUM = TAB_LINES.
WA_OBJPACK-DOC_TYPE = 'RAW'.
APPEND WA_OBJPACK TO IT_OBJPACK.
CLEAR WA_OBJPACK.
*--for attachment
*--Populate Column headings
CONCATENATE TEXT-040 " Material Number
TEXT-041 " Material Description
TEXT-042 " Maintenence status
TEXT-043 " Material type
TEXT-044 " Industry sector
TEXT-045 " Base unit of measure
INTO V_TEXT SEPARATED BY C_TAB.
CONCATENATE V_TEXT
C_CR_LF
INTO V_TEXT.
WA_OBJBIN = V_TEXT.
APPEND WA_OBJBIN TO IT_OBJBIN.
CLEAR WA_OBJBIN.
*--Populate Data to the attachment
LOOP AT IT_FINAL INTO X_FINAL.
CONCATENATE X_FINAL-MATNR
X_FINAL-MAKTX
X_FINAL-PSTAT
X_FINAL-MTART
X_FINAL-MBRSH
X_FINAL-MEINS
INTO V_TEXT SEPARATED BY C_TAB.
*--Go to next line after this record.
CONCATENATE V_TEXT
C_CR_LF
INTO V_TEXT.
WA_OBJBIN = V_TEXT.
APPEND WA_OBJBIN TO IT_OBJBIN.
CLEAR WA_OBJBIN.
ENDLOOP.
CLEAR : TAB_LINES.
DESCRIBE TABLE IT_OBJBIN LINES TAB_LINES.
*1ST ATTACHMENT : MAT 5000 PLANT
*2ND ATT : MAT 5010 PLANTS
SORT IT_FINAL BY MEINS.
DATA : V_BEGIN TYPE SY-TABIX,
V_END TYPE SY-TABIX.
LOOP AT IT_FINAL INTO X_FINAL.
AT END OF MEINS.
IF V_BEGIN IS INITIAL.
V_BEGIN = 1.
ELSE.
V_BEGIN = V_END + 1.
ENDIF.
V_END = SY-TABIX.
WA_OBJPACK-TRANSF_BIN = 'X'.
WA_OBJPACK-HEAD_START = 1.
WA_OBJPACK-HEAD_NUM = 1.
WA_OBJPACK-BODY_START = V_BEGIN.
WA_OBJPACK-BODY_NUM = V_END.
WA_OBJPACK-DOC_TYPE = 'RAW' .
WA_OBJPACK-OBJ_NAME = 'MATERIAL'.
WA_OBJPACK-OBJ_DESCR = 'attachment'.
WA_OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND WA_OBJPACK TO IT_OBJPACK.
ENDAT.
ENDLOOP.
*-populate object header(attachment name)
WA_OBJHEAD = 'MATERIAL DETAILS'.
APPEND WA_OBJHEAD TO IT_OBJHEAD.
CLEAR WA_OBJHEAD.
*-packing list for attachment
WA_OBJPACK-TRANSF_BIN = 'X'.
WA_OBJPACK-HEAD_START = 1.
WA_OBJPACK-HEAD_NUM = 1.
WA_OBJPACK-BODY_START = 1.
WA_OBJPACK-BODY_NUM = TAB_LINES .
WA_OBJPACK-DOC_TYPE = 'RAW' .
WA_OBJPACK-OBJ_NAME = 'MATERIAL'.
WA_OBJPACK-OBJ_DESCR = 'ATTACHMENT DESCRIPTION'.
WA_OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND WA_OBJPACK TO IT_OBJPACK.
CLEAR WA_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 = IT_OBJPACK
OBJECT_HEADER = IT_OBJHEAD
CONTENTS_BIN = IT_OBJBIN
CONTENTS_TXT = IT_OBJTXT
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 E000 WITH 'Error occurred in sending mail'(039).
ELSE.
MESSAGE I000 WITH 'Mail sent'(010).
ENDIF.
ENDFORM. " send_mail_data
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
WRITE :/ SY-ULINE.
WRITE:/1 SY-VLINE,
2 'Material No'(024),
19 SY-VLINE,
20 'Material Description'(025),
61 SY-VLINE,
62 'Maintainence Status'(026),
71 SY-VLINE,
72 'Material type'(027),
89 SY-VLINE,
90 'Industry sector'(028),
107 SY-VLINE,
108 'Base unit of measure'(029),
125 SY-VLINE.
WRITE:/1 SY-VLINE,
19 SY-VLINE,
61 SY-VLINE,
71 SY-VLINE,
89 SY-VLINE,
107 SY-VLINE,
125 SY-VLINE.
WRITE :/ SY-ULINE.
ENDFORM. " DISPLAY_DATA
Regards,
Laxmi. -
Program to send mails from an ABAP program
Hello,
I found the following program on the internet. When i run it i get the status as mail sent, but actually the mail is not delivered to the recipients email address. If i check tcode SBWP, a copy of the sent mail sits in outbox even though it is not actually delivered to the receivers. The domain name is set properly in tcode SCOT. Any attempt to send mail directly using tcode SBWP works fine and a copy of the mail goes in outbox. However mails from the program only go in outbox but are not actually sent.Pls help. The program is as under
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 addr'.
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.Hi,
DATA: l_send_request TYPE REF TO cl_bcs, " Send request
l_body TYPE bcsy_text, " Mail body
l_attach TYPE bcsy_text, " Attachment
wa_text TYPE soli, " Work area for attach
l_document TYPE REF TO cl_document_bcs, " Mail body
l_sender TYPE REF TO if_sender_bcs, " Sender address
l_recipient TYPE REF TO if_recipient_bcs, " Recipient
l_size TYPE sood-objlen, " Size of Attachment
c_tab type abap_char1 value
cl_abap_char_utilities=>horizontal_tab,
l_lines TYPE i, " Lines count
l_email type ad_smtpadr, " Email ID
l_extension type soodk-objtp value 'OTF'. " TXT format
wa_text = 'Contents'.
APPEND wa_text TO l_body.
CLEAR wa_text .
l_send_request = cl_bcs=>create_persistent( ).
Craete document for mail body
l_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_body
i_subject = 'BI PC Log' ).
Add the document to send request
CALL METHOD l_send_request->set_document( l_document ).
Sender addess
l_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
Recipient address
l_email =<ur_emailid>.
l_recipient = cl_cam_address_bcs=>create_internet_address( l_email ).
Add recipient address to send request
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'X'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
Trigger E-Mail immediately
l_send_request->set_send_immediately( 'X' ).
Send mail
CALL METHOD l_send_request->send( ).
COMMIT WORK.
Regards,
KC
Maybe you are looking for
-
Exporting and Importing the schema with AQ capability
Hi, We have a production DB which is using Advance queuing and this whole queuing is working fine in Prod but now we have a problem in test Env and it seems that somebody has already tampered the test DB. (the queue reads and sends the messages to DB
-
Im missing ringtone in itunes library how can can i get it to show up
im missing my ringtone in itunes library what can i do to make it show up
-
How to get video of more than one security camera in java
I want to get video from more than one security cameras and i really donot know yet how we do this that get videos continously with more than one camera olz i a beginner help me
-
Flash Player and screen sharing
I've done some research on screen sharing but see many contradicting answers. Some say it can't be done with the regular Flash Player, but Breeze does it some how with some special player they install. Yet regular players have System variables referr
-
Why does my facebook app for my iPhone4 keep freezing?
Whenever I open the app and it loads, the motion circle is moving at the top as if you are browsing the web and loading a website. Less than 60 seconds, the application will freeze unallowing me to quicky view any information. Eventually the app will