Convert number to words - eg: 1 should come as "first"

Hi,
Is there any function module which would convert numbers to words in a particular format.
for eg: if input is 2, output should be "second".
          if input is twenty, output should be "twentieth".
          and likewise...
Thanks in advance,
Vishnu

Hi,
Check this program.
DATA : gv_words TYPE spell.
DATA : n    TYPE i.
DATA : BEGIN OF itab OCCURS 0,
        split(100),
       END OF itab.
PARAMETERS : a TYPE i.
CALL FUNCTION 'SPELL_AMOUNT'
  EXPORTING
    amount   = a
  IMPORTING
    in_words = gv_words.
WRITE: gv_words-word.
SPLIT gv_words-word AT space INTO TABLE itab.
DESCRIBE TABLE itab LINES n.
READ TABLE itab INDEX n.
PERFORM change_num.
CLEAR: gv_words.
LOOP AT itab.
  IF sy-tabix EQ 1.
    CONCATENATE gv_words-word itab-split INTO gv_words-word.
  ELSE.
    CONCATENATE gv_words-word itab-split INTO gv_words-word
                                  SEPARATED BY space.
  ENDIF.
ENDLOOP.
WRITE: gv_words-word.
*&      Form  change_num
*       text
*  -->  p1        text
*  <--  p2        text
FORM change_num .
  IF itab-split CS 'ONE'.
    REPLACE 'ONE' IN itab-split WITH 'FIRST'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'TWO'.
    REPLACE 'TWO' IN itab-split WITH 'SECOND'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'THREE'.
    REPLACE 'THREE' IN itab-split WITH 'THIRD'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'FOUR'.
    REPLACE 'FOUR' IN itab-split WITH 'FOURTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'FIVE'.
    REPLACE 'FIVE' IN itab-split WITH 'FIFTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'SIX'.
    REPLACE 'SIX' IN itab-split WITH 'SIXTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'SEVEN'.
    REPLACE 'SEVEN' IN itab-split WITH 'SEVENTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'EIGHT'.
    REPLACE 'EIGHT' IN itab-split WITH 'EIGHTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'NINE'.
    REPLACE 'NINE' IN itab-split WITH 'NINTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'TEN'.
    REPLACE 'TEN' IN itab-split WITH 'TENTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'ELEVEN'.
    REPLACE 'ELEVEN' IN itab-split WITH 'ELEVENTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'TWELVE'.
    REPLACE 'TWELVE' IN itab-split WITH 'TWELFTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'TEEN'.
    REPLACE 'TEEN' IN itab-split WITH 'TEENTH'.
    MODIFY itab INDEX n.
  ELSEIF itab-split CS 'TY'.
    REPLACE 'TY' IN itab-split WITH 'TIETH'.
    MODIFY itab INDEX n.
  ELSE. "IF itab-split CS 'D'.
    CONCATENATE itab-split 'TH' INTO itab-split.
    MODIFY itab INDEX n.
  ENDIF.
ENDFORM.                    " change_num
Your requirement is definitley solved with above program
Regards,
Bhupal

