01-04-2022 4:34 AM
Hi Friends,
Download function works successfully.
Currently OLE2 automation tool processing an excel file and attached from local system to outlook and sending customers and download file in local system as well.
Application Server function
No issue - A final data is placing in application server successfully
but find Issue to attach file in outlook: fails
The same OLE2 formatted file to be attached in outlook and to be sent customer without picking file from local system cause This function to run in background in this case we can’t pick file from local system.
01-04-2022 7:25 AM
Do you really need to automate Outlook? Don't you just want to create an email? (search email, attachment and BCS in the forum)
NB: when running ABAP in background, you can't access any user's laptop.
01-04-2022 9:27 AM
Hi Rossi,
Already an outlook attachment is working fine for download function.
but need separate outlook attachment which is same as download data and need to copy the same excel sheet from download function and to be attached and sent customer via outlook application.
1. A radio button works for presentation server and sending mail to customers in download function.,
2. Another radio button works for application server and mail to be sent customer.
Conclusion: To copy download excel file to another excel file and to attach in outlook. it shouldn't be local path when copying file.
01-04-2022 12:14 PM
There is a complete example that does just that.
It requires abap2xlsx but it could be adapted to work without that
01-04-2022 12:58 PM
So you can keep the OLE code which works in dialog, and create another solution without OLE stuff in background, right?
01-04-2022 1:26 PM
HI Rossi,
OLE2 code for downloading excel file in local system.
GET PROPERTY OF w_excel 'ActiveWorkbook' = w_workbook.
CALL METHOD OF
w_workbook
'SAVEAS'
EXPORTING
#1 = p_file.
Now i have to copy w_workbook to another excel to attach outlook.applicaiton cause which is formatted excel where it contains colors other stuff,
My program is going to run in background job in scheduling So which can not pick file from p_file or local system.
01-04-2022 2:26 PM
So you use OLE to tell Excel to create a workbook file. OLE can't run in background as I said. Instead, use abap2xlsx or a lightweight solution as Andrea mentioned.
01-04-2022 3:14 PM
you mean OLE can not run in background job which means it requires to create application outlook & excel from local system. am i correct?
01-04-2022 4:12 PM
I don't know what means "requires to create application outlook & excel from local system", but I guess you understood what I said.
01-05-2022 1:08 PM
Hi Rossi,
I already having an excel sheet data which is manipulated/formatted with colours & other stuff by OLE2 Concept and works for downloading in local system.
Now i require the same excel to copy and attach to send customers for other requirement before downloading in local system.
But my requirement has to run in background job to send mail with attachment to customers.
In this case, i can't use frontend to pick the same excel file.
i think below concepts works to convert ALV internal table data to excel sheet attachment in sending mail from the spool list.
It requires abap2xlsx but it could be adapted to work without that
01-05-2022 2:08 PM
Just to clarify, if you install abap2xlsx in your system, it takes 5 lines of code to generate a workbook with one worksheet containing "hello world", that you can then attach to an email.
Adding colors and so on is easy with abap2xlsx. Moreover abap2xlsx has a template feature which allows reusing an existing Excel workbook that you fill with data.