Repeating XML in Tree Display

I am using a Data Provider to load an xml file into a Tree
structure. My xml file has repeating nodes of <container> and
<product>, they are nested arbitrarily to reflect a proof of
concept. When I load this file into a Tree structure I get
repeating nodes, however in the original xml file, of course, these
nodes do no appear.
My call to load the xml into a XMLList through a Handler
function is as follows:
[Bindable]
private var dishesDP:XMLList;
private function dishesXMLHandler(event:ResultEvent):void
dishesDP = event.result..container;
The incorrect XML being loaded into my XMLList:
<container title="Pants" description="These go on your
legs">
<container title="Jeans" description="They are blue and
last a long time.">
<product id="1" title="Levi's Denium" description="Nice
normal blue jeans." price="17.50" image="image2.jpg"/>
<product id="2" title="Abercombie" description="Did
someone already wear these?? They got holes in them?" price="24.95"
image="image2.jpg"/>
</container>
<container title="Slacks" description="Nice than jeans,
wear them to work.">
<product id="3" title="Dockers" description="Boring old
people pants." price="14.95" image="image4.jpg"/>
<product id="4" title="Old Navy" description="Cheap
slacks, always got something slightly weird about them."
price="18.75" image="image4.jpg"/>
</container>
</container>
<container title="Jeans" description="They are blue and
last a long time.">
<product id="1" title="Levi's Denium" description="Nice
normal blue jeans." price="17.50" image="image2.jpg"/>
<product id="2" title="Abercombie" description="Did
someone already wear these?? They got holes in them?" price="24.95"
image="image2.jpg"/>
</container>
<container title="Slacks" description="Nice than jeans,
wear them to work.">
<product id="3" title="Dockers" description="Boring old
people pants." price="14.95" image="image4.jpg"/>
<product id="4" title="Old Navy" description="Cheap
slacks, always got something slightly weird about them."
price="18.75" image="image4.jpg"/>
</container>
The orginal (and correct) XML, existing in a remote file:
<root>
<container
title="Pants"
description="These go on your legs">
<container
title="Jeans"
description="They are blue and last a long time.">
<product
id="1"
title="Levi's Denium"
description="Nice normal blue jeans."
price="17.50"
image="image2.jpg"
/>
<product
id="2"
title="Abercombie"
description="Did someone already wear these?? They got holes
in them?"
price="24.95"
image="image2.jpg"
/>
</container>
<container
title="Slacks"
description="Nice than jeans, wear them to work.">
<product
id="3"
title="Dockers"
description="Boring old people pants."
price="14.95"
image="image4.jpg"
/>
<product
id="4"
title="Old Navy"
description="Cheap slacks, always got something slightly
weird about them."
price="18.75"
image="image4.jpg"
/>
</container>
</container>
The actually application link can be provided if necessary.
Thank you for your time,
Ryan

