FCC For csv WITHOUT new lines

Hello to everybody,
I trying to do a file content conversion for the following file :
a;b;c;d;a;b;c;d;a;b;c;d
Problem :
file has 4 fields meaning that there is not a nl after each line . The correct file for instance have to be
a;b;c;d
a;b;c;d
a;b;c;d
Target structure :
line
field a
field b
field c
field d
line
field a
field b
field c
field d
etc...
is this achievable ?
just to be more clear :
The incoming csv file has all it's lines continuoysly : no new line after each record ..
Edited by: Laurent Fournier on Jan 20, 2011 2:13 PM

Hi Laurent Fournier,
As you said, if your given a flat file containing "a;b;c;d;a;b;c;d;a;b;c;d" you will replace every 4th ";" with "new line". Then you want it to be converted into XML.
Now let's try to achieve the same using SAP PI. As Sender File FCC can not handle this situation, it should be handled in Adapter module or Mapping.
Let's do it in simple Java Mapping (as Graphical and XSLT can not handle non XML input).
package com.mapping;
import java.io.*;
import com.sap.aii.mapping.api.*;
public class SimpleJavaMapping_PI71 extends AbstractTransformation
     public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException
          try
               InputStream inputstream = transformationInput.getInputPayload().getInputStream();
               OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
               byte[] b = new byte[inputstream.available()];
               inputstream.read(b);
               String strContent = new String(b);
               float fStrContent = strContent.length();
               int iCountColon = 0;
               StringBuilder strOutputContent = new StringBuilder();
               for (int i = 0; i < fStrContent; i++)
                    char cTemp = strContent.charAt(i);
                    if (!";".equals(cTemp))
                         strOutputContent.append(cTemp);
                    } else
                         if (4 != iCountColon)
                              strOutputContent.append(cTemp);
                              iCountColon++;
                         } else
                              strOutputContent.append(System.getProperty("line.separator"));
                              iCountColon = 0;
               outputstream.write(strOutputContent.toString().getBytes());
          } catch (Exception exception)
               exception.printStackTrace();
You can also implement this logic in adapter module in sender channel and then use FCC to convert it into XML. Or you can implement above Java Mapping, followed by another Java Mapping to convert output of above code into XML using DOM parser.
Regards,
Raghu_Vamsee

