After all the intervals of the program run have been processed, Diffuser calls a special subroutine to collate the interval results back together into a single result. Once collated, sets of results exist for the program run. The logic required to collate the interval results is often quite simple but will vary depending upon the nature of the report.
In order to develop your own collation routine, it is a simple matter of adding a new subroutine to the Main program. This subroutine must be called mdr_interval_collation. It has a single parameter passed to it, which is of type /BTR/TT_MDR_INTERVALS. This parameter contains the complete list of intervals and the associated result(s) that have been calculated for each interval in the interval processing subroutine.
It is the task of the Collation routine to loop through each interval and retrieve the result for that interval. It should then combine the data results of each interval together to form one large combined result. An example collation routine is shown below:

*---------------------------------------------------------------------* 
* FORM mdr_interval_collation 
*---------------------------------------------------------------------* 
* This form is called by once all intervals have been processed.      * 
* It can be used to collate the results of the intervals together.    *  
*---------------------------------------------------------------------* 
FORM mdr_interval_collation  
  USING xt_intervals TYPE /btr/tt_mdr_intervals. 
   DATA: 
    lv_interval   LIKE LINE OF xt_intervals,     
    lt_summary    LIKE gt_summary_list[],     
    lv_parameters TYPE ty_parameters. 

  REFRESH gt_summary_list. 

  LOOP AT xt_intervals INTO lv_interval. 
*   Get the summary results for this interval     
    mdr_interval_result_get lv_interval co_label_summary lt_summary[]. 

*   Accumulate in the collated summary    
    LOOP AT lt_summary INTO gt_summary_list. 
      COLLECT gt_summary_list.  
    ENDLOOP. 
  ENDLOOP.  

* Save the summary list for access by the transformation program.   
  mdr_instance_result_put co_label_summary gt_summary_list[].  
ENDFORM. 

As can be seen in the example code the steps of the collation routine are to:

  1. Loop through each interval passed into the subroutine
  2. For each interval, retrieve the results that have been calculated by the interval processing routine by using the statement mdr_interval_result_get
  3. For each result of the interval, combine the data into a “complete” result
  4. Store the “complete” result back into Diffuser using the statement mdr_instance_result_put

Let’s first look at the statement mdr_interval_result_get.

mdr_interval_result_get lv_interval co_label_summary lt_summary[]. 

The first parameter of this statement “lv_interval” is the interval detail that we are retrieving the data from; this is simply the appropriate row of the parameter xt_intervals.

The second parameter of this statement “co_label_summary” is a character string that represents the label of the data. This must be the label that was used to originally store the result during the interval processing.

The final parameter is the result variable itself “lt_summary[]”. This must have the same structure as was originally stored when the result was “put” during the interval processing routine using the statement mdr_interval_result_put. It is crucial that this data type is the same.

Once the Collation subroutine executes, the program will now have a single “complete” result (or results) for the entire interval set. This complete result is a combination of the results of each interval of work as though one job had executed the entire report.
With the processing component of your Diffuser program finished and the end result collated – the final step is to present this data to the user.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment