Sometimes we may need to generate hierarchies manually, in that case if you know Node id and it’s Parent ID then we can generate hierarchies successfully. you can also add root node if our requirement demands. Please check below for the details :


Source : Any source with fields Node Id and Parent ID

Target : Info provider specific Info object with hierarchy option enabled.



Test Account.JPG


Please check below for the hierarchy which is already loaded using Node ID and Parent ID

Initial Screen.JPG

    Hierarchy Tot man.JPG

In the above generated hierarchy the node ALL is not coming from Source and we need this to be added to our hierarchy. Please check below code written in the BW Start Routine


DATA : WA_SOURCE_PACKAGE like LINE OF SOURCE_PACKAGE.

WA_SOURCE_PACKAGEID = ‘1’.
WA_SOURCE_PACKAGE
NAME = ‘ALL’.
WA_SOURCE_PACKAGE
CT_MGMT =.

APPEND WA_SOURCE_PACKAGE TO SOURCE_PACKAGE.


Note : Here assume CT_MGMT represents Parent Id for a management Hierarchy which is coming from source object.


In the above Start Routine code we have created a new record (node id) with parent as blank which represents Root Node ( ALL ).



Hierarchy header.JPG



      Hierarchy Structure.JPG


    

In the above screen shot we have a Field Level Routine for 0H_PARENTID which maps all child nodes to its respective parent node.

Please check below for the ABAP code :


IF SOURCE_FIELDSCT_MGMT is INITIAL AND SOURCE_FIELDSID NE ‘1’.

RESULT =‘1’.
else.
RESULT
= SOURCE_FIELDSCT_MGMT.
ENDIF.


Output :

Hierarchy Tot man.JPG

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply