cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming SessionEvents with SAP GUI Scripting API

Former Member
0 Kudos

Hi all

I try to work with the SAP GUI Scripting API. I manage to either connect to a running SAP Client instance or create a new one.

The _DsapfewseEvents events interface works fine - I can advise my Event handler and the CreateSession and DestroySession methods are called corretly.

But when I try to connect my ISapSessionEvents handler on a newly created session - no event handler methods will be called. The funny thing is that the Advise method works fine - my COM Event Handler is queried for all the interfaces that need to be implemented - but after the Advise finished - all references will be released again by SAP and therefore no method will be called.

What am I doing wrong? Do I need to call any special method or set any special property in order to consume the session events? Are there any SAP Server settings that I need to change?

Thanks in advance for any help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Solved the problem - here is the solution (for those that are interested!)

The CreateSession event passes an ISapSessionTarget* where one can advise the ISapSessionEvents event sink. If the reference count on the ISapSessionTarget is not increased - it won't work.

My theory: The ISapSessionTarget is a wrapper object that is just used by the scripting lib - if the client is not actually referncing the object - it will "die" and therefore all registered events will die as well.

have a nice day

Former Member
0 Kudos

Hi Andreas

This forum is more inclined towards third party software integration queries. I beleive you will recieve a appropriate response by posting in the web application server or abap discussion forums. thanks.

regards

Srini

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Andreas!

I would like to work with SAPGUI Scripting API.

When you execute it, do you execute from abap code or just configuration?

Please, tell me some tips.

Thanks,

Rogerio

Former Member
0 Kudos

Thanks for that suggestion!

I will try