Hierarchial Structure with Child Parameter
I have a query like this
select child
from t
START WITH parent = 'DIV'
CONNECT BY PRIOR child= parent
when i give some parent value its fetching the entire structure from DIV parent.
i need to restric the rows to some specific leaf. i.e i need a additional parameter called child where i will child value so that it have return only the row from that parent to given child.I dont need other trees.
For eg DIV is parent for A, B ,C
A is parent for D,E
B is parent of F,G,H
C has no child.
If i give parameter DIV is parent and G has child i need only this hierarchy. this should return only two rows
A and G
Please let me know if i am not clear..
Pls Help
VInoth.
Maybe combining the two hierarchies:
SQL> with t as (
2 select 'A' child, 'DIV' parent from dual union all
3 select 'B' child, 'DIV' parent from dual union all
4 select 'C' child, 'DIV' parent from dual union all
5 select 'D' child, 'A' parent from dual union all
6 select 'E' child, 'A' parent from dual union all
7 select 'F' child, 'B' parent from dual union all
8 select 'G' child, 'B' parent from dual union all
9 select 'H' child, 'B' parent from dual
10 )
11 select t1.child, t2.lev
12 from (select child from t CONNECT BY prior parent=child start with child='G') t1,
13 (select child, level lev from t CONNECT BY prior child=parent start with parent='DIV') t2
14 where t1.child=t2.child;
CHILD LEV
B 1
G 2you can add a condition on LEV that is the level in the top-down hierarchy...
But I think this could be slow...
Max
Similar Messages
-
Hierarchy structure with temporal hierarchy join
Hi guys,
For characteristic Cost Element, Im using a time dependant hierarchy structure with temporal hierarchy join. In the query, Im selecting select hierarchy and From data, derivation.
If the hierarchy is created in SAP BI or if the hierarchy is imported from Excel, query is working properly.
If the hierarchy is imported from SAP ECC, the query giving me an error:
ABEND BRAIN (336): Hierarchy "xx" from characteristic 0COSTELMNT can be used here
Someone can tell me if its normal or if there is a way in order to correct this problem.
Thanks in advance,
RubéHi guys,
For characteristic Cost Element, Im using a time dependant hierarchy structure with temporal hierarchy join. In the query, Im selecting select hierarchy and From data, derivation.
If the hierarchy is created in SAP BI or if the hierarchy is imported from Excel, query is working properly.
If the hierarchy is imported from SAP ECC, the query giving me an error:
ABEND BRAIN (336): Hierarchy "xx" from characteristic 0COSTELMNT can be used here
Someone can tell me if its normal or if there is a way in order to correct this problem.
Thanks in advance,
Rubé -
Start with Connect by: Showing the whole hierarchy even if child parameter
11g
Hi There,
In our case the manager_id i= employee_id for the top level manager. So when I run the sql, it eliminates the top level manager and shows the output for the next level onwards.
For the regular start with connect by option on the employee table the query used is
select case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status,
level,
First_name as title,
NULL as icon,
EMPloyee_id as value,
First_name as tooltip,
NULL as link
from EMPLOYEES
start with Manager_id is null
connect by prior EMPLOYEE_ID = Manager_id
order siblings by First_namenow this will show the hierarchy and level starting with managers. Now if we provide the "start with Manager_id = 171" then since 171 is not a manager no rows are returned. So for this we can use something like
start with manager_id =171 or employee_id = 171However, the output would be only the employee record since 171 is the last child.
The requirement we had was that, Irrespective of the value entered, whether ultimate parent or ultimate child the output should still show the top down hierarchy. starting with that persons ultimate manager.
So for example if there are two employees, 170 and 171 and 170 is the manager of 171
If in this query I use Start with manager = 170. It will show me the manager and the child records.
However, if I use start with manager = 171 or employee_id = 171 then it will only show me only the child record. I want it to show me both the manager and employee records. i.e all the levels
I hope that make sense!
Thanks,
Ryan
Edited by: ryansun on Dec 12, 2012 1:13 AM
Edited by: ryansun on Dec 13, 2012 1:59 AMHi Alberto,
I was using this query and the output is correct. Except for one thing, the nature of our data is such that the top most manager in this case has "Manager_Id" as null so we can use "start with Manager is null"
But in our case the manager id for the top most manager is the same as his employee id.
So If I modify the query, it then does not show the "top most managers record"
WITH entire_tree AS
SELECT *
FROM employees
START WITH manager_id = 171
CONNECT BY PRIOR employee_id = manager_id
UNION
SELECT *
FROM employees
START WITH employee_id = 171
CONNECT BY employee_id = PRIOR manager_id
SELECT CASE WHEN CONNECT_BY_ISLEAF = 1 THEN 0 WHEN LEVEL = 1 THEN 1 ELSE -1 END AS status
, LEVEL
, first_name AS title
, NULL AS icon
, employee_id AS VALUE
, first_name AS tooltip
, NULL AS link
FROM entire_tree
START WITH manager_id = 100
CONNECT BY PRIOR employee_id = manager_id
ORDER SIBLINGS BY first_name;the only change I made is from
Start with manager_id is null
to
start with manager_id = 100Basically, in this case the manager_id of the top most manager is the same as his employee id. So how can we have that condition incorporated instead of checking for null.
Thanks,
Ryan -
How to use File Adapter with hierarchial Structure?
Hi,
How to use File Adapter with hierarchial Structure like..
Data:
--Header Details:
Line Item Details:
Data
Bcoz I am getting a Flatfile in a hierarchial way as shown below.
Header Details :1
Line Item a
Line Item b
Header Details :2
Line Item c
Line Item d
KishoreHey Kishore,
In order to create a structure you need to use the file with convertion mode on the sending communication channel of the file adapter.
check the link for the needed configuration paramters.
If the structure is more complexed you can use the Contetnt master(CM) from itemfield which allows to ceate XML file from complex flat files and more.
<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm">File sender adapter</a>
If you have any question i'll be more than happy to assist.
Nimrod Gisis -
Create SAP RFC iView with a structure as import parameter
Hello All,
I'm creating a SAP RFC iView from Portal SAP 7.4.
I try call a RFC that have as import parameter a structure with various fields, but the portal recognizes the structure as string field, then I cannot fill the fields values, and when I do a preview the iview, the following error occurs:
Function execution failed. Exception message: class java.lang.String:null incompatible with class com.sapportals.connectors.SAPCFConnector.execution.structures.RecordWrapper:sap.com/[email protected]MultiParentClassLoader@80d4ed6@alive
And only is possible select a output object.
Exists any way of receive a structure or a table as import parameter?, and as output parameters more of a element?
Thanks for your collaboration.Hello All,
I'm creating a SAP RFC iView from Portal SAP 7.4.
I try call a RFC that have as import parameter a structure with various fields, but the portal recognizes the structure as string field, then I cannot fill the fields values, and when I do a preview the iview, the following error occurs:
Function execution failed. Exception message: class java.lang.String:null incompatible with class com.sapportals.connectors.SAPCFConnector.execution.structures.RecordWrapper:sap.com/[email protected]MultiParentClassLoader@80d4ed6@alive
And only is possible select a output object.
Exists any way of receive a structure or a table as import parameter?, and as output parameters more of a element?
Thanks for your collaboration. -
Drilldown on structure with hierarchy display shows additional result rows
Hi all,
difficult problem to explain, but I'll try:
- a structure for the rows axis
- the structure contains hierarchical elements
- each leaf node in the structure is defined as a characteristic C, restricted to certain values from a hierarchy
- additionally characteristic C is on the rows axis below the hierarchy (for detailed drilldown)
- for the row axis, "display as hierarchy" is selected (initial drilldown until structure only)
- on the columns some key figures
- zero suppression set to active for rows
So in Query Designer it looks like this:
1) Structure S
---> Subnode S1
> Element 1 (Characteristic C restricted to value V1 and V2 from hierarchy H)
---> Subnode S2
> Element 2 (Characteristic C restricted to value V3 and V4 from hierarchy H)
2) Characteristic C
Now what happens at runtime:
1. The user opens Subnode S1 and sees 1 row with cumulated values for V1 and V2
2. The user drills down further to Characteristic C
3. He sees 2 result rows below "Element 1": row 1 with value V1, row 2 with value V2
All fine.
4. Now the user opens subnode S2 and drills down to Characteristic C.
5. => The user gets 4 result rows for "Element 2":
- one row with value V3 (as expected)
- one row with value V4 (as expected)
- one row with V1 and empty values (empty values OK, but complete row not expected!)
- one row with V2 and empty values (empty values OK, but complete row not expected!)
So, apparently the OLAP processor has some issues when mixing structures with restricted elements, hierarchies and drill downs
Note: this is exactly the same behaviour as the last poster in this thread noticed:
[Re: Adding Hierarchy to Structure|Re: Adding Hierarchy to Structure]
Does anyone know about workarounds / solutions?
Hendrik
Edited by: HMaeder on Feb 25, 2010 5:31 PMAdvice from SAP so far is to go to BI Frontend SP11, which should solve the problem.
Edited by: HMaeder on Mar 17, 2010 10:04 AM -
Structure with a string field as parameter in FM
Hi,
I have a requirement wherein based on some id which is the import paramter (table) i have to fetch some text of type string n pass as an export paramater. it has to be a table since for each id there wil a text associated with it.
For this i have declared a structure with two fields, one client and the other, the text type string.
While trying to activate my fm, it says that italicsthe structure should be a flat type. You cannot use internal tables. string, references etcitalics
Please provide a solution.
Regards,
herwin.Hi Vikranth,
ya using char or lchar would be one option and the other would be the use of the table type in the the import/export parameters. That worked without giving me that warning message and was able to execute my code properly with the desired output.
Regards,
Herwin.
Edited by: Herwin Wilmet Dsouza on May 11, 2010 12:18 PM -
Org unit Hierarchy structure between two Key date s
Hello Friends,
We have an issue with displaying HR Org unit hierarchy structure between two calendar months.
The BI Report has a selection parameter to select Org unit hierarchy , Calendar month From and Calendar month To
The BI Report is to display the no.of sick absence days for employees in a chosen Org unit hier.
Employee A had a sick absence of 5 days in the month 04.2011 in the Org unit X . The same employee had a sick absence of 4 days in 05.2011.The Org unit X then delimit in 05.2011 , the Org unit X is no longer in Org structure from 05.2011.
When we run the report for 04.2011 to 04.2011 , the employee A is showing absence under Correct Org unit ie X with correct Org structure .
When we run the Report for 05.2011 to 05.2011 , the employee A is showing absence under hierarchy Org unit Not assigned which is OK .
But the issue is when we run the Report from 04.2011 to 05.2011 , The employee A absence days 9 (5 +4 ) showing under Not assigned Org unit hierarchy structure which is the latest Org unit .
When I deactivate the Org unit hierarchy and choose tech name of Org unit , It is showing correct Org unit key
But The user would like to see 5 days under org unit X and 4 days under Not assigned with Correct Org unit hier structure when we run the Report from 04.2011 to 05..2011 .
We have a user Exit variable for the Key date in the Bex Report which seems to be taking only one date at any time .
Is there any way to get the correct figures under Org unit hier structure where employee had absence in when we put range of calendar months on a selection screen ?
Any advice appreciated.
Thanks.Hi
Yes, we can display the same by using time dependent hierachy's i.e. your org is converted to time dependent so that respective employee shows with respective of time.
Regards
Jagadeesh.M -
Org unit Hierarchy structure at Key date
Hello Friends,
We have an issue with displaying HR Org unit hierarchy structure between two calendar months.
The BI Report has a selection parameter to select Org unit hierarchy , Calendar month From and Calendar month To
The BI Report is to display the no.of sick absence days for employees in a chosen Org unit hier.
Employee A had a sick absence of 5 days in the month 04.2011 in the Org unit X . The same employee had a sick absence of 4 days in 05.2011.The Org unit X then delimit in 05.2011 , the Org unit X is no longer in Org structure from 05.2011.
When we run the report for 04.2011 to 04.2011 , the employee A is showing absence under Correct Org unit ie X with correct Org structure .
When we run the Report for 05.2011 to 05.2011 , the employee A is showing absence under hierarchy Org unit Not assigned which is OK .
But the issue is when we run the Report from 04.2011 to 05.2011 , The employee A absence days 9 (5 +4 ) showing under Not assigned Org unit hierarchy structure which is the latest Org unit .
When I deactivate the Org unit hierarchy and choose tech name of Org unit , It is showing correct Org unit key
But The user would like to see 5 days under org unit X and 4 days under Not assigned with Correct Org unit hier structure when we run the Report from 04.2011 to 05..2011 .
We have a user Exit variable for the Key date in the Bex Report which seems to be taking only one date at any time .
Is there any way to get the correct figures under Org unit hier structure where employee had absence in when we put range of calendar months on a selection screen ?
Any advice appreciated.
Thanks.Hi,
You can try adding two more attributes to Org Unit as "Calender month from" and "Calender month to".
In these attributes maintain the validity period for the corresponding master data.
For example, in your case you can maintain the master data as:
Employee | Org Unit | Calender month from |Calender month to | sick absence
A | X | 4.2011| 4.2011 | 5 days
A | | 5.2011 | 05.2011 | 4 days
And in report use variables for Calender month from" and "Calender month to".
Hence, when user executes the report with selection as:
Calender month from" = 04.2011
"Calender month to" = 05.2011
The data will be read from master data based on these selections along with key date and report will show output as expected.
Employee | Org Unit | Calender month from |Calender month to | sick absence
A | X | 4.2011| 4.2011 | 5 days
A | | 5.2011 | 05.2011 | 4 days
Hope this works for you.
Regards,
Geetanjali -
How to pass a structure/array of structure as input parameter in a webservice
Hi Team,
I am trying to create a webservice in powerbuilder .net( pb 12.5.1) . As this webservice will be used by external world to access some of data on basis of some input paarameter.
So can i use array of structure as input parameter to a webservice ? If no, then how can i pass a result set ( mora then 1 row with more than one column)
as an argument to the webservice.
Regards
SubratI am assuming this is the same for .Net but in Classic you can create NVO's with Instance Variables and then reference them in the NVO that will be used as the parameter for the Public WebService.
WS NVO's:
Children
String Child[]
Customer
String FirstName
String LastName
String DOB
Children Children
Public Interface uses Customer
Calling Code Example:
integer rc, liNdx
string lsReturn
SoapConnection lSoapConnect
proxy_testing px_Testing
lSoapConnect = CREATE SoapConnection
if IsValid(lSoapConnect) then
TRY
rc = lSoapConnect.CreateInstance(px_Testing, 'proxy_testing')
CHOOSE CASE rc
CASE 100
lsReturn = "Invalid proxy name"
CASE 101
lsReturn = "Failed to create proxy"
CASE 0
Proxy_Customer lNewCustomer
lNewCustomer = CREATE Proxy_Customer
lNewCustomer.FirstName = 'Chris'
lNewCustomer.LastName = 'Craft'
lNewCustomer.DOB = 'Getting Older'
Proxy_Children lChildren
lChildren = CREATE Proxy_Children
lChildren.Child[1] = 'Madeline'
lChildren.Child[2] = 'Hayden'
lNewCustomer.Children = lChildren
lsReturn = px_Testing.NewCustomer(lNewCustomer)
CASE ELSE
lsReturn = "Unknown error (" + String(rc) + ")"
END CHOOSE
if rc <> 0 then MessageBox("Invocation Error", lsReturn, Exclamation!)
CATCH (RuntimeError rte)
rc = -1
MessageBox("Runtime Error", rte.text, Exclamation!)
END TRY
end if
Chris Craft -
Extract the hierarchy in Parent child format from HP
Hello,
I have a hierarchy within Accounts dimension which I need to move to the other application in the different environment. I donot want to move the whole dimension. I just need to move a hierarchy. Is there a way I can extract a hierarchy in Parent child format with properties and move the same in to the next one.
Thanks in advance for your help.
Cheers,
XXXHi,
Below code assumes that you have 2 alias tables and assymetric hierarchy (having 4 to 6 levels) in accounts and all level 0 accounts are 6 digits. If you wish to remove the second alias table from the code simply remove references to it (i.e. aliastbl_id=50030). You can customize the extract top level member by modifying this section: (select object_id from hsp_object where object_name='Total Expenditure')
This outputs the structure in a fixed columnar format having all levels in different columns.
Code:
select o1.object_name as LVL1, o1.object_name as LVL1_DESC_EN, al1.object_name as LVL1_DESC_AR,
o2.object_name as LVL2, o2.object_name as LVL2_DESC_EN, al2.object_name as LVL2_DESC_AR,
o3.object_name as LVL3, al3.object_name as LVL3_DESC_EN, alar3.object_name as LVL3_DESC_AR,
o4.object_name as LVL4, al4.object_name as LVL4_DESC_EN, alar4.object_name as LVL4_DESC_AR,
o5.object_name as LVL5, al5.object_name as LVL5_DESC_EN, alar5.object_name as LVL5_DESC_AR,
o6.object_name as LVL6, al6.object_name as LVL6_DESC_EN, alar6.object_name as LVL6_DESC_AR
from hsp_object o1
left outer join (select * from hsp_alias where aliastbl_id=50030) a1 on o1.object_id=a1.MEMBER_ID left outer join hsp_object al1 on a1.alias_id=al1.object_id
inner join hsp_object o2 on o1.object_id=o2.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=50030) a2 on o2.object_id=a2.MEMBER_ID left outer join hsp_object al2 on a2.alias_id=al2.object_id
inner join hsp_object o3 on o2.object_id=o3.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a3 on o3.object_id=a3.MEMBER_ID left outer join hsp_object al3 on a3.alias_id=al3.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar3 on o3.object_id=ar3.MEMBER_ID left outer join hsp_object alar3 on ar3.alias_id=alar3.object_id
inner join hsp_object o4 on o3.object_id=o4.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a4 on o4.object_id=a4.MEMBER_ID left outer join hsp_object al4 on a4.alias_id=al4.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar4 on o4.object_id=ar4.MEMBER_ID left outer join hsp_object alar4 on ar4.alias_id=alar4.object_id
inner join hsp_object o5 on o4.object_id=o5.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a5 on o5.object_id=a5.MEMBER_ID left outer join hsp_object al5 on a5.alias_id=al5.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar5 on o5.object_id=ar5.MEMBER_ID left outer join hsp_object alar5 on ar5.alias_id=alar5.object_id
inner join hsp_object o6 on o5.object_id=o6.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a6 on o6.object_id=a6.MEMBER_ID left outer join hsp_object al6 on a6.alias_id=al6.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar6 on o6.object_id=ar6.MEMBER_ID left outer join hsp_object alar6 on ar6.alias_id=alar6.object_id
where o1.object_id =(select object_id from hsp_object where object_name='Total Expenditure') and
LENGTH(o6.object_name)=6
union all
select o1.object_name as LVL1, o1.object_name as LVL1_DESC_EN, al1.object_name as LVL1_DESC_AR,
o2.object_name as LVL2, o2.object_name as LVL2_DESC_EN, al2.object_name as LVL2_DESC_AR,
o3.object_name as LVL3, al3.object_name as LVL3_DESC_EN, alar3.object_name as LVL3_DESC_AR,
o4.object_name as LVL4, al4.object_name as LVL4_DESC_EN, alar4.object_name as LVL4_DESC_AR,
o5.object_name as LVL5, al5.object_name as LVL5_DESC_EN, alar5.object_name as LVL5_DESC_AR,
o5.object_name as LVL6, al5.object_name as LVL6_DESC_EN, alar5.object_name as LVL6_DESC_AR
from hsp_object o1
left outer join (select * from hsp_alias where aliastbl_id=50030) a1 on o1.object_id=a1.MEMBER_ID left outer join hsp_object al1 on a1.alias_id=al1.object_id
inner join hsp_object o2 on o1.object_id=o2.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=50030) a2 on o2.object_id=a2.MEMBER_ID left outer join hsp_object al2 on a2.alias_id=al2.object_id
inner join hsp_object o3 on o2.object_id=o3.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a3 on o3.object_id=a3.MEMBER_ID left outer join hsp_object al3 on a3.alias_id=al3.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar3 on o3.object_id=ar3.MEMBER_ID left outer join hsp_object alar3 on ar3.alias_id=alar3.object_id
inner join hsp_object o4 on o3.object_id=o4.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a4 on o4.object_id=a4.MEMBER_ID left outer join hsp_object al4 on a4.alias_id=al4.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar4 on o4.object_id=ar4.MEMBER_ID left outer join hsp_object alar4 on ar4.alias_id=alar4.object_id
inner join hsp_object o5 on o4.object_id=o5.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a5 on o5.object_id=a5.MEMBER_ID left outer join hsp_object al5 on a5.alias_id=al5.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar5 on o5.object_id=ar5.MEMBER_ID left outer join hsp_object alar5 on ar5.alias_id=alar5.object_id
where o1.object_id =(select object_id from hsp_object where object_name='Total Expenditure') and
LENGTH(o5.object_name)=6
union all
select o1.object_name as LVL1, o1.object_name as LVL1_DESC_EN, al1.object_name as LVL1_DESC_AR,
o2.object_name as LVL2, o2.object_name as LVL2_DESC_EN, al2.object_name as LVL2_DESC_AR,
o3.object_name as LVL3, al3.object_name as LVL3_DESC_EN, alar3.object_name as LVL3_DESC_AR,
o4.object_name as LVL4, al4.object_name as LVL4_DESC_EN, alar4.object_name as LVL4_DESC_AR,
o4.object_name as LVL5, al4.object_name as LVL5_DESC_EN, alar4.object_name as LVL5_DESC_AR,
o4.object_name as LVL6, al4.object_name as LVL6_DESC_EN, alar4.object_name as LVL6_DESC_AR
from hsp_object o1
left outer join (select * from hsp_alias where aliastbl_id=50030) a1 on o1.object_id=a1.MEMBER_ID left outer join hsp_object al1 on a1.alias_id=al1.object_id
inner join hsp_object o2 on o1.object_id=o2.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=50030) a2 on o2.object_id=a2.MEMBER_ID left outer join hsp_object al2 on a2.alias_id=al2.object_id
inner join hsp_object o3 on o2.object_id=o3.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a3 on o3.object_id=a3.MEMBER_ID left outer join hsp_object al3 on a3.alias_id=al3.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar3 on o3.object_id=ar3.MEMBER_ID left outer join hsp_object alar3 on ar3.alias_id=alar3.object_id
inner join hsp_object o4 on o3.object_id=o4.Parent_ID
left outer join (select * from hsp_alias where aliastbl_id=14) a4 on o4.object_id=a4.MEMBER_ID left outer join hsp_object al4 on a4.alias_id=al4.object_id
left outer join (select * from hsp_alias where aliastbl_id=50030) ar4 on o4.object_id=ar4.MEMBER_ID left outer join hsp_object alar4 on ar4.alias_id=alar4.object_id
where o1.object_id =(select object_id from hsp_object where object_name='Total Expenditure') and
LENGTH(o4.object_name)=6
Cheers,
Alp -
Hi All,
I have one requirement at clent site where hierarchy structure changes i.e. parent child relation switches or changes from one level to another level. For example WBS element hierarchy stucture for project 101014 is:
101014--root
101014-1>101014-1-01>101014-1-01-02-->101014-1-01-02-01
after above hierarchy load to bw there are chances that hierarchy nodes change their positions.
i.e.above hierarchy node 101014-1-01 can be removed from parent(101014-1) and assigned to 101014-2.
In Next load Hierarchy need to realign/restructure according to new hierarchy tree from ECC system. Right now we are BW 7.30. Thanks for you help and gurantee of points.
Regards,
ReddyHi Gaurav,
Thanks for quick response, we are running process chain on daily basis which will trigger full load from ECC to BW. I thought the same but when I look below error message I think we need to some how delete hierarchy data and reload with restructed or realigned data. Please find below error details and once again thanks for your help.
Node ID 00001564 has not been included as a sibling node or as a child node
Message no. RH207
Diagnosis
The node with the ID 00001564 and the node name 101014-1-02-03 is not used as a child node (field CHILDID) or a sibling node (field NEXTID) by any node in the hierarchy. The node is also not a root node because the ID of the parent node 00001565 (field PARENTID) is not equal to 0. The node is therefore not linked into the hierarchy. Therefore the node is not connected to the hierarchy.
Procedure
This message is displayed in addition to message RH 242. The node is the root node of a subtree that is not connected to the hierarchy. For further details, see the long text for message RH 242.
4 of a total of 13,846 nodes are not included in the hierarchy
Message no. RH242
Diagnosis
The root nodes are the starting point for moving through the hierarchy. The content of the fields NEXTID and CHILDID is used to move from the current node to its sibling and child nodes.
4 out of a total of 13,846 nodes cannot be reached by moving through the hierarchy in this way. These 4 nodes are not connected to the hierarchy.
System Response
The hierarchy is not consistent and therefore cannot be activated.
Procedure
The cause of the problem is usually incorrect links to sibling nodes (field NEXTID) or child nodes (field CHILDID). An incorrect value often means that an entire subtree (consisting of several nodes) is not included in the hierarchy.
To simplify the search for incorrect links, the system identifies the nodes (from all the not connected nodes) that are not used as sibling nodes or as child nodes. These nodes are usually root nodes of subtrees that are not connected to the hierarchy. You can find these nodes in the RH 207 messages that follow.
Try to localize the problem by using the RH207 messages for help. If the hierarchy is loaded from an SAP source system, you can check whether the extracted data is correct by executing transaction RSA3 in the source system. If necessary, check if the data is modified with a user exit. If the hierarchy is loaded from a file, check the contents of this file. The problem might also be due to an error in the transfer rules or in the transformation.
Thanks
Reddy -
Hierarchy query with dynamic start condition
Hi,
I have a table that stores hierarchical items (foohierarchy) and another one storing users and such items (useritems). Unfortunately the latter one is not consistent and misses some entries. I would like to fix that using pure sql. Fixing here means that a user that possesses a certain child element should also have parents of that child. There are a couple of obstacles here though. First the hierarchy table does not explicitly state which elements are top level elements. I am trying to fix that by emulating a proper structure and named that fixedhierarchy. A select statement that returns all intended user/item relationships would be nice.
Here some visualization and sample data, the sample data follows the pattern that each item uses its level as its suffix, but this shouldn't be exploited in the statement:
asci art:
-- A1 (peter,paul)
-- \_ B2
-- \_ C2
-- \_D3 (thomas)
-- \_X4
-- E1
-- \_F2
-- G1
-- \_H2 (heidi)sample data
drop table foohierarchy;
drop table useritems;
create table foohierarchy (
child_item varchar2(30),
parent_item varchar2(30));
insert into foohierarchy values ('B2','A1');
insert into foohierarchy values ('C2','A1');
insert into foohierarchy values ('D3','C2');
insert into foohierarchy values ('X4','D3');
insert into foohierarchy values ('F2','E1');
insert into foohierarchy values ('H2','G1');
create table useritems (
username varchar2 (40),
item varchar2(30)
insert into useritems values ('peter','A1');
insert into useritems values ('paul','A1');
insert into useritems values ('thomas','D3');
insert into useritems values ('heidi','H2');
commit;my attempt at fixing the hierarchy table
with fixedhierarchy as
(select parent_item,child_item from foohierarchy
union all
select distinct null parent_item,parent_item child_item from foohierarchy where parent_item not in (select child_item from foohierarchy))
select * from fixedhierarchy;What the select should return:
'peter'|'A1'
'paul'|'A1'
'thomas'|'A1'
'thomas'|'C2'
'thomas'|'D3'
'heidi'|'G1'
'heidi'|'H2'Hi,
Thanks for posting the CREATE TABLE and INSERT statments; that's very helpful! Don't forget to mention what version of Oracle you're using. That's especially important with hierachies; every version since Oracle 7 has had significant improvements in how to handle them.
I'm a little comfused as to what you want. Are you trying to permanently change the tables? If so, show what the changed table(s) should look like when the job is finished. Post the output you would want to see from "SELECT * FROM useritems;" or "SELECT * FROM foohierarchy;", or, if you want to change both tables, from both.
It looks like you have two separate problems:
(1) Changing foohierarchy, so that every item appears once as a child_id. That means adding rows with NULL parent_item for all the roots ('A1', 'E1' and 'G1'). The query you posted seems directed toward this.
(2) Denormalizing useritems, so that when a username is linked to an item, the username is linked to all that item's ancestors, too. The results you posted seem to be what you want useritems to look like after this is done.
Here's how to do those things:
<h4>(1) Changing foohierarchy</h4>
The query you posted looks good. Do you see anything wrong with it? You can use that query (or something very close to it) in an INSERT or MERGE statement.
If you just want to add some new rows to foohierarchy, then you don't need the UNION: just the second branch of it. If you're cvertain that none of those rows already exist in foohierarchy, then
INSERT INTO foohierarchy (parent_item, child_item)
SELECT DISTINCT NULL, childitem
FROM foohierarchy
WHERE parent_item NOT IN (
SELECT child_item
FROM foohierarchy
;If some of the roots might already be in foohierarchy correctly, then you'll want a something in the WHERE clause to make sure you don';t add a duplicate. A MERGE statment might do this better than INSERT.
<h4>(2) Denormalizing useritems</h4>
This adds new rows to useritems, to make it look like what you posted:
ERGE INTO useritems dst
USING (
WITH all_ancestors AS
SELECT CONNECT_BY_ROOT child_item AS descendant
, parent_item AS ancestor
FROM foohierarchy
START WITH child_item IN (
SELECT item
FROM useritems
CONNECT BY child_item = PRIOR parent_item
SELECT DISTINCT
u.username
, a.ancestor
FROM all_ancestors a
JOIN useritems u ON a.descendant = u.item
) src
ON ( src.username = dst.username
AND src.ancestor = dst.item
WHEN NOT MATCHED THEN
INSERT (dst.username, dst.item)
VALUES (src.username, src.ancestor)
;After doing this, "SELECT * FROM useritems;" will produce this output:
USERNAME ITEM
paul A1
peter A1
thomas A1
thomas C2
thomas D3
heidi G1
heidi H2Here's how it works:
Sub-query all_ancestors is a bottom-up CONNECT BY query, linking each node in useritems with all of its ancestors. CONNECT BY queries are often slow under the best circumstances; doing a join in a CONNECT BY query makes it even slower. It's more efficient to do the CONNECT BY query first, in a sub-query, and then join tht result set to other tables, as I did in src. -
Product : Errors in attribute hierarchy structure SAP BCA 000164
Hi All ,
When ever i create /Display /Change Product in
Financial Supply Chain Management --> In House Cash > Master Data>Product Definition--> Product --> Create /Change/Display
system through below mentioned error .
I tryed to resolve problem as per below mentioned program through se38 , but still getting same error
Errors in attribute hierarchy structure SAP BCA 000164
Message no. FIPR217
System Response
An error was found in the attribute hierarchy.
In some cases, it is not possible to display the attribute hierarchy without having to correct the errors first.
Procedure
It is recommended that you run the FIPR_CLEAN_ATTRIBUTES (by using transaction SE38). This report can recognize errors, and it attempts to correct them automatically.
Caution: This report can change your table entries permanently.
Once this report has run, you need to check the hierarchy structure, and make any necessary changes.
Regards
Prakash SharmaHi,
the realignment (KEND) does not change the line item tables (CE1***, CE2***), thats why they remain unchanged.
The line items in CE1**** can not be changed. If you really want to have new line items (with the new prod. hierarchy) try in test-client if the use of report RKECADL1 and the new transfer to CO-PA for the deleted line items (KE4S, KE4SFI,...) can help you (SAPNET-note 69370 for details).
CE2**** + SQL-error: As per now, I don't have an idea how to deal with that cases.
best regards, Christian -
Planning Hierarchy Maintenance with Gaps
Dear Experts,
Iam using flexible planning for sales plan. I am using flexible planning. I wanted to create planning hierarchy with Gaps. I mean at some levels I will not be having any data to enter. For eg. My first level is country and second level is region. I will not have region for some countries. So when I maintain the planning hierarchy I will not have any value at the region level for a country.
How can I achieve this. When I dont enter any value, system throws the error message, enter the values without gap.
Thanks in Advance
PrathibHI There,
SAP does not allow maintaining Plng Hier with gaps coz that breaks the planning chain. We had a similar situation & we made up "distinct" dummy values at that level & plugged them in.
The values need to be distinct for each level/segment/CVC (unique), else it'll mess up the planning. The aggregation/dis-aggregation would go for a toss, if the system finds a common value at one given level.
Bottom line, the Planning Hierarchy structure cannot converge at any intermediate level with a common value, it has to be a pyramid structure.
Good Luck
Maybe you are looking for
-
HT1386 itunes and my ipod no longer sync
When I now plug my ipod in it only charges and does not sync and Itunes does not open or find my ipod?
-
Error while creating an application in NWDS CE 7.1
Hi , I am unable to create applications and components for and webdynpro application in NWDS CE 7.1 . Its giving me the following error . Status ERROR Plugin : com.sap.ide.webdynpro.service.applicationmodeler code=0 Internal error Plugin name: We
-
Hello Experts! I have the previous generation MacBook Pro (bought in 2007 before the latest generation came out a year ago or so) and I need to replace the battery because my old one has been through about 600 charge cycles and it's definitely being
-
My messages are not showing
-
Hi I know there is a post about this already in the newsgroup but I think I need something different. I need a way to make my program completely invisible to my users basically have it running as a service. I can't for some reason remove the FP in th