Got E-mail Attachment (.xls Excel file), then import data to Database
Dear All,
I have a project need to do above mention function.
how to do that automatically ?
Database is Oracle 10g running on RH AS 4.0 Linux.
Best regards
boris
Dear All,
Tks for yr reply first,
My meanings is process it automatically & no need thru client to do that.
i think the solution as below : -
1) partner send e-mail to mailbox with attahcment.
2) software can get a mail then extract attachment & allocation to somewhere folder in db server
3) execute command for import data from file to database.
did u know any solution or third party software can do that ?
best regards
boris
Similar Messages
-
Attaching generated excel file in cfmail
Hi,
I've attached the code in which I've generated an excel file
from my data, which the user can then open/save on their PC. I now
want to attach this excel file to an email (using cfmail) and send
it (the task will then become scheduled).
How do I save rather than output the excel file?
KatieHi,
Have a look at the following tags:
1)
<cfsavecontent> to generate a variable from your
tab-delimited content
<cffile action = "write"> to generate a temp file with
your content
<cfmail> and attach that file to your email
or
2)
<cfsavecontent>
<cfmail>,<cfmailpart> to attach the variable
directly to the email without creating a temp file first (have not
tried that myself)
cheers,
fober -
Create BDC group per uploading excel file to fill data in Tcode FB01l
hi experts,
i'm using BDC to run T-code FB01L . for this i'm uploading excel file for input data. my requiremenr=t is as follows : "
only one BDC group should be created per uploading file." But At this moment BDC group is created per document. For user it is not possible to handle, say 1000 BDC groups.
please suggest.
Thanks
DeepikaThe answer is simple and you should be able to work it out yourself but I am feeling generous today.
I am assuming that each line in your excel spreadsheet is a document. The easiest way to do this is simply build up youd BDC table first then create the group.
<- build your bdc table before opening the group ->
call function 'BDC_OPEN_GROUP'
exporting
group = p_group
keep = p_keep
user = p_uname.
call function 'BDC_INSERT'
exporting
tcode = 'FB01'
tables
dynprotab = gt_bdcdata
exceptions
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
others = 7.
call function 'BDC_CLOSE_GROUP'
In the future please do a search on SDN. I have also moved this thread to the ABAP General forum as this is not related to ABAP OO. -
How to read a passward protected excel file with the help of database connectivity tool kit
hi, i was reading an excel file with the help of database connectivity tool kit in labview 8.0
i made tabels in the excel file nand made odbc connection and specified the workbbok name.
now my problem is how to read the same file if i specife a pasword to that excel file ?Hi,
Check out this thread about opening a password-protected Excel file using ActiveX. This should take care of it for you!
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments -
Reading file and dump data into database using BPEL process
I have to read CSV files and insert data into database.. To achieve this, I have created asynchronous bpel process. Added Filed Adapter and associated it with Receive activity.. Added DB adapter and associated with Invoke activity. Total two receive activity are available in process, when tried to Test through EM, only first receive activity is completed, and waiting on second receive activity. Please suggest how to proceed with..
Thanks, Manoj.Deepak, thank for your reply.. As per your suggestion I created BPEL composite with
template "Define Service Later". I followed below steps, please correct me if I am wrong/missing anything. Your help is highly appreciated...
Step 1-
Created File adapter and corresponding Receive Activity (checkbox create instance is checked) with input variable.
Step 2 - Then in composite.xml, dragged the
web service under "Exposed Services" and linked the web service with Bpel process.
Step 3 - Opened .bpel file and added the DB adapter with corresponding Invoke activity, created input variable. Web service is created of Type "Service" with existing WSDL(first option aginst WSDL URL).
and added Assign activity between receive and invoke activities.
Deployed the composite to server, when triedTest it
manually through EM, it is promting for input like "subElmArray Size", then I entered value as 1 with corresponding values for two elements and click on Test We Service button.. Ptocess is completing in error. The error is
Error Message:
Fault ID
service:80020
Fault Time
Sep 20, 2013 11:09:49 AM
Non Recoverable System Fault :
Correlation definition not registered. The correlation set definition for operation Read, process default/FileUpload18!1.0*soa_3feb622a-f47e-4a53-8051-855f0bf93715/FileUpload18, is not registered with the server. The correlation set was not defined in the process. Redeploy the process to the containe -
Attaching PC Excel File to e-mail
Hi,
Is it possible to attach an existing Excel file in the Presentation server to the E-mail?
If it is poosible Please tell howHi Gayathri,
Refer to the following link:
http://sapdev.co.uk/reporting/email/attach_xls.htm
Hope this helps.
Reward if helpful.
Regards,
Sipra -
Hi all,
I checked the lt_attachment in debugging. It has around 87 lines and this FM run without any error. SY-subrc = 0.
But when I opened the excel file it only have 4 lines of records. Anyone have any idea on this? Thanks.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
sender_address = 'email address'
sender_address_type = 'INT'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_bin = lt_attachment
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.Hi Siong,
Did you passing correct parameter in the 'packing list' for the attachment?
doc_size should be represent your message size.
Perhaps you pass wrong value.
* Describe the body of the message
clear gs_packing_list.
refresh gt_packing_list.
gs_packing_list-transf_bin = space.
gs_packing_list-head_start = 1.
gs_packing_list-head_num = 0.
gs_packing_list-body_start = 1.
describe table gt_message lines gs_packing_list-body_num.
gs_packing_list-doc_type = 'RAW'.
append gs_packing_list to gt_packing_list.
* Create attachment notification
gs_packing_list-transf_bin = 'X'.
gs_packing_list-head_start = 1.
gs_packing_list-head_num = 1.
gs_packing_list-body_start = 1.
describe table gt_attachment lines gs_packing_list-body_num.
gs_packing_list-doc_type = ld_format.
gs_packing_list-obj_descr = ld_attdescription.
gs_packing_list-obj_name = ld_attfilename.
gs_packing_list-doc_size = gs_packing_list-body_num * 255.
append gs_packing_list to gt_packing_list.
Regards,
Dondi. -
Internal Table attached as Excel file to an eMail - BCS_EXAMPLE_7 for UC
Hi forums,
SAP provided an example report to send out internal tables attached as an Excel file to a recipients eMail address. I attached the coding of the BCS_EXAMPLE_7 programm to this thread.
report bcs_example_7.
This report provides an example for sending an Excel
attachment in Unicode Systems
constants:
gc_tab type c value cl_bcs_convert=>gc_tab,
gc_crlf type c value cl_bcs_convert=>gc_crlf.
parameters:
mailto type ad_smtpadr
default 'john.doe(a)crazy-company.com'. "#EC *
data send_request type ref to cl_bcs.
data document type ref to cl_document_bcs.
data recipient type ref to if_recipient_bcs.
data bcs_exception type ref to cx_bcs.
data main_text type bcsy_text.
data binary_content type solix_tab.
data size type so_obj_len.
data sent_to_all type os_boolean.
start-of-selection.
perform create_content.
perform send.
*& Form send
form send.
try.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
-------- create and set document with attachment ---------------
create document object from internal table with text
append 'Hello world!' to main_text. "#EC NOTEXT
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = main_text
i_subject = 'Test Created By BCS_EXAMPLE_7' ). "#EC NOTEXT
add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls' "#EC NOTEXT
i_attachment_subject = 'ExampleSpreadSheet' "#EC NOTEXT
i_attachment_size = size
i_att_content_hex = binary_content ).
add document object to send request
send_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
add recipient object to send request
send_request->add_recipient( recipient ).
---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
commit work.
if sent_to_all is initial.
message i500(sbcoms) with mailto.
else.
message s022(so).
endif.
------------ exception handling ----------------------------------
replace this rudimentary exception handling with your own one !!!
catch cx_bcs into bcs_exception.
message i865(so) with bcs_exception->error_type.
endtry.
endform. "send
*& Form create_content
Create Example Content
1) Write example text into a string
2) convert this string to solix_tab
form create_content.
data lv_string type string.
data ls_t100 type t100.
as example content we use some system messages out of t100
get them for all installed languages from db
and write one line for each language into the spread sheet
columns are separated by TAB and each line ends with CRLF
concatenate 'This Is Just Example Text!' "#EC NOTEXT
gc_crlf gc_crlf
into lv_string.
header line
concatenate lv_string
'MSGID' gc_tab
'MSGNO' gc_tab
'Language' gc_tab "#EC NOTEXT
'Text' gc_crlf "#EC NOTEXT
into lv_string.
data lines
select * from t100 into ls_t100
where arbgb = 'SO' and msgnr = '182'.
concatenate lv_string
ls_t100-arbgb gc_tab
ls_t100-msgnr gc_tab
ls_t100-sprsl gc_tab
ls_t100-text gc_crlf
into lv_string.
endselect.
select * from t100 into ls_t100
where arbgb = 'SO' and msgnr = '316'.
concatenate lv_string
ls_t100-arbgb gc_tab
ls_t100-msgnr gc_tab
ls_t100-sprsl gc_tab
ls_t100-text gc_crlf
into lv_string.
endselect.
convert the text string into UTF-16LE binary data including
byte-order-mark. Mircosoft Excel prefers these settings
all this is done by new class cl_bcs_convert (see note 1151257)
try.
cl_bcs_convert=>string_to_solix(
exporting
iv_string = lv_string
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
importing
et_solix = binary_content
ev_size = size ).
catch cx_bcs.
message e445(so).
endtry.
endform. "create_content
NOTES:
UTF-16LE including the BOM (Byte order mark)
is preferred by Microsoft Excel. If you want to create
other binary content you may choose another codepage (e.g.
'4110' (UTF-8) which is standard for e-mails).
Find SAP codepage names in the drop down list
for the codepage setting of node SMTP in transaction SCOT.
Or: leave iv_codepage and iv_add_bom empty. Then the target
codepage is set according to SAPconnect settings
Important:
SAP neither guarantees that the attachment created
by this report can be opened by all Excel Versions nor
that it can be opened by any 3rd party software at all
Best regards to you
Thorsten Hüser
SAP CRM Senior consultant
arvato / BertelsmannHi forums,
SAP provided an example report to send out internal tables attached as an Excel file to a recipients eMail address. I attached the coding of the BCS_EXAMPLE_7 programm to this thread.
report bcs_example_7.
This report provides an example for sending an Excel
attachment in Unicode Systems
constants:
gc_tab type c value cl_bcs_convert=>gc_tab,
gc_crlf type c value cl_bcs_convert=>gc_crlf.
parameters:
mailto type ad_smtpadr
default 'john.doe(a)crazy-company.com'. "#EC *
data send_request type ref to cl_bcs.
data document type ref to cl_document_bcs.
data recipient type ref to if_recipient_bcs.
data bcs_exception type ref to cx_bcs.
data main_text type bcsy_text.
data binary_content type solix_tab.
data size type so_obj_len.
data sent_to_all type os_boolean.
start-of-selection.
perform create_content.
perform send.
*& Form send
form send.
try.
-------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
-------- create and set document with attachment ---------------
create document object from internal table with text
append 'Hello world!' to main_text. "#EC NOTEXT
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = main_text
i_subject = 'Test Created By BCS_EXAMPLE_7' ). "#EC NOTEXT
add the spread sheet as attachment to document object
document->add_attachment(
i_attachment_type = 'xls' "#EC NOTEXT
i_attachment_subject = 'ExampleSpreadSheet' "#EC NOTEXT
i_attachment_size = size
i_att_content_hex = binary_content ).
add document object to send request
send_request->set_document( document ).
--------- add recipient (e-mail address) -----------------------
create recipient object
recipient = cl_cam_address_bcs=>create_internet_address( mailto ).
add recipient object to send request
send_request->add_recipient( recipient ).
---------- send document ---------------------------------------
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
commit work.
if sent_to_all is initial.
message i500(sbcoms) with mailto.
else.
message s022(so).
endif.
------------ exception handling ----------------------------------
replace this rudimentary exception handling with your own one !!!
catch cx_bcs into bcs_exception.
message i865(so) with bcs_exception->error_type.
endtry.
endform. "send
*& Form create_content
Create Example Content
1) Write example text into a string
2) convert this string to solix_tab
form create_content.
data lv_string type string.
data ls_t100 type t100.
as example content we use some system messages out of t100
get them for all installed languages from db
and write one line for each language into the spread sheet
columns are separated by TAB and each line ends with CRLF
concatenate 'This Is Just Example Text!' "#EC NOTEXT
gc_crlf gc_crlf
into lv_string.
header line
concatenate lv_string
'MSGID' gc_tab
'MSGNO' gc_tab
'Language' gc_tab "#EC NOTEXT
'Text' gc_crlf "#EC NOTEXT
into lv_string.
data lines
select * from t100 into ls_t100
where arbgb = 'SO' and msgnr = '182'.
concatenate lv_string
ls_t100-arbgb gc_tab
ls_t100-msgnr gc_tab
ls_t100-sprsl gc_tab
ls_t100-text gc_crlf
into lv_string.
endselect.
select * from t100 into ls_t100
where arbgb = 'SO' and msgnr = '316'.
concatenate lv_string
ls_t100-arbgb gc_tab
ls_t100-msgnr gc_tab
ls_t100-sprsl gc_tab
ls_t100-text gc_crlf
into lv_string.
endselect.
convert the text string into UTF-16LE binary data including
byte-order-mark. Mircosoft Excel prefers these settings
all this is done by new class cl_bcs_convert (see note 1151257)
try.
cl_bcs_convert=>string_to_solix(
exporting
iv_string = lv_string
iv_codepage = '4103' "suitable for MS Excel, leave empty
iv_add_bom = 'X' "for other doc types
importing
et_solix = binary_content
ev_size = size ).
catch cx_bcs.
message e445(so).
endtry.
endform. "create_content
NOTES:
UTF-16LE including the BOM (Byte order mark)
is preferred by Microsoft Excel. If you want to create
other binary content you may choose another codepage (e.g.
'4110' (UTF-8) which is standard for e-mails).
Find SAP codepage names in the drop down list
for the codepage setting of node SMTP in transaction SCOT.
Or: leave iv_codepage and iv_add_bom empty. Then the target
codepage is set according to SAPconnect settings
Important:
SAP neither guarantees that the attachment created
by this report can be opened by all Excel Versions nor
that it can be opened by any 3rd party software at all
Best regards to you
Thorsten Hüser
SAP CRM Senior consultant
arvato / Bertelsmann -
Attach an Excel File with Email for External Email Address
Hi,
I want to send an excel file to an external email address as an attachement.
I am using the function module SO_NEW_DOCUMENT_ATT_SEND_API1 for sending the email.
But as far as I know we can only create and send the excel file in this FM. e.g. we can put the text manually and name the file as excel and add it as packing list and send the document.
Now, my client has a template in excel/word which he wants to send as an attachment always when he sends the mail. I have below Queries:
1. Where and how do i store the template which is in Excel or word? He doesnt want to upload the template each time he runs the report. Can I save the file on AL11? how do i insert the file in this?
2. I have tried standard texts, but his template contains a logo. So, I am not sure if that would work. Can I send the template in Binary and just aapend the file extension? xls or doc? would that do?Hi,
See if you can matintain the required templates in document management and use them in your reports.
Try the link below for reference.
[Document Management|http://wiki.sdn.sap.com/wiki/display/PLM/Templates-Document+Management]]
Regards,
Booma -
Java Mapping: payload as mail attachment and dynamic file name .
Hi,
I have written this piece of java code.
The code includes XPATH for fetching dynamic filename and the copysource( in, out ) to copy the content of payload as mail attchment.
The code seems to work fine, when either of the functionality is implemented.
but when both are implemented together ie parsing for xpath then again parsing to copy payload, then it doesnt executes the latter path i.e the payload is not fetched in the attachment.
public class MailPackage implements StreamTransformation {
public void setParameter(Map map) {
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
String mailSubject = "test mail";
String mailSender = "aaaaaaaa";
String mailReceiver = "[email protected]";
String attachmentName = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
factory.setNamespaceAware(false);
factory.setValidating(false);
try {
builder = factory.newDocumentBuilder();
Document doc = null;
doc = builder.parse(in);
String XPATH ="/*/Invoice/InvoiceHeader/InvoiceNumber/text()";
Node fieldValueNode = org.apache.xpath.XPathAPI.selectSingleNode(doc,XPATH);
System.out.print(fieldValueNode);
attachmentName = fieldValueNode.getNodeValue() +".xml";
String boundary = "--";
String mailContent = "This is a sample file";
String CRLF = "\r\n";
// create XML structure of mail package
String output ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"
+ "<Subject>" + mailSubject + "</Subject>"
+ "<From>" + mailSender + "</From>"
+ "<To>" + mailReceiver + "</To>"
+ "<Content_Type>multipart/mixed; boundary=\"" + boundary + "\"</Content_Type>"
+ "<Content>";
out.write(output.getBytes());
// create the declaration of the MIME parts
//First part
output = "--" + boundary + CRLF
+ "Content-Type: text/plain; charset=UTF-8" + CRLF
+ "Content-Disposition: inline" + CRLF + CRLF
+ mailContent + CRLF
//Second part
+ "--" + boundary + CRLF
+ "Content-Type: application/xml; name=" + attachmentName + CRLF
+ "Content-Disposition: attachment; filename=" + attachmentName + CRLF + CRLF;
out.write(output.getBytes());
//Source is taken as attachment
copySource(in, out);
out.write("</Content></ns:Mail>".getBytes());
} catch (Exception ie) {
throw new StreamTransformationException(ie.getMessage());
protected static void copySource(InputStream in, OutputStream out)throws IOException {
byte[] bbuf = new byte[in.available()];
int bblen = in.read(bbuf);
if (!(bblen < 0)) {
String sbuf = new String(bbuf);
//replace all control characters with escape sequences
sbuf = sbuf.replaceAll("&", "&");
sbuf = sbuf.replaceAll("\"", """);
sbuf = sbuf.replaceAll("'", "'");
sbuf = sbuf.replaceAll("<", "<");
sbuf = sbuf.replaceAll(">", ">");
out.write(sbuf.getBytes());
Povide your suggestions.Hi,
This is the sample o/p that I get by opening the mail attachment using notepad.
<?xml version="1.0" encoding="UTF-8"?>
<InvoiceTransmission><InvoiceTransmissionHeader><InvoiceCreationDate>2008-12-03T00:00:00</InvoiceCreationDate><Version>2.0.2</Version></InvoiceTransmissionHeader><Invoice><InvoiceHeader><CustomerEntityID>LH</CustomerEntityID><IssuingEntityID>009140559</IssuingEntityID><InvoiceNumber>913353669</InvoiceNumber><InvoiceIssueDate>2008-12-03</InvoiceIssueDate><InvoiceType InvoiceTransactionType="OR">INV</InvoiceType><InvoiceDeliveryLocation>aaa</InvoiceDeliveryLocation><TaxInvoiceNumber>Not Applicable</TaxInvoiceNumber><InvoiceCurrencyCode>USD</InvoiceCurrencyCode><InvoiceTotalAmount>517174.63</InvoiceTotalAmount><InvoiceIDDetails InvoiceIDType="BT"><InvoiceIDVATRegistrationNumber>0000000000</InvoiceIDVATRegistrationNumber><InvoiceIDName1>aaaaaaaaaaaaaaa</InvoiceIDName1><InvoiceIDName2>bbbbbbHKG</InvoiceIDName2><InvoiceIDCity>ccccccccc ccccc</InvoiceIDCity><InvoiceIDCountryCode>HK</InvoiceIDCountryCode></InvoiceIDDetails><InvoiceIDDetails InvoiceIDType="II"><InvoiceIDVATRegistrationNumber>0000000000</InvoiceIDVATRegistrationNumber><InvoiceIDName1>eeeeeeee</InvoiceIDName1><InvoiceIDName2>PAY BY WIRE TRANSFER</InvoiceIDName2><InvoiceIDCity>fffffffffffffff, NA</InvoiceIDCity><InvoiceIDCustomField ID="1"><InvoiceIDCustomFieldDescription>Company Registration Number</InvoiceIDCustomFieldDescription><InvoiceIDCustomFieldValue>0000000000</InvoiceIDCustomFieldValue></InvoiceIDCustomField></InvoiceIDDetails></InvoiceHeader><SubInvoiceHeader><InvoiceLine><ItemNumber>001</ItemNumber><ItemQuantity><ItemQuantityType>IN</ItemQuantityType><ItemQuantityFlag>GR</ItemQuantityFlag><ItemQuantityQty>28134.000</ItemQuantityQty><ItemQuantityUOM>USG</ItemQuantityUOM></ItemQuantity><ItemQuantity><ItemQuantityType>DL</ItemQuantityType><ItemQuantityFlag>GR</ItemQuantityFlag><ItemQuantityQty>106498.775</ItemQuantityQty><ItemQuantityUOM>LT</ItemQuantityUOM></ItemQuantity><ItemDeliveryReferenceValue ItemDeliveryReferenceType="DTN">590365</ItemDeliveryReferenceValue><ItemDeliveryReferenceValue ItemDeliveryReferenceType="!
ARN">DAL
CH</ItemDeliveryReferenceValue><ItemDeliveryReferenceValue ItemDeliveryReferenceType="FNO">mmmmmmmmm</ItemDeliveryReferenceValue><ItemDeliveryLocation>pppp</ItemDeliveryLocation><ItemReferenceLocalDate
If you notice the problem is, the undesired "exclamation mark" that gets added in some fields before the actual value.
In the above case.. look at "ItemDeliveryReferenceType="! ARN">DAL"
the exclamation mark before value "ARN is unwanted, which leads to improper XML formation.
Cant figure out why is this coming.
Regards,
Faria Mithani -
Mail attachment (.csv) to File (.csv)
Hi mates,
I have a requirement where I have to pick the attachment(.csv format) of an incoming mail and store this file ( in .csv format)onto a file server using a reciever file adapter.
Please suggest how can i go about it ?Jai,
After changing the transfer mode from text to Binary.
The XI system is creating a file but the data inside that file is junk. For e.g :
" "$"#,##0.00_);[Red]("$"#,##0.00) 7 * 2 ("$"* #,##0);_("$"* (#,##0);_("$"* "-"_);_(@_) . ) ) (* #,##0);_(* (#,##0);_(* "-"_);_(@_) ? , : ("$"* #,##0.00);_("$"* (#,##0.00);_("$"* "-"??_);_(@_) 6 + 1 (* #,##0.00);_(* (#,##0.00);_(* "-"??_);_(@_)à õÿ À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à õÿ ô À à
This looks like when you open a CSV file in a notepad.
Please help how can i format this data so that it lokks like normal comma seperated form. -
How can I create a mail attachment without a file suffix?
Hi,
I'm trying to create anl attachment without a suffix.
Here is my code:
TextPayload attAnlFile = msg.createTextPayload();
attAnlFile.setName("File");
attAnlFile.setContentType("");
attAnlFile.setText("Test");
msg.addAttachment(attAnlFile);
inputModuleData.setPrincipalData(msg);
I get a file named "File.bin", but i need a file, which is only named "File".
Can anyone help me?
Thanks a lot
BR
RalfHi Ralf,
Ref: Receiver Mail Adapter
The attachements are given a .bin extension by default. To change this , the procedure is available in the Mail Adapter FAQ : 856599
Q: Can I choose the name of an attachment in the mail?
A: Yes. Most mail clients use some heuristics based on some MIME headers to derive the name of an attachment. The MIME headers involved in most heuristics are Content-Type, Content-Description, and Content-Disposition. When you create an XI message, the XI payload name is automatically set in the Content-Description. If you want to change or set all of these headers, you can use the MessageTransformBean module (Note 793922) in the adapter framework.
Related questions: How can I set the file name of a mail attachment?
Q: How can I set the file name of a mail attachment?
There are several MIME headers that play a role in how the client retrieves the file name of an attachment. Unfortunately, this behavior differs among various mail clients. The reason for this inconsistent behavior comes from the fact that this mechanism has been extended incrementally. The old way is to use the name parameter in the Content-Type header as specified in RFC1341. For example, you can set the content type of an XML attachment as:
Content-Type: application/xml; name="abc.xml"
RFC1521 discourages the use of this name parameter in anticipation of the new header Content-Disposition, which is defined in RFC1806.
With this Content-Disposition header, you can set the file name as:
Content-Disposition: attachment; filename="abc.xml"
Some clients may show the Content-Description value as the file name. The Content-Description header is typically used to associate some descriptive information to an attachment (RFC1341) as in
Content-Description: my xml file
To avoid potential interpretation problems, it is recommended to combine the use of these headers.
Also, the same note contains all info you wnat on the options of the mail adapter. Take a look at it.
Regards,
Jai Shankar -
Sending mail attachment as XML file
Hi Experts,
I have a XML in an ITAB.
I want to send this data as a mail attachment, any body help, if any one have sample code please send me.
Thanks,
Regards
Venkathi
chk the sample code
REPORT ZMAIL_XLS NO STANDARD PAGE HEADING.
Data for mailing purpose
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER
LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER
LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER
LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER
LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER
LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
Data required for preparing XLS type attachment
DATA: V_TABS TYPE X VALUE '09',
V_NEW_LINE TYPE X VALUE '0D'.
START-OF-SELECTION.
Prepare data to send
PERFORM PREPARE_DATA.
Send mail with XLS attachment
PERFORM SEND_MAIL.
*& Form send_mail
form send_mail.
Creation of the document to be sent
DOC_CHNG-OBJ_NAME = 'TEST'.
DOC_CHNG-OBJ_DESCR = 'TEST MAIL WITH XLS
ATTACHMENT'. "mail subject
OBJTXT = 'Test mail with XLS attachment'.
APPEND OBJTXT.
CLEAR OBJTXT.
APPEND OBJTXT.
APPEND OBJTXT.
OBJTXT = 'Please double click the attachment to
verify'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 +
STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'Sample XLS attachement'. "
APPEND OBJHEAD.
Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'XLS'.
OBJPACK-OBJ_NAME = 'TEST'.
OBJPACK-OBJ_DESCR = 'Test.XLS'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
Completing the recipient list
For sending mail to Internet Address
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
For sending mail to SAP user ID
RECLIST-RECEIVER = 'fing087'.
RECLIST-REC_TYPE = 'B'.
APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE :/ 'MAIL SENT....'.
WHEN 1.
WRITE :/ 'TOO MANY RECEIVERS'.
WHEN 2.
WRITE :/ 'DOCUMENT NOT SENT'.
WHEN 4.
WRITE :/ 'NO SEND AUTHORIZATION'.
WHEN OTHERS.
WRITE :/ 'ERROR OCCURED WHILE SENDING
MAIL'.
ENDCASE.
endform. " send_mail
*& Form PREPARE_DATA
FORM PREPARE_DATA.
CONCATENATE 'NAME'
'ADDRESS'
'PHONE'
INTO OBJBIN-LINE
SEPARATED BY V_TABS.
APPEND OBJBIN.
CLEAR OBJBIN.
CONCATENATE 'Hajira'
'MIG-2022'
'23025487'
INTO OBJBIN-LINE SEPARATED BY V_TABS.
CONCATENATE V_NEW_LINE OBJBIN-LINE INTO
OBJBIN-LINE .
APPEND OBJBIN.
CLEAR OBJBIN.
CONCATENATE 'Faiz'
'MIG-2022'
'23025487'
INTO OBJBIN-LINE SEPARATED BY V_TABS.
CONCATENATE V_NEW_LINE OBJBIN-LINE INTO
OBJBIN-LINE .
APPEND OBJBIN.
CLEAR OBJBIN.
ENDFORM. " PREPARE_DATA
**reward if helpful
regards,
madhumitha -
Parsing .xls(excel) file and creating a .xdat(xml) file out of it
Hi All,
need some tips on a task i am trying accomplish for some days now.
I have a excel file, in which I have 10 columns with 40-50 rows of data.
I have a xml structure in mind, in which I want to put all these data from excel file. But till now I haven't understood exactly how I should go about it step by step.
Should I first parse the excel file and save each row (with the column names) in a list, and then read through each row and insert them in the xml format i have planned?
And how do I open a .xdat data and tell my program to insert the data in the sequence of sets I want them to be saved?
I know it's a pretty newbie question ... but will appreciate any help and tips provided. Would help me a lot to learn this new type of task.
Thank you.
with best regards,
NewbieIf you are using JAXB you unmarshall to read the xml. Then you marshall to write.
So what you do is:
1) Unmarshall your xml document. This means you now have your xml as Java objects.
2) Read through the Java objects using loops, etc making any changes to the values. I think here you want to add values, so you can set your values
3) Now in memory you have your new xml thats been updated, so you can marshall it (save it)
I'd recommend a JAXB tutorial. But the basic steps are:
1) Create an xml file and insure its valid
2) Use a free online utility (http://www.hitsw.com/xml_utilites/) to convert the xml into an xml schema (xsd)
3) Use xjc from the jaxb jar and run it over the xml schema (the command i use is xjc myxmlfile.xsd -p com.example
4) Step 3 above creates all the java classes for you to use so then you can unmarshall. Process. Then marshall
This is just a high level. I might have missed something, but the jaxb tutorial is really good and that's how I learned the process. -
Unable to open xls (Excel) file in Number
Hi all,
I just purchsed Number to open excel file in my Imac but after install try to open. it's say "can't be open"
can anyone help me bcz i'm new to imac so tel me know how i can open it... if i can't i want refund bcz not worth for me...This probably isn't overly helpful, but I just tried using the same version of the Lync 2013 Planning Tool as you and am not having any issues.
What happens if you try and re-save the topology as a new file?
If this helped you please click "Vote As Helpful" if it answered your question please click "Mark As Answer"
Georg Thomas | Lync MVP
Blog www.lynced.com.au | Twitter
@georgathomas
Lync Edge Port Check (Beta)
This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
Maybe you are looking for
-
Im trying to setup the a720 with windows 8 and have this problems: When power off the computer have all time this BSOD : SESSION_HAS_VALID_POOL_ON_EXIT Touchscreen not work. If I run the windows 8 install, just for test, the touch is working, the pr
-
Change all icons of a file type in Yosemite?
Hello, I just upgraded from a early 2011 MBP running Mavericks to a new Retina MBP running Yosemite. I did not use Migration Assistant as I wanted a fresh start and instead have copied over all of my data from a clone manually. I use Parallels 10 to
-
when using ituens to playback music - there is a strange horn like beep sound in the background every 1 or less. what to do to get rid of it
-
[ Edited by Apple Discussions Moderator; Please start a new topic about your technical issue. ] 10.4.7 Update Scott
-
Hi all, i'm new to flex.I have a problem regarding XML attributes."How to get the XML attribute value from the xml file to Flex application using HTTPService".I tried but it is coming only one attribute value. First i have to get the attribute values