Add Zeros at the Ending to make Length 20.

Hi,
I have a Target field WBS where the length should be always 20. If the length is less than 20, I shd add Zeros at the ending to make the length as 20. I think format Number cant be used in this case. Do I need to write a UDF or Is there any standard function
Thanks & Regards,
Varun

Hi Varun,
use this UDF:
StringBuffer sb = new StringBuffer();
int length = 20 - a.length();
for(int i=0;i<length;i++)
     sb.append("0");
return sb.insert(0,a).toString();
The difference to the solution is the use of the StringBuffer class. This is better coding practice. Strings in java are immutable and concatenation of strings therefore very expensive.
Regards Sven

Similar Messages

  • How to add zero at the end of a character string

    Hello Experts,
    I've a requirement where I need to do sum/total of various numbers and display it with $ sign as shown below.
    I'm using a variable CHAR20 to display total with $ sign. The problem is if there is a 0 at the end of the total then variable doesn't display it as highlighted above in red. Can anybody please make suggestion ( a code sample will be great help ) how resolve this issue?
    Many thanks in advance.

    Hi,
    please check this code:
    REPORT  ztestcurr.
    DATA: xv_prval TYPE char20.
    DATA: xv_val1  TYPE dmbtr VALUE '12.67'.
    DATA: xv_val2  TYPE dmbtr VALUE '8.21'.
    DATA: xv_val3  TYPE dmbtr VALUE '13.72'.
    DATA: xv_sum   TYPE dmbtr.
    START-OF-SELECTION.
      xv_sum    =  xv_val1 + xv_val2 + xv_val3.
      PERFORM   print_val  USING  xv_val1.
      PERFORM   print_val  USING  xv_val2.
      PERFORM   print_val  USING  xv_val3.
      PERFORM   print_val  USING  xv_sum.
    *&      Form  PRINT_VAL
    *       Print value
    *      --> XF_VALUE Value to print
    FORM print_val                      USING  xf_value TYPE dmbtr.
      WRITE  xf_value                      TO  xv_prval CURRENCY 'USD'.
      CONCATENATE '$' xv_prval           INTO  xv_prval.
      CONDENSE                                 xv_prval NO-GAPS.
      write /1 xv_prval       using edit mask  'RR____________________'.
    ENDFORM.                    " PRINT_VAL
    Regards,
    Klaus

  • Deleting Zeros at the end of fields in ALV report

    I want to make an ALV report that include both integer and decimals in same column.
    for example :
    1 - 1234.0000
    2 - 0.0027
    i dont want to see zeros at the end of value. 
    But the type will be decimal and integer values will be shown with zeros at the end.
    For Ex.
    I want to take report like this ;
    1 - 1234
    2 - 0.0027
    How can i make this?
    Thanks.
    Edited by: aydnbk on May 14, 2010 3:22 PM

    Hello aydnbk.
    As far as i know, there is no way to do what you want using standard ALV-Functions. There is a field 'DECIMALS' in structure LVC_S_FCAT, but using this field you could only define ONE setting, that would affect ANY value.
    Furthermore i am asking myself, if this feature is really sensible - when numbers are right-justified, a global setting for the number of decimals makes it much easier to compare the values - at least this is my personal opinion...
    If i had to do this trick, i would simply add some character fields to the output-structure and write the values to the charater-fields to enforce this quite special layout.
    Additionally i would set the fields 'NO_OUT' and 'TECH' for the fields of type 'P', that are holding the values - 'NO_OUT' hides the column and 'TECH' ensures, that the field can not be selected in a user-defined layout.
    Hope this helps.
    Regards, Jörg

  • Appending zeros in the end

    Hi,
      How can I add some zeros in the end of a field in the decimal places?
    I need to have 6 decimal places, so which ever decimal place is not filled, should be filled with zeros.
    Example:
    If the value is 11.123
       I need to convert it to 12.123000
    If the value is 11.1
       I need to convert it to 11.100000
    Please let me know how can I do this conversion or whether there is any function module available for this.
    Thanks,
    Uma

    Hi,
    move the value field into character field.
    then do like the below.
    data:num(20) type c value '11.1',len type i,len2 type i,v1(10) type c,v2(10) type c.
    split num at '.' into v1 v2.
    len = strlen( v2 ). <b><<holds the value after decimal point,check the length, if it is less than 6 digits,
    then append the reqd. no. of zeroes at the end>></b>
    len2 = 6 - len.
    do len2 times.
    concatenate v2 '0' into v2.
    enddo.
    write:/ v2.
    regards,
    sowjanya

  • How to add spaces at the end of record

    Hi Friends,
    i am creating a file which contains more than 100 records.
    In ABAP i have internal table with on field(135) type c.
    some time record have length 120, somtime 130 its vary on each record.
    but i would like to add space at the end of each record till 135 length.
    Can you please help me how to add speace at the end of record.
    regards
    Malik

    So why did you said that in your first posting? My glass sphere is out for cleaning...
    Instead of type c use strings and add spaces until they have the appropriate length.
    loop at outtab assigning <pout>.
      while strlen( <pout>-val ) < 135.
        concatenate <pout>-val `` into <pout>-val.
      endwhile.
    endloop.

  • Add Counter at the end of file name

    Hi all,
       I am using NFS protocol and trying to add counter at the end of the file. I have given the Prefix as  '-'
    Format : 1
    Step: 1
    Mode: After First File
    Is the prefix is right? Am i giving the values in right way? Please help me.
    The format required is: test_1.xml
    Thanks,
    Sri

    HI Arun,
    I m not so sure but i think prefix can not have any special character.
    You can do this by giving your file name in target->file name schema as File_* while configuring your communication channel.
    After that it will add automatically your required counter.
    thanks.

  • Add zeros on the left in a string of characters

    Hi,
    I'd like to add zeros on the left in a string of characters. Example:
       Char10: 8572   --->  Char10: 0000008572
    I'd like to know if there's a standard instruction for this, or a quick way to do it.
    Thanks in advance,
    Gerard

    Try this
    *& Report  YCHATEST                                                    *
    REPORT  YCHATEST                                .
    data : l_char(10) value '8275'.
    write : / l_char.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT         = l_char
    IMPORTING
       OUTPUT        = l_char
    write : / l_char.
    Message was edited by: Sekhar

  • I made a video in imovie and saved it, now i want to carry on making it from where i left but every time i try to add an image onto the end it just goes tot he wrong part of the movie, how do i just add it onto the end?

    I made a video in imovie and saved it, now i want to carry on making it from where i left but every time i try to add an image onto the end it just goes tot he wrong part of the movie, how do i just add it onto the end?

    Have you seen my User Tipp here
    "Movie Magic" with Stills and Dissolve
    When you 'prep' your stills in any 'picture app', you can do a lot of marvel by simply applying dissolves.
    In your case, I would create a white document (in Pixelmator, Keynote, Photshop, online at pixlr.com, whatever ...) and another with your logo (and further more ones with additional logos). Drag the jpgs into your iMovie Project and apply dissolves  - tadahh! - logos appear on white.

  • Convert Double to String without zeros at the end

    Hello,
    how can i convert a double-numeric to a string? I know how can do it but not how i can do it in a fast way.
    When i use the "Number to Fractional String"-Object then a number
    1,2 --> is canged to 1,200000
    1,0 --> changed to 1,000000
    what can i do that there are no zeros at the end?
    Currently i´m reading the reversed string in a loop to remove the zeros, but this i to slow i think.
    Is there a fast way?
    Thanks for your help

    Extract from the LV help :
    Select Tools»Options to display the Options dialog box and select
    Front Panel from the Category list to display
    this page.
    Use this page to set front panel options.
    This page includes the following components:
    Open the control editor with double click—Allows you to
    double-click a control to display the Control
    Editor window. Use the Control Editor window to customize
    the appearance of a front panel object. This checkbox is unchecked by default.
    Use localized decimal point—Uses the decimal separator for
    the operating system instead of the period. This checkbox is checked by default.
    Remove the checkmark from this checkbox if you want LabVIEW to use periods in
    all cases for the decimal point.

  • How to make cash account balance Zero at the end of the year

    Hi,
    We have one account 200180 with 1000 Company code( Germany), and document currency is HKD(Hong kong Dollor), but LC is Euro and it is a cash account. At the end of the year, this account shows 0 balance in HKD, and 10,000 in Euro. I understand that it is because of difference in exchange rates every month. Shall I include this account in foreign currency valuation ? Any other way to make the balance is 0 in Euro?
    RK

    Hi men,
    I think tcode F-05 can solve your problem. You should make some adjustment by using this tcode.
    Good luck.

  • How to add footer at the end of every page

    Hi,
    I need to add some text at the bottom of every page in my application. I have made a footer region where i have put that text component. I have simply included that footer region as the last element of every jspx page. This shows the footer at the end of the content and not at the end of page(which is required).
    Using css like position:absolute;bottom:0px; shows the text at the bottom of bowser window, not page(so, problem for pages having scoll).
    It is not feasible to make any changes in each jspx page. So, what is the way out to achieve this by keeping the change limited to pagefooter region page and/or ss.css
    Note: I am using Jdev10.1.3

    With JDev 11g, you can create pageTemplate however, in 10g though support for page template is not available, you can achieve basic functionalities like this through web template. See sample here:
    http://www.developer.com/db/article.php/3513706/Easy-Web-Templates-with-Oracle-JDeveloper-10g.htm
    And if incase you use JHeadstart tool for development, JHeadstart provides templating facilities too.
    If you want to achieve using CSS, check this example:
    http://www.electrictoolbox.com/html-css-footer/
    regards,
    ~K

  • Add interaction to the end of a video

    I have a client that wants to have a video be used as an instructional video. The video will be visible on the internet - on the company website. The client wants someone to view the entire video then have the ability to fill out a form and not go to the form before reaching the end of the video. The form will be for the user to request a certificate. I know that with YouTube videos, you can add interactive elements / links within the video, like at the end. We would like to do this as well but not use a YouTube video. The client doesn't want the YouTube logo at all (we can make it invisible, but it still shows up on rollover).
    So is there a way to add an interactive element (button or text link) at the end of a video that can be embedded in a web page that isn't shown until the end of the video?
    We are showing videos using the JWPlayer (WordPress site).
    I could have done this in a Flash (SWF) file that has a video but we want to let tablets and mobiles see the video.
    An alternate direction is to use a JQuery function that sets a button as disabled until a certain amount of time expires.
    I also thought about putting a video within a PDF.
    I'd love to hear about any thoughts or possible directions you would suggest.
    Thanks! Chris

    If you want your video to play on anywhere then you don't want Flash. You should be able to use a simple html5 page to play your video and then redirect the user to a new page, or display a new div to get to the form. Here's a good discussion of doing that sort of thing: http://help.videojs.com/discussions/questions/509-videojs-and-passing-an-event-at-the-end- of-the-video You can also look at the regular html video dom reference: http://www.w3schools.com/tags/av_prop_ended.asp

  • NW66SP8 ClusterRessource to OES11 ClusterRessource - miggui duplicatesone folder and appends a 0 (zero) at the end of the folders name

    Hi to all,
    while migrating from NW to OES, one clustered volume with one (and
    always the same) folder is duplicated with an trailing zero at the
    folders name.
    Source is
    USER:\Abteilung\Edv\
    Destination is
    /media/nss/USER/Abteilung/EDV0/
    while
    /var/opt/novell/migration/user2/log/filesystem.success.log
    shows the correct destination
    Copying USER:Abteilung/EDV/... to /media/nss/USER/Abteilung/EDV/...
    But in fact a new folder ../EDV0/ (in capitals) ist created, even if the
    folder ../Edv/.. exists. This behaviour ist just with this folder, all
    other volumes and folders worked fin.
    One thing here is special:
    I have *copied* the files to the destination volume because of the need
    to have loaded tsafs.nlm, which nback will use for miggui, with the
    option /nocluster for IBM TSM purposes. After that, I triggered a
    regular consolidation as described above and later I plan to synch files
    and trustees using miggui.
    Any hints on that silly thing?
    TIA
    Tom

    Originally Posted by mrosen
    Tom,
    On 04.03.2013 09:17, bwisupport wrote:
    > But I think, your questions led me to the solution:
    > The destination folder, copied with TotalCommander, was named 'Edv' (as
    > TC shows the sources name too). Miggui sees a source called EDV, and at
    > the destination a folder called 'Edv' and decides that these are two
    > different folders. Because it is not possible having to folders with the
    > same name (despite capitals) at the same place, a new Folder with
    > trailing zero is created.
    >
    > I've deleted the 'EDV0', renamed the destination to EDV (cross-checked
    > with Explorer and CLI) and restart a synch.
    Hmmmm.... Something's very strange here anyways. Miggui *should* not
    care about the case when the destination is NSS set to long namespace.
    Either there's a bug in your version of miggui, or something else is
    weird about that folder. It's also strange that TC and Windows Explorer
    disagree on the capitalization. That again would lead me to the
    assumption that something's broken originally with the source, like the
    DOS and LONG namespaces on the source disagreeing somehow.
    CU,
    Massimo Rosen
    Novell Knowledge Partner
    No emails please!
    Untitled Document
    It sorta does. Apparently there's a bug in the miggui code that does this (although we only have it happen on OES2 SP3 to OES11 and it doesn't add a "0" at the end, it just stops processing after the main directory).
    I've been waiting for NTS to file a bug report for over a month now.
    anyway, Ramesh (the guy who kinda owns miggui) acknowledged there's a bug.
    You can either:
    1) use the migfiles command apparently instead of miggui
    or
    2) Rename the directory so that it matches, but with NSS you'll have to rename it twice. Like:
    EdvX and then again to: EDV
    Problem is with nbackup apparently that miggui uses.

  • How to add totaling at the end of BI Publisher Report. ????

    Dear All:
    I have payment amount in BI publisher . And I want its totaling at the end of each group. How can I add. Can any body know. Thanks
    ALi

    Hi,
    Think there are lots of posts on Tim's blog on totals, e.g.:
    http://blogs.oracle.com/xmlpublisher/2007/03/30#a221
    Regards,
    Gareth
    Blog: http://garethroberts.blogspot.com/

  • Add space to the end of textfield value

    Hi,
      I have a requirement where I need to append 2 spaces to ta textfield at the end of field for certain conditions.
    I used Concat() function and if I checked the length, it added the space successfully in the scripting. But in the output display, it is not considering the space to the text. I need this particularly because all my text fields are right alligned and if I have a space appended to the text at the end, I should able to see it in the form
    for ex:
           I need     Martin     ( for the first text field)
                       Martin       ( with two spaces appended)
    I need the output in the above way.
    Can you please help me out.
    Sample code I wrote on scripting:
    var raw = $.rawValue
    $.rawValue = Concat(raw, Space(2))
    If I check the length of field, I could see that length got increased by 2. But I cannot display in the output.
    Thanks in advance,
    k.c

    Hi,
    Instead of inserting white spaces script to change the right indent:
    if (this.rawValue == "Martin")
        this.para.marginRight = "1.5mm";
    else
        this.para.marginRight = "0mm";
    This is Javascript, but I am sure it will run in FormCalc.
    N.