Similar Messages

  • Report output on one Line, without new line (cariage return)

    Hello I use a user defined report with style plsql. The output is with many dbms_output.put_line and is displays in only one line. May I ask you to get the output on more the one line. For eatch dbms_output I wont to have a new line (cariage return). Many thanks for help in advance

    In the body of the report, I used HTML tags to control the appearance.
    For example, to see what database features you have used in your database today, the following code works well:
    begin
    dbms_output.enable(1000000);
    dbms_output.put_line('<PRE>');
    for rc in ( select output from
       table(dbms_feature_usage_report.display_text)
               ) loop
       dbms_output.put_line(rc.output);
    end loop;
    dbms_output.put_line('</PRE>');
    end; This yields the following output
    DB FEATURE USAGE report for
    DB Name         DB Id     Release    Total Samples Last Sample Time 
    ABCPROD        900004321 10.2.0.1.0             78 09-Oct-09 18:29:17
    DB Feature Usage Summary                       DB/Release: ABCPROD/10.2.0.1.0
    -> This section displays the summary of Usage for Database Features.
    -> The Currently Used column is TRUE if usage was detected for
    -> the feature at the last sample time.
                                              Curr-                                
                                              ently Detected    Total Last Usage   
    Feature Name                              Used    Usages  Samples    Time      
    Automatic SQL Execution Memory            TRUE        78       78 10/09/09 18:29
    Automatic Segment Space Management (syste TRUE        78       78 10/09/09 18:29
    etc.However if you comment the lines with the beginning and terminating tags for preformatted text, then you get output confined to one line that starts out like:
    DB FEATURE USAGE report for DB Name DB Id Release Total Samples Last Sample Time ------------ ----------- and you'll have to scroll to the right or figure how you want to break it up -- That's too much work.
    My configuration:
    Windows XP SP3
    SQL Developer 1.5.5 Build MAIN-5969
    Java(TM) Platform     1.6.0_06

  • FCC receiver file adapter new line 'nl' is not working

    Hi Experts,
    I am doing idoc to file scenario,i have to creart a text file in which each line will have a record.
    i am using
    Recordset Structure -->DeliveryRecords
    DeliveryRecords.addHeaderLine 0
    DeliveryRecords.fieldFixedLengths 4,25,3,10,10,10,8,18,40,10,13,15,10,4
    DeliveryRecords.fieldSeparator '0x09'
    DeliveryRecords.endSeparator  'nl'
    but new line is not working every thing is coming in the same line.i have also tried with '0x0A' , this is also not working.
    Pls suggest what can be done.??

    Hi
    You have to use either fieldFixedLength or fieldSeparator.
    You should not mix together.
    DeliveryRecords.addHeaderLine 0
    DeliveryRecords.fielNames aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn
    DeliveryRecords.fieldFixedLengths 4,25,3,10,10,10,8,18,40,10,13,15,10,4
                       or
    DeliveryRecords.addHeaderLine 0
    DeliveryRecords.fielNames aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn
    DeliveryRecords.fieldSeparator '0x09'
    DeliveryRecords.endSeparator 'nl'
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

  • Sender FCC for CSV file with Reoccuring Record Structures

    Hello,
    I am trying to use FCC to bring in an X12850 Purchase Order file layout WITHOUT using seeburger, etc.
    The Configuration I have in place works if the text file is:
    Heading1
    Heading2
    detail1
    detail2
    detail3
    Footer1
    OR the text file contains:
    Heading1
    Heading2
    detail1
    detail1
    detail2
    detail2
    detail3
    detail3
    Footer1
    Unfortunately, the file I need to work has the format:
    Heading1
    Heading2
    detail1
    detail2
    detail3
    detail1
    detail2
    detail3
    Footer1
    When I try to send process this file I get the error ERROR consistency check in recordset structure validation (line no.6 : missing structure(s) before type detail1
    Is it possible via FCC to bring in this file as XML?

    If you change the record sequence to variable it works.

  • Spooling via DBMS_OUTPUT.PUT_LINE without new lines

    Is there a way to spool output to a file using DBMS_OUTPUT.PUT_LINE so that each line is placed on a same line? ie spool all output to one line?
    I guess this probably goes against design of PUT_LINE as it is mean to put a line.
    What I am trying to do is build a DOS command via a SQL script that spools to a file all on one line. this is so that when the spool file is run (either as a .bat or .sh file) the command can execute correctly since it is all on one line.
    Any ideas?
    Leigh.

    You can try below code.
    create or replace procedure p1(P_AMU varchar2) as
    cursor cu_get_workbooks is
    select '/workbook "'||doc_created_by||'.'||doc_name||'"' workbook
    from (
    SELECT EUL4_DOCUMENTS.DOC_NAME,
    DOC_CREATED_BY
    FROM EUL4_DOCUMENTS EUL4_DOCUMENTS
    WHERE DOC_CREATED_BY=P_AMU;
    str varchar2(4000);
    begin
    for cu_rec in cu_get_workbooks loop
    str := cu_rec.workbook;
    end loop;
    insert into temp values (str);
    end;
    And then you can write a sql script:
    exec p1(&&AMU);
    select * from temp;
    Regards,
    Vidyadhar Singh.

  • NXSD translator for CSV file (Header-Line-Trailer)

    Hi,
    We have to process the file coming in below format.
    File Format-
    Header Line (Only once)
    Payload lines. (is unbounded)
    Trailer Line (only once) ----> this is what i like to skipped by adapter.
    Sample file-
    2013-10-10
    1,2,3,4,4,5,1
    35,5,5,66,6,1,1
    2
    We don't have any record identifier to identify the record type. Only info we have is that first record will be the header and last records will be the trailer and in between that we will get payload.
    Can some one tell how to create XSD for above type of file?
    Thanks,
    Ab

    Hi Puneet,
    As you suggested I generated a separate schema for header+payload and trailer and tried to merge them using both choice and sequence. But not of them seems to be working.
    are you sure that we can handle this scenario in xsd?  Below is the generated schema.
    File Format-
    Header Line (Only once)
    Payload lines. (is unbounded)
    Trailer Line (only once) ----> this is what i like to skipped by adapter.
    Actual data file-
    2013-10-10
    5561386532;11111111;INDIA
    5561386532;44444444;INDIA
    2
    Schema for Trailer-
    <?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"
                xmlns:tns="http://TargetNamespace.com/bn"
                targetNamespace="http://TargetNamespace.com/bn"
                elementFormDefault="qualified"
                attributeFormDefault="unqualified"
                nxsd:version="NXSD"
                nxsd:stream="chars"
                nxsd:encoding="US-ASCII"
    >
      <xsd:element name="Root-Element">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="rec" minOccurs="1" maxOccurs="1">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
    Schema for Header+Payload-
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
                xmlns:tns="http://TargetNamespace.com/bn"
                targetNamespace="http://TargetNamespace.com/bn"
                elementFormDefault="qualified"
                attributeFormDefault="unqualified"
                nxsd:version="NXSD"
                nxsd:stream="chars"
                nxsd:encoding="US-ASCII"
                nxsd:hasHeader="true"
                nxsd:headerLines="1"
                nxsd:headerLinesTerminatedBy="${eol}"
    >
      <xsd:element name="Root-Element">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="rec" minOccurs="1" maxOccurs="unbounded">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="C1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C2" type="xsd:int" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
                  <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                </xsd:sequence>
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>  
      </xsd:element>
    </xsd:schema>

  • For Adding up New Line in existing PO

    Hi,
    I have created PO through Import Standard Purchase Order and now client requires to add more line into existing approved PO which has been migrated through interface table.So,I wanted to know what necessary steps I need to follow for adding lines into existing purachse order.I tried to update action column as 'ADD' in po_headers_interface table but everytime records is being rejectd.
    Please help me if anybody knows the solution.
    Regards
    DS

    hi,
    you want to do change PO, if it is the case, oracle has provided public APIs to do the changes. for details you can refer manufacturing api's and po interface tables pdf docs.
    sen

  • Adding new line item directly to PO

    Hi,
    We have a requirement for adding a new line item directly within the Purchase Order in SRM (without using the shopping cart). We are using the FM BBP_PD_PO_UPDATE for this purpose. However, we are getting the following error while updating. " BUFFER TABLE NOT UP-TO-DATE". Please provide assistance in order to resolve this issue.
    Regards,
    Arun

    We achieved  based on the Security roles to identify if the user is Requester or Purchaser or Manager and Webdynpro changes by the portal team to activate the Change and Order button based on the required business rules.
    Transaction Code for PO Change to be added to the security role.
    Requisitioner:  Any user with out any existing A012 relationship with any existing Organizational units on the current date:
    Manager:  Any user having A012 relationship with any existing Organizational units on the current date.
    If the Authorization object checked programmatically results the value of "PUR" then the standard SAP code for "Purchaser" has to be executed.
    Some additional Info :
    Control list of PO using BADI BBP_WF_LIST - Change Work lists and Search Results Lists   Method:  BBP_WF_LIST
    Badi -BBP_AUTHORITY_CHECK for any additional authorisation checks
    Hope this helps.
    Thanks
    Balaji

  • New line character not read..

    Hi guys;
    i'm writing a jsp application that has to write into a file...
    the file has to be in the form of multiple lines of the form : login=password
    i did the following:
    String s=new String("");
    String s2=new String("");
    BufferedReader in = new BufferedReader(new FileReader(
    "c:\\myflash\\myfile.txt"));
    while((s=in.readLine())!= null){
    s2 +=s+'\n';
    s2 +=login+"="+password;
    in.close();
    PrintWriter outer = new PrintWriter(new BufferedWriter(new FileWriter(
    "c:\\myflash\\myfile.txt")));
    outer.println(s2);
    outer.close();
    the problem is the following: when i run the applications the data are written in the file without new line ...
    it seems that the '\n' character did not got read!!
    I don' know what's the problem!
    please help!...

    are you testing this on Windows? Are you determining that the newline chars aren't there by opening the file in another program? Most Windows programs will not recognize the \n by itself. It needs the \r\n combination. You might want to use System.getProperty("line.separator"), which will return the correct OS-specific line separator character(s).

  • Problem in creating New line in --File writing(Urgent)

    Hi all
    I am facing a tipical problem.
    I am writing a Text file using FileWriter and i am using "\n" for writing a new line,
    but when i open notepad all are falling on a single line with a special char
    (if i open the text file in some other editor vie wis very fine)
    C-0-1@C-1-0@ C-2-1
    @ is where i am writing new line.
    but this king of writing is not supported by my third party tool to which i am sending the text file
    as parameter..
    Kindly any one provide me a solution.
    Bye

    newlines differ between windows and linux/unix. Windows' new line character is somthing like "\n\m" where linux uses "/n". So to keep your program platform independent I would suggest using System.getProperty("line.separator") so your code might look like:
    String s = "C-0-1" + System.getProperty("line.separator") + "C-1-0" + System.getProperty("line.separator") + "C-2-1";
    //then write the string to the filethis will give you the appropriate newline character for the platform your program runs on.

  • New line in concat function in message mapping

    Did any1 succeded adding 2 xml elemnts with LF/CR ( new line ) between them?
    so when I use content conversion to txt file it will put new line between this 2 elements?
    I tried the following delimiters
    '0x0D''0x0A'
    'nl'
    ''0x0D''''0x0A''
    nothing worked
    thx
    Shai

    Shai,
    Here is a simple udf for adding a new line between two fields. Similarly you can extend it.
    Create a "Value" UDF as name "input" and add two arguments 'a' and 'b'.
    Add this code:
    String lines;
    lines = "";
    lines = lines.concat(a + '\n' + b + '\n' );
    return lines;
    Also while testing in test tab if you dont see the new line in the ouptut then view the source of the output. There you can see the new line.
    Regards,
    ---Satish

  • How to add the new line in reciever FCC

    Hi All,
    I have my reciever FCC with me, but I just need to add one more additional line or you can say seprate the first line.
    So how to add extra or new line in the current structure?
    Please let me know if there is any parameter for this.
    Thanks in advance.
    Regards,
    Rahul Kulkarni

    Hi Rahul,
    You can achieve this by endseperatot "nl"
    If record set structure is * means fine, you just add second line field names by using end separator "nl".
    If you added first line names in recordsetstructure add second line names as well and remaining same use end separator.
    Example (below file is having two lines):
    <NameA>
    name,address,id
    empid,sal,region
    <NameA/>
    your FCC will be (according to your requirement the below 3 fileds will be use full).
    Recordsetstructure  - *
    NameA.fieldvalues - name,address,id
    NameA.endseperator - nl
    NameA.fieldvalues - empid,sal,region
    Thanks & Regards,
    A.Neelima.

  • Broken 5s glass, sell for parts, end contract, pay ETF, add new line?

    Broken screen on 5s. Touch works, but glass is shattered. Contract with ATT (6 weeks into it).
    Is it an option to sell the phone as is, end my contract with ATT, pay the ETF, and then add a new line?
    Assuming I can do this, it will be cheaper than doing an Apple OOW repair, which is $270 at the moment. New 5s at Best Buy currently $150. Even with the new activation fee, I should be ahead.

    You're assuming, though that they're going to let you sign a new 2 year contract after terminating yours after less than 2 months. They may not do that without a security deposit. You may want to make sure first. Otherwise, you might be finding yourself paying full retail for a new phone.
    This is one situation where I might actually encourage you to look into buying salvaged parts on line and trying to repair it yourself or finding a 3rd party repair shop and seeing if they can fix it for you. I don't normally do that, but compared to trying to sell it for parts...

  • Exporting string to csv keeping commas and new lines

    Hi there,
    I am exporting string to csv and have been removeing new lines and commas like so
    thing.toString().replace(/\n/g, '').replace(',','') ;
    how can I do this iwthout losing the line breaks and commas? I can't have them in atm because messes up the csv.

    JSON is for 'transfering' information that can be reassembled into number, string, array, object, etc. format afterwards.
    Excel can import CSV but it might not understand the complexity of the information. Tyically what you would do is serialize complex information with JSON, recieve it on the other side (wherever that might be) and then deserialize it. After you deserialize it using JSONs abilities to turn your information back into what is was (numbers, strings, arrays and object) it is up to you how you restructure the data for the format you choose.
    Your original intent of preserving CSV is best for Excel or OpenOffice Calc. You didn't mention your intent. JSON would package those (CRLF) \n's for you.

  • No new line needed in FCC

    Hello friends,
    We have a requirement where we don't need a new line to the record in the FCC.
    If we don't specify 'nl' also, the new line seems to be the separator.
    we don't need the separation and need all the records to come in the same line.
    how can this be done?

    Hi,
    >>If we don't specify 'nl' also, the new line seems to be the separator
    This happens because the default value is a line break (no explicit separator after the last column; instead the structures are arranged line-by-line).
    So to satisfy your requirement, you need to add the following:
    Set the value of <Name>.endSeparator as '  ' ,    i.e set  space as the fieldSeparator because you donot need a new line.
    For details about FCC on the receiver adapter, please refer this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm
    Hope it solves your problem !!!!!
    Thanks
    Biswajit

Maybe you are looking for

  • KSU1 selecting data by internal order

    Dear all, I have faced following problem and need your advice. In my company there are cost centers with two types of posted positions. The first type are positions with cost center as real CO object  and statistical order. Second one is group of cos

  • Web IC Sales Order ERP Integration (Workcentre IC_SLO_ERP)

    System: CRM 2007 s4 and ECC 6 I have integrated ERP Sales Order within my Web IC aplication.  I'm able to create ERP orders from within the CRM based Web IC using the work centre IC_SLO_ERP.  I can save the orders and the orders are saved to SAP ECC

  • I cant sign in my account to the ps vita

    I just made a new account in ps and i cant sign in It just show me You must sign in with the account that is linked with the system. (NP-2100-3)

  • HOW DO I RESTORE DELETED FILES FROM CREATIVE MEDIA ORGANIZER

    I? stupidly deleted the wrong files from the organizer, lost nearly all my music !!? Is there anyway I can get them back ?I can't play anything on Windows Media either. I have all the music on my Zen Jukebox still but it did not transfer all tracks b

  • MDT 2013 Remote Monitoring and LocationServer.xml

    I recently set up MDT remote monitoring on our main deployment server and I've noticed some odd behavior. I have two shares on the server (one for deploying Server OSes and one for deploying Client OSes). Oddly enough remote monitoring appears to pic