I recently had to configure a  backup and restore mechanism for an Infocube. The objective was to store one full copy of the source Infocube every day in a backup Infocube that was created as a copy of the source cube plus a “Backup Date” characteristic

To recover a backup in the main Infocube, a transformation from the backup Infocube to the source Infocubehas been setup. One would have to specify the date of the backup that he wishes to restore in the DTP filter of the restore transformation.

To make sure that only one date is entered in the Backup Date characteristic of the DTP filter. I used the following code to check the DTP Filter values in the start routine. The code is based on an example program to output the list of DTP Filters via an ABAP Program posted in SCN (http://scn.sap.com/thread/1150620) you can also download the program is SAPLINK format here.

There is another way to access DTP infomation in the startroutine that I could have used. That is to use the p_r_request object provided in the routine. I did not figure out how to do that when coding the routine, but I later found interesting info on the subject in the following post: http://www.insiderlearningnetwork.com/bics/blog/2010/11/23/how_to_get_selection_criteria_in_transformations_routines

*$*$ begin of routine – insert your code only below this line        *-*
… “insert your code here
*–  fill table “MONITOR” with values of structure “MONITOR_REC”
*-   to make monitor entries
… “to cancel the update process
*    raise exception type CX_RSROUT_ABORT.
“Block the execution if more that 1 value of IDATEBKP is found in the
“request.
*    data: a type c.
*    a = ‘A’.
*    while a = ‘A’.
*      a = ‘A’.
*    endwhile.

data:
l_lines                           type i,
l_t_seltab                        type MCH_T_SELECT,
l_r_rsbk_dtp                      type ref to cl_rsbk_dtp,
l_r_rsbc_filter                   type ref to cl_rsbc_filter,
l_r_rsbk_dtp_a                    type ref to cl_rsbk_dtp_a,
l_s_rsbk_select                   type rsbk_s_select,
l_v_logdpid                       type rslogdpid.

select single r~logdpid into l_v_logdpid
from rsreqdone as r
where r~rnr = request.

if sy-subrc <>  0.
monitor_rec-msgid = ‘RSAR’.
monitor_rec-msgty = ‘E’.
monitor_rec-msgno = ‘051’.
monitor_rec-msgv1 = ‘Error retrieving filter info for request: ‘.
monitor_rec-msgv2 = request.
append monitor_rec to MONITOR.

RAISE EXCEPTION type CX_RSROUT_ABORT.
ENDIF.

* Factory method to create DTP Object
l_r_rsbk_dtp = cl_rsbk_dtp=>factory( l_v_logdpid ).

* Get object reference to active version
l_r_rsbk_dtp_a ?= l_r_rsbk_dtp->get_obj_ref_objvers(
rs_c_objvers-active ).

* Get reference to DTP’s filter object
CALL METHOD l_r_rsbk_dtp_a->if_rsbk_dtp_display~get_obj_ref_filter
RECEIVING
r_r_filter = l_r_rsbc_filter.

* Check that only one backup date is selected
l_t_seltab = l_r_rsbc_filter->n_t_seltab.
delete l_t_seltab where field NE ‘/BIC/IDATEBKP’.
describe table l_t_seltab lines l_lines.
if l_lines <> ‘1’.
monitor_rec-msgid = ‘RSAR’.
monitor_rec-msgty = ‘E’.
monitor_rec-msgno = ‘051’.
monitor_rec-msgv1 =
‘DTP filter of IDATEBKP must be set to I/EQ/single date’.
append monitor_rec to MONITOR.
RAISE EXCEPTION type CX_RSROUT_ABORT.
endif.

loop at l_t_seltab into l_s_rsbk_select.
if l_s_rsbk_select-sign <> ‘I’
or l_s_rsbk_select-option <> ‘EQ’.
monitor_rec-msgid = ‘RSAR’.
monitor_rec-msgty = ‘E’.
monitor_rec-msgno = ‘051’.
monitor_rec-msgv1 =
‘DTP filter of IDATEBKP must be set to I/EQ/single date’.
append monitor_rec to MONITOR.
RAISE EXCEPTION type CX_RSROUT_ABORT.
endif.
endloop.

*$*$ end of routine – insert your code only before this line         *-*

Leave a Reply