Maybe you are looking for

  • Thinkpad A31 Docking Station

    Hi there,  I have a Thinkpad A31 - 2652 with Windows XP (SP3) and I would like to get a docking tray with the ability to have dual VGA monitors (both external monitors).  I understand that the "ThinkPad T, A, and X Series Dock" has both a VGA and a D

  • Chinese Characters not displaying properly

    I pasted Chinese text into a Rolling title but not all of the characters display.  Some (not many) of them display as an x inside of a square.  All I can think is that some of the characters are not being recognized. If it matters, the text is simpli

  • Problems in Debug mode

    Hi, I like Raptor a lot, but I can't seem to get the debugger working properly. I created a tiny sample proc which I include below. I set a breakpoint on the SELECT statement. I hit the debug button and the Debug PL/SQL window appears, and so I click

  • How to mark (psd) Images with the Circle Symbol without duplicating them

    I would like to import my layered images in Aperture. The problem is i would like to further adjust them in photoshop cs3 without creating a duplicate. Is there a possibility to mark this images with the Circle Symbol (for edited with external editor

  • Multiple Email Notifications

    I've looked at all 192 "suggestions" for this problem when I enter the subject...none of them fix it, but do confirm I'm not the only one having the issue.  I have only one email account (Google Apps) on my iPhone 4S and up until recently, everything