Hi Charu,
Go through below sample.
Link: [ALV TREE|http://wiki.sdn.sap.com/wiki/display/ABAP/CallFMtogeneratealvtreeanddealwithuseraction].
Regards,
Maruthi

Similar Messages

  • Re-display repeating XML data in dynamic form

    I have a dynamic form with repeating data in my XML that populates it. I need to display the repeating data in one of 2 different ways, depending on which business segment the user viewing it is associated with. I have tried 2 ways to accomplish this, neither has worked for me.
    Attempt 1: Create 2 separate subforms and hide the one that should not be shown. The first subform in the layout displays just fine and is populated with records, but the second subform never displays any records. This appears to be an issue with the XML node already having been parsed and displayed and does not get displayed again. Is there a way to move the cursor, or pointer, or whatever you call it in XML-speak back to the top of a repeating node to re-display data?
    Attempt 2: Create a single subform that contains 2 other subforms - one for each view, which lay atop each other. A script command hides the view the shouldn't be displayed. The problem I ran into here is that the records don't display properly. In my example, there are 3 records in the repeating section, the first displays fine, the second is missing some fields and is pulling some data from the first record. The third record displays no data at all. I deleted the one of the 2 subforms and previewed the form again, now all of the records displayed just as they should.
    Any ideas or suggestions would be appreciated.
    Thanks,
    Chad

    That code also produces text in the textfield.  What "specific parts" are you trying to display?
    textfield.text = (xml.bar[0].text());
    textfield.text = (xml.bar[1].text());

  • Error when running a JHeadstart generated two-level tree display

    Dear All,
    I have a simple master detail VO/VO datamodel based on which I'd like to generate a two-level tree display. I've followed the JHeadstart dev guide meticulously.
    When I run the page I get an error:
    javax.faces.el.PropertyNotFoundException: Error getting property 'name' from bean of type oracle.jbo.uicli.binding.JUCtrlHierTypeBinding
    It turns out that this generated code in a region file is the root cause:
    <af:switcher facetName="#{node.hierType.name}">
    <!-- DEBUG:BEGIN:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2 -->
    <f:facet name="MutatieSoortTypenNode">
    <af:outputText value="#{node.Omschrijving}"/> </f:facet>
    <!-- DEBUG:END:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2-->
    <!-- DEBUG:BEGIN:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2 -->
    <f:facet name="MutatieSoortenBijTypeNode">
    <af:outputText value="#{node.Omschrijving}"/> </f:facet>
    <!-- DEBUG:END:TREE_NODE : default/misc/tree/treeNode.vm, nesting level: 2-->
    </af:switcher>
    When I substituted the <af:switcher> .... </af:switcher> xml code by <af:outputText value="#{node.Omschrijving}"/>, the page displayed correctly.
    Given the fact that the code is generated, there doesn't seem to be much that I can do about it.
    We're using JDeveloper version 10.1.3.3.0 and JHeadstart version 10.1.3.2.41.
    Any help or suggestion would be much appreciated.
    Kind regards,
    Ibrahim

    Ibrahim,
    I cannot reproduce this. You are using a non-production build. Can you upgrade to JHeadstart 10.1.3.2.52?
    If the problem persists, you can work around it by creating a custom template for tree.vm which includes the af:switcher statement.
    Steven Davelaar,
    JHeadstart team.

  • Parsing large xml file and display using swing

    Hi all,
    I want to read a large xml file and display graphically in swing as a tree structure.
    I implemented it and works fine for files of 5MB size after increasing the jvm heap size (-Xmx). If the file size is larger than 5MB it throws out of memory error. I'm creating a custom datastructure from the xml and I'm using sax parsing.
    After displaying the datastructure, the user could do some operation on this, like search etc.
    Can any of you suggest a method, to support larger files ? What I'm looking for is create the datastructure in file system, rather than in memory.
    Any other tips for memory management would be greatly appreciated
    Thanks in Advance.
    Nisha

    Use a memory-mapped file?
    http://javaalmanac.com/egs/java.nio/CreateMemMap.html

  • Editable Field in ALV TREE Display Using OOPs

    Hi,
    I am trying to make a field editable on the ALV Tree display. I could create an editable check box. But could not make a field Editable. I have made EDIT = 'X' in the fieldcatalog for the particular field. but  it is not working.
    Please help me in solving this. Its very urgent.

    You do this with the following code example
      DATA: ls_layout TYPE lvc_s_layi.
      CLEAR ls_layout.
      ls_layout-class     = cl_item_tree_control=>item_class_text.
      ls_layout-editable   = 'X'.
      ls_layout-fieldname = your fieldname.
      APPEND ls_layout TO lt_layout.
    add PO header to tree
          CALL METHOD tree->add_node
            EXPORTING
              i_relat_node_key = space
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = l_node_text
              is_outtab_line   = ls_po_item
              is_node_layout   = wa_layout_node
              it_item_layout   = lt_layout
    Roy

  • Double click in ALV tree display....

    Hi all,
    I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
    My code as of now is as below:
    Please tell how to handle events in this report tree display and how and where to write the code for this functionlity of double click.
    FORM alv_tree.
    PERFORM build_sort_table.  “----
    table is sorted
    create container for alv-tree
      DATA: l_tree_container_name(30) TYPE c,
            l_custom_container TYPE REF TO cl_gui_custom_container.
      l_tree_container_name = 'TREE1'.
      CREATE OBJECT l_custom_container
          EXPORTING
                container_name = l_tree_container_name
          EXCEPTIONS
                cntl_error                  = 1
                cntl_system_error           = 2
                create_error                = 3
                lifetime_error              = 4
                lifetime_dynpro_dynpro_link = 5.
    create tree control
      CREATE OBJECT tree1
        EXPORTING
            i_parent              = l_custom_container
            i_node_selection_mode =
                                  cl_gui_column_tree=>node_sel_mode_multiple
            i_item_selection      = 'X'
            i_no_html_header      = ''
            i_no_toolbar          = ''
        EXCEPTIONS
            cntl_error                   = 1
            cntl_system_error            = 2
            create_error                 = 3
            lifetime_error               = 4
            illegal_node_selection_mode  = 5
            failed                       = 6
            illegal_column_name          = 7.
    create info-table for html-header
      DATA: lt_list_commentary TYPE slis_t_listheader.
      PERFORM build_comment USING
                     lt_list_commentary. “----
    already created
    repid for saving variants
      DATA: ls_variant TYPE disvariant.
      ls_variant-report = sy-repid.
    register events
      PERFORM register_events.
    create hierarchy
      CALL METHOD tree1->set_table_for_first_display
              EXPORTING
                   it_list_commentary   = lt_list_commentary
                   i_background_id      = 'ALV_BACKGROUND'
                   i_save               = 'A'
                   is_variant            = ls_variant
              CHANGING
                   it_sort              = gt_sort[]
                   it_outtab            = itab_outtab
                   it_fieldcatalog      = t_fieldcat. "gt_fieldcatalog.
    expand first level
      CALL METHOD tree1->expand_tree
             EXPORTING
                 i_level = 1.
    optimize column-width
      CALL METHOD tree1->column_optimize
               EXPORTING
                   i_start_column = tree1->c_hierarchy_column_name
                   i_end_column   = tree1->c_hierarchy_column_name.
    ENDFORM.                    " alv_tree
    FORM register_events.
    define the events which will be passed to the backend
      data: lt_events type cntl_simple_events,
            l_event type cntl_simple_event.
    define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_header_click.
      append l_event to lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
      append l_event to lt_events.
      call method tree1->set_registered_events
        exporting
          events = lt_events
        exceptions
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
    ENDFORM.                    " register_events

    hi
    (also check u have refresh the field)
    Check the demo program,In this double click the data fields it will display some field in screen,You can check it
    BCALV_GRID_DND_TREE
    Thanks
    Edited by: dharma raj on Jun 17, 2009 7:41 PM

  • Creating Variants in MIGO to block tree display in item overview

    Hi,
    I would like to know how to create Screen Variants in MIGO to hide the Tree display from the Item overview block.
    Also I wish to know how to set this variant as default settings. Because of this, user will not be able to even view the the sub-parts during GR.
    I am looking for this,  to prevent users from removing the sub-parts which are under that parent part.
    So they can be allowed to display only during display of document.
    Would be more thankful if you can send the detail steps to [email protected]
    Thanks,
    Pri

    Hi gurus,
    Can I have your advise on how to proceed for the below setting up of Screen variants in MIGO?
    Appreciate your response !
    Will sure reward for useful tips !
    regards,
    pri

  • Multi-level nested tables for repeatable XML Elements

    Hi there,
    Suppose we have a XML Schema „ASchema“ like this (XMLDB schema annotations are left out for simplicity):
    <xs:schema xmlns:xs=" .... " />
    <xs:element name=“A“>
         <xs:complexType>
              <xs:sequence>
                   <xs:element name=“B“ maxOccurs=“unbounded“/>
                        <xs:complexType>
                             <xs:sequence>
                                  <xs:element name = “C“ maxOccurs=“unbounded“/>
                             </xs:sequence>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
    </xs:element>
    </xs:schema>
    After registering this schema in Oracle, I can define a table like this:
    CREATE TABLE ATable
    id NUMBER,
    doc XMLTYPE
    XMLTYPE COLUMN doc
    XMLSCHEMA “ASchema“ ELEMENT “A“
    VARARRAY doc.“XMLDATA“.“B“ STORE AS TABLE “BTable“
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
    This creates a nested table "BTable" within the table "ATable". So far so good, I can use this nested table to gain faster access on every possible subelement of Element B when I set an appropriate index.
    I now want to create another nested table for element “C“ like this:
    DROP TABLE ATable;
    CREATE TABLE ATable
    id NUMBER,
    doc XMLTYPE
    XMLTYPE COLUMN doc
    XMLSCHEMA “ASchema“ ELEMENT “A“
    VARARRAY doc.“XMLDATA“.“B“ STORE AS TABLE “BTable“
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
    VARARRAY doc.“XMLDATA“.“B“.“C“ STORE AS TABLE “CTable“
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX)
    But this statement fails with the error message something like „ ... no such attribute ... „
    And here's my question: is it possible to create nested tables for repeatable XML Elements that are subelements of other repeatable XML Elements ? And if so, how can I do it ?
    Thank you very much in advance
    Jan

    Found a (partial) solution myself:
    If you add the attribute xdb:storeVarrayAsTable="true" to the root element of the XML schema, Oracle XMLDB generates nested tables for all repeatable XML Elements while registering the XML schema.
    Unfortunately, the names of these nested tables are system-generated, hence it's a bit uncomfortable to set indices on them. You can find out the names of these nested tables as follows:
    select table_name, parent_table_name, parent_table_column from user_nested_tables;
    Further information on that subject is supplied in the following thread:
    Re: default tables for elements with maxoccurs > 1
    It would be nice if there was a way to name the generated nested tables via appropriate XMLDB schema annotations.
    regards
    Jan

  • Tree Display in WAD

    Hi all experts,
    I want to create a tree display, in which i have to hard code the some values.
    After clicking on those values I will link some reports.
    Can anybody please tell, is there any functionality available to create the tree display ?  Or I will have to go by coding in HTML / JAVA Script ?
    The display i want is like below.
    Root
          aaa
                 aaa1
                 aaa2
           bbb
                 bbb1
                 bbb2.
    by clicking on aaa1 it will have another link.
    Regards
    Vinay

    Hi Gillian,
    My requirement is I have to just hard code the tree like structure in WAD.  Later on I can link the things. 
    I have created and called the images, which on clicking, will change.. eg,, Plus and Minus., and open respective subtrees.
    Now the problem is I will have to join those images with horizontal and vertical lines. 
    That seems bit difficult. 
    I am new to WAD and JAVASCRIPT.
    Thats why I am searching <b>is there any code / functionality is available in javascript, which will give the tree like structure.</b>
    Waiting for your reply..
    Regards
    Vinay

  • Could xml files be displayed in a more readable / structured way?

    Within a software test environment, xml files have to be checked on their content. When using the "View Page Source" the xml file is displayed as it is.
    It would be very helpful if Firefox would have an option to display xml files in a more structured way to make then more readable.
    This will save a lot of time, because now the file should first be downloaded and opened in another application.

    Hi Atul,
    The standard DMS system does not offer this feature!!
    However,there are a couple of options you may explore.
    - In SE38,run report DMS_KPRO_READ to retrieve the original file names of a DIR.
    - Alternatively,you may also implement SAP Note 1015165 to display file names of a DIR.
    Hope this helps.
    Regards,
    Pradeepkumar Haragoldavar

  • Tree Display

    Hi guys.
    I want to create a tree display based on the following SAP standard program
    SAPSIMPLE_TREE_CONTROL_DEMO.
    Instead of "ROOT" i would like to display all company codes.
    While clicking the Company Code it should display all the plants under that specific company code.
    can anyone help me out?

    in the standard porgram SAPSIMPLE_TREE_CONTROL_DEMO ...
    The  Root was  defualt  passed  ....  if you want to  pass  the company  code  then ...
    write  a  select  query for Company code and  pass  it ...... in  the below example  i am passing the <b>Purchase  order  list  to the RooT</b>. ....
    FORM create_alvtree_hierarchy .
      DATA: NODE LIKE MTREESNODE,
            ld_node type string.
      LOOP AT it_ekko INTO wa_ekko.
    * Build the node table.
    * Caution: The nodes are inserted into the tree according to the order
    * in which they occur in the table. In consequence, a node must not
    * occur in the node table before its parent node.
    *   Node with key 'Root'
        <b>node-node_key = wa_ekko-ebeln.</b> " 'Root'.   "#EC NOTEXT
        " Key of the node
        CLEAR node-relatkey.      " Special case: A root node has no parent
        CLEAR node-relatship.     " node.
        node-hidden = ' '.        " The node is visible,
        node-disabled = ' '.      " selectable,
        node-isfolder = 'X'.      " a folder.
        CLEAR node-n_image.       " Folder-/ Leaf-Symbol in state "closed":
        " use default.
        CLEAR node-exp_image.     " Folder-/ Leaf-Symbol in state "open":
        " use default
        CLEAR node-expander.      " see below.
        node-text = wa_ekko-ebeln.      "'Root'.
        APPEND node TO node_table.
        LOOP AT it_ekpo INTO wa_ekpo WHERE ebeln EQ wa_ekko-ebeln.
    *     Node with key wa_ekpo-ebelp    "'Child1'
          ld_node = sy-tabix.
          concatenate wa_ekpo-ebelp ld_node into ld_node.
          node-node_key = ld_node.  "'Child1'. #EC NOTEXT
    *     Node is inserted as child of the node with key wa_ekpo-ebeln  "'Root'.
          node-relatkey = wa_ekpo-ebeln.  " 'Root'.
          node-relatship = cl_gui_simple_tree=>relat_last_child.
          node-hidden = ' '.
          node-disabled = ' '.
          node-isfolder = ' '.
          CLEAR node-n_image.
          CLEAR node-exp_image.
          node-expander = ' '.  " The node is marked with a '+', although
    *                        it has no children. When the user clicks on the
    *                        + to open the node, the event
    *                        expand_no_children is fired. The programmer can
    *                        add the children of the
    *                        node within the event handler of the
    *                        expand_no_children event
    *                        (see method handle_expand_no_children
    *                        of class lcl_application)
          node-text = wa_ekpo-ebelp.
          APPEND node TO node_table.
        ENDLOOP.
      ENDLOOP.
    * Add nodes to alv tree
      CALL METHOD GD_TREE->ADD_NODES
        EXPORTING
          TABLE_STRUCTURE_NAME = 'MTREESNODE'
          NODE_TABLE           = NODE_TABLE
        EXCEPTIONS
          FAILED                         = 1
          ERROR_IN_NODE_TABLE            = 2
          DP_ERROR                       = 3
          TABLE_STRUCTURE_NAME_NOT_FOUND = 4
          OTHERS                         = 5.
    ENDFORM.                    " create_alvtree_hierarchy
    reward points if it is usefull ..
    Girish

  • Code to read xml file  and display that data using sax parser

    Hai
    My problem I have to read a xml file and display the contents of the file on console using sax parser.

    here you go

  • Repeating XML Elements

    We have a pdf form, created in designer...<br />All is well except for repeating xml tags.<br /><br /><state>IN</state><br /><statededuction>50.00</statededuction><br /><state>TX</state><br /><statededuction>150.00</statededuction><br /><br />Fields are global......<br /><br />The XML can contain one or 2 instances of the <state> tag.<br />When there is 1 instance, IN shows in both fields on the form.<br />When there are 2 instances for the <state> tag, TX shows in both fields.<br /><br />According to the documentation, the "Order" of the fields will help<br />adobe know that the first occurrence of <state> in the xml file, goes in the first occurrence of field "state" on the pdf template.  I have correctly ordered the fields, to no avail.<br /><br />Any thoughts?<br />Thank you!

    Thank you very much for your reply!<br /><br />You are correct, removing the global makes the 2 occurrences show correctly.  <br /><br />However, I have to have a 2nd copy of the same form and without the fields being global, they won't show on the 2nd copy.<br /><br />You are right, it works very well if I have unique names.<br /><state1>....<br /><state2>....<br /><br />Unfortunately, I'm not sure I can edit the inbound data.<br />I will try.  We are trying to minimize the impact on the application<br />and handle the data exactly as it is used for the html copy of the form.<br /><br />PS:  Are there other options:<br />1) can I somehow use a subform?<br />2) can designer apply a style sheet to convert the repeating <br />tags to unique names.<br />3) Transformation Editor is not an option, right - since it doesn't<br />allow xml input, right?<br />4) Other thoughts?<br /><br />LarryG

  • I am displaying status (traffic signal ) in output screen in tree display

    hi all,
    i am displaying status (traffic signal ) in output screen in tree display but instead its displaying <b>@08@</b> like text format....is there any need of conversion....
    but it works in normal ALV grid layout.
    please suggest a solution....... !
    regards.
    sivaram.

    You need to do the following three steps in order to have "status" indicators on your ALV list:
    (1) Add a status or exception field to your itab definition, e.g.
    TYPES: BEGIN OF ty_s_outtab.
    TYPES:  status(4)    TYPE c.      " status field for LED / traffic light
    INCLUDE TYPE KNB1.
    TYPES: END OF ty_s_outtab.
    DATA:
      gt_outtab  TYPE STANDARD TABLE OF ty_s_outtab
                               WITH DEFAULT KEY.
    (2) Define the status field in the layout (LVC_S_LAYO):
      gs_layout-excp_fname = 'STATUS'.  " name of the status/exception field
      gs_layout-excp_led = 'X'.  " display LEDs, else traffic lights
    (3) Loop over the itab and set the appropriate status:
      LOOP AT gt_outtab INTO ls_outtab.
        IF ( <condition is fulfilled> ).
          ls_outtab-status = '3'.   " green
       ELSEIF ( <condition partially fulfilled> ).
          ls_outtab-status = '2'.   " yellow
       ELSE.
          ls_outtab-status = '1'.   " red
       ENDIF.
        MODIFY gt_outtab FROM ls_outtab.
      ENDLOOP.
    reward  points if it is usefull....
    Girish

  • Tree Display - Hierarchies

    Hello Experts,
                   I am trying to display a hierarchy from BI in VC. There are at least two workarounds methods that are found in SDN. Does anyone know when or which SP a tree display UI element is supported in VC?
    I am using NW 7 sp13.
    Thank you,
    Kiran

    Marcel,
    Based on Adobe's documentation, Flex 3 supports hierarchies. Do you know if VC in CE 7.1 supports Flex 3?
    Thanks,
    Kiran

Maybe you are looking for