Send email with pre-calculated Excel
Hello everybody.
I'm trying to send an email with a pre-calculated Excel worksheet, generated by an Agent Reporting job.
But, I don't know how to attach the last generated XLS file, using ABAP.
We have BW vers. 3.1 so I can't use Information Broadcasting (it would be the perfect solution).
I've tried to send the pre-calculated results as HTML (following a very good document found in this forum), but the results didn't satisfied the users. I've already read the document about sending a workbook as attachment, but my problem is I don't know where to get the Excel generated by Agent Reporting.
Can someone help me?
Thanks in advance.
Gabriele
P.S.: This is my first post. I hope my next posts will be for helping someone, not only asking for help...
Check this link:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7f601a65-0a01-0010-16a5-c369f2a9fa87
Save it as a PDF file before opening it.
Hope it helps.
Regards
Similar Messages
-
Send email with spool in excel attachment
Hi,
I have this function:
CALL FUNCTION 'Z_SEND_EMAIL_SPOOL_PDF'
EXPORTING
application = 'EMAIL'
emailtitle = texttitle
recextnam = email
src_spoolid = tsp01-rqident
TABLES
texttab = body.
And code:
FUNCTION z_send_email_spool_pdf .
*"*"Interfase local
*" IMPORTING
*" REFERENCE(APPLICATION) LIKE SOOD1-OBJNAM DEFAULT 'EMAIL'
*" REFERENCE(EMAILTITLE) LIKE SOOD1-OBJDES
*" VALUE(RECEXTNAM) LIKE SOOS1-RECEXTNAM
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" TABLES
*" TEXTTAB STRUCTURE SOLI
*- local data declaration
DATA: ohd LIKE sood1,
oid LIKE soodk,
to_all LIKE sonv-flag,
okey LIKE swotobjid-objkey.
DATA: g_document LIKE sood4,
g_header_data LIKE sood2,
g_authority LIKE sofa-usracc,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE,
l_folder_id LIKE sofdk,
l_objcont LIKE soli OCCURS 0 WITH HEADER LINE,
i_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
l_objhead LIKE soli OCCURS 0 WITH HEADER LINE,
folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
hd_dat LIKE sood1.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI', " ABAP lists
pdf LIKE sood-objtp VALUE 'PDF', "PDF format
pbyte TYPE i,
t_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
objtype LIKE rststype-type,
type LIKE rststype-type.
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'PDF'.
DATA: BEGIN OF receivers OCCURS 0.
INCLUDE STRUCTURE soos1.
DATA: END OF receivers.
* Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
CHECK sy-subrc = 0.
*- fill odh
CLEAR ohd.
ohd-objla = sy-langu.
ohd-objnam = application.
ohd-objdes = emailtitle.
ohd-objpri = 3.
ohd-objsns = 'F'.
ohd-ownnam = sy-uname.
*- send Email
CONDENSE recextnam NO-GAPS.
CHECK recextnam <> space AND recextnam CS '@'.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = tsp01-rqclient
name = tsp01-rqo1name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
attach_type = c_objtp.
desired_type = pdf.
IF objtype(3) = 'OTF'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = src_spoolid
IMPORTING
pdf_bytecount = pbyte
TABLES
pdf = t_pdf.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = src_spoolid
IMPORTING
pdf_bytecount = pbyte
TABLES
pdf = t_pdf.
ENDIF.
PERFORM convertir_tabla_pdf_2 TABLES t_pdf l_objcont.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
* fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = emailtitle.
g_document-file_ext = c_file_ext.
g_header_data-objdes = emailtitle.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = texttab
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
hd_dat-file_ext = pdf.
hd_dat-objdes = emailtitle.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
* FORM SO_OBJECT_SEND_REC *
FORM so_object_send_rec
TABLES objcont STRUCTURE soli
receivers STRUCTURE soos1
USING object_hd STRUCTURE sood1
folder_id
object_id
link_folder_id.
DATA: oid LIKE soodk,
to_all LIKE sonv-flag,
okey LIKE swotobjid-objkey.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
extern_address = 'X'
* object_hd_change = object_hd
* object_type = 'RAW'
outbox_flag = 'X'
sender = sy-uname
owner = sy-uname
folder_id = folder_id
object_id = object_id
store_flag = 'X'
link_folder_id = link_folder_id
IMPORTING
object_id_new = oid
sent_to_all = to_all
office_object_key = okey
TABLES
objcont = objcont
receivers = receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
OTHERS = 21.
IF sy-subrc <> 0.
RAISE others.
ENDIF.
ENDFORM.
* FORM INIT_REC *
FORM init_rec TABLES receivers STRUCTURE soos1.
CLEAR receivers.
REFRESH receivers.
MOVE sy-datum TO receivers-rcdat .
MOVE sy-uzeit TO receivers-rctim.
MOVE '1' TO receivers-sndpri.
MOVE 'X' TO receivers-sndex.
MOVE 'U-' TO receivers-recnam.
MOVE 'U' TO receivers-recesc.
MOVE 'INT' TO receivers-sndart.
MOVE '5' TO receivers-sortclass.
APPEND receivers.
ENDFORM.
With this function I can send a spool in pdf format by email. But, now I need send a spool in Excel (xls) format by email. I try to disconnect 'CONVERT_OTFSPOOLJOB_2_PDF' and 'CONVERT_ABAPSPOOLJOB_2_PDF' but doesnt work.
Can you help me?
A lot of thanks in advance.
Best regards.Hi.
I do not think it is feasible to create a worthwhile Excel file from a SAP spool file.
I have reports that send output as Excel attachments to email, but the code (including function modules etc) is too much to post here.
You can use OLE to create an Excel file, but this will not generally work when the report is run in the background.
So my approach is to make the report write an Excel XML file (that's just text after all), and send that as an XLS email attachment. When the email receiver double-clicks on the attachment, it fires up Excel and brings in the data. Most users would not realise that it's not a native Excel file.
One nice touch is to have two sheets in the Excel file, one with the main report and the other with the selection criteria.
Of course there is a lot of work getting started with this.
John -
Program To Send Email with attachemnts in PDF / Excel with Subject
Hi All,
I have been given an Object to Develop a report to Send Email with attachemnts in PDF / Excel with Subject.
Please provide the way to go about.
Regards,
MohsinREPORT ZREPORT_TO_EMAIL NO STANDARD PAGE HEADING LINE-SIZE 200.
DATA : BEGIN OF ITAB OCCURS 0,
PERNR LIKE PA0001-PERNR,
ENAME LIKE PA0001-ENAME,
END OF ITAB.
DATA: message_content LIKE soli OCCURS 10 WITH HEADER LINE,
receiver_list LIKE soos1 OCCURS 5 WITH HEADER LINE,
packing_list LIKE soxpl OCCURS 2 WITH HEADER LINE,
listobject LIKE abaplist OCCURS 10,
compressed_attachment LIKE soli OCCURS 100 WITH HEADER LINE,
w_object_hd_change LIKE sood1,
compressed_size LIKE sy-index.
START-OF-SELECTION.
SELECT PERNR ENAME
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM PA0001
WHERE PERNR < 50.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
Receivers
receiver_list-recextnam = 'type your email address here'. "-->
EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
Mail subject
w_object_hd_change-objdes = 'Message subject'.
Mail body
APPEND 'Message content' TO message_content.
Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = w_object_hd_change
object_type = 'RAW'
owner = sy-uname
TABLES
objcont = message_content
receivers = receiver_list
packing_list = packing_list
att_cont = compressed_attachment.
Hope it helps,
regards,
kushagra -
Sending email with a two worksheet excel via SAP
Hi everyone,
I was wondering, if it's possible to send email with an attachment of a two worksheet excel. Someone told me that's not possible at all with the function SO_NEW_DOCUMENT_ATT_SEND_API1, is it true?
Thanks in advance,To enable sending from multiple accounts, you either need to have multiple accounts set up on the iPad, or be using MobileMe Aliases. If you have multiple email accounts set up, you just tap on the sender address, opening up a series of fields, where you can tap the sender again and choose the account you want to use. They do each need their own SMTP servers, AFAIK.
-
Can´t send emails with pdf attachments - why?
Since i moved all my accounts to my new airbook (OS X 10.8.2) everything works fine BUT i am not able to send emails with pdf attachments.I have an exchange and a mac.account - but they both won`t work.
The emails stay put in the local ausgang? exit box and won`t move away unless i delete them.
i checked the accounts, the activity - all says it works fine - but it doesn`t!
Maybe in the *deep* of my mac is one thing that says no pdf - but where can i find it?
I appreciate every helpful hint :-)
greetingsit tries to send the email for about five minutes and than gives the message *server doesn't work* you want to try another? repeat? or later?
when i change the server e.g. from exchange to mac - tries again and without further notice i find the message in the outbox - even when i click that one and *send* again - nothing changes......
I already tried to name the attachments in.pdf - i also change the pdf to jpeg - nothing works - all emails i write after that go immediately to the outbox - so when i want to send messages at all i need to delete the ones with the attachment or send the other ones manually
Please notice in the activity window there is a lot of traffic :-) but it doesn`t help
i even closed all other programmes like excel,safari and stuff - but still
and i still have al lot of free GB on my airbook....
any idea???? -
TS3899 Cannot send email with new iPad air. Works fine with old iPad and iPhone.
Cannot send email with new iPad air. Works fine with old iPad and iPhone. I have deleted account and reinstalled.
Thanks. I got the problem fixed. Spent time with the Apple folks and was kicked up to a senior advisor. It seems the problem was with my internet provider - Tmie Warner. Remember I could use the old ipad and the iphone to send mail. I checked all the specifics between the three units. It seems that TW is changing over from the RR.com to TWC.com. Since the new ipad air was just set up, it fell under the new TWC mail specifics.
-
How do I use my iPhone's hot spot to send email with Mail ?
Hi,
My land line is dead ... so no phone nor internet at home. But I can use my iPhone'hot spot to get on the web from my iMac. Great ... it works !
Oups ! I cannot send email from my computer using my iPhone's hot spot with Mail.
How do I do that ?
Regards.
Robert LespéranceHi Templeton Peck,
Thanks for droping in my thread ...
Doesn't the fact that I can surf the web with my iPhone's hot spot and that I cannot use Mail normally has I normally do give you a clue what the problem could be ?
What other information can I give you other than normally I can surf and send email with my regular ISP. Now that my ISP is dead I am using my iPhone's hotspot to surf the web awaiting that my ISP's connoection returns. Surfing is OK but I cannot send emails with through Mail.
When I want to send an email from my computer, I get a message asking me to select the the SMTP server. Then I select my usual ISP server, but the message comes back telling me it does not work.
Is there any other configuration to do ? -
I'm not able to send emails with mail.ru. Receiving is not a problem. Creating a mail is also not a problem and the mail will be stored at mail.ru as still to be send, only problem is its not possible to send. I noticed the buttons for sending change colour when used but they don't perform. What it is?
Don't know what changed, but all of a sudden able to send emails by mail.ru ...... sorry for bothering.
-
I have 2 email accounts, the second i only just recently added, i was able to send an email from this account after i added the account but am not able to send anymore emails. It says "unable to send email with selected server" there are no other servers to choose from. please help! TIA
Hi apmichael,
If you are having issues sending email from one of your mail accounts on your iPhone, you may find the following article helpful:
iOS: Troubleshooting Mail
http://support.apple.com/kb/ts3899
Regards,
- Brenden -
I have Windows 7, Microsoft Outlook and PSE 13. I have used the "Share photos as embedded images" feature frequently, but today when I went to use it, it wasn't there, only the option to send email with files attached. How do I get back the ability to send emails with photos embedded. I like adding the frames and backgrounds and I think it's easier for recipients to look at the photos. Thanks for any suggestions of things to try.
GailI had a similar problem in that my wife's iphone 5 could not send pics with imessage. Had to set the settings to default to SMS or whatever. After laboring many hours on the web I coincidentally was on the phone with the internet people to question my internet speed. They changed the router channel, which is something that I am capable of doing myself. After that, the pics go over imessage. My own Iphone didn't have the problem. We are both latest IOS 7.0.6.
-
Problems sending emails with iPhone 3G and outlook exchange
I have a problem sending email with exchange. Receiving and answering mail works fine and calender updates work fine. However when I initiate an email from the phone it syncs and ends up in the sent folder in the computer but never reaches the recipient. I have tried this many times with different recipients and phones. It only happens from my iphone and ipad. Any suggestions?
Any help much appreciatedThe iPhone you returned is still syncing against your server and locking out your account. Someone possibly has access to your mail data. I'd recommend having your Exchange Administrator install the Microsoft Exchange Server ActiveSync Web Administration Tool (http://www.microsoft.com/downloads/details.aspx?FamilyID=E6851D23-D145-4DBF-A2CC -E0B4C6301453&displaylang=en) and attempt to wipe/delete/block that other iPhone.
Message was edited by: ethanm -
Is there any problem to use multiple threads to send email with JavaMail
Dear all,
I am using JavaMail 1.3.2 to send emails with SMTP, it works very well for a long time.
But one day, I found that the email service hanged and I could never send email again until I restart the tomcat. I found that the reason was a deadlock had been created, the required resource for sending email had not been released.
I guess the error is due to multiple threads are sending email at the same time. I made a test to create seperate thread for sending each email. After few days, I found this deadlock happened again. So, my question is: Can I use JavaMail with multiple threads? If not, I may need to sychronized all the thread that using JavaMail. I would like to make sure this is the reason for causing the deadlock problem.
Here is part of my code for using JavaMail:
transport = session.getTransport("smtp");
transport.connect(email_host, smtp_user, smtp_pass);
message.saveChanges();
transport.sendMessage(message,message.getAllRecipients());
which is very standard call, and it worked well for a long time.
Here is part for my thread dump on tomcat:
(Thread-339)
- waiting to lock <0x5447c180> (a sun.nio.cs.StandardCharsets)
(Thread-342)
- locked <0x5447c180> (a sun.nio.cs.StandardCharsets)
It seems that these happened after call the method transport.sendMessage() or message.updateChanges()
, and the underlying implementation may require the JRE StandardCharsets object. But the object had been locked and never be released. So, the sendMessage() or updateChanges() can't be completed.
Please give me some helps if you have any idea about it.
Thanks very much!
SiriusNote that the Nightly build gets updated daily (and sometimes more than once in case of a respin) and it is always possible that something goes wrong and it doesn't work properly, so be prepared for issues if you decide to stay with the Nightly build and make sure to have the current release with its own profile installed as well in case of problems.
See also:
* http://kb.mozillazine.org/Testing_pre-release_versions
*http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
*http://kb.mozillazine.org/Shortcut_to_a_specific_profile
*http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox -
Sending emails with both body and attachment to multiple recipients
I have a requirement to send email with body and attachment to multiple recipients.
Body of the email is a standard text. It is a proxy-to-mail scenario.
Here is what I've done: (I'm using PI 7.11)
One mapping from Source to Target structure (format of the attachment text file)
Second mapping from Target Structure to Mail Package format.
In the second mapping I'm concatenating the output of first step into "Content" of the Mail Package.
"XIPAYLOAD" is the message protocol used.
The "Keep attachments" option in the Mail adapter allows only to send "Content" as attachment or as body of the email.
How to send an email with both content and text?
The other problem is even with using ASMA, I can't send email to multiple recipients. I can only do CC and TO for 1 person each - a total of 2. Although I can resolve this by creating mailing lists, it is better if this can be addressed in PI.
Thanks for any input you can provide!
Edited by: crazylad on Jan 18, 2012 3:39 PMThank you for your response Mikael.
For the first question, I was able to find the solution in the following blog:
XI Mail Adapter : Dynamically building attachment and message body content using a simple UDF
(I just needed to search with the right set of key words )
The key is to set the "Content Encoding" as "None" in the mail adapter. If this is not done, the mail will be sent with an attachment - untitled.bin containing both the mail body and the attachment text. Also, don't forget to check the "Keep Attachments" checkbox in the mail adapter.
Multiple recipients could be added by separating the email IDs with a Comma. I have used ASMA to set the recipients. -
XI Mail Adapter: sending emails with attachment with help of java mapping
Hi ,
On trying out the scenerio mentioned in the blog, using the java mapping provided
"XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
The scenerio works just fine.
But the payload as the content of the attachment is not getting generated in proper XML format.
I suppose it's because of the replace special characters code part..
Can anyone help me state the modification required in the code.
Thanks!
Regards,
Faria MithaniIt might be a codepage issue. Is your original payload UTF-8?
-
Sending email with 2 attachments in PDF Format
Hi,
I have 2 ALV Layouts, totally different in Structure.
Now I need to convert these 2 ALV layout to 2 different PDF files and send email with thses 2 attachments.
Can anyone provide me with sample report.
I tried searching for it but there is no clue for ALV report-> PDF -> email.
Thanks
MohanHello,
I doubt if you really searched before posting. You will find many posts indicating how to convert your report output be it ALV or classical into spool and then in to pdf. After you get the pdf binary format, its pretty much the same attaching those and sending E-mail
Vikranth
Maybe you are looking for
-
XML form in not getting displayed in the option while assigning
Hello Experts, I have created a XML form and now assigning it to a folder. While assigning Folder>new>forms> .. here I can see other forms but not the new one which I have recently created. Please let me know I can assign the newly created form to th
-
Problem after creating a module !!!
Hi Experts, I was trying to put my hands on EJB development and took the help of the paper "Step by step guide to develop a module for reading file name in a sender file adapter" by Krishnakumar Ramamoorthy. Now that everything was developed and depl
-
Help icon for inputListOfValues in a table
Hi, In our application, we have an inputListOfValues component inside a table. We are using JDev 11.1.1.4.0. We have a requirement to add online help to this component. However, even though the helpTopicID is specified, the icon is not shown anywhere
-
TS1988 unable to clear trash bin
i have deleted some music files but they still show in the trash,even after secure delete, i have checked and all the files are unlocked, they are not files that are incomplete but it still wont let me delete them, any clues as to how i might get ove
-
New iphone 5s wont connect to itunes store, new iphone 5s wont connect to itunes store
Hi everyone - I purchased a new iphone 5s yesterday and synced it to my itunes library with no issues. The software update was completed to ios 7.0.4 and everything seemed to be going ok! That was until I tried to access the itunes store via my pho