Reading a multiple record types from a single File using BPEL file adapter

Hi all.
We have a requirement where we want to read a CSV file using the BPEl adapter.
Following is the sample of csv file
HDR,1,2,3
---- First transaction starts----
TH,1,2,3
RSD,1,1
RSD,1,1
TD,1
-------Second transaction starts---
TH,1,2,3
RSD,1,1
RSD,1,1
RSD,1,1
RSD,1,2
TD,1
TD,1
-------------Third Transaction starts---
TH,1,2,3
RSD,1,1
TD,1
TD,1
TD,1
TD,1
-------------Fourth Transaction starts---
TH,1,2,3
LN,1,1,1,1,2
-----End of File---
TAIL
I have modified the file with some comments to have some clear understanding.
Basically our file is a transactions file from legacy system & contains mutliple transactions
First line will be a Header record starting "HDR" & contains all summary details about the file.
After it is details of all transactions thorughout the day, each transaction begins with record starting "TH".As shown in all transactions above.EAch transaction can have other multiple records like the RSD & TD shown above.
Our need is to read each transaction from the file & create an instance.How can we configure BPEL to grab the data starting with TH till it encounter's another TH.
Please advise
Krunal

You can't use the wizard to create a schema if a file as complex as this. the good news is that you can create one yourself. What you need to do is create standard xsd that will handle your file, then what you do is add the terminators that determine when a field stops.
Here is an example, hopefully this provides you enough infor for you to make your own.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
targetNamespace="http://Invoice"
xmlns:tns="http://Invoice"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:encoding="ASCII"
nxsd:stream="chars"
nxsd:version="NXSD">
<xsd:element name="Invoice">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="InvoiceHeader" nxsd:startsWith="000" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="tns:InvoiceHeaderDetails" />
<xsd:element ref="tns:LineItem" nxsd:startsWith="001" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="InvoiceHeaderDetails">
<xsd:complexType>
<xsd:sequence nxsd:style="array" nxsd:arrayTerminatedBy="${eol}">
<xsd:element name="BusinessUnit" type="xsd:string" nxsd:style="fixedLength" nxsd:length="13" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="InvoiceNo" type="xsd:string" nxsd:style="fixedLength" nxsd:length="16" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="InvoiceDate" type="xsd:string" nxsd:style="fixedLength" nxsd:length="15" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="VendorNo" type="xsd:string" nxsd:style="fixedLength" nxsd:length="29" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="OriginCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="OperatorID" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="LineCount" type="xsd:integer" nxsd:style="fixedLength" nxsd:length="34" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="GrossAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="17" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="DiscountAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="50" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="FreightAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="93" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="TaxAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="50" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="DiscountFlag" type="xsd:string" nxsd:style="fixedLength" nxsd:length="1" nxsd:paddedBy=" " nxsd:padStyle="tail" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LineItem">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LineItemDetails">
<xsd:complexType>
<xsd:sequence nxsd:style="array" nxsd:arrayTerminatedBy="${eol}">
<xsd:element name="BusinessUnit" type="xsd:string" nxsd:style="fixedLength" nxsd:length="13" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="InvoiceLineNo" type="xsd:integer" nxsd:style="fixedLength" nxsd:length="5" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="DistributionCount" type="xsd:integer" nxsd:style="fixedLength" nxsd:length="5" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="BusinessUnitPO" type="xsd:string" nxsd:style="fixedLength" nxsd:length="5" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="PONo" type="xsd:string" nxsd:style="fixedLength" nxsd:length="10" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="POLineNo" type="xsd:integer" nxsd:style="fixedLength" nxsd:length="38" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="InvoiceLineAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="17" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="tns:Distribution" nxsd:startsWith="002" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Distribution">
<xsd:complexType>
<xsd:sequence nxsd:style="array" nxsd:arrayTerminatedBy="${eol}">
<xsd:element name="BusinessUnit" type="xsd:string" nxsd:style="fixedLength" nxsd:length="13" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="InvoiceLineNo" type="xsd:integer" nxsd:style="fixedLength" nxsd:length="5" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="DistributionLineNo" type="xsd:integer" nxsd:style="fixedLength" nxsd:length="10" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="GLAccountCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="84" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
<xsd:element name="DistributionAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="162" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="DistributionTaxAmount" type="xsd:decimal" nxsd:style="fixedLength" nxsd:length="62" nxsd:paddedBy=" " nxsd:padStyle="tail" />
<xsd:element name="GLDepartmentCode" type="xsd:string" nxsd:style="fixedLength" nxsd:length="10" nxsd:paddedBy=" " nxsd:padStyle="tail"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
cheers
James

