How can I out put an Excel file as Email attachment in SAP CMC?
<p>I have been trying to schedule a report in SAP BO CMC. This report was initially written in Python and built into a .exe file. This .exe application runs to save the report into an .xlsx file in a local folder. 
I want to utilize the convenient scheduling functions in SAP BO CMC to send the report in Emails. I tried and created a "Local Program" in CMC and linked it to the .exe file, but you can easily imagine the problem I am faced with -- the application puts the file in the folder as usual but CMC won't be able to grab the Excel file generated. 
Is there a way to re-write the Python program a bit so that the output is not a file in some folder, <strong>but an object that CMC can get as an attachment to the Emails?</strong> 
I have been scheduling Crystal reports in CMC and this happens naturally. The Crystal output can be sent as an attachment to the Email. Wonder if the similar could happen for a .exe , and how? 
Kindly share your thoughts. Thank you very much!</p>

<p>P.S. Don't think it possible to re-write the report in Crystal though, as the data needs to be manipulated based on inputs from different data sources. That's where Python comes in to help. And I hope I don't need to write the program as to cover the Emailing stuff and schedule it in windows' scheduled tasks. Last option... This would be too inconvenient to maintain. We don't get access to the server easily. </p>

<p>It's kind of hack-ish, but it can be done.  Have the program (exe) write out the bytes of the Excel file to standard output.  Then configure the program object for email destination, and set the filename to a specific name (ex. "whatever.xlsx").</p>

<p>When emailing a program object, the attached file will contain the standard output/error of the program.  Generally this will just be text but it works for binary output as well.</p>

<p>As this is a hack, if the program generates any other text (such as error message) to standard out, it will be included in the .xlsx file, which will make the file invalid.  I'd suggest managing program errors such that they get logged to a file and NOT to standard out/error.</p>

<p>I've tested this with a <strong>Java</strong> program object; but an exe should work just as well.</p>

python excel email sap business-objects