on 11-04-2008 7:11 AM
Dear All,
Could you please give me some support about the following issue:
1. How to get the level number of the Hierarchy table if you know the record belong to Leaf 2 or Leaf 1.
Root (Level 0)
|______Leaf 1 (Level 1)
|_______Leaf 2 (Level 2)
Thanks and Regards,
Edited by: Zhiqiang Liu on Nov 4, 2008 8:11 AM
Hello Pavel Kolotey,
Could you please check my codes:
RetrieveHierAncestorsCommand cmd = new RetrieveHierAncestorsCommand(context);
cmd.setChildNode(channels[1].getId());
cmd.execute();
RecordResultSet set = cmd.getAncestors();
System.out.println("set.getCount():"+set.getCount());
// System.out results
channels[0].getId():R8
Error message:
java.lang.NullPointerException: The result definition is not an optional parameter.
at com.sap.mdm.data.commands.AbstractRetrieveLimitedRecordsCommand.execute(AbstractRetrieveLimitedRecordsCommand.java:128)
at com.sap.mdm.data.commands.RetrieveHierAncestorsCommand.execute(RetrieveHierAncestorsCommand.java:114)
at com.sap.xedm.apple.AppleHierarchy.SearchElement(AppleHierarchy.java:284)
at com.sap.xedm.apple.AppleHierarchy.main(AppleHierarchy.java:322)
Exception in thread "main"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Really, you also need to set result definition for ancestors records.
Try this way:
RetrieveHierAncestorsCommand cmd = new RetrieveHierAncestorsCommand(context);
cmd.setChildNode(channels[1].getId());
// Creating and setting empty result definition
final ResultDefinition rsd = new ResultDefinition(tableId); // TableId of the hierarchy table
cmd.setResultDefinition(rsd);
cmd.execute();
RecordResultSet set = cmd.getAncestors();
System.out.println("set.getCount():"+set.getCount());
It works well.
Thank you for your kind support.
Thanks and Regards
Zhiqiang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Pavel Kolotey,
I checked the API and found that only 4 methods of the Class RetrieveHierAncestorsCommand.
1. public RecordId getChildNode()
2. public void setChildNode(RecordId childNodeId)
3. public RecordResultSet getAncestors()
4. public void execute() throws CommandException
Could you please give me more solutions?
Edited by: Zhiqiang Liu on Nov 5, 2008 8:00 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Zhiqiang Liu.
Let's consider an example.
You have a RecordId of a hierarchy record in variable recordId, and you need to know level of this record in the hierarchy.
final RetrieveHierAncestorsCommand cmd = new RetrieveHierAncestorsCommand(...); // use suitable constructor
cmd.setChildNode(recordId);
cmd.execute(); // CommandException can occur here
final int level = cmd.getAncestors().getCount(); // the level you need to know
Hello, Zhiqiang Liu.
I think you can execute RetrieveHierAncestorsCommand on RecordId of your hierarchy record. The count of items in it's result set will be equal to record level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The version is MDM 5.5.63.60 SP06 Patch03 Hotfix02 - 32Bit.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Hierarchy
1) You can have lookup for main Table for Hierarchy.
2) You can maintain it ECC.
There are many ways to handle if you tell which version of SAP MDM you want to maintain
And what are other system according to that you can maintain Hierarchy .
Thanks
Satnam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.