During the preparation of reports, it is often the case that various hierarchies are supposed to be displayed in one object. There are a number of possibilities in order to overcome such a challenge. Below, we are comparing two possibilities with their advantages and disadvantages.
Possibility 1: Switching of Hierarchies via Formula References
The first possibility is to retrieve multiple hierarchies in the background. They are switched via a formula reference in Display Hierarchy Object, depending on the filter or the authorization.
SETTING ( [OBJ22] ) = 1 ; [<HIERARCHY_1>] ;
SETTING ( [OBJ22] ) = 2 ; [<HIERARCHY_2>]
- The hierarchies may be filed in an individual expanded state (unbalanced hierarchy)
- After retrieving the hierarchy once, it is in the cache. The next retrieval of the hierarchy takes less time.
- The hierarchies store the last expanded state
- Each new hierarchy requires another hierarchy object and must be integrated into the formula. In case of many different hierarchies, this may quickly become confusing.
Possibility 2: Switching the Hierarchies via PLACEMETA DATA
The functions READMETADATA and PLACEMETADATA have already been described in a previous blog entry, thus, this article will only deal with a few adjustments in the query. The names of the hierarchies can be dragged into a column in the database window in order to provide a selection of hierarchies to the user.
Then, the metadata must first be read. Further, the display of the data should be enhanced as they are only displayed as keys. (In addition, a hierarchy is required as drag object for the drag & drop function).
The hierarchy menu may be populated with the selected hierarchy via the function PLACEMETADATA (see here).
- Many hierarchies can be retrieved with few objects via this function.
- New hierarchies only have to be added in the database column.
- The hierarchies are always opened in balanced state (set levels), an individual expanded state cannot be produced.
- Upon switching the hierarchy, the expanded state is lost unless it is manually restored (e.g. via a bookmark function)