Similar Messages

  • Converting number in words

    Hi,
    I want to convert number in words and get the output through a query.
    For example :if the value in row is 1311 then I want the query to return it like one thousand three hundreds and eleven.
    Any help is highly appreciated.
    Cheers

    It could be better indeed, scope is larger, but problem with 0 still exists.
    SQL> select to_char(to_date(0,'J'), 'JSP') as converted_form from dual;
    select to_char(to_date(0,'J'), 'JSP') as converted_form from dual
    ERROR at line 1:
    ORA-01854: julian date must be between 1 and 5373484
    SQL> Better to build function as showed by Tom Kyte in the link given earlier.
    Nicolas.

  • Function to convert number to word format.

    Dear Friends,
    Could you please help me with a code that will take 'sum of all values of a column' as input parameter & return its value in word format.
    Number can be negative , it can/can't contain digits after decimal.
    i have two ways but it won't work when my no. becomes negative
    Moreover i want that it should work on both type of data, numbers without decimal & number with decimal.
    that is what i possess:
    1)
    function CF_1FORMULA return char is
    num1 number;
    p_number number;
    type myArray is table of varchar2(255);
    l_str myArray := myArray( '',
    ' thousand ', ' million ',
    ' billion ', ' trillion ',
    ' quadrillion ', ' quintillion ',
    ' sextillion ', ' septillion ',
    ' octillion ', ' nonillion ',
    ' decillion ', ' undecillion ',
    ' duodecillion ' );
    l_num varchar2(50);
    l_return varchar2(4000);
    begin
    num1:=:my_mumber;
         p_number:=num1;
         l_num:=trunc( p_number );
    for i in 1 .. l_str.count
    loop
    exit when l_num is null;
    if ( to_number(substr(l_num, length(l_num)-2, 3)) <> 0 )
    then
    l_return := to_char(
    to_date(
    substr(l_num, length(l_num)-2, 3),
    'J' ),
    'Jsp' ) || l_str(i) || l_return||'Rupees';
    end if;
    l_num := substr( l_num, 1, length(l_num)-3 );
    end loop;
    return l_return;
    end;
    and
    2)
    select to_char(to_date(floor(1234.99),'J'),'Jsp')||' Rupees and '||to_char(to_date((1234.99-(floor(1234.99)))*100,'J'),'Jsp')||' Paise' from dual;
    kindly help me.
    Thanks & Regards
    Vishnu

    Common question.
    But you will have realised that already if you'd bothered to search the forum...
    http://forums.oracle.com/forums/search.jspa?threadID=&q=number+to+word&objID=f75&dateRange=all&userID=&numResults=30

  • Convert number to words

    is there a way in numbers to convert numbers to words,
    for example"2300" to"two thousand and three hundred".

    Here is a spreadsheet I made to doe this:
    for Numbers 2.x:
    https://www.dropbox.com/s/naooc39djpvn2kk/ValueToText.numbers?dl=0
    for Numbers 3.x:
    https://www.dropbox.com/sh/wz5ejppkbd924mu/AADXJLJ3brHqJL9ts4iq_Kn1a?dl=0
    And a command line application with an Applescript:
    https://www.dropbox.com/s/ajlqxwqbaew5e4m/NumWriterWithScript.zip?dl=0
    See this thread for additional information:
    Return text value of a number

  • I cannot convert pdf to word doc anymore error comes up

    I cannot convert my pdf to word doc anymore

    Hi,
    May i know what error it is showing?
    Please elaborate with screenshot.
    Try to use different browser.
    Regards,
    Florence

  • According to PO number and Line item data should come once but its repeatin

    I am calculating IR Quantity and IR value......
    for a PO  if there are four same  line items i wanted them once but they are displaying for each and every line item
    If my po is 2003000151 and line item 0010 if both are same then i wanted ir quantity 500
    but its displaying like this
      PO                 item   IR
    2003000151   0010 500
    2003000151   0010 500
    2003000151   0010 500
    2003000151   0010 500
    I need like this
    2003000151   0010 500
    2003000151   0010
    2003000151   0010
    2003000151   0010
    If po number and line item are same IR quantity should be displayed only once..
    What should be done if it should not repeat in each and every line item if both PO and line item are same

    i am having internal table of it_ekko.
    in that i am having some data of PO no, Line Item,IR value and IR qty......
    i am having data like below.
    PO                        Line Item   IR Value    IR QTY 
    200310051          0010         1500           4500
    200310051          0010        1500           4500
    200310052         0010           0                   0
    200310052          0010       0               0
    now where ever IR value and IR qty is present i wanted that to display only once against that PO and line item
    i wanted like below
    PO                        Line Item   IR Value    IR QTY 
    200310051          0010         1500           4500
    200310051          0010            0              0
    200310052         0010             0                0
    200310052          0010            0               0
    Field names for IR value and IR Qty are Menge2 and dmbtr2.
    How to do that.........
    I cant use
    Delete adjacent duplicates of it_ekko by ebeln = wa_ekko-ebeln and
                                                                          ebelp = wa_ekko-ebelp.
    because i wanted that po and same line items , how many times it is like that only.....
    in it_ekko table i only wanted to delete duplicates of menge2 and dmbtr2.
    Pls suggest the code

  • Converting Number  into words while Display

    Hello Sir,
    I am working on Project System.
    I am getting Field  MAT_PSPNR(Valuated Sales Order Stock WBS Element) in MSEG Table.
    In table the Corresponding field  stored in Numbers while Display its converted into Some other Content  Please Explain Me ?.
    REPORT  zdemo LINE-SIZE 600.
    tables: mseg.
    select-options: so_mblnr for mseg-mblnr.      " Document No
    start-of-selection.
    select mat_pspnr from mseg into mseg-mat_pspnr    " Valuated Sales Order Stock WBS Element
    where mblnr in so_mblnr.
    check sy-subrc = 0.
    write:/01 mseg-mat_pspnr.
    endselect.
    Table Stored value  for MAT_PSPNR  = 00000293
    Report Display: WSP/RAM/02/03.
    Kindly Explain how the Contents has been changed ?.
    Regards,
    Venkat.

    Hi Venkat,
    please check  the Domain of the field you are trying to display .
    it will have a conversion routine.
    for field MAT_PSPNR domain is PS_POSNR
    In the domain definition tab you will have a conversion routine .
    because of this conversion routine your data is represented in internal format in the table and external format when displayed.
    please read  conversion routine documentation.
    regards,

  • Error in converting number to words

    I use this query
    select (to_char(to_date('46000','J'), 'Jsp'))||' Only'  from dual;It is working fine
    but when I use this query
    select (to_char(to_date('.46','J'), 'Jsp'))||' Only'  from dual;
    showing the error.
    ORA-01858  a non-numeric character was found where a .......

    hoek wrote:
    Hi Solomon,
    Thanks much for commenting and elaborating.
    2. As we all know there is no such thing as year zero.As we all can see, Kame's example is using a string, so I just made up a 'zero' when there's no value present before the decimal sign.Not sure what you mean. I was talking about year 0, not about zero. So to reiterate, you can not use J/JSP format to spell out numbers between 1721058 and 1721423. And since you started talking about 0, your code will not handle 0 as fractional part:
    SQL> with t as ( -- generating some sample data:
      2    select '5.0' str from dual
      3    )
      4    --
      5    --  Actual query:
      6    --
      7    select case
      8             when instr(str,'.') > 0
      9             then nvl(to_char(to_date(to_number(substr(str, 1, instr(str,'.')-1)),'J'), 'Jsp'), 'Zero')||chr(32)
    10             else to_char(to_date(to_number(substr(str, 1, instr(str,'.')-1)),'J'), 'Jsp')
    11           end
    12    ||     case
    13             when instr(str,'.') > 0
    14             then 'point '
    15             else null
    16           end
    17    ||     to_char(to_date(to_number(substr(str, instr(str,'.')+1)),'J'), 'Jsp')
    18    ||     ' Only' str
    19    from   t;
      ||     to_char(to_date(to_number(substr(str, instr(str,'.')+1)),'J'), 'Jsp')
    ERROR at line 17:
    ORA-01854: julian date must be between 1 and 5373484
    SQL> SY.

  • How to convert Number to words In PLD

    Dear Expert,
    I have view all thread related same..but not getting by PLD...
    the amount field i want in Indian format that can be placed on cheque/check ?
    also i add an external data on that PLD now question is that in filed properties ->content -> procedure name ?
    can any one say what that procedure name ? and what u gv ?
    also tell me step for PLD
    please dont send me that begin script link..tell me other way because as per me it will not work with PLD and if i am wrong then tell me.....
    Thanks

    hi kevin,
    In Procedure name u need to link .dll file,Dll files can be created using C++ Programming,
    External data is actually field to print secured images like company logo,Higher official signatures which
    can be tampered when u saved it on computer.
    Hope it clarifies.
    Jeyakanthan

  • Number to Word Convert Function

    Dear All,
    Plz anybody have function name which can convert NUMBER to WORD.
    example:  1213 to One Thousand Two Hundred Thirteen
    thanks,
    RP

    rp,
      Pls. use below FM...
    CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
    AMOUNT = amouno
    CURRENCY = 'USD'
    FILLER = ' '
    LANGUAGE = SY-LANGU
    IMPORTING
    IN_WORDS = SPELL
    EXCEPTIONS
    NOT_FOUND = 1
    TOO_LARGE = 2
    OTHERS = 3.
    Check
    http://www.sap-img.com/fu001.htm
    (OR)
    Also you can use FM HR_IN_CHG_INR_WRDS.
    report ztest02.
    data: words(50) type c.
    call function 'HR_IN_CHG_INR_WRDS'
    exporting
    amt_in_num = '100000'
    importing
    amt_in_words = words.
    write:/ words.
    Pls. Reward if useful

  • Convert numbers into words

    i work on release 11i application and converts some reports to run with xml publisher
    i want to convert a total field that exist in po report to words it seems to convert number into words isthat possible i tried to make this in oracle reports and it run successfully but there is a problem when converting that report to run with xml publisher .
    any help will be approtiated.

    Use ap_amount_utilities_pkg.ap_convert_number
    E.g.
    SQL> select ap_amount_utilities_pkg.ap_convert_number(trunc(12345678)) from dual;
    AP_AMOUNT_UTILITIES_PKG.AP_CONVERT_NUMBER(TRUNC(12345678))
    Twelve million three hundred forty-five thousand six hundred seventy-eight
    Gareth

  • Problem in converting number to character

    Hi All,
    In my report there is number field called <?LINE_TOT_AMOUNT?>. In the next line i want to display that amount in words. I tried using
    <?xdofx:to_char(LINE_TOT_AMOUNT)?>
    but the output is same as the <?LINE_TOT_AMOUNT?>. Can any one help in solving this?

    look at TO_CHAR (number)
    if LINE_TOT_AMOUNT is number then to_char(LINE_TOT_AMOUNT) in string
    it's not display that amount in words
    it's only format row
    if you wnat to convert number to words
    plz see Re: Conversion of number to word

  • NUMBER TO WORDS CONVERSION

    AOA ALL
    Dear i want to convert a numeric value for eg:'1000' into words that is 'ONE THOUSAND' in a report.does any body knows a method or function for that available in developer or any other way...
    do tell me
    thx

    Hi,
    See the link
    converting number to words(100==one hundred)
    Provided a function to convert number to words
    Thanks,
    Oracle Reports Team

  • Any FM to convert amount to words?

    Hi friends,
    Is there any function module available to convert amount to words?
    Regards,
    Lijo Joseph

    Refer:
    Re: I want Function Name which converts number to words
    Regards,
    Subramanian V.

  • How to obtain the number of words of a protected pdf file that can't be converted into a word file?

    I need to get the number of words of pdf files. I usually convert them into word files to get the word count. Some pdf files are protected and can't be converted into word files. Is there another way to get the number of words of these protected pdf files? I use adobe professional XI Pro.

    Scroll through and read the answers available in the thread below. You may find the information helpful.
    Trying to write Javascript code to get word count
    Be well...

