OnLogoff 

This OLE event is fired when an SAP event is received with the End of Session flag turned on. Thus it will be fired both after the Logoff method is called, and after sending an event that results in logging off from the SAP system.