Comma inside quotes in FCC

Hi Gurus,
In a File Content Convertion scenario, I am having an issue as next:
the sender CC will pick the file and put all data between comas in different fields. Example:
file:
data1, data2, data3
File mapped:
<field1>data1<field1>
<field2>data2<field2>
<field3>data3<field3>
But, there are some fields inside the file that are like this:
data1, "data2 (1, 2)", data3
So, what I need to do is remove comma in between double quotes.
Is this possible? How can I handle this?
Thanks!!

Hi ,
         Unless you are very sure about which field and how many times comma may come,I do not think you can resolve this problem at UDF level, after reading the file using FCC. The FCC you are using  is separating the fields using comma. Thus for  a data like this
data1, "data2 (1, 2)", data3
you will receive
<field1>data1<field1>
<field2>"data2 (1<field2>
<field3>2)"<field3>
<field4>data3<field4>
Now I would rather suggest you to try to change the FCC parameters in such a way that record separator is 'nl' or newline. Thus if you receive  a file like this
data1, "data2 (1, 2)", data3
data1, data2, data3
After FCC you will receive data like this
<mt_record>
<row>data1, "data2 (1, 2)", data3</row>
<row>data1, data2, data3</row>
</mt_record>
Now you need to follow java mapping to get the required target structure. If you are new to java mapping follow these blogs, for PI 7.1
http://wiki.sdn.sap.com/wiki/display/XI/UsingPI7.1APIforJavamapping
If you are working in PI 7.0 you can follow
http://wiki.sdn.sap.com/wiki/display/XI/BeginnersguidetoJavamappingusingDOMparserinSAPXI
     After following the FCC specified here, try doing java mapping.
regards
Anupam
Edited by: anupamsap on Jul 8, 2011 6:48 AM

