Padding zeros

Hi friends,
I need a small help.
My requirement is like,I need to pad zeroes in front of a quantity value.
I am using CONVERSION_EXIT_ALPHA_INPUT.But,it is going into dump,because
I am passing a quantity field as input.
Can any one suggest any function module,to pad zeroes to a quantity value or decimal value.
Points guaranteed,
Imran

hi masood,
first Convert that Quantity field value into Char type and then pass it to conversion routine..
ex:
data: var(length) type c.
var = quantity field.
and then pass it to conversion routine.
<b>Reward points if useful</b>
Message was edited by:
        Chandra

Similar Messages

  • Padded zeros which is removed need to be replaced by spaces

    Hi Friends,
    My requirement in XI is : Padded zeros which is removed need to be replaced by spaces.
    for removing padded zeros I used the UDF:
    int i = Integer.parseInt(a);
    return (Integer.toString(i));
    It is working fine.
    Please help as how to go abt in coding : whatever zeros get taken off , need to be replaced with spaces.
    Thanks in Advance,
    Meghna.

    Hi Raj,
    According to the logic given by Henrique, its working. But the point to the noted is that :
    The number of spaces need to be equal to the number of zeros removed, where it not happening in this case.for the below Ex when applied it returned '  12345' instead of '    12345'.
    For ex. source field is '000012345' then the target field need to be '    12345'.
    the Type declared in the data type for the receiver field is integer with length 15.
    Is it possible to move the field value to the right justified, so the the padded zeros code when applied will automatically load spaces.Becoz the code written for removing zeros contains String due to which it is left justified i think.
    The code written for removing zeros is :
    int i = Integer.parseInt(a);
    return (Integer.toString(i));
    please suggest in this regard.
    Regards,
    Meghna.
    Edited by: meghna swaraj on Feb 27, 2008 6:05 PM

  • A query on removing additionally padded zeroes from the pernr.

    Hi ,
    How can i remove the padded zeroes from the pernr, Ex pernr is 8 chars and if pernr has 6 chars it has to remove appended 2 zeroes from the left and should only print the 6 chars with no appended zeroes
    Thanks

    Hi Khaleel,
    Use FM <b>CONVERSION_EXIT_ALPHA_OUTPUT</b>
    Reward if useful.
    Thanks
    Aneesh.

  • Pad Zeros in user Exit

    What is the syntax to pad a value with zeros in a user exit code.
    I have a value of MONTH 01,02, 03...12.  Then to get previous month I do MONTH-1 but this gives me 1,2,3...12.  and I loose the zero which i will need when I concatenate with year to get what I need...
    help please

    hi,
    check the links,
    http://help.sap.com/search/highlightContent.jsp
    http://help.sap.com/search/highlightContent.jsp
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/4f/d5276c575e11d189270000e8322f96/frameset.htm

  • IP Adresses - padding zeroes for ORDER BY

    Hi!
    I have a table with an IP address inside (type varchar2(50)). The data inside looks like 192.168.0.1. Now, my app should be able to ORDER BY this ip address. This means, when I do ORDER BY on this column without any changes, the output is wrong:
    192.168.0.1
    192.168.0.10
    192.168.0.11
    192.168.0.2
    and so on.
    Is there a way to temporarily pad the leading zeroes, e.g.
    to 192.168.000.001?
    Thanks in advance
    André
    PS: To all those who helped me with my large-table-speed-problem some months ago: The project has been dropped :-( Thanks again anyway.

    Depending on how much use you make of IP addresses in your application, it might be worth defining IP_ADDRESS as a type, as then it could have its own MAP or ORDER function and you can simply ORDER BY the IP address column.
    Here is a basic example using IPv4 n.n.n.n addresses. You could add IPv6, domain name, etc etc as necessary.
    CREATE OR REPLACE TYPE ip_address AS OBJECT
    ( hostname VARCHAR2(50)
    , address  VARCHAR2(25)
    , elements INTEGER_TT
    , CONSTRUCTOR FUNCTION ip_address
         ( p_address VARCHAR2 DEFAULT NULL )
         RETURN SELF AS RESULT
    , MAP MEMBER FUNCTION ip_to_integer
         RETURN INTEGER
    CREATE OR REPLACE TYPE BODY ip_address
    AS
         CONSTRUCTOR FUNCTION ip_address
              ( p_address VARCHAR2 DEFAULT NULL )
              RETURN SELF AS RESULT
         IS
              v_current_pos INTEGER := 1;
              v_next_pos    INTEGER := INSTR(p_address,'.');
              v_element_len INTEGER := v_next_pos - v_current_pos;
         BEGIN
              IF p_address IS NULL THEN
                   RETURN;
              ELSIF p_address NOT LIKE '%.%.%.%' OR p_address LIKE '%.%.%.%.%'
              THEN
                   RAISE_APPLICATION_ERROR
                   ( -20000
                   , '"' || p_address || '" is invalid: format should be n.n.n.n' );
              END IF;
              SELF.elements := INTEGER_TT(NULL,NULL,NULL,NULL);
              FOR i IN 1..4 LOOP
                   SELF.elements(i) := SUBSTR(p_address, v_current_pos, v_element_len);
                   IF SELF.elements(i) NOT BETWEEN 0 AND 255 THEN
                        RAISE_APPLICATION_ERROR
                        ( -20000
                        , '"' || p_address || '" is invalid: element ' || i ||
                          ' "' || SELF.elements(i) || '" is outside range 1-255' );
                   END IF;
                   v_current_pos := v_next_pos +1;
                   v_next_pos    := INSTR(p_address,'.',v_current_pos +1);
                   v_element_len := v_next_pos - v_current_pos;
                   IF v_next_pos = 0 THEN
                        v_element_len := 1000;  -- Arbitrary large value
                   END IF;
              END LOOP;
              SELF.address := p_address;
              RETURN;
         END;
         MAP MEMBER FUNCTION ip_to_integer
              RETURN INTEGER
         IS
         BEGIN
              RETURN
                SELF.elements(1) * 1e9
              + SELF.elements(2) * 1e6
              + SELF.elements(3) * 1e3
              + SELF.elements(4);
         END;
    END;
    show errors
    CREATE OR REPLACE VIEW ip_test_view
    AS
    SELECT address_var
         , IP_ADDRESS(address_var) AS address_obj
    FROM   ip_test
    SQL> desc ip_test_view
    Name                                      Null?    Type
    ADDRESS_VAR                                        VARCHAR2(25)
    ADDRESS_OBJ                                        IP_ADDRESS
    SQL> SELECT t.address_var, t.address_obj.address FROM ip_test_view t ORDER BY address_var;
    ADDRESS_VAR               ADDRESS_OBJ.ADDRESS
    192.168.0.1               192.168.0.1
    192.168.0.10              192.168.0.10
    192.168.0.11              192.168.0.11
    192.168.0.2               192.168.0.2
    2.168.0.2                 2.168.0.2
    92.168.0.2                92.168.0.2
    6 rows selected.
    SQL> SELECT t.address_var, t.address_obj.address FROM ip_test_view t ORDER BY address_obj;
    ADDRESS_VAR               ADDRESS_OBJ.ADDRESS
    2.168.0.2                 2.168.0.2
    92.168.0.2                92.168.0.2
    192.168.0.1               192.168.0.1
    192.168.0.2               192.168.0.2
    192.168.0.10              192.168.0.10
    192.168.0.11              192.168.0.11
    6 rows selected.

  • UDF for padding zeroes

    Hi
    I need a UDF Code for the following requirement ,which is used in various fields across a lot of mappings
    Requirement is that if it is a fixed length file and the field length is 10 then whatever value thats coming should be right alligned and there shud be zeroes padded to the left of it
    for e.g
    field length is 10
    input value os 3456
    then the output should be 0000003456
    I want to make it a generic function wher i can take the field length and the input value as inputs
    Dev

    Hi,
    You can edit my function. What you can do is send the length as one input and then it should work. Add this code:
    Create a value udf with two input arguments a and input. Then add this code:
    Imports:  java.*;
    int len=input.length();
    int b = Integer.parseInt(a);
    for(int i=0; i<b-len;i++)
    input="0"+input;
    return input;
    Here pass the total length of the field in first argument and then send the input value to teh second argument. Then it should work for you.
    Regards,
    ---Satish

  • Regarding padding Zeros

    data :  DMBTR(12) TYPE P DECIMALS 3, 
       dmbtr  = 300.000-
    How to pad this field with zeros in front of it.
    Please help me in this regard
    Thanks,
    Lakshmi.

    Hi,
    Test the following Code.
    Data: a(8) TYPE n.
    a = '00000056'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        input         = a
    IMPORTING
       OUTPUT        = a
    WRITE: a.
    a = '56'.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = a
    IMPORTING
       OUTPUT        = a
    WRITE: a.
    Kind Regards,
    Faisal

  • Filename manipulation to get padded zero

    Hi All,
    I am using a file adapter and used the file name as "source_target_fl_%yyyyMMdd%_%SEQ%.xml"
    From file adapter wsdl:
    <jca:operation
    LogicalDirectory="OUT_DIR"
    InteractionSpec="oracle.tip.adapter.file.outbound.FileInteractionSpec"
    FileNamingConvention="source_target_fl_%yyyyMMdd%_%SEQ%.xml"
    OpaqueSchema="false" >
    </jca:operation>
    Now is there any method that I can get the filename as source_target_fl_20090818_00001.xml , I mean I need to do left pad to the sequence, is this possible to do it in the wsdl itself.
    Regards,
    Sreejit

    Have you tried to use "APPS.FND_CONCURRENT" API?
    http://etrm.oracle.com/pls/trm11510/etrm_pnav.show_object?c_name=FND_CONCURRENT&c_owner=APPS&c_type=PACKAGE
    http://etrm.oracle.com/pls/trm11510/etrm_pnav.show_object?c_name=FND_CONCURRENT&c_owner=APPS&c_type=PACKAGE%20BODY
    Thanks,
    Hussein

  • How to pad zeros at the left?

    Hi All,
    I have requirement where
    Input is 1234
    and Output should be :-0000001234(6 Zeros at left).
    Please let me knw how to do it.
    Thanks,
    Suraj

    hi Suraj,
    If you are sure its should be always prefixed with 6 zeros then u can use above mentioned method.
    But if you are not sure about the input string lenghth than below udf will help.
    s = "000000".substring(s.length()) + s;
    where s= input value which is 1234 in ur example given.
    hope this solves your problem.
    thanks and regards,
    Praveen T

  • Payables: Cannot start a Payment Document number with Zero

    Hi all,
    I have a bit of an unusual situation. One of my users wants to issue cheques from a book where the serial starts with 0 (015698, 015699 etc). However, Oracle Payables automatically deletes the 0 at the top of the string and leaves only rest of the integers in the cheque number field. This creates a problem in printing the payment voucher since the voucher will show the paid cheque number without the zero at the front.
    Any suggestions as to how i can overcome this?
    Miranga

    Hi Miranga,
    Note 1361688.1, R12: Payables Check Number Not Accepting Leading0. Ex: 060078, discusses this issue with the note  that:
    "This is a normal behavior, There is no chance to have leading 0 in the check number, The check number in the AP_CHECKS_ALL table is a numeric field, so we can't have padded zeros."
    For reconciliation, the leading check numbers are removed so matching can occur, assuming you have patch 12976660 applied.
      R12.0.X: ceabrmab.pls 120.62.12010000.32
      R12.1.X: ceabrmab.pls 120.56.12000000.40 
    Regards,
    Cheryl

  • Leading Zeros Supression

    How Can I supress Leding zeroes into target Structure?. Iam getting 10 digits filled zeros left justified and my target systems doesn't need zeros. Is there Standard function in Mapping I can use?

    Hi,
    With th ehelp of Substring standard function you can achieve that, if you know the exact number or length.
    Elese it is prefer to write a Java User Defined function to achieve the same.
    Just check with <i>FormatNum</i> inbuilt functions.
    This thread discusses about padding zeros, instead of this, you need to substring it..
    Lpadding zeroes to a string in message mapping- material/customer format
    Regards,
    Moorthy

  • Remove leading zeros from a string

    Hi,
    I have a string with some numeric value.
    e.g.
    String a = 54890001
    I want to make it 10 digits long by padding zeros at the begining
    Now a = 0054890001 ( this is for display purpose ) I know how to do it.
    Now How can strip these leading zeros from this number to get back the actual number. The user sees this 10 digit number and he can change it to something like 0067490001. Now I want to strip these leading zeros.
    and i shd get 67490001.
    In other words, how to strip leading zeros from a string ?
    Thanks for help
    Vinod

    I would try two things: First, just try a straightforward parsing of your String using the Integer.parseInt() method. This is only my first suggestion because the number could be interpreted as octals; only testing will really tell. Second, try a method like this:
    public static String removeLeadingZeros(String str) {
        if (str == null) {
            return null;
        char[] chars = str.toCharArray();
        int index = 0;
        for (; index < str.length; index++) {
            if (chars[index] != '0') {
                break;
        return (index == 0) ? str : str.substring(index);
    }Shaun

  • String padding in FCC

    Hello All,
    I have receiver FCC and have requirement of Right padding strings and left padding numerics. FCC  is of fixedLength.
    String data type fields have to be end padded with " " e.g. "Data    "
    Numeric or Decimal data type have to be forward padded with "0" e.g. "000001234". Can we handle something like this in FCC itself. Is there any solution except writing and using UDF for each field.
    Regards
    Arpil

    String data type fields have to be end padded with " "
    I don't think you need right padding as it is already fixed lenght FCC, the space will be added to the string if its shorter than the specified length.
    To control this behaviour you can use NameA.fixedLengthTooShortHandling.
    http://help.sap.com/saphelp_nw70/helpdata/EN/d2/bab440c97f3716e10000000a155106/content.htm
    And for left padding zero's, you either need to use numFormat function as mentioned or write a udf. I dont think this can be handled in FCC.
    Refer this link for UDF-
    http://wiki.sdn.sap.com/wiki/label/padding

  • Procedure or function to trim leading zeros

    Hi!
    I need to create a procedure or function that can trim the leading zeros of a value (character string).
    I.e.
    Original: 0000012345,67
    Output: 12345,67
    Thanks for any ideas/examples!
    Edited by: user545194 on 21.06.2010 07:33

    user515689 wrote:
    What about the opposite of this? Needing to pad zeroes on values?
    i..e make 867 00867?
    How can that be done?
    Any tips?
    Thanks.If the value is a number, then use to_char and specify a format mask...
    SQL> select to_char(867,'fm09999') from dual;
    TO_CHA
    00867

  • Prevent oracle suppresses the leading zero

    Hi guys,
    What is the best way to prevent oracle from suppressing leading 0 while convert a number to char. I am using Release 11.2.0.1.0.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select to_char(0.01) from dual;
    TO_
    .01I can achieve this by using decode, for example:
    SQL> select decode(instr(to_char(0.01), '.'),
      2                1,
      3                '0' || to_char(0.01),
      4                to_char(0.01)) val
      5    from dual;
    VAL
    0.01
    SQL>But it doesn't look very pretty, is there a better way to do this please? Please note my data is mixed with values with or without decimal places. When the value is greater equal than 1, i want to have the output as same as to_char(val), the padding zero only applies to when the value is between 0 to 1. Many thanks.
    Best regards,
    Pete

    Many thanks Justin, but it doesn;t give quite what i want
    SQL> select to_char(1, '0.99') col from dual;
    COL
    1.00
    SQL>Please note my data is mixed with or without decimal places, for example value 123, i just want to show 123, NOT 123.00 instead. At the moment i am using decode to do this as:
    SQL> select decode(instr(to_char(123), '.'),
      2                1,
      3                '0' || to_char(123),
      4                to_char(123)) val
      5    from dual;
    VAL
    123
    SQL>It works but it looks ugly to me, I wonder is there a better way to do this please?
    Cheers,
    Pete

Maybe you are looking for