Ansicht
Dokumentation

BAPI_HIERA_GETSUBSTRUCTURE - Class Hierarchy BAPI: Read Hierarchy (Top Down)

BAPI_HIERA_GETSUBSTRUCTURE - Class Hierarchy BAPI: Read Hierarchy (Top Down)

TXBHW - Original Tax Base Amount in Local Currency   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This BAPI returns all classes that have the instance as a superior class, and the relationships of the classes to each other. Superior classes of classes in the hierarchy are excluded, unless they also have the instance as a superior class.

The instance is defined by fields 'ClassNum' and 'ClassType'. You can also transfer a date ('KeyDate'). You can use the 'HierarchyDepth' parameter to determine how many levels of the hierarchy are read. The default is to explode the entire hierarchy below the instance.

The hierarchy structure is in table 'SubstrucList'. This table contains the subordinate class of each class (the class is in field 'ClassName' and the subordinate class in field 'ChildName'). Field 'Level' contains the hierarchy level. The instance has level 1, and the level of each class is the level of its superior class plus 1. (If a class has more than one superior class, the level refers to the superior class whose entry has no 'Link' indicator.) If a class has more than one subordinate class, the entry is repeated for all fields except field 'ChildName', which contains a different subordinate class.

The 'Link' indicator is for multiple classification in the hierarchy, where one class has more than one superior classes immediately above it. Each of these superior classes has an entry, with the class that has multiple assignments in field 'ChildName'. However, all but one of these entries has the 'Link' indicator set.

The 'Status' field contains the status of the assignment of the class in field 'ChildName' to the class in field 'ClassName'.

If the class has no subordinate classes, table 'SubstrucList' contains exactly one entry for the instance, with the 'ChildName' field blank.

Example

Class1 is the instance. The entire hierarchy has the following structure:

Class1 is assigned to Class0
Class9 is assigned to Class0
Class10 is assigned to Class0
Class2 is assigned to Class1
Class3 is assigned to Class1
Class4 is assigned to Class1
Class4 is assigned to Class9
Class5 is assigned to Class2
Class6 is assigned to Class2
Class6 is assigned to Class3
Class7 is assigned to Class6
Class8 is assigned to Class6

Class0, Class9, and Class10 are outside the section of the hierarchy that is relevant, because they are neither directly nor indirectly assigned to the instance. Class1 is the root, Class9 is another root, due to multiple classification. Class6 is assigned to several classes in the hierarchy. Class4 is assigned to several classes outside the hierarchy. Class4, Class5, Class7, and Class8 are end nodes. This means that table 'SubstrucLis' is as follows:

ClassName Level Link ChildName
Class1 1   Class2
Class1 1   Class3
Class1 1   Class4
Class2 2   Class5
Class2 2   Class6
Class3 2 X Class6
Class4 2
Class5 3
Class6 3   Class7
Class6 3   Class8
Class7 4
Class8 4

Notes

The instance is the only root and has level 'Level' = 1.

If the 'HierarchyDepth' parameter is blank, exactly those classes that have no entry for 'ChildName' are end nodes of the hierarchy. If this parameter is set, the result may be a section of the hierarchy where end nodes have a class in the 'ChildName' field that does not occur in the 'ClassName' field of another entry. The processing logic can cope with this situation, but the original rule still applies to actual end nodes.

Multiple classification means that you can access all subordinate classes of a class, but not all their superior classes. Check for entries with 'ChildName' = class.

If a class is classified in multiple classes, the hierarchy level refers to the class that has the classified class as a subordinate class without the 'Link' indicator. This means that, for entries with a 'Link' indicator set, the level of the subordinate class need not be 1 higher than that of the superior class. You must take account of this when navigating.

The sequence of entries in table 'SubstrucLis' is not relevant.

Further information

This BAPI does not return characteristics or characteristic values for classes in the hierarchy. BAPI Class.GetDetailSubclass is available for this purpose.

If you are only looking for one hierarchy path between a superior class you know and a subordinate class you know, it is better to use BAPI Class.GetSuperstructure, with the subordinate class as the instance. This improves system performance considerably and returns far less superfluous information.





Parameters

CLASSNUM
CLASSTYPE
HIERARCHYDEPTH
KEYDATE
RETURN
SUBSTRUCLIST
WITH_DESCRIPTION

Exceptions

Function Group

CLBPH

CL_GUI_FRONTEND_SERVICES - Frontend Services   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.

Length: 7051 Date: 20240523 Time: 093835     sap01-206 ( 122 ms )