‎2009 Aug 27 12:56 PM
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
‎2009 Aug 27 7:45 PM
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.
‎2009 Aug 30 12:15 PM
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....
‎2009 Aug 30 1:49 PM
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)
‎2009 Aug 30 2:43 PM
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
‎2009 Aug 30 5:30 PM
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).
‎2009 Sep 02 1:40 PM
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 ?
‎2009 Sep 02 2:39 PM
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.