How to add a zero in front of integer?

i have a value, which is int, retrieve from database
but now, i wish to add a zero in front of those single digit integer value, can anyone teach me how to do it?

If you want to display 1 as 01 then one solution is is that yu have to convert it to the string and then display it. you can use this function
private String convertString(int i)
if(i<10)
return "0"+Integer.toString(i);
else
return Integer.toString(i);
i am using this function in my application.

Similar Messages

  • How to add two zeros end of field

    how to add two zeros end of field?

    Hi srinu,
    If it's a number field, then just multiply by 100.
    If it's a string, then just use CONCATENATE and add the '00' to your existing string.
    Hope this helps.
    SL

  • How to add prefix zero to all matnr fields in itab

    Hi,
      I ve a internal table with following fields
      Matnr                                                  bwkey                            
      6                                                        678                                 
      67                                                      rty     
      678                                                    78k                                
      How to add prefix zero to all tha matnr fields.
      like
    matnr                                     bwkey
    00000000000000006                678
    00000000000000067                rty
    00000000000000678                78k
    Thanks in advance

    Hi,
    commonly used conversion routine is ALPHA.
    It is conversion used to insert leading zero for document number.
    For example, in sales order (VBAK-VBELN length 10),
    when we key in order no, for example we key in '4302',
    conversion routine input will automatically add leading zero,
    so it will become '0000004302', this is real value stored in table VBAK.
    On conversion routine output, it will delete leading zero
    function CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
    Ex:
    data: lv_c(10) type c value '123'.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                      input = lv_c
              importing
                     output = lv_c.
    write:/ lv_c.
    Regards.

  • 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 add leading zeros ?

    Hi Friends,
    I have a shipment no say 10 char long . Now the thing is in my program I need to add leading zeros if the shipment no is not 10 char long .
    For eg : if the tknum is 99919 . I need to make use of a command to make it 10 char long lke 0000099919.
    Also I need to be able to add zeros if tkum is 5 or 7 or 8 char long .
    How do i add these leading zeros to fill up the remaining positions ?
    Thanks,

    hi ,
      use the following code.
    data : lv_vbeln(10) type c.
           lv_sonumber like vbak-vbeln.
    <b>This function module will convert the data into the required format based on the data type of the variable that you are passing in import paramter of the funcation module.</b>
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                        INPUT         = lv_vbeln
                     IMPORTING
                       OUTPUT        = lv_sonumber
    Thanks
    mahesh

  • Urgent........How to add leading zeros to negative values.....

    Hi,
    I want to add leading zeros to negative values.
    <b>Present Value    :</b> -567
    <b>Expected Value :</b> -0000000567
    I know to adding leading zeros with the help of CONVERSION_EXIT FM.
    Thanks in advance.
    Regards,
    Kumar.

    Hi
    Use below FM.
    CONVERSION_EXIT_ALPHA_INPUT
    Try out below FM with the above one.
    <b>CLOI_PUT_SIGN_IN_FRONT</b>
    <b>ISJP_GET_SIGN</b>
    or you can use
    <b>WRITE variable USING EDIT MASK '-___________'.</b>
    or
    <b>CONCATENATE syntax</b>
    Hope it will solve your problem
    <b>Reward Points if it is helpful.</b>
    Message was edited by:
            ilesh 24x7
    Message was edited by:
            ilesh 24x7

  • How to add leading zeros to a characteristic in CT04

    The business is requesting that we change a class characteristic so that it adds leading zeros.  Currently the characteristic is set as numeric with length of 6, no decimals.  Is there any way via template or otherwise to force this characteristic to store leading zeros, as recorded against the characteristic?

    Hi David,
    1. If you are mentioning about the "Characteristics"This is Standard Field name.
    2. You will not be able to influence the same,
    3. Also i doubt if you are talking about the Characteristic Value - Since only in the Char Value we will be able to define the length, etc.
    4. In case of Charvalues if you want leading zeros then create it as character , where you can store with leading zero
    Reg,
    Dsk

  • How to add leading zeros to kunnr field

    Hi All,
    I need to add leading zeros to KUNNR field runtime.
    i.e for some customer it is displaying '2001084606'
    some customer's it si displaying '10434'.
    I want add leading zeros when customer length is
    not equal to ten '10'.
    plz kind let me know this is urgent.
    Regards
    Bhaskar

    Hi there,,
    Kunnr is using a dataelement with Char 10.
    You can do in this fashion to resolve your issue.
    len = strlen (itab-kunnr).
    len is having the lenght of the customer number.
    if len < 10..
       while len < 10.
          concatenate '0'  itab-kunnr into temp_text.
          add 1 to len.
       endwhile.
    endif.
    now finally you can assign temp_text to your itab-kunnr.
    hope this way you can resolve your issue.
    if found helpful,, don't forget to reward points.
    Thanks-
    Rahul.

  • How to add leading zero using the toString() function?

    Hi,
    I've looked in the user manual and I can't find any reference to toString() for syntax information.  Isn't there a parameter for me to use to specify the string lenght?  And whether to add leading zeros or not?
    Here's the code I need to add leading zeros:
    playbutt.addEventListener(MouseEvent.CLICK, playSound);
    function playSound(e:Event)
    SoundMixer.stopAll();
    var num:Number = Math.ceil(Math.random()*43);
    bigNum.text = num.toString();
    var path:String = "Track No" + bigNum.text + ".mp3";
    trace(path);
    var s:Sound = new Sound(new URLRequest(path));
    s.play();
    The files I'm trying to open starts at "Track No01".
    Any ideas?
    Ron

    Thank you for the code replacement.
    By the way, instead of having the user click a button to start a random music file (MP3), I'd like to get the music going as soon as one loads a webpage and once the first tune is finished playing jump to another randomly selected music file (MP3).
    I've search via Google for ideas but couldn't find anything that came close to what I need done.
    Any ideas?
    Regards,
    Ronald

  • How to add ASCII symbol to Front Panel

    Hello,
    I am trying to add an ASCII character to the front panel but I cannot figure out or find out how to do it. It should be ALT key plus the decimal code I thought.
    Any help would be appreciaited.
    John

    you can enter an "e", select the character, and change to symbol font.
    LabVIEW Champion . Do more with less code and in less time .

  • How to add leading zeros to hex string?

    Hi, I've got the following problem:
    I have a string that represents a 8-digits hexadecimal number. But if the number has less as 8 digits, I need to add the leading zeros. I can't use DecimalFormat, 'cause it works only with decimal numbers. Is there any elegant solution to add the leading zeros to hex string (for example "A3F" to "00000A3F")

    Or better use a StringBuffer for that, though I doubt it's a performance problem in your case.

  • How to add a leeter in front of char value in report

    Hi guys
    We need to get nr of days between two dates...I created two replacement path variables with referece to that dates as date2 and date1...and Iam using formua date2 - Date1..
    Iam getting correct result when date2 is > date1...But when date2<date1  Iam getting the result as 70more...example
    2/11/2008-3/19/2008 = -108
    1/23/2008-2/6/2008 = -83
    1/3/2008-1/22/2008 = -19
    This is happening only if the month is diff in two dates...if same then its giving correct result...Iam using Jan till Dec as my colums....and Nr of days as rows...
    Can any one let me know how to fix this
    regards

    Hello Sam,
    Use the [ Boolean Operator|http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm] to check the condition and calculate the difference accordingly.
    The other option is using  a User Exit by reading these 2 date values and calculate the difference as per your requirement.
    Thanks
    Chandran

  • How to add currency sign?

    Hi,
    I have a group currency key figure in my report. I want to add $ sign in front of the amount for ex. 12550 it should show as $12550.
    How to add currency sign $ in front of the aount.
    Pts for ans.
    Regards,
    Shri.

    Hi,
    You can enable currency in the reporting output using following steps:
    Query properties> Display> select Display scaling factors for key figures.
    but using this option currency($) will be displayed after the amount. it means key figure values will be displayed like 300$, 800$.
    hope it helps..
    regards,
    raju

  • How to add Zero to an integer value from left (like 999 to 0999)

    hello,
    any body please tell me how to add "0" to an integer from left
    i just want to make my value 999 to 0999
    and i tried with converting it to strings but after adding zero i have to make the string to integer again because my method accepts integers onli.
    thanks in advance
    ranadheer

    i will be much clear now
    i have a jar file which takes date and time as input
    but the it accepts only 4 digits in the Year field
    so if i have date with year before 1000 its not
    accepting.so with keeping year field as integer i
    have to make the 3 digits to 4 digits by appending
    0 at the front
    thanks and regards
    RanadheerThen you need to keep that variable as a String (before parsing it to a Date object), not as a numerical value. You can prepend a String to another String using the + operator.
    String s = "0"+"123";

  • How to add silver front panel theme for labview 2010

    how to add silver front panel theme for labview 2010

    Mahisnair wrote:
    yes i had tried this way but the vi built with silver theme doesnt look good in 2010 :-(
    wish if there was a way to include silver theme in 2010
    The only way I see to make it like that would be to recreate the theme in LabVIEW 2010 with external bitmap objects. Unfortunately it won't be as functional as the silver controls in various terms such scaling (bitmaps scale very badly) or transparency and click through functionality (a bitmap assigned to a control part will always catch all clicks and never allow a click to pass through anywhere to a lower layered part).
    The silver controls are using special internal graphic objects that were added in LabVIEW 2011, so recreating silver controls with the same functionality in earlier LabVIEW versions is impossible.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • HP Office jet pro scanning size issue

    I have a HP Officejet Pro 8500 When scanning to my computer to a .pdf it always results in an 8.5x14 document not an 8.5x11 document (and this happens regardless of whether I scan a book page with the scanning lid open or an 8.5x11 single page origin

  • Installed 106.3 with Combo Update but Mail won't open at all

    Never saw this happen before. Mail.app won't open. Anyone else seeing this?

  • Problem in sales order Item availability

    User created sales order with 5 materials, out of this 5 material first one material X not appear in MD04 transaction. I try to re activate the item availability in sales order,but system not showing the availability control screen. but in schedule l

  • How to re-order pages in Pages 5.0.1?

    I just upgraded to Pages 5.0.1 but am not pleased. The simplicity of re-ordering pages within a document or copy-pasting pages between documents is gone, or so it seems. Can anybody give me directions how to tackle this? Otherwise I'll have to downgr

  • Using the result of Get-ADOrganizationalUnit into an array.

    Hello all! I'm hoping you can help me with the following challange. What I want to accomplish: I'm building a PowerShell script that will parse all the servernames from multiple OU's through the RDCman Set-Rdg script build by timdun @ http://blogs.ms