If you want to retrieve the task count from an alternative (external) source, you need to implement an interface in a new class.
To create a new class implementation, proceed as follows:
In your SAP system, start transaction SE24.
In the Object Type field, enter the object name, for example, ZCL_IMPLEMENTATION.
Choose Create. The Object Type screen is displayed.
Select the Class radio button and press continue. The Create Class screen is displayed.
In the Description field, enter the relevant description for the class and choose Save. The Create Object Directory Entry screen is displayed.
Select the relevant package name and choose Save. The Class Builder: Change Class screen is displayed.
Select the Interfaces tab.
In the Interface field, enter /IWWRK/IF_TGW_SCENARIO.
Select the Methods tab.
Double-click the method displayed.
Enter the relevant code.
Choose Save and activate all the newly created objects.
The method interface consists of a list of tasks. The output consists of a list of tasks and their respective count. You must ensure that the relevant data (according to the input) is retrieved and assigned to the output.