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 retrieve parallel process task id (aRFC)

Former Member
0 Likes
2,176

Hi guys , I have a program that calls 2 RFC-enabled function modules and runs them in parallel. To my knowledge, each function modules is assigned with a unique task id when performing parallel processing.

My question is, how do I retrieve the information on the individual process such as task name and its duration?

say

call function 'Z_XXX' starting new task 'A' performing 'Z_FUNC' on end of task.....

and

call function 'Z_XXX' starting new task 'B' performing 'Z_FUNC' on end of task .....

then execute these functions and let it runs for a while, then how do i retrieve the task name of each process programmatically (A and B)?

sorry I'm still pretty new when it comes to ABAP

somehow my previous question was removed along with replies

7 REPLIES 7
Read only

Former Member
0 Likes
1,614

Hello,

You can use following function module to get the id of transactional processing.


CALL FUNCTION 'ID_OF_BACKGROUNDTASK'
* EXPORTING
*   DEST          = ' '
* IMPORTING
*   TID           =  --> collect ID from this varaible
*   FNUM          =

and for reteriving status you can use:


CALL FUNCTION 'STATUS_OF_BACKGROUNDTASK'
  EXPORTING
    tid                 =
  tables
    errortab            =
* EXCEPTIONS
*   COMMUNICATION       = 1
*   RECORDED            = 2
*   ROLLBACK            = 3
*   OTHERS              = 4
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Hope this helps!

Thanks,

Augustin.

Read only

0 Likes
1,614

Thx and sorry for late the reply , I have tried the methods you provided and it seems to only work when I use 'IN BACKGROUND TASK' in conjunction with 'CALL FUNCTION' but not 'STARTING NEW TASK'

after some googling, I found that 'TH_DISPLAY_WORKPROCESS_LIST'' list down each individual process by username and its unique PID. If i can only somehow retrieve the task id from it's PID....

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,614

it's explained in the [abap help - call function in aRFC|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_STARTING.htm]

the name of the task is sent to the callback form (it's the only parameter)

Read only

0 Likes
1,614

hmm just noticed that, I think i'm going to have 3 aRFC functions, which one of them will monitor the status of the remaining aRFCs at 1s interval.

the monitoring function will check the task id and states of the 2 aRFCs by retrieving the task id and sy-subrc from the callback subroutines

Read only

0 Likes
1,614

it's very surprising to monitor RFCs by other RFCs, why do you use it like that, just to know?

To measure runtime, don't you want to do it with SE30 (for example)?

By the way, in your first post, you indicate that the task name "must be probably unique" (or something like that). In fact, the task name may be the same, it is used run function modules in a SAP RFC server in the same internal session and you must also use RECEIVE ... KEEPING TASK so that to work (FMs are executed one after the other asynchronously). Of course, if the tasks run independently, or if you execute the FMS on a non-SAP system, it makes no sense trying to execute them in the same task (i.e. same internal session).

Read only

0 Likes
1,614

oh sorry forgot to tell you that, the monitoring RFC will monitor the 2 aRFCs (doin random calculations and loops) by checking their stats(task id,runtime) from their callback routines and then update the report screen at 5s interval continuously.

I 'm doing this because I want to get familiar with abap parallel processing, even though this is not the main purpose of parallel aRFC.

is there any other way to auto-refresh report or dialog without resorting to parallel processing ?

Read only

0 Likes
1,614

Okay To auto-refresh, I only know aRFC + wait method. I think you don't need a 3rd "monitoring RFC", a dialog is sufficient, but maybe you've done it on purpose.