Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to call a class instance from e.g. 10 different parallel processes?

Hello Gurus,

i have created a class instance in one abap Process/Mode and i want to access this instance from other parrallel jobs. I pass the instance and other values to the new created Dialog Jobs/Processes but i am losing the instance while the values are still there. The question is if that is possbile in ABAP - i tried with a SPA/GPA but the parameters are type text so the garbage collector erases my instance. Any ideas?

Regards,

Ioan Constantin.

replied

It depends what you are actually denoting as a process here. Do you mean separate external sessions?

In any case passing references via memory I think is not possible. This is like passing a handle for object which exists only in program's roll area. Once you terminate the program that handle would become empty. I think the only way is to flatten object (serialize it), and then pass it either to memory or store it under persistent form (i.e. as table record). Then in next "process" deflatten (deserialize) it.

This is more or less the same process which workflow uses. Every class which can "interact" with workflow must implement interface IF_WORKFLOW . In that you have to program yourself how the object will look like in persistent form, then how it will retrieve an object from this persistent form. This kind of action must be done as workflow runs asynchronously . One user creates workflow object then leaves the session (garbace collector flushes the memory so no more object exists there). After some time another user wants to access the same item (object). The only way to have this done is to restore it from persisten form and recreate.

Note!

Even the objects data are the same (attributes) there will be two separate instances in these processes, which you can't compare.

Regards

Marcin

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question