Mapping parent to sub

Hi.
I have a table (let's call it 'Node') with fields:
- id (primary key)
- id_parent (foreign key to id-field)
I can easily map the table to get it's parent-object,
but I can't seem to get Node's sub-nodes (1 to many) mapped in toplink workbench.
I have created a reference to the toplink table mapping:
source: id, target field: id_parent,
and it seems like it should work (no errors etc),
but when I run the code, it returns just an empty collection.
Any ideas why this doesn't work?
- Toni

Hi Tony,
If you are attempting a relective 1-many mapping, try looking at the toplink example 'employee' where employee has a 1-M 'managedEmployees' with a 1-1 'manager' backpointer.
Thanks,
Stephen

Similar Messages

  • 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

  • Context Mapping: child-nodes of non-mapped parent nodes

    I am somewhat curious about Context Mapping in WebDynpro.
    Which parents nodes need to be mapped in order to map child nodes ? Does a child node has more than one parent node (e.g. grandparent - two steps above) ?
    A.1  -
    MAPPED----
    >    B.1
      - A1.1   NOT MAPPED
      - A1.2   NOT MAPPED
            - A.1.2.1     MAPPED TO>    B.1.2.4
            - A.1.2.2   NOT MAPPED
      - A1.3   NOT MAPPED
    Is it sufficient that only one of these parent nodes (e.g. direct parent node not mapped, but parent node of this parent node is mapped) need to be mapped so that the child node can be mapped ?
    Is this assumption true or not ?
    The SAP library states:
    "Conversely, child nodes of non-mapped parent nodes cannot be mapped, otherwise this would result in irresolvable conflicts at runtime with respect to the parent-child relation in the context and the mapping relation." (http://help.sap.com/saphelp_nw04/helpdata/de/51/a3384162316532e10000000a1550b0/content.htm)
    This statement is not absolutely clear on this issue.

    Let me put it this way
    You have a node vehicle and you have a child node for that the car. The car node have parameters car1, car2.
    Let the vehicle node have parameters veh1 and veh2
    Then if you map vehicle node one to any other node (say in the comp. controller) you have the option of mapping its children i.e veh1,veh2 and carnode.
    You can have that veh1 is mapped and veh2 is not mapped.
    vehicle node(mapped)
    veh1(may or may not be mapped)
    veh2(may or may not be mapped)
    car node(may or may not be mapped)
    If instead you try to map only the car node the vehicle node will also get mapped automatically but not it's child parameters like veh1 and veh2.
    vehicle node(mapped)
    veh1(may or may not be mapped)
    veh2(may or may not be mapped)
    car nodemapped)
    car1(may or may not be mapped)
    car2(may or may not be mapped)
    Hope this would help.
    Do revert for further clarification
    Regards
    Noufal

  • Message Mapping: Parent should only appear if child exists

    Hi,
    i have a message structure like
    root
       structure 0-unbounded
          field1    0-1
          field2    0-1
    I want to create the same output structure, but if field1 doent exist, the parent structure shouldnt appear. Sounds very simple, but the my problem is: however i map field1 to structure, either directly or with functions like exists() or ifWithOutElse() it allways give me the wrong structure.
    For example:
    <root>
       <structure>
          <field2>10</field2>
       </structure>
       <structure>
          <field1>20</field1>
          <field2>30</field2>
       </structure>
       <structure>
          <field2>40</field2>
       </structure>
    </root>
    mapped with field1 (context to root) -> structure gives me as result
    <root>
       <structure>
          <field2>10</field2>
       </structure>
    </root>
    I would like to have:
    <root>
       <structure>
          <field1>20</field1>
          <field2>30</field2>
       </structure>
    </root>
    Thx 4 ur help,
    Udo

    Hi Satish,
    thx for posting
    I checked your solution, but i got the same result, may be i understood something wrong.
    >I changed the occurence of your mapping to 0..unbouned in mapping.
    I dont understand that. Are you talking about a multi mapping?
    >For root in target: field1(change context to root in source) > removecontext>exists>creatif>root
    The root is of course occurence 1, so i dont need to map it, right?
    >For Strucurte in target: field1 > removecontext>exists-->creatif -->Strucurte
    I tried to map the structure like you recommended. It should now give ONLY structures where the child field1 exists. This works, if the first structure has such a child, but not in my example. I get the wrong structure.
    Do you think i need to use node functions as well for field1 or field2? Can they appear in a wrong structure?
    Regards,
    Udo

  • MAP value for sub materials from New(Main) Material

    Hi all
    I got an issue in Kit breaking i.e. i got one material(main) which contains 10 of sub materials.Now when i am receiving the main material, i will receive with a value  assume as 10000 bugs.
    Now i would like to know that the 10000 bugs can be splited equally between all the 10 materials automatically.
    All the 10 material  are newly created with MAP value as zero.
    Regards
    Praveen

    As mentioned in my earlier reply, if material is maintained on price control 'V', then system tries to settle the variance to inventory. In such case, if the variance is favourable i.e. Actual cost is less than the standard cost, the negative variance will reduce the value of inventory and as a result MAP. If the inventory value is less than the amount of variance, system issues a message that MAP will become negative.
    Hope this clear the issue. If yes, please award points
    Regards
    Rakesh Pawaskar
    Message was edited by:
            Rakesh Pawaskar

  • AUTOMATIC MAPPING OF ASSET SUB NUMBER IN PO IN ITEM DETAILS

    Hi Guruz,
    i have an urgent issue regarding asset topic and sub number.
    my issue is my client purchased 100 computer sets. Each computer set has an unique asset number. now we are using multiple account assignment concept. Earlier my client use to purchase 100 computers by including 100 line items in the purchase order in item overview each having an asset number(that belongs to a particular asset class which is in turn assigned to one G/L account). So we can see that it is a very lengthy job. Instead my client wants that they should enter only one line item containing the asset number in the item overview of the PO.
    At present we are using multiple account assignment as we are creating the asset sub number under one main asset.
    With this we are able to prevent entering 100 line items in the item overview but we are entering the 100 sub number data in item details of the PO.
    item overview look out:
    Ex: asset no: 100268 quantity -100 price- 20000
    item detail look out:
    quantity asset sub number
    1 100268 1
    1 100268 2.....
    similarly upto 100......
    THis is done in account assignment tab of PO.
    REQUIREMENT:
    when i am giving asset number 100268 sysytem should automatically give/propose 100 sub number as we have defined 100 sub number in as11 for that asset number. I.e: when we are putting asset number 100268 in the item overview it should reflect 100 quantities in item detail.
    is it possible???
    pl discuss...
    in the sub item field the asset number 100268 will automatically divide into 100 sub numbers automatically.

    Hi,
    This is unfortunately not possible with standards but you may try using Badi ME_PROCESS_PO_CUST => PROCESS_ACCOUNT.
    Regards

  • Mapping issue replicating sub nodes

    Here's what I have
    Messages 1:1
    Source_MT 1:1
    - OrderNum 1:unbounded
    - Header 1:1
    - - Text 1:unbounded
    - - - TextId
    - - - TextLine
    Target is an RFC structure
    Messages 1:1
    BAPI_SO 1:unbounded
    - SONumber 1:1
    - Order_text
    - - Item 1:unbounded
    - - - TextId
    - - - TextLine
    In the source_MT, I have more than one text id, lets say 3 of 'em and 2 SOs. If I try to use useOneAsMany, it errors our stating I have too many values in my 1st queue which is textids.
    How can I create the same number of text ids in each BAPI_SO split by SO Number? Any idea?
    TextID  - >
    <i>OrderNum</i> ->useOneAsMany->SplitByValue-> Textid
    OrderNum  - >
    Thank you for all your feedback.

    Hi,
    I think useOneAsMany will not work for your case. Hope you have check this link already
    http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm
    You can try it in UDF
    When you map the TextID use a UDF function which will take in TextID as a queue form and set the context is from the root level. Inside the UDF loop thru all the records and add it to the resultlist. Give the output of the UDF to a SplitByValue.
    Hope this works
    Thanks,
    Prakash

  • Message Mapping - Node's sub-levels navigation

    Hi all,
    How should I code in order to navigate between different levels of a given node of the source structure?
    example:
    Main
      Struct_11
        Struct1101
          Field_1101_A
          Field_1101_B
        Struct1102
          Field_1102_A
          Field_1102_B
      Struct_22
        Struct2201
          Field_2201_A
          Field_2201_B
        Struct2202
          Field_2202_A
          Field_2202_B
    In the sample above, how should I do to map the node Struct_11 and, within a UDF (or some other way, but I only imagine through a Java UDF), access and validate Struct1101-Field_1101_A, or Struct1102-Field_1102_B, etc?
    If someone could provide me with a sample code, it'd help me.
    Thank you!

    Mark, tks. It helped.
    I could do all that I needed withing the XML working as a text.
    The only problem now is that, the target structure must be built according to the source cardinality (N..N).
    In the sample bellow, see that in the source structure, the Struct_11 repeat 3 times. In the 1st and 3rd, it contains the substructure Struct1101. I have to check if Struct1101 exists, if so, I have to take the Field_1101_A and validate if it's equal to WE. If yes, then the correspondent Field_1101_B has to be sent to target <row> field.
    In the 2nd occurrence, there NO Struct1101, so the UDF returns #void#.
    UDF to map Struct_11:
    int v_pos1, v_pos2, v_start = 0;
    String v_Struct1101 = "Struct1101";
    String v_WE = "WE";
    String v_FieldA = "<Field_1101_A>WE</Field_1101_A>";
    String v_FieldB = "";
    v_pos1 = Item.indexOf(v_Struct1101);
    if(v_pos1 >= 0){
         v_pos2 = Item.indexOf(v_FieldA);
         v_start = v_pos2 + 32;
         v_FieldB = Item.substring(v_start, v_start+10);
    }else{
              v_FieldB = "#void#";
    return v_FieldB;
    Source
    <Main>
      <Struct_11>
        <Struct1101>
          <Field_1101_A>WE</Field_1101_A>
          <Field_1101_B>110</Field_1101_B>
        </Struct1101>
        <Struct1102>
          <Field_1102_A>ZS</Field_1102_A>
          <Field_1102_B>222</Field_1102_B>
        </Struct1102>
      </Struct_11>
      <Struct_11>
        <Struct1102>
          <Field_1102_A>ZS</Field_1102_A>
          <Field_1102_B>222</Field_1102_B>
        </Struct1102>
      </Struct_11>
      <Struct_11>
        <Struct1101>
          <Field_1101_A>WE</Field_1101_A>
          <Field_1101_B>112</Field_1101_B>
        </Struct1101>
        <Struct1102>
          <Field_1102_A>ZS</Field_1102_A>
          <Field_1102_B>222</Field_1102_B>
        </Struct1102>
      </Struct_11>
      <Struct_22>
        <Struct2201>
          </Field_2201_A>
          </Field_2201_B>
        <Struct2202>
          </Field_2202_A>
          </Field_2202_B>
    </Main>
    Target
    <result>
      <row>110</row></result>
    <result>
      <row>#void#</row></result>
    <result>  <row>112</row></result>
    <result> is mapped to <Struct_11>, so that for each <Struct_11>, one <result> is created.
    I've insert this sample payload and in the Definition tab, Display Queue option shows me the right result:
    110
    #void#
    112
    However, during the MM test, it throws error:
    Cannot create target element /ns0:MT_TARGET/result[2]/row. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD
    Any clue?
    Thank you !
    Edited by: rvsilvax on Sep 14, 2011 9:00 PM

  • EJB Mapping Parent child persistance not working in javax.persistance

    Hi,

    Container managed injections can only work in resources that are container managed. You mention RESTEasy so I assume JAX-RS - that was added to the JEE spec since JEE6, which JBoss 5.1 does not service (it is a JEE5 server). If you want this to work you likely have to upgrade to JBoss 6.x, in which case I advise you to go all the way to JBoss 7.1 which is an awesome piece of tech.
    When you crosspost, do mention that you do that. Otherwise you are wasting people's time when they try to answer in one site and the answer was already given in another:
    https://community.jboss.org/thread/211905?tstart=0

  • [CS3 JS] Making sub-/subsub topic (setting parent topic)

    Hi all,
    I'm trying to have my script add an index, that consists of nested topics:
    Parent
    Child
    Sub-child
    From what I can read in the Object Model there's a 'withProperties' parameter, but I just can't seem to get it working ...
    var myDocument = app. activeDocument;
    for (var j=0; j<myWord.length; j++){
    if ( j%3 == 0 ) {
    var myTopicL1 = myDocument.indexes[0].topics.add(myWord[j]);
    var myTopicL2 = myDocument.indexes[0].topics.add(myWord[j + 1].charAt(0));
    var myTopicL3 = myDocument.indexes[0].topics.add(myWord[j + 1]);
    molsted

    Simply add a topic to a subtopic:
    var myTopicL1 = myDocument.indexes[0].topics.add(myWord[j]);
    var myTopicL2 = myTopicL1.topics.add(myWord[j+1]);
    var myTopicL3 = myTopicL2.topics.add(myWord[j+2]);
    Peter

  • External Context Mapping - Pass data from Child to Parent

    Hello,
    I have the following scenario:
    DCParent Component (contains)
    - DCChildComp1    (used DC)
    - DCChildComp2    (used DC)
    - DCChildComp3    (used DC)
    - DCChildComp4    (used DC)
    What user enters in DCChildComp1 then needs to be made available to DCParent and all other DCChildComp(n) siblings.
    I have looked the posts and blogs in SDN and all of them seem to deal with passing inputField data from Parent to Child. May be I am missing it.
    In my case, I need the data to be passed from DCChildComp1 to DCParent ie Child to Parent. Then from DCParent to other DCChildComps.
    How should I go about
    a. defining the context nodes and Component Interface context nodes in parent vs child vs siblings and
    b. how should I map them externally?
    Step by step instruction would be helpful.
    Thanks in advance,
    SK.

    Thanks for all the help. As I had already seen all the links and blogs you had linked here, I was still confused about how it all came together. Finally, I got it after reading Bertram Ganz's response in this thread [Context Mapping problem;.
    when you map a context in the parent comp to an interface context in the used child component you do not define an external context mapping relation. That's normal context mapping as the data context resides in the child component.
    I have it working now and I am able to push the changes in the child component's context to the parent.
    For those who are interested in how I did it (and those who know a better way to do it
    In the child component DC:
    Map Child's View Context to Child's Controller Context
    Map Child's Controller Context to Child's Interface Controller (make sure the inputEnabled is FALSE - as the child is the data producer and the parent is the data consumer, in my case)
    In the parent DC:
    Add child DC as a Used DC
    Add child Component as a Used Component in the Parent Component
    Add Child's Interface Controller as Required Controller in Parent Component
    Map Child's Interface Controller Context to Parent's Controller Context
    Map Parent's Controller Context to Parent's View Context
    No external mapping required per the thread above. Now, any change in the child component's view is visible in the parent component view.
    Thanks again very much for the help.
    - Siva

  • Mapping problem in SOAP response to RFC response - RFC-XI-SOAP scenario

    Hi gurus,
    response structure from SOAP is as below (inbound msg - in SXMB_MONI)
    MONI and RWB shows successful(I am using graphical mapping)
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <ns0:testrequestResponse xmlns:ns0="conversion" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" Status="Success">
    - <ns0:SAP_OUT>
           <ns0:F1 Value="1234" />
           <ns0:F2 Value="2345" />
         - <ns0:SAP_LINES>
             - <ns0:SAP_LINE>
                    <ns0:SAP_L Value="1" />
                    <ns0:Field5 Value="" />
                  - <ns0:SAP_S1>
                           - <ns0:SAP_S>
                                   <ns0:ID Value="11111" />
                                   <ns0:SAP__NO Value="0001" />
                                   <ns0:DATE1 Value="08/15/2008 00:00:00:000" />
                                   <ns0:FST/>
                             </ns0:SAP_S>
                    </ns0:SAP_S1>
             </ns0:SAP_LINE>
          </ns0:SAP_LINES>
      </ns0:SAP_OUT>
      </ns0:testrequestResponse>
    I make the RFC response with same structure and mapped it but it is not giving the full structure rather it is giving only this (Outbound Msg in SXMB_MONI)
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:Z_MYRFC.Response xmlns:ns1="urn:sap-  com:document:sap:rfc:functions">
      <STATUS>Success</STATUS>
      </ns1:Z_MYRFC.Response>
    what went wrong?

    Hi,
    You would have forgot to map parent node coming after <STATUS>Success</STATUS>
    Make sure that you have properly mapped all the parents and there child.
    Are you getting the same result while Testing it standalone?
    Thanks
    Sunil Singh

  • Problem in idoc to file mapping

    Hi Experts,
    I am doing a idoc to file scenario...
    There is a single idoc with multiple header and line items .
    I am using multi mapping for header and lineitems.
    The problem i am facing is regarding the occurences in target strucure...
    at which level they should be specified so all the headers come in one strucure and line items in another...or should the occurences be o to unbounded at each field level.
    Kindly help me regarding the same ...

    hi
    i have the same scenario : IDOC (orders) to Flat File. can you plz help in mapping. the input format to XI is in the given way
    idoc
        a1---(0-1)
        a2---(0-1)
           b1--
        a3---(0-1)
           b1---(0-n)
             c1---
           b2---
             c1---
        a3---(0-n)
           b1---
           b2---
        a3---
          b1---
          b2---
        a3
          b1---
          b2---
    i have created the same output DT in the same format (parent-child) for flat file. and my questions are
    1. is that correct, do i need to create the same DT as the above idoc (like parent and child) or different?
    2. how to map the idoc fields to my file DT..do i need to map parent to parent and child to child...or different.
    plz help me out
    Thanks
    ram

  • Message mapping issue

    Hi guys,
    I am facing an issue in mapping.
    it is IDOC to File scenario.
    this is wat i have to perform.
    (MARM-UMREN / MARM-UMREZ) for PC               x                    (MARM-UMREZ / MARM-UMREN) for CAS.
    here PC and CAS both taken from MARM-MARM..which i got from my IDOC.
    How can i get make 2 values for MARM_meinh(PC and CAS).only 1 value comes in idoc.
    please provide me some logic for this.
    Thanks in advance.
    Sahil

    Hi,
    You can use advanced user defined function.
    Give input as Header element.
    add all the elements within header in the result set.
    put splitByvalue at the output of user defined funstion and map it to  sub..
    i assume that sub is unbounded.
    This should work. check this out.
    reply if it works
    thanks and regards
    P.Venkat

  • Asset capitalissation _ parent and chield

    Hi,
    I have acquired a teleconf. system. I want to creat parant and child relation for that asset. main asset will have value zero and chiled assets will have values in lakhs.
    the system is giving error :
    Mean amount from 25,000.00 INR exceeds low value asset maximum amount
    Message no. AA615
    What should i do? in parent chield kinda structure how should i capitalise the asset?
    Pl. help
    Regds
    Vedavatee

    Hi,
    I believe you are creating an asset from Low value asset class and you entered maximum amount for low value asset class, go and remove the amount you entered at LVA class.
    1. IF you wanted to see the all the values of the Main asset and sub asset, go to aw01n and give the main asset number and in the sub asset give as *, this will give you the value of parent and sub assets together.
    Thanks,
    CM Reddy

Maybe you are looking for

  • "Build Application/settings/Advanced/Run after installation" is not working LV70

    Hi ! Look at thread http://forums.ni.com/ni/board/message?board.id=170&message.id=129269 Seems like "Run executable after installation" is not workin at all (LV70, W2K). I' been try all, - run directly *.BAT file - i great exe file what' s runn *.BAT

  • Can i import my music from my iphone to my Mac?

    Hey Guys, Struggling a bit here, have tried to search other posts but with no luck. Basically, i recently spilt a pint of water over my PC, completely ruining it. Luckily insurance paid out and I used the money to put towards a new Mac. Basically, I

  • Problem in deploying an ear file in weblogic 8.1 SP5

    Hi, When I tried deploying my ear file in Weblogic 8.1 SP5, I am getting the following error: weblogic.management.ApplicationException: Exception:weblogic.management.ApplicationException: prepare failed for counter-ejb.jar Module: counter-ejb.jar Err

  • MDM search text iView --when searchnode it should displayall parents&childs

    Hi all I have create one page & added three iViews to that page. one is MDM search text iView second is resultset iView & third is Itemdetails iView. actually my requirement is when i search for any node in the search text iView then it has to displa

  • Empty cell until value entered in different cell

    I am trying to create a formula that will leave a certain cell empty until the first cell is populated. The problem is that the cell that first needs to be populated will not have the same value in it.  Basically, I am creating a daily chart where I