Parent child format

<p>Hi</p><p>        can anyoneplease tell me how to get metadata in parent child format <b><spanstyle=" text-decoration: underline;">from</span></b> essbase. Ineed the data from essbase cubes which are already build. we areusing version 6.5.4.2</p><p> </p><p>Thanks!!</p>

<p>Thanks forthe reply. i have some more questions.</p><p>       Is it a freeware ?where can I download it from. As per my knowledge My company doesnthave it.</p><p> </p><p>Thanks!!</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>

Similar Messages

  • Output as parent-child format

    Hi,
    I have this table REQ_DETAILS
    detail_id value_id parent
    282     125     281
    283     126     281
    284     119     (null)
    285     127     284
    286     128     284
    301     120     (null)
    341     1169     321
    303     130     301
    322     1168     321
    334     123     (null)
    335     129     301
    342     1170     321
    321     122     (null)
    361     1172     334
    362     1171     334
    363     119     (null)
    364     120     (null)
    365     1170     364
    281     118     (null)
    219     125     284
    The column PARENT refers to DETAIL_ID.
    and I've NUMTABLE of type INTEGER. (create or replace TYPE NUMTABLE AS TABLE OF INTEGER;)
    I'd like to write a function which takes detail_id's as input and returns the correct order of the input. (parent-child format)
    for example
    order_req_det (detId_in NUMTABLE) return NUMTABLE;
    order_req_det (219, 284, 285, 286, 282, 283, 281, 362, 334, 361)
    should return the below output.
    284
    219
    285
    286
    281
    282
    283
    334
    361
    362
    Any suggestions?
    Regards.

    Guys, not even a suggestion?
    SQL> desc numtable;
    numtable TABLE OF NUMBER(38)
    SQL> select * from test;
    DETAIL_ID   VALUE_ID     PARENT
           282        125        281
           283        126        281
           284        119
           285        127        284
           286        128        284
           301        120
           341       1169        321
           303        130        301
           322       1168        321
           334        123
           335        129        301
           342       1170        321
           321        122
           361       1172        334
           362       1171        334
           363        119
           364        120
           365       1170        364
           281        118
           219        125        284
    20 rows selected.
    SQL> declare
      2   vt1 numtable :=
      3        numtable(219, 284, 285, 286, 282, 283, 281, 362, 334, 361);
      4   vt2 numtable;
      5   vt3 numtable;
      6   vt4 numtable := numtable();
      7   --v2 number;
      8  begin
      9   select detail_id
    10   bulk collect into vt2
    11   from test
    12   where parent is null
    13   and detail_id in( select column_value
    14                     from table(vt1));
    15   for i in 1..vt2.count loop
    16    select detail_id
    17    bulk collect into vt3
    18    from test
    19    start with detail_id = vt2(i)
    20    connect by prior detail_id = parent
    21    order siblings by detail_id;
    22    vt4 := vt4 multiset union vt3;
    23   end loop;
    24   for i in 1..vt4.count loop
    25    dbms_output.put_line(vt4(i));
    26   end loop;
    27  end;
    28  /
    284
    219
    285
    286
    281
    282
    283
    334
    361
    362
    PL/SQL procedure successfully completed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Converting numeric level identifier into Parent/Child format to load.

    I am unable to receive meta data in parent child format from a ERP source system and need to load these into Planning through ODI. Each member is identified with a numeric level indicator. Is there any wasy to convert this into Parent/Child format using the level indicator?
    Thank you.

    If you are using oracle you could look into using the "Connect by prior" function.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • 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,
    XXX

    Hi,
    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

  • Financial Reporting - HFM and Parent/Child formatting

    I have a report that has many rows, each with the same logic: Children of Account(Inclusive).
    I would like to have the parent formatted differently than the children (ie lines to show that it is a subtotal). Is this possible?
    I can remove the inclusive part and then add an Auto Calculation Total to each row and then hardcode the Auto Calculation Heading, but am looking for a more dynamic approach.

    I use 2 rows to accomplish this.
    Children[Account] - this is not inclusive
    Sum([1])
    I use a Custom Heading for the summary row. This method allows you to put the sub total at the bottom and format as needed.

  • Hierarchy Parent Child Relation Storage

    Hello All,
                I need to display hier. info in parent-child format. Any ideas on how to store parent child relationship in an ODS....I can view this format in the infoobject display screen for hierarchy...but cannot get this format to display..
    EX: Parent - child1,2,3,4
          child1- child 1-1,1-2,...
          child2 - child 2-1,2-2...
    thanks

    Spanyal,
    You will have to write a program to store this information in an ODS object. You will have to use /BIC/h<IO> Table to read the data and update a custom table. You will have to do some basic checks like business content or not, plan version, time dependency etc in the entry screen and then the program can read the hierarchy table in the format you want.
    I am not aware of any simpler way to populate hierarchy data into an ods object in a meaningful fashion.
    -Saket

  • Flattened to Parent Child Hierarchy

    Hi,
    My client has a little different requirement from normal.
    We want to convert the flattened version of hierarchy to parent child format. Does anyone have any sql script or idea how we can achieve this quickly?
    Thanks in advance.

    http://www.rittmanmead.com/2007/06/21/obiee-data-modeling-tips-3-ragged-hierarchies/
    might be helpful.

  • Does essbase studio support Parent/Child build method

    Hi,
    I am trying to build essbase outline from Essbase studio where my source data is in Parent child format. Dimension hierarchies are not built correctly with this build method.. all members are appearing as siblings... could you please confirm if essbase studio does support Parent Child build method... so that i can try to fix the bugs at source if there are any. Thanks for your help in advance.
    Regards,
    Praveen

    HI John and Glenn,
    Thank you very much for your help. I have now built essbase outline with recursive hierarchies.
    I have total 11 dimensions and 1 fact table. During the cube schema built, chosen fact table column 'Amount' into measures/measure, 11 hierarchies into hierarchy section... and one dimension as "Account" dim from the 11 dims. The data load is failing with the below error:
    Failed to deploy Essbase cube.
    Caused by: Failed to load data into database: CurrrASO.
    Caused by: Cannot get async process state. Essbase Error(1003007): Data Value [8.23326e+007] Encountered Before All Dimensions Selected, [1] Records Completed
    The native sql issued by Studio does not contain the dimension column which is designated as Account dim. I have used custom sql (included one column from each of the 11 dims) but here the data value is also treated as member name and all the records are rejected.
    Member 37356.617844 Not Found In Database
    [2] Mar USD No Segment FY07 Actual-Detail E345 D310 R00 P0000 PL000 7306 37356.617844
    I cant open the rules files in AAS console to check what was going on.. so need your help to understand where i am going wrong.
    Thanks,
    Praveen
    Edited by: user8627339 on Dec 22, 2010 10:26 PM

  • Help needed in retrieving parent child relationship values

    Hi,
    I have a requirement to get parent child relationship values as below.
    Ex: Address table
    cont cont_code state state_code
    C1 10 S1 1
    C1 10 S2 2
    C1 10 S3 3
    C2 20 S4 4
    C2 20 S5 5
    C3 30 S6 6
    C3 30 S7 7
    C3 30 S8 8
    I want a result of country/state and corresponding code like below.
    corresponding states should be displayed under each country with some space appended to it.
    Geography code
    C1 10
    S1 1
    S2 2
    S3 3
    C2 20
    S4 4
    S5 5
    C3 30
    S6 6
    S7 7
    S8 8
    I am using oracle 10g version.
    Thanks in advance.

    Hi,
    When you post formatted text (like your output) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    I think you're saying that you want this output:GEOGRAPHY CODE
    C1 10
    S1 1
    S2 2
    S3 3
    C2 20
    S4 4
    S5 5
    C3 30
    S6 6
    S7 7
    S8 8
    If so, UNION, as Hoek suggested, is a good way.
    GROUP BY ROLLUP is more efficient, but harder to understand:SELECT     CASE
              WHEN GROUPING (state) = 1
              THEN cont
              ELSE ' ' || state
         END          AS geography
    ,      CASE
              WHEN GROUPING (state) = 1
              THEN MAX (cont_code)
              ELSE MAX (state_code)
         END          AS code
    FROM     t
    GROUP BY cont
    ,      ROLLUP (state)
    ORDER BY cont
    ,      state          NULLS FIRST
    By the way, this looks like a bad table design.
    In a relational database, the fact that the name 'C1' belongs to cont_code 10 should only be stored in one place.  You have the same information on 3 separate rows.
    Also, if 'C1' and 'S1' are both names, they should probably be in the same column, so that (to give just one example) you can find the information about 'x1' without knowing if it is a cont or a state.
    A better design would be.NAME     CODE     PARENT     DSCR
    ====     ====     ======     ====
    C1     10          CONT
    S1     1     10     STATE
    S2     2     10     STATE
    S3     3     10     STATE
    C2     20          CONT
    S4     4     20     STATE
    S5     5     20     STATE
    C3     30          CONT
    S6     6     30     STATE
    S7     7     30     STATE
    S8     8     30     STATE
    If the data is this simple, then the dscr column isn't needed.  Whether parent is NULL or not tells whether the rows represents a cont or a state.
    To get the results you want from a table like this, you could use CONNECT BY.  Using either UNION or ROLLUP, you have to know, at the time you write the query, how many levels there will be in the parent-child tree, and the length of the code is proportional to that depth, and the table has to be changed if you ever need to add another level.  CONNECT BY can handle any number of levels, and the length and complexity of the code is the same whether you have just 2 levels (countries and strates), or 7 levels (continents, regions, countiries, states, districts, cities and neighborhoods) or 72 levels.  The table doesn't need any more columns, no matter how deep the tree gets.
    Edited by: Frank Kulash on Sep 16, 2010 11:54 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Parent - Child mapping - ODI

    Hi experts,
    I have source as a below format, in .xls, this is parent- child relationship..
    Gen1     Gen2     Gen3     Gen4
    9000000009 blank     blank     blank
    blank     910000000 blank     blank
    blank     blank     9110000000     blank
    blank     blank     9120000009     blank
    blank     blank     blank     9121100009
    And trying the data into Oracle table with the below format.
    Gen1     Gen2     Gen3     Gen4
    9000000009               
    9000000009     9100000009          
    9000000009     9100000009     9110000000     
    9000000009     9100000009     9120000009     
    9000000009     9100000009     9120000009     9121100009
    Please help me what is the workaround I can follow to achieve using ODI.
    regards,
    Preet
    Edited by: 914626 on Mar 4, 2012 10:13 PM
    Edited by: 914626 on Mar 4, 2012 10:14 PM
    Edited by: 914626 on Mar 4, 2012 10:15 PM
    Edited by: 914626 on Mar 4, 2012 10:15 PM
    Edited by: 914626 on Mar 4, 2012 10:17 PM

    Thanks for the thoroughness. There was a mistake in moving the code over for the forum. The field names are correct throughout the original source code.
    BASE_OBJECT_ID is used throughout.
    I suspect the problem lies in the one-to-many sampleItem(s) relationship that is based upon the subclassed item class. (The relationship is actually "sampleItems" in the real code and somehow got changed in the move over.)
    The problem may lie in the mapping of the attribute override in the child class to the referencing of the item class from the parent side of the relationship in the Sample class.
    I further suspect this may be specific to Eclipselink based upon other postings I've seen on the web that have similar problems...
    Any thoughts?
    Edited by: Chris-R on Mar 3, 2010 9:56 AM

  • Representating Hierarchical (Parent-Child) relation graphically using Swing

    Hi,
    I have to represent a hierarchical data which is having Parent-Child relation using Swing. I am not able to upload the image overhere, so I am represnting the data in such a way so that one can understand this problem. If anyone knows how to upload image on Sun forum, please let me know it will be great help for me.
    Parent Root - A
    Child of A - B, C, D
    Child of C - E, F, G
    Child of F - H
    Child of D - J, K
    The data needs to be represented in two formats-
    1. Tabular Format
    I am able to represent data in this format using combination of JTree and JTable. The data is getting represented in tabular format and I am able to expand and collapse the parent nodes to see the childs. The tabular data will look like below structure,
    A
    I_B
    I
    I_C
    I I_E
    I I
    I I_F
    | I |_H
    | I
    I I_G
    I
    I_D
    I
    I_J
    I
    I_K
    2. Graphical Format
    This is the other way in which I need to represent the data. The above shown tabular data needs to represented in graphical form. The end result should look like,
    I A I
    ____________________I__________________________
    ___I___ __I__ __I__
    I  B  I I  C   I I  D   I
    ____________________I____________ ______I________
    ___I___ __I__ __I__ __I__ ___I__
    I  E  I I  F   I I  G   I I  J   I I   K    I
    __I___
    I   H   I
    Each box representing alphabates will be a component (like JPanel) which will have details about the item to be displayed. The parent and child should be connected with each other using line. This representation should be created at runtime using the hierarchical data. Also the parent and child relations should be expandable/collapsible as they are in JTree.
    I am not able to find any component or any solution in Swing which can provide me this graphical representation. It will be great help if anyone can help me out in this.
    Thanks in advance.

    Sorry for inconvinience for the data representaion in graphical form. I don't know how this get jumblled. Please try to figure out the tabular/graphical representation using pen and paper as forum is not providing any help to upload an image.
    Sorry again for inconvinience.
    Thanks
    Manoj Rai

  • Parent child relation tables

    Hi experts,
    Please check it my code . in this procedure first cursor only inserted into t1 temp table not inserted second cursor please check it and modified the my code.
    i want inserted parent child relation table like bellow
    parent child
    a b
    a c
    a d
    b l
    b m
    b n
    c d like that only inserted
    PROCEDURE TEST_PARENTS_CHILD( p_TABLE VARCHAR2)
    IS
    CURSOR c(P_TABLE varchar2)
    IS
    SELECT p.table_name PARENT, c.table_name CHILD
    FROM user_constraints p, user_constraints c
    WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
    AND c.constraint_type = 'R'
    AND p.constraint_name = c.r_constraint_name
    AND p.table_name = P_TABLE;
    CURSOR C1(p_child varchar2) IS SELECT p.table_name PARENT_TABLE, c.table_name CHILD_TABLE
    FROM user_constraints p, user_constraints c
    WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
    AND c.constraint_type = 'R'
    AND p.constraint_name = c.r_constraint_name
    AND p.table_name = P_CHILD;
    type array
    IS
    TABLE OF T1%ROWTYPE INDEX BY PLS_INTEGER;
    t_data ARRAY;
    BEGIN
    FOR I IN C(P_TABLE)
    LOOP
    FETCH C bulk collect INTO T_DATA limit 1000;
    --- EXIT WHEN C%NOTFOUND;
    FORALL I IN 1..T_DATA.last
    INSERT INTO T1 VALUES T_DATA(I);
    FOR J IN C1(i.CHILD)
    LOOP
    FETCH C1 BULK COLLECT INTO T_DATA LIMIT 1000;
    --EXIT
    --WHEN C1%NOTFOUND;
    FORALL j IN 1..T_DATA.last
    INSERT INTO T1 VALUES T_DATA(j);
    end loop;
    END LOOP;
    END TEST_PARENTS_CHILD;
    Regards,
    Venkat

    You've been asked before on your previous questions (all of which still appear to be unanswered) to read the FAQ: {message:id=9360002} and post correct details of your question, and use {noformat}{noformat} tags to preserve your code/data formatting on the forum.
    But still you post a question lacking all the information and formatting.  If you can't be bothered to help us understand your issue (and read your code), why do you expect others will be bothered to try and help you?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Parent - child tables foreign key relation ship

    Hi All,
    we have 600 hundred tables ..i would like to print a hierarchial tree based on the foreigh key relathionship
    i tried my best but i couldnt.
    parent table
    child table 1
    childtable3
    child table 2
    and so
    Can somebody help me out with a query?
    Thanks,
    kt

    CREATE OR REPLACE FUNCTION get_child_tables (
    ptable VARCHAR2,
    powner VARCHAR2 DEFAULT 'SCOTT',
    plevel NUMBER DEFAULT 10
    RETURN stringarray
    -- -- create this ON SQL*PLUS "CREATE OR REPLACE TYPE STRINGARRAY AS TABLE OF VARCHAR2(50);"
    -- AUTHID CURRENT_USER
    PIPELINED
    AUTHOR DATE VERSION COMMENTS
    ======================================================================================
    [email protected] 26-OCT-2009 1.0 Developed to ease developers effort to find Nth level of Referential integrity
    ======================================================================================
    -- PURPOSE -> To find PARENT=> CHILD relational TABLE(S) in Oracle upto a depth max N Level.
    --SYNTAX TO USE
    SELECT * FROM TABLE( get_child_tables('DEPT','SCOTT',3)); Store this query in a file for your use
    SELECT * FROM TABLE( get_child_tables('EMPLOYEE')); Store this query in a file for your use
    -- RESULTS looks as below
    --1 => DEPT
    --2 => EMP
    --2 => EMP2
    --3 => EMP_CHILD
    --3 => EMP2_CHILD
    -- and so on
    --This can be leveraged to use in any oracle database REGION 10g having and above.
    --This FUNCTION gives formatted result of the Oracle 10g Hierarchical query result coded in the cursor
    --to find MASTER => CHILD relational TABLE(S) upto a depth max 10 Level.
    --The result of the PIPELINED function can be retrieved using Oracle new operator
    --TABLE(array name) in SQL query.
    --Due to the AUTHID CURRENT_USER compiler directive any user can use based on his/her access privileges on the database.
    --GRANT EXECUTE ON SCOTT.get_child_tables TO PUBLIC;
    --CREATE OR REPLACE PUBLIC SYNONYM get_child_tables FOR SCOTT.get_child_tables;
    IS
    atname stringarray := stringarray ();
    -- create this ON SQL*PLUS CREATE OR REPLACE TYPE STRINGARRAY AS TABLE OF VARCHAR2(50);
    vlevel NUMBER;
    vtname VARCHAR2 (50);
    nindex NUMBER := 0;
    bprocessed BOOLEAN := FALSE;
    CURSOR c1 (powner_in IN VARCHAR2, ptable_in VARCHAR2, plevel_in NUMBER)
    IS
    SELECT LEVEL, LPAD (' ', (LEVEL - 1) * 2, ' ') || pt AS "TNAME"
    FROM (SELECT a.owner w1, a.table_name pt, a.constraint_name c1,
    a.r_constraint_name r1, b.owner w2, b.table_name ct,
    b.constraint_name c2, b.r_constraint_name r2
    FROM all_constraints a, all_constraints b
    WHERE a.constraint_name = b.r_constraint_name(+)
    AND a.owner = b.owner(+)
    AND a.owner =
    UPPER (powner)
    -- Change Owner here while testing
    --AND A.r_constraint_name IS NULL
    AND a.constraint_type IN ('P', 'R')) v1
    START WITH pt =
    UPPER
    (ptable)
    -- Change your master table here while testing the QUERY
    CONNECT BY PRIOR ct = pt AND LEVEL <= plevel;
    -- Change lavel here while testing
    BEGIN
    atname.EXTEND;
    atname (1) := 'NOTHING';
    OPEN c1 (powner, ptable, plevel);
    LOOP
    bprocessed := FALSE;
    FETCH c1
    INTO vlevel, vtname;
    IF nindex > 1 AND atname (atname.LAST - 1) = vtname
    THEN
    --DBMS_OUTPUT.PUT_LINE('2 ==== vtname  ' ||vtname || '   '|| atname.count|| '   '||atname.last ||  '   '||atname( atname.last-1));
    bprocessed := TRUE;
    END IF;
    IF NOT bprocessed
    THEN
    nindex := nindex + 1;
    atname.EXTEND;
    atname (nindex) := vtname;
    PIPE ROW (vlevel || ' => ' || vtname);
    DBMS_OUTPUT.put_line ( ' **** nindex - atname( nindex) '
    || nindex
    || ' - '
    || atname (nindex)
    DLOG('ADDING ',vTname); A LOGGING ATONOMUS PROCEDURE FOR DEBUG PURPOSE
    END IF;
    EXIT WHEN c1%NOTFOUND;
    END LOOP;
    CLOSE c1;
    FOR i IN 1 .. atname.COUNT
    LOOP
    DBMS_OUTPUT.PUT_LINE('atname (i) ' ||atname (i));
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN no_data_needed
    THEN -- THIS EXCEPTION HAS TO BE THERE TO GET THE FUCTION WORKABLE
    DBMS_OUTPUT.put_line (SQLERRM);
    RETURN;
    END get_child_tables;
    /

  • Very  urgent- find parent-child relationship for wbs element

    Hi,
    There is a certain parent child heirachy in WBS elements.My requiremnet is to delete WBS element depending on certain field , say depending on some ""status"".If the status is active in some or any of the child then I am not suppose to delete its respective parent too. This parent-child relation can have say 5 levels.
    For this I require a logic /program which shall maintain the parent reference for that particular child whih I want/ dont want to delete.
    I am maintaining bottom- to -top approach.
    That is I shall be checking for the status of the lowest level of WBS and then  going to the highest.
    Please Help!
    Kshitija

    hi you can use following code....
    REPORT  zpmgmt_rpt_projinfo NO STANDARD PAGE HEADING LINE-SIZE  160.
    *& Includes
    INCLUDE <icon>.
    INCLUDE zdata_declare_n.  " include for data declaration
    INCLUDE zsubr_n.          " include for both subroutines
    DATA: gv_index LIKE sy-tabix,
          lv_index LIKE sy-tabix,
          date_index TYPE sy-tabix.
    *& Start of Selection ( Get Data )
    START-OF-SELECTION.
    For initial display cnt is set to X
      IF cnt EQ 'X'.
        PERFORM getdata.
        CLEAR it_final.
        PERFORM hierarchy.
        cnt = ''.
      ENDIF.
    *&      Form  GETDATA
    Fetches the data and logic for T1 and T2
    -->  p1        text
    <--  p2        text
    FORM getdata.
    Getting project header data
      SELECT * FROM proj
        INTO CORRESPONDING FIELDS OF TABLE it_proj
        WHERE pspid IN so_posid
        AND werks IN so_plant
        AND stort IN so_loc
        AND erdat IN so_date.
      IF sy-subrc <> 0.
        MESSAGE 'Enter the valid entry' TYPE 'I'.
        STOP.
      ENDIF.
      LOOP AT it_proj.
        PROJECT = it_proj-pspid.
    Get project & WBS element details
    BAPI used gives the output in some specific format
    which is used for roll-up logic.
        CALL FUNCTION 'BAPI_PROJECT_GETINFO'
         EXPORTING
            project_definition           = project
            with_activities              = 'X'
         IMPORTING
            e_project_definition         = e_project_definition
         TABLES
            e_wbs_hierarchie_table       = e_wbs_hierarchie_table.
    Appending all the projects in the e_wbs.
            LOOP AT e_wbs_hierarchie_table.
              MOVE-CORRESPONDING e_wbs_hierarchie_table TO e_wbs.
              APPEND e_wbs.
              CLEAR e_wbs.
            ENDLOOP.
        CLEAR PROJECT.
      ENDLOOP.
      SET COUNTRY 'US'.
      i_repid = sy-repid.
    Getting data into internal tables
    Getting project WBS element
      SELECT * FROM prps
        INTO CORRESPONDING FIELDS OF TABLE it_prps
        FOR ALL ENTRIES IN it_proj
        WHERE psphi = it_proj-pspnr.
    Getting project activities
      SELECT * FROM afvc
        INTO CORRESPONDING FIELDS OF TABLE it_afvc
        FOR ALL ENTRIES IN it_prps
        WHERE projn = it_prps-pspnr.
      SORT it_afvc BY vornr.
    Getting activities start & end dates from AFVV
      SELECT * FROM afvv
       INTO CORRESPONDING FIELDS OF TABLE it_afvv
       FOR ALL ENTRIES IN it_afvc
       WHERE aufpl = it_afvc-aufpl
       AND aplzl = it_afvc-aplzl.
    Getting plant name
      SELECT * FROM t001w
        INTO CORRESPONDING FIELDS OF TABLE it_t001w
        FOR ALL ENTRIES IN it_proj
        WHERE werks = it_proj-werks.
    Logic for passing data to final internal table
    Passing Project master data
      READ TABLE it_proj INDEX 1.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
          EXPORTING
            input  = it_proj-pspid
          IMPORTING
            output = it_proj-pspid.
        it_final-posid = it_proj-pspid.
        it_final-post1 = it_proj-post1.
        APPEND it_final.
        CLEAR it_final.
      ENDIF.
    Passing WBS element to the final internal table IT_FINAL
      LOOP AT it_prps.
        CALL FUNCTION 'CONVERSION_EXIT_ABPSN_OUTPUT'
          EXPORTING
            input  = it_prps-posid
          IMPORTING
            output = it_prps-posid.
         CLEAR color.
    Get WBS element status ans color(T2)from OBJNR
        CALL FUNCTION 'ZGET_STATUS_N'
          EXPORTING
            objnr    = it_prps-objnr
          IMPORTING
            color    = color
          TABLES
            t_status = it_tj30t.
        IF     color = 'RED'.
          it_final-t2 = '@0A@'.
        ELSEIF color = 'YELLOW'.
          it_final-t2 = '@09@'.
        ELSEIF color = 'GREEN'.
          it_final-t2 = '@08@'.
        ENDIF.
        SORT it_tj30t DESCENDING.
    Getting User statuses of WBS element at component level.
        READ TABLE it_tj30t INDEX 1.
        IF sy-subrc EQ 0.
          CONCATENATE it_tj30t-txt04 '' INTO it_final-txt04 SEPARATED BY  space.
        ENDIF.
        READ TABLE it_tj30t INDEX 2.
        IF sy-subrc EQ 0.
          CONCATENATE it_tj30t-txt04 it_final-txt04 INTO it_final-txt04  SEPARATED BY space.
        ENDIF.
        MOVE-CORRESPONDING it_prps TO it_final.
        READ TABLE it_proj WITH KEY pspid = it_prps-posid.
        IF sy-subrc EQ 0.
          it_final-werks = it_proj-werks.
        ENDIF.
        APPEND it_final.
        CLEAR  it_final-txt04.
    Passing activity to the final internal table IT_FINAL
        LOOP AT it_afvc WHERE projn EQ it_prps-pspnr.
          CLEAR color.
    Getting user status and color(T2) for Activity from OBJNR
          CALL FUNCTION 'ZGET_STATUS_N'
            EXPORTING
              objnr    = it_afvc-objnr
            IMPORTING
              color    = color
            TABLES
              t_status = it_tj30t.
          IF     color = 'RED'.
            it_final-t2 = '@0A@'.
          ELSEIF color = 'YELLOW'.
            it_final-t2 = '@09@'.
          ELSEIF color = 'GREEN'.
            it_final-t2 = '@08@'.
          ENDIF.
          CLEAR: it_final-fsavd,
                 it_final-fssad.
          MOVE-CORRESPONDING it_afvc TO it_final.
    Getting User statuses of WBS element at activity level.
          SORT it_tj30t DESCENDING.
          READ TABLE it_tj30t INDEX 1.
          IF sy-subrc EQ 0.
            CONCATENATE it_tj30t-txt04 '' INTO it_final-txt04 SEPARATED  BY space.
          ENDIF.
          READ TABLE it_tj30t INDEX 2.
          IF sy-subrc EQ 0.
            CONCATENATE it_tj30t-txt04 it_final-txt04 INTO it_final-txt04  SEPARATED BY space.
          ENDIF.
          APPEND it_final.
          lv_index = sy-tabix.
          CLEAR it_final-txt04.
          CLEAR it_final-ltxa1.
          CLEAR it_tj30t.
          REFRESH it_tj30t.
    Start Date and End Date fetched from AFVV.
          LOOP AT it_afvv  WHERE   aufpl  EQ it_afvc-aufpl
                              AND   aplzl EQ it_afvc-aplzl.
            MOVE-CORRESPONDING it_afvv TO it_final.
            MODIFY it_final INDEX lv_index TRANSPORTING fsavd fssad.
          ENDLOOP.
          CLEAR it_afvc.
          CLEAR lv_index.
        ENDLOOP.
      ENDLOOP.
    Logic for T1.
    T1 is based on T2 and start date and end date of activities.
      LOOP AT it_final WHERE stufe = 3
                       AND ltxa1 IS NOT INITIAL.
        gv_index = sy-tabix.
        PERFORM date_difference.
        CASE it_final-t2.
          WHEN '@0A@'.     "  If Red
            IF sy-datum GT it_final-fssad.
              it_final-t1 = '@0A@'.
            ELSEIF sy-datum LE it_final-fssad AND
                   sy-datum GE it_final-fsavd.
              IF gv_diff > 1.
                PERFORM date_monitor.
              ENDIF.
              it_final-t1 = '@09@'.
            ELSEIF
              sy-datum LT it_final-fsavd.
              it_final-t1 = '@08@'.
            ENDIF.
          WHEN '@09@'.     " If Yellow
            IF sy-datum GT it_final-fssad.
              it_final-t1 = '@0A@'.
            ELSEIF sy-datum LE it_final-fssad AND
                   sy-datum GE it_final-fsavd.
              IF gv_diff > 1.
                PERFORM date_monitor.
              ENDIF.
              it_final-t1 = '@09@'.
            ELSEIF
              sy-datum LT it_final-fsavd.
              it_final-t1 = '@08@'.
            ENDIF.
          WHEN '@08@'.     " If Green
            it_final-t1 = '@08@'.
        ENDCASE.
        MODIFY it_final INDEX gv_index TRANSPORTING t1.
        CLEAR gv_index.
      ENDLOOP.
    ENDFORM.                    " GETDATA
    *&      Form  hierarchy
    Displays the data in ALV hierarchical manner.
    In coding 3 tables are used for roll-up functionality.
    FORM hierarchy .
      DATA: it_final1 LIKE it_final OCCURS 0 WITH HEADER LINE.
      DATA: it_final2 LIKE it_final OCCURS 0 WITH HEADER LINE.
      DATA: it_final3 LIKE it_final OCCURS 0 WITH HEADER LINE.
      DATA: count TYPE i VALUE 1.
      DATA: posid LIKE prps-posid.
      DATA: change,
            date_mask  TYPE c LENGTH 10,
            lv_index2 LIKE sy-tabix.
      DATA: index TYPE sy-tabix.
      DATA: up LIKE prps-posid.
    Deleting duplicate entries from the it_final.*****************
      DELETE ADJACENT DUPLICATES FROM it_final.
      LOOP AT it_final WHERE stufe EQ 2.
        IF posid NE it_final-posid.
          posid = it_final-posid.
        ELSE.
          DELETE it_final INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
      CLEAR posid.
      LOOP AT it_final  WHERE stufe EQ 3
                        AND ltxa1 EQ space.
        IF posid NE it_final-posid.
          posid = it_final-posid.
        ELSE.
          DELETE it_final INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
    Updating a new intrnal table for roll up functionality. ********
      it_final1[] = it_final[].
      CLEAR: lv_index2.
      LOOP AT it_final1 WHERE stufe =  3
                        AND ltxa1 IS NOT INITIAL.
        READ TABLE it_final WITH KEY  stufe = 3
                                      posid = it_final1-posid
                                      post1 = it_final1-post1.
       clear change.
        IF sy-subrc = 0.
          lv_index = sy-tabix.
          IF lv_index2 <> lv_index.
            CLEAR: change.
            lv_index2 = lv_index.
          ENDIF.
          IF it_final1-t1 = '@0A@'.
            it_final-t1 =  '@0A@' .
            MODIFY it_final INDEX lv_index TRANSPORTING t1.
            DELETE it_final1 WHERE posid = it_final-posid.
            CONTINUE.
          ENDIF.
          IF  it_final1-t1 = '@09@'.
            it_final-t1 = '@09@'.
            change = 'Y'.
            MODIFY it_final INDEX lv_index TRANSPORTING t1.
            CONTINUE.
          ENDIF.
          IF it_final1-t1 = '@08@'.
            it_final-t1 =  '@08@' .
            IF change IS INITIAL.
              MODIFY it_final INDEX lv_index TRANSPORTING t1.
            ENDIF.
            CONTINUE.
          ENDIF.
        ENDIF.
      ENDLOOP.
      it_final2[] = it_final[].
      CLEAR: lv_index2.
      LOOP AT it_final2 WHERE stufe = 3
                        AND ltxa1 IS INITIAL.
        READ TABLE e_wbs WITH KEY wbs_element = it_final2-posid.
        IF sy-subrc = 0.
          READ TABLE it_final WITH KEY stufe = 2
                                       posid = e_wbs-up.
          IF sy-subrc = 0.
            CHECK it_final-t1 <> '@0A@'.
            lv_index = sy-tabix.
            IF lv_index2 <> lv_index.
              CLEAR: change.
              lv_index2 = lv_index.
            ENDIF.
            IF   it_final2-t1 = '@0A@'.
              it_final-t1 =  '@0A@' .
              MODIFY it_final INDEX lv_index TRANSPORTING t1.
              CONTINUE.
            ENDIF.
            IF  it_final2-t1 = '@09@'.
              it_final-t1 = '@09@'.
              MODIFY it_final INDEX lv_index TRANSPORTING t1.
              change = 'Y'.
              CONTINUE.
            ENDIF.
            IF it_final2-t1 = '@08@'.
              it_final-t1 =  '@08@' .
              IF change IS INITIAL.
                MODIFY it_final INDEX lv_index TRANSPORTING t1.
              ENDIF.
              CONTINUE.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
      it_final3[] = it_final[].
      CLEAR: lv_index2.
      CLEAR change.
      LOOP AT it_final3 WHERE stufe = 2.
        READ TABLE e_wbs WITH KEY wbs_element = it_final3-posid.
        CHECK sy-subrc = 0.
        READ TABLE it_final WITH KEY stufe = 1
                                     posid = e_wbs-up.
        IF sy-subrc = 0.
          CHECK it_final-t1 <> '@0A@'.
          lv_index = sy-tabix.
          IF lv_index2 <> lv_index.
            CLEAR: change.
            lv_index2 = lv_index.
          ENDIF.
          IF   it_final3-t1 = '@0A@'.
            it_final-t1 =  '@0A@' .
            MODIFY it_final INDEX lv_index TRANSPORTING t1.
            DELETE it_final3.   " WHERE stufe = 2.
            CONTINUE.
          ENDIF.
          IF  it_final3-t1 = '@09@'.
            it_final-t1 = '@09@'.
            MODIFY it_final INDEX lv_index TRANSPORTING t1.
            change = 'Y'.
            CONTINUE.
          ENDIF.
          IF it_final3-t1 = '@08@'.
            it_final-t1 =  '@08@' .
            IF change IS INITIAL.
              MODIFY it_final INDEX lv_index TRANSPORTING t1.
            ENDIF.
            CONTINUE.
          ENDIF.
        ENDIF.
      ENDLOOP.
    Building hierarchy table ***************
      LOOP AT it_final.
        IF it_final-stufe = '0'.
          node_tab-type = 'T'.
          node_tab-name = 'Project'.
          node_tab-tlevel = '01'.
          node_tab-nlength = '8'.
          node_tab-color = '4'.
          node_tab-text = it_final-post1.
          node_tab-tlength ='20'.
          node_tab-tcolor = 5.
          APPEND node_tab.
          it_final_hsk-node = node_tab.
          APPEND it_final_hsk. CLEAR it_final_hsk.
          CLEAR node_tab.
        ELSEIF it_final-stufe = '1'.
          node_tab-type = 'P'.
          node_tab-name = 'Project'.
          node_tab-tlevel = '02'.
          node_tab-nlength = '10'.
          node_tab-color = '1'.
          node_tab-kind2 = 'I'.
          node_tab-text3+0(4) = it_final-t1.
          node_tab-tlength3 = '5'.
          node_tab-tcolor3 = 1.
          node_tab-kind3 = ' '.
          node_tab-text4 = it_final-posid.
          node_tab-tlength4 ='20'.
          node_tab-tcolor4 = 3.
    Code added for plant name
          CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'
            EXPORTING
              input  = it_final-posid
            IMPORTING
              output = it_final-posid.
          READ TABLE it_proj WITH KEY pspid = it_final-posid.
          CHECK sy-subrc = 0.
          READ TABLE it_t001w WITH KEY werks = it_proj-werks.
          CHECK sy-subrc = 0.
    Code End.
          node_tab-kind4 = ' '.
          node_tab-text5 = it_t001w-name1.   " Plant Name
          node_tab-tlength5 ='25'.
          node_tab-tcolor5 = 4.
          node_tab-kind5 = ' '.
          node_tab-text6 = it_proj-stort.
          node_tab-tlength6 ='15'.
          node_tab-tcolor6 = 4.
          node_tab-kind6 = ' '.
          node_tab-text7 = it_final-post1.
          node_tab-tlength7 ='25'.
          node_tab-tcolor7 = 4.
          APPEND node_tab.
          it_final_hsk-node = node_tab.
          APPEND it_final_hsk. CLEAR it_final.
          CLEAR node_tab.
        ELSEIF it_final-stufe = '2'.
          node_tab-type = 'P'.
          node_tab-name = 'Gate Id'.
          node_tab-tlevel = '03'.
          node_tab-nlength = '10'.
          node_tab-color = '1'.
          node_tab-kind2 = 'I'.
          node_tab-text3+0(4) = it_final-t1.
          node_tab-tlength3 = '5'.
          node_tab-tcolor3 = 1.
          node_tab-kind3 = ' '.
          node_tab-text4 = it_final-posid.
          node_tab-tlength4 ='20'.
          node_tab-tcolor4 = 3.
          node_tab-kind4 = ' '.
          node_tab-text5 = it_final-post1.
          node_tab-tlength5 ='25'.
          node_tab-tcolor5 = 4.
          APPEND node_tab.
          it_final_hsk-node = node_tab.
          APPEND it_final_hsk.
          CLEAR it_final.
          CLEAR node_tab.
        ELSEIF it_final-stufe = '3' AND it_final-ltxa1 EQ space.
          node_tab-type = 'P'.
          node_tab-name = 'Component'.
          node_tab-tlevel = '04'.
          node_tab-nlength = '11'.
          node_tab-color = '1'.
          node_tab-kind2 = 'I'.
          node_tab-text3+0(4) = it_final-t1.
          node_tab-tlength3 = '5'.
          node_tab-tcolor3 = 1.
          node_tab-kind3 = ' '.
          node_tab-text4 = it_final-posid.
          node_tab-tlength4 ='25'.
          node_tab-tcolor4 = 3.
          node_tab-kind4 = ' '.
          node_tab-text5 = it_final-post1.
          node_tab-tlength5 ='25'.
          node_tab-tcolor5 = 4.
    Code added for start date and end date for component level.
          SELECT SINGLE pstrm petrf INTO (v_pstrm, v_petrf)
               FROM prte WHERE posnr = it_final-pspnr.
          it_final-fsavd = v_pstrm.
          it_final-fssad = v_petrf.
          MODIFY it_final INDEX sy-tabix.
          WRITE it_final-fsavd TO date_mask MM/DD/YYYY.
          node_tab-tpos1 = '0'.
          node_tab-kind5 = ' '.
          node_tab-text6 = date_mask.
          node_tab-tlength6 ='10'.
          node_tab-tcolor6 = 3.
          CLEAR date_mask.
          WRITE it_final-fssad TO date_mask MM/DD/YYYY.
          node_tab-tpos1 = '0'.
          node_tab-kind6 = ' '.
          node_tab-text7 = date_mask.
          node_tab-tlength7 ='10'.
          node_tab-tcolor7 = 3.
          CLEAR date_mask.
          APPEND node_tab.
          it_final_hsk-node = node_tab.
          APPEND it_final_hsk.
          CLEAR it_final_hsk.
          CLEAR node_tab.
        ELSEIF it_final-ltxa1 IS NOT INITIAL.
          node_tab-type = 'P'.
          node_tab-name = 'Element'.
          node_tab-tlevel = '05'.
          node_tab-nlength = '11'.
          node_tab-color = '1'.
          node_tab-kind = 'I'.
          node_tab-text1+0(4) = it_final-t1.
          node_tab-tlength1 = '5'.
          node_tab-tcolor1 = 1.
          node_tab-kind2 = 'I'.
          node_tab-text3+0(4) = it_final-t2.
          node_tab-tlength3 = '5'.
          node_tab-tcolor3 = 1.
          node_tab-kind3 = ' '.
          node_tab-text4 = it_final-ltxa1.
          node_tab-tlength4 ='45'.
          node_tab-tcolor4 = 3.
          node_tab-kind4 = ' '.
          node_tab-text5 = it_final-txt04.
          node_tab-tlength5 ='10'.
          node_tab-tcolor5 = 3.
          WRITE it_final-fsavd TO date_mask .
          node_tab-kind5 = ' '.
          node_tab-text6 = date_mask.
          node_tab-tlength6 ='10'.
          node_tab-tcolor6 = 3.
          CLEAR date_mask.
          WRITE it_final-fssad TO date_mask.
          node_tab-tpos1 = '0'.
          node_tab-kind6 = ' '.
          node_tab-text7 = date_mask.
          node_tab-tlength7 ='10'.
          node_tab-tcolor7 = 3.
          CLEAR date_mask.
          APPEND node_tab.
          it_final_hsk-node = node_tab.
          APPEND it_final_hsk.
          CLEAR it_final_hsk.
          CLEAR node_tab.
        ENDIF.
      ENDLOOP.
      CALL FUNCTION 'RS_TREE_CONSTRUCT'
        TABLES
          nodetab = it_final_hsk.
      CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
        EXPORTING
          callback_program      = i_repid
          callback_user_command = 'USER_COMMAND'
          callback_gui_status   = 'ZLD_TREE_N'
          screen_start_column   = 0
          use_control           = 'L'.
    ENDFORM.                    " hierarchy
    *&      Form  MYGUI
          text
         -->EX_TAB     text
    FORM zld_tree_n.
      SET PF-STATUS 'ZLD_TREE_N'.
    ENDFORM.                    "zld_tree.
    **&      Form  user_command
        Code for REFRESH button
    FORM user_command TABLES   node STRUCTURE seucomm
                               USING ucomm CHANGING exit
                                        list_refresh.
      CASE ucomm.
        WHEN 'REFR' .
          CLEAR it_final.
          REFRESH it_final_hsk.
          REFRESH it_final.
          PERFORM getdata.
          CLEAR it_final.
          PERFORM hierarchy.
        WHEN 'BACK1'.
          LEAVE TO TRANSACTION 'ZCN41_N'.
      ENDCASE.
    ENDFORM.                    "user_command
    include.....
    *&  Include           ZDATA_DECLARE
    *& Tables used for the report
    TABLES: proj, prps, aufk, afvc, jest, tj30t, afvv, prte.
    *& Type Pools used
    TYPE-POOLS: slis, icon, fibs, stree.
    *& Class & Data defination
    CLASS DEFINATION
    CLASS cl_gui_resources DEFINITION LOAD.
    DATA DECLARATION
    DATA: g_lights_name TYPE lvc_cifnm VALUE 'LIGHT',
          pspid LIKE proj-pspid,
          l_pos TYPE i VALUE 1,
          gs_layout TYPE slis_layout_alv,
          color TYPE zcn41_color_n-color.
    DATA : cnt VALUE 'X'.
    DATA : i_repid TYPE sy-repid.
    DATA : t_node TYPE snodetext.
    DATA : node_tab LIKE t_node OCCURS 0 WITH HEADER LINE.
    DATA : gv_diff TYPE p, stort LIKE proj-stort.
    CONSTANTS: st_formname_top_of_page TYPE slis_formname
                                  VALUE 'TOP_OF_PAGE-ALV'.
    *& Internal Table Declarations
    DATA it_proj   TYPE STANDARD TABLE OF proj WITH HEADER LINE.
    DATA it_prps   TYPE STANDARD TABLE OF prps WITH HEADER LINE.
    DATA it_afvc   TYPE STANDARD TABLE OF afvc WITH HEADER LINE.
    DATA it_tj30t  TYPE STANDARD TABLE OF tj30t WITH HEADER LINE.
    DATA it_afvv   TYPE STANDARD TABLE OF afvv WITH HEADER LINE.
    DATA it_jcds   TYPE STANDARD TABLE OF jcds WITH HEADER LINE.
    DATA it_t001w  TYPE STANDARD TABLE OF t001w WITH HEADER LINE.
    DATA: BEGIN OF it_final OCCURS 0,
              stufe  LIKE prps-stufe,
              pspnr  LIKE prps-pspnr,
              t1      TYPE icon-id,
              t2      TYPE icon-id,
              node    LIKE node_tab,
              posid  LIKE prps-posid,
              post1  LIKE prps-post1,
              ltxa1  LIKE afvc-ltxa1,
              txt04(20),
              objnr  LIKE afvc-objnr,
              vornr  LIKE afvc-vornr,
              aufpl  LIKE afvc-aufpl,
              aplzl  LIKE afvc-aplzl,
              fsavd  LIKE afvv-fsavd,  "Ear. Start date
              fssad  LIKE afvv-fssad,  "Ear. finish date
              werks  LIKE t001w-name1,     " added after update
              stort  LIKE proj-stort,     " added after update
         END OF it_final.
    DATA: BEGIN OF it_hsk OCCURS 0,
            t2      TYPE icon-id,
            t1      TYPE icon-id,
            posid  LIKE prps-posid,
            post1  LIKE prps-post1,
            objnr  LIKE afvc-objnr,
            stufe  LIKE prps-stufe,
          END OF it_hsk.
    DATA: BEGIN OF it_new OCCURS 0,
            objnr LIKE afvc-objnr,
            fsavd LIKE afvv-fsavd,
            fssad LIKE afvv-fssad,
            udate LIKE jcds-udate,
            t2(10),
          END OF it_new.
    CLEAR : node_tab, node_tab[].
    DATA  : entval TYPE prps-posid.
    DATA  : ct_fieldcat TYPE  slis_t_fieldcat_alv.
    DATA  : BEGIN OF it_final_hsk OCCURS 0,
              node LIKE node_tab,
            END OF it_final_hsk.
    DATA  : project LIKE bapipr-project_definition,
            e_project_definition LIKE bapi_project_definition_ex.
    DATA  : e_wbs_hierarchie_table TYPE STANDARD TABLE OF bapi_wbs_hierarchie
            WITH HEADER LINE.
    DATA  : e_wbs LIKE e_wbs_hierarchie_table OCCURS 0 WITH HEADER LINE.
    DATA:  v_pstrm LIKE prte-pstrm, v_petrf LIKE prte-petrf,
           v_posnr LIKE prps-pspnr.
    *& Selection Screen of the report
    SELECTION-SCREEN BEGIN OF BLOCK pms WITH FRAME TITLE text-001.
    SELECT-OPTIONS so_posid FOR proj-pspid OBLIGATORY.
    SELECT-OPTIONS so_plant FOR proj-werks.
    SELECT-OPTIONS so_loc FOR proj-stort.
    SELECT-OPTIONS so_date FOR sy-datum.
    SELECTION-SCREEN END OF BLOCK pms.
    *AT SELECTION-SCREEN .
    READ TABLE it_proj WITH KEY pspid = so_posid.
    IF sy-subrc <> 0.
       MESSAGE 'Project Name dose not exist' TYPE 'E.
    ENDIF.
    include..
    *&  Include           ZSUBR
    *&      Form  date_difference
          text
    -->  p1        text
    <--  p2        text
    FORM date_difference .
      CALL FUNCTION 'ZDATETIME_DIFFERENCE_N'
        EXPORTING
          date1                  = it_final-fsavd
          time1                  = '000000'
          date2                  = it_final-fssad
          time2                  = '000000'
       IMPORTING
         datediff               = gv_diff
       EXCEPTIONS
         INVALID_DATETIME       = 1
         OTHERS                 = 2
      IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " date_difference
    *&      Form  date_monitor
          text
    -->  p1        text
    <--  p2        text
    T1 for more than 1 days activities
    Subroutines result out the T1 on basis of 80% of activity ( Green )
    or if 20 % reamined. ( Yellow )
    FORM date_monitor .
      DATA: date TYPE string,
            temp_date TYPE string,
            lv_date LIKE afvv-fsavd,
            lv_date_final LIKE afvv-fsavd,
            lv_days LIKE  bseg-dtws1 VALUE 0.
      CONSTANTS: con TYPE f VALUE '0.8'.
    *lv_date = it_new-fsavd.
      IF gv_diff EQ 2.
        lv_days = 1.
        CALL FUNCTION 'ZCALC_DATE_N'
          EXPORTING
            date      = it_final-fsavd
            days      = lv_days
            months    = '00'
            sign      = '+'
            years     = '00'
          IMPORTING
            calc_date = lv_date_final.
        IF sy-datum LE lv_date_final.
          it_final-t1 = '@08@'.
        ELSEIF sy-datum GT lv_date_final AND
               sy-datum EQ it_final-fssad.
          it_final-t1 = '@09@'.
        ENDIF.
      ELSEIF gv_diff > 2.
        lv_days = con * gv_diff.
        CALL FUNCTION 'ZCALC_DATE_N'
          EXPORTING
            date      = lv_date
            days      = lv_days
            months    = '00'
            sign      = '+'
            years     = '00'
          IMPORTING
            calc_date = lv_date_final.
        IF sy-datum LE lv_date_final.
          it_final-t1 = '@08@'.
        ELSEIF sy-datum GT lv_date_final AND
               sy-datum EQ it_final-fssad.
          it_final-t1 = '@09@'.
        ENDIF.
      ENDIF.
    ENDFORM.                    " date_monitor
    this code will give you exact out put as you required from bootom to top functinality....with status....

  • Retrieve Parent Child Sub-Child recors in SQL Query

    I've a self reference table and it has Parent-Child-Subchild relation. I'm getting an output (from second answer http://stackoverflow.com/questions/16031000/get-records-containing-all-the-child-records-in-sql-server) as expected, but it's
    displaying results in below format.
    <parent id> - <name> - <code>
    <child id> - <name> - <code>
    <child id> - <name> - <code>
    <child id> - <name> - <code>
    <child id> - <name> - <code>
    <sub child id> - <name> - <code>
    <sub child id> - <name> - <code>
    <sub child id> - <name> - <code>
    I want to display the results like in below format with applying some indent style to distinguish parent\ child\sub-child relationship.
    <parent id> - <name> - <code>
    <child id> - <name> - <code>
    <child id> - <name> - <code>
    <sub child id> - <name> - <code>
    <sub child id> - <name> - <code>
    <child id> - <name> - <code>
    <child id> - <name> - <code>
    <sub child id> - <label> - <code>
    <child id> - <name> - <code>
    <child id> - <name> - <code>
    Please assist me on foumulating results as expected.

    BOL has a good example of doing this in the CTE topic.  See http://technet.microsoft.com/en-us/library/ms175972%28v=sql.105%29.aspx Here is a slightly modified
    version of what is in BOL.
    CREATE TABLE #MyEmployees
    EmployeeID smallint NOT NULL,
    FirstName nvarchar(30) NOT NULL,
    LastName nvarchar(40) NOT NULL,
    Title nvarchar(50) NOT NULL,
    DeptID smallint NOT NULL,
    ManagerID int NULL,
    CONSTRAINT PK_EmployeeID PRIMARY KEY CLUSTERED (EmployeeID ASC)
    -- Populate the table with values.
    INSERT INTO #MyEmployees VALUES
    (1, N'Ken', N'Sánchez', N'Chief Executive Officer',16,NULL)
    ,(273, N'Brian', N'Welcker', N'Vice President of Sales',3,1)
    ,(274, N'Stephen', N'Jiang', N'North American Sales Manager',3,273)
    ,(275, N'Michael', N'Blythe', N'Sales Representative',3,274)
    ,(276, N'Linda', N'Mitchell', N'Sales Representative',3,274)
    ,(285, N'Syed', N'Abbas', N'Pacific Sales Manager',3,273)
    ,(286, N'Lynn', N'Tsoflias', N'Sales Representative',3,285)
    ,(16, N'David',N'Bradley', N'Marketing Manager', 4, 273)
    ,(23, N'Mary', N'Gibson', N'Marketing Specialist', 4, 16);
    ; WITH DirectReports(Name, Title, EmployeeID, EmployeeLevel, Sort)
    AS (SELECT CONVERT(varchar(255), e.FirstName + ' ' + e.LastName),
    e.Title,
    e.EmployeeID,
    1,
    CONVERT(varchar(255), e.FirstName + ' ' + e.LastName)
    FROM #MyEmployees AS e
    WHERE e.ManagerID IS NULL
    UNION ALL
    SELECT CONVERT(varchar(255), REPLICATE (' ' , EmployeeLevel) +
    e.FirstName + ' ' + e.LastName),
    e.Title,
    e.EmployeeID,
    EmployeeLevel + 1,
    CONVERT (varchar(255), RTRIM(Sort) + '| ' + FirstName + ' ' +
    LastName)
    FROM #MyEmployees AS e
    JOIN DirectReports AS d ON e.ManagerID = d.EmployeeID
    SELECT EmployeeID, Name, Title, EmployeeLevel
    FROM DirectReports
    ORDER BY Sort;
    GO
    drop table #MyEmployees;
    Tom

Maybe you are looking for

  • Sound Problems after converting

    I converted all my video files from Quicktime to MPEG-4 so that the videos would play on my iPod. The videos now play, but there is no sound. How can i get sound to play?

  • Various Errors in connection to iTunes on my new HP Laptop with Win7 64bit

    I tried to connect my iPhone 3G 16GB with my new HP Pavilion dv7 (intel core i7) Laptop with Windows 7 64 Bit and it fails... While iTunes synch appears the first error message: "iTunes was not possible to connect with this iPhone because of an unkno

  • Bought new computer, Won't let me transfer songs from Ipod to new computer?

    Is this possible? I have several hundred songs on my Ipod/other computer (desktop). I bought a new Dell laptop and I was hoping I could transfer all the songs on my new computer. It did let me transfer the songs that were purchsed through Itunes but

  • Can't get ok prompt on V440

    Hi all, I have a V440 for upon bootup gives me the option of getting into ALOM with #. - I assume pretty standard. I don't have the ALOM password so I want to re-install Solaris 10. When connected to the Management serial interface (on the PCI card)

  • LMS 3.2 Compliance Template syntax help

    I want to add the command "no logging event link-status" to all switchport mode access ports EXCEPT for the ones with the following switchport access vlans: 4022,4032,4042,4052,4072 & 4082. How do I create a compliance template to do this? LMS 3.2, R