Maybe you are looking for

  • Problem to access https after upgrade 8.4

    Hi, i try to upgrde a new device with no config inside... I put the asa and asdm file in the device (last release), then i simply remove the old asa and the old asdm. No the https:192.168.1.1 is no longer accessible. There is my config : Wats wrong ?

  • Plz help me out bapi message (urgent)

    hi i need help. i m passing values in bapi n taking message from table in bapi to print in out put. requirment is.. a)     Pass the following parameters: NUMBER = NETWORK Tables: I_COMPONENTS_CHANGE      COMPONENT = IT_COMP-COMPONENT      BATCH = P_C

  • F-53 Post outgoing payment- help

    When a user tries to post and manual outgoing payment using F-53 for a vendor he is getting a warning message “No open items were found” however there are open items for that vendor which are due for payment. I looked into the data he is entering on

  • Controlling the AWE64 with keybo

    I've recently bought an Edirol PCR- to control my Awe64 Gold. I want to edit parameters such as cutoff frequency, etc in my music sequencing software, but I can't find any 'controller sets' for the Awe on the web. I've tried creating my own set by us

  • Threads, swing etc...

    Hi, I need to develop a software that manage the windows creation. Each windows make some operation: eg. show or manage some data or is a text editor and so on.. I need to know the general idea that is behind the design of a software of this type. I