Sometimes you get programs where you might have done almost all the programming best practices and Indexing and other stuff but still the program will run very slow.On a time like this sometimes we might wonder is there a way to do parallel processing or something like multi treading on SAP.
Hmm.... There is only one way that I can think about in SAP and we can get most of the features on Parallel processing from this way.
You can define a remote function like bellow and start it in a new task.
CALL FUNCTION 'Fetch_Data'
STARTING NEW TASK 'Fetch'
performing RETURN_FROM_WAIT ON END OF TASK
EXPORTING
input = input
TABLES
output = output
EXCEPTIONS
COMMUNICATION_FAILURE = 1
SYSTEM_FAILURE = 2.
Important : You cant use any import parameters on the function. no this
method the only option is to using the RETURN_FROM_WAIT which is a
perform.
For Eg: When you want to fetch data parallel do it using 2 functions and using the perform you can have a flag to make sure that fetching is completed.
I got this detail document from Daniel Perecky link.
This has lots of information no how to program this way.
Apart from this I recently got demo program which has coded to work parallely
SPTA_PARA_DEMO_1
These are the few ways I have got to know no how to write parallel programming in SAP. I would like to see others findings on this area and would love to see how sucessful they were by using them.
Thanks
Nafran