Similar Messages

  • Load data from a file with multiple record types to a single table-sqlldr

    We are using two datastores which refer to the same file. The file has 2 types of records header and detail.
    h011234tyre
    d01rey5679jkj5679
    h011235tyrr
    d01rel5678jul5688
    d01reh5698jll5638
    Can someone help in loading these lines from one file with only two data stores(not 2 separate files) using File to Oracle(SQLLDR) Knowledge Module.

    Hi,
    Unfortunately the IKM SQLDR doesn't have the "when" condition to be wrote at ctl file.
    If you wish a simple solution, just add an option (drop me a email if you want a LKM with this)
    The point is:
    With a single option, you will control the when ctl clause and, for instance, can define:
    1) create 2 datastores (1 for each file)
    2) the first position will be a column at each datastore
    3) write the when condition to this first column at the LKM in the interface.
    Does it help you?

  • Read Large Files Using BPEL File Adapter

    Hi,
    I have a scenario, where files of large size in text format are to be read and send to 3rd party. MTOM Policy has to be attached. Files of size 3MB or less are polled and size greater than 3 MB are not Retrieved. How can I resolve the issue. Do I have to break the file and send the data? If so how?
    Thanks
    Ranga

    You have to use streaming feature of the JCA file adapter for handling huge file.
    You could go through the following link
      http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#CIAHHEBF

  • File Adapter - Multiple Record Types to same Target

    I am currently reading in a fixed length file and loading into a table.
    The issue is, some of the lines in my file differ by two spaces at the end. See example below.
    For example,
    Record 1 might look like :
    DD/MM/YY - length of 8
    Record 2 might look like:
    DD/MM/YY{space}{space} - length of 10
    and they both go into the same date column of my target
    Question 1) Is there a way for BPEL to skip the two spaces at the end of each line for Record 2
    Queston 2) I have currently created multiple record types for the two types but it won't allow me in my transformation to map them both to the "date" column in the target table. It says multiple nodes cannot be mapped to the target
    Any help would be appreciated.

    Hi,
    Unfortunately the IKM SQLDR doesn't have the "when" condition to be wrote at ctl file.
    If you wish a simple solution, just add an option (drop me a email if you want a LKM with this)
    The point is:
    With a single option, you will control the when ctl clause and, for instance, can define:
    1) create 2 datastores (1 for each file)
    2) the first position will be a column at each datastore
    3) write the when condition to this first column at the LKM in the interface.
    Does it help you?

  • With Pages 5.2 how can i use multiple language types in a single document

    My Macbook Air Has the version 10.9.3
    I'm used to work with the old version of Page.
    But now I am using the new version of Pages 5.2 (1860).
    I want to know with the new version how do I use an multiple language types in a single document option.
    In the old  version of Pages I was using  Inspector -> Text -> "More" tab -> Language: British Inglese.
    In the new Pages 5.2 I do not know how to do it
    Could you help me?
    melo

    It's not possible to tag text with multiple languages in Pages 5.  Go back to Pages 4, which should still be in you iWork folder.
    For the whole doc in Pages 5, use Edit > Spellling and Grammar > Show Spelling and Grammar.

  • Flat File with multiple record types (OWB 10.2.0.2)

    Hi!
    I`m using OWB 10.2.0.2 and I`m trying to load a flat file with multiple record types, using SQL LOADER.
    In the flat file editor in the Record tab, I`ve set the type values and the corresponding record names like this:
    Type Value Record Name
    ======== ===========
    T TRAILER
    0 DETAILS
    1 DETAILS
    2 DETAILS
    When using this flat file in a mapping to load the data in a staging table, the generated code looks like this:
    INTO TABLE TRAILER
    TRUNCATE
    REENABLE DISABLED_CONSTRAINTS
    WHEN (1:1) = 'T'
    INTO TABLE DETAILS
    APPEND
    REENABLE DISABLED_CONSTRAINTS
    WHEN (1:1) = '0,1,2'
    The above clause (WHEN (1:1) = '0,1,2') is wrong as I expect one "INTO TABLE..." clause for each record type.
    Could this be a bug or am I doing something wrong?
    Thanks a lot for your help,
    Yorgos

    We`re using two target tables, one for the trailer record and the other for the details records.
    We are facing this problem from the moment we upgraded from OWB 10.1 to OWB 10.2.0.2, so we think it must be something with the way the sql loader code is generated in the new version.
    As our data sources are mainly flat files coming from mainframes, this is a huge problem for us. We even asked an expert in DW from Oracle to help us on this, but still haven`t found a solution.
    Is there any workaround for this or should we forget sql loader and go with an external tables + custom PL/SQL code solution?
    Your help is greatly appreciated Jean-Pierre.
    Regards,
    Yorgos

  • Calling  multiple  script  logics from  a  single  package

    Team- How  do i  call multiple  script  logics  from a   single  DM  package...?
    I   know  its  possible  and  have seen  a  prototype  but  cant  recollect  or  find  it on sdn...
    Thanks  for  your  time.
    Vishal.

    Hi,
    You can create a master script logic which will include all the other script logics using the *INCLUDE command and call this master script through your DM package.
    Another way is to have multiple tasks in the process chain which is calling a script logic. You can pass separate script logics to each of the tasks.
    I would prefer the first option
    Hope this helps.

  • Generate multiple idoc's from the single application doc(Sales order)

    Hi All,
    Iam working on a requirement where i have to generate multiple idoc's from a single sales order based on sales org, division on header data and plant at item level, if somebody please let me know how to proceed with this requirement.
    Thanks
    Kashif

    Hi,
    You can create a Z-program and call Function Module  <b>MASTER_IDOC_DISTRIBUTE</b>.
    You can make a call to this FM to send the Idoc as many times as u have plants in your Sales Order.
    You can call FM <b>IDOC_OUTPUT_ORDRSP</b> to fill the IDoc structure.
    Then u can keep the materials of only that plant for which u want to pass on the information.
    Thanks,
    Utsah Garg.

  • Reading a PublicKey \ PrivateKey type from a txt file

    Hi,
    i want to read a PublicKey \ PrivateKey type from a txt file and input it into a method.
    How can i read the data from the file while keeping or converting back to PublicKey \ PrivateKey type?
    I'm working with the following:
    generate = KeyPairGenerator.getInstance("ECDSA", "FlexiEC");                              
    generate.initialize(ecParams, new SecureRandom());
    KeyPair keyPair = generate.generateKeyPair();
    ............continues
    **and then i write the keys to the a simple txt file.**
    thanks!
    Edited by: sk16 on Apr 8, 2010 10:03 PM

    So, if i work with the two above is it ok, like:
    generate = KeyPairGenerator.getInstance("ECDSA", "FlexiEC");
                   generate.initialize(ecParams, new SecureRandom());
                   KeyPair keyPair = generate.generateKeyPair();
                   // Pub. and Priv. key objects.
                   PublicKey publicKey = keyPair.getPublic();
                   PrivateKey privateKey = keyPair.getPrivate();
                   // Write keys to separate files.
                   FileOutputStream fos = new FileOutputStream(publicKeyFile);
                   fos.write(publicKey.getEncoded());
                   fos.close();
                   FileOutputStream fos1 = new FileOutputStream(privateKeyFile);
                   fos1.write(privateKey.getEncoded());
                   fos1.close();
    and then for example>>>
    DataInputStream in = new DataInputStream(
              new FileInputStream("publicKeyFile.txt"));
              byte[] encodedPublicKey = new byte[1024];
              in.read(encodedPublicKey);
              in.close();
              X509EncodedKeySpec encodedPublicKeySpec = new X509EncodedKeySpec(encodedPublicKey);
              KeyFactory keyFactory = KeyFactory.getInstance("ECDSA", "FlexiEC");
              publicKey = keyFactory.generatePublic(encodedPublicKeySpec);

  • Mutiple Rows from a Single Row using SQL

    How can i get Multiple rows from a single row using sql ?
    Example : one row contains the complete address separated by delimiter say comma (,) as address1,address2,city,state,zip,country
    I want to split this row and get the output in multiple rows as address1 address2 city state zip country using sql query.
    Thanks,

    Hi,
    The solution above assumes that the |-delimited entries always contain at least one character. If you have a string like
    1 Elm Street|||Sioux City|IA||it will think 'Siuox City' is address2.
    If you have empty entries, like that, then you need something a little more complicated:
    INSERT INTO table2
    (       address1
    ,     address2
    ,     address3
    ,     city
    ,     state
    ,     postal
    ,     country
    SELECT     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 1), 2)     -- address1
    ,     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 2), 2)     -- address2
    ,     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 3), 2)     -- address3
    ,     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 4), 2)     -- city
    ,     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 5), 2)     -- state
    ,     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 6), 2)     -- postal
    ,     SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 7), 2)     -- country
    FROM     table1
    ;

  • I am using iMac OS 10.7.2 with Garageband'11 6.0.4. I can't record sound from  mixer Behringer X1622USB using USB out. when I connect the mixer to iMac via USB  appears USB Audio CODEC on Sound and preferences but no sound from mixer to iMac. Need help.

    I am using iMac OS 10.7.2 with Garageband'11 6.0.4. I can't record sound from  mixer Behringer X1622USB using USB out. when I connect the mixer to iMac via USB  appears USB Audio CODEC on Sound and Preferences but I can't get no sound from mixer to iMac only sound from iMac to mixer. I only can record sound using microphone line in. Please help.

    Eric,
    Thanks for your reply. Realtek audio works only in playback. There is a stereo mix in the mixer but the recording controls are not operable with no sliders in the mixer for any recording option. Slider controls appear to be grayed out. Can't figure out how to enable them. Downloaded newest drivers to no avail.
    The M Audio control panel has no apparent option for recording stereo mix. Adobe ignores the sound from the DVD or CD and shows flatline.
    I'm trying to record the sound from the DVD not rip the track.
    When I go to Audio Driver Setup and select Audition 3.0 windows sound, there is no input device installed.
    I'm thinking of going back to a decent internal Soundblaster card like I have on my 8 year old machine I am replacing.

  • Why can I copy music to my iPad or iPod touch from multiple computers but from only one computer using my iPhone?

    Why can I copy music to my iPad or iPod touch from multiple computers but from only one computer using my iPhone?
    IPads and iPod Touches don't seem to have the same media copying restriction that my iPhone has. My main computer is at home. I have music at home and at work and sometimes I like to add it to my iPhone from work. I can do this no problem using my iPad or my iPod touch, but when it comes to my iPhone, I can only copy music to it from my main computer.
    Why would the iPhone have this restriction but not the other two devices?
    ps. Where's my "add currently playing song to playlist" button? I can't even find a third-party music app with this feature.

    Because...!
    I've no idea why either.
    Although it isn't normally possible to sync an iPod/iPad/iPhone with two computers (or manually manage an iPhone from more than one) it can be achieved if all computers have copies of the self same library. See Re: how do i sync on a second laptop without the data on my iPhone 5 being erased?
    tt2

  • Process multi-record & multi-record-format files using ESB & File Adapter

    I am looking to process/parse an in-bound file with the following make-up and to load into a database table using the File Adapter, ESB and DB Adapter.
    File Make-Up:
    - each line in the file is a record
    - each record is made up of 12 fields
    - there are multiple record types denoted by the first field in the line
    - record types may or may not have common fields
    - where there are common fields, the field may be in different columns
    - each record is to be inserted into a database table
    Sample File:
    3,,"03-0243-0188132-00",.20,26,075,"","000000006026","","","22/04/08",03 1303
    3,,"03-0243-0188132-00",20.00,26,075,"","","","","22/04/08",03 0579
    5,,"03-0243-0188132-00",99.60,,,"OPENING BALA",,,"ACME GROUP","22/04/08",
    6,,"03-0243-0188132-00",99.60,,,"CLOSING BALA",,,"ACME GROUP","22/04/08",
    8,,"03-0243-0188132-00",-346119.05,16,000,"DEBITS",,,,"22/04/08",
    8,,"03-0243-0188132-00",346119.05,349,050,"CREDITS",,,,"22/04/08",
    9,,"03-0243-0188132-00",-346119.05,16,000,"DEBITS",,,,"22/04/08",
    9,,"03-0243-0188132-00",346119.05,349,050,"CREDITS",,,,"22/04/08",
    Record Types and corresponding format:
    3, Corp ID, A/C Number, Trans Amt, Serial Number, Trans Code, Particulars, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    5, Corp ID, A/C Number, Opening Balance, Serial Number, Trans Code, Particulars, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    6, Corp ID, A/C Number, Closing Balance, Serial Number, Trans Code, Particulars, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    8, Corp ID, A/C Number, Amount, Number, 000, “DEBITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    8, Corp ID, A/C Number, Amount, Number, 050, “CREDITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    9, Corp ID, A/C Number, Amount, Number, 000, “DEBITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    9, Corp ID, A/C Number, Amount, Number, 050, “CREDITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    Please note that record types 8 and 9 have 2 fixed fields.
    I have tried playing around with the File Adapter and the ESB but not having much luck. Can someone provide any suggestions on how I can handle this?

    James,
    Thanks for your prompt response. I have come across your post previously.
    Please excuse my in-experience (very new to SOA and Oracle SOA Suite) but i have not understood how your post regarding the manual creation of an XSD will assist with my problem. Could you possibly further elaborate on the overall approach i should be taking?
    Regards,
    Simon

  • Can we define cursors from in procedure while using .procedure file?

    Hi Team,
    Can we define cursors from in procedure while using .procedure file?
    I have a catalog procedure in which am using cursors and it is working fine. But while trying to create the same procedure using .procedure , the validation is failing with "An error occurred while parsing your procedure".
    Request your suggestions.
    Regards,
    Krishna Tangudu

    Hi Krishna,
    I also tried to find the validation for procedure and failed. What was on my mind when I posted earlier was related to Window -> Properties -> SAP HANA -> Modeler -> Validation Rules but this is not the same for procedure.
    Also the validation error seems to not being raised by Studio but the server, so it's not a frontend validation anyway.
    Trying to replicate your error I create two procedures here and both worked fine with cursor.
    The behavior you found was the same I found, the .procedure goes to repository and _SYS_BIC after activation and .hdbprocedure goes to catalog only.
    As far as I understood as you are moving from catalog (manually) and it worked on catalog (.hdbprocedure), I could check the declaration of table types of header as it's the main difference.
    Despite this investigation of declaration, you can try create it on modeler direct and see what you found on .procedure created. This can speed up investigation.
    Regards, Fernando Da Rós
    BTW: I'm faced an very strange behavior that each caracter I type on .procedure or .hdbprocedure freezes studio by around 15 seconds ?!?!?!?! (studio rev73)

  • How to read relevant record type from file into LSMW ?

    Here my req is like this.
    file with 5 records.
    some of records in file are begin with 'AD'.
    i want to read only that records from file while reading data.
    i created one field in source structure with record type filed.
    even i had given this Identifing Field Content:AD
    but after reading data from file its reading all records from file.
    But it should read only record type AB from source file.
    How can we achieve this?
    Thanks in Advance.

    For this do the follwing steps
    goto step 3 Maintain Source Fields
    press the change mode button  after the double click the filed which is pass the AD value
    then it will appier one popup window in this window you have one check box like " selection parameter for import/convert data"
    tick thic chekc box and save it.
    now when you read the data in Step9 , here you find select options there you enter AD* now you will get the only records start with AD.

Maybe you are looking for