Using XPath with SQL to extract XML data

Given data such as this one:
<?xml version="1.0"?>
<ExtendedData>
   <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>
  <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
  <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>
  <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>
</ExtendedData>I normally use extractValue function as shown below for example to extract the value for the last parameter in the data above, e.g:
select extractValue(extended_data,'/ExtendedData/Parameter[@name="RealProv"]/BooleanValue') "my_column_alias" from tableAny ideas on how I may return the value of the parameter xsi:nil from this node:
<Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>I'd like to extract the true in xsi:nil="true"...
Thanks,
Edited by: HouseofHunger on May 15, 2012 2:13 PM
Edited by: HouseofHunger on May 15, 2012 2:13 PM

Extractvalue() has a third parameter we can use to declare namespace mappings :
SQL> with sample_data as (
  2    select xmltype('<?xml version="1.0"?>
  3  <ExtendedData>
  4    <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>
  5    <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
  6    <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>
  7    <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>
  8  </ExtendedData>') doc
  9    from dual
10  )
11  select extractvalue(
12           doc
13         , '/ExtendedData/Parameter[@name="BARRING_PASSWORD"]/@xsi:nil'
14         , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
15         )
16  from sample_data
17  ;
EXTRACTVALUE(DOC,'/EXTENDEDDAT
true
If you're on 11.2.0.2 and up, extractvalue() is deprecated.
One should use XMLCast/XMLQuery instead :
SQL> with sample_data as (
  2    select xmltype('<?xml version="1.0"?>
  3  <ExtendedData>
  4    <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>
  5    <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
  6    <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>
  7    <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>
  8  </ExtendedData>') doc
  9    from dual
10  )
11  select xmlcast(
12           xmlquery('/ExtendedData/Parameter[@name="BARRING_PASSWORD"]/@xsi:nil'
13            passing doc
14            returning content
15           ) as varchar2(5)
16         )
17  from sample_data
18  ;
XMLCAST(XMLQUERY('/EXTENDEDDAT
true
Note : the xsi prefix is predefined when using Oracle XQuery, so in this case we don't have to declare it explicitly.
Edited by: odie_63 on 15 mai 2012 15:23

Similar Messages

  • How to use XPath with Namespaces in the xml ?

    Hi all,
    I need to reference a certain Node in a Document using XPath notation.
    The problem is the the XML Document contains Namespaces inside it
    f.e.
    <xn:SubNetwork id="JRANM">
        <xn:VsDataContainer id="1">
           <xn:vsDataType>vsDataAreas</xn:vsDataType>
        </xn:VsDataContainer>
    </xn:SubNetwork >Using DOMXPath (from weblogic.xml.xpath)
      DOMXPath xPath = new DOMXPath("xn:SubNetwork/*");
      Set nodeset = xPath.evaluateAsNodeset(this.xmlRootElement);When I Iterate through the Set I can see it's empty.
    (On the other hand without namespaces everything is fine.)
    So how can I reference a Node that contains a namespace in it ?
    Thanks a lot
    Francesco

    We use the following class to perform XPath Queries on our XmlBean objects.
    Hope this helps,
    Craig
    import java.util.Set;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.apache.xmlbeans.XmlException;
    import org.w3c.dom.Document;
    import weblogic.xml.util.StringInputStream;
    import weblogic.xml.xpath.DOMXPath;
    * Class to encapsulate API specific (i.e. weblogic) XML functions
    public class XmlUtil {
         * Returns a set containing objects of type reflected in the query.<br/>
         * e.g.<br/>
         * /saur:tree/saur:treeNode[@label='My Reports']<br/>
         * Returns a Set of TreeNode objects<br/>
         * Sample Code: <br/>
         * <code>
         * Set set = XmlUtil.executeXPathQuery( myQuery, tree.xmlText());
         * for( Iterator iter = set.iterator(); iter.hasNext();) {
         *     TreeNode node = TreeNode.Factory.parse((Node)iter.next());
         *     // Do whatever...
         * </code>
         * @param query
         * @param xml
         * @return
        public static Set executeXPathSetQuery( String query, String xml) throws XmlException {
            try {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();   
                factory.setNamespaceAware(true);
                DocumentBuilder builder = factory.newDocumentBuilder();
                StringInputStream in = new StringInputStream(xml);
                Document doc = builder.parse(in);
                DOMXPath xQuery =  new DOMXPath(query);
                return xQuery.evaluateAsNodeset(doc);
            catch(Exception x) {
                throw new XmlException("Error running XPath query", x);
    }

  • Problem with extracting Xml data source fields

    Post Author: new_crystal
    CA Forum: Crystal Reports
    Hi,
    I am creating a report which has a xml data source.
    I have a field named fieldvalue in the xml, I need to present this fieldvalue in a column format based on the name of the column heading which is another field in the database called fielddata
    here is what i want
    fielddata1     fielddata2    fielddata3 .......
    fieldvalue1    fieldvalue2   fieldvalue3......
    i have dragged the fieldvalue 3 times in the report and applied different formula for each one of them
    here is the eg. of the formula
    if ( = "A" ) then
    but it is not giving me the correct values pulled from the data source. for the first column it is pulling correctly but for the rest of the columns it is giving values as 0's.
    Can anyone help me out in this? It is pretty urgent!
    Thanks

    Post Author: tel
    CA Forum: Crystal Reports
    I have no idea how to format it in Crystal Reports (i'm new to it too), but if worse comes to worse, you can create an XSLT stylesheet to convert the XML into a format that is easier for Crystal to use. 
    In case you don't know XSLT is a programming language that is designed to convert one XML format into another.

  • Using XPath with the XML DOM

    I have just started to use the XML DOM API. One thing I cannot see yet is an easy way to use XPath to get the value of an element.
    What I would like to do is pass an XPath expression like this:
    \EDIFACT\ORDERS\NAD[2]\NAD01\NAD0102
    into a method, and get the value of the element returned to me.
    Does anybody know if there is a method of one of the DOM interfaces that would provide that kind of functionality, or am I going to have to traverse the nodes of the DOM tree manually to do this?
    BR,
    Tony.

    Hi Tony,
    I read your posted question - I have the same problem.
    I think that the method find_from_path_ns (or find_from_path) is the only "xpath"-like way to get a value.
    BUT the syntax is very limited so you cannot use all good features of xpath
    To traverse the nodes manually is (in my problem) unpractible - the xml-structures are different and it's horrible to traverse the tree.
    I need xpaths like ' //x/y[3]/z[a='MS']' . I know, the performance is not very good but for small XML-messages fast enough
    Do you have any solutions?
    regards
    Wolfgang Hummel

  • Can you use Object Relational SQL to access XML content ?

    Is there a possibility to use the generated object types and collection types to conveniently access the xml data?

    Technically there is nothing to prevent you from using the object types generared when an XML Schema is registered to access and manipulate the contents of the instance documents that conform to the Schema. This would be done using the notation x.xmldata.attribute In this case x would be the object table, xmldata is the name of the instance of the SQL object type associated with the table in question.
    However we do not encourage or recommend this approach. Currently XML DB provides the application developer with DML / DDL independence. This holds true as long as you use XPATH expressions to express your DML operations. Using XPATH expressions to access the content of an XML document maintains an abstraction between the DML (XPATH) and the underlying Object Relational Storage Structure derived from the information in the corresponding XML Schema. Whereever possible, when you express a query using an XPATH expression, under the covers we attempt to re-write the query into Object Relational SQL, based on the meta data contained in the Schema, as access v
    If you use the object notation to access the content of the document you break this abstraction. Your application now needs to be aware of the physical (object relational) storage model being used to manage the instance documents.
    One of the key features of XML DB is that it allow a developer to use Schema Annotations to alter the storage model used to manage the instance documents. The most common example of this is using annotations to control the way in which collections are managed. Depending on the annotation in the schema you can store collections as a VARRAY, as a NestedTable or as a separate XMLType table. Dependong on the technique chosed the objects that are generated during the XML Schema registration process will change.
    If you use the XPATH expressions to accesss the content of your documents, and you decided to change the annotations in your schema so as to revise the way your documents are stored, XML DB will ensure your code should continue to work unchanged, regardless of which objects are generated during Schema registration. On the other hand, if you use the object notation to access the content of the documents, and then change the annotation you will have to change your code.
    I hope this clarifies the situation..

  • Use of External tables to load XML data.

    Hi,
    I have used external table definitions to load various XML files to the database, usually splitting the XML into seperate records - 1 per major element tag, and using PL/SQL to parse out a primary key to store in a relational table with all of the XML relevant to that primary key value stored as an XMLTYPE coumn in a row of the table. This has worked fine for XML with a single major entity (element tag) .
    However, I now have an XML file that contains two "major" elements (both children of the root) that I would like to split out and store in seperate tables.
    The XML file is of the following basic format:-
    <drugs>
    <drug>drug 1...</drug>
    <drug>drug 2...</drug>
    <partners>
    <partner>partner 1</partner>
    <partner>partner 2</partner>
    </partners>
    </drugs>
    The problem is there are around 18000 elements of the first type, followed by several thousand of the 2nd type. I can create two seperate external tables - one for each element type, but how do I get the external table for the 2nd to ignore all the elements of the first type? My external table definition is :-
    CREATE TABLE DRUGBANK_OWNER.DRUGBANK_PARTNERS_XML_EXTERNAL
    DRUGBANK_XML CLOB
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DRUGBANK_DIR
    ACCESS PARAMETERS
    ( records delimited by "</partner>" SKIP 100000
    characterset al32utf8
    badfile extlogs:'drugbank_partners_xml.bad'
    logfile extlogs:'drugbank_partners_xml.log'
    discardfile extlogs:'drugbank_partners_xml.dis'
    READSIZE 52428800
    fields
    drugbank_xml CHAR(50000000) terminated by '</partners>'
    LOCATION (DRUGBANK_DIR:'drugbank.xml')
    REJECT LIMIT UNLIMITED
    PARALLEL ( DEGREE 8 INSTANCES 1 )
    NOMONITORING;
    The problem is that before the first <partners> element the 1800 or so <drugs> elements cause a data cartrdige error:-
    ORA-29913: error in executing ODCIEXTTABLEFETCH callout
    ORA-29400: data cartridge error
    KUP-04020: found record longer than buffer size supported, 52428800
    This happens regardless of the value of the SKIP or the size of the drugbank_xml field.
    I have tried using an OR on the "records delimited by" access parameter, to 'delimit by "</partner>" OR "</drug>"', with the intention of filtering out the <drug> elements but this leads to a syntax error.
    Anyone ever tried anything similar and got it to work?
    Any other suggestions?
    Thanks,
    Sid.

    No, the content inside quotes is spanned across multiple lines....there are line breaks after every html tag.
    "What's the error message you are getting?"
    Iam not getting any error while selecting from external table , but I am getting tose rows in BAD file and log file has the following entries
    KUP-04021: field formatting error for field TKBS_DSCN
    KUP-04036: second enclosing delimiter not found
    Message was edited by:
    user627610

  • Best way to extract XML data to DB

    Hello,
    In our work we need to extract data from XML documents into a database. Here are some extra notes:
    + There is no constant schema for the XML documents.
    + Some processing on the XML files is required.
    + The XML documents are very big.
    + The database is Oracle 8i or 9i (Enterprise Edition both) and our framework is NET.
    Our questions are:
    1. What is the best way to extract the data into the database under the above circumstances ?
    2. In case there was a constant schema for the XML documents, would there be a better way ?
    3. Is writing the data to text files first, and then loading it via SQL-Loader is an effective way ?
    Any thoughts would be welcome. Thanks.

    Hi Nicolas,
    The answer depends on your actual storage method (binary, OR, CLOB?), and db version.
    You can try XMLTable, it might be better in this case :
    SELECT x.elem1, x.elem2, ... , x.elem20
    FROM your_table t
       , XMLTable(
          '/an/xpath/to/extract'
          passing t.myxmltype
          columns elem1  varchar2(30) path 'elem1'
                , elem2  varchar2(30) path 'elem2'
                , elem20 varchar2(30) path 'elem20'
         ) x
    ;

  • Using Multiple Subpaths - question about nested XML data

    Hello.
    I am in the process of getting my head around the nested XML data that is one layer deeper than I know how to handle - ultimately I would like to populate a Spry MenuBar from the static XML file.
    Updates & revisions to the menu would be done by simply uploading a new XML file to the server whenever something needs changed.
    The problem I am having is in regard to more than one subpath.
    I can successfully get the "Menuheading" and the "items" to show but the "subitems" that should attach to the "items" are nowhere to be found. Once this is figured out, I will begin building my menu.
    I'm not getting an XML error when testing in Safari (Mac OS 10.5.8)
    I thing my problem lies here in the head section of the page - obviously somewhere in the subPaths area:
    <script type="text/javascript">var dsItems1 = new Spry.Data.XMLDataSet("MenuXML.xml", "/menu/menuitem", { subPaths: [ "items/item", "subitem" ] });
    and here in the body section at subitem:
    <tr spry:repeat="dsItems1">
    <td>{@id}</td>
                <td>{menuheading}</td>
                <td>{items/item}</td>
                <td>{subitem}</td>
            </tr>
    ==================================================
    The end result I would like rendered in the menu is:
    ==================================================
    Menuheading
    ---- Item (hyperlink)
    ---- Item (hyperlink)
    ---- Item (hyperlink)
    ---- Item
           ------- sub submenu item (hyperlink)
    Menuheading
    ---- Item
           ------- sub submenu item (hyperlink)
           ------- sub submenu item (hyperlink)
           ------- sub submenu item (hyperlink)
    ---- Item (hyperlink)
    ---- Item (hyperlink)
    ---- Item (hyperlink)
    ...and so on.
    I have attached both files in their entirety at the bottom of the post in hopes someone can help.
    ==================================================
    Here is the relevant HTML
    ==================================================
    <head>
    <script language="JavaScript" type="text/javascript" src="includes/xpath.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/SpryData.js"></script>
    <script language="JavaScript" type="text/javascript" src="includes/SpryNestedXMLDataSet.js"></script>
    <script type="text/javascript">var dsItems1 = new Spry.Data.XMLDataSet("MenuXML.xml", "/menu/menuitem", { subPaths: [ "items/item", "subitem" ] });</script>
    </head>
    <body>
    <div spry:region="dsItems1">
    <table class="dataTable">
    <tr>
    <th width="62">Menu ID</th>
                <th width="171">Menu Heading</th>
                <th width="257">Menu Items</th>
                <th width="257">Submenu Items</th>
            </tr>
    <tr spry:repeat="dsItems1">
    <td>{@id}</td>
                <td>{menuheading}</td>
                <td>{items/item}</td>
                <td>{subitem}</td>
            </tr>
    </table>
    </div>
    </body>
    ==================================================
    A representative snippet of the XML is shown here:
    ==================================================
    <?xml version="1.0" encoding="UTF-8"?>
    <menu>
         <menuitem id="0001" type="Aboutus">
              <menuheading>About Us</menuheading>
                   <items>
                        <item id="0011">Welcome to MHBS</item>
                        <item id="0021">History</item>
                        <item id="0031">Mission</item>
                        <item id="0041">Accreditation</item>
                        <item id="0051">Directions</item>
                        <item id="0061">Calendar</item>
                        <item id="0071">Board of Directors</item>
                                     <subitem id="0111">Meet the Board</subitem>
                        <item id="0081">FAQs</item>
                   </items>
         </menuitem>
         <menuitem id="0002" type="Academics">
              <menuheading>Academics</menuheading>
                   <items>
                        <item id="0012">Meet the Faculty</item>
                        <item id="0022">Elementary</item>
                        <item id="0032">Middle School</item>
                        <item id="0042">High School</item>
                        <item id="0052">Academic Achievements</item>
                                     <subitem id="0251">Test Scores</subitem>
                                     <subitem id="0252">College Acceptance</subitem>
                        <item id="0062">Accelerated Reading</item>
                        <item id="0072">Summer Reading</item>
                        <item id="0082">Guidance and Counseling</item>
                   </items>
         </menuitem>
    ... and on and on ...
    </menu>
    Should I be doing something with the Spry.Data.NestedXMLDataSet instead?
    If so, how do I implement that?
    many thanks in advance

    Yes, you should be using the nested dataset instead.
    Did you read: http://labs.adobe.com/technologies/spry/samples/data_region/NestedXMLDataSample.html ?

  • Extract XML data based on column tag

    Dear All,
    i want to extract the XML data type based on column selection.
    For example:
    i have the below xml in my database stored as XMLTYPE() data.
    <c1>10</c1><c2>0011</c2><c3>DEBIT</c3><c4>USD</c4>
    i want to extract the column tag c2&c3 alone. Is there any query to extract the same.
    Waiting for your response.Thanks in Advance.

    Hi,
    How do I set the web service option up correctly?  The XMLs are being created behind the scenes on what data to be used but I don't know how to make the menu only pick the xml based on the menu option.
    I have one XML that populates the menu options and specific XML's that has the data that goes with each menu option. The menu population works great but it doesn't pull the other XML's to populate the charts. This is the part that I need help.
    How do I use the web service to fix this? Any help would be very much appriecated.  I could even send you my dashboard if it helps so you can see what I've gotten so far (it's not all prettied up yet since I wanted to see if it's doable first)
    I'm new to Xcelsius so I apologize if these are newbie questions.
    Thanks,
    Jay

  • Is it possible to use MERGE with sql*plus and if yes how?

    Hello everybody,
    I have an xls file and I have to load its data with sql*loader, but instead of "APPEND" operation stated in the control file I need MERGE operation.Here is what my control file contains:
    LOAD DATA
    INFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\data.csv'
    BADFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\p_badfile.txt'
    APPEND
    INTO TABLE D_ACCOUNT_NAMES_TMP
    FIELDS TERMINATED BY ";"
    TRAILING NULLCOLS
    (account_number , consignment, sub_consignment, consign_sub_consign, account_name_bg, account_number_2, consign_parent_2, account_name_bg_2, account_number_3, account_name_bg_3, account_number_4, account_name_bg_4, account_number_5 , ACCOUNT_NAME_BG_5 ).
    How can I use merge in this case , instead of insert ?
    Regards,
    Maria

    I'm not sure if there is any MERGE thing in SQL*Loader, but you can have a backup table which gets loaded by SQL*Loader and then use MERGE statement from backup to the original table, if your data is not huge to become a performance barrier. This is just a suggestion, may be you can try some reading of SQL*Loader here.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/part2.htm#436160
    Cheers
    Sarma.

  • Pl/sql procedure in XML Data Template.

    Hi
    I have a procedure , which is returning a ref cursor , i need to use this ref cursor in xml data templete . how we will write this data templete.
    Also how to call the procedure in data templete.
    Please guide me.
    SS

    If it's function you can call it direct, Procedure all you need to do is to wrap the procedure around a function and call that function which return the ref cursor
    For example :
    I have getdept procedure which has OUT ref cursor, I will wrap this with
    get_dept function which return the ref Cursor then
    <sqlStatement name="Q1">
    <![CDATA[SELECT get_dept(:p1,:p2,....) dept from dual]]>
    </sqlStatement>

  • Using prompts with SQL query

    Post Author: wleonetti
    CA Forum: Crystal Reports
    Hello!
    I have acquired a report from our regional headquarters, and have been asked locally to add a prompt to one that already exists in the report.
    The report currently uses an SQL query, which in turn uses a single prompt to limit the data reported. However, the name of the parameter in the Field Explorer in Parameter Fields is "Facility", but, when I use the Database Expert and select edit for the query (under Selected Tables, right-click on "Command" under the database and click on "Edit Command"--is Command a default name?), under the Parameter List, the name of the parameter there is "Facility1" (?). The SQL references the parameter "Facility1" (...like '{?Facility1}'), but I cannot find any link/interface between the Parameter List "Facility1" to the Parameter Field "Facility", and I cannot find any other references to "Facility1" anywhere else in the report (sorry, I'm very new at CR, and am not sure how to do a global search of a desired text string in the reports).
    I have asked the author for an explanation, but he would only offer, after indicating that he ... was not obligated to help me in any way .., the following bone: "I just simply rename the parameter in Command from Facility1 to Facility which bears the same name as the parameter interface and it just works fine." This only served to confuse me more, since the parameter name currently in Command is  "Facility1" (and the report works the way it is)--when I change the name of the parameter in Parameter List (and the parameter name in the SQL query) to "Facility" (to match the Parameter Field's "Facility"?) ... the parameter in the Parameter Fields ... disappears?
    Can someone please instruct me how to, in whatever steps are necessary, add a parameter to the Parameter Fields and edit the SQL code to use that parameter? or point me to some documentation that will help me with this?
    Thanks in advance for any help offered.
    wleonetti

    Hi Eric,
    Try expressing the source as this:
    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;That works fine for me, and if I take out the begin-end and the trailing semicolon from the return statement I get the same behavior as you.
    It does mention in the help for the source (only during the wizard though) that this source type has to be expressed that way, but I agree it would be helpful if the tool would validate for this format when 'Function Returning SQL Query' is used or give some sort of indication of the trouble. Anyway, this should get you going again.
    Hope this helps,
    John
    If you find this information useful, please remember to mark the post "helpful" or "correct" so that others may benefit as well.

  • Problem accessing Infosets using Query with SQL

    Hi,
    I have Lumira desktop version 1.18.0.
    Using the Query with SQL connection, I successfully connected to SAP R/3 6. I was able to view the User Groups under CATALOG_VIEW, but it seems I cannot go beyong this point and select an Infoset. When I click on an Infoset I expect the Query pane to be populated with the SQL statement but nothing happens.
    I attached a screenshot for clarification
    Thanks
    Dany

    Hi Dany,
    A suggestion for you would be to use another client tool & check if the behavior is the same. I suggest that you use Information Design Tool (from BOE 4.1), create a connection to your ERP, then a data foundation on top of that connection and check if the behavior is the same. This way we can isolate if the problem is caused by the client tool or by the backend.
    My 2 cents
    Antoine

  • OracleRowSet/Javax.SQL.Rowset and XML data (Java 1.4)

    Does anybody know if it is possible to fetch xml data with an Oracle Row Set (or a hint how to do it)
    Or it is obligatory to use the OracleResultSet to make use of the xml methods.
    Thanks in advance
    Sebastian Schardt

    OracleWebRowSet has the writeXml method to output an XML String.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/oracle10g/webrowset/GetWebRowSet.java.html
    Also refer
    http://www.oracle.com/technology/sample_code/tutorials/rowset/rowsettoc.html
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/DMLSample/Readme.html

  • APD using Query with multiple structures as a data source

    All,
    I want to set up an automatic process which executes a query and exports it to a shared drive as a csv file. I have tried various options , when I try to use APD to set up the extract, I get an error and this is because the query that I am trying to use has Strucutres in both rows and columns. Hence, I am unable to use this option. I tried RSCRM_BAPI, It works well, but there is an issue with scheduling this in Process chain. I created an event and scheduled this as a job to trigger after "event" as per SAP instructions, but the job does not exist and it is not possible to trigger it through the Process chain unless the variables are hard coded in the query which I do not want to do.
    Can any one tell me if there is a way to deal with APD using Query with multiple structures?
    Would really appreciate if some one can give me the right solution...
    Thanks

    Hi Tanu ,
    APD is an option but its not very good with large amount of data or hiearachies or if you have attributes in you query structure .
    One more option for this requirement is use of report program using function module RRW3_GET_QUERY_VIEW_DATA .
    This will work fine with multiple structure etc .
    There are some overheads with this FM  ex: if amount of data is too much then program will give dump .Solution for that is we call the FM in LOOP by diving amount of data need to be fetched .ex:  we can read data quarter wise.
    For using this function module what you can do is write an ABAP program (At SE38 ) .which will call this FM and then write the output into a flat file which you can save at application server (AL11) .From there other system can read it .
    To automate this whole process you can further add all the report programs into a process chain (RSPC) which can be schedule as per requirement .
    To pass input parameters you can use variants that will pass the values to the report .
    Check thi link for sample code :
    [http://www.tricktresor.de/content/index.php?navID=696&aID=496]
    Hope this will be helpful .
    Regards,
    Jaya Tiwari

Maybe you are looking for