Ansicht
Dokumentation

BAPI_HIERA_CHANGESUBSTRUCTURE - Class Hierarchy BAPI: Change Hierarchy (Top Down)

BAPI_HIERA_CHANGESUBSTRUCTURE - Class Hierarchy BAPI: Change Hierarchy (Top Down)

Fill RESBD Structure from EBP Component Structure   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

This BAPI changes a class hierarchy whose root is the instance. The classes involved must all exist. You cannot assign values to the assignments, because this would lead to quantities of data that are too large.

Any assignment that does not exist yet is created. Any assignment that already exists is changed. Any assignment that exists, but is not in the table, is deleted.

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 to be changed is transferred in table 'SubtreeList'. This must contain correct entries for the fields 'ClassName' (class), 'ChildName' (subordinate class), 'Level' (hierarchy level), 'Link' (multiple classification indicator), and 'Status'. The fields 'RightName' and 'LeftName' are not relevant here, and the 'Description' field is ignored.

'ClassName' contains the class to which you want the class in 'ChildName' assigned. The classification status is specified in 'Status'. The hierarchy levels ('Level') can be anything you want, but we recommend that you assign level 1 to the instance, level 2 to its subordinate classes, and so on. The level of each class must be higher than the level of its superior classes. If multiple classification occurs, the 'Link' field must be set. When you assign the class to another superior class, this field contains the entry 'X'. The entries in the table can be in any sequence.

First, a consistency check is run on the structure. If errors are found, no changes are made, and the BAPI returns an error log. The check uses the following rules:

  1. The instance is the only class without a superior class.
  2. Each class used exists and is valid.
  3. Each assignment occurs only once (there is no other entry that has the same classes for 'ClassName' and 'ChildName').
  4. Each class in field 'ChildName' also occurs in field 'ClassName'. (The classes that have no subordinate classes have an entry with the 'ChildName' left blank.)
  5. Each class only occurs on one hierarchy level ('Level').
  6. The hierarchy level of each class is higher than the level of its superior class (the superior class without the 'Link' indicator).
  7. The hierarchy is not recursive. In other words, no class is assigned to itself (indirectly). This applies both to the structure to be changed and to all superior classes of the instance.
  8. Each class in field 'ChildName' has exactly one entry without the 'Link' indicator.

The results are logged in table Return. This table contains either only the error messages from the consistency check, or error/success messages for creating/changing/deleting the individual assignments. In the former case, each entry contains the information that is 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/changed/deleted" with the message type 'E' or 'S'. Before this message are detailed messages on causes of error, but the actual assignment is not identified.

Example

The instance is Class1.
This class 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 contents of the table are shown below (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

It is necessary to evaluate table 'Return' accurately, because this BAPI does not tend to return a 'true' or 'false' result. If you want to know what actually happened, you can also display the new hierarchy by using BAPI Class.GetSubstructure.

Large hierarchies slow down system performance a lot. If you only want to change a few assignments, use BAPI Class.ChangeSubclassAllocation or Class.DeleteSubclassAllocation for the individual assignments.

Caution
Each assignment that exists, but is not in the table, is deleted. If you do want this, you must transfer the entire substructure, including assignments that are not to be changed.

This BAPI does not change the database. To do this, BAPI BapiService.TransactionCommit must be called afterward.

Further information





Parameters

CHANGENUMBER
CLASSNUM
CLASSTYPE
KEYDATE
RETURN
SUBSTRUCLISTNEW

Exceptions

Function Group

CLBPH

ABAP Short Reference   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 5568 Date: 20240523 Time: 101738     sap01-206 ( 101 ms )