cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP scripting with Python: Handle unexpected error messages/pop up window

Former Member
0 Likes
1,809

Hello,I'm trying to read out data from diffrent transactions in SAP through the scripting function.I already did it successfully in VBA, now I want to do it with Python to run the scripts outside of the Microsoft Office environment.

I am new to Python and realised to handle errors is quite different than in VBA. For some processes I use the try and exception handling, there where I know how the code shall process after an error appeared.

But what if an unexpected error occurs? My problem is I want to continue with the Try block where the error occurs after I handle the error event in the exception block but I learnt in Python it is not possible. Something like On Error Resume Next doesn't exist. To wrap every code line in try exception block of the large script can't be the single solution.

Is there a possibilty when the main code interrupts, a second event shall be fired to handle the error and after that the main code shall continue?

Especially for my problem the main idea is an error/pop up window in SAP should be traced and closes by a second event while the main event is paused and continues when the first event finishes.

Thanks in advance.

View Entire Topic
Former Member
0 Likes

Hello,

thanks for your solution, to solve such problems in VB is not a big deal.

Quote: "...then pass it the session & then come back for the rest of the flow..."

That's the issue, I can't pass such functions in the session block because such popup can occurs anytime/anywhere, even if there are only finite places. To find the exact spots in every transaction makes it more complicated. Moreover to jump "back" to the rest of the code after handling an error in python is not possible (or till now I am not aware of it).