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: 
Read only

How to access Objects created across parallel sessions ?

1,581

Hi,

I have a scenario where i need to access the objects created in parallel sessions ( parallel processing implemented) in the main program.

since RFC FM does not allow Object references as export parameters, i am looking for another approach to access these objects created in parallel sessions .

Please suggest me ideas on how to implement this functionality .

Thanks in advance.

Cheers,

Ravi.

1 ACCEPTED SOLUTION
Read only

thalesvb
Active Contributor
1,202

Hello Ravi,

You can't access objects created in parallel sessions. But you can use serialization to create a replica instance on main session, passing its serialized data in RFC parameter.

Please refer to interface IF_SERIALIZABLE_OBJECT and it's class documentation about how to serialize, implemeting it on your class (tl;dr: CALL TRANSFORMATION).

3 REPLIES 3
Read only

thalesvb
Active Contributor
1,203

Hello Ravi,

You can't access objects created in parallel sessions. But you can use serialization to create a replica instance on main session, passing its serialized data in RFC parameter.

Please refer to interface IF_SERIALIZABLE_OBJECT and it's class documentation about how to serialize, implemeting it on your class (tl;dr: CALL TRANSFORMATION).

Read only

0 Likes
1,202

Hi Batista,

Thank you very much for your response.

I have worked on the idea that you have suggested and the issue is resolved.

i am amazed by the way that references an be accessed by call transformation logic, which put me in a universe of queries.:-)

how did it work? Are the references stored in the shared memory ?

it would be really great if you can share your knowledge on how it works. Also , a link to a documentation also helps ( referred to sap docu. it gave info only on the implementation) .

Thanks in advance.

Cheers,

Ravi.

Read only

thalesvb
Active Contributor
0 Likes
1,202

The call transformation simply "extracts" the object's attributes contents and put them in a xstring/string variable (the RESULT call's parameter). When you do the reverse transformation call, it reads this variable and restores the object state (attributes values) in a new instance. It isn't stored in shared memory, you are actually creating a new instance with same attributes contents. You can think the xstring/string variable as a file and the CALL TRANSFORMATION is doing a save/load operation.

I forgot to point some behaviors that it can lead:

  • Since you are using a object copy, any state change in parallel section object won't reflect in main session object (they are two distinct instances, yet have a same state at some point).
  • Nested object references can be a problem in this kind of programming if you have multiple application servers (I think the interface documentation mentions that, or it was on CALL TRANSFORMATION F1 help, can't remenber right now). If you can, just use objects without nested object references, or guarantee that all nested objects implement too the IF_SERIALIZABLE_OBJECT interface.

Unfortunately I can't point to a documentation better than this about serialization, yet it is too technical and less conceptual about how it works. Wikipedia's article give a brief explanation about it.