Trying to separate mst and dtl data while extracting from xml

Any help is greatly appreciated.
What I try to get done is as follows:
My external xml file structure has a header and 2 sub-sections with eachsub-section having multiple nodes.
<BOM>
<Header>
<Article>123</Article>
<Description></Description>
<Language>E</Language>
<Plant>QUO</Plant>
<ValidFrom>20120424</ValidFrom>
<ValidTo></ValidTo>
<BaseQty>1000</BaseQty>
<BaseUoM>kg</BaseUoM>
<Price>212.51</Price>
<LCFfound>Yes</LCFfound>
<Ingredients>
<Ingredient>
<Counter>1</Counter>
<Component>G52000</Component>
<CompDescr>AGRICULTURAL SALT</CompDescr>
<Quantity>557.941</Quantity>
<UoM>kg</UoM>
<Percentage>55.794</Percentage>
<Available>Yes</Available>
<MinQty></MinQty>
<MaxQty></MaxQty>
</Ingredient>
<Ingredient>
<Counter>2</Counter>
<Component>G51000</Component>
<CompDescr>SYLVINITE</CompDescr>
<Quantity>273.501</Quantity>
<UoM>kg</UoM>
<Percentage>27.350</Percentage>
<Available>Yes</Available>
<MinQty></MinQty>
<MaxQty></MaxQty>
</Ingredient>
<Nutrients>
<Nutrient>
<Counter>1</Counter>
<CharDescr>WEIGHT</CharDescr>
<Description>WEIGHT</Description>
<Value>553.985</Value>
<Usage>3</Usage>
</Nutrient>
<Nutrient>
<Counter>2</Counter>
<CharDescr>PRICE</CharDescr>
<Description>PRICE</Description>
<Value>212.509</Value>
<Usage>4</Usage>
</Nutrient>
</Nutrients>
</Header>
</BOM>
I can't get the Ingredients/Ingredient and the Nutrients/Nutrient section separated out without loosing the relationship to the Header.
I use the following code to insert into my header table and that works fine:
insert into X_FM_HDR_IMP( ID
,PRODUCT
,DESCRIPTION
,LANG
,ORG
,FROM_DATE
,TO_DATE
,QTY
,UOM
,PRICE
,LCF_FOUND)
select x.*
from xmltable (XMLNAMESPACES(DEFAULT 'http://www.anysite.com/xmltable'),
'/BOM/Header'
passing xmltype(bfilename('XML_IMP_DIR', "testing.xml'), nls_charset_id('CHAR_CS'))
columns ID FOR ORDINALITY
,PRODUCT VARCHAR2(40) path 'Article'
,DESCRIPTION VARCHAR2(254) path 'Description'
,LANG VARCHAR2(5) path 'Language'
,ORG VARCHAR2(3) path 'Plant'
,FROM_DATE VARCHAR2(8) path 'ValidFrom'
,TO_DATE VARCHAR2(8) path 'ValidTo'
,QTY NUMBER path 'BaseQty'
,UOM VARCHAR2(3) path 'BaseUoM'
,PRICE NUMBER path 'Price'
,LCF_FOUND VARCHAR2(1) path 'LCFfound'
) as x;
I need to be able to either load the xml record into one table or preferably into 3 tables such that
<BOM>
<Header>
= record
and
<BOM>
<Header>
<Ingredients>
<Ingredient>
= record with 'Article' and 'Org' from <Header> as columns
and
<BOM>
<Header>
<Nutrients>
<Nutrient>
= record with 'Article' and 'Org' from <Header> as columns
The xml file structure cannot be changed because it is generated by a 3rd party.
Thanks again in advance for any insight on how to get this accomplished.

Using the following simplified structure :
create table header_imp (
  ID number
, PRODUCT     VARCHAR2(40)
, DESCRIPTION VARCHAR2(254)
, LANG        VARCHAR2(5)
, ORG         VARCHAR2(3)
create table ingredient_imp (
  Product      varchar2(40)
, org          VARCHAR2(3)
, Counter      number
, Component    varchar2(30)
, CompDescr    varchar2(254)
, Quantity     number
, UoM          varchar2(5)
create table nutrient_imp (
  Product      varchar2(40)
, org          VARCHAR2(3)
, Counter      number
, CharDescr    varchar2(254)
, Description  varchar2(254)
, Value        number
, Usage        number
);This multitable insert works for me :
insert all
  when hrn = 1 then into header_imp
           (id, product, description, lang, org)
    values (id, product, description, lang, org)
when irn = 1 then into ingredient_imp
           (product, org, counter, component, compdescr, quantity, uom)
    values (product, org, i_counter, component, compdescr, quantity, uom)
when nrn = 1 then into nutrient_imp
           (product, org, counter, chardescr, description, value, usage)
    values (product, org, n_counter, chardescr, n_description, value, usage)
select -- header info
       h.id
     , h.product
     , h.description
     , h.lang
     , h.org
     , rownum hrn
     -- ingredient info
     , i.counter i_counter
     , i.component
     , i.compdescr
     , i.quantity
     , i.uom
     , row_number() over(partition by irn order by null) irn
     -- nutrient info
     , n.counter n_counter
     , n.chardescr
     , n.description n_description
     , n.value
     , n.usage
     , row_number() over(partition by nrn order by null) nrn
from xmltable (
       '/BOM/Header'
       passing xmltype(bfilename('TEST_DIR', 'testing.xml'), nls_charset_id('CHAR_CS'))
       columns
         ID FOR ORDINALITY
       , PRODUCT     VARCHAR2(40)  path 'Article'
       , DESCRIPTION VARCHAR2(254) path 'Description'
       , LANG        VARCHAR2(5)   path 'Language'
       , ORG         VARCHAR2(3)   path 'Plant'
       , INGREDIENTS XMLType       path 'Ingredients'
       , NUTRIENTS   XMLType       path 'Nutrients'
     ) as h
  , xmltable(
      '/Ingredients/Ingredient'
      passing h.ingredients
      columns
        Counter      number        path 'Counter'
      , Component    varchar2(30)  path 'Component'
      , CompDescr    varchar2(254) path 'CompDescr'
      , Quantity     number        path 'Quantity'
      , UoM          varchar2(5)   path 'UoM'
      , irn          for ordinality
    ) i
  , xmltable(
      '/Nutrients/Nutrient'
      passing h.nutrients
      columns
        Counter      number        path 'Counter'
      , CharDescr    varchar2(254) path 'CharDescr'
      , Description  varchar2(254) path 'Description'
      , Value        number        path 'Value'
      , Usage        number        path 'Usage'
      , nrn          for ordinality
    ) n
SQL> select * from header_imp;
        ID PRODUCT         DESCRIPTION         LANG  ORG
         1 123                                 E     QUO
SQL> select * from ingredient_imp;
PRODUCT         ORG    COUNTER COMPONENT                      COMPDESCR                     QUANTITY UOM
123             QUO          1 G52000                         AGRICULTURAL SALT              557,941 kg
123             QUO          2 G51000                         SYLVINITE                      273,501 kg
SQL> select * from nutrient_imp;
PRODUCT         ORG    COUNTER CHARDESCR                      DESCRIPTION                 VALUE      USAGE
123             QUO          1 WEIGHT                         WEIGHT                    553,985          3
123             QUO          2 PRICE                          PRICE                     212,509          4

Similar Messages

  • My ipod starts voicing song data, artist data, and playlist data while I am listening to music.  Is this a feature or a defect?  I do not know why it occurs, but the only way to stop it is to stop the music then play the playlist again.

    My ipod starts voicing song data, artist data, and playlist data while I am listening to music.  Is this a feature or a defect?  I do not know why it occurs, but the only way to stop it is to stop the music then play the playlist again.

    To make sure voiceover is off, you need to go to summary screen then click the "Configure Universal Access" button. Then you will get a dialog where you can make sure voiceover is off. All of the boxes in the dialog should be unchecked.
    i

  • Why wont google chrome let me play you tube videos as all I get is a black scfeen with no control iocons??? ps help I've  but made n o diff. tried clearing cashe's  and browsing data but made no diff grrr

    why wont google chrome let me play you tube videos as all I get is a black scfeen with no control iocons??? ps help I've  but made n o diff. tried clearing cashe's  and browsing data but made no diff grrr

        Check  whether you are currently  in  YouTube HTML 5 trial?
         http://www.youtube.com/html5
        At the bottom  left of the page  uncheck the box for
       "You are currently in the HTML5 trial".

  • I ordered iphone 6 on 15 oct and delivery date will be from 3 nov-6nov. i'll travel on 7 nov morning, am worried to receive the order late.. can you please expedite the order?

    i ordered iphone 6 on 15 oct and delivery date will be from 3 nov-6nov. i'll travel on 7 nov morning, am worried to receive the order late.. can you please expedite the order?

    No. Because we are not Apple employees. In fact there is no one from Apple in this forum. Contact Apple directly via phone. Use the "Contact Us" link at the bottom of this page to find the phone listing.

  • Error while extracting from BI source

    Hi,
    We are facing a wierd problem:
    Scenario:
    Loading data from one DSO to another DSO with the help of transformation
    The DTP fails at second data package each time. First data package goes successfully but it fails at the second data package) We have tried to vary the data package for e.g. 100 records, 5 records etc.....no matter what we do the load fails at the second data package with the following error message.
    Error:
    Data package processing terminated
    Error while extracting from source EPUD0002 (type InfoProvider)
    System error in program SAPLRS_EXCEPTION and form RS_EXCEPTION_TO_MESSAGE (see long text)
    Unknown error in SQL interface
    Error reading the data of InfoProvider EPUD0002
    Exception CX_RS_STEP_FAILED logged
    Workaround:
    We tried to increase the number of data package size so that all the records can be processed in only one data package and the load has never to request for 2nd data package . BUT as the data package size is big it takes long time to process and never completes....
    FYI...Our transformation has lots of abap coding ...
    Addn Info:
    SAP_BW   700   0010
    BI_CONT   703   0005
    SAP_BASIS  700  0010
    Any help will be highly appreciated...
    - Amit

    There must be some bug in the code which is causing this issue.
    try to debug it,
    refer: /people/community.user/blog/2007/03/29/sap-netweaver-70-bi-extended-capabilities-to-debug-a-data-transfer-process-dtp-request
    /people/dirk.herzog/blog/2005/02/11/abap-development-in-sap-bw

  • Error while extraction from R3 : URGENT

    While extracting from R/3 generic datasource(extracted through function module ) i am getting error as :
    <b>Error message from the source system
    Diagnosis
    An error occurred in the source system.
    System response
    Caller 09 contains an error message.
    Further analysis:
    The error occurred in Extractor .
    Refer to the error message.
    Procedure
    How you remove the error depends on the error message.
    Note
    If the source system is a Client Workstation, then it is possible that the file that you wanted to load was being edited at the time of the data request. Make sure that the file is in the specified directory, that it is not being processed at the moment, and restart the</b>
    <u>But when I am running the FM or the extractor checker it is giving actual records with our any error</u>
    Could you please help me what to do ?
    No job log in job overview , only it is given <b>Cancelled</b>.

    Some possibilities:
    1. Replicate the data source and then try loading.
    2. Check the RFC connection ; may be it is broken.
    3. Check the update rules to see it is active.
    Ravi Thothadri

  • Error while extracting from source type InfoProvider)

    Dear Sdns,
                       Am trying to load the data from the exisitng standard cube to one new ZCUBE.. The time when am loading the data. am getting the following errors...
    <b>- Data package processing terminated     
    - Error while extracting from source 0FIGL_C10 (type InfoProvider)
    - ORA-01652: unable to extend temp segment by 128 in tablespace PSAPTEMP
    - SQL Error: 1652
    - Exception CX_RS_STEP_FAILED logged</b>
    Can any one help me out from this issue...
    Answering getz appreciated,
    Warm Regards,
    Hemanth Aluri

    Hi,
    It seems like Table space problem..check with your basis team.
    regards,
    raju

  • Error while extracting from DSO

    Hellow ! ! !
    Got a error message.
    Scenario:
    Tried Loading data from one DSO to another DSO through transformation.
    But, got a following error message.
    Error:
    Error while extracting from source 0FIGL_O02 (type DataStore)
    Message no. RSBK242
    Inconsistent input parameter (parameter: <unknown>, value <unknown>)
    Message no. RS_EXCEPTION101
    System:
    SAP_BW:700
    Support Package: SAPKW70016
    Regards,
    DongSun Choi

    Got same results though tried several times.
    Updated well  from DSO after Changing from transformation to  update rule.
    Think the transformation is some problem.
    Thanks a lot...
    dongsun, choi

  • Trying to export x and y data points into excel

    Hi guys,
    I'm in a bit of a time crunch and I've been trying to figure a simple issue out.  I've been trying to export the x and y data points into an excel file.  I thought trying to use a property node would work but I've been tinkering with different subsets of the specific property nodes without any success.  The current issue I'm having right now is that the current way I have the data points into the excel file is incorrect because it's not including the x axis data points.  Additionally, I have thousands of data points that really slows things down.  I have attached the vi.  Thanks.
    Jon
    Attachments:
    UltraPCIe.vi ‏460 KB

    Hi Bill,
    Thanks for the note.  Yes, I am using that said vi.  I have attached the jpeg version of the block diagram for you.  Thanks!
    Jon
    Attachments:
    Update2.jpg ‏257 KB

  • Separate table and index data in RAC database

    Hi Experts,
    Our database is Oracle11g RAC database. I need your expertise on this
    Do we need to retain the table and index data in two different tablespaces for performance perspective in RAC database too?
    Please share your practical experience…Thanks in advance.
    Regards
    Richard

    g777 wrote:
    In my opinion, if there is striping implemented then performance shouldn't degrade even if the index and table blocks are in one tablespace. Exactly.. striping is NOT a good idea at tablespace level as a tablespace is a logical storage device. It is very difficult to stripe comprehensively/correctly at that level, if not impossible.
    Striping is a function of the actual storage system and need to happen at physical level. A proper RAID0 implementation.
    So the question about multiple tablespaces for a performance increase should not be about striping - but about issues such as data management, block sizes, transportable tablespaces and so on.
    Thus my question (at the OP) - what performance problems are expected and are these relevant to the number of tablespaces?

  • Trying to represent Min and Max date on a rtf. template, please help :-(

    Hi all,
    I'm a little bit disappointed. I make effort to write questions with the hope someone in this forum can help me, but it seems nobody has interest about it.
    I try once again:
    I am tryin to represent a From Date and To Date. My XML File looks like:
    <ServiceRequest
    <Created
    08/04/2003 07:34:21</Created
    <aENumber
    </aENumber
    <CheckResultCommentUAW
    </CheckResultCommentUAW
    <CheckResultCommentUAW
    </CheckResultUAW
    <ABCCategory
    </ABCCategory
    <ChargeNumber
    </ChargeNumber
    <ABCEndDate
    </ABCEndDate
    <ABCStatus
    </ABCStatus
    <ABCTransferStatus
    </ABCTransferStatus
    <ClosedDate
    </ClosedDate
    <ContactAccountName
    FGD Enterprise</ContactAccountName
    <ContactCTIFaxInbound
    </ContactCTIFaxInbound
    <ContactCTIPhoneOutbound
    +4904217280677</ContactCTIPhoneOutbound
    <ContactDepartment
    </ContactDepartment
    <ContactEmailAddress
    [email protected]</ContactEmailAddress
    <ContactFirstName
    Kate</ContactFirstName
    <ContactLastName
    Middleton</ContactLastName
    <ContactSalutation
    Miss</ContactSalutation
    <ContactSubject
    Psychoth.</ContactSubject
    <ContactTitle
    </ContactTitle
    <ContactType
    Doctor</ContactType
    <CreatorFirstName
    Iris</CreatorFirstName
    <CreatorName
    Ramos</CreatorName
    <Description
    Questions about Suprare.</Description
    <JoinedContactAccountId
    1-L8-676</JoinedContactAccountId
    <PTCNumber
    </PTCNumber
    <Product
    Novasitin</Product
    <ProductBusinessUnit
    BU Winters</ProductBusinessUnit
    <SRNumber
    1-1043652</SRNumber
    <SRType
    Speciality Service Request</SRType
    <SolutionDescription
    WLvbf</SolutionDescription
    <Status
    Open</Status
    <TemporaryContactName
    </TemporaryContactName
    <TemporaryPhoneNumber
    </TemporaryPhoneNumber
    <ABCDateReceived
    </ABCDateReceived
    <ABCLinkedProductName
    Novasitin 1</ABCLinkedProductName
    <ABCNoofUnitsReceived
    </ABCNoofUnitsReceived
    <ABCRefundReplacement
    </ABCRefundReplacement
    <ABCSampleStatusReceived
    </ABCSampleStatusReceived
    <ABCSolutionDescription
    </ABCSolutionDescription
    <VisitCompleteAddress
    The Parskinson 3</VisitCompleteAddress
    <Login
    A456788</Login
    <ListOfSRInternalProducts
    <SRInternalProducts
    <MaterialNumber
    134152</MaterialNumber
    <ProductName
    Novasitin 1</ProductName
    <BatchNumber
    </BatchNumber
    <ReplacementRefnd
    </ReplacementRefnd
    <SampleAmount
    </SampleAmount
    <SampleRecievedDate
    </SampleRecievedDate
    <SampleStatus
    </SampleStatus
    </SRInternalProducts
    <SRInternalProducts
    <MaterialNumber
    KTA</MaterialNumber
    <ProductName
    Novasitin</ProductName
    <BatchNumber
    </BatchNumber
    <ReplacementRefnd
    </ReplacementRefnd
    <SampleAmount
    </SampleAmount
    <SampleRecievedDate
    </SampleRecievedDate
    <SampleStatus
    </SampleStatus
    </SRInternalProducts
    </ListOfSRInternalProducts
    </ServiceRequest
    </listOf_ssServiceRequest
    As you see the date has the format 08/04/2003 07:34:21, but I want to represent it like 04.08.2003. I have this on my template:
    <?xdoxslt:set_variable($_XDOCTX, ‘minYear’, xdoxslt:to_char(concat(substring(Created, 4,2), ‘.‘,substring(Created, 1, 2), ‘.‘,substring(Created, 7, 4)), ‘DD.MM.YYYY’))?>
    <?xdoxslt:set_variable($_XDOCTX, ‘maxYear’, xdoxslt:to_char(concat(substring(Created, 4,2), ‘.‘,substring(Created, 1, 2), ‘.‘,substring(Created, 7, 4)), ‘DD.MM.YYYY’))?>
    and the loop:
    <?for-each:ServiceRequest?>
    <?if: xdoxslt:date_diff(‘s’, xdoxslt:get_variable($_XDOCTX, ‘minYear’), xdoxslt:to_char(concat(substring(Created, 4,2), ‘.‘,substring(Created, 1, 2), ‘.‘,substring(Created, 7, 4)), ‘DD.MM.YYYY’), $_XDOLOCALE, $_XDOTIMEZONE) < 0 ?>
    <?xdoxslt:set_variable($_XDOCTX, ‘minYear’, xdoxslt:to_char(concat(substring(Created, 4,2), ‘.‘,substring(Created, 1, 2), ‘.‘,substring(Created, 7, 4)), ‘DD.MM.YYYY’))?><?end if?>
    <?if: xdoxslt:date_diff(‘s’, xdoxslt:get_variable($_XDOCTX, ‘maxYear’), xdoxslt:to_char(concat(substring(Created, 4,2), ‘.‘,substring(Created, 1, 2), ‘.‘,substring(Created, 7, 4)), ‘DD.MM.YYYY’), $_XDOLOCALE, $_XDOTIMEZONE) > 0?>
    <?xdoxslt:set_variable($_XDOCTX, ‘maxYear’, xdoxslt:to_char(concat(substring(Created, 4,2), ‘.‘,substring(Created, 1, 2), ‘.‘,substring(Created, 7, 4)), ‘DD.MM.YYYY’))?><?end if?><?end for-each?>
    So it gives me all the Service Request records in the time range. For example From Date: 31.01.2005 til To Date 01.02.2005.
    It doesn't give me the To Date result unfortunately, it gives me the correct From Date, but as To Date the result is the same as From Date, what is false.
    The results should be:
    From Date: 31.01.2005
    To Date: 01.02.2005
    Can anybody help me? please?
    Regards

    I can but I was looking for a direct API use if possible here. Our library is so compilcated that I can't use the direct select statement.
    Well thanks, I will be using the select max, min and further writing another API for my use.
    Regards,
    KP

  • Purchase order Text and Basic data text needed from MM03 tcode

    Hi
    I need Purchase order text and Basic data text to be fetched by material number.
    Purchase order text and Basic data text are present in MM03 Tcode.
    Can anyone please guide me how to do it.
    Kind Regards
    Sajid

    hi
    Purchase order text
    GotoMM03 ->view purchase order text.
    In purchase order text screen, below you find one icon 'Editor'
    click on this icon. It will open another screen.
    In this screen -> click Goto Menu->Header.
    It will open the details about Purchase order text.
    TextName (Generally it is material name)
    Language
    Text ID : BEST
    Text Object: MATERIAL.
    Pass the above to READ_TEXT to get the text
    *Basic data text *
    Basic Data Text in MM03

  • HT1655 my i pod shuffle (3rd genration ) is not seeing in itune and all data is erased from there.

    hi i try to reset ipod shuffle(3G) via itunes but as i chossen dan all data got erased from ipod and now i can connect my ipod to itunes

    The three music came with your operating system.
    Sync is only oneway, from PC to your device.  Unless you have the music on your PC, iTunes is going to wipe out what you have on your device if you are syncing to a new library.
    You can only transfer Purchased music over to Itunes on your PC.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/HT1848
    As for you own music, you may have to use a third party software.  A good Free one is called Sharepod which you can download from Download.com here: 
    http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2

  • How do I display today's date and a date 1 month from today in livecycle designer

    Hello,
    Does anyone know how to display a future dates in 3 date fields that would be 1 month; 2 months and 3 months from today?
    I am making a sales contract form and in a date field is today's date (which can be altered if the user needs to change it).  The javascript I have is:
    if 
    (this.rawValue == null){
    var  
    msNow = (new Date()).getTime();
    var  
    d1 = new Date(msNow); this.rawValue
    = util.printd("mmm/dd/yyyy", d1);}
    else  
    { this.rawValue
    = rawValue;
    Then in the next date field i need to display the date 1 month from today
    The third date field 2 months from today
    the fourth date filed 3 months from today.
    Any suggestions would be greatly appreciated.

    Hi Peter,
    If you need to be more exact than adding 30 days then you can use the following code;
    function 
    addMonth(date){
      var year = date.getFullYear();  
      var month = date.getMonth();  
      var day = date.getDate();  month= (month % 12) + 1;  year
    += parseInt(month / 12); 
      var days = daysInMonth(month, year);  
      if (day > days)  {
        day= days;   }
      return new Date(year, month, day);}
     function  daysInMonth(iMonth, iYear){
      return 32 - new Date(iYear, iMonth, 32).getDate();}
    You need to pass in a Date object to addMonth so (assuming DateTimeField1 is your date field);
    NextMonth.rawValue= util.printd("mmm/dd/yyyy", addMonth(
    = util.printd("mmm/dd/yyyy", addMonth(
    Date.parse(DateTimeField1.formattedValue));
    Bruce

  • Can you perform "ymodem" and "kermit" data file transfers from within Labview ?

    If third party software vendors can do this, does anyone know who they may be ? In my application, the final product which I must communicate with is a finished commercial product which uses picodos as the operating system and accepts commands and transfers data over an RF Freewave modem, downloading and uploading files using both "ymodem" in procomm and "kermit"(old program) for large data files. I've got around most of the picodos stuff but I'm left with these two items which do not seem to be handled by National.
    Help !!!!
    Bryce Davis
    email: [email protected]
    902-426-3100 ext 284

    I have searched through our database and the web, and I cannot find any information about these modem protocols. I cannot even find a standard so that you could implement the code yourself. You might consider contacting our aliance members--it appears that some of them had modem toolkits in the past. The aliance list can be found at http://exchange.ni.com/servlet/Redirect?id=6361480
    Jeremy Braden
    National Instruments

Maybe you are looking for