Ansicht
Dokumentation
BAPI_HIERA_ADDSUBSTRUCTURE - Class Hierarchy BAPI: Create Hierarchy (Top Down)
General Material Data Vendor Master (General Section)This documentation is copyright by SAP AG.
Functionality
This BAPI creates a class hierarchy whose root is the instance. The classes involved must all exist. You cannot assign values to the assignments, because this would involve too much data.
The instance is defined by the class name ('ClassNum') and the class type ('ClassType'). You can also specify a date ('KeyDate') and a change number ('ChangeNumber').
The structure you create is transferred in table 'SubtreeList'. In this table, the fields 'ClassName' (class), 'ChildName' (subordinate class), 'Level' (hierarchy level), 'Link' (multiple classification indicator), and 'Status' must be filled correctly. The fields 'RightName' and 'LeftName' are irrelevant here, and the 'Description' field is ignored.
'ClassName' contains the class to which you want to assign the class in 'ChildName'. The classification status is specified in 'Status'. The hierarchy levels ('Level') can be anything you like, but we recommend assigning level 1 to the instance, level 2 to its immediate subordinate classes, and so on. In any case, the level of a class must always be higher than the level of its subordinate class. If multiple classification applies, the field 'Link' must be set. When a class is assigned to a second superior class, this field contains the entry 'X'. The sequence of entries in the table is irrelevant.
First, the structure is checked for consistency. If errors are found, nothing is created, and the BAPI just returns the error log. The following rules are checked:
- The instance is the only class without a superior class.
- Each class used exists and is valid.
- Each assignment is unique (no other entry has the same classes for 'ClassName' and 'ChildName').
- Each class in field 'ChildName' also occurs in field 'ClassName'. (Classes without subordinate classes have an entry with an empty 'ChildName' field.)
- A class is always on the same hierarchy level ('Level').
- The hierarchy level of each class is higher than the level of its superior class (the one without the 'Link' indicator).
- The hierarchy is not recursive - no class is (indirectly) assigned to itself. This rule applies to both the structure being created and all superior classes of the instance.
- Each class in field 'ChildName' has exactly one entry without the 'Link' indicator.
The results are logged in table RETURN. This contains either the error messages from the consistency check only, or the error/success messages from creating the individual assignments. In the former case, each entry contains the information required to identify the error. In the latter case, each assignment has the message "The assignment of class X to class Y was (not) created", with the appropriate message type "E" or "S". Before this message, there are detailed messages on the causes of errors, but without identifying which belongs to which assignment.
Example
The instance is Class1.
It is to contain subordinate classes Class2 and Class3. Class2 has subordinate
class Class4, which has subordinate class Class5. Class5 is also assigned to Class3. The table then looks as follows (not all fields are shown):
ClassName | ChildName | Level | Link |
---|---|---|---|
Class1 | Class2 | 1 | |
Class1 | Class3 | 1 | |
Class2 | Class4 | 2 | |
Class3 | Class5 | 2 | X |
Class4 | Class5 | 3 |
Notes
Ensure that you evalute table RETURN accurately, because this BAPI does not deliver a result that is either "correct" or "incorrect". If you want to know what has actually been created, you can use BAPI Class.GetSubstructure to display the hierarchy you have created.
Large hierarchies slow down system performance. If you only want to create one assignment, always use BAPI Class.CreateSubclassAllocation.
This BAPI does not change the database. To do this, call BAPI BapiService.TransactionCommit afterward.
Further information
Parameters
CHANGENUMBERCLASSNUM
CLASSTYPE
KEYDATE
RETURN
SUBSTRUCLIST
Exceptions
Function Group
CLBPHRFUMSV00 - Advance Return for Tax on Sales/Purchases ROGBILLS - Synchronize billing plans
This documentation is copyright by SAP AG.
Length: 5536 Date: 20240523 Time: 110438 sap01-206 ( 135 ms )