File sender  - carriage return and new line as endseparator

Hi All,
I'm stumbled with a problem to set carriage return and newline character as the endseparator (record delimiter)
Scenario: The input file PI is receiving has got few fields which has text in it and the content in this text has got newline characters. So to identify record separator, at  the end of each record the combination of carriage return and new line is added.
In file sender content conversion I've set the folllowing parameters to achieve this:
Row.fieldSeparator :   ,  (comma)
Row.endSeparator  :  '0x0D''0x0A'
Problem: In my sample input file, the first row has a text field with a newline character. When executed PI is splitting the record at the newline character in the text field (instead of combination of carriagereturn and newline which is set in the endSeparator paramter).
Pls advice on how to resolve this .
Happy Holidays!!
amar

Rajesh..Thanks for your quick response
I'm trying with the actual file being provided by the trading partner. I did not generate the file nor changed the file..
Before identifying the combination of carraige return and new line, the adapter is splitting the record when encountered with new line character within one of the text fields.
As you said it worked for you, you do have new line characters within fields in a record?..pls throw some light..let me know for any information..
Thank you
amar--

Similar Messages

  • How to find a carriage return and Line feed?

    I need to detect if a crriage retunr and line feed present on each row in my text file before allowing user to upload the text file
    I know how to remove them from each line but what I need is to detect them no removing them from file.
    Our concern is when the a row does not have carriage return and line feed.
    Is there a way to find this using CF? Please help
    thanks

    That is exactly the problem Dave, if some rows do not have line feed, they're not being inserted into DB, it skips other steps and go right to finish. It looks
    like the file is done processing.
    So I need to do early rejection to this kind of file.
    I used cfloop to catch anything else that do not follow the formatting rules.
    Here is what I already done:
    Right after the file got uploaded, I have these codes:   
    <cfloop  index="x" file="#MyFile#" >
      <CFSETMyLine = Replace(x,chr(9),"|", "ALL")>
      I'm using a few functions, such as, Left(), Mid(), Right(), etc to make sure certain rules are followed.
      Up till here, it's done and tested, everything is working.
      The only problem is when 1 or more rows don't end up with line feed and or carriage return.
      I plan to add some codes to check the end of each row for chr(10) since it is looping for every row anyway.
      If detected, process file normally otherwise stop processing.
    </cfloop>
    So this can't be done in CF?

  • Carriage Returns and Tabs in XML element

    I have a number of carriage returns and tabs within an xml element. When I take that element I would like it to transform to html in which I am then displaying within a JEditorPane. However, when I do this it is one long string. I have tried the xml:space="preserve" within that element and this still is not working.
    Here is part of the xml with the carriage return line feeds. The element that I am talking about is called pseudocode. You can see it is displayed correctly below.
    Design Document XML : <?xml version="1.0" encoding="ISO-8859-1"?><design-doc><title-page><title>Testing Document</title><class-prepared-for>Lloyd</class-prepared-for><authors>Ben Garbers</authors><date-created>September 23, 2004</date-created></title-page><introduction text="This is the introduction. This is the introduction."/><class-definitions><class-definition class-name="ClassOne" visibility="public" class-complexity="not complex"><global-variables><variable visibility="public" name="VariableOne" object="String" comments="This is a String."/><variable visibility="public" name="VariableTwo" object="Integer" comments="This is an Integer."/></global-variables><methods><method name="MethodOne" synopsis="This will do some things." purpose="public" visibility="public"><input-parms><variable visibility="null" name="firstName" object="String" comments="null"/></input-parms><output-parms><variable visibility="null" name="lastName" object="String" comments="null"/></output-parms><local-variables><variable visibility="null" name="age" object="int" comments="null"/></local-variables><pseudocode xml:space="preserve">/* Ensure that player name exist in the system*/
    if (player =null)
         NullPlayerException;
              if (NOT (isPlayerNameExist(player)))
                   throw PlayerNameNotExistException;
              /* Ensure player name exist in the team already*/
              i ? 1;
              while (i <= length(mPlayers)) {
                   if (mPlayers.mPlayerName != playerName)
                        throw PlayerNameNotExistInTeamException;
    this.mPlayers ? this.mPlayers - player;</pseudocode>
    However, when I do the transformation I get the following with the pseudocode:
    /* Ensure that player name exist in the system*/if (player =null)     NullPlayerException;          if (NOT (isPlayerNameExist(player)))               throw PlayerNameNotExistException;          /* Ensure player name exist in the team already*/          i ? 1;          while (i <= length(mPlayers)) {               if (mPlayers[i].mPlayerName != playerName)                    throw PlayerNameNotExistInTeamException;}this.mPlayers ? this.mPlayers - player;
    It looks like it adds some spaces but no carriage returns or line feeds.
    My transformation code is the following:
         public ParseFile(String xmlString) {
              try {
              //Here we will load the correct style sheet for the message
              //that will be formatted.
              String urlString = "DesignDocument.xsl";
              URL url = this.getClass().getResource(urlString);
              System.out.println("URL to style sheet = " + url.toString());
              String styleSheetName = url.getFile();
              System.out.println("Style sheet name : " + styleSheetName);
              InputStream styleSheetInputStream = this.getClass().getResourceAsStream(urlString);
              //We will than load our SAXParerFactory and parse the message.
              SAXParserFactory SPFactory = SAXParserFactory.newInstance();
              SPFactory.setValidating(true);
              SAXParser sp = SPFactory.newSAXParser();
              XMLReader sax2parser = sp.getXMLReader();
              //NO Validation done on for this because we do NOT have a DTD.
              sax2parser.setFeature(
                   "http://xml.org/sax/features/validation",
                   false);
              sax2parser.setContentHandler(new FileContentHandler());
              //we create a character array of the length of the xml message String
              char[] messageCharacterArray =
                   new char[xmlString.length()];
              // we then put the xml string into the character array.
              messageCharacterArray = xmlString.toCharArray();
              // after this ew end up creating a CharArrayReader that will be used by the Sax
              // parser to parse the xml.
              CharArrayReader xmlCharArrayReader =
                   new CharArrayReader(messageCharacterArray);
              // we put the xml character array within the Input Source which will then be parsed
              // by the Sax2 parser.
              InputSource in = new InputSource(xmlCharArrayReader);
              // Use a Transformer for outputting the message into our formatted xml using
              // the stylesheet defined up in a messages own sxl stylesheet file.
              TransformerFactory tFactory = TransformerFactory.newInstance();
              tFactory.setURIResolver(new BasicURIResolver());
              StreamSource stylesource = new StreamSource(styleSheetInputStream);
              Transformer transformer = tFactory.newTransformer(stylesource);
    //          transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    //          transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    //          Properties properties = new Properties();
    //          properties.setProperty("indent", "yes");
    //          properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    //          transformer.setOutputProperties(properties);
              // We will use a ByteArrayOutputStream to put our transformed xml.
              ByteArrayOutputStream bos = new ByteArrayOutputStream();
              StreamResult result = new StreamResult(bos);
              SAXSource source = new SAXSource(in);
              transformer.transform(source, result);
              String s = bos.toString();
              StringBuffer sb = new StringBuffer();
              //This will make sure the Version Line is not shown.
              BufferedReader br = new BufferedReader(new StringReader(s));
              String line = "";
              while ((line = br.readLine()) != null) {
                        sb.append(line);
              bos.close();
              br.close();
              formattedXmlString = sb.toString();
              System.out.println("--------------------------------");
              System.out.println(formattedXmlString);
              System.out.println("--------------------------------");
              } catch (Exception e) {
                   e.printStackTrace();
    I have been searching and trying to figure this out forever. Any help would be greatly appreciated. Bottom line is that I want carriage returns and tabs to work when transferring from the xml to xsl.

    I get the following line when adding the <pre> tags.
    /* Ensure that player name exist in the system*/if (player =null)     NullPlayerException;          if (NOT (isPlayerNameExist(player)))               throw PlayerNameNotExistException;          /* Ensure player name exist in the team already*/          i ? 1;          while (i <= length(mPlayers)) {               if (mPlayers[i].mPlayerName != playerName)                    throw PlayerNameNotExistInTeamException;}this.mPlayers ? this.mPlayers - player;
    On the screen this is shown on 1 line. It looks like the tabs are working correctly. However, the carriage return, line feeds do not seem to be working. The xml that is pushed into the transformation has the carriage returns and line feeds and is formatted correctly. There has to be something happening when the xsl takes the xml String. When I add <BR></BR> within the xml that doesn't seem to work either.
    I am really sumpted. If you could help DrClap I would really be appreciated.

  • XSL mapping of ARTMAS IDoc - carriage returns and white space

    Hi all. I have tried all sorts here and am completely stuck. I am mapping an article master ARTMAS IDoc using XSL mapping and an extra carriage return and white space characters are being added to the FIELD1 and FIELD2 fields of the E1BPE1MARAEXTRT segment and I don't know why! These fields contain all our bespoke field values joined together so they are 229 and 250 characters long respectively, which I think is related to the problem. The mapping program looks like this:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>
    <xsl:template match="/">
    <ARTMAS04>
    <IDOC>
      <xsl:copy-of select="//ARTMAS04/IDOC/EDI_DC40"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MATHEAD"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARART"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARAEXTRT"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MAKTRT"/>
      <xsl:for-each select="//ARTMAS04/IDOC/E1BPE1MARCRT">
        <xsl:if test="(PLANT='D100') or (PLANT='D200') or (PLANT='D300')">
          <xsl:copy-of select="."/>
        </xsl:if>
      </xsl:for-each>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARMRT"/>
      <xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MEANRT"/>
    </IDOC>
    </ARTMAS04>
    </xsl:template>
    </xsl:stylesheet>
    I have a test IDoc going through this and the first 3 characters of the FIELD1 are "BIK". If I look at the source of the XML file, the problem area looks like this:
    <E1BPE1MARAEXTRT SEGMENT="1">
          <FUNCTION>004</FUNCTION>
          <MATERIAL>000000000000895649</MATERIAL>
          <b><FIELD1>
            BIK</b>      0  0.00 T                                    000000001CARRERA FURY 04 20"     CARRERA FURY 04 20" 2005092420040622    X                    00000000   20031104 00200406140000000000                    0.00 0000000
          </FIELD1>
    You can't really see it above, but there is a carriage return and 8 white spaces before the BIK. Where does this carriage return and white space come from?! Any help would be really appreciated - this is driving me crazy!
    Many thanks,
    Stuart Richards

    Stuart,
    I think I know the cause to your problem. I am not an XSLT programmer but based on searching this forum I found how I can acheive the carriage return at the end of my document. Your xsl statement is as follows:
    <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>
    Change the indent value from yes to no. This should remove the carraige return. Hope this works for you.
    I actually need a carriage return and line feed on my document so I am still stuck. All I have acheived is the carraige return.
    Thanks,
    Jim

  • Parsing a csv file with carriage return replaced with #

    Hi,
    We have a weird problem. We are able to download a csv file using standard FM HTTP_GET. We want to parse the file and upload the data into our SAP CRM system. However, the file downloaded, has the carriage return replaced and the character # replaces it and everything seems like its one line.
    I understand that the system replaces the Carriage return with the charater #. My question is, if I try to pass this file into my program to parse for the data, will there be any issues in the system recognizing that "#" that it is a carriage return and that the data in the file is not 1 record but multiple records?

    Hi
    '#' is what you see in the SAP. But the actuall ascii associated will be of carraige return itself. So to identify if you have multiple records of not don't use hard coded '#' but instead use the constant CL_ABAP_CHAR_UTILITIES=>CR_LF.
    Regards
    Ranganath

  • Writing binary data to a file without carriage returns every 512 bytes

    Is there a VI for writing binary data to a file without carriage returns being inserted every 512 bytes?
    Thanks

    Hi Momolxg,
    I could be way off on this. I tried to simulate what you've done by
    making a for loop that would run a set number of times. For my example I
    used 1025. I wired the iteration terminal to a 'Write to SGL File.vi'
    outside the loop with indexing enabled. It wrote the SGL data from 0 to
    1024 to the file. I then read the file with a 'Read Characters from
    File.vi' and searched the output for a carriage return (0D hex). It was
    found five times. The reason why was the SGL number it was reading had a
    13 (0D hex) in it. Perhaps you're running into a similar problem?
    I tried it again, this time using the 'Write to I16 File.vi'. The
    carriage return was found five times: the 28th character the first time
    then on the 512th character four consecutive time
    s after that. I suppose
    that makes sense that you'd find a 0D in the numbers at equal spacings if
    they're incrementing this way... In this case the carriage returns you're
    seeing are actually numbers from your data.
    One big difference is that I'm using a set pattern of numbers. This
    doesn't appear to be your case. Is there a better way we can duplicate
    your problem? It sounds interesting. Again my simulation could be way
    off. (I'm also running this on LV60 for Linux so my results could be
    different)
    - Kevin
    In article <[email protected]>,
    "momolxg" wrote:
    > Is there a VI for writing binary data to a file without carriage returns
    > being inserted every 512 bytes? Thanks

  • Search for multiple values separated by carriage return and not commas

    I have developed a report in BI Publisher that allows a user to enter multiple values that are separated by commas.
    Is there any way of entering multiple values that are separated by carriage return and not commas?
    Any help would be appreciated.
    Thanks

    Here below, without function :
    SQL> with tbl as
      2  (select 0 c1, 'j' c2 from dual union all
      3   select 1 c1, 'k' c2 from dual union all
      4   select 2 c1, 'l' c2 from dual union all
      5   select 3 c1, 'm' c2 from dual union all
      6   select 4 c1, 'n' c2 from dual )
      7  select *
      8  from   tbl
      9  where   c1 in (select substr(mystring,instr(mystring,',',1,rownum)+1,instr(mystring,',',1,rownum+1)-instr(mystring,',',1,rownum)-1)
    10                 from   (select ','||'&str'||',' mystring from dual)
    11                 connect by  level <= length(mystring)-length(replace(mystring,','))-1);
    Enter value for str: 1,2,3
    old  10:                from   (select ','||'&str'||',' mystring from dual)
    new  10:                from   (select ','||'1,2,3'||',' mystring from dual)
            C1 C
             1 k
             2 l
             3 m
    SQL> /
    Enter value for str: 0
    old  10:                from   (select ','||'&str'||',' mystring from dual)
    new  10:                from   (select ','||'0'||',' mystring from dual)
            C1 C
             0 j
    SQL> Nicolas.

  • NEW CELL and NEW LINE

    Hi,
    I am not clear about NEW CELL and NEW LINE in The Main window -> Table -> Footer -> Output options -> Output Table.  Could any one help in explaining exactly what is the purpose of it.
    Thanks
    Ram

    when you are placing a text element, you need to specify whether you want this text element to be displayed in the next cell of the table. If the text element is to be displayed in the next line then you will have to check that as well. So, if you are displaying a list of fields in a row format then for the first field, you check both line and cell and for the rest of the fields you check just the cell.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • How to open animated .GIF files in Photoshop CS3 and newer

    Q: Since ImageReady is long gone from Photoshop, how can I open animated GIF files in Photoshop CS3 and newer?
    A: File -> import-> video to layers.
    In the dialogue box type "*.*" to show all file types.
    Select your GIF file and which frames to import.
    They will now be available in your animation palette.

    Zeno
    curt y, sorry for the late reply, I tried that but I doesn't work. I have to choose at least two files in the Load Layers window in order for the OK button to be available and then some action script uses the different files to make layers and merges them but not from the frames of the gif file. I can undo through the script to see what it did but it never accessed the frames of the gif file, just the first frame. Choosing "make frames from layers" in the animation palette only puts the original files into layers - that is only the first frame of the gif file.
    I guess I'm out of luck with the 64  bit version of Photoshop as Zeno suggested :-(
    What program would you people suggest for opening each frame from gif files?

  • B2CBasket- Sales Order  How to add Vendor partner and new line item of SO

    Hi,
    I want to add the following BEFORE the sales order creation process starts:
    Add a VENDOR partner
    Add a new line item to ORDERADM_I
    I suspect in BADI CRM_ISA_BASKET_ITEMS and CRM_ISA_BASKET_HEAD. I have user 'HEAD' to add extension fields but cant figure the creation of NEW partners and NEW line item.
    regards,
    Dave

    Thank you for feedback Shantoor,
    The CRM_ORDER_MAINTAIN need not be called as this FM is called immediately following almost all of the CRM_ISA_* BADI's.
    For clarification I just want to expand on the solution..
    In all of these BADI's SAP uses the CT_INPUT_FIELDS parameter. This is where you should enter WHICH fields you have made changes to in the exit. CRM_ORDER_MAINTAIN uses the same parameter.
    However the challenge is .. WHAT do you enter in the CT_INPUT_FIELDS. This is where you have to follow a strategy. I yused the following:
    1. Looked where the structure was used in programs/class to see how SAP used it
    2. Set breakpoints at the call of the BADI. Check what CT_INPUT_FIELDS content is (SAP uses same technique)and try and replicate for your new entries.
    I hope this helps those that, like me, battled a bit with the use of these BADI's.

  • How to provide space and new line to the text in AI Script

    how to provide space and new line to the text in AI Script

    ?? can you explain better, can you at least add another sentence?
    space
    var mySpace = " ";
    new line
    var newLine = "\n";

  • How to retain carriage return and spaces in a report..

    Hi everyone,
    I have a TEXT AREA where users enter comments in that like
    First record
    Hi           Carriage returns          spaces
    Second  record
    Hi
    carriage returns
    spaces
    Third record
    Hi
         carriage returns
                                 spaces
    Is it possible to retain the carriage returns and spaces when i am displaying the records in a report.
    For carriage returns i replaced  chr(10) with '
    (without the single quotes). I works fine. But how i can i retain the spacesplease give me some suggestions
    Thanks
    phani

    Hi dimitri,
    Thanks for the reply
    For carriage returns i am doing like this replace(column_name,chr(10),'<"br">') (Ignore the double quotes)
    For spaces is there any ASCII code like chr(10) for carriage returns..
    I mean how to identify Number of spaces in database..
    Thanks
    phani
    Message was edited by:
    phani marella

  • XML is cluttered with carriage returns and line feeds - how to suppress?

    Hi all,
    at least within text paragraphs we would prefer 'clean' XML without carriage returns. Can Framemaker be configured to avoid these control character?
    Below is an example of a DITA file produced by Framemaker. Evidently this is related to the Pretty Printing feature and I do admit that it increases the readability. However they cause some issues for us. Note that the carriage returns in the paragraph are at arbitrary positions, not at the end of the lines as they appear in the Framemaker editor (I inserted the word "End" at the end of the first line).
    Robert

    By default, FrameMaker adds a CR at around 70-80 characters unless instructed to do otherwise.
    Also, soft returns (SHIFT+ENTER) are lost unless you're in a pre formatted element like a <codeblock> (which is probably why there's no CR after your "End" text.
    If you want to limit the seemingly arbitrary CRs, you must tell FM where to put them. Add the following rule to the structure application rules file ..
    element "p"
      writer line break is 99999 characters;
    …scott

  • SQL Loader - CSV Data file with carraige returns and line fields

    Hi,
    I have a CSV data file with occasional carraige returns and line feeds in between, which throws my SQL loader script off. Sql loader, takes the characters following the carraige return as a new record and gives me error. Is there a way I could handle carraige returns and linefeeds in SQL Loader.
    Please help. Thank you for your time.
    This is my Sql Loader script.
    load data
    infile 'D:\Documents and Settings\user1\My Documents\infile.csv' "str '\r\n'"
    append
    into table MYSCHEMA.TABLE1
    fields terminated by ','
    OPTIONALLY ENCLOSED BY '"'
    trailing nullcols
    ( NAME CHAR(4000),
    field2 FILLER,
    field3 FILLER,
    TEST DEPT CHAR(4000)
    )

    You can "regexp_replace" the columns for special characters

  • Receiver File channel for XML files: with carriage return

    Hi all,
    we are using a receiver FILE channel to generate an XML file that is sent to an external partner.
    The XML file looks good in a parser (IExplorer). But in fact there are not carriage return / line feeds between the XML tags
    of the XML payload in the file.
    Our partner now requires the XML file in a more vertical structure which means: for every tag a separate line (like it is displayed in a parser)
    Does anybody know a more general way to convert to a vertical XML structure (so with carriage return line feed).
    There is one entry in the SDN dealing with this topic but suggesting using an UDF. I think this is a very specific way.
    I don't think it is a good way to change/enhance the message mapping just because of a general formating change.
    Is it better to use an XSLT mapping as a second step in the interface mapping or a JAVA adapter module to convert ?
    any experiences? suggestions? examples?
    Thank you very much
    best regards
    Hans
    examples:
    original by XI receiver FILE adapter
    <?xml version="1.0" encoding="UTF-8"?>
    <MT_batchStatus><type>BS</type><header><message><messageSender>SENDER</messageSender><messageDate>20090723143720</messageDate> ... and so on
    required:
    <?xml version="1.0" encoding="UTF-8"?>
    <MT_batchStatus>
    <type>BS</type>
    <header>
    <message>
    <messageSender>SENDER</messageSender>
    <messageDate>20090723143720</messageDate>
    ... and so on

    >
    Hans Georg Walter wrote:
    > Is it better to use an XSLT mapping as a second step in the interface mapping or a JAVA adapter module to convert ?
    > any experiences? suggestions? examples?
    In such a case, the best is to write an generic XSLT or Java mapping that will attempt to do the pretty printing/formatting of the xml.
    The advantage of a generic one is that you can reuse the same class/jar for many other scenarios.
    so the flow will be as below in your interface mapping;
    1. your specific source to target mapping
    2. the generic formatting class

Maybe you are looking for

  • Can I use  a MY Book Pro external 500 gig Triple interface HD with FCE?

    Hey everyone, I just recently bought a Macbook pro and purchased FCE HD 3.5. I want to purchase a high capacity external HD. I want it mainly for my projects with FCE and other members of the family will be backing up to it. I want to keep my project

  • BADI FTR_CUSTOMER_EXTENT Implementation for Facility creation - TM_61

    Hello Experts I am trying to add new tab in the create facility transaction and I feel that the right BAID to do this is FTR_CUSTOMER_EXTENT. I am not able to update the new values in the screen to the database table. I check in the forum and there a

  • Why doesn't copy command in context menu work?When you

    When you right-click on a song and scroll down to copy and select, the paste function is not enabled. So you literally can't copy a song from within your itunes library to a folder. You have to instead go to the extra step and right-click show in fin

  • Tutorial on Dreamweaver templates?

    I am fairly new to Dreamweaver (cs6), having previously designed and maintained a few sites using Freeway. I purchased a template from TemplateMonster.com in the hope that this would simplify the creation of a new site. The template came without any

  • AGAIN - Needed SAX parser for java on Oracle 8.1.5

    like in subject. I load succesful sax2, but i need load more useful parser like from oracle or ibm. But when i try i get a lot of errors like ORA-29534 (NullPointerOperation). Kail