Fonction SAP BAPI_HIERA_REMOVESUBSTRUCTURE - Class Hierarchy BAPI: Delete Hierarchy (Top Down)

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
CHANGENUMBER BAPI1003_KEY-CHANGENUMBER C 12 X Change number
CHECKALLROOTS BAPI1003_KEY-FLAG C 1 X Read Multiple Classification
CLASSNUM BAPI1003_KEY-CLASSNUM C 18 Class
CLASSTYPE BAPI1003_KEY-CLASSTYPE C 3 Class type
KEYDATE BAPI1003_KEY-KEYDATE D 8 SY-DATUM X Valid-From Date

Paramètre Reférence Long. Facultatif Description
RETURN BAPIRET2 548 Return parameter

Functionality
This BAPI deletes all assignments in the substructure of the instance.You can use the 'CheckAllRoots' indicator to choose one of twoprocedures.
If the 'CheckAllRoots' indicator is set, deletion removes the entiresubstructure for the instance, without affecting other classes thathave part of the hierarchy as a substructure (see example).
If the 'CheckAllRoots' indicator is not set (default), all assignmentsin the structure are deleted. The deleted assignments are the sameassignments that BAPI Class.GetSubtree would have returned.
If there is no multiple classification, do not set the 'CheckAllRoots'indicator, because this slows down system performance. The deletionlogic is the same in both cases.
Table RETURN contains the log of the deletion transaction for eachindividual assignment in the substructure. If deletion was successful,the table contains a message of type "S", which says "The assignment of to was deleted". Otherwise, thereis a similar message of type "E", with further error messages.
The most common error when deleting a hierarchy occurs if values ofcharacteristics of the superior class have been assigned to asubordinate class or an object (such as a material). The BAPI checksthat values assigned in a subordinate class do not prevent deletion. Ifan error message is displayed, check whether values of inheritedcharacteristics are assigned to objects, and if they are, delete theassigned values.

Example
Class1 is the instance, with the following hierarchy:
Class2 is assigned to Class1
Class3 is assigned to Class2
Class3 is assigned to Class5
Class4 is assigned to Class3
1.) CheckAllRoots = ' '
The following assignments are deleted:
Class2 to Class1
Class3 to Class2
Class4 to Class3.
Before, Class4 was indirectly assigned to Class5. After, this is nolonger the case, because all assignments whose superior class is theinstance or has the instance as its superior class are deleted.
2.) CheckAllRoots = ' X'
The following assignments are deleted:
Class2 to Class1
Class3 to Class2.
The direct assignmnet of Class3 to Class5 and the indirect assignmentof Class4 to Class5 remain. However, not all assignments in thesubstructure are deleted - only those whose only superior class is theinstance or whose superior class is the instance itself.
This means that the hierarchy still contains the following assignments:
Class3 to Class5
Class4 to Class3
A second call of the BAPI for Class5 would delete these twoassignments, too. The end result after calling the BAPI for each rootis the same as for procedure 1.).

Notes
This BAPI is not for detaching a substructure: the substructure iscompletely dissolved. If you only want to detach the substructure, useBAPI Class.DeleteSubclass.
Only if table RETURN contains no messages of type "E" did the BAPI runsuccessfully. Otherwise, some of the assignments were deleted, butothers were not.
This BAPI does not change the database. To do this, call BAPIBapiService.TransactionCommit afterward.

Description
Change number

Description
Read multiple classification.
See BAPI documentation.

Default
No

Description
Class

Description
Class type

Description
Valid-from date

Default
System date

Description
Return parameters