Changing flat XML into nested

I'm working on a tree navigation that needs to have some data provided in a nested xml format
<node label="California">
     <node label="location 1" />
     <node label="location 2">
          <node label="option 1" />
          <node label="option 2" />
     </node>
</node>
But the data that I'm getting (and probably can't change) is coming out flat:
<item>
     <id>12</id>
     <label>California</label>
</item>
<item>
     <id>15</id>
     <label>location 1</label>
     <parent>12</parent>
</item>
<item>
     <id>17</id>
     <label>location 2</label>
     <parent>12</parent>
</item>
<item>
     <id>33</id>
     <label>option 1</label>
     <parent>17</parent>
</item>
<item>
     <id>70</id>
     <label>loption 2</label>
     <parent>17</parent>
</item>
Any suggestions on how to change that data from what I'm supplied to what I need? Is it just a brute force looping through the xml nodes a bunch of times? Or is there a clever way that I'm not seeing?

If you are sure about data integrity, especially ids relationships, the following is one of the ways to reposition nodes without changing general node structure. Following this logic you can restructure XML altogether.
With that said, I am not sure XML restructuring is the best way to go anyway. I feel a much better solution would be to parse XML into a more native to AS3 structure like Array, Object or Vector. I would rather create a specialized data provider class.
Example uses the following XML:
<items>
    <item>
        <id>1</id>
        <label>California</label>
    </item>
    <item>
        <id>2</id>
        <label>California location 1</label>
        <parent>1</parent>
    </item>
    <item>
        <id>3</id>
        <label>California location 1 option 1</label>
        <parent>2</parent>
    </item>
    <item>
        <id>4</id>
        <label>California location 1 option 2</label>
        <parent>2</parent>
        </item>
    <item>
        <id>5</id>
        <label>California location 1 option 3</label>
        <parent>2</parent>
    </item>
    <item>
        <id>6</id>
        <label>California location 2</label>
        <parent>1</parent>
    </item>
    <item>
        <id>7</id>
        <label>California location 2 option 1</label>
        <parent>6</parent>
    </item>
    <item>
        <id>8</id>
        <label>California location 2 option 2</label>
        <parent>6</parent>
    </item>
    <item>
        <id>9</id>
        <label>New York</label>
    </item>
    <item>
        <id>10</id>
        <label>New York location 1</label>
        <parent>9</parent>
    </item>
    <item>
        <id>11</id>
        <label>New York location 1 option 1</label>
        <parent>10</parent>
    </item>
    <item>
        <id>12</id>
        <label>New York location 1 option 1</label>
        <parent>10</parent>
    </item>
