Mail sending exception
Hi All,
I am developing a Contact Us form. The application is giving me the foll. exception
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Unknown SMTP host: mail.exchange.com; nested exception is: java.net.UnknownHostException: mail.exchange.com
My code is as follows:
Properties properties = new Properties();
String SMTPIPAddress = "smtpipaddress";
String SMTPAddress = "smtpaddress";
String mailId = "[email protected]";
Session session;
Provider p;
properties = System.getProperties();
properties.put("SMTPAddress ", "SMTPIPAddress");
session = Session.getDefaultInstance(properties, null);
Message message = new MimeMessage(session);
try{
message.setFrom(new InternetAddress(mailId));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(mailId));
message.setSubject("Conference");
message.setText("Hello");
Transport.send(message);
}catch (AddressException ade) {
wdComponentAPI.getMessageManager().raiseException(ade.toString(),false);
}catch(MessagingException msge){
wdComponentAPI.getMessageManager().raiseException("MessagingException "+msge.toString(),true);
}catch(Exception e){
wdComponentAPI.getMessageManager().raiseException("Exception "+e.toString(),true);
Please let me know what is wrong.
Regards
Nikhil Bansal
Hi Abhijeet,
Thanks for the reply.
I have given the IP address of SMTP address in Java Mail Client in Visual Admin.
However, I am getting the foll. exception
MessagingException javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect
Has it got something to do with the port being opened for SMTP host.
Please let me know.
Regards
Nikhil
Similar Messages
-
Hi All,
I kept mail sending functionality in a bady.
I kept the code in a method and i am using the Function module "SO_NEW_DOCUMENT_SEND_API1" to send the Email.But Suprig this function module returnd SY_SUBRC = 0 but when i checked in the SCOT its not showing the LOG and the mail is not going.I copied the same code and i kept in a Report and tried but here the Mail is sending.
Please help how to resolve this .
Regards
KrishnaHi.
Try using COMMIT WORK statement after the call to the FM.
Also Check the below code.
PARAMETERS: p_mail TYPE ad_smtpadr OBLIGATORY.
DATA: i_mara TYPE STANDARD TABLE OF mara, " MARA Entries
i_marc TYPE STANDARD TABLE OF marc. " MARC Entries
DATA: l_text TYPE char255. " Text
DATA: l_lines TYPE i,
l_size TYPE sood-objlen.
" Size of Attachment
* Mail related
DATA: i_content TYPE soli_tab, " Mail content
i_attach TYPE soli_tab, " Attachment
i_attach1 TYPE soli_tab. " Attachment
DATA: l_send_request TYPE REF TO cl_bcs,
" E-Mail Send Request
l_document TYPE REF TO cl_document_bcs,
" E-Mail Attachment
l_recipient TYPE REF TO if_recipient_bcs,
" Distribution List
l_sender TYPE REF TO if_sender_bcs,
" Address of Sender
l_uname TYPE salrtdrcpt,
" Sender Name(SY-UNAME)
l_bcs_exception TYPE REF TO cx_document_bcs,
" BCS Exception
l_addr_exception TYPE REF TO cx_address_bcs,
" Address Exception
l_send_exception TYPE REF TO cx_send_req_bcs.
" E-Mail sending Exception
*Constants------------------------------------------------------------*
CONSTANTS: c_tab(1) TYPE c VALUE
cl_abap_char_utilities=>horizontal_tab,
" Tab Character
c_cr(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf,
" Line Feed for End-Of_line
c_ext TYPE soodk-objtp VALUE 'XLS'. " XLS Extension
START-OF-SELECTION.
SELECT * FROM mara INTO TABLE i_mara UP TO 20 ROWS.
SELECT * FROM marc INTO TABLE i_marc UP TO 20 ROWS.
* Preparing body of the Mail
MOVE 'Mail Body' TO l_text.
APPEND l_text TO i_content.
* Creates persistent send request
TRY.
l_send_request = cl_bcs=>create_persistent( ).
* Creating Document
l_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = i_content[]
i_subject = 'Material Details' ).
* Preparing contents of attachment with Change Log
PERFORM prepare_attachment.
DESCRIBE TABLE i_mara LINES l_lines.
* Size to multiplied by 2 for UNICODE enabled systems
l_size = l_lines * 2 * 255.
* Adding Attachment
CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type = c_ext
i_attachment_size = l_size
i_attachment_subject = 'Material Details'
i_att_content_text = i_attach[].
DESCRIBE TABLE i_marc LINES l_lines.
* Size to multiplied by 2 for UNICODE enabled systems
l_size = l_lines * 2 * 255.
* Adding Attachment
CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type = c_ext
i_attachment_size = l_size
i_attachment_subject = 'Material Plant Details'
i_att_content_text = i_attach1[].
* Add document to send request
CALL METHOD l_send_request->set_document( l_document ).
* Get Sender Object
l_uname = sy-uname.
l_sender = cl_sapuser_bcs=>create( l_uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
* E-Mail
TRANSLATE p_mail TO LOWER CASE.
l_recipient = cl_cam_address_bcs=>create_internet_address( p_mail )
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'U'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
*Trigger E-Mail immediately
l_send_request->set_send_immediately( 'X' ).
CALL METHOD l_send_request->send( ).
COMMIT WORK.
CATCH cx_document_bcs INTO l_bcs_exception.
CATCH cx_send_req_bcs INTO l_send_exception.
CATCH cx_address_bcs INTO l_addr_exception.
ENDTRY.
*& Form PREPARE_ATTACHMENT
FORM prepare_attachment.
FIELD-SYMBOLS: <lfs_table>, " Internal table structure
<lfs_con>. " Field Content
DATA: l_text TYPE char1024. " Text content for mail attachment
DATA: l_con(50) TYPE c. " Field Content in character format
* Columns to be tab delimeted
LOOP AT i_mara ASSIGNING <lfs_table>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
TO <lfs_con>.
IF sy-subrc NE 0.
CONCATENATE c_cr l_text INTO l_text.
APPEND l_text TO i_attach.
EXIT.
ELSE.
CLEAR: l_con.
MOVE <lfs_con> TO l_con.
CONDENSE l_con.
IF sy-index = 1.
CLEAR: l_text.
MOVE l_con TO l_text.
ELSE.
CONCATENATE l_text l_con INTO l_text
SEPARATED BY c_tab.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
LOOP AT i_marc ASSIGNING <lfs_table>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
TO <lfs_con>.
IF sy-subrc NE 0.
CONCATENATE c_cr l_text INTO l_text.
APPEND l_text TO i_attach1.
EXIT.
ELSE.
CLEAR: l_con.
MOVE <lfs_con> TO l_con.
CONDENSE l_con.
IF sy-index = 1.
CLEAR: l_text.
MOVE l_con TO l_text.
ELSE.
CONCATENATE l_text l_con INTO l_text
SEPARATED BY c_tab.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
ENDFORM. " PREPARE_ATTACHMENT
Please treat above code just as reference...
Hope this helps.
Thanks,
Balaji -
Hi
i have requirement like this employee can change the emergency details online like phone num etc. when he upteted his details the auto mail should go to hr.
to send a mail how to write the logic.
can anybody help me.
Thanks in advance
RevathiHi kavitha,
Please refer following code .I have used jung's blog for this and its running very well.Here if you wil see the code i am sending an internal table in ecel format on an email id with some message.
DATA: l_text1 TYPE char255. " Text
DATA: l_lines TYPE i,
l_size TYPE sood-objlen. " Size of Attachment
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
DATA lo_api_controller TYPE REF TO if_wd_controller.
lo_api_controller ?= wd_this->wd_get_api( ).
lo_message_manager = lo_api_controller->get_message_manager( ).
* Mail related
DATA: i_content TYPE soli_tab, " Mail content
i_attach TYPE soli_tab. " Attachment
DATA: l_send_request TYPE REF TO cl_bcs, " E-Mail Send Request
l_document TYPE REF TO cl_document_bcs, " E-Mail Attachment
l_recipient TYPE REF TO if_recipient_bcs, " Distribution List
l_sender TYPE REF TO if_sender_bcs, " Address of Sender
l_uname TYPE salrtdrcpt, " Sender Name(SY-UNAME)
l_bcs_exception TYPE REF TO cx_document_bcs, " BCS Exception
l_addr_exception TYPE REF TO cx_address_bcs, " Address Exception
l_send_exception TYPE REF TO cx_send_req_bcs. " E-Mail sending Exception
* l_SO_OBJECT_MIME_GET type ref to SO_OBJECT_MIME_GET.
DATA: l_recipient_soos TYPE soos1.
DATA: lv_i_with_error_screen TYPE os_boolean.
DATA: lv_result TYPE os_boolean.
CONSTANTS: c_tab(1) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab, " Tab Character
c_cr(1) TYPE c VALUE cl_abap_char_utilities=>cr_lf, " Line Feed for End-Of_line
c_ext TYPE soodk-objtp VALUE 'XLS'. " XLS Extension
DATA p_uname TYPE so_dir_ext .
p_uname = 'sumit.goenka -avaya.co.in'.
* Preparing body of the Mail
MOVE 'Please execute the trade given in the attached excel file' TO l_text1.
APPEND l_text1 TO i_content.
MOVE '' TO l_text1.
APPEND l_text1 TO i_content.
MOVE '' TO l_text1.
APPEND l_text1 TO i_content.
MOVE 'Warm Regards SAP' TO l_text1.
APPEND l_text1 TO i_content.
* Preparing contents of attachment with Change Log
FIELD-SYMBOLS: <lfs_table> TYPE ANY, " Internal table structure
<lfs_con> TYPE ANY. " Field Content
DATA: l_text TYPE char1024. " Text content for mail attachment
DATA: l_con(50) TYPE c. " Field Content in character format
* Columns to be tab delimeted
LOOP AT detail ASSIGNING <lfs_table>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <lfs_table>
TO <lfs_con>.
IF sy-subrc NE 0.
CONCATENATE c_cr l_text INTO l_text.
APPEND l_text TO i_attach.
EXIT.
ELSE.
CLEAR: l_con.
MOVE <lfs_con> TO l_con.
CONDENSE l_con.
IF sy-index = 1.
CLEAR: l_text.
MOVE l_con TO l_text.
ELSE.
CONCATENATE l_text l_con INTO l_text
SEPARATED BY c_tab.
ENDIF.
ENDIF.
ENDDO.
ENDLOOP.
* Creates persistent send request
TRY.
l_send_request = cl_bcs=>create_persistent( ).
* Creating Document
l_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = i_content[]
i_subject = 'Buy / Sell Order' ).
DESCRIBE TABLE detail LINES l_lines.
* Size to multiplied by 2 for UNICODE enabled systems
l_size = l_lines * 2 * 255.
* Adding Attachment
CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type = c_ext
i_attachment_size = l_size
i_attachment_subject = 'Buy Sell Order Detail'
i_att_content_text = i_attach[].
* Add document to send request
CALL METHOD l_send_request->set_document( l_document ).
* Get Sender Object
l_uname = sy-uname.
l_sender = cl_sapuser_bcs=>create( l_uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
* E-Mail
TRANSLATE p_uname TO UPPER CASE.
l_recipient_soos-recesc = 'U'.
l_recipient_soos-recextnam = p_uname.
* Preparing recepient from SAP Logon Name
CALL METHOD cl_send_request_bcs=>create_recipient_from_soos1
EXPORTING
i_soos1 = l_recipient_soos
RECEIVING
result = l_recipient.
* Add Recipient
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'U'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
*Trigger E-Mail immediately
l_send_request->set_send_immediately( 'X' ).
CALL METHOD l_send_request->send( lv_result ).
IF lv_result IS INITIAL.
* * report message
CALL METHOD lo_message_manager->REPORT_SUCCESS
EXPORTING
message_text = 'Mail sent successfully '.
ENDIF. .
COMMIT WORK.
CATCH cx_document_bcs INTO l_bcs_exception.
CATCH cx_send_req_bcs INTO l_send_exception.
CATCH cx_address_bcs INTO l_addr_exception.
ENDTRY.
If you have any doubt then feel free to ask.
regards
PG -
Mail Send Functionality using SO_NEW_DOCUMENT_ATT_SEND_API1
hi,
i m using Fn Module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send email with attachment.
I have written a program which will fetch data in excel format . this excel should be sent as attachment to specified receiver. however i m having difficulties adding attachment to function module.
I specified under parameter "contents_bin" but its giving some error message related wth structure.
I chkd SDN and wasnt able to find any resolution yet.
Any suggestion or idea which can be useful on this.
Thanks.REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default 'write email address' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
Send email message
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
receivers = it_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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM -
MAIL Sender adapter going in to error
Hello Experts ,
We have configured one mail sender adpater with a custom module to read the attachements in the email message. This was working fine before.
We recently had a restart of the PI servers. After that the channel is going in to error. The first error as per NWA logs is :
failed to call the adapter engine; caused by javax.ejb.EJBException: Exception in getMethodReady() for stateless bean sap.com/com.sap.aii.adapter.mail.app*xml|com.sap.aii.adapter.mail.ejb.jar*xml|XIMailAdapterBean; nested exception is: com.sap.engine.services.ejb3.util.pool.PoolException: javax.ejb.EJBException: Exception raised from invocation of public void com.sap.aii.adapter.mail.ejb.XIMailAdapterBean.ejbCreate() throws javax.ejb.CreateException method on bean instance com.sap.aii.adapter.mail.ejb.XIMailAdapterBean@243be1e1 for bean sap.com/com.sap.aii.adapter.mail.app*xml|com.sap.aii.adapter.mail.ejb.jar*xml|XIMailAdapterBean; nested exception is: javax.ejb.CreateException: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Failed to load messages into Queue AFWSend from database. Reason: com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException occurred in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot get connection. Reason: the thread of component "ejbContexts/sap.com/com.sap.aii.adapter.mail.app/com.sap.aii.adapter.mail.ejb.jar/XIMailAdapterBean" in application "sap.com/com.sap.aii.adapter.mail.app" is currently associated with a restricted resource set and it is not allowed to get connection within it.
After that whenever it is trying to process a message its throwing the below error :
exception caught during processing mail message [588]com.sap.aii.af.lib.mp.module.ModuleException
Has anybody faced thsi error before? Please help!!!
ThanksHi VR
Have you tried swapping by Payload name?
Please try it out with the following configuration, and remove any extra lines - there are duplicate key names and values in your configuration.
You should be able to see the successfully swap by payload name in the audit log as shown below.
Rgds
Eng Swee -
Mail sender adapter POP server not configured for URL access
Hi Experts,
I have a Mail --> PI --> R/3 scenario and I am configuring the Mail sender adapter for POP3. The issue is that the POP server is not configured to be accessed via a URL and hence the URL pop://hostname/ is causing the following error at runtime:
_1. When I use pop://Fully qualified host name/
_Error: exception caught during processing mail message; java.net.UnknownHostException
_2. When I use pop://IP address of host/
_Error: exception caught during processing mail message; java.net.SocketException: Connection timed out:could be due to invalid address
I am able to ping the POP3 server from the PI server using both the FQDN and IP address.
Can someone please help.
Thanks,
Shobhit
Edited by: Shobhit Swarup Mathur on Jul 14, 2009 9:29 AM
Edited by: Shobhit Swarup Mathur on Jul 14, 2009 9:29 AMHi Shobhit
Check with these notes:
804102
xi 3.0 mail adapter with pop3 user authentication problem
810238
XI 3.0 Mail Adapter for POP3 may not report some errors
also check mailserver security settings ...
Connection refused occures when XI cannot connect
in most cases so try checking it again , maybe some ports are not opend on the firewall
Thanks
Edited by: Abhishek Agrahari on Jul 14, 2009 11:44 AM -
Mail Sender Adapter for Exchange 2007 IMAPS account
Hi everybody,
I have the following todo:
I configured a Mail Sender Adapter that is supposed to fetch mails from an IMAP account.
The mails contain text files with data to be processed by XI 3.0 SP 22.
The mail server is Exchange 2007 and requires IMAPS. IMAP is not enough. I read the notes
- 893590 - XI 3.0 Mail sender adapter with IMAP or POP with SSL problem
- 856599 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 Mail Adapter
and configured the sender apapter as follows:
URL: imaps://<ip address>/owa
Authentication method: Plain
User: <domain>\<user>
Password: topsecret
Poll Interval: 5
The first challenge is to setup the adapter with SSL. To do so, I added the Exchange server's
root SSL certificate in the default truststore service-ssl via the KeyStorage service.
This is necessary, as far as I know, to successfully validate the Exchange server's trusted
certifacate which is being transfered to XI during SSL handshake.
Since the communication channel in RWB is in status error with following message:
mail client job stopped completly
exception caught during processing mail message; java.io.IOException: invalid IMAP status response; not finding * STATUS, but 001I NO owa doesn't exist.
mail client job scheduled,
I do not know how to setup SSL for IMAPS. I successfully tested a PING to the Exchange server.
Are there already experiences with Exchange 2007?
What I have to do to fetch mails from an Exchange 2007 IMAPS folder/account with a Mail Sender Adapter?
Kind regards,
AndreasHi,
It should be imap and not imaps.
You can try imap://xxx.xxx.de:993/Inbox
Make sure that port 993 is correct. If you have doubt, then you may try 143 which is default port instead of 993 in the above url.
regards,
ganesh. -
Error in mail sender channel : invalid sequence number
Hello all,
I'm having the following issue.
I'm using the mail adapter to get messages from a mail server, which are attached to the mail.
This interface is already productive, and is working fine most of the time.
Only frequently I get the following error, which can be found in the java log.
exception caught during processing mail message[630];
java.io.IOException: the specified message not found: -ERR invalid sequence
number
This error seems only to appear when there are a lot of mails to be fetched.
All the mail is read into PI and processed succesfully, only I also get a lot these errors.
Does anyone know what causes this error?
I also don't know where this sequence number is coming from, and what's the meaning of this.
Is it possible it's trying to read the same mail more then once?
The settings in the mail sender channel are:
- transport protocol : POP3
- message protocol : XIPAYLOAD
- Use mail package : enabled
- content encoding : none
- Keep attachments : enabled
- QOS : exactly once
- Set adapter specific message attibutes : enabled
The PI version is 7.01
Thanks a lot in advance for the replies on this question.
Kind regards,
Marco van IerselHi
Well we have used it with POP3 and it is working in the way as it should be.
This feature is recommended by sap when the number of emails to be read is large.
You can set this additional parameter to restrict the number of mails fetched by sender mail adapter in one polling interval.
Sometimes the mailbox configured for the sender mail adapter contains large number of unread mails, which exceeds the average expected number of mails in one polling interval. In such a case, processing of all the unread mails in the same polling interval by sender mail adapter degrades the system performance. To avoid this, set value of this parameter to the maximum number of mails to be fetched and processed in one polling interval. The remaining mails exceeding the limit would be processed in the next polling interval.
That's why I have asked you to give it a try. -
Xi mail sender adapter for outlook express configuration
hi,
can somone please tell me how to configure xi mail sender adapter for reading from inbox of outlook express?
i keep getting errors in communication channel monitor:
"exception caught during processing mail message; java.io.IOException: unexpected user response; read -ERR Command is not valid in this state."
Thanks
TomerHi,
use below link,finish the configuration of sender mail adapter,many documents available on the same in sdn,search your self
http://www.riyaz.net/blog/xipi-configuring-the-sender-mail-adapter/
Cheers,
Raj -
Mail Sender Adapter with IMAPS
Hi,
I had a Mail Sender Adapter running fine with imap. Our Email Server has changed now to secure protocol. Therefore I need to use the Mail Sender Adapter with IMAPS. If I use imaps://<mailserver>:993 in the channel configuration the Mail Adapter aborts with error "not initialized; mail agent null" and in the default trace it says "failed to initialize the channel: java.io.IOException: illegal protocol for XMBIMAPInitiator: imaps#". If I configure the Mail Adapter with <b>imap</b>://<mailserver>:993 the Mail Adapter starts and says "running", but it does not poll the postbox. In the security.log file there is a warning about untrusted certificates "com.sap.security.core.server.https.SecureConnectionFactory#Plain###Attempting to create outgoing ssl connection without trusted certificates#". I did already import the (CA) Certifcate of the mailserver with key storage service of J2EE Engine in the Trusted area and I configured the J2EE Engine for using SSL (the https access to the J2EE Engine works fine).
What is still missing in XI 3.0 (SP12)? I can access the postbox securely with e.g. Thunderbird using port 993.
Has anyone an idea or had already this issue?
Thanks for any help in advance.
PeterHi Sebastian ,
The Mail sender --IMAPS , did it solve your issue because i fcae the same kind of Error in Communication Channel :
exception caught during processing mail message; java.io.IOException: unable to create a socket
Mail sender CC:imaps://NZxxx.dknz.nzcorp.net:993/NZDKINVOICES
-Login Credentials is correct.
-Defualt XI Paramters are correct
-Mail Server is the right one
-Tried in command prompt , N:/telnet NZxxx.dznz.corp.net 143 , but i get response : Could not open connection to the host, on port 143 .Connection Failed
Could you kindly assist
Thanks,
Vara -
Communcation Channel Type E-Mail Receiver Exception thrown in method proces
Hi,
I use a scenario R/3 IDOC -> XI -> Email. It is working, however the email is send 4 times.
I have an error within a communication channel.
Adaptertype E-Mail Direction Receiver
The communcation channel message log show the following entry:
2008-08-14 12:47:09 Erfolgreich Message wurde erfolgreich vom Messaging-System empfangen. Profil: XI URL: http://host:port/MessagingSystem/receive/AFW/XI Credential (User): PIISUSER
2008-08-14 12:47:09 Erfolgreich Mit der Verbindung Mail_http://sap.com/xi/XI/System. Versuch die Message in die Empfangs-Queue zu stellen
2008-08-14 12:47:09 Erfolgreich Message erfolgreich in Queue gestellt
2008-08-14 12:47:09 Erfolgreich Die Message wurde erfolgreich aus der Empfangs-Queue abgerufen
2008-08-14 12:47:09 Erfolgreich Der Status der Message wurde auf DLNG gesetzt
2008-08-14 12:47:09 Erfolgreich Liefert an Kanal: CC_Application_Mail_RCV
2008-08-14 12:47:09 Erfolgreich MP: Tritt in den Modulprozessor ein
2008-08-14 12:47:09 Erfolgreich MP: Lokales Modul localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean wird verarbeitet
2008-08-14 12:47:09 Erfolgreich Mail: message entering the adapter
2008-08-14 12:47:09 Erfolgreich Mail: Receiver adapter entered with qos ExactlyOnce
2008-08-14 12:47:09 Erfolgreich Mail: calling the adpter for processing
2008-08-14 12:47:09 Erfolgreich Mail: call completed
2008-08-14 12:47:09 Erfolgreich Mail: continuing to response message 58650010-69ee-11dd-bc24-0018fe76622e
2008-08-14 12:47:09 Erfolgreich Mail: sending a delivery ack ...
2008-08-14 12:47:09 Erfolgreich Mail: sent a delivery ack
2008-08-14 12:47:09 Erfolgreich MP: Lokales Modul localejbs/AF_Modules/MessageTransformBean wird verarbeitet
2008-08-14 12:47:09 Fehler MP: Ausnahme aufgetreten mit Grund com.sap.engine.services.ejb.exceptions.BaseTransactionRolledbackLocalException: Exception thrown in method process. The transaction is marked for rollback.
2008-08-14 12:47:09 Fehler Ausnahme aufgetreten beim Adapter-Framework: Exception thrown in method process. The transaction is marked for rollback.
2008-08-14 12:47:09 Fehler Zustellung der Message an die Anwendung über Mail_http://sap.com/xi/XI/System ist fehlgeschlagen weil: com.sap.aii.af.ra.ms.api.RecoverableException: Exception thrown in method process. The transaction is marked for rollback.: com.sap.engine.services.ejb.exceptions.BaseTransactionRolledbackLocalException: Exception thrown in method process. The transaction is marked for rollback.
2008-08-14 12:47:09 Erfolgreich Der Status der Message wurde auf WAIT gesetzt
2008-08-14 12:47:09 Erfolgreich Die Zustellung der asynchronen Message um Thu Aug 14 12:52:09 CEST 2008 wurde erfolgreich eingeplant.
Does anybody know what do to?
Best regards,
Nils KlothHi,
it seems that the module processing is not working, if the flag keep attachments is not checked.
Best regards,
Nils Kloth -
hi experts
I want to send 2 attachments(.XLS) to email ,through the function module 'SO_DOCUMENT_SEND_API1' can any 1 guide me through step by step procedure.
regards
PRASUNhi check this example..
REPORT ZMAIL.
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver .
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
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.
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,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
data: ld_store(50) type c. "Leading zeros
CONSTANTS: con_cret(5) TYPE c VALUE '0D', "OK for non Unicode
con_tab(5) TYPE c VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
*Modification to retain leading zeros
inserts code for excell REPLACE command into ld_store
=REPLACE("00100",1,5,"00100")
concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
wa_charekpo-ebelp '")' into ld_store .
concatenate ld_store into .xls file instead of actual value(ebelp)
CONCATENATE wa_charekpo-ebeln ld_store wa_charekpo-aedat wa_charekpo-matnr INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& 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_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.
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_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-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 = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
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.
*& 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
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
regards,
venkat -
REfresh : it_message.
clear : it_message[].
APPEND 'Hi Sir/Madam,' TO it_message.
APPEND '' TO it_message.
APPEND 'Kindly approve the submitted leave request' TO it_message.
APPEND '' TO it_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = 'Leave Request for Approval'. "psubject.
gd_doc_data-sensitivty = 'S'.
gd_doc_data-no_change = space.
Describe the body of the message
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
Add the recipients email address
CLEAR it_receivers.
REFRESH it_receivers.
it_receivers-receiver = p_final_tab_emailid. "p_email.
it_receivers-rec_id = 'DEVELOPER'.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
APPEND it_receivers.
Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_txt = it_message
receivers = it_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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
LOOP AT it_receivers.
ENDLOOP.
WAIT UP TO 2 SECONDS.
IF gd_error EQ 0.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
when i execute this conding for mail sending i'm getting one pop up when i press enter only mail is going i dont need that popup to be displayed for that what should i do in my coding.,,
Can some one suggest me.,.,
Thanks and Regards.
Thirukumaran. RREfresh : it_message.
clear : it_message[].
APPEND 'Hi Sir/Madam,' TO it_message.
APPEND '' TO it_message.
APPEND 'Kindly approve the submitted leave request' TO it_message.
APPEND '' TO it_message.
* Fill the document data.
* gd_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = 'Leave Request for Approval'. "psubject.
gd_doc_data-sensitivty = 'S'.
gd_doc_data-no_change = space.
* Describe the body of the message
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
* Add the recipients email address
CLEAR it_receivers.
REFRESH it_receivers.
it_receivers-receiver = p_final_tab_emailid. "p_email.
* it_receivers-rec_id = 'DEVELOPER'.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
* it_receivers-notif_del = 'X'.
* it_receivers-notif_ndel = 'X'.
APPEND it_receivers.
* Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_txt = it_message
receivers = it_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.
* Store function module return code
gd_error = sy-subrc.
* Get it_receivers return code
* LOOP AT it_receivers.
* ENDLOOP.
WAIT UP TO 2 SECONDS.
IF gd_error EQ 0.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF. -
What's the problem of this mail sending program
Hi,
I have Written following code. I have wriiten & run this code in Eclipse. Mail.jar & Activation.jar both jar file i kept in the webcontent/web-inf/lib
directory. & I also added this jar file using builpath->add External Library. But when run this code then it throws the following exception. What's the problem of code? IS there anybody can help me? Please help me.
My code is : UserMail.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<title>Mail Sending Program</title>
<%@ page import="javax.mail.internet.*"%>
<%@ page import="javax.mail.*"%>
<%@ page import="java.util.*"%>
</head>
<body>
<%
String to = "[email protected]";
String from = "[email protected]";
String host = "192.168.1.1";
String txt = "I am from jsp of java";
String subject = "For testing";
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session1 = Session.getDefaultInstance(props, null);
MimeMessage msg = new MimeMessage(session1);
try{
InternetAddress to1 = new InternetAddress(to);
msg.setFrom(new InternetAddress(from));
msg.addRecipient(Message.RecipientType.TO,to1);
msg.setSubject(subject);
msg.setText(txt);
msg.setSentDate(new Date());
Transport.send(msg);
catch(Exception e){
e.printStackTrace();
%>
</body>
</html>Exception is:
javax.mail.MessagingException: Could not connect to SMTP host: 192.168.1.1, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at org.apache.jsp.UserMail_jsp._jspService(UserMail_jsp.java:73)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: Software caused connection abort: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 27 moreWith regards
Binajavax.mail.MessagingException: Could not connect to SMTP host: 192.168.1.1Is this host Ip correct. If Ip is correct then this host should be a mail exchange server. Hope u did not use Ip address of ur machine ;-)
By the way hope u recd the test mail during my testing....lol
Regards
Rohit -
Mail Sending issue to Outlook - Mail Request not Showing in SOST
Hi,
Im using mail sending logic for sending a mail to Creator of Billing. i have one itab which is having two Users with two different mail IDs. i need to send a mail to those user mail ids to Outlook
user Mail id
12 XXX
12 XXX
13 YYY
13 YYY
at end of User i need to send a mail..
loop at itab.
at end of user.
here sending a mail...for the first user it is sending mail perfectly..and mail request is available in SOST . once its comes to second user sending a mail getting sy-subc = 0 after SO_NEW_DOCUMENT_ATT_SEND_API1 FM..and mail request Not coming for second mail id in SOST both mails also available in Sap out box.
endat.
endloop.
Kindly Help me out..
Regards
DileepHi,
to send mails use this:
FORM docu_send_email USING pv_otfdata TYPE tsfotf
pv_emailid TYPE any
pv_formname TYPE any.
DATA: lv_filesize TYPE i,
lv_buffer TYPE string,
lv_attachment TYPE i,
lv_testo TYPE i.
DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
li_mess_att TYPE STANDARD TABLE OF solisti1,
li_mtab_pdf TYPE STANDARD TABLE OF tline,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objtxt TYPE STANDARD TABLE OF solisti1,
li_objbin TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objhead TYPE soli_tab.
DATA: lwa_pdfdata TYPE tline,
lwa_objpack TYPE sopcklsti1,
lwa_mess_att TYPE solisti1,
lwa_objtxt TYPE solisti1,
lwa_objbin TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_doc_chng TYPE sodocchgi1.
CONSTANTS: lc_u TYPE char1 VALUE 'U',
lc_0 TYPE char1 VALUE '0',
lc_1 TYPE char1 VALUE '1',
lc_pdf TYPE char3 VALUE 'PDF',
lc_raw TYPE char3 VALUE 'RAW',
lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = lc_pdf
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = pv_otfdata
lines = li_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 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.
LOOP AT li_pdfdata INTO lwa_pdfdata.
TRANSLATE lwa_pdfdata USING ' ~'.
CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
CLEAR lwa_pdfdata.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.
DO.
lwa_mess_att = lv_buffer.
APPEND lwa_mess_att TO li_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Object with PDF.
REFRESH li_objbin.
li_objbin] = li_mess_att[.
DESCRIBE TABLE li_objbin LINES lv_attachment.
Object with main text of the mail.
lwa_objtxt = space.
APPEND lwa_objtxt TO li_objtxt.
CLEAR lwa_objtxt.
DESCRIBE TABLE li_objtxt LINES lv_testo.
Create the document which is to be sent
lwa_doc_chng-obj_name = text-008.
lwa_doc_chng-obj_descr = text-008.
lwa_doc_chng-sensitivty = lc_0.
lwa_doc_chng-obj_prio = lc_1.
lwa_doc_chng-doc_size = lv_testo * 225.
Pack to main body.
CLEAR lwa_objpack-transf_bin.
header
lwa_objpack-head_start = 1.
The document needs no header (head_num = 0)
lwa_objpack-head_num = 0.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_testo.
lwa_objpack-doc_type = lc_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
Create the attachment.
Fill the fields of the packing_list for the attachment:
lwa_objpack-transf_bin = gc_x .
header
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_attachment.
lwa_objpack-doc_type = lc_pdf.
lwa_objpack-obj_name = lc_attachment.
lwa_objpack-obj_descr = text-008.
lwa_objpack-doc_size = lv_attachment * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
lwa_reclist-receiver = pv_emailid.
lwa_reclist-rec_type = lc_u.
lwa_reclist-notif_del = gc_x.
lwa_reclist-notif_ndel = gc_x.
APPEND lwa_reclist TO li_reclist.
IF li_reclist IS NOT INITIAL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = gc_x
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " DOCU_SEND_EMAIL
Maybe you are looking for
-
Yosemite 10.10.3 and Photoshop Elements 13
I upgraded my Mac OS to Yosemite 10.10.3 two days ago, uninstalled and reinstalled photoshop elements 13, updated all of the elements updates, and installed the java for OSx 2014-001. Nothing has fixed this problem. When I go to open a photo in El
-
Dictation on a 2009 MacMini won't work
Hi there, my first post; question ;-) On my MacMini 2,26GHZ from 2009 I installed Mountan Lion. I tried to get the dictation part working. Everything was configured, but when I try to speak text into Pages, the Icon apperars, shakes a short time and
-
In E-recruiting how to identify a rehire candidate?
Hi, Please let us know if you have worked on the following: 1) How can we identify in e-recruiting that an external candidate was a previous employee of the company at some point in time? OR how to identify that the candidate had a record in SAP PA i
-
How to create great logo in illustrator simple tool ???
Create the logo with simple tools use for the illustrator.
-
HT201317 what is the icloud control panel and where do i find it
i just swaped my ipad to a refurbished one and i can not get my photos back on my ipad 2