Converting data to char in double quotes.

I need to create a comma separated txt data load file. Each column has to be within double quotes.
"Material","Plant","SOrg" .....
Currently I am doing something like this. ..
Loop at table, for each field, concatenate " field value ".
But I find this solution to be cumbersome as I have to change the data type for each field to character. Is there a better way to accomplish this?
Thank you.

You can create simple Method or Subroutine or a Macro for this purpose.
If you have lot of fields, you can even use RTTS to get the field names and field-symbols instead of writing all the fields.
TYPES:
  BEGIN OF lty_data,
    fld1 TYPE char10,
    fld2 TYPE dmbtr,
  END   OF lty_data.
DATA: li_data TYPE STANDARD TABLE OF lty_data.
DATA: lwa_data LIKE LINE OF li_data.
DATA: lv_char TYPE char255.
DEFINE _con.
  lv_char = &1.
  condense lv_char.
  concatenate &2 '"' lv_char '"' into &2 .
END-OF-DEFINITION.
lwa_data-fld1 = 'c1'.
lwa_data-fld2 = '12345.23'.
APPEND lwa_data TO li_data.
lwa_data-fld1 = 'c2'.
lwa_data-fld2 = '72345.23'.
APPEND lwa_data TO li_data.
DATA: lv_output TYPE string.
LOOP AT li_data INTO lwa_data.
  _con lwa_data-fld1 lv_output.
  CONCATENATE lv_output ',' INTO lv_output.
  _con lwa_data-fld1 lv_output.
  WRITE: / lv_output.
  CLEAR: lv_output.
ENDLOOP.
Regards,
Naimesh Patel