</items>
Code that parses this xml is (given the value of the xml above is assigned to var xml:XML
var parent:XMLList;
for each (var node:XML in xml.item)
    if (node.parent.toString() != "")
        parent = xml.item.(id == node.parent.toString());
        if (parent.parent.toString() == "")
            parent.@["type"] = "top";
        node.@["type"] = "child";
        parent.appendChild(node);
xml = new XML(xml.toString());
while (xml.item.(@type == "child").length() > 0)
    delete xml.item.(@type == "child")[0];
trace(xml);
Output is:
<items>
    <item type="top">
        <id>1</id>
        <label>California</label>
        <item type="child">
            <id>2</id>
            <label>California location 1</label>
            <parent>1</parent>
            <item type="child">
                <id>3</id>
                <label>California location 1 option 1</label>
                <parent>2</parent>
            </item>
            <item type="child">
                <id>4</id>
                <label>California location 1 option 2</label>
                <parent>2</parent>
            </item>
            <item type="child">
                <id>5</id>
                <label>California location 1 option 3</label>
                <parent>2</parent>
            </item>
        </item>
        <item type="child">
            <id>6</id>
            <label>California location 2</label>
            <parent>1</parent>
            <item type="child">
                <id>7</id>
                <label>California location 2 option 1</label>
                <parent>6</parent>
            </item>
            <item type="child">
                <id>8</id>
                <label>California location 2 option 2</label>
                <parent>6</parent>
            </item>
        </item>
    </item>
    <item type="top">
        <id>9</id>
        <label>New York</label>
        <item type="child">
            <id>10</id>
            <label>New York location 1</label>
            <parent>9</parent>
            <item type="child">
                <id>11</id>
                <label>New York location 1 option 1</label>
                <parent>10</parent>
            </item>
            <item type="child">
                <id>12</id>
                <label>New York location 1 option 1</label>
                <parent>10</parent>
            </item>
        </item>
    </item>
</items>

Similar Messages

  • Transforming XML into nested Internal Table via Call Transformation XSLT

    Hi guys!
    I am relatively new to this XML transformation to Abap Internal table. Hence I got help some help from this thread ABAP Development as well as referencing Txn SSTDEMO1 and SSTDEMO2
    But I tried to attempt on my prog it failed. Heres my sample XML, XSLT & as well as Internal Table.
    The good news is I am able to read in a BID item under bidlist BUT with no fields filled in the table.... Pls help....
    <b><u>XML</u></b>
    <?xml version="1.0" encoding="iso-8859-1"?>
    <myXML>
      <BIDLIST>
        <BID>
          <HEADER>
            <DOC_CODE>4000000343</DOC_CODE>
            <RESPONSE_NO>80000003</RESPONSE_NO>
            <RESPONSE_DATE>2006-10-01</RESPONSE_DATE>
            <SUPP_CODE>44</SUPP_CODE>
            <SUPP_SITE_ID>44</SUPP_SITE_ID>
            <SUPP_CONTACT_NAME>JIM BEAN</SUPP_CONTACT_NAME>
           <SUPP_CONTACT_PHONE>+6512345678</SUPP_CONTACT_PHONE>
            <SUPP_CONTACT_EMAIL>[email protected]</SUPP_CONTACT_EMAIL>
            </HEADER>
          </BID>
        </BIDLIST>
    <myXML>
    <u><b>XSLT</b></u>
    <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:sap="http://www.sap.com/abapxml"
    >
    <xsl:template match="/">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml">
    <asx:values>
        <BID_RESPONSE>
            <xsl:for-each select="myXML/BIDLIST/BID">
            <LBID>
                <xsl:for-each select="HEADER">
                <LHEADER>
                            <DOC_CODE> <xsl:value-of select="DOC_CODE"/> </DOC_CODE>
                            <RESPONSE_NO> <xsl:value-of select="RESPONSE_NO"/> </RESPONSE_NO>
                            <RESPONSE_DATE> <xsl:value-of select="RESPONSE_DATE"/> </RESPONSE_DATE>
                            <SUPP_CODE> <xsl:value-of select="SUPP_CODE"/> </SUPP_CODE>
                            <SUPP_SITE_ID> <xsl:value-of select="SUPP_SITE_ID"/> </SUPP_SITE_ID>
                            <SUPP_CONTACT_NAME> <xsl:value-of select="SUPP_CONTACT_NAME"/> </SUPP_CONTACT_NAME>
                            <SUPP_CONTACT_PHONE> <xsl:value-of select="SUPP_CONTACT_PHONE"/> </SUPP_CONTACT_PHONE>
                            <SUPP_CONTACT_EMAIL> <xsl:value-of select="SUPP_CONTACT_EMAIL"/> </SUPP_CONTACT_EMAIL>
                </LHEADER>
            </xsl:for-each>
            </LBID>
            </xsl:for-each>
        </BID_RESPONSE>
    </asx:values>
    </asx:abap>
    </xsl:template>
    </xsl:transform>
    <u><b>Internal Table</b></u>
    TYPES: BEGIN OF T_HEADER,
            DOC_CODE(17),
            RESPONSE_NO(8),
            RESPONSE_DATE(10),
            SUPP_CODE(16),
            SUPP_SITE_ID(15),
            SUPP_CONTACT_NAME(140),
            SUPP_CONTACT_PHONE(23),
            SUPP_CONTACT_EMAIL(100),
           D_HEADER TYPE T_HEADER OCCURS 0.
    TYPES: BEGIN OF T_BID,
            HEADER TYPE D_HEADER,
           END OF T_BID,
           D_BID TYPE T_BID OCCURS 0.
    TYPES: BEGIN OF T_BIDLIST,
            BID TYPE D_BID,
           END OF T_BIDLIST,
           D_BIDLIST TYPE T_BIDLIST OCCURS 0.
    TYPES: BEGIN OF TYPE_DATA,
            BIDLIST TYPE D_BIDLIST,
           END OF TYPE_DATA.
    DATA: BID_RESPONSE TYPE TABLE OF TYPE_DATA.

    hi
    good
    go through these links, i hope these ll help you to solve your problem.
    http://sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/15ecdf90-0201-0010-d792-941a3c3c30a4
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/d-f/from%20xml%20to%20abap%20data%20structures%20and%20back%20bridging%20the%20gap%20with%20xslt
    thanks
    mrutyun^

  • Changing XML document nesting

    Hello,
    I am trying to change the xml nesting (parent - child) relationships for a returned xml query. I am getting java.lang.Nullpointerexcetion on the following line of code:
    tempNode := xmldom.appendChild(newRootNode,oldNode);
    I have initialized in the following manner:
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    len number;
    newlen number;
    newDOMDoc xmldom.DOMDocument;
    oldDOMDoc xmldom.DOMDocument;
    newNodeList xmldom.DOMNodeList;
    oldNodeList xmldom.DOMNodeList;
    newNode xmldom.DOMNode;
    oldNode xmldom.DOMNode;
    tempNode xmldom.DOMNode;
    newRootNode xmldom.DOMNode;
    newPatientNode xmldom.DOMNode;
    newPatientDeathNode xmldom.DOMNode;
    newParentNode xmldom.DOMNode;
    newDrugNode xmldom.DOMNode;
    newElem xmldom.DOMElement;
    BEGIN
    /* Initialize */
    ClbIDoc := IDomDoc;
    p := xmlparser.newparser;
    newDOMDoc :=xmldom.newDOMDocument;
    newRootNode := xmldom.makeNode(newDOMDoc);
    newElem := xmldom.createElement(newDOMDoc,'root');
    newRootNode := xmldom.appendChild(newRootNode,xmldom.makeNode(newElem));
    xmlparser.parseclob(p, ClbIDoc);
    tempNode := xmldom.makeNode(newDOMDoc);
    -- get old document
    oldDOMDoc := xmlparser.getDocument(p);
    -- get the message header
    oldNodeList := xmldom.getElementsByTagName(oldDOMDoc,'messageheader');
    -- there should be only one header in the document
    oldNode := xmldom.item(oldNodeList, 0);
    -- put the header into the new document
    tempNode := xmldom.appendChild(newRootNode,oldNode);
    -- get the saftey report
    oldNodeList := xmldom.getElementsByTagName(oldDOMDoc,'report');
    -- there should be only one report in the document
    oldNode := xmldom.item(oldNodeList, 0);
    -- put the saftey report into the new document
    tempNode := xmldom.appendChild(newRootNode,oldNode);
    Any help would be greatly appreciated!!
    Also, if there is a more convienent method for changing the nesting I would be open to other suggestions.
    Thanks,
    Scott
    null

    I'm not sure if this will be of help or not but I have a custom action handler that writes XML out to the file system but moves the nodes around slightly befor writing the file. After a day of trial and error I finaly found a method tat works, here is the code:
    import java.io.*;
    import java.lang.String.*;
    import java.sql.SQLException;
    import oracle.xml.parser.v2.XMLDocument;
    import oracle.xml.xsql.*;
    import oracle.xml.xsql.actions.XSQLIncludeXSQLHandler;
    import org.w3c.dom.*;
    public class WriteXMLToFile extends XSQLActionHandlerImpl
    //the first three variables are parameter names the action handler looks for
    private static final String BASETAG = "base-tag";
    private static final String FILEATTR = "file";
    private static final String DIRATTR = "dir";
    //this fourth one is the base directory for saving the files. The user may specify
    //and existing directory with in this directory but cannot escape out of it
    private static final String BaseDir = "/u01/oracle/ias10210/xdk/java/xsql/XMLRepository/";
    public void handleAction(Node rootNode) throws SQLException
    //The Element actElt is a refrence to the document that is used to get
    //the parameter values if they exist
    Element actElt = getActionElement();
    //this block gets the values for the three parameters
    String targetFileName = getAttributeAllowingParam(FILEATTR, actElt);
    String targetDirName = getAttributeAllowingParam(DIRATTR, actElt);
    String baseTagName = getAttributeAllowingParam(BASETAG, actElt);
    //The filePathName will be used to create a directory/file path to be appended to
    //the BaseDir constant when saving the file
    String filePathName = "";
    //searchNode is used to keep track of the current node name be looked for
    String searchNode = "";
    int oldIndex = 0;
    int currentIndex = 0;
    boolean keepLooking = true;
    boolean moveSuccesfull = false;
    // Must have a "file" attribute on the action element
    if (targetFileName == null &#0124; &#0124; targetFileName.equals(""))
    this.reportMissingAttribute(rootNode, FILEATTR);
    return;
    // Must have a "base-tag" attribute on the action element
    if (baseTagName == null &#0124; &#0124; baseTagName.equals(""))
    this.reportMissingAttribute(rootNode, BASETAG);
    return;
    //The base-tag must start with a / so our search through the string works right
    if (!baseTagName.startsWith("/"))
    this.reportError(rootNode, "The 'base-tag' must begin with a '/'.");
    return;
    //The base-tag must also end with a / so our search through the string works right
    if (!baseTagName.endsWith("/"))
    this.reportError(rootNode, "The 'base-tag' must end with a '/'.");
    return;
    //The base-tag must also have a / somwhere in the middle so we have a from and a too
    if (!baseTagName.equals("/") && baseTagName.indexOf("/", 1) == (baseTagName.length() - 1))
    this.reportError(rootNode, "The 'base-tag' must have 2 or more nodes in it.");
    return;
    //this if/else checks to see if the target dir was passed or not
    if (targetDirName == null &#0124; &#0124; targetDirName.equals(""))
    //if not our PathName is just the filename
    filePathName = targetFileName;
    else
    //if so then the PathName is the dirname/filename
    filePathName = targetDirName + "/" + targetFileName;
    if (filePathName.indexOf("..") != -1)
    this.reportError(rootNode, "Invalid directory name.");
    return;
    //get a refrence to the document
    Document XMLDoc = rootNode.getOwnerDocument();
    //break the child nodes down into a NodeList for parsing
    NodeList currentNodeList = XMLDoc.getChildNodes();
    //the dead node is what we will temporarily store the node
    //we are deleting in
    Node deadNode = null;
    //if the base-tag was just / then we don't edit the layout at all
    if (!baseTagName.equals("/"))
    //if not ....
    //search for the next occurance of a / in the path
    currentIndex = baseTagName.indexOf("/", oldIndex + 1);
    //the currentIndex will be -1 if a / was not found
    if (currentIndex >= 0)
    //if it was found set the    searchNode to the name of that substring
    searchNode = baseTagName.substring(oldIndex + 1, currentIndex);
    //set the index so we can keep track of where we are in the string
    oldIndex = currentIndex;
    //loop through the child nodes of the root document looking for out first match
    for (int index = 0; index < currentNodeList.getLength(); index++)
    //if the name of the node is equal to the search node we found it
    if (currentNodeList.item(index).getNodeName().equals(searchNode))
    //remove the node from the document and store it in a temporary
    //node and get out of the for
    deadNode = XMLDoc.removeChild(currentNodeList.item(index));
    index = currentNodeList.getLength();
    //create the NodeList from the removed Node
    currentNodeList = deadNode.getChildNodes();
    //find the next / in the tag string
    currentIndex = baseTagName.indexOf("/", oldIndex + 1);
    //if a / was found
    if (currentIndex >= 0)
    //get the name of the Node we are now looking for
    searchNode = baseTagName.substring(oldIndex + 1, currentIndex);
    oldIndex = currentIndex;
    //if there was a node removed and the searchNode has a name and the node index is >= 0
    while (deadNode != null && !searchNode.equals("") && currentIndex >= 0 && keepLooking)
    keepLooking = false;
    //loop through the nodes in the node list
    for (int index = 0; index < currentNodeList.getLength(); index++)
    //if the node we are looking for is found
    if (currentNodeList.item(index).getNodeName().equals(searchNode))
    //look for the next / in the tag string
    currentIndex = baseTagName.indexOf("/", oldIndex + 1);
    //if one is found
    if (currentIndex >= 0)
    //get the next node name from the tag string and set the node
    //list to the children of the node we just found
    currentNodeList = currentNodeList.item(index).getChildNodes();
    searchNode = baseTagName.substring(oldIndex + 1, currentIndex);
    oldIndex = currentIndex;
    keepLooking = true;
    //if one is not found
    else
    moveSuccesfull = true;
    //set the search node to "" since we are done looking
    searchNode = "";
    //add the node back to the root document
    XMLDoc.appendChild(currentNodeList.item(index));
    //get out of the for
    index = currentNodeList.getLength();
    if (!moveSuccesfull)
    XMLDoc.appendChild(deadNode);
    //if the document is not null
    if (XMLDoc != null)
    try
    //try to write the file to the specified path and name
    FileWriter fw = new FileWriter(BaseDir + filePathName);
    ((XMLDocument)XMLDoc).print(new PrintWriter(new BufferedWriter(fw)));
    catch (IOException iox)
    //if it fails report the error
    this.reportError(rootNode, "Error writing file " + filePathName);
    return;
    else
    //if the document is null report the error
    this.reportError(rootNode, "No Document to write.");
    return;
    }It's fairly long and I'm not sure how clear it is since I just whipped it up for a proof of concept. If you have any question feel feel to email.
    Hope it helps,
    -Eric Dalquist

  • Loading into Nested XML target

    Hi all,
    I need to load the data from a flat file into XML file(which has a nested structed).
    How can we achieve this through BODI?

    Yes, you can definitely do this through the NRDM (Nested Relational Data Model) feature in Data Integrator/Data Services.
    The standard documentation contains information on how to do this (check the Designer Guide >> Nested Data chapter) or have a look at our [Data Integrator Tips & Tricks wiki,|https://www.sdn.sap.com/irj/scn/wiki?path=/display/bobj/businessobjectsDataIntegratorTipsandTricks], here the section that covers NRDM : https://www.sdn.sap.com/irj/scn/wiki?path=/display/bobj/theNoneRelationalDataModelNRDM

  • Flat file into XML

    Hi,
    I have a requriment like source will be sending IDoc DELVRY03 in form of flatfile(fixed length).So i have  to convert to XML so that PI can do transformation.I cant do file content conversion.Target is also IDoc DELVRY03.
    Kinldy suggest me how to convery flat file into XML.
    Regards,
    Anitha M
    Edited by: Anitha m on Aug 3, 2010 10:07 AM

    Hi Anitha,
    You should use File content conversion to convert flat file into XML file.
    Please check the below link, which help you to know how to do it.
    http://saptechnical .com/Tutorials/XI/Contentconversion/page2.htm
    Please check the weblink given below for converting the file content:
    http://help.sap.com/saphelp_srm40/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Thanks,

  • Load nested XML into table

    Hello, could anyone help me on this? I have a XML file as below:
    <Feed>
    <svc>enr1</svc>
    <report_email>[email protected]</report_email>
    <requisition id="12">
    <email>[email protected]</email>
    <Name>Joseph</Name>
    <PRODUCT>
         <PROD_ID>532343234</PROD_ID>
         <NAME>KID'S WEAR </NAME>
         <DATE_ORDERED>09/04/2009</DATE_ORDERED>
    </PRODUCT>
    <PRODUCT>
         <PROD_ID>67045434</PROD_ID>
         <NAME>SHOES</NAME>
         <DATE_ORDERED>09/04/2009</DATE_ORDERED>
    </PRODUCT>
    </requisition>
    <requisition id="13">
    <email>[email protected]</email>
    <Name>Sarah</Name>
    <PRODUCT>
         <PROD_ID>11111111</PROD_ID>
         <NAME>LOST IN FOREST</NAME>
         <DATE_ORDERED>10/05/2008</DATE_ORDERED>
    </PRODUCT>
    <PRODUCT>
         <PROD_ID>222222222</PROD_ID>
         <NAME>TRY IT NOW</NAME>
         <DATE_ORDERED>09/04/2007</DATE_ORDERED>
    </PRODUCT>
    </requisition>
    </Feed>

    You could flatten the XML into table style output using XMLTABLE...
    WITH t as (select XMLTYPE('
    <RECSET>
      <REC>
        <COUNTRY>1</COUNTRY>
        <POINT>1800</POINT>
        <USER_INFO>
          <USER_ID>1</USER_ID>
          <TARGET>28</TARGET>
          <STATE>6</STATE>
          <TASK>12</TASK>
        </USER_INFO>
        <USER_INFO>
          <USER_ID>5</USER_ID>
          <TARGET>19</TARGET>
          <STATE>1</STATE>
          <TASK>90</TASK>
        </USER_INFO>
      </REC>
      <REC>
        <COUNTRY>2</COUNTRY>
        <POINT>2400</POINT>
        <USER_INFO>
          <USER_ID>3</USER_ID>
          <TARGET>14</TARGET>
          <STATE>7</STATE>
          <TASK>5</TASK>
        </USER_INFO>
      </REC>
    </RECSET>') as xml from dual)
    -- END OF TEST DATA
    select x.country, x.point, y.user_id, y.target, y.state, y.task
    from t
        ,XMLTABLE('/RECSET/REC'
                  PASSING t.xml
                  COLUMNS country NUMBER PATH '/REC/COUNTRY'
                         ,point   NUMBER PATH '/REC/POINT'
                         ,user_info XMLTYPE PATH '/REC/*'
                 ) x
        ,XMLTABLE('/USER_INFO'
                  PASSING x.user_info
                  COLUMNS user_id NUMBER PATH '/USER_INFO/USER_ID'
                         ,target  NUMBER PATH '/USER_INFO/TARGET'
                         ,state   NUMBER PATH '/USER_INFO/STATE'
                         ,task    NUMBER PATH '/USER_INFO/TASK'
                 ) y
       COUNTRY      POINT    USER_ID     TARGET      STATE       TASK
             1       1800          1         28          6         12
             1       1800          5         19          1         90
             2       2400          3         14          7          5Or you could shread the XML into Oracle nested tables...
    e.g.
    (Based on response from mdrake on this thread: Re: XML file processing into oracle
    Reading XML using a schema...
    declare
      SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
      XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
            <xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
            <xs:complexType name="groupType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="id" type="xs:byte" use="required"/>
            </xs:complexType>
            <xs:complexType name="itemType" xdb:maintainDOM="false">
                    <xs:simpleContent>
                            <xs:extension base="xs:string">
                                    <xs:attribute name="id" type="xs:short" use="required"/>
                                    <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:extension>
                    </xs:simpleContent>
            </xs:complexType>
            <xs:complexType name="cust_orderType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="group" type="groupType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="cust_id" type="xs:short" use="required"/>
            </xs:complexType>
         </xs:schema>';
      INSTANCE  CLOB :=
    '<cust_order cust_id="12345">
      <group id="1">
        <item id="1" name="Standard Mouse">100</item>
        <item id="2" name="Keyboard">100</item>
        <item id="3" name="Memory Module 2Gb">200</item>
        <item id="4" name="Processor 3Ghz">25</item>
        <item id="5" name="Processor 2.4Ghz">75</item>
      </group>
      <group id="2">
        <item id="1" name="Graphics Tablet">15</item>
        <item id="2" name="Keyboard">15</item>
        <item id="3" name="Memory Module 4Gb">15</item>
        <item id="4" name="Processor Quad Core 2.8Ghz">15</item>
      </group>
      <group id="3">
        <item id="1" name="Optical Mouse">5</item>
        <item id="2" name="Ergo Keyboard">5</item>
        <item id="3" name="Memory Module 2Gb">10</item>
        <item id="4" name="Processor Dual Core 2.4Ghz">5</item>
        <item id="5" name="Dual Output Graphics Card">5</item>
        <item id="6" name="28inch LED Monitor">10</item>
        <item id="7" name="Webcam">5</item>
        <item id="8" name="A3 1200dpi Laser Printer">2</item>
      </group>
    </cust_order>';                
    begin
      dbms_xmlschema.registerSchema
         schemaurl       => SCHEMAURL
        ,schemadoc       => XMLSCHEMA
        ,local           => TRUE
        ,genTypes        => TRUE
        ,genBean         => FALSE
        ,genTables       => TRUE
        ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
      execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
    end;
    desc CUST_ORDER_TBL
    SQL> desc CUST_ORDER_TBL
    Name                                                                                                                                    Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
    set autotrace on explain
    set pages 60 lines 164 heading on
    col cust_id format a8
    select extract(object_value,'/cust_order/@cust_id') as cust_id
          ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
    from   CUST_ORDER_TBL
          ,XMLTABLE('/cust_order/group'
                    passing object_value
                    columns id   number       path '@id'
                           ,item xmltype      path 'item'
                   ) grp
          ,XMLTABLE('/item'
                    passing grp.item
                    columns id   number       path '@id'
                           ,inm  varchar2(30) path '@name'
                           ,qty  number       path '.'
                   ) itm
    CUST_ID    GROUP_ID    ITEM_ID ITEM_NAME                        ITEM_QTY
    12345             1          1 Standard Mouse                        100
    12345             1          2 Keyboard                              100
    12345             1          3 Memory Module 2Gb                     200
    12345             1          4 Processor 3Ghz                         25
    12345             1          5 Processor 2.4Ghz                       75
    12345             2          1 Graphics Tablet                        15
    12345             2          2 Keyboard                               15
    12345             2          3 Memory Module 4Gb                      15
    12345             2          4 Processor Quad Core 2.8Ghz             15
    12345             3          1 Optical Mouse                           5
    12345             3          2 Ergo Keyboard                           5
    12345             3          3 Memory Module 2Gb                      10
    12345             3          4 Processor Dual Core 2.4Ghz              5
    12345             3          5 Dual Output Graphics Card               5
    12345             3          6 28inch LED Monitor                     10
    12345             3          7 Webcam                                  5
    12345             3          8 A3 1200dpi Laser Printer                2
    17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
    On 10.2.0.1:
    Execution Plan
    Plan hash value: 3741473841
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   1 |  NESTED LOOPS                      |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   2 |   NESTED LOOPS                     |                        |     3 | 11460 |   805   (1)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL               | CUST_ORDER_TBL         |     1 |  3777 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN                | SYS_IOT_TOP_774117     |     3 |   129 |     1   (0)| 00:00:01 |
    |   5 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    Predicate Information (identified by operation id):
       4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
           filter("SYS_NC_TYPEID$" IS NOT NULL)
    Note
       - dynamic sampling used for this statementOn 10.2.0.3:
    Execution Plan
    Plan hash value: 1048233240
    | Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   1 |  NESTED LOOPS           |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   2 |   MERGE JOIN CARTESIAN  |                   |    17 |   131K|   805   (0)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL    | CUST_ORDER_TBL    |     1 |  3781 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                   |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_56152 |     1 |    43 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C006701       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
       6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
           filter("SYS_NC_TYPEID$" IS NOT NULL AND
                  "NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
       7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
    Note
       - dynamic sampling used for this statementCLEAN UP...
    DROP TABLE CUST_ORDER_TBL purge;
    exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd');

  • Nested XML into comboBox

    Well as stupid as this sounds I can populate a datagrid from
    a dynamic xml source(ASP) using HTTPservice but a basic lack of
    understanding is preventing me from using this data in a comboBox
    Below is my application source that works for populating the
    datagrid in it, but when the data is used in the comboBox as it's
    dataprovider the value is "[object][object]" Ive tried a bunch of
    stuff but I think im conceptualy misunderstanding something about
    retreiving nested values...
    --MY BROKEN EXAMPLE---
    --XML-output-by-asp-document--------
    <product>
    <category>Tile</category>
    <name>Angelic Peach</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Cosmo</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Durva</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Isosilis</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Magaloth</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Trunklin</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Googolfletch</name>
    </product>
    <product>
    <category>Tile</category>
    <name>Moskurbelf</name>
    </product>
    <product>
    <category>Tile</category>
    <name>DoChoaKoa</name>
    </product>
    ---products-component-for-use-in-main-application---
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="400" height="300"
    creationComplete="this.productStream.send();">
    <mx:Script>
    <![CDATA[
    import mx.utils.ArrayUtil;
    import mx.utils.XMLUtil
    //var urlPath="
    http://localhost/rogerwilko/AndeanStone/xml.asp";
    function xmlRequest():void {
    // Cancel all previous pending calls.
    productStream.cancel();
    var params:Object = new Object();
    params.func = 'products';
    productStream.send(params);
    ]]>
    </mx:Script>
    <mx:HTTPService id="productStream"
    url="
    http://localhost/rogerwilko/AndeanStone/xml.asp"/>
    <mx:Label text="Select A Product Category" top="0"
    left="0"/>
    <mx:ComboBox id="prodCatList"
    dataProvider="{mx.utils.ArrayUtil.toArray(this.productStream.lastResult.product)}"
    width="200" left="0" top="20" cornerRadius="3" fillAlphas="[0.5,
    0.5]" themeColor="#00ff00" alpha="0.49">
    </mx:ComboBox>
    <mx:DataGrid id="prodList"
    dataProvider="{mx.utils.ArrayUtil.toArray(this.productStream.lastResult.product)}"
    columnWidth="200" width="200" left="0" top="55">
    <mx:columns>
    <mx:DataGridColumn headerText="{prodCatList.value}"
    dataField="name"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Canvas>
    Thanks in advance for any help you can provide me
    leo

    You will need to specify either a labelField or
    labelFunction. You can use a labelField if the value you want to
    show in the combo box is a first level property of the item.
    If the data you want to display is deeper in the item object,
    and you need to "dot down" to get it use a labelFunction.
    HTTPService resultFormat defaults to Object. I have never
    been comfortable about the way Flex converts xml into objects, so I
    always use e4x. This choice affects the structure of your item
    objects, and therefore the way you need to access the item objects
    properties.
    Try labelField, anif that doesn't work use a labelFunction.
    Note, you can debug the labelFunction quite handily.
    Tracy

  • IDOC-- PI-- flat xml file

    Hi ,
    we are working on a HR IDOC>PI>flat xml file scenario.
    Idoc name is HRMD_A07.
    we have consolidated some 10 interfaces together.
    Plan is to,
    1)(master interface) get the idoc data into a flat xml file, where flat xml consists of unique fields of all 10 interfaces.
    2)Later, use flat xml as input to 10 interfaces, which are FILE>PI>FILE.
    we are facing problem in master interface. The data is not coming properly in flat xml.
    Can you guys suggest the proper way to do this.
    should we use,
    1)abap mapping, with standard functionality to convert idoc to flat file?
    2)write a udf to get the proper data?
    pls suggest the best approach.
    san.

    Hi San,
    you gave us nearly no details, so it is hard to give you any recommandation.
    PI provides 4 general possibilities for mappings:
    Graphical: Standard and for simple cases the best solution
    XSL: Webstandard, in some cases much less development time compare to graphical (if the message structure changes)
    ABAP: For special cases (access to ABAP tables, operations before parsing)
    Java: For special cases
    Regards,
    Udo

  • Flat File Into DW

    Hi All,
    I have many flat files in xls, access, csv format to be brought into the OBIDW. I have a EBS Financials, OM and SCM modules which also has some flat file data as sources.
    1. whats is the general approach to bring in the flat file data to the OBIDW (I have DAC 7.9.5 and INFA 8.1.1).
    ---is the approach like - just build a fully customized INFA mappings with flat file as source?
    OR
    --first bring in the flat file data into a local staging DB without any business logic (just Data migration) and then use them as additional  
    tables in the pre-built INFA mappings? how are the relations between new OLTP tables built?
    OR
    --what is the best practice? (ppl having experience of having done this pls answer, its very critical!)
    2.what is the industry standard. PLs let me know ASAP!
    3. In OOTB DAC 7.9.5 I see some execution plans/ subject areas called 'Flat File' what are they used for? Any relation to the above question.??
    4. any documents/ links are appreciated.
    5. How is the Change Capture Mechanism realized for BI Apps as EBS as source. In Siebel I am used to Image tables. But i do not see any image table concept here in EBS. Pls help me in this regard also.
    Thanks You Very much.

    Hi Anitha,
    You should use File content conversion to convert flat file into XML file.
    Please check the below link, which help you to know how to do it.
    http://saptechnical .com/Tutorials/XI/Contentconversion/page2.htm
    Please check the weblink given below for converting the file content:
    http://help.sap.com/saphelp_srm40/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Thanks,

  • Error while loading flat file into DSO

    Hi
    I am loading data from a flat file into a DSO. My fields in the flat file are Trans_Dt, (CHAR) Particulars (CHAR), Card_Name, (CHAR) Exps_Type, (CHAR)
    Debit_Amount,Credit_Amount,***._Amt,Open_Bal_Check_Acnt, (CURR)
    0Currency (CHAR)
    In the proposal tab apart from the above mentioned fields 3 additional fields viz, field 10, field 11, and field 12 have come. How did these 3 additional fields come when I don't have any additional fields in my flat file? I've deleted these extra 3 fields though.
    When I activate the DataSource it is getting activated but then I get the message 'Data structures were changed. Start transactions before hand'. What does this message mean?
    When I hit the 'Read preview data' button it doesn't show me any data and gives me the error Missing reference to currency field / unit field for the fields Debit_Amount,Credit_Amount,***._Amt,Open_Bal_Check_Acnt
    How do I create a reference field to the above mentioned fields?
    Earlier I didn't have the 0Currency field in the flat file. But in my DSO while creating the key figures by default the 0Currency field also got created which is quite obvious. Now while activating the transformations I was getting a message that 'No source field for the field 0Currency'. Hence I had to create a new field in my flat file called 0Currency and load it with USD in all rows.
    Please help me in loading this flat file into the DSO.
    Thank you.
    TR.

    Hi guys,
    Thanks a lot for your answers. with your help I could see the data in the 'Read preview data' and schedule the load. I did use all the Info objects in the info objects column of the data source to load the flat file.
    The data is in PSA successfully without any issues. but when I executed the DTP it failed with errors.
    Earlier there was no mapping from Currency field in source to the all the key figure fields in the target in the transformation. The mapping was only from Currency to 0CURRENCY but still the transformation got activated. As per your advise I mapped Currency field to the remaining Key Figure fields but then I am getting the error
    'Source parameter CURRENCY is not being used'
    Why is that so?
    list of Errors after executing the DTP:
    1. 'Record filtered because records with the same key contain errors'
    Message:
    Diagnosis: The data record was filtered out becoz data records with the same key have already been filtered out in the current step for other reasons and the current update is non-commutative (for example, MOVE). This means that data records cannot be exchanged on the basis of the semantic key.
    System Response: The data record is filtered out; further processing is performed in accordance with the settings chosen for error handling.
    Procedure: Check these data records and data records with the same key for errors and then update them.
    Procedure for System administration
    Can you please explain this error and how should I fix this error.
    2. Exception input_not_numeric; see long text - ID RSTRAN
    Diagnosis: An exception input_not_numeric was raised while executing function module RST_TOBJ_TO_DERIVED_TOBJ.
    System Response
    Processing the corresponding record has been terminated.
    Procedure
    To analyse the cause, set a break point in the program of the transformation at the call point of function module RST_TOBJ_TO_DERIVED_TOBJ. Simulate the data transfer process to investigate the cause.
    Procedure for System Administration
    What does this error mean? How do I set a breakpoint in the program to fix this error inorder to load the data?
    What does Procedure for System Administration mean?
    Please advise.
    Thank you.
    TR.

  • Loading data from flat file into 0EMPLOYEE

    Dear,
    I want to see the <b>'monthly change of numbers of employees'</b> of my company in a BW report.
    i want to do this by loading data from a dummy flat file into 0EMPLOYEE and afterwards into cube 0PAPA_C02.
    i've searched the whole 'help and service sap' websites but nowhere, i could find a usefull user guide.
    Could you explain me how this job needs to be done, are there certain steps that need to be taken?
    here are a few of my questions:
    1: what fields and data do i have to fill in my flat file?
    2: how does the time-dependency of master data of employee work?
    3: why do you only have to map 0calday and 0employee from infosource 0HR_PA_PA_1 to the corresponding fields of cube 0PAPA_C02?
    4: how is the key figure 0HDCNT_VC filled automathically?
    (the activation of cube 0PAPA_C02  and its flow is already done.)
    or maybe you know a user guide which explains the whole picture and could you send me its link?
    thanks a lot in advance,
    Julie de Meyer

    Hi,
    Employee is master data : You need to extarct data every month.Once the extraction is done , you need rto activate to see the results. Otherwise it will display old result.
    You can extract data for 0HR_PA_0 and 0HR_PA_1 cubes also. After that  you can do the reporting based on this.
    You can try some sap standard BI reports .
    Headcount is calculated based on employement percentage which is maintained in infotype 0007 (Planned Working Time). If it is 100 then it is considerd as headcount 1.
    you can check .
    http://help.sap.com/saphelp_nw2004s/helpdata/en/63/351e3c6a2fc036e10000000a114084/frameset.htm
    Regards
    Nilesh

  • Can't Figure Out How To Import XML into a Table?

    HELP!
    I've been using InDesign for several years now... but everything Ive ever done has been basic one off layout concepts.
    I am working on a website for a musical theater actress and for her resume, Id like to make a PDF which lists in table format the show, theatre and role she had for each job.
    I could do this manually... but Id really like to learn how to just reuse the same XML data that I have for her website and import it into InDesign.
    I have looked at Adobe's help file, I have scoured the internet, and I still can't figure it out... I have done like the adobe support file says... and I cant seem to get the values I create in her resume xml file to show up in a table I create in InDesign.
    I even tried to simplify it for the learning process and did something as basic as an XML file that has 5 colors... couldnt even get that working.
    So could someone explain it to me like Im a 5 year old... how to take a XML file, import it, place it in a table and have the data actually show up in the table.
    thanks,
    brian

    Are you sure you want to use XML with tables for this? No doubt importing XML into tables is useful for some specialized tasks, such as importing formatting information inside the XML itself, but for most of the familiar tasks that XML excels at, tables are neither necessary nor useful.
    In my (limited) experience, if the XML elements are well-differentiated, by which I mean different types of data have their own distinctive tags, then the special powers of XML can be exploited more fully using the more familiar tagged text, nested tags etc. in ordinary text frames using paragraph breaks, tab characters, etc. to achieve a suitably "tabular" finished appearance.
    If you must import XML into tables, I recommend Adobe's own PDF "Adobe InDesign CS3 and XML: A Technical Reference" availabe here:
    http://www.adobe.com/designcenter/indesign/articles/indcs3ip_xmlrules.pdf
    It sounds very daunting -- the words "technical reference" make me shudder -- but actually it's very readable and not very technical at all. Some nice pics and everything!
    Jeremy

  • Load a flat file into BW-BPS using SAP GUI

    Hi,
    We are using BW BPS 3.5 version, i implemented how to guide  " How to load a flat file into BW-BPS using SAP GUI" successfully without any errors.
    I inlcuded three infoobjects in the text file   costelemt, Posting period and amount. the same three infoobjects i inlcuded the file structure in the global data as specified in the how to document
    The flat file format is like this
    Costelmnt      Postingperiod         Amount   
    XXXXX             #      
    XXXXX             1                          100
    XXXXX             2                           800
    XXXXX             3                           700
    XXXXX             4                           500
    XXXXX             5                           300
    XXXXX             6                           200
    XXXXX             7                           270
    XXXXX             8                           120
    XXXXX             9                           145 
    XXXXX            10                           340
    XXXXX            11                           147
    XXXXX            12                           900 
    I successfully loaded above flat file in to BPS cube and it dispalyed in the layout also.
    But users are requesting to load  flatfile in the below format
    Costelmnt        Annual(PP=#)   Jan(PP=1)   Feb(PP=2) ........................................Dec(PP=12)  
    XXXXX              Blank                       100           800                                                   900
    Is it possible to load a flat file like this
    They wants load a single row instead of 13 rows for each costelement
    How to do this. Please suggest me if anybody accorss this requirment.
    In the infocube we have got only one Info object 0FISCPER3(Posting period) and one 0AMOUNT(Amount)
    do we need 13 Infobjects for each posting period and amount.
    Is there any possiblity we can implement any user exit which we use in BEX Quer's
    Please share your ideas on this.
    Thanks in advance
    Best regards
    SS

    Hi,
    There are 2 ways to do this.
    One is to change the structure of the cube to have 12 key figures for the 12 posting periods.
    Another way is to write an ABAP Function Module to fetch the values from each record based on the posting period and store it in the cube for the corresponding characteristic. This way, you dont have to change the structure of the cube.
    If this particular cube is not used anywhere else, I would suggest to change the structure itself.
    Hope this helps.

  • How can I load a flat file into a ZTABLE dynamically

    I need to create a program which can Load a ZTABLE from a flat file structure (delimited and fixed options required).  We have many ZTables where this will be required so I was hoping to do it dynamically somehow.  Otherwise I will have to create one ABAP for every ZTable we have to load.
    My Inputs should be
    PARAMETERS:  p_ztable TYPE ddobjname,         "Z Table Name
                 p_infile(132) LOWER CASE,        "File Name
                 p_delim(1).                      "Delimiter
      I know that I can read the file by using gui_upload
        CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = c_infile
          has_field_separator     = p_delim
        TABLES
          data_tab                = indata
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
            OTHERS                  = 9.
    I know that  I can split the contents of this file (if a delimiter is used).  However I will not know the actual field names of the table until runtime as to what to fields to split it into.  In the example below I have the actual table (t_rec) and each of the fields (pernr, lgart, etc) in the code but each table I
    need to load will be different – it will have a different # of fields as well.
    FORM read_data_pc.
      LOOP AT indata.
        PERFORM splitdata USING indata.
        APPEND t_rec.
        CLEAR t_rec.
      ENDLOOP.
    ENDFORM.
    FORM splitdata USING p_infile.
       SPLIT p_infile AT p_delim INTO
            t_rec-pernr                 "Employee #
            t_rec-lgart                 "Wage Type
            t_rec-begda                 "Effective date
            t_rec-endda.                 "End date
      ENDFORM.                       
    Once I split the data into the fields then I can just look and insert the record.
    Does anyone have any ideas?  Specific code examples would be great if you do.  Thx!!

    Hi janice,,
    Try this sample code where you can upload data from a flat file into the internal table.
    REPORT  z_test.
    TABLES: mara.
    FIELD-SYMBOLS : <fs> .
    DATA : fldname(50) TYPE c.
    DATA : col TYPE i.
    DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
    DATA: progname LIKE sy-repid,
    dynnum LIKE sy-dynnr.
    DATA itab TYPE TABLE OF alsmex_tabline WITH HEADER LINE.
    DATA: BEGIN OF ZUPLOAD1_T OCCURS 0 ,
             matnr like mara-matnr,
             ersda like mara-ersda,
             ernam like mara-ernam,
             laeda like mara-laeda,
          END OF ZUPLOAD1_T.
    *DATA: ZUPLOAD1_T LIKE mara OCCURS 0 WITH HEADER LINE.
    DATA: wa_data LIKE TABLE OF  ZUPLOAD1_T WITH HEADER LINE.
    selection-screen
    SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE text-001.SELECTION-SCREEN : SKIP 1. PARAMETERS : p_file LIKE rlgrap-filename.SELECTION-SCREEN : SKIP 1.SELECTION-SCREEN : END OF BLOCK blk
    . AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    F4 Value for File
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'   EXPORTING
                          PROGRAM_NAME        = SYST-REPID
                          DYNPRO_NUMBER       = SYST-DYNNR
                          FIELD_NAME          = ' '
         static              = 'X'
                          MASK                = ' '
        CHANGING      file_name           = p_file   EXCEPTIONS     mask_too_long       = 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.
    START-OF-SELECTION.
    CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' 
    EXPORTING    filename                      = P_FILE   
    i_begin_col                   = 1   
    i_begin_row                   = 1   
    i_end_col                     = 5   
    i_end_row                     = 12507 
         tables   
       intern                        = ITAB
    EXCEPTIONS  
            INCONSISTENT_PARAMETERS       = 1  
            UPLOAD_OLE                    = 2  
           OTHERS                        = 3.          .
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GET_COMPONENT_LIST' 
    EXPORTING  
        program          = SY-REPID   
        fieldname        = 'ZMARA' 
           tables   
           components       = CMP.
    LOOP AT itab.    AT NEW row.     
    IF sy-tabix = 1.        APPEND ZUPLOAD1_T.     
    ENDIF.   
    ENDAT.   
    col = itab-col.   
    READ TABLE cmp INDEX col.  
    CONCATENATE 'ZUPLOAD1_T-' cmp-compname INTO fldname.  
    ASSIGN (fldname) TO <fs>.  
    <fs> = itab-COL.  
      APPEND ZUPLOAD1_T.  ENDLOOP.
    DELETE ZUPLOAD1_T where matnr eq space.
    LOOP AT ZUPLOAD1_T INTO wa_data.
    insert mara from  wa_data .
        WRITE: / ZUPLOAD1_T-matnr, 20 ZUPLOAD1_T-ersda , 45 ZUPLOAD1_T-ernam, 55 ZUPLOAD1_T-laeda.
    *HERE IAM JUST CHECKING I NEED TO UPDATE A ZTABLE
      ENDLOOP.
    insert ZMARA FROM table itab ACCEPTING DUPLICATE KEYS.
    I have tried it for mara.Please let me know whether it was helful.
    Regards,
    Kannan

  • Unsorted Flat File into IDoc with multiple use of nodes

    Hi Experts!
    I am facing a little problem. I have a source flat file for a classification where some fields appear several times.
    My source flat file looks like this:
    item1; field1a
    item2; fieldA
    item3; fieldxa
    item1; field1b
    as you can see the item1 exists twice (further appearances are also possible).
    Now i have to map the flat file into an IDoc structure
    My target IDoc looks like this
    Header
    -- node1
    attribute1
    -- node2
    the "field1a" and "field1b" has to be mapped into the "attribute1" in "node1". "node1" has to be duplicated for each time an "item1" appears (.. and if item2, item3 etc. appears twice, three ... four times...).
    So how can i reach it that the node1 will be duplicated automatically when an item appears twice or more times? I know that it could be possible to work with "SplitByValue"... but for this i need all item1 in an straight order.... but i dont have them in a correct order.
    I am looking forward to your suggestions.
    Thank you in advance.
    Udo

    Complex sorting is not or not easy possible with the grafical mapping tool.
    Use a sequence mapping. The first mapping is a simple XSLT which does the sort. The second mapping works as usual.
    I have an example XSLT which I used for a different purpose:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <ORDERLIST>
          <xsl:for-each select="ORDERLIST/ITEM">
            <xsl:sort select="ID"/>
            <xsl:copy-of select="."/>
          </xsl:for-each>
        </ORDERLIST>
      </xsl:template>
    </xsl:stylesheet>
    Regards
    Stefan

Maybe you are looking for

  • Css centering layout problem

    Hi, I'm building a website from a photoshop design and I have a problem with the layout I can't see how to fix: I have a header and a footer which both need to stay centered and expand to whatever the browser window width is set to. Between them I ha

  • Can't full-screen RDP session window?

    Hi, I'm using Win7 to RDP to an AWS WinServer2012 box. I need to view RDP session full screen. Checked RDP -> Display configuration, which is set to Full Screen. My machine's resolution is set to 1680x1050. I checked the Screen Resolution on the serv

  • Is there a way to collapse the timeline?

    I've been doing a lot of grading in DaVinci Resolve lately, and I really love the way it allows you to collapse the timeline and show only the monitor and your grading controls.  Is there any way to do this in Speedgrade? It's kind of silly that you

  • Unknown error (-48) Huh?

    Help. when I connect the iPod it's recognized but says "the iPod cannot be synced. An unknown error occurred (-48). Any ideas?

  • Profit center data analysis

    Hi all, In report FAGLL03 we can see only Profit centers in respect to GL codes, but is there any feasibility to have  profit center wise data analysis, Like Cost center reports etc. we are using New GL, Thanks kishore