I’ve a scenario as follows:
Background:
I’ve a Parent class (let’s say ZCL_PARENT) and have 3 child classes (ZCL_CHILD1, ZCL_CHILD2, ZCL_CHILD3).
All the 3 child classes process different set of datasets from different DB Tables (Tab1, Tab2, Tab3).
I’ve 3 different programs (PROG-A1, PROG-B1, PROG-C1) to instantiate these individual child classes and they all call the parent class method ‘Execute’.
So, PROG-A1 runs the following code:
NEW zcl_child1( )->execute( ).
Similar for PROG-B1 and PROG-C1.
The implementation for ‘Execute’ method is centrally done in ZCL_PARENT and it calls the method ‘Prepare_Data’ that is implemented in each child class.
Method ‘Prepare_Data’ basically is about collecting all the data that the specific child class needs to gather from the corresponding Table. Data is returned as TYPE REF TO DATA.
Method ‘Execute’ then calls another method ‘Process_Data’ (implemented within ZCL_PARENT) passing in the data gathered from ‘Prepare_Data’:
...
process_data( prepare_data( ) ).
...
Method ‘Process_data’ has the following logic:
Data is received as –
IR_DATA TYPE REF TO DATA.
Logic:
FIELD-SYMBOLS: <lt_data> TYPE ANY TABLE.
ASSIGN ir_data->* TO <lt_data>.
IF <lt_data> is assigned.
"The field-symbol would be only be assigned if there's any data in the importing table
LOOP AT <lt_data> ASSIGNING FIELD-SYMBOL(<ls_data_record>).
"Serialize the key content
DATA(lv_key) = /ui2/cl_json=>serialize( data = <ls_data_record> ).
TRY.
"Create Unit
DATA(lo_bgrfc_unit) = cl_bgrfc_destination_inbound=>create( 'ZDESTINATION' )->create_trfc_unit( ).
CALL FUNCTION 'ZDATA_PROCESSOR'
IN BACKGROUND UNIT lo_bgrfc_unit
EXPORTING
iv_keys = lv_key.
COMMIT WORK.
ENDLOOP.
ENDIF.
So basically, the code above fires away tRFC units for each record of data.
And when the unit executes, it performs some logic in the FM ‘ZDATA_PROCESSOR’.
This entire process works fine and has been thoroughly tested.
The problem that I’m looking a solution for, is to track the execution state of these tRFC units once the programs have individually finished running. I basically want to track the status of the tRFC units for each program separately as there are other dependent programs (PROG-A2, PROG-B2, PROG-C2) (that are triggered separately from an orchestration process) that need this status to finish processing.
As all these units are loaded against the same bgRFC destination, I couldn’t find a way to tell these units apart for each program (PROG-A1, PROG-B1, PROG-C1).
As a BAU, the tRFCs should process fine but I’m interested in tracking the statuses of these for if any are in error and also for aforementioned for dependent programs.
I have been using qRFC units till now instead of tRFC units and tracking the qRFC units’ status is quite straightforward as I just have to check the queue names for processing status.
But I’ve been requested by my Basis team to look into the tRFC units solution instead as:
- It’ll improve performance of bgRFC processing.
- These units are not dependent on each other so a qRFC spawning isn’t relevant.
Any ideas and solutions are welcome.
Thanks