Similar Messages

  • Converting date time string to double data

    I have to plot a bar chart. The VI accepts only 2-d double data. My X- axis is date timestamp and Y- axis is the double data.
    Bt I am unable to convert the timestamp value to double.
    Anyone can suggest anything ?
    Regards,
    Runjhun.

    Thnx a lot Darin.
    Bt may be I should be more clear with my reqmts.
    In the image attached the data to be plotted is stored in Excel from LabVIEW.
    And the graph is plotted in Excel selecting the data.
    Plotting of graph is maual.
    I want that the graph plotting should be automatic.
    In RGT der's a function Excel Plot Graph bt the problem is dat it takes only 2d double array as I mentioned earlier.
    May be dis wil make my problem clearer.
    Regards,
    Runjhun A.
    Attachments:
    plot_type.jpg ‏3724 KB

  • Converting Date to Char

    Using MaxDB Version Version: 7.7.04.28
    I am seeing difficulties with the CHAR(a,t) function. I have an SQL statement where I would like to convert the current date to a string and pick only the year information.
    If I understand the documentation correctly, this should work: CHAR(NOW(),'YYYY')
    However, I find that the second parameter is not a year but a locale.
    This works: CHAR(NOW(),USA) and gives 2009-10-09
    So to get the year information I am doing this: SUBSTR(CHAR(NOW(), USA),1,4)
    But this looks like  a hack. The clean way would be to use CHAR(NOW(),'YYYY'). How come this does not work?
    Many thanks for any help.

    > I am seeing difficulties with the CHAR(a,t) function. I have an SQL statement where I would like to convert the current date to a string and pick only the year information.
    >
    > If I understand the documentation correctly, this should work: CHAR(NOW(),'YYYY')
    You don't understand this command correctly, sorry.
    > However, I find that the second parameter is not a year but a locale.
    > This works: CHAR(NOW(),USA) and gives 2009-10-09
    Yes, sure it works.
    The documentation says that exactly this would happen when you use the command as you did.
    Problem in sight?
    > So to get the year information I am doing this: SUBSTR(CHAR(NOW(), USA),1,4)
    > But this looks like  a hack. The clean way would be to use CHAR(NOW(),'YYYY'). How come this does not work?
    What you do there is a hack, but it's not about the data extraction model.
    There is a specific function for what you want to to: YEAR().
    Have a look at
    [Extraction (extraction_function)|http://maxdb.sap.com/doc/7_7/45/583ea6484365d1e10000000a1553f6/content.htm]
    and the bunch of SQL Tutorials on this topic you also find in the documentation.
    Just as a general hint: don't try to do Oracle with any database that is not Oracle.
    Examples:
    sqlcli db77=> select year(now()) from dual
    | EXPRESSION1        |
    | ------------------ |
    |               2009 |
    1 row selected (168.846 msec)
    sqlcli db77=> select month(now()) from dual
    | EXPRESSION1        |
    | ------------------ |
    |                 10 |
    1 row selected (1406 usec)
    sqlcli db77=> select day(now()) from dual
    | EXPRESSION1        |
    | ------------------ |
    |                 10 |
    1 row selected (1234 usec)
    sqlcli db77=> select dayofweek(now()) from dual
    | EXPRESSION1        |
    | ------------------ |
    |                  6 |
    1 row selected (1671 usec)
    sqlcli db77=> select weekofyear(now()) from dual
    | EXPRESSION1        |
    | ------------------ |
    |                 41 |
    1 row selected (885 usec)
    sqlcli db77=> select now() from dual
    | EXPRESSION1                |
    | -------------------------- |
    | 2009-10-10 08:39:17.890000 |
    1 row selected (28.149 msec)
    regards,
    Lars
    Edited by: Lars Breddemann on Oct 10, 2009 8:40 AM

  • Not able to convert date in char with interval

    When i run below
    SQL> select to_date('20120229','YYYYMMDD') + interval '1' day from dual;
    TO_DATE('
    01-MAR-12
    How can i change this output to YYYYMMDD format.
    Desired output - *20120301*
    I tried with to_char making on above query,It didn't work !

    Hi,
    Not really a SQL Developer tool question. Next time, please try the SQL and PL/SQL forum in the Oracle Database section:
    PL/SQL
    But this will do the trick:
    select to_date('20120229','YYYYMMDD') + interval '1' day from dual;
    select to_char(to_date('20120229','YYYYMMDD') + 1, 'YYYYMMDD') as mydateformat from dual; produces this
    TO_DATE('20120229','YYYYMMDD')+INTERVAL'1'DAY
    01-MAR-12                
    MYDATEFORMAT
    20120301     Regards,
    Gary
    SQL Developer Team

  • Double Quotes Display Question Marks

    I have some data in a tabe that is rendered as some read only output in my JHS app. This works fine in JDeveloper on Linux and JDeveloper as well as deployed on Windows. However in the version that is deployed on Red Hat the double quotes are not displaying correctly and instead display question marks in their place. The import of the database schema worked and the data is in fact double quotes. Wondering what setting I can change that makes this server treat the same data as the other environments?

    Hi,
    This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. Can you please ask this question at the JDeveloper forum at JDeveloper and ADF ? Thanks!
    Regards,
    Evert-Jan de Bruin
    JHeadstart Team

  • Substitution double quotes

    Bingo
    I found the way to change the used substitution smart quotes.
    Open
    <bootVolume>:Applications:iWork '08:Pages.app:Contents:Frameworks:SFWordProcessing.framework:Versions:A:Resourc es:xxxx.lproj:AutoCorrect.plist
    with "Property List Editor" or with "Pref Setter"
    Edit the sibling named: "smartQuotesString"
    In the French version, the original string is:
    replace the two curly quotes by the french "chevrons"
    and at last we have these chars as double quotes.
    Yvan KOENIG (from FRANCE mercredi 16 juillet 2008 19:29:03)

    Check out this thread: http://www.network54.com/Forum/58296/thread/1274327761/substitution+variables+setup+issue
    Here's an example I just tested in 11.1.1.3:
    In a script called test.msh:
    set vardouble = '"' ;
    set varsingle = "'" ;
    alter database Cameron.Basic set variable YourVar $varsingle$vardouble$1$vardouble$varsingle ;
    This worked with a line that looked like:
    essmsh test.msh 1999
    YourVar ended up with a value of "1999".
    Regards,
    Cameron Lackpour

  • Performance question when compare date with date or char with char

    Hello from Germany (Frankfurt) !
    I am working on Oracle 9.2.0.8.0
    and have to solve following problem:
    Comparison of a date and char fields.
    Now two ways to do it.
    Either I compare char with char and convert date to char,
    or I compare date with date and convert char to date.
    Now the performace question. Which operation takes more effort for the database?
    So why not to try and to see the results?
    First create table:
    CREATE TABLE TEST (
    char_date VARCHAR2(8),
    real_date DATE
    NOLOGGING;
    Then insert 1.000.000 rows
    BEGIN
    for x in 1..1000000
    loop
    insert into test (char_date, real_date) VALUES('19990101', TO_DATE('2006.01.01', 'YYYY.MM.DD'));
    end loop;
    COMMIT;
    END;
    Collect statistics
    EXEC dbms_stats.gather_table_stats('TESTER', 'TEST');
    Now run some selects for date to char conversion:
    Elapsed: 00:00:00.00
    SQL> select * from test t where TO_DATE(char_date, 'YYYYMMDD') > real_date;
    no rows selected
    Elapsed: 00:00:03.02
    SQL> select * from test t where TO_DATE(char_date, 'YYYYMMDD') > real_date;
    no rows selected
    And some selects for char to date conversion:
    Elapsed: 00:00:03.02
    SQL> select * from test t where char_date > TO_CHAR(real_date, 'YYYYMMDD');
    no rows selected
    Elapsed: 00:00:02.05
    SQL> select * from test t where char_date > TO_CHAR(real_date, 'YYYYMMDD');
    no rows selected
    Elapsed: 00:00:02.05
    SQL>
    As you see when I compare char with char and convert date to char it seems to be faster (almost 1 second)
    Is the test correct?
    I still not sure, what gets better performance...
    Any idea?
    Thanks!

    Depends on whether you want the right results or not.
    Why don't you run the following two queries and see if the difference in results tells you anything?:
    with t as (select to_date('01/02/2007', 'dd/mm/yyyy') date_col from dual
               union all
               select to_date('02/02/2007', 'dd/mm/yyyy') from dual
               union all
               select to_date('03/02/2007', 'dd/mm/yyyy') from dual
               union all
               select to_date('03/03/2006', 'dd/mm/yyyy') from dual)
    select *
    from   t
    where  date_col < to_date('04/03/2006', 'dd/mm/yyyy');
    with t as (select to_date('01/02/2007', 'dd/mm/yyyy') date_col from dual
               union all
               select to_date('02/02/2007', 'dd/mm/yyyy') from dual
               union all
               select to_date('03/02/2007', 'dd/mm/yyyy') from dual
               union all
               select to_date('03/03/2006', 'dd/mm/yyyy') from dual)
    select *
    from   t
    where  to_char(date_col) < '04/03/2006';

  • Extracting data in .txt which is enclosed in double quote," "

    Hello everyone,
    I am trying to read data from a .txt file which look like below.
    "13.000000,393.000000 13.000000,291.000000 92.000000,284.000000 94.000000,380.000000 64.000000,385.000000 13.000000,388.000000 "The problem is every time i tried to read and save the data, i also save the double quote sign. Is there anyway to ignore the double quote sign? I am using the below coding to read and save the data in double array. Anyway will be great.
         FileReader fread=null;
             BufferedReader bread = new BufferedReader(new FileReader("test1.txt"));
                java.io.File file=new java.io.File("test1.txt");
             java.util.Scanner input=new java.util.Scanner(file);
             while(input.hasNext()){
              String arr=bread.readLine();
    String[][] str = buildArray(arr);

    veldhanas wrote:
    Hi,
    String yourString = bread.readLine();        
             String substring = yourString.substring(1,yourString.length()-1);
             System.out.println(substring);
    [See the String class |http://java.sun.com/javase/6/docs/api/java/lang/String.html]
    ThanksWatch out for those empty lines...

  • Error in Reading the data when double quote(") is present.

    Hi all,
    We are trying to read the delimited data of below type: using file adapter
    00|ABC   |00|          |ZZ|ABC      |ZZ|               |090914|above data works fine ..but when we have data of the below form:double quote after pipe symbol
    00|"ABC   |00|          |ZZ|ABC      |ZZ|               |090914|
    {code}
    when a double is present at the begininng of the pipe sysmbol the message is getting rejected...but when we have other symbol's like single quote or plus sign  at the beggining the its working fine.
    can anyone help me wat the issue is...im using soa 10.1.3.4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    any help.

  • SSIS 2012 - Double quote charcter in data does not allow to load flat file to source component

    Hello everyone,
    I've created a source component for flat file data.
    This file contains data the column data in double quotes. Like,
    First Name Last Name
    "Ankit"       "Shah"
    The text qualifier is double quote for source file connection. 
    When I do have data like below, it does not able to load the source file. And throws an error "The column delimiter for column was not found"
    First Name Last Name
    "Ank"it"       "Shah"
    Can anybody please advise how to resolve this problem?
    Any help would be much appreciated.
    Thanks,
    Ankit
    Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.com

    Please refer:
    http://visakhm.blogspot.com/2014/06/ssis-tips-handling-embedded-text.html
    http://www.ideaexcursion.com/2008/11/12/handling-embedded-text-qualifiers/
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • SQL Loader - double quote within data

    Hi,
    I'm putting together some SQL loader scripts to load source data into a DB. The data we are receiving is comma delimited, optionally enclosed by double quotes (").
    e.g. "abc","123","this is a "test"","987"
    The problem I've got is that some data items contain double quotes ("test") as part of the data and this cause the SQL Loader to fall over with the error:
    Record 14644: Rejected - Error on table x, column y.
    no terminator found after TERMINATED and ENCLOSED field
    Is it possible to load this without changing the extraction process from the source system?
    My .ctl file looks like this:
    LOAD DATA
         INFILE '../data/toload/BR_ADDRESS.CSV'
         APPEND INTO TABLE STA_COMP_BRADD
         FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
         etc....
    Message was edited by:
    MaximumStagg

    Hi,
    Look in to this in Oracle documentation:
    "If two delimiter characters are encountered next to each other, a single occurrence of the delimiter character is used in the data value. For example, 'DON''T' is stored as DON'T. However, if the field consists of just two delimiter characters, its value is null."
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm
    Thanks,
    Kishore

  • Can i export without double quotes in data files?

    How can i export without double quotes in data files using dataexport commands in MaxL?

    I don't know of any way to do any formatting in a straight export out of Essbase.  BSO lets you choose between a columnar vs. free form (really Essbase) format.  That lack of formatting includes removing double quotes.
    If you're willing to put up with the limitations (and formatting issues) of an MDX extract to a log file, that approach does not put double quotes around member names.  The same is true in Report Scripts although I have a vague recollection that you can put in double quotes if you want it -- obviously you do not.
    There are limitations to the above two approaches, the biggest being that they they are not as efficient as a true MaxL export.  OTOH, you may want only part of a database to get exported out in which case either approach may be more to your needs.
    If in fact you do want to do a full export, there are lots of OS-level ways of removing double quotes.  Here's a Windows-based approach:
    Removing double quotes in a batch program in Windows 2003 - Stack Overflow
    What would life be without hacks like the above?  Probably not worth living. 
    Regards,
    Cameron Lackpour

  • Converting a 6 char string to date

    Please help..
    How can I convert a 6 char date (ddmmyy) to date format
    that can be passed as input to function module?

    Hi,
    Try FM,
    CONVERT_DATE_TO_INTERNAL
    Run this sample code,
    DATA:
      my_date(6) TYPE c VALUE '300708',
      w_date     TYPE sy-datum.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        date_external                  = my_date
    *   ACCEPT_INITIAL_DATE            = ACCEPT_INITIAL_DATE
    IMPORTING
       date_internal                  = w_date
    EXCEPTIONS
       date_external_is_invalid       = 1.
    WRITE: w_date.
    Regards
    Adil

  • How to convert DATE variable to CHAR variable

    dear all,
    How to convert DATE variable to CHAR variable
    thanq

    Depending on your final goal here are 2 options.
    DATA: datein        TYPE d.
    DATA: dateout(10)   TYPE c.
    DATA: dateout2(8)   TYPE c.
    datein = sy-datum.
    WRITE datein TO dateout MM/DD/YYYY.
    dateout2 = datein.
    WRITE:/ datein, dateout, dateout2.
    and the output
    05022008 05/02/2008 20080502    

  • Convert double quotes to single quotes

    I'm using a regEx to convert all the double quotes in an xml string before saving to an mysql database (any doublequotes get escaped by the PHPcode).
    buildXML = buildXML.replace(/"/g,"'");
    however after that line all the following turns red (I assume because of the unbalanced double quotes).
    what other way can I express the regEx?

    Your syntax looks fine (that compiles, right?)--FlexBuilder is just not being as smart as it should. The easiest way to fix this is to use a RegExp object instead of a RegExp literal:
    buildXML = buildXML.replace(new RegExp('"', 'g'),"'");
    Maciek Sakrejda
    Truviso, Inc.
    www.truviso.com
    Truviso is hiring: http://www.truviso.com/company-careers.php?i=87

Maybe you are looking for

  • How many computers can i put a copy of dreamweaver on?

    how many computers can i put a copy of dreamweaver on? I am wanting to put it on my home couputer, laptop and work computer Am i able to do this with one serial number? Thanks

  • Hp 6500 officejet 6500 e709n series won't print

    This printer printed a few documents, but, after one week, it would not print, I just get an error message on the screen and my computer has a popup that says "document failed to print".     Officejet 6500 e709n series.

  • 3dmark05 score too low!!!

    my 3dmark05 score is too low. i have a msi 9800 pro(green pcb version.) and i only got 1200 points please help. Also i used to get 6400 points in 3dmark03 but they also dropped to 5000. I also installed the latest chipset drivers and also have cataly

  • Using username and password used in UME

    Hi     i have used UME to authenticate the user and now i want to do as follows.     call a web service and if that logged in user has right to access that web service he will get the result else he will not.    right now i have hard coded the a user

  • Invoice - discount

    Hi Guys, I want to find out the discount amount a customer can take on a invoice (not the discount a customer has taken). Do i have to go back to the billing document for that. But on the billing document i dont find anything like this. Is it a calcu