Vous êtes sur la page 1sur 8

Program to Activate the

Transformation & DTP

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 Transformation’s and DTP’s. 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: Arminder Singh


Company: Accenture
Created on: 04 November 2009

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.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 1
Program to Activate the Transformation & DTP

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

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 2
Program to Activate the Transformation & DTP

Overview
In SAP BI we have the choice of using various activation programs which are available as function modules,
programs or BAPI’s 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 DTP’s 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 ZTEST_ARMI_TRANS.

TYPES: t_tran TYPE rstran,


i_tran TYPE STANDARD TABLE OF t_tran.
DATA: 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 .

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 3
Program to Activate the Transformation & DTP

CATCH cx_rstran_already_exist .
CATCH cx_rstran_error_with_message .
ENDTRY.

CALL METHOD r_tran_maintain->check


EXPORTING
i_with_display = rs_c_true
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.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 4
Program to Activate the Transformation & DTP

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 = rs_c_objvers-modified
i_force_activation = rs_c_true
i_show_check_protocol = rs_c_false
i_with_cto = 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.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 5
Program to Activate the Transformation & DTP

Step by Step Guide


1. Log on to SAP and execute the transaction SE38.
2. Create a new program:

3. Enter the description in the following screen:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 6
Program to Activate the Transformation & DTP

4. Copy and paste the code in your program.


5. You can also maintain the text elements for the selection text P_ID:

6. Finally activate the program and click on execute.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 7
Program to Activate the Transformation & DTP

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 8

Vous aimerez peut-être aussi