Reg : Mail attchment
Hi Experts,
I am in requirment of sending an attachement through mail.I have wirtten code for that in which the functional module 'SO_NEW_DOCUMENT_ATT_SEND_API1' is used and the sy-subrc value is getting 0. After this function module the report RSCONN01 with required parameters.
But the mail attachement is not getting in the specified mail box. Could any of you please help me out in this regard.Any babsis setting is required? Please send the response ASAP.
Regards,
Ramkishore.
Hi ,
Check out this code.
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = entries.
objpack-doc_type = 'RAW'.
APPEND objpack.
Creating the document attachment
(Assume the data in OBJBIN are given in BMP format)
LOOP AT v_joboutput-otfdata INTO wa_otfdata.
APPEND wa_otfdata TO objbin.
CLEAR wa_otfdata.
ENDLOOP.
DESCRIBE TABLE objbin LINES tab_lines.
<b>objhead = 'NonSignerDetails.otf'. APPEND objhead.</b>
Creating the entry for the compressed attachment
<b> objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'OTF'.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'NonSignerDetails'.
objpack-doc_size = tab_lines * 255.</b>
APPEND objpack.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objcont
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
regards,
Santosh Thorat
Similar Messages
-
Hi Experts,
I want to set-up a mail server so as to perform some email-related scenarios, so please tell me the procedure to set-up a mail server in my local desktop. Is it cumbersome to set-up a mail server for testing purposes?
Can I use one of the options available on www.google.com? Is it reliable?
Thanks.
Edited by: Abhishek01 on Jul 23, 2009 12:16 PMHi,
Better to checkw with your network team for desk top mai server, why because we need few autoorization for configuration.
Follow below steps for mail configuration.
1. First we need to configure basis level setp like SMTP, POP3 through Tcode SCOT then
2. Take URL for SMTP & POP3 from your network team & basis team
3. Follow below links for scenario configuration
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure -
Please check the code reg mail implementation and give guide lines to me
Hi experts
I written some code for implementing the mail in webdynpro using java mail API,i did not get the out put ,Is any configuration i have to do in webdynpro or WAS
Can any body review my code and tell me where i mistaken in the implementation .Is there any thing i want to configure .Here with i am sending my code in the action of Send button
public void onActionSendMail(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionSendMail(ServerEvent)
// get the values entered by the user in the form
try{
String toAddress=wdContext.currentContextElement().getTo();
String ccAddress=wdContext.currentContextElement().getCC();
String bccAddress=wdContext.currentContextElement().getBCC();
String subject=wdContext.currentContextElement().getSubject();
String messageBody=wdContext.currentContextElement().getMessage();
//set the properties of host and port no
Properties p = new Properties();
p.put("mail.transport.protocol","smtp");
p.put("mail.smtp.host","12.38.145.108");
p.put("mail.smtp.port","25");
//get the session object or connection to the mail server or host
Session sess=Session.getDefaultInstance(p,null);
//create a MimeMessage and add recipients
MimeMessage message = new MimeMessage(sess);
if(toAddress !=null && toAddress.length()>0){
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
}else
wdComponentAPI.getMessageManager().reportSuccess("Please Enter the To Address");
if(bccAddress !=null && bccAddress.length()>0)
message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bccAddress));
if(ccAddress !=null && ccAddress.length()>0)
message.addRecipient(Message.RecipientType.CC, new InternetAddress(ccAddress));
if(subject!=null && subject.length()>0)
message.setSubject(subject);
message.setFrom(new InternetAddress("[email protected]"));
if((messageBody!=null) && (messageBody.length()>0))
message.setContent(messageBody,"text/plain");
}else
message.setContent("","text/plain");
Transport.send(message);
catch(Exception e)
e.printStackTrace();
Please mail to : [email protected]
Thanks and regards
kalyanHi Venkat,
The code seems ok to me. you don't need to configure WAS to use JavaMail APIs. However, if this code doesnot work then check with the code given below as this is working fine.
Properties prop = new Properties();
prop.put("mail.smtp.host", host);
prop.put("mail.smtp.auth", "false");
Session session = Session.getInstance(prop, null);
session.setDebug(true);
try {
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address =
{ new InternetAddress(to1)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
MimeBodyPart msg1Body = new MimeBodyPart();
msg1Body.setText(msg1);
MimeBodyPart msg2Body = new MimeBodyPart();
msg2Body.setText(msg2);
Multipart mp = new MimeMultipart();
mp.addBodyPart(msg1Body);
mp.addBodyPart(msg2Body);
msg.setContent(mp);
Transport.send(msg);
} catch (AddressException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.print("AddressException : " + e.getMessage());
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.print("MessagingException : " + e.getMessage());
} catch (Exception e) {
System.out.print("Exception : " + e.getMessage());
where host is 12.38.145.108 in your case. May be you chk if your mail server is using another port. 25 is the default port for the smtp. This may be the case that your code is not working.
Regards:
Abhinav Sharma
PS : Do reward points if it helps -
Hi all,
In my report , i am sending mails to the user id which i am giving in the selection screen. i am getting the mails when i execute the report.
But when i see the mails in the SOST transaction , i am not getting,
could anyone suggest me the solution?
hoping for ur wonderful support!!!!!!
Regards'
KarthikHi,
use this class,
text-022 , text-021 and text-022 are the your selection screen parameters.
FORM send_mail TABLES p_it_error_records LIKE it_error_records p_it_parked_documents
LIKE it_success_records USING p_count TYPE string p_text TYPE string.
DATA: send_request TYPE REF TO cl_bcs,
att_text TYPE bcsy_text, "#EC NEEDED
document TYPE REF TO cl_document_bcs, "#EC NEEDED
sender TYPE REF TO cl_sapuser_bcs, "#EC NEEDED
recipient TYPE REF TO if_recipient_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
v_str(255) TYPE c,
wa_receivers TYPE adr6,
wa_text TYPE bcsy_text,
v_subject TYPE so_obj_des.
DATA:it_receivers TYPE TABLE OF adr6.
wa_receivers-smtp_addr = text-020.
APPEND wa_receivers TO it_receivers.
CLEAR wa_receivers.
wa_receivers-smtp_addr = text-021.
APPEND wa_receivers TO it_receivers.
CLEAR:wa_receivers,
wa_bdcmsgcoll.
wa_receivers-smtp_addr = text-022.
APPEND wa_receivers TO it_receivers.
CLEAR wa_receivers.
CONCATENATE text-004 sy-datum INTO v_subject SEPARATED BY space.
TRY.
---- create persistent send request -
send_request = cl_bcs=>create_persistent( ).
---- create and set document with attachment -
create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = wa_text
i_length = '60'
i_subject = v_subject ).
--add attachment to document--
REFRESH wa_text.
CONCATENATE p_count p_text INTO v_str.
APPEND v_str TO wa_text.
LOOP AT p_it_parked_documents INTO wa_bdcmsgcoll1 . " For Success Records
AT FIRST.
MOVE text-016 TO v_str.
APPEND v_str TO wa_text.
CLEAR v_str.
ENDAT.
CONCATENATE wa_bdcmsgcoll1-msgv3 wa_bdcmsgcoll1-msgtyp wa_bdcmsgcoll1-msgnr
wa_bdcmsgcoll1-msgv2 wa_bdcmsgcoll1-msgv1 text-014 INTO v_str SEPARATED BY space.
APPEND v_str TO wa_text.
clear v_str.
ENDLOOP.
LOOP AT p_it_error_records INTO wa_bdcmsgcoll1 . "For Error Records
AT FIRST.
MOVE text-015 TO v_str.
APPEND v_str TO wa_text.
clear v_str.
ENDAT.
CONCATENATE wa_bdcmsgcoll1-msgv3 wa_bdcmsgcoll1-msgtyp wa_bdcmsgcoll1-msgnr wa_bdcmsgcoll1-msgv2
wa_bdcmsgcoll1-msgv1 wa_bdcmsgcoll1-msgv4 INTO v_str SEPARATED BY space.
APPEND v_str TO wa_text.
clear v_str.
ENDLOOP.
CALL METHOD document->add_attachment "Adding Attachment
EXPORTING
i_attachment_type = 'RAW'
i_attachment_subject = v_subject
i_attachment_size = '60'
i_att_content_text = wa_text.
add document to send request
CALL METHOD send_request->set_document( document ).
LOOP AT it_receivers INTO wa_receivers . "Recievers SMTP address
recipient =
cl_cam_address_bcs=>create_internet_address( wa_receivers-smtp_addr ).
----add recipient with its respective attributes to send request-
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
---- send document -
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
MESSAGE s053(ZFI).
ENDIF.
COMMIT WORK.
* exception handling
CATCH cx_bcs INTO bcs_exception. " Exception while sending mail
WRITE: text-009 , bcs_exception->error_type.
EXIT.
ENDTRY.
ENDFORM. "seding_mail
this will work fine
thanks and regards,
rakesh -
Reg: mail need to be trigger for salary change
Hi gurus,
I have one requirement.
If any one does the changes in salary I mean in infotype 0008 then one mail need to be trigger.
Can any one tell me the procedure how to do this requirement?
Regards
RameshHI Soumya,
Thank you very much .
I have found one BOR for this workflow
BOR name : BSAICPAY
if any changes happen in infotype 0008 then changes event will tiger in this bor.
I completed this requirement trough simple workflow
Thank you all
Thank you for your support
Regards
RameshG -
Busines service reg mail adapter
Hi
I am working on scenario idoc(sender) to mail(reciever),sender idoc is aleaud,reciever is mail of format mailpackage, i am taking reciever as business service,when i am running the scenario the message is comming into xi,but it is not triggering mail adapter, in reciever mail adapter also i maintained all the parametrs, what could be the possible error, do i need to maintain the reciever mail as business system in sld or i can go ahead with business service. i am sending the mail to my company mail.
regards
raghuHi,
As of NetWeaver04 (XI 3.0), SP15 or NetWeaver04s (XI 7.0) Support Package 06, it is possible to define a security level for certain HTTP-based XI inbounds. This is done in the directory in the corresponding sender channels.
The following HTTP-based adapters/inbounds are supported:
Integration Server:
o XI protocol
o Plain HTTP adapter
Adapter Engine:
o SOAP adapter
The following HTTP security levels are possible (in ascending order):
HTTP without SSL
HTTP with SSL (= HTTPS) without client authentication
HTTP with SSL (= HTTPS) with client authentication
HTTPS configuration:
Note that for the HTTPS security levels with and without client authentication, you must configure the integration server (ABAP WebAS) or the adapter engine (J2EE WebAS) accordingly. This configuration basically affects the following aspects:
- Installing the SAP Cryptographic Library (both in ABAP and J2EE WebAS)
- Generating and maintaining certificates for the HTTPS server role
- Configuring and mapping the client certificates that are used onto the corresponding internal users (in client authentication). In J2EE WebAS, you must select the option "Request Client Certificate" on the tab "Runtime" and "Client Authentication" in visual admin in the dispatcher service "SSL Provider".
In this regard, see also the SAP Help Portal at http://help.sap.com/ -> Documentation -> SAP NetWeaver -> SAP NetWeaver 2004s (or SAP NetWeaver '04) under SAP NetWeaver Library -> Administrator's Guide -> SAP NetWeaver Security Guide -> Security Guides for NetWeaver according to Usage Types -> Security Guide for Usage Type PI -> SAP NetWeaver Process Integration Security Guide -> Network and Communication Security -> HTTP and SSL.
SOAP adapter configuration:
You still have to configure the SOAP adapter, particulary in visual admin. To do this, change the relevant SOAP adapter service sap.com/com.sap.aii.af.soapadapter*XISOAPAdapter in the security provider service (under -> Runtime-> Policy Configurations). Under the Authentication tab set the list of login modules as follows:
ClientCertLoginModule, SUFFICIENT
BasicPasswordLoginModule, SUFFICIENT
You do not need to enter anything specific into the Options column.
Regards
Aashish Sinha -
Hi,
I have a requiremnt like i need to pick the txt file from the sender side and place that file to the targer. Once the Tarfget file is place i need to send mail with the input file as attachement and body of the mail should have few details from the payload.
In interfface determination i have checked maintian oreder at runtime. ISo when the file is placed then only mail is sent.
The problem is i am able to get the content in the mail bosy. But i am not able to send input file as an attachment.
I have seen many blogs in SDN, but only body or attachemnt is possible at a time. Otherwise i need to do XSLT mapping or java mapping for this..
Can u please help in this issue.
Regards,
Ramana'You can either have attachment or email-body using the mail adapter....both of them are not supported at the same time (in standard functionality).
Update:
If you are looking for an option then having a JAVA mapping will help you create both body and attachment:
/people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping
But the sa,e cannot be achieved using message mapping.
Regards,
Abhishek.
Edited by: abhishek salvi on Mar 18, 2010 4:17 PM -
Hi All,
How to trigger a mail when an sales order is created to particular mail ids with the sales order number? Is there any enhancements available or we need to develop workflows?
Regards,
ArpitamHi,
Your requirement can be fulfilled by configuring an output type which needs to be triggered while creating a sales order.
The output type has to be configured using the tcode NACE You need to build the logic to trigger mail to the customer in the driver program. Please check the below link for more details on how to send MAIL
http://wiki.sdn.sap.com/wiki/display/Snippets/Send+mail+via+SAP+ABAP+Code -
hi ,
In my workflow..when ever quotation is created.(suppose USER1 has created quotation)......
Workflow starts and there is an activity with task and rule in task.
The rule finds the responible agent and sends the work item to that ID (suppose USER2 has received the workitem).
After the agent checks the workitem in his inbox..and approves the quotation..... a mail should be sent to the user who careted quataion(USER1).
I kept a mail step below thw activity with agent as workflow intitaor.
but its not working.
what would be the mistake??
Can anyone help me ????
regards
ArjunHi Arjun,
Check if you are able to get the value of the WF initiator in the workflow container.
This would only come if you have binded the triggering event container to the workflow container.
This is done in 'Basic Data' button, 'Start Events' tab. Here do the binding in between the event and the workflow as &_EVT_CREATOR& => &_WF_INITIATOR&.
Hope this helps!
Regards,
Saumya -
hi,
I have a user decision with approve reject outcomes.
and this user decision step is sent to 3 different users (USERID1, USERID2, USERID3) with help of RULE.
when user 1 clicks approve .......a mail is sent him(to his userid USERID1) saying that he clciked approve outcome.
similarly
when user 2 approves .......a mail is sent to his userid only(to his userid USERID2) ,
when user 3 approves .......a mail is sent to his userid only (to his userid USERID3) .
how to acheive this?????
i kept a mail step after user decision step????
bue i need to asssign the receiver ..so i selected the EXPRESSION and select the container variable &AGENT&.
But this is not working .
Can anyone help me??
Regards
arjun .hi siva,
That was really gr8 answer from u.
ur magic really worked out in a sec .
thx very much .
regards
Arjun -
Reg:Mails are in waiting status in SOST
Hi Experts,
We have configured mails to be sent to all the DCs in one of our Retail production servers.
can you please,guide us thru so that we can process the mails automatically and what could be the possible reason for the mails being held in SOST
Thanks in advance
Regards
Venu> All the mails are in waiting status with an error message,"Wait for communications service"
So you did configure an outgoing gateway where the SAP system should send those mails?
http://help.sap.com/saphelp_nw70/helpdata/EN/af/73563c1e734f0fe10000000a114084/frameset.htm
Markus -
hi all,
i am using jes 2005Q4 and msg server 6.0.
in detail---
Sun Java(tm) System Messaging Server 6.2-3.04 (built Jul 15 2005)
libimta.so 6.2-3.04 (built 01:43:03, Jul 15 2005)
SunOS sunt2000 5.10 Generic_118833-17 sun4v sparc SUNW,Sun-Fire-T200
i am using a domain demo.admin.com which is the child of admin.com.my exact problem is i can send mails to all domains like gmail,
yahoo but not to admin.com.And again,i am receiving mails only from my domain(only from demo.admin.com),not from any external domains.
i am getting smtp error 550 5.1.1---user unknown from the relevant domains
i am getting struck with this issue.please help me.thanks in advance.
regards,
MadhaviHey, I know how to use that(JDBC thing).
My question is how does one retrieve data (email messages) from a mail server ( I have downloaded Java Mail Server)? What is the interface and how is it done?
How is it done actually in practice?
Please help.
Vivek -
Hi experts (reg mail sending)
Dear all
i am having a internal table .
TYPES: BEGIN OF ty_messages ,
lifnr LIKE pa0315-lifnr, "contract number
pernr TYPE c LENGTH 8,
ebeln LIKE pa0315-ebeln,
ebelp TYPE c LENGTH 5,
curr_amount LIKE pc207-betrg,
belnr TYPE rseg-belnr,
buzei TYPE rseg-buzei,
invdate TYPE sy-datum,
invtime TYPE sy-uzeit,
gjahr TYPE gjahr,
invoice TYPE re_belnr,
message_text(400),
END OF ty_messages.
DATA: int_messages TYPE TABLE OF ty_messages WITH HEADER LINE.
i want to send this internal table to this function module.'SO_NEW_DOCUMENT_SEND_API1' to send mail.
but the problem is the message field length is 400. but the object content field contains only 255 char in the function module . how can i do this ?
kind regards
karthikDear all
i am having a internal table .
TYPES: BEGIN OF ty_messages ,
lifnr LIKE pa0315-lifnr, "contract number
pernr TYPE c LENGTH 8,
ebeln LIKE pa0315-ebeln,
ebelp TYPE c LENGTH 5,
curr_amount LIKE pc207-betrg,
belnr TYPE rseg-belnr,
buzei TYPE rseg-buzei,
invdate TYPE sy-datum,
invtime TYPE sy-uzeit,
gjahr TYPE gjahr,
invoice TYPE re_belnr,
message_text(400),
END OF ty_messages.
DATA: int_messages TYPE TABLE OF ty_messages WITH HEADER LINE.
i want to send this internal table to this function module.'SO_NEW_DOCUMENT_SEND_API1' to send mail.
but the problem is the message field length is 400. but the object content field contains only 255 char in the function module . how can i do this ?
kind regards
karthik -
Hi friends,
1. I have created a report by using the function module 'SO_DOCUMENT_SEND_API1' to send mail to
the user with attachments.But in my report i can able to send only one attachment. Now I want to send more
than one attachment in the mail. How can i send?
2. while using document type 'XLS' type , I can able to get '.XLS' attachment but i cant get the attached datas
in correct alignment. Instead of getting line items one by one, i am getting all the line item details in a single line in the excel
sheet. How can i clear this problem? Thanks in advance...
Regards,
Sakthivel.VThi,
yes you can send more then one attachment in a mail.
see below/:-
DATA:objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE, " internal tables declared for sending attachments to the mail
"*Attachment
n = 1. "for sending 1st attachment
DESCRIBE TABLE objbin1 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment1'.
objpack-obj_descr = 'Excel File Attachment1'.
APPEND objpack.
n = n + tab_lines. "for sending 2nd attachment
DESCRIBE TABLE objbin2 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment2'.
objpack-obj_descr = 'Excel File Attachment2'.
APPEND objpack.
n = n + tab_lines. "for sending 3rd attachment
DESCRIBE TABLE objin3 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment3'.
objpack-obj_descr = 'Excel File Attachment3'.
APPEND objpack.
*Create the list of recipients
reclist-receiver = p_email1.
reclist-rec_type = 'U'.
reclist-express = 'X'.
APPEND reclist.
*Send the e-mail by using this function module
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_bin = objbin_final
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
COMMIT WORK.
regards
Ritesh -
Mail Adapter: original Attachment filename retrieval in Proxy
Hi,
I have a Sender Mail Adapter, and the receiver is a proxy, where I need to get the attachment and its details.
When I execute
attachment_filename = l_attachment->GET_DOCUMENT_NAME( ).
it simply returns Attachment-1 etc.
How do I get the original attachment filename?
I am on SP16.
Regards,
Puloma.HI
Please refer tihs thread for mail attchments
Re: Handling attachments of mail
Scenario to pick the mail with its attachments into XI\Re: Infrastructure required for Mail Adapter
Maybe you are looking for
-
What do I need to open a document ending in " .pub"
What do I need to open a .pub document? Thanks, Jane
-
In FF 29.0, how to move the address bar on the top of the tabs bar?
It is OK in Firefox 28 and lower to set browser.tabs.onTop=false to move the address bar on the top of the tabs bar. But in Firefox 29, I can not find the browser.tabs.onTop who can tell me how to move the address bar to the top of the tabs bar?
-
Using iPod without the battery
I just picked up an iPod that I want to use at work. Can I just plug it in using the USB adapter and not use the battery at all? It seems like it would be nice if I never really had to use up the battery. -Matthew
-
I need 3 or 4 blank pages which I can add to at random - How, please ?
Hello, I have my home page on FF but I need several extra pages. I didn't realise that it could be difficult. I've used FF on my old PC for 2/3 years but I've added a few years and a new PC and I'm now 78yrs so please excuse the fuss !! Why would it
-
Please help to (re)organize my library!
My iTunes library is a mess and I don't know how to (re)organize it. First problem: my iTunes library (.xml and related files) are on my laptop data disk D:, i want to migrate it to my external harddisk I (Itunes). Second problem: my music files shou