Similar Messages

  • Unable to Load CSV file with comma inside the column(Sql Server 2008)

    Hi,
    I am not able load an CSV file with Comma inside a column. 
    Here is sample File:(First row contain the column names)
    _id,qp,c
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    "1","[ ""0"", ""0"", ""0"" ]","helloworld"
    When i specify the Text Qualifier as "(Double quotes) it work in SQL Server 2012, where as fail in the SQL Server 2008, complaining with error:
    TITLE: Microsoft Visual Studio
    The preview sample contains embedded text qualifiers ("). The flat file parser does not support embedding text qualifiers in data. Parsing columns that contain data with text qualifiers will fail at run time.
    BUTTONS:
    OK
    I need to do this in sql server 2008 R2 with Service pack 2, my build version is 10.50.1600.1.
    Can someone let me know it is possible in do the same way it is handle in SQL Server 2012?
    Or
    It got resolved in any successive Cumulative update after 10.50.1600.1?
    Regards Harsh

    Hello,
    If you have CSV with double quotes inside double quotes and with SSIS 2008, I suggest:
    in your data flow you use a script transformation component as Source, then define the ouput columns id signed int, Gp unicode string and C unicode string. e.g. Ouput 0 output colmuns
    Id - four-byte signed
    gp - unicode string
    cc - unicode string
    Do not use a flat file connection, but use a user variable in which you store the name of the flat file (this could be inside a for each file loop).
    The user variable is supplied as a a readonly variable argument to the script component in your dataflow.
    In the script component inMain.CreateNewOutputRows use a System.IO.Streamreader with the user variable name to read the file and use the outputbuffer addrow method to add each line to the output of the script component.
    Between the ReadLine instraction and the addrow instruction you have to add your code to extract the 3 column values.
    public override void CreateNewOutputRows()
    Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
    For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
    string line;
    System.IO.StreamReader file = new System.IO.StreamReader( Variables.CsvFilename);
    while ((line = file.ReadLine()) != null)
    System.Windows.Forms.MessageBox.Show(line);
    if (line.StartsWith("_id,qp,c") != true) //skip header line
    Output0Buffer.AddRow();
    string[] mydata = Yourlineconversionher(line);
    Output0Buffer.Id = Convert.ToInt32(mydata[0]);
    Output0Buffer.gp = mydata[1];
    Output0Buffer.cc = mydata[2];
    file.Close();
    Jan D'Hondt - SQL server BI development

  • SQL: how to embed parameter inside quotes for wildcard %

    I would like to know how to modify a SQL statement to embed a
    parameter inside quotes. I want to use the parameter inside of a
    statement such as: SELECT * from table WHERE col LIKE '%@parm'
    I can get the query to work without the parameter, just not
    with it?? Is there a CS3 workaround?
    Thanks

    Well, after plenty of trial and error, it appears I had to
    edit the parameter itself.
    and go from this
    Request.Form["TextBox1"] : ""
    to this
    "%" + Request.Form["TextBox1"] + "%" : ""
    yay!

  • Commit inside pl/sql trasnformation

    In OWB (10.2.0.1) mapping I call custom pl/sql function via transformation operator. Inside this function there is insert to table. Problem is that commit doesn't work during execution of this function when mapping started in normal mode from control center, but if I start it in mapping editor in debug mode all is working fine, commit works. I've tried create this function as AUTONOMOUS_TRANSACTION, but result is the same - no commit inside my pl/sql function.
    Is it possible some how use commit in transformation operator function?
    Thanks.

    Hi,
    you must use the PRAGMA AUTONOMOUS_TRANSACTION.
    In one session you see the inserts also without a commit, so in the debug mode it only seems to work without this pragma.
    Be aware frm the misunderstanding that you can use the results of the autonomous transaction in the calling mapping. Look here: http://orafaq.com/node/1915.
    Regards
    Detlef

  • Commit inside For Loop

    Hi,
    I have a query which is updating millions of records and is inside a for loop . I have issued commit inside that for loop only . Which one will be better . Should I issue the commit inside the for loop or outside it .
    Thanks in Advance,
    Rahul Guha Ray

    No it is not technically true but ajallen has a valid point. Under traditional rollback segment management reading and updating the same table where large quantities of data were changed with frequent committing was probably the number one cause of snapshot too old errors. However, there are many factors that play into this so even under traditional rollback segment management how likely you are to get an error depends: total size of transaction, total run time, concurrent access, and amount on rollback space available.
    With undo segment space management it largely depends on the total transaction size and runtime verse how much undo you have and your retention policy.
    At some point re-opening the query may indeed be a good idea. One approach is to code to re-open the query only on getting the 1555 error. Some updates however cannot be resumed easily as the update does not mark the row in such a way as the query or where clause conditions can exclude it. In cases like this saving restart information with each commit is necessary.
    A lot of different factors have to go into the decision of how often to commit.
    -- Mark D Powell --

  • Commit inside the procedure..

    Hi,
    I have a 3 procedure, which conatain the INSERT, MERGE and then UPDATE.
    I need to put a COMMIT, inside the every procedure. if i leave the commit, when it will be committed.
    Please explain.
    -Sathya

    > I have a 3 procedure, which conatain the INSERT,
    MERGE and then UPDATE.
    need to put a COMMIT, inside the every procedure. if
    i leave the commit, when it will be committed.
    Generally, we can use commit at the end of the procedure and before the exception segment starts. But, since you are calling three procedures - you have to evalaute the bussiness logic of your coding. If it is stated that combination of these three procedure ultimately considered as one work. To establish that - you have to use commit inside the main block from where these three procedure is called.
    Ex:
    Procedure aaa()
       procedure x1( );  --performs some dml
       procedure x2( ); -- again perform some dml
       procedure x3( ); -- perform some final dml
      commit;   -- here you should use the commit
    exception
      when others then
         rollback;The reason is, if there is any exception between the three procedure - all the transactions will be rolled back - thus achieving it as logical unit work.
    Hope this will clear your doubt.
    Regards.
    Satyaki De.

  • Comma and quote problem in csv file

    Hi
    My requirement is to append data in an csv file. This is Proxy to File FCC Scenario. for some of the fields from proxy which contains comma(,) and also double-quote("). for these fileds the in the csv file it is spiting in to two columns and appending in to the next column. and the double-quote symbol is not inserting in the csv file.
    1. why the double-quote(") is not inserting in to the csv file columns?
    2. how to over come the comma problem? I want that particular file need to append in one column only.
    Thanks
    Vankadoath

    hi vankadoath,
    Were you able to solve comma issue in CSV file.
    Even i am facing similar issue.....
    wheneever there is a comma in field, it is updating data after comma into next field.
    If anybody has solution for the same.......
    pls suggest the same............
    santosh.
    Edited by: santosh koraddi on Jan 20, 2011 9:44 PM

  • Spool file with comma including quotes

    Hi All,
    I am getting the csv file however location commas are treated as another column in file. I am expecting based on the below SQL only two columns and all the data should be in two columns though we have comma value in location string.
    CREATE TABLE DEPT ( DEPTNO NUMBER,LOCATION VARCHAR2(255));
    INSERT INTO DEPT (DEPTNO,LOCATION) VALUES(100, 'CHICAGO,NEWYORK');
    INSERT INTO DEPT (DEPTNO,LOCATION) VALUES(200, 'ATLANTA,NEWYORK');
    INSERT INTO DEPT (DEPTNO,LOCATION) VALUES(300'OMHA,NEWYORK');
    INSERT INTO DEPT (DEPTNO,LOCATION) VALUES(100, 'NEWJERSEY,NEWYORK');
    COMMIT;
    sql file :
    set pagesize 10000
    set feedback off
    set heading off
    set echo off
    spool r:\dept.csv
    select to_char(deptno)||','||rtrim(location)
      from dept;
    spool off
    set echo on
    set heading on
    set feedback onEdited by: user1758353 on Dec 6, 2011 7:47 AM
    Edited by: user1758353 on Dec 6, 2011 7:47 AM
    Edited by: user1758353 on Dec 6, 2011 7:48 AM

    try to wrap your column location with a double quotes.
    e.g.
    select to_char(deptno)||','||'"'||rtrim(location)||'"'
      from dept;when you opened your csv file on excel it considers the strings enclosed on a double quotes as one column.

  • Why we cannot commit inside BAPI and what if we call workflow inside BAPI?

    hi,
    can anyone tell me why we cannot use Commit statement inside BAPI ?
    Also what if in my BAPI ,i have triggered my workflow and through that can i commit??
    Regards,
    Mayank

    Hi,
    it is a part of the BAPI programming model that BAPIs use a certain transaction model. This transaction model says that one BAPI has to follow the so called ACID (atomar, consistent, isolated, durable) principle. To ensure that a BAPI is atomar you cannot put a commit work just anywhere in mid of a BAPI as this would violate the modell. Furthermore BAPIs shall allow external commit handling that means it has to be possible to include several BAPI calls in one LUW. For this there are BAPIs which are only for committing or rolling back a transaction. For more detailed information you can check as usual the SAP help [click me|http://help.sap.com/saphelp_nw04/helpdata/EN/a5/3ec8654ac011d1894e0000e829fbbd/frameset.htm]
    If would suppose that when you throw a workflow event it is triggered once the LUW is closed. At least SAP should work that way. But I have to admit in newer ABAP OO developments SAP often just calls the Event raising function module with the option to not wait for the DB commit. Seems there are some problems with the newer LUW concepts / OO and the old workflow technology. This can lead in worst case to events raised for objects which were rolled back later but SAP seems to accept that so it is in my oppinion an acceptable solution.
    Hope that helps a bit
    Roman

  • Comma separated Excel file FCC?

    Hi Experts,
    I have an excel file like below (I have just mentioned the row n column to give an idea):
    first name(A1), last name(B1), street (C1) city(D1), state(E1)
    John (A2), Smith(B2), MacArthur(C2), Dallas(D2), TX(E2)
    Mike(A3), Dale(B3), Main St(C3), Austin(D3), TX(E3)
    Kevin(A4), Costner(B4), 2nd Steert(C4), Houston(D4), TX(E4)
    Can I tranform this into xml out-of-the box using XI 3.0 file adapter file content conversion? If I have to use the module, is there as stadard module available or should have to build from scratch?
    If I open the excel file in notepad, it opens as comma separated text file
    first name,last name, street,city,state
    John,Smith,MacArthur,Dallas,TX
    Mike,Dale,Main St,Austin,TX
    Kevin,Costner,2nd Steert,Houston,TX
    How do I do FCC for the above CSV file? I mean I have one header with the field names and remaings rows as record sets.

    > I have an excel file like below (I have just mentioned the row n column to give an idea):
    >
    PI Standard Adapter will not support Execl files.,there is no standard module available, you have to develop adapter module to process EXCEL files.
    >
    > Can I tranform this into xml out-of-the box using XI 3.0 file adapter file content conversion? If I have to use the module, is there as stadard module available or should have to build from scratch?
    >  If I open the excel file in notepad, it opens as comma separated text file
    >
    If you have comma separated values in text file then you can use file content conversion to convert CSV file in to XML,standard adapter will support this.
    > How do I do FCC for the above CSV file? I mean I have one header with the field names and remaings rows as record sets.
    search in sdn , many blogs available on the same  ,converting CSV to XML it is very easy.
    Regards,
    Raj

  • Commit inside stored procedure

    If you call a procedure from another procedure and issue COMMIT, then you commit not just inner stored procedure, but also outside procedure. Am I right? Can we make SP smarter and commit only statement in inner SP?

    But bear in mind that a rollback will have a similar effect. A rollback of parent transaction will not undo the work done in the autonomous transaction. That might be a issue to watch out for if you wanted to undo all the changes in the event of an error.

  • Regexp return only the text inside quotes

    I'm looking for a way to return only what is between text in a column, or a period if it's between two sets of quotes. There could be any number of occurrences within the text of the column.
    "ENC"."CHECKOUT_TIME"[DATE,7], "ENC"."PAT_ENC_CSN_ID"[NUMBER,22], "ENC"."CHECKIN_TIME"[DATE,7]
    Becomes
    "ENC"."CHECKOUT_TIME""ENC"."PAT_ENC_CSN_ID""ENC"."CHECKIN_TIME"
    Is this something that's possible with a regular expression?

    Hi,
    I'm not sure if that can be done with a single regular expression.
    Here's a way that uses two functions:
    SELECT  str
    ,       REGEXP_REPLACE ( REGEXP_SUBSTR ( str
                           , '("[^"]*"(\."[^"]*")?)[^"]*'
                           , '\1'
                           ) AS new_str
    FROM    table_x
    REGEXP_SUBSTR removes unquoted material before the first double-quote and after the last double-quote.

  • Commit inside backing bean

    Hi,
    I have a submit button in a page. In the action, I gave the page flow that redirects to another page and in the action listerner, I gave the method that it needs to execute. In the method, I am doing some insert rows into a viewObject and I need to do a AM Commit. How to do that? If I drag the commit button into this submit button, the action gets changes to commit.execute. How to do the AM Commit in the backing bean?
    Thanks
    Saru

    Here's how I did it.
    1) Create the commit operation in your data binding. Bind to your AM.
    2) In your backing bean lookup the OperationBinding. (I used the ADFUtil.java from the StoreFrontModule example code for this.)
    OperationBinding commitOperation = ADFUtils.findOperation("Commit");
    3) Then just do:
    commitOperation.execute();
    Rodger...
    Edited by: rodger63 on Jan 5, 2010 1:24 PM
    Edited by: rodger63 on Jan 5, 2010 1:26 PM

  • A solution to parsing CSV records that contain embedded commas in quotes

    I've seen so many people looking to use StringTokenizer or Split to parse a quoted CSV file, only to fail to handle embedded ','s in quoted fields. So i'm throwing in my 2-cents with my solution that anyone can use freely.
    It's small, comes with a little test program and utilizes the String.split function.
    Enjoy,
    Todd Blackley
    [email protected]
    www.pawsource.org
    Copyright (c) 2005 Todd Blackley
    The above copyright notice shall be included in all copies or substantial
    portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
    FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
    COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
    IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    package com.pawsource.model;
    import java.util.*;
    public class Csv
    public     Csv()
    public     void     test1()
         LinkedList     list     = new LinkedList();
         for (int i=0;i<1000000;i++)
         list.add(new String(Integer.toString(i)));
         for (Iterator iter = list.iterator(); iter.hasNext();)
         String     s = (String)iter.next();
         System.out.println(s);
    public     String     toCSV(ArrayList aList)
         StringBuffer     buffer     = new StringBuffer();
         for (int i=0;i<aList.size();i++)
         String     text           = (String)aList.get(i);
         boolean     needQuotes     = text.indexOf(",")==-1?false:true;
         if (needQuotes)     buffer.append("\"");
         buffer.append(text);
         if (needQuotes)     buffer.append("\"");
         if (i<aList.size()-1)
              buffer.append(",");
         return buffer.toString();
    public     ArrayList     parseCSV(String aBuffer)
         String[]     orig     = aBuffer.split(",");
         ArrayList     tokens     = new ArrayList();
         int     index     = 0;
         while (index<orig.length)
         if (orig[index].startsWith("\""))
              int          origIndex     = index;
              tokens.add(orig[index].substring(1,orig[index].length()));
              while (orig[index].endsWith("\"")==false && ++index<orig.length)
              tokens.set(origIndex,tokens.get(origIndex)+ "," + orig[index]);
              if (index<orig.length)
              String     temp = (String)tokens.get(origIndex);
              tokens.set(origIndex,temp.substring(0,temp.length()-1));
         else
              tokens.add(orig[index]);
         index++;
         return tokens;
    public static void main(String[] args)
         Csv     test = new Csv();
         System.out.println("Start...");
         String     buffer     = "1,2,,4,\"5,6,7,8\",9,10";
         ArrayList     tokens = test.parseCSV(buffer);
         for (int i=0;i<tokens.size();i++)
         System.out.println("Token :" + tokens.get(i));
         System.out.println("CVS :" + test.toCSV(tokens));
         System.out.println("Finish...");
    }

    My $0.2 worth for cleaning up the code (nothing to do with functionality and not trying to be critical):
    list.add(new String(Integer.toString(i)));
    shoud be
    list.add(Integer.toString(i));
    no reason to create an extra String since that is what toString() returns
    boolean needQuotes = text.indexOf(",")==-1?false:true;
    should be
    boolean needQuotes = text.indexOf(",")==-1;
    and
    while (orig[index].endsWith("\"")==false && ++index><orig.length)
    should be
    while (orig[index].endsWith("\"") && ++index><orig.length)
    the rest is redundant
    Also, what is "><"?
    Both toCSV() and parseCSV should be static because they contain no state.

  • Placing commas inside method parameters with Doclet API

    I wrote a custom Doclet using the [Doclet API|http://java.sun.com/j2se/1.3/docs/tooldocs/javadoc/doclet/index.html ] (located in the JDK's tools.jar).
    The purpose for the Doclet is to load Java source files and create stubs (which are identical Java source files).
    Here's my Docklet:
    public class MyDoclet {
         private static String DEST_DIR = "./destination/";
         private static String TAB = "\t";
         public static boolean start(RootDoc root) {
             ClassDoc[] classes = root.classes();
             // Parse through class or interface
             for (ClassDoc clazz : classes) {
                    // Print Methods
                    MethodDoc[] methods = clazz.methods();
                    for (MethodDoc method : methods) {
                           Parameter[] parameters = method.parameters();
                           println();
                              print(TAB + method.modifiers() + " " + method.returnType().simpleTypeName() + " " + method.name());
                              print("(");
                              for (Parameter parameter : parameters) {
                                  p.print(parameter.type().simpleTypeName() + " " + parameter.name());
                              print(")");
                              println(" {");
                              println("\n");
                              println(TAB + "}");
              return stub(root);
    }When I run this doclet, it generates the correct code but for methods which have multiple parameters, I can't seem to figure out how to place a comma, after each variable...
    For example, if this was the target class:
    public class Inventory {
       public double adjustTax(int newCoffee, double SALES_TAX) {
          // Implementation
    }My parsed code looks like this:
    public class Inventory {
       public double adjustTax(int newCoffeedouble SALES_TAX) {
          // Implementation
    }Does anyone have a suggestion on how I can calculate or accurately place commas in between the method parameters?
    Thank you,
    Mike

    Already found the solution...

Maybe you are looking for

  • Need help in SQL - subquery

    I have 2 tables. Tbl1 (col1, col2) Tbl2 (col1, col2) all columns are varchar I am writing a sub query like: select * from tbl1 where col1 in (select col1 from tbl2) this works perfectly 1) Now I am writing a function which returns a single value crea

  • White Keyboard issues

    Hi I have had problems with Apple's white keyboard. I believe it's still the latest one. Every 3-4 months of normal usage of my keyboard, the keys start sticking and I find it very hard to type. I have brought the keyboard back, and now this is my FO

  • Siebel Error while configuring in IDM ?

    Hi, I am trying to connect to Siebel system via IDM resource configuration wizard. I have put following 2 jars in WEB-INF/lib folder - Siebel.jar SiebelJI_enu.jar The Siebel version is 7.8.2.3. Please assist. According to Siebel team, all the paramet

  • JDK/JRE release announcement list?

    I've looked high and low, but cannot find anywhere that is a definitive e-mail release announcement distribution point for the JDK/JRE (announcements only, not a bunch of additional "newsletter" content). [email protected] doesn't have such a list, a

  • Heavyweight V Lightweight

    Hi Is there a way to keep a Swing component always "on top" of an AWT component? I have a JSplitPane that contains some "heavyweight" components and consequently when dividers are resized back and forth, sometimes the divider disappears beneath until