Professional Documents
Culture Documents
Applies to:
SAP BI 7.0. For more information, visit the Business Intelligence homepage
Summary
This paper provides a code which can be used to activate inactive Transformations and DTPs. SAP has provided various programs for activating info-providers, transfer rules, etc but these two programs were missing from the standard set of programs. Author: Company: Arminder Singh Accenture
Author Bio
Arminder Singh is working as SAP BI Consultant in Accenture Services Private Ltd having extensive experience in implementation of SAP BI projects. His expertise includes SAP BI, ABAP and Business Objects.
Table of Contents
Overview ............................................................................................................................................................. 3 Code ............................................................................................................................................................... 3 Code to Activate Transformation: ................................................................................................................... 3 Code to Activate DTP:..................................................................................................................................... 4 Step by Step Guide............................................................................................................................................. 6 Disclaimer and Liability Notice ............................................................................................................................ 8
Overview
In SAP BI we have the choice of using various activation programs which are available as function modules, programs or BAPIs to activate inactive multiproviders, info-cubes, info-sets, transfer rules, etc. But for a long time everyone felt the need of having a program for activating the Transformations and DTPs which are not provided as a standard from SAP. This article provides the code to achieve the same and also a step by step guide to create a Z-program using transaction SE38.
Code
Code to Activate Transformation: REPORT TYPES: DATA:
ZTEST_ARMI_TRANS. t_tran TYPE rstran, i_tran TYPE STANDARD TABLE OF t_tran. r_tran_maintain TYPE REF TO cl_rstran_maintain, lv_subrc TYPE sy-subrc, lv_output(255) TYPE c, tab_tran TYPE i_tran, i_s_source TYPE rstran_s_tlogo, i_s_target TYPE rstran_s_tlogo.
SELECTION-SCREEN BEGIN OF BLOCK b1. SELECTION-SCREEN SKIP 1. PARAMETERS: p_id TYPE char35. SELECTION-SCREEN END OF BLOCK b1. START-OF-SELECTION.
FIELD-SYMBOLS: <fs_trans> TYPE t_tran. REFRESH tab_tran. SELECT * FROM rstran INTO TABLE tab_tran WHERE tranid = p_id AND objvers = 'A' AND objstat = 'INA'. SORT tab_tran. IF tab_tran IS NOT INITIAL. LOOP AT tab_tran ASSIGNING <fs_trans>. TRY. CREATE OBJECT r_tran_maintain EXPORTING
i_tranid = <fs_trans>-tranid i_s_source = i_s_source i_s_target = i_s_target i_expert = rs_c_false i_mode = rsawc_c_tfc-display i_with_message = rs_c_true. CATCH cx_rstran_not_found . CATCH cx_rstran_input_invalid . CATCH cx_rstran_cancelled . CATCH cx_rstran_not_authorized . CATCH cx_rstran_display_only .
IMPORTING
e_subrc = lv_subrc.
IF lv_subrc = 0. CONCATENATE 'Activated Transformation : ' <fs_trans>tranid ' : ' <fs_trans>-sourcename '->' <fs_trans>-targetname INTO lv_output. ELSE. CONCATENATE 'Transformation : ' <fs_trans>-tranid ' : ' <fs_trans>sourcename '->' <fs_trans>-targetname 'Could Not be Activated' INTO lv_output. ENDIF. IF lv_subrc = 0. TRY. CALL METHOD r_tran_maintain->execute EXPORTING
i_wrkmode = cl_rstran_stat=>wrkmode_activate
IMPORTING
e_subrc = lv_subrc.
CATCH cx_rstran_cancelled . CATCH cx_rstran_error_with_message . CATCH cx_rstran_display_only . ENDTRY. ENDIF. WRITE:/ lv_output. ENDLOOP. ELSE. WRITE:/ 'Transformation is not Inactive'. ENDIF. Code to Activate DTP: REPORT
ZTEST_ARMI_DTP.
TYPES: BEGIN OF t_dtp, dtp LIKE rsbkdtpstat-dtp, objstat LIKE rsbkdtpstat-objstat, src LIKE rsbkdtp-src, tgt LIKE rsbkdtp-tgt, END OF t_dtp. TYPES: i_dtp TYPE STANDARD TABLE OF t_dtp. DATA: lv_output(255) TYPE c, lv_subrc TYPE sysubrc, tab_dtp TYPE i_dtp, r_dtp TYPE REF TO cl_rsbk_dtp.
SELECTION-SCREEN BEGIN OF BLOCK b1. SELECTION-SCREEN SKIP 1. PARAMETERS: p_id TYPE char35. SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
FIELD-SYMBOLS: <fs_dtp> TYPE t_dtp. REFRESH tab_dtp. SELECT * FROM rsbkdtp AS a JOIN rsbkdtpstat AS b ON a~dtp = b~dtp INTO CORRESPONDING FIELDS OF TABLE tab_dtp WHERE a~dtp = p_id AND a~objvers = 'A' AND b~objstat = 'INA'. IF tab_dtp IS NOT INITIAL. LOOP AT tab_dtp ASSIGNING <fs_dtp>. CALL METHOD cl_rsbk_dtp=>factory EXPORTING
i_dtp = <fs_dtp>-dtp RECEIVING r_r_dtp = r_dtp. IF sy-subrc = 0. CALL METHOD r_dtp->activate
EXPORTING
i_objvers i_force_activation i_show_check_protocol i_with_cto = = = = rs_c_objvers-modified rs_c_true rs_c_false rs_c_true
IMPORTING
e_subrc = lv_subrc.
IF lv_subrc = 0. CONCATENATE 'Activated DTP : ' <fs_dtp>-dtp ' : ' <fs_dtp>-src '>' <fs_dtp>-tgt INTO lv_output. ELSE. CONCATENATE 'DTP : ' <fs_dtp>-dtp ' : ' <fs_dtp>-src '->' <fs_dtp>tgt ' Could Not be Activated' INTO lv_output. ENDIF. ENDIF. WRITE:/ lv_output. ENDLOOP. ELSE. WRITE:/ 'DTP is not Inactive'. ENDIF.
4. Copy and paste the code in your program. 5. You can also maintain the text elements for the selection text P_ID: