Keeping leading zeros

I have a series of reports that use Account segmentations that are based on a string of numbers. Unfortunately some of these strings of numbers have leading zeros. (eg. 0023, 0123)
When the reports are downloaded to excel these leading zeros are lost. Any words of wisdom on how to keep these leading zeros in the report when downloading to excel?

How would I put the value into double quotes?
Would this be done under Edit Column Formula?
If so, I must be doing something wrong. The current column formula is:
Campaign."Source Code"
If I change it to:
"<Campaign."Source Code">"
I get the following error.
[nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <Code>: Syntax error [nQSError: 26012] . (HY000)
SQL Issued: SELECT "<Campaign."Source Code">", Campaign."Campaign Name", Campaign.PICK_0, Campaign.PICK_1, Campaign.PICK_2, Campaign.PICK_3, Campaign.PICK_4, Campaign.PICK_5, Campaign.PICK_6, Campaign.PICK_7, Campaign.PICK_8, Campaign.PICK_9, Campaign.Status, Campaign.TEXT_31, Campaign.TEXT_32, Campaign.TEXT_33, Contact."Contact First Name", Contact."Contact Last Name" FROM "Campaign Response Analysis"
Please advise.

Similar Messages

  • How to keep leading Zeros in a CSV file

    Hi All -
    I am trying to keep leading zeros in CSV file. Ex. I need 00001 but not just 1. I tried formatting the cells but not getting saved. Any advise please.
    Thanks.

    Dear Super Man  ,
    Try using ALPHA Conversion Routine
    ALPHA Conversion Routine
    The ALPHA conversion is used in the BW system for each presetting for character characteristics. The ALPHA conversion routine is registered automatically when a characteristic is created. If you do not want to use this routine, you have to remove it manually.
    The ALPHA conversion routine is used, for example, with account numbers or document numbers
    For more details
    http://help.sap.com/saphelp_nw04/helpdata/en/9b/f9c18f5a07f0459127e9676ae22a54/frameset.htm
    Hope it helps
    Regards
    Bala

  • Convert hex to Decimal and keep leading zeros..

    Hi,
    I hope you can help?
    How to convert hex to Decimal and keep leading zeros
    I read 002C, hex, and I want to convert it to 0044 decimal.
    sscanf (MyNum, "%4x", &DecNum); will only give me 44.
    It have been working up till I started to get leading zeros.
    We will always have a 4 digit hex input in a range
    We must have the leading 00 in this case.
    How is this best done?
    Thanks for the help
    Simon
    Solved!
    Go to Solution.

    Hi,
    I don't really understand your problem. Is this stuff what you need ?
    int main (int argc, char *argv[])
    const char MyNum[] = "002C";
    int DecNum;
    sscanf (MyNum, "%4x", &DecNum);
    printf ("%04d", DecNum);
    getchar ();
    return 0;
    "0044" appears on standard output when printf function executes...

  • Help keeping leading zero String- Long

    Hello
    I wonder lets say I have a String "09090" how do I convert this String to a Long and keeping leading zero so the Long is 09090?
    /D_S

    Numeric types like Long (or long) are numbers, not strings, so they have no formatting notions like leading zeroes. If you want to maintain the string "09090" keep the string around, even if you have to parse it as well. By the way, you forgot to describe what your goal is, what you are trying to do and what it has to do with leading zeroes.
    One more: Why does this print false?
    System.out.println(07070 == 7070);Hint: this generates a compile-time error:
    System.out.println(09090 == 9090);

  • Keeping leading zero intact  in mail attachment

    Hi All,
    I am sending the excel document into recipients mail id but the leading zero's in the data get truncated.
    I have read so many posts in the forum but did not find any answer to get this done. Some trails i did as follow:
    1. Adding  apostrophes ( ' )  doesn't satisfy my requirement.
    2. Data is good before passing it to mailing function module.
    3. All function module i have tried like SO_NEW_DOCUMENT_ATT_SEND_API1, SO_DOCUMENT_SEND_API1 etc.
       None of them satisfy my requirement.
    Can someone tell  the exact solution?
    Thanks in advance.
    Rudhir Bhaskar

    That's not an SAP email issue though.  I'm sure you'll find that if you open the sent file from a text editor, either from the email client directly or after saving it, that the leading 0's are intact.  Excel is simply interpreting the field as a numeric field upon opening and dropping them.  You need to run the text import wizard and specify the fields as text in order to keep them.

  • Export jsp content to Excel -- how to keep leading zero?

    Hi:
    I am trying to export a JSP content to Excel by using
    response.setContentType( "application/vnd.ms-excel" );
    response.setHeader( "Content-disposition", "attachment; filename=pc.xls" );
    it was working great except my jsp has a field whose value consist of leading zero. i.e. 000XXX. Excel strips the leading zero, but I would like to keep them. Please advise.

    hi Chang,
    Can you please check my thread http://forum.java.sun.com/thread.jspa?threadID=737238&tstart=0
    I think you might know the answer since it is similar functionality but for text files.
    Thanks !

  • Keeping leading zero of an integer

    Wondering if anyone can help me solve this small problem.
    Here's what I had:
    for(int i=01; i<13; i++) {
       String month = "2003" + i;
       System.out.println(month);
    }This gives me the following output:
    20031
    20032
    20033
    20034
    20035
    20036
    20037
    20038
    20039
    200310
    200311
    200312
    However, I want the output to be:
    200301
    200302
    200303
    200304
    200305
    200306
    200307
    200308
    200309
    200310
    200311
    200312
    Then I tried this:
    String year = "2003";
    String month = new String()
    for(int i=01; i<13; i++) {
       if(i<10)
          month = year+"0"+i;
       else
          month = year+i;
       System.out.println(month);
    }The code above gives me the results I want. However, I'm thinking that there has to be a better way to do this. Is there anyway to increment the variable i and kept it two digits? I mean keeping the leading zero until it gets to the number 10? Any ideas?

    the previous poster is right. It's also a little odd how you have things setup, in that you're expressing dates with an unusual approach (most people would use Date or Calendar), but, if you want to keep like you have it, I think this might be the easiest solution:
    int date = 200300;
    for (int i = 1; i < 13; i++ ) {
      System.out.println(date + i);
    }

  • Keeping leading zeroes in flat file

    I am loading data from a flat file to a DSO.
    One of the columns in the flat file is data type CHAR with a length of two. The data values will be either 01, 02 or 03.
    When I load the data, the leading zeroes are dropped. Thus, I see 1, 2 and 3 in my DSO. How can I prevent this happening?

    Hi,
    Right Click on that column in Excel file and Formate Cells >Custome> Under Type give "00" and then give the values in column like 01 , 02 .... and save as .csv and close it, immediatly load it, DON"T OPEN FILE, because , if you open it will reset to 1, 2... SO again you need to Right click.....and formare cells..
    Thanks
    Reddy
    Edited by: Surendra Reddy on Jun 24, 2010 4:28 PM

  • How to keep leading zeros using SAP_CONVERT_TO_XLS_FORMAT

    my leading zeros  drop when download using FM-SAP_CONVERT_TO_XLS_FORMAT, how to fix it?

    Hi,
    You can try as below.
    Let's for the 10 digit numeric field, using the function module CONVERSION_EXIT_ALPHA_INPUT, you can get the 10 digit number with leading zeroes.
    Now if you declare the char of 10 in length field in the internal table will be replaced with the above value.
    Now it will be downloaded as required.
    Regards,
    Nishant Malhotra

  • How to keep leading zeros in numeric Keynote entries?

    When I try to enter numbers that start with zeroes in a table, Keynote removes the zeroes. For instance, I type 007 and it gets "corrected" to 7. Also, for instance, when i type false in lower case, it gets changed to FALSE.
    How do I stop this? I found the Auto-correction tab in Preferences, but everything is unchecked there except for the things that deal with email and hyperlink underlining.

    Ok, naturally I found it after I posted the question. I go to Table in the inspector window and change Cell Format from Automatic to Text.

  • String to double conversion, but keeping leading zeros?

    Hopefully a simple one for you gurus,
    double theValue = Double.parseDouble(aString);works fine, but the input string is say, "08.00", then theValue = 8.0, I want 08.00, how would I go about implementing this?
    tia.

    You will get ur question answered at the following webpage:
    http://java.sun.com/docs/books/tutorial/java/data/decimalFormat.html
    --DM                                                                                                                                                                                                                                                                               

  • Remove leading zeros, divide by 1,000,000 and keep 2 decimals

    I have a field named PLCOST which is a varchar(15) field. It has entries that look like this:
    000000022410000
    This entry represents $22.41
    I want to convert the field to a decimal (10,2) type so it looks like this: 22.41
    To do this I need to:
    a) Remove the leading zeros
    b) Convert the entry to a number
    c) Divide the number by 1,000,000
    d) Cast the result as a decimal (10,2) type
    I know that this code will remove the leading zeros:
    SUBSTRING(PLCOST, PATINDEX('%[^0 ]%', PLCOST + ' '), LEN(PLCOST))
    But my effort to perform the other manipulations result in an error.
    I tried this:
    cast(convert(SUBSTRING(PLCOST, PATINDEX('%[^0 ]%', PLCOST + ' '), LEN(PLCOST))) /1000000 AS DECIMAL(10, 2))
    But I get an incorrect syntax error at the first instance of 'PLCOST'. (Got this info from an error checking program).
    Thanks for any help you can give with this.

    Actually this will work... Doing a replace on the zeros will kill any number that actually has a legit 0 in the value.
    declare @col varchar(20)='000000022410000'
    SELECT
    CAST(CAST(@col AS INT) / 1000000.0 AS DECIMAL(10,2))
    Casting to an INT handles the leading zeros and dividing by 1,000,000.0 allows the int to be divided and maintain the values after the decimal.
    HTH,
    Jason 
    Jason Long

  • Leading zeros in apex reports

    Hi,
    In an apex application, when user downloads data from an apex report into csv, it loses the leading zeros because excel thinks it is a number.
    Is there a way to keep the leading zeros?
    Thanks

    I'm afraid but I think that the simplest way is to "quote" the string (so that Excel take it as "text").
    Example:
    SELECT
    '="'|| c1 ||'"'
    FROM
    select 'MX190' c1 from dual
    UNION ALL
    select '00190' c1 from dual
    Or, sometimes, I save the ".csv" file and load it with Excel's Wizard that allow to specify the column to be considered text ...
    But for a normal user is a complex solution...
    Thanks
    Stefano Corradi

  • Leading zeros in excel

    Hi,
         I am trying to load a flat file in .csv format but whenever I open the file I am losing the leading zeros. It is very cumbersome for me to do those changes in notepad.
    Does one know how to keep the leading zeros even when I open in excel and edit and save? I changed the format of that column to text but if I close the file and next time I open the file, it is again back...
    ANy suggestions please?

    Hi,
      In excel, make the columns as text and save it. Then save as .csv format. But dont open the csv file becoz if you open, it will get its orginality back. So if you want to see whether it is in text format or not just open the csv file in notepad format. Now you can see leading zeros in the notepad. Without opening the csv file only, load the file.
    Regards,
    Bindu

  • Leading Zeroes are lost when convert from string to int

    What I'm trying to do is simple yet the solution has seemed difficult to find.
    I have a system that requires 4 digit numbers as "requisitionNo". The system uses JSPs and accepts the 4 digit number that the user inputs (fyi - duplicate handling is already managed). The input number (rNumber) is of STRING type and in the action (using struts) is converted to an int:
    int requisitionNo = Integer.parseInt(rNumber);At that very line the issue is that when the user inputs a number with leading zeros such as: "0001" the 3 leading zeros are chopped off in the INT conversion. The application validation kicks in and says: "A 4 digit number is required" which is by design. The work around has been that the user has been putting in number that start with 9's or something like that, but this isn't how the system was intended to be used.
    How do I keep the leading zeroes from being lost instead of saving a number "1" to the database how do I keep it saving "0001" to the database? Would I just change everything to STRING on down to the database? or is there another number type that I can be using that will not chop off the leading zeroes? Please provide short code references or examples to be more helpful.

    Yeah, I have to agree here that leading zeroes make no sense. I figured that out when I started to look into this problem. The only requirement that exists is that the user wants it to be a 4 digit number due to some other requirement they have themselves.
    So what I'm gathering from what I've read in the responses thus far is that I should change the validation a bit to look at the STRING for the 4 required digits (which are really 4 characters; maybe I should add CLIENT side numeric validation; currently its doing server side numeric/integer validation; or maybe change up the server side validation instead???) and if they are ALL GOOD then let the application save the int type as it wants to. IE: Let it save "0001" as just "1" and when I come back to DISPLAY this saved number to the user I should append the string of "000" in front of the 1 for display purposes only? Am I understanding everyone correctly?

Maybe you are looking for