Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve SAPGUI events with comtypes in Python

former_member741893
Discoverer
0 Kudos
563

Hi all,

I've been trying to get notified by events in SAP in python. For this I wanted to the comtypes module (I cannot use the win32com module). I can retreive the scripting engine of SAP as follows:


import comtypes.client

SapGui = comtypes.client.CoGetObject("SAPGUI").getScriptingEngine

Now I should be able to use comtypes.client.ShowEvents as follows:

comtypes.client.ShowEvents(SapGui)

Which would print out all events of the SapGui. However, I get the following error: "TypeError: cannot determine the source interface", which I am not sure on how to solve. How can I apply ShowEvents (or something similair) while still using comtypes?

Kind regards,

Falko

1 REPLY 1

former_member30
Product and Topic Expert
Product and Topic Expert
0 Kudos
406

Hi and welcome to the SAP Community!

Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).

Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.

Cheers,

Julia
SAP Community Moderator