Child pages
  • Cleaning Authorizations that reference deleted hierarchies
Skip to end of metadata
Go to start of metadata

Purpose

To show how to correct Analysis Authorizations that have an invalid reference to a hierarchy that has been deleted,   This should not occur and is an inconsistancy.

Overview

The inconsistancy causes unusual warnings when editing authorizations or running queries. 

How to use Report

Execute the report ZRS_CLEAN_HIER_AUTH in SE38

Enter the Hierarchy name that you suspect is causing the problem.  This will be seen in the error when editing the authorization.

You have the option to check or delete,  delete will remove the entries in RSECHIE whereas check will simply report the inconsistancy.

We always recommend running in check mode first to be aware of what the incosistancy is.

 
Note: there is no F4 help as the hierarchy doesnt exist in the hierarchy tables.

Report

*&---------------------------------------------------------------------*

*& Report ZRS_CLEAN_HIER_AUTH

*& TITLE: To clean up authorizations that reference hierarchies that

*& have been deleted.

*&

*& CREATED ON: 05 Oct 2012

*&

*& CREATED BY: Brian Keenan

*&

*& DESCRIPTION: This first checks the authroizations that reference

*& a hierarchy, then checkes if these hierarchy exit, giving

*& the option to delete the reference or just check for

*& the inconsistancy.

*&---------------------------------------------------------------------

*REPORT ZRS_CLEAN_HIER_AUTH.

DATA: wa_sechier TYPE RSECHIE,

gt_sechier TYPE TABLE OF RSECHIE,

wa_RSHIEDIR TYPE RSHIEDIR,

gt_RSHIEDIR TYPE TABLE OF RSHIEDIR.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

PARAMETERS p_hier LIKE RSECHIE-TCTHIENM OBLIGATORY.

SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK para WITH FRAME TITLE text-001.

PARAMETERS:

Check RADIOBUTTON GROUP sel DEFAULT 'X',

Delete RADIOBUTTON GROUP sel.

SELECTION-SCREEN END OF BLOCK para.

START-OF-SELECTION.

*check if there are authorizations in table RSECHIE for this hierarchy

SELECT * from RSECHIE into TABLE gt_sechier where TCTHIENM = p_hier.

IF sy-subrc <> 0.

MESSAGE 'This hierararchy has no analysis authorizations' TYPE 'I'.

EXIT.

ENDIF.

LOOP AT gt_sechier into wa_sechier.

*check if the hierarchy exists in the hierarchy table

SELECT * from RSHIEDIR into TABLE gt_RSHIEDIR WHERE HIEID = wa_sechier-HIEID.

IF sy-subrc <> 0.

*Then no Hierarchy exists but the analysis authorizations reference this.

IF Delete = 'X'.

DELETE from RSECHIE WHERE HIEID = wa_sechier-HIEID.

WRITE: / wa_sechier-TCTHIENM,

'The invalid Hierachy analysis has been removed'.

ELSE.

WRITE: / wa_sechier-TCTHIENM,

'The analysis authorization contains an invalid refernence to a hierarchy that doesnt exist'.

ENDIF.

ELSE.

MESSAGE 'This Hierarchy and authorization are consistant' TYPE 'I'.

EXIT.

ENDIF.

ENDLOOP.

Related Content

Related Documents

Insert SAP Help links or other WIKI content

Related Notes

Insert links to any related notes/KBA that support your topic or are related

  • No labels