As mentioned earlier, MDR requires that the processing and presentation components of a report/program are separate. This section describes how the Transformation (Presentation) program is to be structured.
The Transformation program is its own stand-alone program with a different name to that of the Main program. The common component of the Transformation and Main program should be the data type(s) of the results. If you have defined your own data type to store the result sets, then either make sure they are defined in the Data Dictionary, or they have been defined in a common include file for use by both the Main and Transformation programs.
The Transformation program is designed to run every time that the user is to be presented with the end result data. This means it needs to first retrieve the results and then present them to the user. One of the major benefits of having the Transformation program separate to the Main program is that it can have its own select-options/parameters. This can be used to further restrict the “collated” data when it is presented.
An example transformation program is shown below:

*---------------------------------------------------------------------* 
* Sample Transformation Program
*---------------------------------------------------------------------* 
REPORT z_sample_mdr_transform_program. 

INCLUDE:  
  /btr/mdr_include. 

* Transformation run options
 mdr-begin-select_screen_trans.

START-OF-SELECTION. 

* Get the summary results   
 mdr_instance_result_get co_label_summary gt_summary_list[]. 

* Display the details to the user 
  PERFORM display_result USING gt_summary_list. 

The MDR statement mdr-begin-select_screen_trans must be used before the START-OF-SELECTION event. This allows the transformation program to be run separately from the run history and doing so will produce the options below the main part of the selection screen allowing the user to check their latest runs or select runs.

The next statement in the transformation program is mdr_instance_result_get. This statement will retrieve the “complete” result that was calculated in the Collation subroutine. The label that is passed is very important in that it identifies which result you are trying to retrieve since there may be more than one. The last parameter to the statement is the actual variable that you have defined and must be the exact type as what you have defined in the Collation subroutine when you saved the “complete” result.
Now that the complete result (or results) has been retrieved, you can display them to the user. It is up to you how you do this. In the example on the previous page, a subroutine has been defined that will perform whatever steps are required to display the data. This might involve using WRITE statements and outputting to the spool. In many cases, a better approach would be to use the ABAP List viewer and call the REUSE* function modules. There are no restrictions to the presentation possibilities.
An important feature of the Transformation program is that it can be interactive. Hence the AT USERCOMMAND and AT LINE-SELECTION events can be implemented, unlike a traditional batch report that would have the results stored in the spool. The Transformation program will be executed every time a user decides to view the results of an MDR program run.

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