Export SAP Reports to Excel File

I have a process that exports SAP reports to Excel. the export works fine. the issue is that SAP opens Excel after saving the file. I use the Kill Excel activity to close Excel. but Excel takes to long to close and I get a timeout. I’ve tried extending the timeout to 15 seconds, but this doesn’t help. It is not an option to change SAP settings to prevent Excel from opening.

When I run the process in attended mode, the issue almost never happens. But when I publish to Orchestrator and have a bot run the process, this issue happens every time. The bot runs on the same VM used when running in attended mode.

That leads me to two questions:

  1. is there a best practice for closing Excel after it has been opened by another process (like SAP).
  2. Is there a way to determine if there is a problem (e.g., performance) with robot/job that is run through Orchestrator.

I do not know what report/transaction you execute, but SAP usually leaves excel report open and asks user to save it, but when you confirm in SAP it was done report will be closed.
But whatever, you can use SAP Scripting/VBA to support this part of workflow, script will always wait for all actions (save, close) on report to be executed and there shouldn’t be timeout in UiPath on ‘Invoke VBA’ activity.

Additionaly set screenshot to be taken when you run on VM from Orchestrator, this will help you better understand what’s happening there.

Hi all.
I get the Timeout Exceptions on this activity and looking for a way to prevent it.

Hello all,

A workaround I came up with really just exploits an error message in Excel, but it gets the job done. When your bot goes to type in the file name, have it save the document as “file name.xls” rather than .xlsx. When Excel goes to open up, you’ll get an error that says the file format and extension don’t match and it asks if you want to open it anyway. Using an attach window activity and a click activity, have the bot select “no.” Then use another attach window to go back into SAP and do whatever it is you want to do next, even if all of the preceding steps were already nested in an attach window activity that links to SAP. Without the seemingly unnecessary attach window steps, you get the timeout issues described above.

When you go to actually use the excel exports, either rename the file to “.xlsx” or just click yes when the error message pops up. It should work just fine.

Hope this helps!