SCOT - Send email in ECC 6.0
Hi,
We were using a program to send emails to external vendors in 4.6C. This is done using the function module SO_NEW_DOCUMENT_SEND_API1. We changed the SCOT config in ECC 6.0 to use mailhost/port instead of RFC fn.module.
Now we are not able to send email using the program.
Please let me know how to solve this issue.
Thanks
Kumar
Function module SO_NEW_DOCUMENT_ATT_SEND_API1 has a parameter CONTENTS_BIN = OBJBIN which was assigned data type as SOLIX. This was not compatible with the data type SOLISTI1 used for Function Module SO_CONVERT_CONTENTS_BIN that is called inside this FM. So the data type was changed from SOLIX to SOLISTI1.
We had the same problem and this was the possible remediation we have done.
Please check if this can help you.
Similar Messages
-
SCOT: Sending emails through ECC
Hi All
I have read the link
(http://help.sap.com/saphelp_tm60/helpdata/en/af/73563c1e734f0fe10000000a114084/content.htm)
to configure SCOT. I have 3 doubt plzz clarify.
Doubt No. 1:
In that link its mentioned that I have to add 2 profile parameter in the transaction RZ10 namely *icm/server_port_<> and *is/SMTP/virt_host_<>
My question is Can I put any value which i like in place of * like can I add either icm/server_port_2 OR icm/server_port_3 OR icm/server_port_4 in icm parameter AND ALSO
Can I put any value which i like in place of * in is/SMTP/virt parameter like can I add either is/SMTP/virt_host_0 OR is/SMTP/virt_host_1 OR is/SMTP/virt_host_2 .
Doubt No. 2:
What port value I have to put in the profile parameter icm/server_port_2 in RZ10. Can I put any port value ? and automatically that port will work? say suppose I addded this profile parameter in RZ10
icm/server_port_2 = PROT=SMTP,PORT=25000,TIMEOUT=180 so automatically 25000 port will work ? or will it give error?
Doubt No. 3:
When I go to SMICM transaction and go to services , I get the following:
No. Log Service name/port Host name Keep Alive Proc TimeOut Active
1 HTTP 8000 epv.sopm.com 30 60 Yes
2 SMTP 0 epv.sopm.com 30 60 Yes
3 HTTPS 8001 epv.sopm.com 30 180 Yes
This means that HTTP port is 8000, HTTPS port is 8001. My question is why in SMTP its showing 0, why no port is shown?
I have not added any profile parameter like icm/server_port_2 = PROT=SMTP,PORT=25000,TIMEOUT=180 for SMTP in RZ10 as of now.
Is this the reason for this ?1.
is/SMTP/virt_host_<*> = <host>:<port>,<port>,...;
This parameter defines a virtual mail host for receiving mails. If all incoming mails (including status notifications) are to be received and processed by one single client of the SAP system, this parameter is not required. In this instance, is/SMTP/virt_host_0 = :; is used by default. If multiple clients are to be used as recipients, a virtual host has to be created for each of these clients. <host> describes the name of the host to which the incoming mails are addressed. You can enter * here if the mails are to be sent independently of the host being addressed. <port> describes the number of the port to which the incoming mails are addressed.
Do you plan to use incoming mail to SAP?
If so set this parameter for each client
If you plan to receive email for one client then you dont need to set this parameter.
Yes. You can specify any name.
The parameters must have the following syntax:
is/HTTP/virt_host_n = <Host_1>:<Service_11>, .. <Service_1n>
<Host_2>:<Service_21>, .. <Service_2m>
<Host_x> and <Service_yz> may contain the wildcards '*' and
'*' can be used to represent any substring, '?' any
character.
2. You can enter any free port available.Generally higher the port number should be free(25000 should be a free port)
3. SMTP port will be asigned port 0 if you dont specify the parameter for SMTP.
Yes. Thats the reason for it.
But it still works. -
How to configure SCOT/RFC destination to send email to external addresses
Hi,
I have an ABAP program which sends out an email to email addresses such as [email protected], i configured SCOT and entered our company exchange server address in the SMTP node, and it works just fine. Problem is the program also needs to send emails to internet mail id's such as [email protected] or [email protected], and here it doesnt work, the email request shows up in SOST as failed saying that the address is unrecognized, we are able to send receive emails from internet id's as well using our email client (outlook), i just have no idea how to get the same to work from my ABAP program, i guess i am missing some BASIS configuration, can anybody help please?Please see the following example. Make sure you are setting the recipient type correctly.
report zrich_0003 .
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]'.
<b> mailrec-rec_type = 'U'.</b>
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.
Regards,
Rich Heilman -
Sending Emails/SCOT in HA Cluster/PRD
HI Experts:
I am hoping for some guidance on this and would really appreciate your prompt replies with this.
I have already successfully configured SAP to send emails from our DEV and QAS systems. There is no scope for recieving emails in our SAP systems.
I just have some doubts on how to properly do this in our HA PRD environment.
I have all the relevant information regarding our SMTP server and SMTP port. I know that the information is correct because it has been working in our DEV and QAS systems.
I had our MS Exchange Admin add the IP addresses to the Exchange server so SAP could use to send emails. She added both the virtual IP and the physical IP for our CI instance only.
I have already activated the SAPConnect in SICF.
I have also updated the following information in SCOT
Default Domain
SAPConnect - INT - SMTP
Selected Node in Use
Mail Host
Mail Port
In the past this has worked for us when sending emails from SAP.
I have already looked at notes 455140 and 607108. I have also checked the following link. http://help.sap.com/saphelp_nw04/helpdata/en/55/a8b538891b11d2a25a00a0c943858e/frameset.htm
The only thing I am not sure about is the following line:
"You have to adjust the profile of the SAP Web Application Server if you want to use the SMTP function. The SAPconnect send job can only be scheduled for servers on which SMTP has been activated. For this reason, you must activate SMTP for all of the SAP systemu2019s application servers."
I am also desribing the error message I get when I try to send a message through tranascation SO01.
In transaction SOST, I get an error with the code 802.
No delivery to email address, as recipient unknown
Message no. XS802
Any help would be greatly appreciated.
ImranSo, after going through this exercise I have figured out that the following works.
The IP addresses of all the physical servers (cluster plus app servers) need to be added to the Exchange Server list. This will allow SAP to send emails using SCOT and MS Exchange Server.
OR
The IP addresses of only the two servers (cluster) has to be added. the job has to be defined in such a way that it has to use one of these two servers to send the emails out. -
What settings in SCOT to be done to send EMail
Hi ,
Iam working on FM which sends email ,which is working fine .
now iam trying to test in nother system that is DV2 (quality ),where i cant able to send the email .Iam getting a message 'ERROR DURING SEND PROCESS'
I think there will be problem with SCOT settings .can any one help me on ,what settings has to be done in SCOT to get the email sent .
HOW IAM SAYING SO SURE THAT THERE WAS A PROBLEM WITH THE SCOT IS I TRYED TO SEND IT THROUGH transaction 'SBWP' too
its giving the same problem .
How can this be done .
could any one explain me on this .
Thanks ,
shankar.Hi Vinay,
Just go theough these thread they have ur answer..
Re: SCOT SETTINGS
Re: How to configure SCOT/RFC destination to send email to external addresses
Rgds,
Prakash
<b>Reward points to helpful answer</b> -
hi,
I write some coding to send emails via the class CL_CFX_EMAIL_UTIL and its send_email method.
but then the emails didn´t arrive and were waiting with status "waiting" as I see in ta SCOT.
I send them manually but i am searching for a way to send it direktly in my abap coding after callen the send_email method.
is it possible?Hi,
Please check this thread for sending emails..
Sending emails from ABAP program
http://www.sapdevelopment.co.uk/reporting/email/email_mbody.htm
Please refer to this link for function modules sending emails..
Function Module to send emails to users
Hope this would help you.
Good luck
Narin -
Sending email from 2 SMTP servers
Hi Experts,
We have users from different domains in 1 client. Emails are send out from different domains. We directed SCOT to 1 of the SMTP server, and the email administrator will setup relays from this SMTP server to other SMTP servers. But now, some are saying that relays are not secure and that it should be removed. Hence, we are trying to find alternative.
How am I able to add another SMTP node in SCOT so that email from different domains are directed to different SMTP servers directly?
Thanks,
TMYou will not find anything from SAP to support your claim.
SAP designed its system to be able to send emails to a single SMTP node. That is a fact and it is logical because SAP Netweaver is not a dedicated mail software.
If you have more complex needs, you have to find a workaround.
In my company, my solution was to install an SMTP relay software managed by the SAP administration team.
Therefore we can set our own routing rules for incoming or outgoing mails from our SAP systems (ECC, SRM, CRM, etc...)
This SMTP relay can then send or receive emails from the company SMTP official servers.
Regards,
Olivier -
We are in the process of upgrading to ECC 5.0. I have read that many of the SAP email functions require a new COMMIT_WORK parameter to send email, or a COMMIT WORK in the main program.
We have some functions in table T779X triggered when various infotypes are created or changed. A few of these functions do a CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'. The workflow is triggered, and the email shows up in my Outbox, but it never gets sent even though I have the COMMIT_WORK parameter set to 'X' in the calling function.
We have other workflows not triggered directly from table T779X and other programs that call this function successfully to send email. Has anyone encountered this problem?
Janice IsheeSuresh/Karun
Thank you for your suggestions. I was aware of SCOT. I am not sure what values I should be checking for, but our Basis team has used SCOT to set values, and I am receiving emails from other workflows, just not ones triggered directly from table T779X.
I did not know about SOST. That is very intersting. Although I can see my emails in my Outbox, I do not see them in SOST. I am not sure what that means.
Other developers have said that I should not be sending email from a workflow triggered directly from T779X, but to use that workflow to raise an event. Then have a second function waiting for the event, and to send my email from that second function. I don't like that solution as I don't have the before image and after image like I do in the function triggered directly from T779X. I'm going to post a message with OSS just to confirm that.
Thanks
Janice -
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 -
Up until the beginning of this month my Thunderbird was working fine with my roadrunner email address. I have not downloaded any new software or made any changes to my settings during this time. Now I can no longer send emails (although it claims they are sent) and I never get an error message. I'm definitely in online mode, can receive all messages fine, and can send messages from my road runner server fine through webmail. I have checked to ensure no firewalls or antiviruses are blocking my outgoing messages and know the SMTP is correct. Please help!
Hi...thanks so much for your help! It says "mail sent successfully" and shows it in my sent folder after I click send.
Troubleshooting:
Application Basics
Name: Thunderbird
Version: 24.4.0
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
Profile Folder: Show Folder
(Local drive)
Application Build ID: 20140316131045
Enabled Plugins: about:plugins
Build Configuration: about:buildconfig
Crash Reports: about:crashes
Memory Use: about:memory
Mail and News Accounts
account1:
INCOMING: account1, , (pop3) pop-server.tampabay.rr.com:110, plain, passwordCleartext
OUTGOING: smtp-server.tampabay.rr.com:25, plain, none, true
account2:
INCOMING: account2, , (none) Local Folders, plain, passwordCleartext
Extensions
Important Modified Preferences
Name: Value
browser.cache.disk.capacity: 358400
browser.cache.disk.smart_size.first_run: false
browser.cache.disk.smart_size.use_old_max: false
browser.cache.disk.smart_size_cached_value: 358400
extensions.lastAppVersion: 24.4.0
font.internaluseonly.changed: true
font.name.monospace.el: Consolas
font.name.monospace.tr: Consolas
font.name.monospace.x-baltic: Consolas
font.name.monospace.x-central-euro: Consolas
font.name.monospace.x-cyrillic: Consolas
font.name.monospace.x-unicode: Consolas
font.name.monospace.x-western: Consolas
font.name.sans-serif.el: Calibri
font.name.sans-serif.tr: Calibri
font.name.sans-serif.x-baltic: Calibri
font.name.sans-serif.x-central-euro: Calibri
font.name.sans-serif.x-cyrillic: Calibri
font.name.sans-serif.x-unicode: Calibri
font.name.sans-serif.x-western: Calibri
font.name.serif.el: Cambria
font.name.serif.tr: Cambria
font.name.serif.x-baltic: Cambria
font.name.serif.x-central-euro: Cambria
font.name.serif.x-cyrillic: Cambria
font.name.serif.x-unicode: Cambria
font.name.serif.x-western: Cambria
font.size.fixed.el: 14
font.size.fixed.tr: 14
font.size.fixed.x-baltic: 14
font.size.fixed.x-central-euro: 14
font.size.fixed.x-cyrillic: 14
font.size.fixed.x-unicode: 14
font.size.fixed.x-western: 14
font.size.variable.el: 17
font.size.variable.tr: 17
font.size.variable.x-baltic: 17
font.size.variable.x-central-euro: 17
font.size.variable.x-cyrillic: 17
font.size.variable.x-unicode: 17
font.size.variable.x-western: 17
mail.openMessageBehavior.version: 1
mail.winsearch.enable: true
mail.winsearch.firstRunDone: true
mail.winsearch.global_reindex_time: 1386018562
mailnews.database.global.datastore.id: d0565083-6917-4a0a-868f-37bebde1e81
network.cookie.prefsMigrated: true
places.database.lastMaintenance: 1398260550
places.history.expiration.transient_current_max_pages: 104808
plugin.importedState: true
plugin.state.npdeployjava: 0
print.printer_Lexmark_X264dn.print_bgcolor: false
print.printer_Lexmark_X264dn.print_bgimages: false
print.printer_Lexmark_X264dn.print_colorspace:
print.printer_Lexmark_X264dn.print_command:
print.printer_Lexmark_X264dn.print_downloadfonts: false
print.printer_Lexmark_X264dn.print_duplex: -1574483314
print.printer_Lexmark_X264dn.print_edge_bottom: 0
print.printer_Lexmark_X264dn.print_edge_left: 0
print.printer_Lexmark_X264dn.print_edge_right: 0
print.printer_Lexmark_X264dn.print_edge_top: 0
print.printer_Lexmark_X264dn.print_evenpages: true
print.printer_Lexmark_X264dn.print_footercenter:
print.printer_Lexmark_X264dn.print_footerleft: &PT
print.printer_Lexmark_X264dn.print_footerright: &D
print.printer_Lexmark_X264dn.print_headercenter:
print.printer_Lexmark_X264dn.print_headerleft: &T
print.printer_Lexmark_X264dn.print_headerright: &U
print.printer_Lexmark_X264dn.print_in_color: true
print.printer_Lexmark_X264dn.print_margin_bottom: 0.5
print.printer_Lexmark_X264dn.print_margin_left: 0.5
print.printer_Lexmark_X264dn.print_margin_right: 0.5
print.printer_Lexmark_X264dn.print_margin_top: 0.5
print.printer_Lexmark_X264dn.print_oddpages: true
print.printer_Lexmark_X264dn.print_orientation: 0
print.printer_Lexmark_X264dn.print_page_delay: 50
print.printer_Lexmark_X264dn.print_paper_data: 1
print.printer_Lexmark_X264dn.print_paper_height: 11.00
print.printer_Lexmark_X264dn.print_paper_name:
print.printer_Lexmark_X264dn.print_paper_size_type: 0
print.printer_Lexmark_X264dn.print_paper_size_unit: 0
print.printer_Lexmark_X264dn.print_paper_width: 8.50
print.printer_Lexmark_X264dn.print_plex_name:
print.printer_Lexmark_X264dn.print_resolution: 0
print.printer_Lexmark_X264dn.print_resolution_name:
print.printer_Lexmark_X264dn.print_reversed: false
print.printer_Lexmark_X264dn.print_scaling: 1.00
print.printer_Lexmark_X264dn.print_shrink_to_fit: true
print.printer_Lexmark_X264dn.print_to_file: false
print.printer_Lexmark_X264dn.print_unwriteable_margin_bottom: 0
print.printer_Lexmark_X264dn.print_unwriteable_margin_left: 0
print.printer_Lexmark_X264dn.print_unwriteable_margin_right: 0
print.printer_Lexmark_X264dn.print_unwriteable_margin_top: 0
Graphics
Adapter Description: Intel(R) HD Graphics
Vendor ID: 0x8086
Device ID: 0x0152
Adapter RAM: Unknown
Adapter Drivers: igdumd64 igd10umd64 igd10umd64 igdumd32 igd10umd32 igd10umd32
Driver Version: 8.15.10.2639
Driver Date: 2-1-2012
Direct2D Enabled: false
DirectWrite Enabled: false (6.2.9200.16571)
ClearType Parameters: ClearType parameters not found
WebGL Renderer: false
GPU Accelerated Windows: 0
AzureCanvasBackend: skia
AzureFallbackCanvasBackend: cairo
AzureContentBackend: none
JavaScript
Incremental GC: 1
Accessibility
Activated: 0
Prevent Accessibility: 0
Library Versions
Expected minimum version
Version in use
NSPR
4.10.2
4.10.2
NSS
3.15.4 Basic ECC
3.15.4 Basic ECC
NSS Util
3.15.4
3.15.4
NSS SSL
3.15.4 Basic ECC
3.15.4 Basic ECC
NSS S/MIME
3.15.4 Basic ECC
3.15.4 Basic ECC -
Batch job creation for sending email if the invoice is aged
Positive confirmation: Send system notification to the requestor if:
a) An invoice is received and GR is not yet posted in the ECC system.
b) An 'aged' invoice and GR is not yet posted in the ECC system.
This requirement is for USA only. i.e., we have only one company code which is 8960.
Identifiers of the invoice are
Company Code = u20188960u2019
Invoice Document Type = u2018R9u2019
Use table EKBE for relationship between Invoice, Goods Receipt and Purchase Order.
The field EKPO-BEDNR contains the Shopping Cart Number
Implementation Strategy
1. To send email if the invoice is aged.
Create a program that will run as a job. This job will frequently check for invoices related to SRM Shopping Carts received from E2OPEN. If an invoice is aged and there is no Goods Receipt posted through confirmation from SRM, then an email will go out from ECC system to the requestor. Using the Shopping Cart number on PO, find the requestor information (email ID) from SRM through an RFC call. This job will run once in a day and should have a parameter in the program for the age of the Invoice.
Both the emails should contain a link (To be taken from SRM system, to be supplied) to log into SRM system. The email will also contain the Shopping Cart number and the Description of the item, and a message to Confirm this, including age of the invoice if aged.
Please let me know how to create the batch job.
Regards,
Venkat
Edited by: VenkatG on Sep 1, 2009 3:14 PMDo not pass the COMMIT_WORK flag... Leave it blank. Any transaction for the data integrity, one should never use COMMIT WORK related statements. Normally SAP transactions will have the COMMIT WORK at the end of transaction which is enough for any thing that is added part of the customer exits...
Hope this helps.
Regards
Anjaiah -
Hi friends,
I wrote this code to send mail to external user from sap.
It did not work properly can anyone help me to send email to extenal user.
The return code after executing the function module is 2.
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.
Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'OFFER'.
DOC_CHNG-OBJ_DESCR = 'abcd'.
OBJTXT = 'aaaaaaaaaaa:'.
APPEND OBJTXT.
OBJTXT = 'bbbbbbbbbb'.
APPEND OBJTXT.
OBJTXT = 'ccccccccccccc.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
RECLIST-RECEIVER = mail address.
RECLIST-REC_TYPE = 'U'.
RECLIST-COM_TYPE = 'INT'.
RECLIST-NOTIF_DEL = 'X'.
RECLIST-NOIF_NDEL = 'X'.
APPEND RECLIST.
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 = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creating the document attachment
(Assume the data in OBJBIN are given in BMP format)
OBJBIN = ' \O/ '. APPEND OBJBIN.
OBJBIN = ' '. APPEND OBJBIN.
OBJBIN = ' / \ '. APPEND OBJBIN.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'picasso.bmp'. 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 = 'BMP'.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
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 = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Hi,
Check in SCOT t-code whether it has been properly configred to send the mails
Regards,
siva chalasani. -
Error while sending email to external mail - Urgent
Hi All,
I am getting error while sending email with attachement. The Error code is 02.
I am not able to identify the error. bold Please help me in solving this problem.
Is it anything wrong with the code or Any Configuration with SCOT/SOST.bold
the code i am using is :
REPORT YVR_F MESSAGE-ID XX .
TABLES : EDIDC, EDIDS, EDPAR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_STATUS LIKE EDIDC-STATUS DEFAULT '51'.
SELECT-OPTIONS : S_DIRECT FOR EDIDC-DIRECT,
S_MESTYP FOR EDIDC-MESTYP,
S_CREDAT FOR EDIDC-CREDAT.
SELECTION-SCREEN END OF BLOCK B1 .
PARAMETER: P_EMAIL LIKE SOMLRECI1-RECEIVER,
P_SENDER LIKE SOMLRECI1-RECEIVER no-display,
P_DELSPL AS CHECKBOX,
P_ONLINE NO-DISPLAY.
DATA : TB_EDIDC LIKE STANDARD TABLE OF EDIDC INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_EDPAR LIKE STANDARD TABLE OF EDPAR INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_KNA1 LIKE STANDARD TABLE OF KNA1 INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_ADRC LIKE STANDARD TABLE OF ADRC INITIAL SIZE 0 WITH HEADER
LINE.
DATA: INT_PDF TYPE TABLE OF TLINE WITH HEADER LINE.
DATA : BEGIN OF TB_ED OCCURS 0,
SNDPRN LIKE EDIDC-SNDPRN,
LOC LIKE ADRC-BUILDING,
DOCNUM LIKE EDIDC-DOCNUM,
IDOCTP LIKE EDIDC-IDOCTP,
MESTYP LIKE EDIDC-MESTYP,
DIRECT LIKE EDIDC-DIRECT,
CREDAT LIKE EDIDC-CREDAT,
STATUS LIKE EDIDC-STATUS,
END OF TB_ED.
DATA: IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
Job Runtime Parameters
DATA: GD_EVENTID LIKE TBTCM-EVENTID,
GD_EVENTPARM LIKE TBTCM-EVENTPARM,
GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
GD_JOBNAME LIKE TBTCM-JOBNAME,
GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
DATA: W_RECSIZE TYPE I,
W_SPOOL_NR LIKE SY-SPONO.
%_print LIKE pri_params.
DATA: GD_SUBJECT LIKE SODOCCHGI1-OBJ_DESCR,
IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
GD_SENDER_TYPE LIKE SOEXTRECI1-ADR_TYP,
GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
GD_ATTACHMENT_NAME TYPE SO_OBJ_DES.
Spool to PDF conversions
DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
GD_DESTINATION LIKE RLGRAP-FILENAME,
GD_BYTECOUNT LIKE TST01-DSIZE,
GD_BUFFER TYPE STRING.
Binary store for PDF
DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF IT_PDF_OUTPUT.
DATA: GD_RECSIZE TYPE I.
CONSTANTS: C_DEV LIKE SY-SYSID VALUE 'DEV',
C_NO(1) TYPE C VALUE ' ',
C_DEVICE(4) TYPE C VALUE 'LOCL'.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1.
DATA : MSTR_PRINT_PARMS LIKE PRI_PARAMS,
MC_VALID,
P_REPID LIKE SY-REPID,
WF_ID LIKE TSP01-RQIDENT,
LOC_BYTECOUNT TYPE I.
*start-of-selection.
MSTR_PRINT_PARMS-PDEST = 'LOCL'.
P_REPID = SY-REPID.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority= ' '
COPIES = '1'
COVER_PAGE = SPACE
DATA_SET = SPACE
DEPARTMENT = SPACE
DESTINATION = 'LP01'
EXPIRATION = '1'
IMMEDIATELY = 'X'
LAYOUT = 'X_65_132'
MODE = SPACE
NEW_LIST_ID = 'X'
NO_DIALOG = 'X'
USER = SY-UNAME
IMPORTING
OUT_PARAMETERS = MSTR_PRINT_PARMS
VALID = MC_VALID
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS MSTR_PRINT_PARMS.
AND RETURN.
NEW-PAGE PRINT ON NO DIALOG PARAMETERS
MSTR_PRINT_PARMS.
perform data.
NEW-PAGE PRINT OFF. "This marks the end of the screen for which the
*SPOOL NO WAS GENERATED.
WF_ID = SY-SPONO.
*converting spool to pdf
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = WF_ID "SPOOL NUMBER
NO_DIALOG = SPACE
PDF_DESTINATION = 'X'
IMPORTING
PDF_BYTECOUNT =
LOC_BYTECOUNT "NUMBER OF BYTES TRANSFERRED
TABLES
PDF = INT_PDF "TABLE FOR PDF REPORT
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
*CALL FUNCTION 'DOWNLOAD'
*EXPORTING
*bin_filesize = loc_bytecount "NO. OF BYTES
*filename = 'C:/EMAILPDF.PDF'
*filetype = 'BIN'
**IMPORTING
**act_filename = loc_filename
*TABLES
*data_tab = int_pdf.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
Transfer the 132-long strings to 255-long strings
LOOP AT INT_PDF.
TRANSLATE INT_PDF USING ' ~'.
CONCATENATE GD_BUFFER INT_PDF INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
CHECK GD_RECSIZE > 0.
PERFORM SENDMAIL USING P_EMAIL..
*& Form sendmail
text
--> p1 text
<-- p2 text
FORM SENDMAIL USING P_EMAIL.
CHECK NOT ( P_EMAIL IS INITIAL ).
REFRESH IT_MESS_BOD.
Default subject matter
GD_SUBJECT = 'Subject'.
GD_ATTACHMENT_DESC = 'IDOC LIST'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
IT_MESS_BOD = 'List Of Failed Idocs'.
APPEND IT_MESS_BOD.
IT_MESS_BOD = 'List Of Failed Idocs'.
APPEND IT_MESS_BOD.
If no sender specified - default blank
IF P_SENDER EQ SPACE.
GD_SENDER_TYPE = SPACE.
ELSE.
GD_SENDER_TYPE = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESS_BOD
IT_MESS_ATT
USING P_EMAIL
'Document attachment'
'PDF'
GD_ATTACHMENT_NAME
GD_ATTACHMENT_DESC
P_SENDER
GD_SENDER_TYPE
CHANGING GD_ERROR
GD_RECIEVER.
ENDFORM. " sendmail
*& Form DELETE_SPOOL
text
--> p1 text
<-- p2 text
FORM DELETE_SPOOL.
DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
LD_SPOOL_NR = WF_ID. "GD_SPOOL_NR.
CHECK P_DELSPL <> C_NO.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
SPOOLID = LD_SPOOL_NR.
ENDFORM. " DELETE_SPOOL
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
text
-->P_IT_MESS_BOD text
-->P_IT_MESS_ATT text
-->P_P_EMAIL text
-->P_0846 text
-->P_0847 text
-->P_GD_ATTACHMENT_NAME text
-->P_GD_ATTACHMENT_DESC text
-->P_P_SENDER text
-->P_GD_SENDER_TYPE text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = IT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = p_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
W_SENT_ALL = 'X'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
object_header = objhead
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'Error occurred while sending'.
ELSE.
MESSAGE I000 WITH 'The document was sent'.
ENDIF.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form data
text
--> p1 text
<-- p2 text
FORM data.
SELECT SNDPRN
DOCNUM
IDOCTP
MESTYP
DIRECT
CREDAT
STATUS
FROM EDIDC
INTO CORRESPONDING FIELDS
OF TABLE TB_EDIDC
WHERE STATUS = P_STATUS
AND MESTYP IN S_MESTYP
AND DIRECT IN S_DIRECT
AND CREDAT IN S_CREDAT.
SELECT KUNNR
INPNR
FROM EDPAR
INTO CORRESPONDING FIELDS
OF TABLE TB_EDPAR
FOR ALL ENTRIES IN TB_EDIDC
WHERE KUNNR = TB_EDIDC-SNDPRN.
SELECT KUNNR
ADRNR
FROM KNA1
INTO CORRESPONDING FIELDS
OF TABLE TB_KNA1
FOR ALL ENTRIES IN TB_EDPAR
WHERE KUNNR = TB_EDPAR-INPNR.
SELECT ADDRNUMBER
BUILDING
FROM ADRC
INTO CORRESPONDING FIELDS
OF TABLE TB_ADRC
FOR ALL ENTRIES IN TB_KNA1
WHERE ADDRNUMBER = TB_KNA1-ADRNR.
LOOP AT TB_EDIDC WHERE STATUS = P_STATUS
AND MESTYP IN S_MESTYP
AND DIRECT IN S_DIRECT
AND CREDAT IN S_CREDAT.
TB_ED-SNDPRN = TB_EDIDC-SNDPRN.
TB_ED-DOCNUM = TB_EDIDC-DOCNUM.
TB_ED-IDOCTP = TB_EDIDC-IDOCTP.
TB_ED-MESTYP = TB_EDIDC-MESTYP.
TB_ED-DIRECT = TB_EDIDC-DIRECT.
TB_ED-CREDAT = TB_EDIDC-CREDAT.
TB_ED-STATUS = TB_EDIDC-STATUS.
READ TABLE TB_EDPAR WITH KEY KUNNR = TB_EDIDC-SNDPRN.
READ TABLE TB_KNA1 WITH KEY KUNNR = TB_EDPAR-INPNR.
READ TABLE TB_ADRC WITH KEY ADDRNUMBER = TB_KNA1-ADRNR.
TB_ED-LOC = TB_ADRC-BUILDING.
APPEND TB_ED.
ENDLOOP.
WRITE :/02 'CustomerNo',
15 'Location Code',
30 'Idoc Number',
55 'Basic Type',
70 'Message Type',
95 'Direction',
110 'Received Date',
130 'Status'.
ULINE.
LOOP AT TB_ED.
WRITE :/02 TB_ED-SNDPRN,
15 TB_ED-LOC,
30 TB_ED-DOCNUM,
55 TB_ED-IDOCTP,
70 TB_ED-MESTYP,
95 TB_ED-DIRECT,
110 TB_ED-CREDAT,
130 TB_ED-STATUS.
ENDLOOP.
ENDFORM. " data
Kindly help me in solving the issue.
Thanks in advance.
Suki.Hi,
Check in transaction SCOT. If your mail is in error status in SCOT, you can assure that there is no problem with your code. If your message has not reached till SCOT, then the problem will be with the code.
If the mail is there in scot with error status tell the BASIS to configure it. I feel this could be the problem.
Regards,
Renjith Michael. -
SAPConnect to Send Emails to external mail address
I am trying to send email from SAP to an external email address.
I've configured in SCOT the mail server and it respective port.
When I tried to send a test message, the message failed in the queue with the log:
"Cannot process message in SAP System - No ESMTP Plug-In Is Available for SAPconnect
Application Server Used by the Send Process:
S21TDI05
(Schedule Send Process on App.Server with Plug-In)
Upon checking the sap documentation, I encounter there's also a SMTP Service in "SMICM" as well. Inside there I can see that the SMTP setting is not activate and no values has been entered.
Are these 2 connected?
Advices are welcome.
Thanks,
Regards,
Wooi Chian.This error message means that your SMTP plug-in is not active. Go to TR: SMICM -> GOTO -> SERVICES
Here you must see that the SMTP plug in is active.
This error usally due to bind error. The port wich had to be used is used by an other service.
Check if below mentioned parameters are set.
rdisp/start_icman = true
icm/server_port_0 = PROT=HTTP,PORT=1080
icm/server_port_1 = PROT=SMTP,PORT=25$$, TIMEOUT=60, PROCTIMEOUT=300
icm/server_port_2 = HTTPS,PORT=82$$, TIMEOUT=60, PROCTIMEOUT=300
and restart ICM . You should see SMTP service on SMICM transaction.
In my case problem was with the below parameters. PORT=HTTPS was assigned to server_port_1. I swapped the values of both the parameters icm/server_port_1 and icm/server_port_3. Only after that SMTP service started being visible under DISPLAY --> Services.
icm/server_port_0 PROT=HTTP,PORT=80$$, TIMEOUT=60, PROCTIMEOUT=300
icm/server_port_1 PROT=HTTPS,PORT=82$$, TIMEOUT=60, PROCTIMEOUT=300
icm/server_port_3 PROT=SMTP,PORT=25$$, TIMEOUT=60, PROCTIMEOUT=300
Hope this helps solve the issue.
/Ravi -
i am having internal table contains values.
i want that output should be send as an email attachment to email id given in selection screen.
but chinese can't diaplay rightly in attachment.eg:'批次; ','日期,and so on,all can't display rightly! .
please help me its urgent.thank you
*& Report YPD00010A
*& DEVELOPER/DATE : SJDU / 12.06.2007
*& REPORT: display barcodes which can't be updated in the sta
*& of x_ray
REPORT YPD00010A no standard page heading
line-count 90
line-size 120 .
selection-screen begin of block sel with frame.
PARAMETERS:
PA_WERKS LIKE YP043D-WERKS OBLIGATORY DEFAULT '8000',
PA_MAIL like ys054-mailaddress MATCHCODE OBJECT ZMAILADDRESS,
PA_MAIL1 like ys054-mailaddress MATCHCODE OBJECT ZMAILADDRESS,
PA_ZBAT like YP043D-ZBAT OBLIGATORY MATCHCODE OBJECT ZZBAT. "File
selection-screen end of block sel.
DATA: BEGIN OF Line1,
ZBARCD LIKE yp043d-zbarcd,
END OF Line1.
DATA: ta_yp043d like Line1 occurs 0 with header line.
data: begin of TAB,
X(1) type x value '09',
end of tab,
C(10) type c.
class cl_abap_char_utilities definition load.
c+5(1) = cl_abap_char_utilities=>horizontal_tab.
DATA:
it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER
LINE,
it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER
LINE.
data: p_email TYPE somlreci1-receiver .
data: p_email2 TYPE somlreci1-receiver .
DATA: TP_MAIL(255) TYPE C.
DATA: TP_MAIL_MAIN(255) TYPE C.
DATA: TP_MAIL_TMP(255) TYPE C.
DATA:
t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_doc_data LIKE sodocchgi1,
w_cnt TYPE I,
w_sent_all(1) TYPE C,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA:COUNT1 TYPE I VALUE 0,
COUNT2 TYPE I VALUE 0.
INITIALIZATION.
clear: ta_yp043d, it_attach, it_message.
REFRESH: ta_yp043d, it_attach, it_message.
START-OF-SELECTION.
PERFORM GET_DATA.
IF PA_MAIL <> ' ' OR PA_MAIL1 <> ' '.
READ TABLE TA_YP043D INDEX 1.
IF SY-SUBRC = 0 .
pERFORM SEND_EMAIL.
ENDIF.
ENDIF.
END-OF-SELECTION.
PERFORM GET_WRITEDATA.
TOP-OF-PAGE.
PERFORM GET_HEADER.
END-OF-PAGE.
*& Form GET_HEADER *
*& To display the header *
FORM GET_HEADER.
data:
tp_header(120) type c.
TP_HEADER = '山东公司条码表'.
WRITE:4 '程序序号:',10 'YPD00010', 42 tp_header,
92 '日期:',102 SY-DATUM+0(4),
106 '年',
108 SY-DATUM+4(2),110 '月',112 SY-DATUM+6(2),114 '日',
/92 '时间 :',SY-TIMLO,
/3 '上传凭证:',18 PA_ZBAT, 92 '页码 :', SY-PAGNO.
ULINE.
ENDFORM.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA .
DATA:TP_ZBARCD LIKE YP043-ZBARCD,
TP_ZBARCD1 LIKE YP043-ZBARCD,
TP_ZVALS LIKE YP043D-ZVALS.
SELECT ZBARCD INTO CORRESPONDING FIELDS OF TABLE ta_yp043d FROM YP043D
WHERE WERKS = PA_WERKS AND ZBAT = PA_ZBAT
AND ZUPDS = 'N' AND ZVALS = 'B' AND ZLVORM <> 'X'.
ENDFORM. " GET_DATA
*& Form GET_WRITEDATA
* text
* --> p1 text
* <-- p2 text
FORM GET_WRITEDATA .
WRITE: /'硫化未上传的条码有:'.
SKIP.
LOOP AT TA_YP043D.
WRITE:TA_YP043D-ZBARCD,' '.
ENDLOOP.
ENDFORM. " GET_WRITEDATA
*& Form SEND_EMAIL
* text
* --> p1 text
* <-- p2 text
FORM SEND_EMAIL.
READ TABLE TA_YP043D INDEX 1.
IF SY-SUBRC = 0 .
* Retrieve sample data from table ekpo
* PERFORM DATA_RETRIEVAL.
* Populate table with detaisl to be entered into .htm file
PERFORM BUILD_XLS_DATA_TABLE.
* Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
* Send file by email attached as .htm file
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES it_message
it_attach
USING p_email
'条码系统出库有问题的条码'
'HTML'
'WC_Document'
CHANGING gd_error
gd_reciever.
* Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDIF.
ENDFORM. " SEND_EMAIL
*& Form BUILD_XLS_DATA_TABLE
* text
* --> p1 text
* <-- p2 text
FORM BUILD_XLS_DATA_TABLE .
CONCATENATE '<' 'HTML' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE '<' 'HEAD' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE
'<meta http-equiv=Content-Type content=' '"' 'text/html; charset= GB2312
''"' '>' INTO it_attach.
APPEND it_attach.
CONCATENATE '<' '/HEAD' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0PT''><B> 批次:' pa_zbat
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0pt''><B> 日期:' sy-datum
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0pt''><B>' '硫化未上传的条码有: '
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
*CONCATENATE '<P style=''font-size:12.0pt''><B>' ' ' ' </B></P>' INTO
*it_attach.
*APPEND it_attach.
LOOP AT TA_YP043D .
*CONCATENATE '< style=''font-size:12.0pt''><B> ' TAB-ZBARCD '</B>'
CONCATENATE '<B> ' TA_YP043D-ZBARCD ' </B>' INTO
it_attach .
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form POPULATE_EMAIL_MESSAGE_BODY
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_EMAIL_MESSAGE_BODY .
DATA: TP_TEST0(255) TYPE C,
TP_TEST3(255) TYPE C,
TP_TEST(255) TYPE C.
TP_TEST = '当轮胎进行X光机数据上传时,有些条码在硫化阶段不存在资料'.
TP_TEST0 = '请您查看并尽快解决.'.
CONCATENATE TP_TEST TP_TEST0 INTO TP_TEST3 SEPARATED BY ' , '.
APPEND '尊敬的先生/女士,' TO it_message.
APPEND ' ' TO it_message.
APPEND TP_TEST3 TO it_message.
APPEND '具体问题请查看附件.' TO it_message.
APPEND ' ' TO it_message.
APPEND '谢谢.' TO it_message.
APPEND ' ' TO it_message.
APPEND '来自,' TO it_message.
APPEND SY-UNAME TO it_message.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT *
*& Send email *
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES pit_message
pit_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA:
ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_email2 LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver value
'[email protected]',
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: TMP_MAIL(40) TYPE C.
DATA: MAIN_EMAIL(40) TYPE C.
DATA: TMP_POS TYPE I .
DATA: ADD_EMAIL(40) TYPE C.
DATA: L_POS TYPE I, R_POS TYPE I, MAIL_LEN TYPE I.
ld_email = p_email.
ld_email2 = p_email2.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
TP_MAIL_MAIN = PA_MAIL.
TP_MAIL = PA_MAIL1.
if sy-subrc = 0 .
t_receivers-receiver = TP_MAIL_MAIN.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
ENDIF.
*READ FROM TP_MAIL LIST
TP_MAIL_TMP = TP_MAIL .
WHILE SY-SUBRC = 0 .
SEARCH TP_MAIL_TMP FOR ', ' .
MAIL_LEN = STRLEN( TP_MAIL_TMP ) .
IF SY-SUBRC = 0 .
TMP_POS = sy-fdpos .
ADD_EMAIL = TP_MAIL_TMP+0(TMP_POS) .
R_POS = TMP_POS + 2 .
L_POS = MAIL_LEN - TMP_POS .
TP_MAIL_TMP = TP_MAIL_TMP+R_POS(L_POS) .
ELSE.
ADD_EMAIL = TP_MAIL_TMP .
ENDIF.
t_receivers-receiver = ADD_EMAIL.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
t_receivers-COPY = 'X' .
APPEND t_receivers.
ENDWHILE.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM *
*& Instructs mail send program for SAPCONNECT to send email *
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
Message was edited by:
shanjing du
Message was edited by:
shanjing duTry the following.
You may need to add language parameter to "CALL METHOD cl_document_bcs=>create_document", or perhaps replace it with a call to the ADD_ATTACHMENT method or some other method of this class - there are public methods for text, MIME, office documents.
==================
*& Report ZLOCAL_EMAIL_TEST
Test of ECC Send email using class CL_BCS
REPORT zlocal_email_test.
DATA:
l_obj TYPE REF TO cl_bcs,
l_recip TYPE REF TO if_recipient_bcs,
l_rec TYPE REF TO cl_cam_address_bcs,
sender TYPE REF TO if_sender_bcs,
note TYPE bcsy_text,
line TYPE soli,
l_address TYPE adr6-smtp_addr,
l_result TYPE os_boolean,
l_sub TYPE string,
text TYPE bcsy_text,
document TYPE REF TO cl_document_bcs.
parameters: p_email like ADR6-SMTP_ADDR visible length 70,
p_uname like sy-uname default sy-uname.
START-OF-SELECTION.
Create email instance
l_obj = cl_bcs=>create_persistent( ).
Build text of message
APPEND 'Hello World' TO text.
APPEND 'Hello World 2' TO text.
APPEND 'Hello World 3' TO text.
APPEND 'Hello World 4' TO text.
Create the email document
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = 'subject line'
I_LENGTH =
I_LANGUAGE = SPACE
I_IMPORTANCE =
I_SENSITIVITY =
i_text = text
I_HEX =
I_HEADER =
I_SENDER =
RECEIVING
result = document.
Add document to email object
CALL METHOD l_obj->set_document
EXPORTING
i_document = document.
Short form version
CALL METHOD l_obj->set_document( document ).
Build long subject line
CONCATENATE 'Long subject' sy-abcde 'with still more'
'Long subject' sy-abcde 'with still more'
'Long subject' sy-abcde 'with still more'
INTO l_sub SEPARATED BY space.
Add long subject to the email
CALL METHOD l_obj->set_message_subject
EXPORTING
ip_subject = l_sub.
Get recipient address in correct format
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = p_email
RECEIVING
result = l_rec.
Add recipient address to the email
CALL METHOD l_obj->add_recipient
EXPORTING
i_recipient = l_rec
i_express = 'X'.
Get Sender address in correct format
CALL METHOD cl_sapuser_bcs=>create
EXPORTING
i_user = p_uname
RECEIVING
result = sender.
Short form version of this method call
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender to the email
CALL METHOD l_obj->set_sender
EXPORTING
i_sender = sender.
Send the email
CALL METHOD l_obj->send
EXPORTING
I_WITH_ERROR_SCREEN = SPACE
RECEIVING
result = l_result.
Required commit work.
COMMIT WORK.
Maybe you are looking for
-
Po is not picking up current exchange rate
hi, in our import po system is not picking up current updated exchange rate.do u have any idea where the problem may be. from where does import po picks up exchange rate? thanks
-
Data Modeler 3.0 EA2: Column type changes to unknown
Drawing a relational model Create table TABLE_1 add Column_1 - number - primary key Create table TABLE_2 add Column_2 - varchar2 - primary key create foreign key TABLE_2_TABLE_1_FK Create unique constraint TABLE_2 for columns Column_2 , TABLE_1_Colum
-
Error in Payment Advice F110_IN_AVIS
Hi, I have copied F110_IN_AVIS to ZF110_IN_AVIS for payment advice SAPSCRIPT. I am using the print program RFFOM100 during automatic payments. I am getting the error : F0251-In form ZF110_IN_AVIS / window MAIN , the element 610-U (Text-U) is missing
-
Command line in text module is not working
Hi , I have the follwoing if condition inside the text module (smartform) but the if statement is not working. /: IF &T001-BUKRS& = '0201'. please ignore /: ENDIF. it is not checking for company code and printing the text. Please let
-
IPhoto '11 suddenly not launching even after reinstalling
I am currently running version 10.6.8 and was using iPhoto '11 for many months without any problems until today! Suddenly slideshows disappeared, so I checked for any updates - which there was one - and downloaded it. I then restarted my computer h