Sending XI-Content as Mail Attachement with specific Filename
Hi,
I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
Is this possible and how?
Thank you for your help
Thomas
Hi Thomas,
You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
In the Mail Receiver Channel got to tab "Module"
As first module (before the mail module) enter:
localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
For this module key you can use in the module configuration following entries:
Transform.ContentDisposition inline|attachment;filename=<filename>
Transform.ContentDescription <Filename>
Transform.ContentType <MimeType>/<SubType>;name="<filename>"
If you want to send an attachment, use:
Transform.ContentDisposition attachment;filename="MyFile.csv"
Transform.ContentDescription MyFile
Transform.ContentType text/plain;name="MyFile.csv"
If you use the Mail Package, you can set the file name that way:
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>[email protected]</From>
<To>[email protected]</To>
<Content_Type>text/plain;name="MyFile.csv"</Content_Type>
<Content>Here comes the CSV Data</Content>
</ns:Mail>
Hope that helps,
Stefan
Similar Messages
-
How to send table contents as mail attachment.
Hi,
I am showing data into webdynpro table by accessing database. Now i have to send these data through mail to different persons. How can i do it. I tried it by sending the table elements into excel files but i am facing some problems. can it be done through HTML files??
Please give a solution to it.
Thanks and Regards..
Pankaj Kumar.Pankaj
I am giving sample code here.
Put this code in an action behind Send Mail button on your iview as an example.
Also add external jar file mail.jar to your web dynpro project to achieve your objective.
if(wdContext.currentContextElement().getTest()== null)
IWDWindowInfo windowInfo1 = wdComponentAPI.getComponentInfo().findInWindows("EnterText");
IWDWindow window1 =wdComponentAPI.getWindowManager().createWindow(windowInfo1,true);
window1.open();
window1.setWindowPosition(300,300);
wdContext.currentContextElement().setEmptyText(window1);
} else
Properties props = new Properties();
String host = "XXX.XXX.X.X"; /*ip address of mail server */
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth","false");
// auth = new AuthenticationBean();
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage (
Session.getInstance ( props, null ) );
Address toAddress = new InternetAddress();
Address fromAddress = new InternetAddress();
Address ccAddress = new InternetAddress();
Address bccAddress = new InternetAddress();
//new window code
IWDWindowInfo windowInfo = wdComponentAPI.getComponentInfo().findInWindows("SuccessWindow");
IWDWindow window =wdComponentAPI.getWindowManager().createWindow(windowInfo,true);
window.open();
window.setWindowPosition(300,300);
wdContext.currentContextElement().setSuccess(window);
try
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
fromAddress = new InternetAddress(wdContext.currentContextElement().getFromEmail());
message.setFrom(fromAddress);
toAddress = new InternetAddress(wdContext.currentContextElement().getRfcEmail());
wdContext.currentContextElement().setErr(wdContext.currentContextElement().getRfcEmail());
message.setRecipient(Message.RecipientType.TO, toAddress);
message.setSubject(wdContext.currentContextElement().getMycontactDD());
messageBodyPart.setText("Message From :"" " wdThis.wdGetMailAppController().wdGetContext().currentContextElement().getName()"\r\n""\r\n"+wdContext.currentContextElement().getTest());
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
catch (AddressException e)
wdComponentAPI.getMessageManager().reportWarning(e. getLocalizedMessage());
e.printStackTrace();
catch (SendFailedException e)
wdComponentAPI.getMessageManager().reportWarning(e. getLocalizedMessage());
e.printStackTrace();
catch (MessagingException e)
wdComponentAPI.getMessageManager().reportWarning( e.getLocalizedMessage());
e.printStackTrace();
Please award points if this helps as this will give you a hint for sending mails. -
Sending SmartForm as E-mail attachment, with email subject and content
Hi,
I'm, e-mailing a SmartForm using the SmartForm parameters (MAIL_RECIPIENT, MAIL_SENDER and MAIL_APPL_OBJ) using control device 'MAIL'.
Create MAIL_RECEPIENT (swotobjid): CREATE_RECIPIENT_OBJ_PPF
Create MAIL_SENDER (swotobjid): CREATE_SENDER_OBJECT_PPF
Create MAIL_APPL_OBJ: This works a little different. The sender needs to have an SAP Office Inbox (SO_USER_AUTOMATIC_INSERT) where a folder is to be created using the marco's swc_create_object and swc_object_to_persistent (INCLUDE <cntn01>).
Everything works fine.
The mail is being send and the SmartForm can be accessed as attachment, the E-Mail subject (as the name of the attachment) is taken from the title of the SmartForm (output_options-tdtitle).
QUESTION *
No they want to change the E-mail subject en change the content(body) of the mail.
Is this possible within the options of the MAIL_APPL_OBJ.
Or do have to rebuild the SmartForm program, get the SmartForm as OTF, rebuild as PDF en mail the PDF to the recepient using the SO_NEW_DOCUMENT_ATT_SEND_API1.
I was thinking of creating a container and set the elements of that container (swc_set_table ?) but I don't no in the end if this woll work.Refer the following Blog-
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID0426134050DB01517382336190791762End?blog=/pub/wlg/1798
generate filename as yesterday's yyyymmdd format, and it must send file with same name with yyyymmdd
You need to use the following UDF to generate yesterday's date-
Imports: java.text.;java.util.;
public String yesterday(Container container)
long oneDay = (long) 1000.0 * 60 * 60 * 24;
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
java.util.Date today = new java.util.Date(System.currentTimeMillis());
java.util.Date yesterday = new java.util.Date(System.currentTimeMillis()-oneDay);
String b = dateFormat.format(yesterday);
return b;
Map this with Content_Disposition as mentioned in wiki.
XI 3.0 message must be executed one a day automatically (for example at 9.00 Am).
Use 'Availability Time planning' for CC as mentioned above.
http://help.sap.com/saphelp_nw70/helpdata/EN/45/06bd029da31122e10000000a11466f/content.htm -
Sending mail attachment with long filename in 4.6C
Hi everyone,
Our requirement needs to have a custom program to send a mail with a pdf attachment, which we have managed to work so far. The problem is that the filename is 37characters long, which is absolutely necessary. For example, my pdf filename can be
072346843023332201_20100720_120101.pdf
In the function that we used, SO_NEW_DOCUMENT_ATT_SEND_API1, the field where the filename is stored (field SOPCKLSTI1-OBJ_NAME) is only 12 characters long. This poses a problem when we try to attach the pdf file.
So my question is if there is an alternative function module or way that we can attach the pdf with the file name still complete? The SAP version that we are using is 4.6C.
Thanks in advance.helllllllllooooooooooooooooooooooooo
anybody
Sara -
Sap adobeform sending pdf as attachment with specific name
Hi Experts,
Need your help in solving my problem !!
My requirement is to send adobe form as mail attachment in PDF format, Which I am able to do.
My Problem is PDF attachment should be generated with specific name.
For example my scenario (below given screen shot),
When i click on submit by email button, PDF will be attached to my mail,
with some random name such as "d4811f8_45171.pdf" Instead it should be generated with
fixed name such as "new_attach.pdf" or dynamic name using user name such as
"Vishwa_attachment.pdf".
Kindly help to achieve my needs.
Any help will be greatly appreciated and rewarded.
Thanks in advance,
Regards,
VishwaHi Naveen,
please read through my query again, I should generate pdf when I click on "submit by email button".
I am not using any function for conversion it will happen automatically.
thanks,
Vishwa -
Sending a document as an mail attachment with approve and reject button
Hi all,
i have an infopath form where a user fills the form and on submit the form is saving as an document in the document library,
now my question is, how can i get this document as an mail attachment with approve and reject option.Hello,
You need to hide them on form load for user. Add one more hidden control in form and keep control value blank initially. Now add rule on button submit to set the control value to some other so you can hide/show the button.
Now add rule on approve and reject buttons that, if field1 is blank then hide this control.
http://office.microsoft.com/en-in/infopath-help/add-formatting-rules-HA101783371.aspx
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Mail attachment with UDF in SAP PI 7.1
Hello,
I need to reproduce this solution in PI 7.1
/people/samuel.chandrasekaran2/blog/2008/10/06/xi-mail-adapter-dynamically-building-attachment-and-message-body-content-using-a-simple-udf
It is about adding lines of a message as an attachment to a mail.
The UDF works for all elements except the lines for the attachment itself.
In order to build the content of the attachment (for this particular requirement) they are using a global variable declared and initialized in the global sections.
But the button for the Java Section to use an imported archive is no longer available in PI.....
So how to solve that issue?
I tried to use a graphical variable instead of a global variable but I have no idea how to add the n lines
from the source message as one import object into the UDF via that graphical variable.
Your ideas are very appreciated!
Best Regards
DirkHi,
yes, it is a little bit different. This is the issue.....
But I am not sure if your links will help:
1) /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
is about a different solution. I do not need to count the number of lines of the source message.
And the second variable is about concat line by line from unbound node to unbound node.
My issue is:
Souce:
Message line (0...unbound) ! ! ! ! ! ! ! !
. ResultLine (1..1)
Mapping:
=> ResultLine1
ResultLine2
ResultLine........ => into UDF to an element (1..1) in one mapping operation.
So that all "ResultLine"s are included.
The result is explained in the given link for Mail attachment with UDF.
So I am not sure how to use this thread for my issue.
In the comments of that blog Christoph Gerber writes that the new variable feature can only handle single values.
So it is not suitable for my purposes as I have a list of values here that needs to be moved into the target message field.
2) http://wiki.sdn.sap.com/wiki/display/Java/UsingEditJavaSectioninMessageMapping
shows where to find the button "Java section" which is not available here in 7.1
3) /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
too is about the nice little button for Java Section that is no longer existing on PI 7.1 screen for mappings.
So my issue is: How to replace the Java section function with global variables in PI 7.1?
Best regards
Dirk -
Unable to recieve content in mail attachment
Hi all,
I am unable to recieve content in mail attachment. I am using java mapping to define mime boundary.
Please suggest any inputs.
Regards,
SaipriyaHow is this connected with Adobe forms?
-
Problem with Thunderbird email:
When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others receive it but it does not come to my email Inbox. The same problem occurs when I send the email to the mailing list addresses individually. When I send a simple test message to myself, I do receive it in my Inbox. Can you help me??
Bob GreenmanAre you using either cc or bcc? Is googlemail involved? Some email providers suppress cc's and bcc's to oneself since you will have a copy in your Sent folder.
-
Mail Attachment with attachment name = mail subject name
Hi,
I am using the mail adapter and today I am using hard codes attachment names using the MessageTransformBean. I have read the blog /people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution about dynamic filenames but how do I get the eMail subject as a viriable to create the attachment?
Thanks
JuergenJuergen my weblog was the simplest suggestion to your issue - you can put the mail subject anywhere in
message get it (and remove) in the adapter module
you can also try to get the
Adapter-Specific Message Attributes from the adapter module
http://help.sap.com/saphelp_nw04/helpdata/en/43/09b16006526e72e10000000a422035/content.htm
but I'm not sure it the second solution works with adapter modules - but you can do an easy check
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a> -
Mail attachment with time stamp
Hi
My scenario is Proxy to Mail.
On receiver side I am getting the data as an attachment but i want that attachment with time stamp.
How to add time stamp to the attachment in reciever mail adapter.
Regards
Sowmya
Edited by: Sowmya on Aug 28, 2008 12:24 PMhi sowmya,
The bellow link for MessageTransformBean..
[http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
In that ContentDisposition is used to fill the value for Attachment file name..
Its allows the value accordingly "RFC1806" Note..
RFC1806 allows accordingly RFC822 ..
Check RFC822 ..
5. DATE AND TIME SPECIFICATION
Regards,
Prakasu -
How to send incoming XML as mail-attachment
Hi Experts,
I have the following scenario: an incoming XML-file should be send as attachment of a mail. Now, I have defined incoming message with the structure of the xml-message and outgoing message as mail-package. In the message mapping I fill the nessesary mail-fields. In my receiver comm.channel (mailadapter) I checked "Use mail package" and "Keep attachment".
Result is that the mail is created and send ok, but without attachment....what am I doing wrong here?
Regards,
WilliamHi JWD,
You should configure the mail adapter with 'use the mail adpater' and 'keep attachments'.
Create an XML file conform the XML structure provide by SAP
The mail package should look like this:
<?xml version="1.0" encoding="utf-8"?>
<ns:MT_Mail_Sent xmlns:xi="http://sap.com/xi/XI/Mail/30">
<xi:Mail>
<Subject>Item</Subject>
<From>MAIL ADDRESS</From>
<To>MAIL ADRESS</To>
<Content_Type>multipart/mixed; boundary="AaBb--984dfgeSSd3532"</Content_Type>
<Content_Disposition>attachment</Content_Disposition>
<Content>
AaBb984dfgeSSd3532
Content-Type: text/plain
this is sample data.
AaBb984dfgeSSd3532
Content-Type: text/plain;name="CSV_data.csv"
Order number;Item number;description<xsl:text> </xsl:text>
<xsl:for-each select="Article_line">
<xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text>
</xsl:text></xsl:for-each>
AaBb984dfgeSSd3532
Content-Type: text/plain;name="TXT_data.txt"
Order number;Item number;description<xsl:text> </xsl:text>
<xsl:for-each select="Article_line">
<xsl:value-of select="Ord_nmbr"/>;<xsl:value-of select="Item_nmbr"/>;<xsl:value-of select="Description<xsl:text> </xsl:text></xsl:for-each>
AaBb984dfgeSSd3532
</Content>
</xi:Mail>
</ns:MT_Mail_Sent>
In the above example you should have some content and 2 attachments (1 csv file and 1 txt file).
After each break (AaBb984dfgeSSd3532) specify again the 'Content-Type'.
*When you want to send a message payload as described, you have to set in the mail receiver channel the parameter Content Encoding to None and uncheck Keep Attachments.
The last boundary AaBb984dfgeSSd3532 should be omitted, as the mail adapter sets that border itself (tested with SP16)*
Reward points if this helps
Regards
Pragathi. -
Sending smartform output as mail attachment (PDF)
Hi,
I am trying to send a smartform output in PDF format as a mail attachment. This has to be fired in the save of a Invoice.. configured by the output type.
Here is the code which i have .. and it does not work.
DATA: ls_bil_invoice TYPE lbbil_invoice.
tables: nast.
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZSDDLB_BIL_INVOICE'
IMPORTING
fm_name = v_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
is_bil_invoice = ls_bil_invoice
is_nast = nast
is_repeat = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
if sy-subrc EQ 0.
endif.
Convert PDF from 132 to 255.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Object with main text of the mail.
i_objtxt = 'Find attached the output of the smart form.'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
Document information.
wa_doc_chng-obj_name = 'Smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'Smart form output'.
wa_doc_chng-sensitivty = 'F'. "Functional object
wa_doc_chng-doc_size = v_lines_txt * 255.
Pack to main body as RAW.
Obj. to be transported not in binary form
CLEAR i_objpack-transf_bin.
Start line of object header in transport packet Smart Forms
i_objpack-head_start = 1.
Number of lines of an object header in object packet
i_objpack-head_num = 0.
Start line of object contents in an object packet
i_objpack-body_start = 1.
Number of lines of the object contents in an object packet
i_objpack-body_num = v_lines_txt.
Code for document class
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Smartform_output' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'. "Internet address
APPEND i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
IF sy-subrc EQ 0.
ENDIF.Hi Aviroop,
Compare your part of code with the below given code.
*& Report YSSN_SIMPLE_SMARTFORM *
report zhr_bhaskar_pdf_to_email message-id zmsg.
parameters: p_vbeln type vbak-vbeln default '35'.
data: it_items type table of vbap,
v_fm_name type rs38l_fnam,
v_tot_lines type i,
v_sy_tabix type i,
output_data type ssfcrescl. " To hold Output information
constants:
c_sep type c value '-', " Value -
c_x type c value 'X', " Value X
c_space type c value ' '. " Space
*****MAIL START
include .
data: g_mail_rec_obj type swotobjid,
g_mail_sen_obj type swotobjid,
g_mail_app_obj type swotobjid,
g_cont_par type ssfctrlop,
folder type swc_object,
begin of sofmfol_key,
foldertype like sofm-foltp,
folderyear like sofm-folyr,
foldernumber like sofm-folno,
type like sofm-doctp,
year like sofm-docyr,
number like sofm-docno,
forwarder like soub-usrnam,
end of sofmfol_key,
bor_key like swotobjid-objkey,
g_mail TYPE ppfdmailad VALUE '[email protected]',
g_mail type so_name value '[email protected]',
g_mail TYPE ppfdmailad VALUE '[email protected]' ,
g_mail TYPE ppfdmailad VALUE '[email protected]' ,
g_rectype type so_escape value 'U'. " 'B'.
data: job_output_info type ssfcrescl,
hotfdata like itcoo occurs 1 with header line,
htline like tline occurs 1 with header line,
x_objcont like soli occurs 1 with header line,
ld_packing_list like soxpl occurs 1 with header line,
x_object_hd_change like sood1 occurs 1 with header line,
x_objhead like soli occurs 1 with header line,
x_receivers like soos1 occurs 1 with header line,
format_pdf(10) value 'PDF',
doc_size(12) type c,
hltlines type i,
htabix like sy-tabix,
fle1(2) type p,
fle2(2) type p,
off1 type p,
hfeld(500) type c.
tables: soud.
*****MAIL END
select *
into table it_items
from vbap
where vbeln = p_vbeln.
if it_items[] is initial.
exit.
endif.
perform call_smartform.
*& Form call_smartform
text
--> p1 text
<-- p2 text
form call_smartform .
*DATA: lx_control_parameters TYPE SSFCTRLOP,
lx_OUTPUT_OPTIONS type SSFCOMPOP.
lx_OUTPUT_OPTIONS-TDIMMED = ' '.
lx_OUTPUT_OPTIONS-TDfinal = 'X'.
lx_OUTPUT_OPTIONS-TDDELETE = 'X'.
lx_CONTROL_PARAMETERS-NO_CLOSE = 'X'.
lx_CONTROL_PARAMETERS-NO_OPEN = ' '.
data: x_ssfcompop type ssfcompop,
x_ssfctrlop like ssfctrlop,
x_ssfcrescl type ssfcrescl.
**MAIL
g_cont_par-langu = sy-langu.
g_cont_par-no_dialog = 'X'.
g_cont_par-getotf = 'X'.
g_cont_par-device = 'MAIL'.
Get BOR-Objects for Recipient, Sender und Applikation
perform mail_recipient_object changing g_mail_rec_obj.
perform mail_sender_object changing g_mail_sen_obj.
perform mail_appl_object changing g_mail_app_obj.
**MAIL
*--Internal table is having more than 1 record
if v_tot_lines gt 1.
if v_sy_tabix = 1.
*--For first record of table
x_ssfctrlop-no_open = c_space.
x_ssfctrlop-no_close = c_x.
elseif v_sy_tabix = v_tot_lines.
*--For last record of table
x_ssfctrlop-no_open = c_x.
x_ssfctrlop-no_close = c_space.
else.
x_ssfctrlop-no_open = c_x.
x_ssfctrlop-no_close = c_x.
endif.
endif.
IF r_previ = c_x.
x_ssfctrlop-preview = c_x.
x_ssfctrlop-getotf = c_x.
ENDIF.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'YSSN_SMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = v_fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
if sy-subrc <> 0.
message i000 with 'Smart form module name failure'.
exit.
endif.
CALL FUNCTION '/1BCDWB/SF00000199'
call function v_fm_name
exporting
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = g_cont_par
mail_appl_obj = g_mail_app_obj
mail_recipient = g_mail_rec_obj
mail_sender = g_mail_sen_obj
OUTPUT_OPTIONS = lx_OUTPUT_OPTIONS
USER_SETTINGS = 'X'
t_vbap = it_items
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = job_output_info
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
perform send_pdf_mail.
endform. " call_smartform
*& Form send_pdf_mail
text
--> p1 text
<-- p2 text
form send_pdf_mail .
data ld_binfile type xstring.
pdf_table type rcl_bag_tline,
data: ld_originator like soos1-recextnam.
convert form
loop at job_output_info-otfdata into hotfdata.
append hotfdata.
endloop.
call function 'CONVERT_OTF'
exporting
format = format_pdf
max_linewidth = 132
importing
bin_filesize = doc_size
bin_file = ld_binfile
tables
otf = output_data-otfdata
lines = htline
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
*-Itab 134 Zeichen nach 255 Zeichen überführen
describe table htline lines hltlines.
describe field htline length fle1 in character mode.
describe field x_objcont length fle2 in character mode.
loop at htline.
htabix = sy-tabix.
move htline to hfeld+off1.
if htabix = hltlines.
fle1 = strlen( htline ).
endif.
off1 = off1 + fle1.
if off1 ge fle2.
clear x_objcont.
x_objcont = hfeld(fle2).
append x_objcont.
shift hfeld by fle2 places.
off1 = off1 - fle2.
endif.
if htabix = hltlines.
if off1 gt 0.
clear x_objcont.
x_objcont = hfeld(off1).
append x_objcont.
endif.
endif.
endloop.
x_object_hd_change-objnam = 'EMAIL'.
x_object_hd_change-objdes = 'Smart Form'.
x_object_hd_change-objla = sy-langu.
x_object_hd_change-objsns = 'O'.
x_object_hd_change-objlen = doc_size.
x_object_hd_change-file_ext = 'TXT'.
ld_packing_list-transf_bin = 'X'.
ld_packing_list-head_start = 1.
ld_packing_list-head_num = 0.
ld_packing_list-body_start = 1.
describe table x_objcont lines ld_packing_list-body_num.
ld_packing_list-objtp = 'EXT'.
ld_packing_list-objdes = 'Smart Form'.
ld_packing_list-objla = sy-langu.
ld_packing_list-objlen = doc_size.
ld_packing_list-file_ext = 'PDF'.
append ld_packing_list.
x_receivers-recextnam = g_mail.
x_receivers-recesc = 'E'.
x_receivers-sndart = 'INT'.
append x_receivers.
ld_originator = '[email protected]'.
ld_originator = FSABE-USRNAM.
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = x_object_hd_change
object_type = 'RAW'
originator_type = 'B' "Einfügen
originator = ld_originator "Einfügen
tables
objcont = ld_text
receivers = x_receivers
packing_list = ld_packing_list
att_cont = x_objcont
att_head = x_objhead
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
others = 21.
endform. " send_pdf_mail
*& Form mail_sender_object
text
<--P_G_MAIL_SEN_OBJ text
form mail_sender_object changing p_mail_sen_obj.
call function 'CREATE_SENDER_OBJECT_PPF'
exporting
ip_sender = sy-uname
importing
ep_sender_id = p_mail_sen_obj
exceptions
invalid_sender = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " mail_sender_object
*& Form mail_appl_object
text
<--P_G_MAIL_APP_OBJ text
form mail_appl_object changing p_mail_app_obj.
SELECT * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.
ENDSELECT.
IF sy-subrc NE 0.
call function 'SO_USER_AUTOMATIC_INSERT'
exporting
sapname = sy-uname
exceptions
no_insert = 1
sap_name_exist = 2
x_error = 3
others = 4.
if sy-subrc ne 0.
clear soud.
else.
select * from soud where sapnam like sy-uname and deleted = ' '.
endselect.
endif.
ENDIF.
clear sofmfol_key.
sofmfol_key-type = 'FOL'.
sofmfol_key-year = soud-inbyr.
sofmfol_key-number = soud-inbno.
bor_key = sofmfol_key.
if not bor_key is initial.
swc_create_object folder 'SOFMFOL' bor_key.
if sy-subrc = 0.
swc_object_to_persistent folder p_mail_app_obj.
if sy-subrc ne 0.
clear p_mail_app_obj.
endif.
endif.
else.
clear p_mail_app_obj.
endif.
endform. " mail_appl_object
*& Form mail_recipient_object
text
<--P_G_MAIL_REC_OBJ text
form mail_recipient_object changing p_mail_rec_obj.
call function 'CREATE_RECIPIENT_OBJ_PPF'
exporting
IP_COUNTRY =
IP_FAXNO =
ip_mailaddr = g_mail
ip_type_id = g_rectype " 'U'
importing
ep_recipient_id = p_mail_rec_obj
EP_ADDRESS =
ET_RECIPIENT =
exceptions
invalid_recipient = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " mail_recipient_object
I hope this code should definitely work and helps you a lot.
Do reward me if it helps you.
Cheers,
Sampath -
How to run 2 reports to send 1 PDF e-mail attachment instead of 2 e-mails.
I used 9i Reports to create 2 reports in a PDF format. I run these reports from a 9i form using the web.show_document command. XML is used to send the 2 e-mails with the reports.
Is there a way I can combine the running of the reports to make one PDF to created 1 e-mail attachment or run the reports at the same time and attach 2 PDF files to 1 e-mail.
I have no problems running 1 report and sending 1 e-mail attacment!
This is example of the XML used in creating the e-mail:
- <destinations>
- <foreach>
- <file id="Test" name="REPORT_1.pdf" format="pdf" instance="XXXX">
<include src="report" />
</file>
</foreach>
- <!-- Send a mail with an attachment
-->
- <mail id="ex1" to="&DESNAME" from="&DESNAME" subject="&DESNAME;*;&p_postal_number: was submitted for
approval on &p_postal_date">
<body srcType="text">This is to notify you of a new submission that requires an approval before being
sent to out. Please use the URL link below to review the information as soon as possible.
https://xxxx.aaaa.sss.com:234/web_html/static.html AAAA Administrator</body>
- <attach format="pdf" name="Report_1&.pdf" srcType="report">
<include src="mainSection" />
</attach>
</mail>
</destinations>You can use iText to combine two PDF files into one.
-
Sending payslip as a PDF attachment with an email
Hi Experts,
I need to send an email with payslip as a PDF attachment. I wonder how this can be done for country China. The payroll driver program seems doesn't helps to send an email. Can any one tell me, if this can be achieved directly, else will have to write a code for the same.
Thanks.
Warm regards,
Harshad. MHi,
Here two Z-program needs to be develop.One program is to convert payslip into PDF file & store the PDF file in a folder where you send as an E-Mail.
Then create a spool request in Remunation statement. Maintain the Mail id's in Inftype-105.
Develop one Z program which will Send Email with PDF attachment.
Run this program the second screen will display where you have to attach the spool request no & the mail ID. Then execute the program to send as email.
Snita
Maybe you are looking for
-
Photo book what does it do?
What does photo book do? pictures?
-
Hi gurus: When I send the XML below using a SOAP communication Channel, XI server doesn't receive it well: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmls
-
I want to find an application in order to help me with my storage .
I want it to be able to get all the information about a product which means entry , price , how many left , etc. all by reading the product's barcode with iPhone or iPad camera . I have seen such this app , but it was just fine medicine in a specific
-
Open source before this disappears
Currently the squigglySDK provides three components compiled. Engine, UI, etc. Would it be possible to obtain the source classes of the adobe.linguitstics.spelling SpellCheck.as, .... I believe these were from a previous version... import com.adobe.l
-
How the PCUI event for export button works?
Hi All, After get the order search result in PCUI, when I click the Export button. It show me the message that : Microsoft office 2003 or higher is not installed on your computer. In fact, I have the office 2003. And I found that the event for Export