Csv attachments
There does not seem to be a separate category for the Mail app that is included with Mac OS.
There was an earlier thread on this but it is archived.
When I attached csv files to an email - and send it to folsk on windows - the file gets extra lines inserted - this causes problems for them processing the file.
The file is NOT created by Excel - but it is read into Excel - so changing the way the file is saved is not an possibility - and opening each file just to save it with different format is also not an option as the number of files to be processed makes that too time consuming.
Mail is doing something to the file that it likely does not need to be doing. If I attached the exact same file to a Mac Mail email and also to an email sent from a different email client - and open them both on Windows from Outlook - the Mac Mail file has extra lines and the other does not.
Yes I could remove the extension - or compress - or use a file sharing option instead of email attachment - the trouble is that there are many other folks involved in the process and it may be too difficult to change too much of the process.
Short term - I will simply not use the Mail client included with Mac OS X.
Outlook 2007 is what I have tested with - the other end might be 2003, 2007 or 2010 on the windows side - and 2011 on hte Mac side.
Yes send windows attachemnt was checked and makes no difference.
Yes zip is an option.
Opening and saving each file in xls format is an option - however, I would have to do that operation at least a dozen times a day - which coudl get annoying - maybe a folder action setup to open each csv and resave it as an xls automatically might work.
The output file that I send gets copied and pasted into another doc - and then is not needed - so the extra work involved in converting the csv in advance seems inefficient.
Not using email to share the files might be an option.
For the moment the simplest option is for me to NOT use Apple Mail to send - or to instruct the folks on the other end to NOT use Outlook to receive.
Over the past decade or so I have created about 12,000 csv files - and while that is only about 1,200 a year or an average of about 5 a day - i am not the only one creating them and there is more than one person on the team that needs to process the files. So I am looking for the simplest - easiest - most comprehensive solution.
This was not a problem in the past because we all used Windows OS and MS Office Professional - a number of us have recently switched to Mac OS and not using MS Office (or at least not using Outlook).
Similar Messages
-
*.CSV attachments scrambled
Hi,
Am having trouble with automated reports being sent out in *.CSV format.
The emails are going out to suppliers and the reports are being attached in CSV format. However in some instances the attachments are being scrambled and received by the supplier as scrambled text within the email body with no attachment reaching them. Most of the reports are reaching their destinations without issue.
Can anyone tell me what is causing this and what can be done to rectify it?
If it is a problem on the suppliers end (ie a firewall issue) is there an easy fix that I can advise them to implement?
Cheers.Outlook 2007 is what I have tested with - the other end might be 2003, 2007 or 2010 on the windows side - and 2011 on hte Mac side.
Yes send windows attachemnt was checked and makes no difference.
Yes zip is an option.
Opening and saving each file in xls format is an option - however, I would have to do that operation at least a dozen times a day - which coudl get annoying - maybe a folder action setup to open each csv and resave it as an xls automatically might work.
The output file that I send gets copied and pasted into another doc - and then is not needed - so the extra work involved in converting the csv in advance seems inefficient.
Not using email to share the files might be an option.
For the moment the simplest option is for me to NOT use Apple Mail to send - or to instruct the folks on the other end to NOT use Outlook to receive.
Over the past decade or so I have created about 12,000 csv files - and while that is only about 1,200 a year or an average of about 5 a day - i am not the only one creating them and there is more than one person on the team that needs to process the files. So I am looking for the simplest - easiest - most comprehensive solution.
This was not a problem in the past because we all used Windows OS and MS Office Professional - a number of us have recently switched to Mac OS and not using MS Office (or at least not using Outlook). -
Need to send CSV attachments in a single mail to the Rcvr
Hi All,
Currently we are using 7.1 release of PI system. The scenario is from IDOC to ANSI Format. All the files recieved from IDOC should be sent as an attachment in CSV format in a single mail .Could anyone please let me know how to proceed with this. If there is any javamapping needed for this? If yes, could you please provide the code for the same,
Regards,
PavithraHi Pavithra,
How to Guide for sending mails:
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d0964d7c-e66e-2910-24bb-ac535e4a5992
Use StrictXML2PlainBean in the module processor to convert the data to CSV:
/people/pooja.pandey/blog/2009/02/23/xml-to-text-conversion-made-easy-by-strictxml2plainbean
http://help.sap.com/saphelp_nwpi711/helpdata/en/44/748d595dab6fb5e10000000a155369/content.htm
Regards,
Aravind -
Convert .csv-attachments
Hi!
I would like to convert a .csv-file which is received as an email-attachment. The problem is that the .csv-file is not recognized as I am not able to define the structure of the .csv-file. At the moment it is converted to one long string with all fields which can not be used for further processing.
If I transmit the attachment via FTP it is no problem as I have the possibility to use "file content conversion" as message protocol in the file adapter.
Does anyone know if there is a possibility of file content conversion while using the mail adapter?
Regards
ChrisHi Joachim,
thank you very much for your answer.
On page 3 of the Howto-guide for JMS adapter i found the "Module Sequence in the Sender Channel". I only used the line with "Plain2XML" and set all parameter values from page 4. The last line (xml.fieldFixedLengths) was changed to xml.fieldSeparator with parameter value ";" as a CSV file should be converted.
During the test the adapter received the email with the attachment and I received the following feedback from the mail adapter:
<b>running: [2005-11-09T15:22:52Z] 1 new messages found among 1 messages in total; processing message 1... done; action completed</b>
I think that the conversion was done successfully but I can`t find the message in the RWB.
Do you know where to find the converted message?
Best regards
Chris -
Archive the CSV attachments in mail
Hi,
I need to archive the CSV attachements that I am sending by mail
Please suggest how to go about this???
If not possible archiving of selected mails will also do....part-2
CONCATENATE 'Display Message' ' ' INTO IT_OBJTXT
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CLEAR IT_OBJTXT.
IT_RECLIST-RECEIVER = 'emailaddress'.
IT_RECLIST-REC_TYPE = 'U'.
IT_RECLIST-EXPRESS = ' '.
IT_RECLIST-COM_TYPE = 'INT'.
APPEND IT_RECLIST.
CONCATENATE 'Display Message' ' ' INTO IT_OBJTXT
SEPARATED BY SPACE.
APPEND IT_OBJTXT.
CLEAR IT_OBJTXT.
IT_RECLIST-RECEIVER = 'email address'.
IT_RECLIST-REC_TYPE = 'U'.
IT_RECLIST-EXPRESS = ' '.
IT_RECLIST-COM_TYPE = 'INT'.
APPEND IT_RECLIST.
CLEAR: W_TEXT.
DOC_CHNG-OBJ_DESCR = 'Successfull Message display'.
DOC_CHNG-OBJ_NAME = 'INBOUND'.
DESCRIBE TABLE IT_OBJTXT LINES TAB_LINES.
READ TABLE IT_OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( IT_OBJTXT ).
CLEAR: W_LONGTEXT.
W_LONGTEXT = 'name of report for testing'.
IT_OBJBIN = W_LONGTEXT.
APPEND IT_OBJBIN. CLEAR IT_OBJBIN.
APPEND IT_OBJBIN. CLEAR IT_OBJBIN.
APPEND IT_OBJBIN. CLEAR IT_OBJBIN.
CLEAR TEXT.
MOVE: 'User:' TO TEXT,
SY-UNAME TO TEXT+6.
IT_OBJBIN = TEXT.
APPEND IT_OBJBIN. CLEAR IT_OBJBIN.
CLEAR: w_status, W_MATNR,
W_MTART, w_werks, w_lgort .
w_sno = 's no'.
w_status = 'status'.
W_MATNR = 'Mat No.'.
W_MTART = 'Mat Type'.
W_werks = 'werks'.
w_lgort = 'lgort'.
CONCATENATE w_status W_MATNR W_MTART W_werks w_lgort
INTO W_LONGTEXT SEPARATED BY ','.
IT_OBJBIN = W_LONGTEXT.
APPEND IT_OBJBIN. CLEAR IT_OBJBIN.
LOOP AT IT_TAB2.
DO.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE IT_TAB2 TO <FIELD>.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
SEARCH <FIELD> FOR ',' IN CHARACTER MODE.
IF SY-SUBRC = 0.
CONCATENATE '"' <FIELD> '"' INTO <FIELD> IN CHARACTER MODE.
ENDIF.
IF SY-INDEX = 1.
I_DLOAD-DLOAD = <FIELD>.
SHIFT: I_DLOAD-DLOAD LEFT DELETING LEADING SPACE.
ELSE.
SHIFT: I_DLOAD-DLOAD LEFT DELETING LEADING SPACE.
CONCATENATE I_DLOAD-DLOAD <FIELD> INTO I_DLOAD-DLOAD
SEPARATED BY ',' IN CHARACTER MODE.
ENDIF.
ENDDO.
IT_OBJBIN = I_DLOAD-DLOAD.
APPEND IT_OBJBIN. CLEAR IT_OBJBIN.
ENDLOOP.
ENDIF.
ENDIF. -
Read multi-tabbed excel file attachments from Sender Mail Adapter.
There is a need to read excel attachments from incoming email to a
mailbox. We know we can use Sender Mail adapter to easily read .xml, .txt
or .csv attachments.
For excel attachments we know from SDN that you have to write
adapter modules to handle excel. However the excel file we need to read has
multiple worksheets(tabs) and data may be contained in any of them.
Is it possible to use SAP XI Mailsender adapter to read such a file as an attachment? What kind of module development would we need for this? I am not much of a Java programmer so examples or links to other documentation would help.
Thanks,
RudraRudra,
Use Java Mapping. There is a free java api available called JExcelAPI to achieve this.
Shabarish's blog describes about this. This might be helpful to you
/people/shabarish.vijayakumar/blog/2009/04/05/excel-files--how-to-handle-them-in-sap-xipi-the-alternatives -
Issue with 3 attachments in an email
Hi All,
Anybody can send me the program which generates 3 excel sheets as an attachment. i wrote one program which geberates .txt files as an atatchmetns.
thanks,
maheedharhi,
following is the code which uses both formats PDF and CSV OR XLS.
*& Report Z_SEND_JOB. &*
*& Title : Send spool lists with PDF / CSV attachments. &*
*& Program name : Z_SEND_JOB. &*
*& Source Code Type : Report &*
report z_send_job.
* INCLUDE *
include z_send_job_data.
include z_send_job_pai.
* AT SELECTION-SCREEN. *
at selection-screen.
if s_email1[] is initial.
message s899(mm) with 'Please Enter E-Mail id'.
stop.
endif.
if p_spool is initial and p_tcode is initial and p_pgna is initial and p_sch is initial.
message s899(mm) with 'Please enter Spool Number or Tcode or Program name or created by'.
stop.
endif.
* START-OF-SELECTION. *
start-of-selection.
perform get_job_details.
if not p_pdf is initial.
*process to send as pdf attachment
perform convert_spool_to_pdf.
perform process_email.
else.
*process to send as excel attachment
perform convert_spool_excel.
if not it_spool_xls_return[] is initial.
perform process_email.
else.
message i000(0) with 'Cannot Send this spool as an Excel File'.
endif.
endif.
*iinclude z_send_job_data.
*& Include Z_SEND_JOB_DATA
* Tables Workarea *
tables: somlreci1,
tbtcp.
* TYPE-POOLS *
type-pools: truxs.
* CONSTANTS *
constants: c_no(1) type c value ' ',
c_device(4) type c value 'LOCL'.
* GLOBAL DATA DECLARATIONS *
data : gd_recsize type i.
data : l_format(3) type c.
*Job Runtime Parameters
data : gd_eventid like tbtcm-eventid,
gd_eventparm like tbtcm-eventparm,
gd_external_program_active like tbtcm-xpgactive,
gd_jobcount like tbtcm-jobcount,
gd_jobname like tbtcm-jobname,
gd_stepcount like tbtcm-stepcount,
gd_error type sy-subrc,
gd_reciever type sy-subrc.
data : w_recsize type i.
data : gd_subject like sodocchgi1-obj_descr,
it_mess_bod like solisti1 occurs 0 with header line,
it_mess_att like solisti1 occurs 0 with header line,
gd_sender_type like soextreci1-adr_typ,
gd_attachment_desc type so_obj_nam,
gd_attachment_name type so_obj_des.
*Spool to PDF conversions
data : gd_spool_nr like tsp01-rqident ,
gd_destination like rlgrap-filename,
gd_bytecount like tst01-dsize,
gd_buffer type string.
data : gv_client type tsp01-rqclient,
gv_name type tsp01-rqo1name,
gv_type type rststype-type,
gv_objtype type rststype-type,
gv_is_otf(1) type c value ' ',
* GV_SPOOL type i,
gv_pdfspoolid type tsp01-rqident,
gv_jobname type tbtcjob-jobname,
gv_jobcount type tbtcjob-jobcount.
* Field Strings *
*Spool IDs
types: begin of t_tbtcp.
include structure tbtcp.
types: end of t_tbtcp.
*for excel
types: begin of t_spool.
include structure bapixmspoo.
types: end of t_spool.
* Internal Tables *
data: it_tbtcp type standard table of t_tbtcp initial size 0,
wa_tbtcp type t_tbtcp.
*Binary store for PDF
data: begin of it_pdf_output occurs 0.
include structure tline.
data: end of it_pdf_output.
data t_spools type standard table of t_spool with default key.
data : it_spool_xls like t_spools with header line.
data : it_spool_xls_return type truxs_t_text_data.
data: wa_spool_xls_return(255) type c.
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 : begin of gt_spool_file occurs 0,
tdline(2500) type c,
end of gt_spool_file.
* Selection Screen *
selection-screen begin of block b1 with frame title text-001.
select-options: s_email1 for somlreci1-receiver
no intervals.
parameter: p_spool like tbtcp-listident,
p_tcode like tstc-tcode,
p_pgna like tstc-pgmna,
p_sch like tbtcp-sdluname default sy-uname.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameter: p_pdf radiobutton group g1 default 'X',
p_excel radiobutton group g1.
selection-screen end of block b2.
*include z_send_job_pai
*& Include Z_SEND_JOB_PAI
*& Form GET_JOB_DETAILS
form get_job_details .
data : l_spool(10) type c.
if p_spool is initial.
*IF USER ENTER tcode get program name
if not p_tcode is initial.
select single pgmna into p_pgna from tstc
where tcode = p_tcode.
endif.
*get spool if for program name.
if not p_pgna is initial.
if p_sch is initial.
select listident into l_spool from tbtcp "GD_SPOOL_NR
up to 1 rows
where progname = p_pgna
order by listident descending.
endselect.
if sy-subrc eq 0.
move : l_spool to gd_spool_nr.
endif.
else.
select listident into l_spool from tbtcp
up to 1 rows
where progname = p_pgna
and sdluname = p_sch
order by listident descending.
endselect.
if sy-subrc eq 0.
move : l_spool to gd_spool_nr.
endif.
endif.
endif.
*get spool id with usr name
if not p_sch is initial and p_pgna is initial.
select listident into l_spool from tbtcp
up to 1 rows
where sdluname = p_sch
order by listident descending.
endselect.
if sy-subrc eq 0.
move : l_spool to gd_spool_nr.
endif.
endif.
else.
gd_spool_nr = p_spool.
endif.
if gd_spool_nr is initial.
message s899(mm) with 'Spool not found'.
stop.
endif.
endform. " GET_JOB_DETAILS
*& Form CONVERT_SPOOL_TO_PDF
form convert_spool_to_pdf .
call function 'RSPO_RETURN_SPOOLJOB'
exporting
rqident = gd_spool_nr
first_line = 1
last_line = 1000
desired_type = 'RAW'
tables
buffer = gt_spool_file
exceptions
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
others = 8.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
select single rqclient
rqo1name
into (gv_client, gv_name)
from tsp01
where rqident = gd_spool_nr.
call function 'RSTS_GET_ATTRIBUTES'
exporting
authority = 'SP01'
client = gv_client
name = gv_name
part = 1
importing
type = gv_type
objtype = gv_objtype
exceptions
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 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.
if gv_objtype(3) = 'OTF'.
gv_is_otf = 'X'.
else.
gv_is_otf = space.
endif.
if gv_is_otf eq 'X'.
call function 'CONVERT_OTFSPOOLJOB_2_PDF'
exporting
src_spoolid = gd_spool_nr
no_dialog = ' '
importing
pdf_bytecount = gd_bytecount
pdf_spoolid = gv_pdfspoolid
btc_jobname = gv_jobname
btc_jobcount = gv_jobcount
tables
pdf = it_pdf_output.
else.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
importing
pdf_bytecount = gd_bytecount
tables
pdf = it_pdf_output
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
endif.
if sy-subrc eq 0.
* Transfer the 132-long strings to 255-long strings
loop at it_pdf_output.
translate it_pdf_output using ' ~'.
concatenate gd_buffer it_pdf_output into gd_buffer.
endloop.
translate gd_buffer using '~ '.
do.
it_mess_att = gd_buffer.
append it_mess_att.
shift gd_buffer left by 255 places.
if gd_buffer is initial.
exit.
endif.
enddo.
endif.
endform. " CONVERT_SPOOL_TO_PDF
*& Form PROCESS_EMAIL
form process_email .
if not p_pdf is initial.
describe table it_mess_att lines gd_recsize.
else.
describe table it_spool_xls_return lines gd_recsize.
endif.
check gd_recsize > 0.
perform send_email.
endform. " PROCESS_EMAIL
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
form send_file_as_email_attachment
tables it_message
it_attach
using p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
data: ld_error type sy-subrc,
ld_reciever type sy-subrc,
ld_mtitle like sodocchgi1-obj_descr,
ld_email like somlreci1-receiver,
ld_format type so_obj_tp ,
ld_attdescription type so_obj_nam ,
ld_attfilename type so_obj_des ,
ld_sender_address like soextreci1-receiver,
ld_sender_address_type like soextreci1-adr_typ,
ld_receiver like sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_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.
* do the follwoing 3 times with three different internal tables.
t_attachment[] = it_attach[].
* Describe the body of the message
clear t_packing_list.
refresh t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
describe table it_message lines t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
append t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
describe table t_attachment lines t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
append t_packing_list.
* Add the recipients email address
clear t_receivers.
refresh t_receivers.
loop at s_email1.
t_receivers-receiver = s_email1-low.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
append t_receivers.
endloop.
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.
if ld_error ne 0.
message s899(mm) with 'Error while sending email'.
stop.
else.
message s899(mm) with 'Email sent succesfully'.
endif.
* Populate zreceiver return code
loop at t_receivers.
ld_receiver = t_receivers-retrn_code.
endloop.
endform. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form SEND_EMAIL &*
form send_email. " USING P_EMAIL.
data p_sender like somlreci1-receiver.
data l_sub(50) type c.
refresh it_mess_bod.
* Default subject matter
if not p_pdf is initial.
gd_subject = 'SAP Report Spool Output - .pdf File Attachment'.
gd_attachment_desc = 'spooldata'.
it_mess_bod = 'SAP Report Spool Output - .pdf File Attachment'.
append it_mess_bod.
else.
gd_subject = 'SAP Report Spool Output - .xls File Attachment'.
gd_attachment_desc = 'spooldata'.
it_mess_bod = 'SAP Report Spool Output - .xls File Attachment'.
append it_mess_bod.
endif.
* If no sender specified - default blank
if p_sender eq space.
gd_sender_type = space.
else.
gd_sender_type = 'INT'.
endif.
if not p_tcode is initial.
concatenate 'Attachment from TNS' p_tcode into l_sub separated by space.
elseif not p_pgna is initial.
concatenate 'Attachment from program' p_pgna into l_sub separated by space.
elseif not p_spool is initial.
concatenate 'Attachment from spool' p_spool into l_sub separated by space.
else.
concatenate 'Attachment from user' p_sch into l_sub separated by space.
endif.
if not p_pdf is initial.
l_format = 'PDF'.
else.
l_format = 'XLS'.
it_mess_att[] = it_spool_xls_return[].
endif.
* Send file by email according to the selection file format (.PDF,.XLS File)
perform send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using l_sub
l_format
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
endform. " SEND_EMAIL
*& Form convert_spool_excel &*
form convert_spool_excel .
data : lv_spool like tsp01-rqident,
l_count type sy-tfill,
l_tabix type sy-tabix.
lv_spool = gd_spool_nr.
call function 'RSPO_RETURN_ABAP_SPOOLJOB'
exporting
rqident = lv_spool
first_line = 1
tables
buffer = it_spool_xls
exceptions
no_such_job = 1
not_abap_list = 2
job_contains_no_data = 3
selection_empty = 4
no_permission = 5
can_not_access = 6
read_error = 7
others = 8.
if sy-subrc ne 0.
message s899(mm) with 'Error while reading spool'.
stop.
endif.
call function 'SAP_CONVERT_TO_CSV_FORMAT'
exporting
i_field_seperator = '|'
i_line_header = '-'
i_filename = 'TEST'
tables
i_tab_sap_data = it_spool_xls
changing
i_tab_converted_data = it_spool_xls_return
exceptions
conversion_failed = 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.
data : l_length(3) type c.
*change the format to excel by using the object classes
loop at it_spool_xls_return into wa_spool_xls_return.
condense wa_spool_xls_return.
* l_length = strlen( wa_spool_xls_return ).
* l_length = l_length - 3.
**delete header lines if contains any
if wa_spool_xls_return cp '|--*--|'
or wa_spool_xls_return np '*|*|*|*'.
delete it_spool_xls_return.
clear wa_spool_xls_return.
* concatenate cl_abap_char_utilities=>newline wa_SPOOL_XLS_RETURN
* into wa_SPOOL_XLS_RETURN.
* modify it_spool_xls_return from wa_spool_xls_return.
* clear wa_spool_xls_return.
else.
*If not new line then replace '|' by tabs
if not wa_spool_xls_return eq cl_abap_char_utilities=>newline.
if wa_spool_xls_return ca '|'.
concatenate cl_abap_char_utilities=>newline wa_spool_xls_return
* cl_abap_char_utilities=>horizontal_tab
into wa_spool_xls_return.
replace all occurrences of '|' in wa_spool_xls_return
with cl_abap_char_utilities=>horizontal_tab.
*get rid of '-' symbol if contains any
* if wa_SPOOL_XLS_RETURN CA '-'. "or not wa_SPOOL_XLS_RETURN CA '|'.
* CLEAR wa_SPOOL_XLS_RETURN.
* concatenate cl_abap_char_utilities=>newline wa_SPOOL_XLS_RETURN
* cl_abap_char_utilities=>horizontal_tab
* into wa_SPOOL_XLS_RETURN.
* endif.
replace all occurrences of '.' in wa_spool_xls_return
with space.
condense wa_spool_xls_return.
modify it_spool_xls_return from wa_spool_xls_return.
* wa_SPOOL_XLS_RETURN = cl_abap_char_utilities=>newline.
* IF l_count NE 0 .
** l_tabix = l_tabix + 1.
**Insert new line for the excel data
** if sy-tabix gt 1.
** INSERT wa_SPOOL_XLS_RETURN INTO it_SPOOL_XLS_RETURN INDEX l_tabix.
** endif.
* l_count = l_count - 1.
* ENDIF.
clear wa_spool_xls_return.
else.
delete it_spool_xls_return.
clear wa_spool_xls_return .
* concatenate cl_abap_char_utilities=>newline wa_SPOOL_XLS_RETURN
** cl_abap_char_utilities=>horizontal_tab
* into wa_SPOOL_XLS_RETURN.
* modify it_SPOOL_XLS_RETURN from wa_SPOOL_XLS_RETURN.
* clear wa_SPOOL_XLS_RETURN.
endif.
endif.
endif.
endloop.
endform. " convert_spool_excel -
Sender mail adapter - attachment name
Hi there
We have configured a sender email adapter to receive text/csv attachments and save them to a file system. What we are having a problem with is reading the attachment name. So we are using Dynamis Configuration to create the file name using the subject line - Which is not ideal. Ideally we would like to use the same name as the origianl attachment but haven't found any way of doing that. We even tried using Content-type in the Variable Header (XHeaderName1) suing variable transport binding but it doesn't show up in the Dynamic Config part of the SOAP message.
Is there any way of reading the name of the file attachment? We are on PI release 7.0.
Any help would be appreciated.
Cheers
SalilHi Vitor
There are 2 scenarios that I can think of -
1. You are saving the email attachment as a file. In that case use step 3 in the earlier reply to get the attachment name and save the file witht that name.
2. You are sending the XML straight to a receiver using HTTP, IDOC, JDBC etc. in which case you would need the attachment name much earlier that step 3. For that I guess you would have to write another adapter module on the sender mail adapter(at Position 3 where position1 = payloadswap bean, 2 = custom module to get the attachment name) and add an xml tag to your incoming message. These adapter modules are really powerful and are like user exits in ABAP. In that case you would have to change the Data Type in the Integration repository to reflect that extra tag. Here is some code from a module we wrote to totally change the structure of the xml coming in. The key thing to remember is this module is that you can read the whole message byte by byte. There might be smarter ways of doing it (like using the SAP XML parser factory class) but since I'm not a Java programmer I stuck to the basics. Here's the code( you could also look at the example given in sap help where they remove (or add I'm not sure) CR(carriage return) from CRLF (CR Line feed).
Created on Aug 8, 2007
To change the template for this generated file go to
Window>Preferences>Java>Code Generation>Code and Comments
package jdbcPackage;
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import com.sap.aii.af.mp.module.*;
import com.sap.aii.af.ra.ms.api.*;
@author Salil.Mehta Soltius NZ Ltd
To change the template for this generated type comment go to
Window>Preferences>Java>Code Generation>Code and Comments
public class jdbcClass implements SessionBean, Module {
private SessionContext myContext;
public void ejbRemove() {
public void ejbActivate() {
public void ejbPassivate() {
public void setSessionContext(SessionContext context) {
myContext = context;
public void ejbCreate() throws CreateException {
public ModuleData process(
ModuleContext moduleContext,
ModuleData inputModuleData)
throws ModuleException {
// put your code here
try {
Message msg = (Message) inputModuleData.getPrincipalData();
XMLPayload payload = msg.getDocument();
String payEnc = payload.getEncoding();
byte[] payByte = payload.getContent();
byte[] payByteOut = new byte[payByte.length];
byte[] payByteTemp = new byte[payByte.length];
int i;
int j;
int actualCount = 0;
char xmlTagFound = ' ';
char endXmlTagFound = ' ';
char tagFound = ' ';
System.arraycopy(payByte, 0, payByteTemp, 0, payByte.length);
// Step 1 - Conversions
// convert "< to <" and "> to >"
// convert " to "
// This will remove any carriage returns and line feeds
// and the <XML* and </XML* tags plus the <row> and </row> tags
for (i = 0; i < payByte.length; i++) {
// convert < to < and > to >
if (payByteTemp<i> == '&') {
if (payByteTemp[i + 1] == 'l') {
if (payByteTemp[i + 2] == 't') {
if (payByteTemp[i + 3] == ';') {
payByteTemp<i> = '<';
payByteTemp[i + 1] = '\n';
payByteTemp[i + 2] = '\n';
payByteTemp[i + 3] = '\n';
if (payByteTemp<i> == '&') {
if (payByteTemp[i + 1] == 'g') {
if (payByteTemp[i + 2] == 't') {
if (payByteTemp[i + 3] == ';') {
payByteTemp<i> = '>';
payByteTemp[i + 1] = '\n';
payByteTemp[i + 2] = '\n';
payByteTemp[i + 3] = '\n';
if (payByteTemp<i> == '&') {
if (payByteTemp[i + 1] == 'q') {
if (payByteTemp[i + 2] == 'u') {
if (payByteTemp[i + 3] == 'o') {
if (payByteTemp[i + 4] == 't') {
if (payByteTemp[i + 5] == ';') {
payByteTemp<i> = '"';
payByteTemp[i + 1] = '\n';
payByteTemp[i + 2] = '\n';
payByteTemp[i + 3] = '\n';
payByteTemp[i + 4] = '\n';
payByteTemp[i + 5] = '\n';
// This will take in the initial xml declaration from the Byte array
// And we also don't want the stuff after the xml declaration till
// we reach the first <row> tag
if (xmlTagFound == ' ') {
if (payByteTemp<i> == '>') {
xmlTagFound = 'X';
payByteOut[actualCount++] = payByteTemp<i>;
if (xmlTagFound == 'X') {
payByteOut[actualCount++] = '\r';
continue;
if (xmlTagFound == 'X') {
if (payByteTemp<i> == '<') {
if (payByteTemp[i + 1] == 'r') {
if (payByteTemp[i + 2] == 'o') {
if (payByteTemp[i + 3] == 'w') {
if (payByteTemp[i + 4] == '>') {
xmlTagFound = 'Y';
} else {
continue;
} else {
continue;
} else {
continue;
} else {
continue;
} else {
continue;
// Carriage return and line feed
if ((payByteTemp<i> == '\r') || (payByteTemp<i> == '\n')) {
continue;
// <XML_*> tag
if (payByteTemp<i> == '<') {
if (payByteTemp[i + 1] == 'X') {
if (payByteTemp[i + 2] == 'M') {
if (payByteTemp[i + 3] == 'L') {
tagFound = 'X';
endXmlTagFound = ' ';
continue;
// </XML_*> tag
if (payByteTemp<i> == '<') {
if (payByteTemp[i + 1] == '/') {
if (payByteTemp[i + 2] == 'X') {
if (payByteTemp[i + 3] == 'M') {
if (payByteTemp[i + 4] == 'L') {
tagFound = 'X';
endXmlTagFound = 'X';
continue;
// <row> tag
if (payByteTemp<i> == '<') {
if (payByteTemp[i + 1] == 'r') {
if (payByteTemp[i + 2] == 'o') {
if (payByteTemp[i + 3] == 'w') {
if (payByteTemp[i + 4] == '>') {
tagFound = 'X';
continue;
// </row> tag
if (payByteTemp<i> == '<') {
if (payByteTemp[i + 1] == '/') {
if (payByteTemp[i + 2] == 'r') {
if (payByteTemp[i + 3] == 'o') {
if (payByteTemp[i + 4] == 'w') {
if (payByteTemp[i + 5] == '>') {
tagFound = 'X';
continue;
if ((payByteTemp<i> == '>') && (tagFound == 'X')) {
tagFound = ' ';
continue;
if (tagFound == ' ') {
if (endXmlTagFound == 'X') {
continue;
payByteOut[actualCount++] = payByteTemp<i>;
byte[] payByteExp = new byte[actualCount];
System.arraycopy(payByteOut, 0, payByteExp, 0, actualCount);
payload.setContent(payByteExp);
msg.setDocument(payload);
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
ModuleException me = new ModuleException(e);
throw me;
return inputModuleData; -
Hi.
I'm look for a way to send an Email with an HTML not as an attachment (this I know how to do) but in the email body.
The reason is that sometimes we want to allow the user to see the data without having to open their HTML browser.
I've searched this forum and other and couldn't find anything relevant.
By the way I'm on 4.6c.
thanx in advance.
ayal.Dear Vijay.
I've tried it before I posted this message and also now I copied Rich's code to make sure I haven't left anything.
I get the Email allright, but instead of seing an HTML I see the HTML code itself in the body.
Do I need to do some system configuration like the conversion we do for CSV attachments?
thanx
ayal. -
hi,
I am working in oracle9i and linux 2.4. I need to send a mail from pl/sql along with attachments.
I wrote a pl/sql procedure about how to send a mail with out attachments..
but i want to send a mail from pl/sql along with (csv )attachments ..
That file we have to retrive it from the Directory in the database and to send it through pl/sql using smtp configuration....
RegsAPC,
When I was making use of your sample on OTN that is called 'demo_mail.sql', I got these issues (when compiling the package header against one 10g DB)
21/19 PL/SQL: Declaration ignored
21/65 PLS-00201: identifier 'UTL_TCP' must be declared
22/19 PL/SQL: Declaration ignored
23/47 PLS-00201: identifier 'UTL_TCP' must be declared
47/3 PL/SQL: Declaration ignored
52/16 PLS-00201: identifier 'UTL_SMTP' must be declared
55/3 PL/SQL: Declaration ignored
55/46 PLS-00201: identifier 'UTL_SMTP' must be declared
60/3 PL/SQL: Declaration ignored
60/49 PLS-00201: identifier 'UTL_SMTP' must be declared
64/3 PL/SQL: Declaration ignored
64/45 PLS-00201: identifier 'UTL_SMTP' must be declared
72/3 PL/SQL: Declaration ignored
72/52 PLS-00201: identifier 'UTL_SMTP' must be declared
81/3 PL/SQL: Declaration ignored
81/54 PLS-00201: identifier 'UTL_SMTP' must be declared
95/3 PL/SQL: Declaration ignored
95/57 PLS-00201: identifier 'UTL_SMTP' must be declared
102/3 PL/SQL: Declaration ignored
102/47 PLS-00201: identifier 'UTL_SMTP' must be declared
Bst Rgds,
HuaMin -
How Can I Export Our WIki in a CSV Format?
Victims of our own success: what was originally created as internal content on our private OS X Server wiki now is being requested for presentation on an externally hosted web service. Management wants this content to be accessible to constituents on the outside in a searchable database on a completely different service not administered by us on the inside.
The developer building the database has asked for this content to be exported in CSV for easy import into the new database: page title, tags (a.k.a. keywords, not to be confused with HTML formatting tags), and page content.
Sadly, according to the Wiki Server Admin Guide (p. 73), the Wiki service does not appear to store page content in any kind of database, but rather in separate files. Thus I can't see a way to provide the requested data short of copying and pasting content from each individual wiki page on the OS X Server.
Considering that we're talking about ~200 pages of content, I'd like to avoid a manual process of that kind. I've been through the official Wiki Server Admin Guide, but it offered no help for exporting content in the way I need.
I'm fairly comfortable with AppleScript, less so with shell/bash scripting. Since I'm trying to save time, I'm not sure that's my answer on this scale. Debugging a script (for me) might take longer than a simple copy/paste of 200 items (maybe I'm wrong).
Does anyone have a different way of looking at this I haven't thought of? Am I missing something?
Thanks in advance,
AxiomUnfortunately, exporting the wiki data into a format that databases can understand is not a trivial process. Pages are stored as a collection of folders that contain the wiki text, the HTML for display, the change history, the comments, and the attachments.
In a default setup, the page folders are under /Library/Collaboration/Groups/{groupname}/wiki . All folders under Groups can only be viewed by using root access permissions.
For example, for a wiki page accessed by:
http://yourserver.com/groups/general/wiki/abc12/mywikipage.html
Under /Library/Collaboration/Groups/general/wiki
abc12.page - folder for wiki page
!- attachments - folder for attachments
!- images - folder for images
! page.html - html (probably a cache) for display
! page.plist - property list file with all notes on the
! revisions.db - SQLite database file that contains all the revisions.
You would need a script that runs as the _teamserver user to read every .page directory, parse the .plist files, and generate a SQL statement to preserve all the text, markup, and quotations. If you program really well, you could search for the URLs in every .plist file and record the embedded attachments and images, and copy them to another location.
For my first project, I parsed the .plist files just to get a map of the random page URL and the title. I also found out about "deleted" and "tombstoned" states, and elected to ignore those.
If I get a moment I'll write about that next. -
Sender "Mail" adapter - CSV file attachment
Hi there
I'm looking for some help in configuring a sender mail adapter that receives ".csv" files. I did read some blogs that mention using the "PayloadSwapBean" module to read the mail attachment instead of the mail content. My problem is to now convert the ".csv" file into a message. Is there a module that I can use ( is it the "MessageTransfomBean" ) and how. Any help would be appreciated.
Thanks
SalilHi Salil,
If you want to send a mail with a body and attachments, the message sender HAS to provide an XI message with attachments. I doubt a CSV file does justice.
As Renjith said you need to convert CSV to XmL.
A short description about the Standard Modules:
MessageTransformationBean is a standard module used to apply the XSLT mapping to the adapter module by using <i>Transform.class</i> ( This xslt mapping is done to create a mail package, Dont confuse with the actual mapping in your case this is NOT for converting csv to xml).
Also this module can be used to change the name and type of payloads by using <i>Transform.contentType</i>, <i>Transform.contentDisposition</i>, <i>Transform.contentDescription</i>.
PayloadSwapbean is a standard module for replacing payloads with other payloads (SWAP)
If you want to give each attachment a certain name use Parameters, <i>swap.keyname</i> for name of the payload and <i>swap.keyvalue</i>.
I Hope the use of standard modules is understood. -
Memory problem with loading a csv file and displaying 2 xy graphs
Hi there, i'm having some memory issues with this little program.
What i'm trying to do is reading a .csv file of 215 mb (6 million lines more or less), extracting the x-y values as 1d array and displaying them in 2 xy graphs (vi attacked).
I've noticed that this process eats from 1.6 to 2 gb of ram and the 2 x-y graphs, as soon as they are loaded (2 minutes more or less) are really realy slow to move with the scrollbar.
My question is: Is there a way for use less memory resources and make the graphs move smoother ?
Thanks in advance,
Ierman Gert
Attachments:
read from file test.vi 106 KBHi lerman,
how many datapoints do you need to handle? How many do you display on the graphs?
Some notes:
- Each graph has its own data buffer. So all data wired to the graph will be buffered again in memory. When wiring a (big) 1d array to the graph a copy will be made in memory. And you mentioned 2 graphs...
- load the array in parts: read a number of lines, parse them to arrays as before (maybe using "spreadsheet string to array"?), finally append the parts to build the big array (may lead to memory problems too).
- avoid datacopies when handling big arrays. You can show buffer creation using menu->tools->advanced->show buffer allocation
- use SGL instead of DBL when possible...
Message Edited by GerdW on 05-12-2009 10:02 PM
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to extract data from an arbitrary xml file and export in a nice csv file?
Hallo,
I'm facing big problems in the use of XML files. I have an
application which generates XML files with clusters containing arrays
and scalars like in the example pasted below. My task is to
read it and export the data in a human-friendly CSV document.
Since I don't know the actual content of the cluster, I need some kind
of intelligent vi which goes through the XML file looking for arrays
and other data structures in order to export them properly in the CSV
format (columns with headers).
Thank you
<Cluster>
<Name></Name>
<NumElts>3</NumElts>
<Array>
<Name></Name>
<Dimsize>6</Dimsize>
<I32>
<Name></Name>
<Val>0</Val>
</I32>
<I32>
<Name></Name>
<Val>1</Val>
</I32>
<I32>
<Name></Name>
<Val>2</Val>
</I32>
<I32>
<Name></Name>
<Val>3</Val>
</I32>
<I32>
<Name></Name>
<Val>4</Val>
</I32>
<I32>
<Name></Name>
<Val>5</Val>
</I32>
</Array>
<DBL>
<Name></Name>
<Val>3.14159265358979</Val>
</DBL>
<String>
<Name></Name>
<Val>ciao</Val>
</String>
</Cluster>
Solved!
Go to Solution.Thank you again,
I'm forwarding my vi draft with many comments and an xml file sample.
Data in cluster is stored according to the LabVIEW schema, infact it is generated by LabVIEW.
What I'm trying to do is to access the element of the cluster and read their content using the Invoke node and Property node functions. Could you give it a look, there may be something wrong, I'm not able to access cluster children.
Which funcions should I use? Could you give me an example? You may use the draft I enclosed...
Then write these data in a csv file
should be the easier part.
BODY{font:x-small 'Verdana';margin-right:1.5em}
.c{cursor:hand}
.b{color:red;font-family:'Courier New';font-weight:bold;text-decoration:none}
.e{margin-left:1em;text-indent:-1em;margin-right:1em}
.k{margin-left:1em;text-indent:-1em;margin-right:1em}
.t{color:#990000}
.xt{color:#990099}
.ns{color:red}
.dt{color:green}
.m{color:blue}
.tx{font-weight:bold}
.db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
.di{font:small Courier}
.d{color:blue}
.pi{color:blue}
.cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
.ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}
<?xml
version="1.0" encoding="iso-8859-1" ?>
<Contents type="Data"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XMLSection.xsd">
<section name="beta"
date="7/31/2009" time="3:43:03 PM" version="1.0">
<Cluster>
<Name />
<NumElts>1</NumElts>
<Array>
<Name />
<Dimsize>4</Dimsize>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.93317638164326</Val>
</DBL>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.79233924020314</Val>
</DBL>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.39199947274518</Val>
</DBL>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.74817197429441</Val>
</DBL>
</Array>
</Cluster>
</section>
</Contents>
Attachments:
read_array.vi 12 KB -
How can I display a .csv file as a real time waveform using labview
Hi folks.
As stated, Im looking to display a .CSV file (obtained via RS-232, example; 100,101,102,102,102,103...) as a waveform in real-time. What is the best way to approach this? Im thinking LabVIEW. I have version 7.1 but am not really experienced in using it. I'll give anything a go though. Also, I have Visual Studio 2005, so I was thinking VB???
Thanks in advance!
Simon.
Message Edited by simonious on 10-26-2007 04:13 AMHave a look at this VI.
Add a convert string to number function behind it.
André
Message Edited by andre.buurman@carya on 10-26-2007 01:08 PM
Regards,
André
Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)
Attachments:
convert csvars 2 array of vars.vi 16 KB
Maybe you are looking for
-
Transaction variant durign creation of sales order.
I have a scenario Sale area is R001/10/10 and is applicable for all the customer in all india. Now the requirement is to incase of sell order creation to only the customers at UP it will be made mandatory to put cheque number in the sales order other
-
Change language to use a valid license of another language
Hello, I have a license for Adobe Acrobat X Pro in German. After installing (and license) it in German I changed the language to English. After 30 days, the trial period of the English version has expired, and now I´d like to change the language back
-
K7T Pro2-A (MS-6330) Motherboard
Hi, I am on my second K7T pro motherboard - the first was replaced because the machine started to randomly restart. Things were great for a while and the new(er) one is exhibiting the same symptoms. It seems strange that it is a "grows on you" kinda
-
How do I block ad's on meet me. com
Every time I'm on this website my play store opens up and candy crush saga is what it is showing. This happens quite often this morning. How do I block that from happening again
-
Opinions please: camera quality
Hello, We normally shoot with a Panasonic AG-HPX500P. We have a few field folks who have still cameras with video capabilities. They've taken video with these cameras and I've imported the clips into FCP to compare. Visually, the footage doesn't have