Add Trailing  zeros to a number or char

Hi Experts,
           my material number is stored in the form of Character so i want to add a trailing zero to that number
           supposr for example my material number is ccf5a   so i want add zeroes to make it 18  like   cf5a0000000000000 characters
          Please help me on this  hoping for the quick replay.

Use [CONCATENATE|http://help.sap.com/abapdocu/en/ABAPCONCATENATE.htm] (only once with a constant initialized with 18 zeroes)
or
go to [PAD|http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING_FORMAT_OPTIONS.htm#!ABAP_ADDITION_3@3@] in [Embedded expressions format_options |http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING_FORMAT_OPTIONS.htm] in [String Templates - embedded_expressions|http://help.sap.com/abapdocu/en/ABENSTRING_TEMPLATES_EXPRESSIONS.htm] in [string_exp - String Templates |http://help.sap.com/abapdocu/en/ABENSTRING_TEMPLATES.htm] in [string_exp - String Expressions|http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING.htm] in [Expressions and Functions for String Processing |http://help.sap.com/abapdocu/en/ABENSTRING_PROCESSING_EXPR_FUNC.htm]
Regards,
Raymon

Similar Messages

  • Add leading zero

    hi im trying to add leading zeros in vendor number
    im using the fm 'CONVERSION_EXIT_ALPHA_INPUT', its not working
    anybody knows how else i can do that

    Well, I made this example, adapt it to suit your needs.
    DATA: vendor(10) TYPE c VALUE '452'.
    START-OF-SELECTION.
      SHIFT vendor CIRCULAR RIGHT.
      WHILE vendor(1) = space.
        SHIFT vendor CIRCULAR RIGHT.
      ENDWHILE.
      SHIFT vendor CIRCULAR LEFT.
      OVERLAY vendor WITH '0000000000'.
      WRITE vendor.

  • Custom Number Format With Leading & Trailing Zeros

    Hi!
    How can I define following number format in Apple Pages (v3.5)?
    Positive numbers: +#'##0.00 (e.g. +0.30 or +5'000.00)
    Negative numbers: -#'##0.00 (e.g. -0.30 or -5'000.00)
    If I create a custom number format and enable Show Trailing Zeros, the leading zero is not shown (e.g. +.30 instead of +0.30). Number format with Thousands Separator enabled comes closest to what I need, but misses the plus sign for positive numbers (which I need to represent differences).
    Any ideas? Thanks in advance for your help!

    Hi Tuna,
    Maybe the currency format would work for you,
    The plus sign is problematic. With the above your negative numbers will be red and in brackets, positive numbers will be black. You could use conditional highlighting to change that.
    quinn

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

  • Trailing zero's

    Hello,
    I have a 15 digit code. It's of varchar data type. Now when i try to pull it into Obiee it's dropping off the trailing zero's. Is there a way to get them. I know we can get them in the report by using html tag. But i have this in the prompt. is there a way i can get the whole code without losing the zero's.
    thanks,
    deep

    Hi,
    can you try below on your column prompt --> edit formula --> try below
    cast(cast( Column as int) as char)
    alternative way
    column properties -> Data Format and select 'Override Default Data format' and treat number as 'Custom'.You can specify the format of that number as required set it.
    Thanks
    Deva

  • Using excel vi's loses trailing zeroes

    I've been given to write a program that saves columns of numbers to a txt
    file that is in the format of spreadsheet. All the numbers in this file are
    3 places format even if there are trailing zeroes. I am using the excel
    vi's that I downloaded from NI. When I save the file all the numbers lose
    their trailing zeroes. So when the user opens the file using notepad the
    columns tend to not line up anymore. I can format the numbers I am writing
    into strings, but still all the rest of the spreadsheet loses its trailing
    zeroes. I wrote a quick fix that reads all 32 columns and reformats them as
    strings with 3 places, but that is kind of a kludge. Is there a better way?

    "Greg McKaskle" wrote in message
    news:[email protected]..
    > > I've been given to write a program that saves columns of numbers to a
    txt
    > > file that is in the format of spreadsheet. All the numbers in this file
    are
    > > 3 places format even if there are trailing zeroes. I am using the excel
    > > vi's that I downloaded from NI. When I save the file all the numbers
    lose
    > > their trailing zeroes. So when the user opens the file using notepad
    the
    > > columns tend to not line up anymore. I can format the numbers I am
    writing
    > > into strings, but still all the rest of the spreadsheet loses its
    trailing
    > > zeroes. I wrote a quick fix that reads all 32 columns and reformats
    them as
    > > strings with 3 places, but that is
    kind of a kludge. Is there a better
    way?
    >
    > I'm not positive that I understand what is going on, but if you have
    access
    > to the diagrams, you should look for where the numbers are formatted. To
    > format a number as a string and pad with zeroes, you can change the format
    > to %0f, or %08.3f for eight chars with three decimal chars and filled with
    > zeroes.
    In excel ObjectRepository.vi (from excel get data to modify.vi from excel
    save.vi) the diagram can't be viewed without a password. I think that is
    where the data is prepared for saving. I never even knew diagrams could be
    protected like that.

  • A Way to add a zero to an alphanumeric code?

    Does anyone know how I can add a zero to this kind of code?
    The list I get sent each week is:
    1m1
    1m2
    1m3 and so on..
    but I need
    1m01
    1m02
    1m03
    I would really appreciate it if someone could show me this!
    Best regards,
    Felix

    It would be useful to know the exact problem.
    Is the first part always a two chars one ?
    What to do if the original value is 1m11 ?
    I guess that the complete description of the problem is :
    *I receive strings made of a first part of two characters,*
    *and a second part which may be one or two digits.*
    *I want to edit them so that second part made of a single digit become a two digits one starting with a zero.*
    To treat this problem, use the formula :
    =IF(LEN(B)>3,B,LEFT(B,2)&"0"&RIGHT(B,1))
    If the column B may contain blank cells, it would be useful to use an enhanced formula :
    =IF(LEN(B)>0,IF(LEN(B)>3,B,LEFT(B,2)&"0"&RIGHT(B,1)),"")
    Read *_iWork Formulas and Functions User Guide_* to get details about what the used functions are designed to achieve.
    Yvan KOENIG (VALLAURIS, France) mercredi 28 juillet 2010 19:03:41

  • I want to remove Trailing zeros from a charecter value

    Hello ,
              i want to remove trailing zeros for a prticular value.Following is my code :
    DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
               V_CHAR(25) ,
               P10_4(10) TYPE P DECIMALS 4.
    CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
    EXPORTING
    FLOAT_IMP = V_FLOAT
    FORMAT_IMP = P10_4
    ROUND_IMP = ' '
    IMPORTING
    CHAR_EXP = V_CHAR.
    SHIFT V_CHAR RIGHT DELETING TRAILING '0'.
    WRITE : V_CHAR ."NO-ZERO.
    <u><b>Output:</b></u>
    if we pass the value '1.3000000000000000E+01' it should be 13.0
    ex2: '1.3400000000000000E+01' it should be 13.4
    ex3:'4.8240000000000000E+03' it should be 4824
    is there any way to get the solution without functional module. If so Please tell me with code.

    hi
    u can do it in number of ways.
    Use TCODE SU3
    Select default tab and select radio button 123467.89 in decimal notation and save it.
    or u can try :
    if you want to do this through ABAP program.
    1. to delete trailing spaces.
    SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.
    to delete leading zeroes,
    SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.
    only for one abap program, u can use set country command
    for all programs :
    sap menu>system->go to user profil->own data>default --> and choose ur format.
    hope this helps u.
    Regards,
    Prasanth
    Reward all hepful replies

  • 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

  • How can i retain the trailing zeroes after decimal

    how can i retain the trailling zeros after decimal?
    values are showing in table like( 4.50,5.00) but i am trying to do some processing with these values then ithe zeroes are truncated like (4.5,5),
    how can i get values with zeroes

    If the values in the table have trailing zeroes, it's a character type column.
    Once you perform operations on them, they're implicitely converted to the number type, hence "losing" trailing zeroes.
    To get the trailing zeroes back, you have to convert them back to character data:
    TO_CHAR(1.5*3, '90d99')Have fun,
    K.

  • How to get PL/SQL output in Excelsheet & preserve trailing zero for VARCHAR

    Hi All,
    I am trying to get the PL/SQL procedure out put to Excel sheet, I have wrote below code and it worked fine.
    CREATE OR REPLACE PROCEDURE plsql_to_excel_demo IS
    CURSOR cur_stock_details
    IS
    SELECT *
    FROM stocks;
    outfile UTL_FILE.file_type;
    l_chr_string VARCHAR2(100);
    l_chr_col_header VARCHAR2(100);
    l_chr_file VARCHAR2(100);
    l_chr_date VARCHAR2(20);
    BEGIN
    SELECT TO_CHAR(sysdate,'DD_MON_YYYY')
    INTO l_chr_date
    FROM dual;
    l_chr_col_header :='SYMBOL'||CHR(9)||'COMPANY'||CHR(9)||'CURRENT_PRICE'||CHR(9)||'TRADE_DATE'||CHR(9)||'NUMBER_TRADED_TODAY'
    ||CHR(9)||'TODAYS_HIGH'||CHR(9)||'TODAYS_LOW';
    l_chr_file := 'STOCK_REPORTS_'||l_chr_date||'.xls';
    outfile := UTL_FILE.FOPEN ('/u01/app/UTL/out',l_chr_file, 'W');
    UTL_FILE.PUT_LINE(outfile,l_chr_col_header);
    FOR rec_stock_details IN cur_stock_details LOOP
    /*l_chr_string := rec_stock_details.symbol||CHR(9)||''''||rec_stock_details.company||''''||CHR(9)
    ||rec_stock_details.current_price||CHR(9)||
    TO_CHAR(rec_stock_details.trade_date,'DD/MM/YYYY')||CHR(9)||rec_stock_details.number_traded_today||CHR(9)||
    rec_stock_details.todays_high||CHR(9)||rec_stock_details.todays_low;
    l_chr_string := rec_stock_details.symbol||CHR(9)||rec_stock_details.company||CHR(9)||rec_stock_details.current_price||CHR(9)||
    TO_CHAR(rec_stock_details.trade_date,'DD/MM/YYYY')||CHR(9)||rec_stock_details.number_traded_today||CHR(9)||
    rec_stock_details.todays_high||CHR(9)||rec_stock_details.todays_low;
    UTL_FILE.PUT_LINE(outfile,l_chr_string);
    END LOOP;
    UTL_FILE.FCLOSE (outfile);
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line ('Error in main '||SQLERRM);
    END plsql_to_excel_demo;
    I am facing the issue when I have VARCHAR2 column say Company in stocks table with value as 0000234. When I get the data Excel
    sheet I can only see 234
    for company name. I want to preserve the trailing zeros while getting the output in Excel sheet.
    I have tried with adding single quote (') please see the commented part in the above code, but it will give me output in company
    column in excel '0000234' which i don't want.
    Is there any way I can make this work and only get 0000234 as company name in Excel.
    Thanks for reading the post..
    regards,
    Shyam.
    Edited by: Suryawanshi on Mar 22, 2010 5:40 PM

    Yes, that should be a client (excel, or open office in my case) issue.
    I stole some code from http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:95212348059 to test this out.
    Adding a single quote to the beginning of the string worked fine with my version of Open Office, should work for your Excel as well.
    create table varchar2_test(col1 varchar2(10), col2 number(10));
    insert into varchar2_test values ('000189', 10);
    create or replace function  dump_csv( p_query     in varchar2,
                                          p_separator in varchar2 default ',',
                                          p_dir       in varchar2 ,
                                          p_filename  in varchar2 )
    return number
    is
        l_output        utl_file.file_type;
        l_theCursor     integer default dbms_sql.open_cursor;
        l_columnValue   varchar2(2000);
        l_status        integer;
        l_colCnt        number default 0;
        l_separator     varchar2(10) default '';
        l_cnt           number default 0;
    begin
        l_output := utl_file.fopen( p_dir, p_filename, 'w' );
        dbms_sql.parse(  l_theCursor,  p_query, dbms_sql.native );
        for i in 1 .. 255 loop
            begin
                dbms_sql.define_column( l_theCursor, i, l_columnValue, 2000 );
                l_colCnt := i;
            exception
                when others then
                    if ( sqlcode = -1007 ) then exit;
                    else
                        raise;
                    end if;
            end;
        end loop;
        dbms_sql.define_column( l_theCursor, 1, l_columnValue, 2000 );
        l_status := dbms_sql.execute(l_theCursor);
        loop
            exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
            l_separator := '';
            for i in 1 .. l_colCnt loop
                dbms_sql.column_value( l_theCursor, i, l_columnValue );
                utl_file.put( l_output, l_separator || l_columnValue );
                l_separator := p_separator;
            end loop;
            utl_file.new_line( l_output );
            l_cnt := l_cnt+1;
        end loop;
        dbms_sql.close_cursor(l_theCursor);
        utl_file.fclose( l_output );
        return l_cnt;
    end dump_csv;
    variable x number;
    begin
       :x :=    dump_csv
                   p_query     => 'select '''' || col1, col2 from varchar2_test',
                   p_separator => ',',
                   p_dir       => 'TEST_DIR',
                   p_filename  => 'test_output.xls'
    end;
    print :x

  • Answers report-download as Excel loose trailing zeroes

    Hi!
    When I download Answers report to Excle (Word) I loose trailing zeroes.
    1.2500 -> 1.25Trailing zeroes are important and I'd like that format remain as it is in OBI in all downloading types (Excel, Word etc).
    When I export to PDF (run through Oracle BI publisher) trailing zeroes are correct.
    Any help please.
    My config, OBI on Windows 2003 32 bit:
    Product Information
    Oracle Business Intelligence Product Version     10.1.3.4 (Build 080726.1900)
    Physical Presentation Catalog Path     \\?\C:\OracleBIData\web\catalog\teb\root
    Oracle BI Server Data Source     AnalyticsWeb
    Available Paging Memory (MB)     5176
    Available Virtual Address Space (MB)     1833

    Hi,
    here are mine data as requested ...
    The only three formating columns are Cash up KN, Cash up EUR i Cash up EUR/KN.
    Column that has problem has no "mso" like formating at all, only two decimal number format, defined in classic way in OBI.
    Generated Excel file from OBI:http://sites.google.com/site/vadasovi/icon_holders-1/BAZA.xls
    How it is opened in Excel 2003:http://sites.google.com/site/vadasovi/_/rsrc/1318338523563/Home/temp/2007.PNG , look column in red.
    Same file in Excel 2010 (other mashine then 2003:http://sites.google.com/site/vadasovi/_/rsrc/1318338543353/Home/temp/2010.png
    Both client are Win XP SP3 with Croatian locale (same one in detail).
    Rg,
    Damir

  • 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 delete Trailing zeros in a string array

    I am reading data from RS232 port and storing the values in an array of 16 nos. Then converting the array of numbers into string using 'number to fractional string" function with precession 2  and sending the data string to Table. I am printing this table further for report generation.
    I am unable to remove the trailing zeros as i am defining precession 2 which is not needed for all the numbers in the table.
    Please help me how to remove the trailing zeros after decimal point which is very much necessary for report generation.
    regards
    Prasanna Kumar N M

    Use format into string in a FOR loop with a format specified of %#f. See attached example (LabVIEW 7.0)
    Message Edited by altenbach on 10-14-2006 05:40 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AutoFormat.vi ‏17 KB
    AutoFormat.png ‏3 KB

  • 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

Maybe you are looking for

  • Iphone 3g: Clicking phone number in calendar doesn't work

    Clicking on phone number in email will prompt for calling the number but the same doesn't work in calendar. Is it a known issue ?

  • Drop messages in queue that have a blank sender

    I'm getting hundreds of messages in the Queue where the From Address is < >.  Do I just let these build up or is there a setting somewhere that would just drop the message if it has a blank sender? Here is an example of one that I've received; Identi

  • Adapter Engine not  visible in RWB

    Hi Guys,          I coudnt find the Adapter engine in Component Monitoring and Message monitoring in RWB. while displaying the components of Integration Engine getting the below error. I am using PI 7.1 Kindly let me know where to check if the compon

  • PSE 12 Installer will not initialize

    So, downloaded PSE 12 without problem. Run the installer and get the "installer will not initialize" message.  Running MAC OS 10.9 on Macbook Pro. No log created to tell me what has happened.

  • How can i use Canny algorithm in imaq

    hi is there Canny algorithm in imaq vision? i need it in iris project thanx