Need to add leading zeros to the field if field length is less than 6

Actually the field length is 16.
But for some manual entries it is comming as 4 chars.
so if field length is less than 6 then it should be replaced by leading zeros.
Moderator message: very basic, please (re)search yourself before asking, @all: please do not reply to basic questions, points removed.
locked by: Thomas Zloch on Sep 9, 2010 11:43 AM

Hi Ravi,
Do it in 2 steps.
1. check the length of your entry by strlen function and get the length.
2. If the output is less than 6 call the FM CONVERSION_EXIT_ALPHA_INPUT to get leading zero
Regards,
anirban

Similar Messages

  • 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

  • Need to show leading zeros in the number field when printed from RDF

    We have a requirement to show leading zeros in the rdf output.
    We cannot use a format mask to achieve the same as the length of the field is not fixed.
    for ex if we have 0.68 then the same is printed in RDF as .68
    we cannot use a format mask as the length of the field is not fixed.
    we need to
    Kindly suggest if any solution exists for the same.

    the numbers after the decima can be anything..
    it can range between 2 to 10 or more...
    as told by you if we put the format as to_char(.68,'90.99') it shall give 0.68 but what for numbers like0.678,0.4567,0.765433 it will display only 2 digits after the decimal...
    The requirement is to dispaly the number as it is ,only the zeroes before the decimal should stay intact..
    we are not able to achieve this in rdf output..
    if it is
    0.678 then 0.678 shld be dispalyed
    0.4567 then 0.4567
    0.765433 then 0.765433
    one format mask shld wrk for all the above..
    we would not be changing the format mask for each number....

  • Add leading zeroes in the IDOC segment data

    Hi,
    How to populate the Document number and EAN code  in the segment with leading zeroes because I have checked that all fields in the segment are of charcter type.
    I want to know can this be handled by customizing or coding but how?
    Thanks
    Prince

    Hi,
    You can use :
       call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exportiong
          input = c1
        importing
          output = c1.
    Regards,
    Subramanian

  • 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

  • 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.

  • Adding leading zeros to the display data

    hi folks,
    I have the character variable of size 9, if I get the value of the variable less than 9, I need to add leading zeros to it accordingly before displaying the numeric value stored in it. I tried to use the 'SHIFT' command for that it did not work out.
    here is the code..
             data: len type I,
                   amount type C,
                   addspace len type I.
              len = strlen( amount ).
              write: ' the length of the string',len.
               if ( len < 9 ).
               addspace = 9 - len.
               write: addspace.
    SHIFT amount BY addspace Places LEFT.
    Thanks in advance.

    Hi Santhosh,
    All the suggestions here will work. Make sure that your number is on the right justified to your character field. Here is an example.
    DATA: v_char09_left_justified(09)  TYPE c,
          v_char09_right_justified(09) TYPE c,
          v_numc09(09)                 TYPE n.
    START-OF-SELECTION.
    *-- in case the value is left justified in the field
      v_char09_left_justified = '9        '.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
           EXPORTING
                input  = v_char09_left_justified
           IMPORTING
                output = v_char09_left_justified.
      WRITE:/ 'V_CHAR09_LEFT_JUSTIFIED from FM =', v_char09_left_justified.
      v_numc09 = v_char09_left_justified.
      WRITE:/ 'V_NUMC09 =', v_numc09.
    *-- in case the value is right justified in the field
      v_char09_right_justified = '        9'.
      SHIFT v_char09_right_justified LEFT DELETING LEADING space.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
           EXPORTING
                input  = v_char09_right_justified
           IMPORTING
                output = v_char09_right_justified.
    WRITE:/ 'V_CHAR09_RIGHT_JUSTIFIED from FM =', v_char09_right_justified.
      v_numc09 = v_char09_right_justified.
      WRITE:/ 'V_NUMC09 =', v_numc09.

  • Function Module for adding Leading Zero's to a specific field

    Hi,
    Can anyone please provide a Function that will do the following:
    1. Take the value of the field
    2. Take the field type
    3. Output the value of the field with leading zero's.
    Anything similar would be very helpful.
    Thank You & Best Regards,
    John

    Sure use the function  CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
    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,
    Rich Heilman

  • Add leading zero to matnr in a conversion program

    Hi All,
    When uploading matnr from a text legacy file , should i add leading zeroes to the sku value. For ex the data from the lagacy is 1000123456 (10 digits length). The values are always numbers. The matnr in SAP is 18 chars. Should my program transform it into 000000001000123456 before saving it into mara-matnr?
    Regards, Oli

    Are you sure that in configuration, the Indicator for lexicographical material numbers is unchecked?  If it checked, then SAP will not then the all numeric material numbers will not get leading zeros by default.   =====>
    Indicator for lexicographical material numbers
    Defines the way numeric material numbers are stored in the database.
    Use
    Caution
    It is only possible to set or reset (cancel) this indicator if no numeric material numbers have been used yet in the system since they would no longer be interpretable after setting or resetting this indicator.
    If this indicator is not set, numeric material numbers are padded with leading zeros and stored right-justified

  • BADI to add leading zero to material in DP

    Hello,
    I wanted to check if there is a BADI that can be used while generating CVC (/sapapo/mc62) that will add leading zeros to the product number (9amatnr) while uploading CVCs from FLAT FILE.
    Thanks,
    Sanju

    Hello,
    I am basically trying to create CVC from a TAB delimited file using tcode /sapapo/mc62. The file will be loaded on Application server and  /sapapo/mc62 will pick up the tab delimited file in background. I want a FM or BADI that can pad leading zero in front of the material Characteristics when CVCs are generated.
    Please advise.
    I am not planning to load the file into infocube and generate CVC from infocube.
    Thanks

  • ALV: ADD leading ZEROs in a CHAR field

    Hello Everybody!
    I have a problem and I hope you can help me
    What I have:
    1. ALV (hier)
    2. Char field 'DEBIT' type SAKNR.
    3. Field catalog TYPE slis_t_fieldcat_alv,
       created by FUNCTION MODULE 'REUSE_ALV_FIELDCATALOG_MERGE'.
    The problem is: i need to show leading zeros in ALV.
    For example: an account '07110000' (in the inner table) is shown as '7110000'.
    What I've done:
    1. ls_fieldcat-lzero = 'X'.
         ls_fieldcat-no_convext = 'X'.
    2. CLEAR ls_fieldcat-ref_tabname.
         ls_fieldcat-lzero = 'X'.
    ( ls_fieldcat-ref_fieldname was clear after filling by the function module)
    I'm realy waiting for your advice!

    >
    nagaraj kumar nishtala wrote:
    > Hi,
    >
    > try to give refernce table name and reference field name for the field after the fieldcatalog merge FM.
    >
    > i mean to say modify the fieldcatalog for that particluar field  by giving refernce table name and reference field name .
    I've tried it, but it doesn't work:
        ls_fieldcat-outputlen = 8.
        ls_fieldcat-lzero = 'X'.
        ls_fieldcat-no_convext = 'X'.
        ls_fieldcat-ref_tabname = 'T599I'.
        ls_fieldcat-ref_fieldname = 'PARAM'.
        ls_fieldcat-datatype = 'NUMC'.
        ls_fieldcat-inttype = 'N'.
    >
    nagaraj kumar nishtala wrote:
    > or use conversion_exit_alpha_input to add zero's to it.
    >
    > Regards,
    > Nagaraj
    How can I use conversion_exit_alpha_input? I have no idea...

  • File rename doesn't add leading zeros to renaming files sequence? And a pat on the back to the LR de

    First of all, LR truly rocks. Any Adobe folk reading this, please take this note as a massive pat on the back for your team. There's a lot of childish and naive negativity from people posting in this forum. And I suspect from folk who are not really your key market for this app. I feed my kids by running a photography business and have been shooting digital since the early 90s...ya know...
    LR will be looked at as a massive sea change in the development of digital photography. The first time the entire workflow process is truly viable from end to end. What will make LR the ultimate winner in it's field is simply the integration with Photoshop. Aperture, Capture One etc cannot ever beat LR regarding this and so, just like the way that Excel and Word and Powerpoint all work together and everyone uses them, LR will inevitably become the de facto standard way of managing RAW images for pro photographers.
    Even with the few bugs (specifically file movingon Mac OS10.4.9) LR has shaved HOURS off our workflow. We shoot around 250 gigs of images a month in our weddings and event business. Now all of our editors use LR. No more Capture One etc for us.
    Here's the question - There seems to be no way to add leading zeros to a file rename command. So if you rename a batch of images they appear as 1,2,3,4,5,6,7,8,9,10,11,12 etc so now when I look at them in Bridge or other apps, they are now sorted 1,10,11, etc
    Now let me tell ya this is a pain.
    Any comments or comfort that is is a known issue would be appreciated. All we want is a way to have the rename add the leading zeros like most other apps do...
    Best to all
    William Henshall
    www.californiaweddingphotos.com
    PS By the way, I am a HARD *** about shoddy unstable software sold to pro photographers as the "prefect solution" that doesnt work as advertised...I am that guy that the tech support guys at certain companies dread. Yep, I simply expect an app to do what it says, just like the car I buy. I once resorted to sending the CEO of a certain software company an invoice for my time restarting, reinstalling the OS and bug finding another similar app. You can image, I got a personal call...heh...

    William-
    <br />
    <br />I just changed a folder of 85 images' names, and typed in 001 as my starting number. While no zeroes were prepended, the pix show up in order both in the Finder and in Bridge CS3.
    <br />
    <br />Say a bit more about file moving on your Macs.....
    <br />
    <br />
    <span style="color: rgb(102, 0, 204);">John "McPhotoman"</span>
    <font br="" /></font> color="#800000" size="2"&gt;~~ John McWilliams
    <br />
    <br />
    <br />
    <br />MacBookPro 2 Ghz Intel Core Duo, G-5 Dual 1.8;
    <br />Canon DSLRs

  • No leading zeros in the assignment field on a billing doc header

    Can someone tell me how I can get the assigment field in a billing doc not to show any leading zero's so when the assigment field is populated in the accounting doc it will not show the zeros either .
    At the moment I have the sales order PO set in copy control to show in the reference field and the assigment field of the billing doc header but need it to show no leading zeros in the accounting doc even if there is some in the SO.
    I.E
    sales orde PO no              Assignment field in billing doc             accounting doc
    0000012345                      0000012345                                        0000012345
    i need it to show NO zeros
                                               12345                                                  12345
    any ideas

    check this thread
    VBRK-XBLNR not copied to BKPF-XBLNR in transaction VF11.
    Note: Pls Text Removed
    Edited by: Lakshmipathi on Nov 1, 2011 10:42 AM
    Please dont ask for points in each of your suggestion and deviate the forum rules

  • Need leading Zeros in the excel sheet which is sent from ABAP

    Hi ,
    I am downloading data from SAP to excel sheet using the WS_DOWNLOAD Function Module. The numeric data in not having leading zeros.  if it is 0010 it is displaying 10 in the excel sheet . i need the leading zeros in the excel sheet. without manulally changing it to Text in the excel sheet .
       Is there any way to do it .
    Thanks,
    Chetan

    Hi Chetan,
      CALL FUNCTION 'WS_DOWNLOAD'
        EXPORTING
          filename                = w_file_path
          filetype                = 'DBF'                       "declare the File type as DBF then leading zeros will appear
          write_field_separator   = 'X'
          confirm_overwrite       = 'X'
        TABLES
          data_tab                = Itab.
    Regards,
    Prabhudas

  • The leading zeros are removing from Number field

    Hi,
    How can i keep the leading Zeros in the number field. For eg, when validating the field, 00123 becomes 123, how to prevent it,
    Thanks in advance

    Hi
    I tried with LPAD(:numberfield,5,'0') in the validate field, but it is not working, I am getting the error , it is not a procedure....., I working with Forms 10g
    Thanks in advance

Maybe you are looking for

  • Problem to assign specific skin for sorted af:column

    Hi, Jdev 11.1.1.2.0 Doc http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e15862/toc.htm says: af|column::column-header-cell-content Styles the content in a header cell. Available pseudo-classes are :sorted (when the column has been sorted).

  • Hacked account - Support team link does not work

    i'm posting this on behalf of my parents, as they don't speak english but their account has been hacked. They received notifications that their password, and email was changed, which they definitely didn't do. I followed the steps on Password reset,

  • Chinese input method crush when input "出" using pin'in or handwrite on IOS5

    either SMS or note and other app, crush happend when trying to input "出". It seems like a bug.

  • This could be the end of my Verizon relationship

    I have been a very loyal customer since 1996 (then Airtouch), even staying after all my friends (mobile to mobile gone) left for Sprint when the iPhone came out.  I have had nothing but issues the past year due to the fact that my plan is old... So m

  • Delete  user applet cache....(Question) ?

    Hi guy, I am looking for any idea or suggestion that how i can delete user's applet cache . Lets suppose i have got new applet, i mean new version with some changes, then how i can automatically delete current cached applet and let the user download