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

Communication between multiple processes

sebastianNoe
Participant
0 Likes
653

Hi there!

I have once again a problem concerning paralel processing in ABAP.

The problem is that:

I want to write a programm which invokes a process that can recursive invoke another process and so on.

Let me try to picture it out:

-> means invokes

Main Program -> Thread1

Thread 1 -> Thread 2

Thread 2 -> Thread 3

Thread 2 -> Thread 4

Thread 4 -> Thread 5

Thread 5 -> Thread 6

As you can see I have several Threads invoking another Thread. The structure of Threads invoking each other will be dynamic. Now I face the following problem:

I want just a few threads to run at the same time (let's say for now 3) and there are dependencies between the Invoker and the invoked Thread (e.g. Thread 3 needs some information from Thread 2).

How can I let my Main Program know that all the data is ready? Does the WAIT UNTIL statement also applies for these nested threads?

How does Thread 5 e.g. know that there are already too much processes running and he has to wait?

Is there a possibility how I can queue these processes?

sth like:

Thread 1 - Thread 2 - Thread 3 - Thread 4 - Thread 5 - Thread 6

If prerequisites for Thread 3 are not fullfilled it would look like:

Thread 1 - Thread 2 - Thread 4 - Thread 5 - Thread 6

and so on...

The problem is the communication over the bounds of Threads. This dynamic structure is neccessary due to the large data amount that I have to handle. Due to restrictions I can only use a function group and a report. No database tables or stuff like that is allowed.

I hope I was able to point out my problem. If it was to unclear please let me know it, then I will try to specify it more.

Thank you in advance for your help.

Best Regards,

Sebastian

3 REPLIES 3
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
593

If your threads are dependent on each other you can try using qRFC wherein you can queue the function calls or try using call function in update task to define the dependency and then based on the no.of work processes available process the threads.

Read only

ThomasZloch
Active Contributor
0 Likes
593

To be honest I don't know if or how the global counters required for the WAIT UNTIL command would work in such a scenario. Please explain why you need the nested calls, why can the main program not call all the first level threads and the additional calls from #1 to #2 and so on could be done as normal calls inside the same work process? Passing information would be done via standard function module interfaces.

Thomas

P.S. I hope the formatting issue of these smaller posts will be fixed soon.

Read only

0 Likes
593

@ Sandeep: Thanks for your answer I am going to have a look at that

@ Thomas: These nested Calls would be useful because of the amount of data that has to be processed. Think about a Tree with over 200.000 entries. For each entry there is the requirement for Check if corresponding dataset is right, if necessary Adapt data and Update on the database.

The approach with the nested threads would check a single node, looks whether there are child nodes and if so starts a thread for processing the child nodes. These would check each child node and if neccessary starts another thread and so on. Child nodes can only be changed if parent change was successful so I have the dependency right here.

Yesterday I had another idea that should work:

My Main Programm first checks the root node and then the direct childs of the root node (1st hierarchy level). Then invokes a thread for each child node which has again child nodes and for which changes applied (2nd hierarchy level. Each thread 'returns' a list of nodes for which once again the main program should invoke another thread and so on. (This would build up a queue for processing within the Main Program)

It is a similar approach to the think with nested threads but the control structure is more clear and there is no nesting of threads neccessary.

Thanks and Best Regards,

Sebastian