Step by Step Approach To Delete and Recreate Secondary Indices in Process Chains
Step by Step Approach To Delete and Recreate Secondary Indices in Process Chains
Step by Step Approach To Delete and Recreate Secondary Indices in Process Chains
Applies to:
SAP BW 3.x & SAP BI Net Weaver 2004s. For more information, visit the Business Intelligence homepage.
Summary
This article explains the step by step approach to delete and recreate secondary indexes of DSO in the
process chains.
Author:
Vikram Srivastava
Author Bio
Vikram Srivastava is working as Technology Analyst with Infosys Technologies Limited. He has
got rich experience on various BW Implementation/Support Projects in both SAP BW 3.5 and SAP
BW 7.0.
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
Table of Contents
Scenario .............................................................................................................................................................. 3
Step by Step Approach ....................................................................................................................................... 3
Step 1: ............................................................................................................................................................. 3
Step 2: ............................................................................................................................................................. 3
Step 3: ............................................................................................................................................................. 4
Step 4: ............................................................................................................................................................. 4
Step 5: ............................................................................................................................................................. 7
Step 6: ............................................................................................................................................................. 7
Step 7: ............................................................................................................................................................. 7
Using the program .............................................................................................................................................. 8
Disclaimer and Liability Notice ............................................................................................................................ 9
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
Scenario
In this article we will understand the step by step approach to delete and recreate indexes of a DSO in
process chains and jobs. This becomes very useful and handy while trying to do a constant performance
improvement effort.
Step 2:
Enter the name of the program Z_DELETE_CREATE_INDEXES
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
Step 3:
Click on Create and specify the attributes as shown below and Click on Save
Below Screen appears:
Step 4:
Write the program as mentioned below:
*&---------------------------------------------------------------------*
*& Report Z_DELETE_CREATE_INDEXES
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT
Z_DELETE_CREATE_INDEXES.
TYPE-POOLS: rsdu.
data: ODSIndex
Function(3)
rc
current_schema
tabschema
table_name
Parameters: iODS(30)
iIdx(3)
iFunctn(6)
"DB utilities
type
type
like
type
type
type
rsdu_s_index,
c,
sy-subrc,
db6schema,
db6schema,
db6tabnam.
type c,
type c,
type c.
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
ODSIndex-indexname = iIdx.
ODSIndex-tabname
= iODS.
Function = iFunctn.
* Get the current DB schema
perform get_schema in program sdb1fdb6
changing current_schema.
* check existance of table
exec sql.
select tabschema from syscat.tables into :tabschema
where tabschema = :current_schema
and tabname = :ODSIndex-tabname
endexec.
if sy-subrc <> 0.
message id 'RSM' type 'E' number '799'
with 'Finding the table ' ODSIndex-tabname
' in the current schema,' current_schema.
endif.
case Function.
when 'DELETE'.
perform DropODSIndex using ODSIndex rc.
when 'CREATE'.
perform CreateODSIndex using ODSIndex rc.
table_name = ODSIndex-tabname.
perform CreateStatistics using table_name tabschema.
when others.
message id 'RSM' type 'E' number '799'
with 'Only CREATE (Create Index) and DELETE (Delete Index)'
' are valid for the Function'.
endcase.
message id 'RSM1' type 'S' number '799'
with Function ' successful'.
*&---------------------------------------------------------------------*
*&
Form DropODSIndex
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_ODSTABLENAME text
*
-->P_INDEXID text
*----------------------------------------------------------------------*
FORM DropODSIndex USING
P_ODSIndex type rsdu_s_index
P_RC.
CALL FUNCTION 'RSDU_DROP_INDEX'
EXPORTING
I_S_INDEX
= p_ODSIndex
IMPORTING
E_SUBRC
= p_rc
EXCEPTIONS
DROPPING_ERROR
= 1
OTHERS
= 3.
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
" DropODSIndex
*&---------------------------------------------------------------------*
*&
Form CreateODSIndex
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_ODSINDEX text
*
-->P_RC text
*----------------------------------------------------------------------*
FORM CreateODSIndex USING
P_ODSINDEX type rsdu_s_index
P_RC.
CALL FUNCTION 'DD_DATABASE_UTILITY'
EXPORTING
FCT
= 'CRE'
ID_NAME
= p_ODSIndex-indexname
OBJ_NAME
= p_ODSIndex-tabname
OBJ_TYPE
= 'INDX'
IMPORTING
SUBRC
= p_rc
EXCEPTIONS
UNEXPECTED_ERROR
= 1
UNSUPPORTED_FUNCTION
= 2
UNSUPPORTED_OBJ_TYPE
= 3
TABLE_IS_LOCKED_BY_TCNV
= 4
AUTHORITY_CHECK_FAILED
= 5
ABORT_FUNCTION
= 6
CONVERSION_ERROR
= 7
OTHERS
= 8.
.
IF SY-SUBRC <> 0 or p_rc <> 0.
message id 'RSM' type 'E' number '799'
with P_ODSIndex-tabname P_ODSIndex-indexname
' Failed to create ODS index with RC = ' sy-subrc.
ENDIF.
ENDFORM.
" CreateODSIndex
*&---------------------------------------------------------------------*
*&
Form CreateStatistics
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_TABLENAME text
*
-->P_TABSCHEMA text
*----------------------------------------------------------------------*
FORM CreateStatistics USING
P_TABLE_NAME
P_TABSCHEMA.
CALL FUNCTION 'DB6_PM_RUNSTATS_REORGCHK'
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
EXPORTING
TNAME
= p_table_name
TOWNER
= p_tabschema
DETAIL
= 'Y'
*
SUPPRESS_DBALOG
= 0
EXCEPTIONS
C_CALL_FAILED
= 1
INVALID_PARAMETER_SET
= 2
OTHERS
= 3.
.
IF SY-SUBRC <> 0.
message id 'RSM' type 'E' number '799'
with p_table_name
' Failed to create DB Statistics with RC = ' sy-subrc.
ENDIF.
ENDFORM.
" CreateStatistics
Step 5:
Save and Activate
Step 6:
Go to Text Elements and enter the description as shown below
(GotoText Elements Selection Texts)
Step 7:
Save and Activate. The program is ready.
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains
This program can now be used in process chains by creating the variants.
Step by Step Approach to Delete and Recreate Secondary Indices in Process Chains