cancel
Showing results for 
Search instead for 
Did you mean: 

Is there something available like a thread in BSP?

Former Member
0 Kudos

I have to process a large internal table out of several database tables. It is presented with a tableview.

Is it possible to interrupt processing the table and give the user the first let's say 20 records. In the meanwhile the server-process could continue filling the internal table.

The table is part of a model. Application is stateful.

thx for every hit

Erwin

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Interesting...

There is sort of a threading model in ABAP where you use ARFC (see the on-line help for CALL FUNCTION ... STARTING NEW TASK) to split some work off into another work process. This is generally used for parallel process, but the key is that the parent process actually goes into a wait state until the children report back with their results. This could still allow you to reduce your total processing time by several factors.

I think you are also going to run into the problem of the typical Browser Request/Response cycle. The server only processes requests, it can't just spawn independent responses to the frontend.

You could research AJAX. You could have a trigger on the client side to request (via XML calls) additional data for your table. However this would really have to happen outside the HTMLB interface. I would think you would have problems keeping the data in sync. I supose after the server sends back the first 20 records, you could trigger some JavaScript on the frontend to request the remaining data via XML. If you could get this call to work in the same session as your application, you could then populate the remaining data into the model. The response XML could come back (it wouldn't necessarily need to contain all the data) to the frontend and this could trigger some more javascript that in turn triggers a server event so that the table can be refreshed with the remaining data. All of this is fairly theoretical however (I'm not sure you could get the asynchronous XML call into the same session with access to the existing model). Also what happens if the user triggers a different server event while you are populating the rest of the internal table?

Former Member
0 Kudos

Thomas,

thx for your quick reply.

Im wondering what is the sense of the ARFC if the parent process goes in a wait state? Are your sure - otherwise i would investigate into that direction.

regards

Erwin

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

In order to receive the results from the spawned RFCs, the parent process via coding normally waits (using the wait until syntax). What you add to the original call is the CALLING meth} ON END OF TASK syntax. This allows the results to be passed back (since the two work processes wouldn't be sharing a context). The parent application still needs to be running to receive the results - hence the wait construct. Have a look at the help on WAIT UNTIL (which falls under CALL Function - STARTING NEW TASK).

Former Member
0 Kudos

Thomas,

i found now a interesting solution that meets my needs.

1. i process only a subset of records (depending on a parameter)

2. i start a asynchron task which processes the full set of records

3. the asynchron task writes the results into a server-side cookie

4. i inform the user - that there are results pending (create a refresh-button - disable sort in the tableview)

5. in the following events we check the cookie - if the cookie has the data we copy the data over our pre-processed data in our model.

best regards

Erwin

Answers (0)