Format issue in opening an XLS attachment sent through email by ABAP2XLSX
I have downloaded the ABAP2XLSX nuggets and tried to send an attachment in the email using the SAP. But when opening the attachment it is giving up an format issue and not able to view the content. I am able to save the XLSX file on the PC and able to read it but when I send it to email it doesn't open correctly and it is in a non readable format. Please find the code that I have been using. Can someone help me on this.
TYPES: BEGIN OF tp_zzrule,
zzprog TYPE zzfunc,
zzdata TYPE zzcri1,
zzseq TYPE zzseq,
zzkey1 TYPE zzkey1,
zzkey2 TYPE zzkey2,
END OF tp_zzrule.
DATA: w_zzrule TYPE tp_zzrule,
t_zzrule TYPE TABLE OF zzourule.
TYPE-POOLS: abap.
DATA: v_document TYPE REF TO cl_document_bcs,
v_recipient TYPE REF TO if_recipient_bcs,
v_main_text TYPE bcsy_text,
v_send_request TYPE REF TO cl_bcs,
v_msub TYPE so_obj_des,
v_size TYPE so_obj_len,
v_string2 TYPE string,
v_attsub TYPE sood-objdes,
v_mailid TYPE ad_smtpadr,
v_sent(1) type c,
v_sent_to_all TYPE os_boolean,
v_string TYPE string,
v_repid TYPE sy-repid,
v_title TYPE so_text255,
v_dochead TYPE so_text255.
DATA lt_test TYPE TABLE OF sflight.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
column_dimension TYPE REF TO zcl_excel_worksheet_columndime.
DATA: ls_table_settings TYPE zexcel_s_table_settings.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab,
t_objtxt like solisti1 occurs 0 with header line,
t_objbin like solisti1 occurs 0 with header line,
t_objpack like sopcklsti1 occurs 0 with header line,
t_reclist like table of somlreci1 with header line.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
CONSTANTS: lv_default_file_name TYPE string VALUE 'multi sheet test.xlsx'.
PARAMETERS: p_path TYPE zexcel_export_dir,
p_empty TYPE flag.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path.
SELECT *
INTO TABLE t_zzrule
FROM zzourule
WHERE zzprog = 'RV63A999'.
SELECT * FROM sflight INTO TABLE lt_test.
" Creates active sheet
CREATE OBJECT lo_excel.
For first Sheet in the excel workbook
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Test sheet one').
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ls_table_settings-show_row_stripes = abap_true.
lo_worksheet->bind_table( ip_table = lt_test
is_table_settings = ls_table_settings ).
lo_worksheet->freeze_panes( ip_num_rows = 3 ). "freeze column headers when scrolling
column_dimension = lo_worksheet->get_column_dimension( ip_column = 'E' ). "make date field a bit wider
column_dimension->set_width( ip_width = 20 ).
For second Sheet in the excel workbook
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( ip_title = 'Second sheet' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2
ip_value = 'This is the test for second sheet by Pavan' ).
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ls_table_settings-show_row_stripes = abap_true.
lo_worksheet->bind_table( ip_table = t_zzrule
is_table_settings = ls_table_settings ).
This will create excel.
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer->write_file( lo_excel ).
" Convert to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_file
IMPORTING
output_length = lv_bytecount
TABLES
binary_tab = lt_file_tab.
Save the file on to the PC
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = lv_full_path
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ).
*--Create and set document with attachment.
v_main_text-line = 'This is the main text not sure where this would print'.
append v_main_text.
TRY.
v_send_request = cl_bcs=>create_persistent( ). "#EC .., bzw.
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
v_msub = 'Test excel with multi sheets.XLS'.
TRY.
v_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = v_main_text
i_subject = v_msub ).
CATCH cx_document_bcs . "#EC NO_HANDLER
ENDTRY.
v_size = lv_bytecount.
*--Add the attachment.
TRY.
v_document->add_attachment( "#EC .., bzw
i_attachment_type = 'EXT'
i_attachment_type = 'XLS'
i_attachment_type = 'RAW'
i_attachment_subject = v_attsub
i_attachment_size = v_size
i_att_content_hex = lt_file_tab ). "#EC .., bzw.
i_att_content_hex = lt_file_tab ). "#EC .., bzw.
CATCH cx_document_bcs . "#EC NO_HANDLER
ENDTRY.
*--Add document object to send request.
TRY.
v_send_request->set_document( v_document ). "#EC .., bzw.
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
*--E-mail recipent list
t_reclist-rec_type = 'U'.
t_reclist-receiver = <email Id here>.
APPEND t_reclist.
CLEAR t_reclist.
LOOP AT t_reclist.
CLEAR v_mailid.
v_mailid = t_reclist-receiver.
*--Create mail recipient object.
TRY.
v_recipient = cl_cam_address_bcs=>create_internet_address( v_mailid ). "#EC .., bzw.
CATCH cx_address_bcs . "#EC NO_HANDLER
ENDTRY.
*--Add recipient object to send request.
TRY.
v_send_request->add_recipient( v_recipient ). "#EC .., bzw.
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
ENDLOOP.
**--Add recipient object to send request.
TRY.
v_sent_to_all = v_send_request->send( i_with_error_screen = 'X' ).
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
*--Send document.
COMMIT WORK.
IF sy-subrc = 0.
MESSAGE s999(zou01) WITH text-020.
v_sent = 'X'.
ENDIF.
I realize this is an old post, but am wondering if you ever resolved this. I'm having the same issue. Download an xlsx file locally opens fine, but attaching the seemingly exact same file throw errors/warnings when trying to open via an email attachment.
Similar Messages
-
Error while trying to open an attachment sent through email in smartform
Hi,
My requirement is to send the smartform through email as PDF attachment.I am able to send the mail.But when I try to open the attachment I am getting error as 'Adobe reader could not open the attachment 'advance shipment notification.PDF' because it is either not the supported file type or the file has been corrupted(for example, it was sent as an email attachment and was't correctly decoded)'.What does it mean?
Can anyone give me a proper solution for this?
It's very urgent.Useful answers will be rewarded.
Thanks,
HemaHi,
Are you using any webdispatcher or some proxy? Is there any URL filter configured in between?
If yes then I think you have to allow these pages.
Regards,
Vamshi. -
I am having trouble viewing pictures through e-mails sent from a friends ipad to my imac. Where picture should be is a blue ? mark. Can anyone help.
Are you really using a G3, if so you're on the wrong forum. This forum is for Intel based machines. If you have updated you may want to update your profile, here is a link to tips on how to do that: Profile Update
However regardng the photo's you aren't providing any infomraiton, such as what mail tool is being used. Please provide more details and someone may be able to help you out. If you have a newer iMac remember OS X no longer has Flash installed so you may need to go to Adobe's website and download Flash.. -
Some users are experiencing difficulty opening certain docx files sent as email attachments. These files contain content controls to protect data in the document. Could someone please confirm that the content controls are the reason the files won't open.
These files open correctly when sent as doc files.
ThanksCongrats to Saeid, Ronen, and Ricardo! Big thank you to all our contributors!
Transact-SQL Technical Guru - February 2015
Saeid Hasani
T-SQL: How the Order of Elements in the ORDER BY Clause Implemented in the Output Result
Durval Ramos: "Very well structured and with examples that clarify how a T-SQL statement can change the data output order."
Richard Mueller: "Good use of Wiki guidelines and great examples."
Ronen Ariely
Free E-Books about SQL and Transact-SQL languages
Richard Mueller: "An excellent collection and a great idea."
Durval Ramos: "A good initiative. Very useful !!!"
Ricardo Lacerda
Declare Cursor (Transact-SQL) versus Window with Over - Running Totals
- Accumulated Earnings
Durval Ramos: "The "Window function" sample was well presented, but it was unclear how the chart was generated."
Richard Mueller: "A new idea that can be very useful. Grammar needs work"
Also worth a mention were the other entries this month:
[T-SQL] Retrieve Table List with Number of Rows by
Emiliano Musso
Richard Mueller: "Short but sweet solution to basic question."
Durval Ramos: "A simple T-SQL script, but useful."
[T-SQL] Search for Missing Values within a Numerical Sequence by
Emiliano Musso
Richard Mueller: "Clever solution with good code examples."
Durval Ramos: "You need add more details about development of the idea and create a "Conclusion" section to easy understanding."
[T-SQL] Converting Multiple Rows into HTML Format single ROW by
Maheen Khizar (Bint-e-Adam)
Durval Ramos: "In some situations, It's need to consume and format HTML tags for a UI, but It's important to remember that Best Practices recommend this formatting process preferably in Presentation Layer"
Richard Mueller: "A great new idea. Some features need more explanation. Avoid first person."
Ed Price, Azure & Power BI Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
How do I open a PDF attachment from an email so I can edit it for reply on an iPad?
I need to open a PDF attachment on an email, edit it and resend it back to the originator on an iPad. Help?
A PDF is a graphics document, so you can't edit it without access to an expensive program like Adobe Acrobat.
-
I have iPad 4th Generation with iOS 6.1.3 Since my iBooks was updated to version 3.1.1 I cannot open pdf file attachment in my email. When I tap of the attachment, the iBooks icon no longer show itself. Can someone please help?
Thanks for all (Ocean20 & Courcoul) who replied.
Reset the device did not help me but it does triggers me to attempt to resend the PDF file attachment on email--and it works the 2nd time. My problem is now solved.
The Adobe Reader is very helpful--it allows me to scroll through the document easily, unlike iBooks, where I cannot scroll straight up or down. -
This whole support process doesn't make sense to me, but that's a problem for another day...
I opened a PDF attached to an email ( from a trusted source). Now I can't close it, nor can I get back to my email account. When I try, I just get the open PDF. How do I close it?I looked at similar inquiries, and got my answer. Thanks!
-
I filled out my own form saved it and sent through email, when I opened it what I filled out was not there, why would this be?
What software did you use to fill-in the form (Preview, perhaps) and what software did you use to open it after you emailed it?
-
I opened a word attachment to an email in my gmail account and now I can't get rid of it. When I tap the mail icon the doc appears not my emails. Can anyone help?
1. Double-click the Home button reveal the Task Bar
2. Hold the Mail icon down for a minute or two until the minus sign appear
3. Hit the minus sign to close the Mail icon -
Encypting Pdf document sent through email from BO WEBI
Hi,
Encypting Pdf document sent through email from BO WEBI . Is there any sdk scripts/3rd part tools to do this.
Thanks
RanjithHello Ranjith,
There is no native functionality for encrypting a PDF document from within BusinessObjects Enterprise. Additionally, none of the BOE SDKs are able to encrypt a PDF document either. Generally speaking, if it is not possible in the product (BOE) it's not possible with the various SDKs.
I am not aware of any third party tools that can do this from inside BOE either. If you haven't done so already you may want to post a question to the [Business Objects Board|http://www.forumtopics.com/busobj/index.php?sid=1037068e7b26619422be6a7b18a8c2ee] (BOB) to see if anyone there has a suggestion.
Sincerely,
Dan Kelleher -
I am not able to open an Excel (.xls) document sent as an attachment in an Email. I have Office for Mac loaded on my Mac.
Try dragging those attachments out of the mail message and into a Finder folder or onto your Desktop.
Then drag the .xls file onto the Excel app (the "actual" app or the Dock icon will do), or use File->Open from within Excel.
If that doesn't work, it's possible that the Excel file being sent to you was created using a more recent version of Excel than the one you have. Ask the person sending it to save it in an older format. If you just need to look at it and not edit it, the other person could send it to you as a PDF file. -
What is the minimal Format of an iCal event to attach to an email?
Hello all!
I just finished a large order page for a taxi friend. I would like to send the order with an iCal event attached to an email. He should only click on this new file, to enter this pickup order to his iCal ...
I am struggling with the format. In my CGI script I have the following format, where the $variables are replaced with the convinient strings:
BEGIN:VCALENDAR
BEGIN:VEVENT
DTEND;TZID=Europe/Berlin:$ical_data_end
SUMMARY:$ical_summary
DTSTART;TZID=Europe/Berlin:$ical_data_start
DTSTAMP:$ical_dtstamp
LOCATION:$ical_location
SEQUENCE:0
DESCRIPTION:$ical_comment
BEGIN:VALARM
TRIGGER:-PT1H
DESCRIPTION:Event reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR
Does a time string like "20120608T123500" has to finish with a "Z" ? Do I need additional informations, like "UID:", "X-WR-ALARMUID:" ... In any case my iCal event sent by email is not adding to the iCal saying: "iCal can't read this calendar. No events have been added to your iCal calendar."
I would be grateful for any hint
marekSurprise Surprise!
I realized after heavy testing, that a DTSTAMP: is not needed.
But there is apparently a problem with the DATE-TIME format: Perhaps for other readers, which are in such a desparate situation, as I am since two days now!!! here some explanations:
The reference about iCal format you find in RFC 5546
DTSTART; and DTEND; have a time string like follows:
yyyymmddThhmmss
In the middle the big letter "T". But you have to add the time zone: for me it is the following:
DTSTART;TZID=Europe/Berlin:20120608T062500
Now the big surprise: this time format with an hour over 12 ooops! I tested now once again like follows
DTEND;TZID=Europe/Berlin:20120608T212500
DTSTART;TZID=Europe/Berlin:20120608T202500
changing the hh (hours) with one hour difference up until here. 10 Minutes again, iCal was freezing with hours over 19. I swear!
Ok to answer my original question: What is the minimal format of an iCal event, which you may attach to an email:
BEGIN:VCALENDAR
BEGIN:VEVENT
DTEND;TZID=Europe/Berlin:20120608T212500
SUMMARY:Name
DTSTART;TZID=Europe/Berlin:20120608T202500
LOCATION:MUC
SEQUENCE:0
BEGIN:VALARM
TRIGGER:-PT1H
DESCRIPTION:Event reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR
But be aware, that this is buggy. Be carefull and have a nice evening
marek -
Looking for attachment sent via email
I am trying to find out if a user sent an attachment via GW. I was wondering what logs I could check to see any attachments to emails that were sent via GW. I have already looked at the Agent Accounting Data Files, and looked at the POA.log = which only shows username to username, but no attachment file names.
Are there any other logs that would show what email user sent an in-house email to another in-house user and what attachments, if any, where attached to that email's?
Thank you!
JonGWAVA Reveal will allow you to logon as the user undetected, if needed,
and check the send items
Tommy Mikkelsen
IT Quality A/S, Denmark
Novell Support Forums SYSOP / NKP
Sorry, but no support through email
Please join http://www.open-horizons.net
jnlickey wrote:
>
> I am trying to find out if a user sent an attachment via GW. I was
> wondering what logs I could check to see any attachments to emails
> that were sent via GW. I have already looked at the Agent Accounting
> Data Files, and looked at the POA.log = which only shows username to
> username, but no attachment file names.
>
> Are there any other logs that would show what email user sent an
> in-house email to another in-house user and what attachments, if any,
> where attached to that email's?
>
> Thank you!
>
> Jon -
Korean text displayed as junk char in xls attachmnt sent thru email frm SAP
Hi All,
I am sending a report output to users as an xls attachment through email from SAP.
I am facing problem with languages other than English. For ex a customer name is in korean lang and when I display the name in ALV it is fine also when I download from ALV it is fine only problem when I send that report through email.
Excel is having all junk char instead of Korean text.
I am using function modules SCMS_STRING_TO_XSTRING,SCMS_XSTRING_TO_BINARY and SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
I am using above FM because the data is more than 255 char.
Please help me to send other lang texts in XLS attachment through email.
Regards,
Suresh.Hi All,
I am sending a report output to users as an xls attachment through email from SAP.
I am facing problem with languages other than English. For ex a customer name is in korean lang and when I display the name in ALV it is fine also when I download from ALV it is fine only problem when I send that report through email.
Excel is having all junk char instead of Korean text.
I am using function modules SCMS_STRING_TO_XSTRING,SCMS_XSTRING_TO_BINARY and SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
I am using above FM because the data is more than 255 char.
Please help me to send other lang texts in XLS attachment through email.
Regards,
Suresh. -
Cant open pdf documents attached to an email
Hi All,
Since updating Adobe reader to Version 9 I am unable to open any pdf documents attached to emails (outlook express). If I want to open the documents I have to first save the attachments to a different location eg My documents, and then go to that location to open them. If I try to open the pdf in the email the following message is displayed "Do you want to open this File?" after clicking yes the following message comes up "This file does not have a program associated with it for performing this function. Create an association in the folder options control panel"
PDF is already in the folder options
Any ideas?
ToniThanks. I disabled Protected Mode, and I was able to open the pdf attachment. Just to make sure, I enabled it and then disabled it again, and when I tried to open the attachment, it did as before – Adobe Reader (Not Responding) and Internal Error message. Tried it several more times, (enable and then disable Protected Mode) and each time, Adobe Reader wouldn’t launch (Not Responding, Internal Error).
Morris Davidson
Maybe you are looking for
-
Can anyone help me to delete the faintly listed songs on my iPad which I have transferred from my Pc but they will not play on my iPad.
-
Crystal report -How to display multiple lines in line chart?
Hi, M struggling to display multiple lines in line chart. All the values m fetching it from database into data table in below format & data type Category(String).....year(Int).....graph_values(Int).....table_value(String) Test........................
-
JButton not visible after use of Jpanel removeAll ..
Hi! I'm having a calculator class that inherits JFrame. I need to add more buttons after setting an option from the (view) menu bar .. (from normal to scientific calculator). I needed to use the JPanel removeAll method and then add the normal buttons
-
Aperture 3.6 wrong photo in main viewer pane
Aperture 3.6 Yosemite 10.10.1 MacBook Pro (15-inch, Mid 2012) 2.3 GHz Intel Core i7 Aperture library 62,000+ photos. Main photos stored in directories (not in Aperture library) Question to resolve: When I am using Aperture at time when in "Split view
-
Artículos compuesto y gestión por numero de serie
Buen día a todos. Les comento, hemos usado sap para nuestras operaciones de trabajo y vamos a comenzar a llevar un registro del inventario de equipos y mobiliario de la empresa en sap cosa que no habíamos hecho aun, creamos los códigos para los