Skip to Content
avatar image
Former Member

Any possibility to implement a destructor in abap-objects

we have a class that when generated creates open a logger-handle via the normal SAP functions. If this class gets destroyed (i.e. if the session in this case is closed) there is no return to any calling point possible.

So what I would need here would be a destructor in which I could close the log-handle again and this way exit with all things done in an orderly way.

Dumb thing is couldnt find anything about destructors in AbapObjects - so fear they cant be dont? Or am I hopefully wrong on this?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Aug 11, 2004 at 07:10 AM

    thx for the answer but I think theres some misunderstanding...dont want a method from outside I can call to destroy my object (free)...I need a method (like the counterpart to a constructor) that gets automatically called WHEN the instance is destroyed (like the constructor is when the instance is created).

    As I said problem is, when the class gets destroyed I dont have the possibility outside of it to e.g. close the logger-handle.

    Add comment
    10|10000 characters needed characters exceeded

    • There are no real Destructors in ABAP Objects. You will see the C-Desctructor, but this can only make Kernel calls and is only released for internal SAP Development. For more details check out OSS Note 168703.

      Message was edited by: Thomas Jung

  • Aug 11, 2004 at 07:03 AM

    The destructor method is called "FREE" in ABAP OOP.

    You can have look at in some of the standard class for an example.

    Regards

    Raja

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 11, 2004 at 11:02 AM

    thank you - had found that about c-destructors too but thought perhaps there is some way to do it differently by now.

    Seems I'll have to implement a workaround for the application there then...due to another thread in BSP-forum I think even have some idea already about how it could be possible

    Add comment
    10|10000 characters needed characters exceeded