Cfspreadsheet how to preserve leading zeroes

Is there a way to preserve leading zeroes in a field when displaying in excel other than adding a ' at the front of the field?  I have an id field defined in sql server as varchar but when creating an xls document using cfspreadsheet excel is interpreting the field as numeric and dropping the leading zeroes.  I cannot have the ' leading that field since it is imported into another system.

This has been resolved.  I tested both suggested solutions.  I tried formatting the columns with spreadsheetformatcolumn as suggested in http://stackoverflow.com/questions/3081202/how-to-format-spreadsheet-c olumns-using-coldfusion but that did not preserve the leading zeroes in the ID column.  I then tried the solution with POI found here http://www.bennadel.com/projects/poi-utility.htm by Ben Nadel and that did preserve the leading zeroes.  Thanks for everyone's assistance and thanks to Ben for sharing his POI utility.
- Julie

Similar Messages

  • How to remove pound symbol # and preserve leading zeros in BEx Query

    Hi,
    I have two questions regarding the display in BEx Query.
    1. How can I remove the pound symbol # for blanks in BEx Query?
    2. How can I preserve leading zeros? At the moment, value "001" will be displayed as "1". But I need the leading zeros.
    Thanks.
    Joon

    Hi ,
    You can apply these settings in Bex query designer.
    If you need to remove pound symbol jsut make a new formula and use NODIM function you will find this function under data functions.
    So NODIM(Your price keyfigure) this will remove the Pound symbol.
    For # just find out against which  characterstic you are getting # then go to default values panel there you will find all your characterstic which you are using in report---Rt click -Restrict-single valuesdirect input-#-Move to selection(That forward arrow)--select that # and choose exclude from selection (That red square icon).
    And yes for leading zeros check out this thread
    Leading zeros not displaying
    Hope it helps you.
    Regards,
    AL
    Edited by: AL1112 on Jun 9, 2011 1:43 PM
    Edited by: AL1112 on Jun 9, 2011 1:47 PM

  • Preserve leading zeros in CSV file.

    Hello...
    I am creating a file on the fly and attaching with email.
    emp_no starts with 0001,0002,0003 ...etc.
    When file write emp_no to csv file...i looses leading
    zeros...what is best solution to preserve zeros?.
    In excel file creation, i am using
    style="mso-number-format:0000;" to preserve leading zeros.
    But by using cffile, i am not able to use style.....Is there
    any other way to preserve leading zeros?
    <cffile action="write" file="#dirname#/emp_mon.csv"
    output="List of Employees" addnewline="Yes">
    <cfoutput query="emp_q">
    <cffile action="append" file="#dirname#/#filename#"
    output="#emp_no#,#e_name#,#e_address#,#sal#" addnewline="Yes">
    </cfoutput>

    I'd suspect your CSV is fine, ie. if you open it in WordPad
    or NotePad you will see 0002. The problem is with whatever you're
    importing it into. Excel? If something else I don't know. If Excel,
    your Import spec, saved or on-the-fly needs to say Text on that
    field rather than the default General which simply means make a
    number (zero-suppressed) whenever possible. Single or Double quotes
    (on each field that needs it) are a workaround provided you specify
    them as "Text Qualifier", but you don't seem to want to do that, so
    Text is the only other method.

  • How to remove leading zero from Material Number

    Hello Everyone,
    I need to figure it out how to remove leading zero from material number. Cureently extractor is sending material number as 100663. But when comes into BI i am getting as "000000000000100663" and similariy in report it is appearing as "000000000000100663". Now my client wants me to exclude preceeding zero for a material in all the reports.
    Is there any setting in query desinger to handle this issure or in the backend.
    Need your inputs.
    Thanks,
    Lasya.

    Hi
    you can use the function Module
    CONVERSION_EXIT_ALPHA_OUTPUT in the start routine
    to test this go to SE37  --- give the CONVERSION_EXIT_ALPHA_OUTPUT -
    >display -
    > F8
    in the input give 000000456
    and execute
    the out put will be 456
    for getting Zeros you can use
    CONVERSION_EXIT_ALPHA_INPUT--- to remove leading zeros
    Santosh
    Edited by: Santhosh Nagaraj on Oct 29, 2009 10:52 PM
    Edited by: Santhosh Nagaraj on Oct 29, 2009 10:54 PM

  • How to remove leading zeros from variable

    hi,
       how to remove leading zeros from variable like it_vbap-matnr.
    value in it_vbap-matnr is 000000000000000358
    i want to remove leading zeros so that it become 358
    regards
    deepak

    You can use Function Module <b>'CONVERSION_EXIT_MATN1_OUTPUT'</b>
    This Function Module will eliminate leading Zeros.
    For each MATNR Value read form DB Table,u can eliminate Leading zeros and then modify ur Internal table.
    I think u will not get leading Zeros into utr Internal table when u read from VBAP.
    Bcoz MATNR in VBAP itself have Conversion routine.
    If u r getting leading zeros,U can use following Logic.
    tables:
      vbap.
    data:
       t_vbap like standard table of vbap.
    select matnr
    from vbap
    into corresponding fields of table t_vbap.
    loop at t_vbap into vbap.
      CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
          EXPORTING
            INPUT         =  vbap-matnr
          IMPORTING
            OUTPUT        =  vbap-matnr
      modify t_vbap from vbap transporting matnr.
    endloop.
    Hope this will work.....

  • How to remove leading zeros for an item number within quickviewer

    how to remove leading zeros for an item number within quickviewer. Pls help

    ask your abap guy to do  it. not portal guys business.

  • How to delimit leading zero in vendor number in OO ABAP ALV without using conversion routine

    Hi,
    How to delimit leading zero in OO ABAP ALV without using conversion routine, because I have many fields like vendor, customer, material number etc..
    How to address this leading zero.
    I appreciate your quick response.
    Regards,
    Nalini S.

    Hi Nalini,
    Delimiting leading zeros in fields has to be done via conversion routines, as suggested by Vadamalai you need to pass on the conversion routine name in you field catalog variable.
    Now as to which object oriented approach are you using to have your table contents display in ALV as it matters  -
    Using FACTORY method of CL_SALV_TABLE class, or
    Using SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class.
    Using FACTORY method of CL_SALV_TABLE will do your own work, no need to apply any conversion routines or set long/medium/short text for columns as we do in field catalogs!
    Cheers,
    Varun

  • How to suppress leading zeros

    Hi,
            How to suppress leading zeros in a character string.
    Thank you.

    hi,
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
                EXPORTING
                  input  = str1
                IMPORTING
                  output = str1.
    Example:
    input = 00000000000123
    output = 123
    rgds
    Anver

  • How to retain leading zeros in module pool screen

    Hi experts,
    I have a ztable field of type NUMC4 being displayed on a module pool screen, the value in the field is '0001', but on the screen it displays value as '1' (without leading zeros), When I save the record, Even in the databse it stores as '1'.
    But I have checked in debugging the field always contains '0001' in the program execution and I have also used 'CONVERSION_EXIT_ALPHA_INPUT' in the PBO but no use.
    Pls suggest.
    Thanks,
    Deepak

    Check the screen attributes for the field. There is an option to show leading zeroes.
    edit.
    And how did you see it was stored a 1 and not 0001? Using SE16N? Mind you: with SE16N conversion-exits are executed automatically thus showing 0001 as 1.
    To make sure: double click on the record in SE16N and look if it's still 1 and not 0001.

  • How to add leading zeros to a packed variable

    Hi all,
    I have a to add leading zeros for a packed field.
    eg.
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    but I have to display the field as '0000000000012.063'.
    How can we achieve this?
    Regards.

    Execute the code .
    REPORT zex13 .
    Data : brgew like mara-brgew.
    brgew = '12.063'.
    data:val(18) type c,
         in(13) type n ,
         dec(6) type c.
    data :  a type i ,
            b type i.
            a = TRUNC( brgew ).
            write:/ a .
    in = a.
    write:/ in.
            dec = frac( brgew ).
            write:/ dec.
            concatenate in  dec+2(4) into val separated by '.'.
            write:/ val.
    see if this works for u .
    regards,
    vijay

  • How to display leading zeros in a report

    Hi folks,
    I am doing a HR report and the users are very much used to seeing a two digit numeric value as the pay scale since their legacy days.
    In BW, I have the Pay Scale defined as a character (2) and it shows the values on the report as follows:
    Pay Scale
    0
    1
    2
    3
    11, etc.
    But the users would like to see 00, 01, 02, 03, 11, etc.
    Under the query properties, display tab, there are four separate options - display zeros, show zeros as, etc. I tried all the options but the pay scale still does not show the leading zeros. I remember seeing a SAP note a while back that talks about this. Does anybody know how to force the leading zeros on the BEx report.
    Thanks.
    Abdul

    Try removing the ALPHA Conversion from info object defintion.

  • How to remove leading Zeroes in all fields in Payload

    Hi,
    How can I remove the leading Zeroes in every Filed I have in whole Payload Structure.there are around 10000 fields that have to be removed the leading Zeroes.any good idea please.
       <POSNR>000010</POSNR>
      <MATNR>000002465640</MATNR>
      <ARKTX>000012 KG D107</ARKTX>
      <MATKL>00030010000</MATKL>
      <WERKS>0000ORGC</WERKS>
      <LGORT>0000GC55</LGORT>
      <CHARG>000TEST</CHARG>
    like this mutliple segments and multiple Fields.so  I can take as whole payload with multiple fields should not have leading Zeroes.I can handle if they are 10 0r 20 fileds,but not like whole pay load/1000 fields right.
    thank you,
    Prem

    Hi
      You can have an additional XSLT mapping, to your existing one..
    use copy-of & apply-templates to copy the whole tree & make changes recursively.
    below is a sample code , the marked line is where you need to try your logic of trimming Zeros. (this code does upper case)
    add this below code in your interface mapping object, as XSLT mapping, which does the job (only try putting your logic)
    <xsl:stylesheet
                      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      version="2.0">
                <xsl:output  method="xml"
                            indent="yes"
                            omit-xml-declaration="yes"/>
                <xsl:template  match="*">
                      <xsl:copy>
                            <xsl:copy-of  select="@*"/>
                            <xsl:apply-templates/>
                      </xsl:copy>
                </xsl:template>
                <xsl:template  match="text()">
                      <xsl:value-of  select="upper-case(.)"/>
                </xsl:template>
          </xsl:stylesheet>
    hope this fixes your issue
    Regards
    Vishnu

  • How to remove leading zeroes of a coloumn in a table

    can someone tell me how to remove the leading zeroes in a table's coloumn .... its a NUMC  data type..
    i tried with abap statement shift leading zeroes, but its not working for me.... the sorting is missing..
    in properties is there any option to remove the leading zerores>
    niraja

    Hi Niraja,
    I am displaying a table with information from SFLIGHT. The CONNID field is of type NUMC and so it too used to contain the leading zeroes.  I so deleted the leading zeroes in my WDDOINIT method before binding the internal table to the context node. The table now does not display the leading zeroes as earlier. Find my coding as shown below:
    METHOD wddoinit .
      DATA: lr_node TYPE REF TO if_wd_context_node,
            wa_sflight TYPE ig_componentcontroller=>element_node,
            lt_sflight TYPE ig_componentcontroller=>elements_node.
      SELECT * FROM sflight INTO TABLE lt_sflight.
      LOOP AT lt_sflight INTO wa_sflight.
        SHIFT wa_sflight-connid LEFT DELETING LEADING '0'.
        MODIFY lt_sflight FROM wa_sflight TRANSPORTING connid.
      ENDLOOP.
      lr_node = wd_context->get_child_node( name = ig_componentcontroller=>wdctx_node ).
      lr_node->bind_table( new_items = lt_sflight ).
    ENDMETHOD.
    Regards,
    Uday

  • How to remove leading zero in a inputfield

    I have a inputfield UI element which is bind to a NUM type context.  When it display a number, it always come with leading zero, like '001'. Can anyone teach me how to remove the leading zero.

    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/3a/2232666aeb45f4b759848a4caf9c8b/frameset.htm
    Use the Display leading zeros formatting option in the context attribute properties.
    The other option is to use a data dictionary domain for the field that has a built in field conversion exit. The ALPHA conversion exit is commonly used on NUMC fields like Sales Order number to suppress leading zeros.  The WD runtime will automatically use the underlying DDIC Domain Field Conversion Exit.  You don't need to do anything except use that DDic to define the context.

  • How to maintian leading zeros in BI ?

    Hi All,
    We have a requirement for one InfoObject called "0RPA_MEAN" EAN Assignment to Article for this info object i need to maintain a leading zeros as its coming from R/3 end?
    Ex: In R/3 side EAN 123 is different than EAN 0123,EAN 00123.
    But while extracting in BW end the the leading zeros is getting skipped off?How to retain the leading zeros?
    In rsa3 its coming with the same leading zeros but in psa its not showing it?
    This is very serious issue going on, need your valuable inputs on this?
    Many thanks in advance.
    *Points Assured*

    Hi Rakesh,
                       When you extract data to BI there won't be any leading zeroes. So in PSA there won't be any leading zeroes.
    To bring leading zeroes from PSA itself.
    Double click on your datasource in rsa1. Click on the 'Fields' tab. Type 'ALPHA' for the source system field under the column 'Conv. Routines'. I think that will solve the problem.
    To bring leading zeroes after PSA (ie. from transformation onwards)
    But when load data from PSA to further data targets using transformation we can add leading zeroes.
    So in transformation click on rule details for that info object. In the rule details you have to use a function module called 'CONVERSION_EXIT_ALPHA_INPUT'.  when you use this function module the leading zeroes will be added automatically.
    Thanking you,
    Jerry
    Edited by: jerryabap on Oct 14, 2010 5:52 AM

Maybe you are looking for

  • How can I print a message

    I have a message on my iphone that I would like to print, how can I do that? Or, how can I send it to my gmail address in order to print it?

  • Account Based COPA Cost of goods sold and Revenue Split

    Dear Experts, We are using account based copa in a automobile company. As per the requirement when a car is sold, depending on the customer request the car  goes for a conversion. like adding Radio, Seat cover, etc As per our setup we have different

  • New Pages V5 is running very slow

    I was using the previous version happily for  6 months, using the shapes and shadows, dimensions etc to create great looking and very fast design plans. The features were surprisingly good and the process very quick and easy. As soon as I downloaded

  • Error in adding selection screen fields

    Hi All,, I am getting error when i add a selection screen parameters in module pool. I copied stadard program to custom one, when I add an input field to screen it gives information message saying "Selection screen: Report generation makes screen cha

  • When will ios 7 be available for the ipod

    when will ios 7 be available for the ipod