Converting the amount in words

Hi ,
Issues is like if the amount is $137,510.82 for US currency it should give as   ONE HUNDRED THIRTY-SEVEN THOUSAND FIVE HUNDRED TEN USD and 82/100.
But when the document currency is german in the check it should give as ONE HUNDRED THIRTY THOPUSAND AND 51082/100.
THE LOGIC SHOULD BE CURRENCY DEPENDENT.
HOW DO I DI THIS...

following is a customized report to convert amount to words...
*& Report  ZCFM_REPT_RUPEE_CONVERSION                                  *
*This report is a copy of report 'ZRUPECO1' in Tengl server            *
Date                    :  25-Oct-2006                               *
Author                  :  Amiya Shrivastava                         *
Title                   :  Report to convert amount into words as per*
                           Indian spelling conventions               *
Original Request number :  DEVK917286                                *
report  zcfm_rept_rupee_conversion              .
include zcfm_incl_rupee_conv_data.
*&      Form  COVERSION1
      text
     -->NUMBER     text
     -->ANS        text
form coversion1 using number changing ans.
  clear: gtab,
         giritab,
         giriline,
         girijtab,
         line ,
         ans,
         init, initnam, initno , init1,
         cnam1, cnam2, cnam3,cnam4, point,jpoint,
         kpoint,lpoint1, lpoint2,lpoint,fpoint,
         cnt1 , cnt2, cnt3 ,
         flhun, flth, flla, flcr1,flcr2, flchu1, flchu2, flpt, res.
  refresh :
         itab ,
         ktab ,
         jtab .
  init = number.
  init1 = init.
  cnt1 = strlen( init ).
  cnt2 = cnt1 - 1.
  do cnt1 times.
    initnam = init+0(1).
    shift init by 1 places left.
    if initnam = '.'.
      cnam1 = init1+0(initno).
    endif.
    initno = initno + 1.
  enddo.
  do cnt1 times.
    cnam2 = init1+0(1).
    shift init1 by 1 places left.
    if cnam2 = '.'.
      point = init1+0(2).
      exit.
    endif.
  enddo.
  do 2 times.
    jpoint = point+0(1).
    shift point by 1 places left.
    if sy-index = 1.
      kpoint = point.
    endif.
    perform points.
  enddo.
  cnt1 = strlen( cnam1 ).
  do cnt1 times.
    cnam2 = cnam1+0(1).
    perform calcu .
    shift cnam1 by 1 places left.
  enddo.
  sort itab descending by index.
  loop at itab.
    if sy-tabix = 1.
      jtab-result = itab-result.
      jtab-index = itab-index.
      append jtab.
    else.
      if itab-result = 'One  ' and  ( sy-tabix = 2 or sy-tabix = 5 or
                sy-tabix = 7 or sy-tabix = 9 ).
        perform teens.
        move space to line-result.
        modify jtab from line index cnt3 transporting result .
      else.
        if itab-result <> space.
          perform ties.
        else.
          jtab-result = itab-result.
          jtab-index = itab-index.
          append jtab.
        endif.
      endif.
    endif.
    cnt3 = sy-tabix.
    res = itab-result.
  endloop.
  skip.
  loop at jtab.
    case sy-tabix.
      when 10.
        if jtab-result <> space.
          if flcr1 = 'X' and flcr2 = 'X'.
            concatenate jtab-result 'Hundred Crores' into line-result
                  separated by ' '.
            modify jtab from line index sy-tabix transporting result.
          else.
            concatenate jtab-result 'Hundred AND' into line-result
                  separated by ' '.
            modify jtab from line index sy-tabix transporting result.
          endif.
        endif.
      when 9.
        if flcr1 = 'X'.
          if jtab-result <> space.
            concatenate jtab-result 'Crores' into line-result
                            separated by ' '.
            modify jtab from line index sy-tabix transporting result.
          else.
            flcr2 = 'X'.
          endif.
        endif.
      when 8.
        if jtab-result <> space.
          concatenate jtab-result 'Crores' into line-result
                          separated by ' '.
          modify jtab from line index sy-tabix transporting result.
        else.
          flcr1 = 'X'.
        endif.
      when 7.
        if flla = 'X'.
          if jtab-result <> space.
            concatenate jtab-result 'Lacs' into line-result
                        separated by ' '.
            modify jtab from line index sy-tabix transporting result.
          endif.
        endif.
      when 6.
        if jtab-result <> space.
          concatenate jtab-result 'Lacs' into line-result
                         separated by ' '.
          modify jtab from line index sy-tabix transporting result.
        else.
          flla = 'X'.
        endif.
      when 5.
        if jtab-result <> space.
          if flth = 'X'.
            concatenate jtab-result 'Thousand' into line-result
             separated by ' '.
            modify jtab from line index sy-tabix transporting result.
          endif.
        endif.
      when 4.
        if jtab-result <> space.
          concatenate jtab-result 'Thousand' into line-result
                   separated by ' '.
          modify jtab from line index sy-tabix transporting result.
        else.
          flth = 'X'.
        endif.
      when 3.
        if jtab-result <> space.
          if flchu1 = 'X' and flchu2 = 'X'.
            concatenate jtab-result 'Hundred' into line-result
                separated by ' '.
          else.
            concatenate jtab-result 'Hundred AND' into line-result
                separated by ' '.
          endif.
          modify jtab from line index sy-tabix transporting result.
        else.
          flhun = 'X'.
        endif.
      when 2.
        if jtab-result = space.
          flchu2 = 'X'.
        endif.
      when 1.
        if jtab-result = space.
          flchu1 = 'X'.
        endif.
    endcase.
  endloop.
*SORT JTAB ASCENDING BY INDEX.
  loop at jtab.
    if sy-tabix = 1.
      cnam4 = jtab-result.
    else.
      concatenate jtab-result cnam4  into cnam4 separated by space.
    endif.
  endloop.
  if lpoint2 = space and lpoint1 = space.
    lpoint = 'only'.
  else.
    concatenate 'Paise' lpoint2 lpoint1 'only' into lpoint separated by
    space.
  endif.
  if cnam4 <> space.
    shift cnam4 left deleting leading space.
    concatenate 'Rupees' cnam4 lpoint into ans separated by space.
*WRITE : / 'RUPEES', CNAM4.
*WRITE : / ANS.
  endif.
endform.                                                    "COVERSION1
*WRITE : / LPOINT NO-GAP.
form ties.
  jtab-index = itab-index.
  if sy-tabix = 2 or sy-tabix = 5 or sy-tabix = 7 or sy-tabix = 9.
    case itab-result.
      when 'Two  '.
        jtab-result = 'Twenty'.
      when 'Three'.
        jtab-result = 'Thirty'.
      when 'Four '.
        jtab-result = 'Fourty'.
      when 'Five '.
        jtab-result = 'Fifty'.
      when 'Six  '.
        jtab-result = 'Sixty'.
      when 'Seven'.
        jtab-result = 'Seventy'.
      when 'Eight'.
        jtab-result = 'Eighty'.
      when 'Nine '.
        jtab-result = 'Ninety'.
      when space.
        jtab-result = space.
    endcase.
  else.
    jtab-result = itab-result.
  endif.
  append jtab.
endform.                    "TIES
*&      Form  TEENS
      text
form teens.
  jtab-index = itab-index.
  case res.
    when 'One  '.
      jtab-result = 'Eleven'.
    when 'Two  '.
      jtab-result = 'Twelve'.
    when 'Three'.
      jtab-result = 'Thirteen'.
    when 'Four '.
      jtab-result = 'Fourteen'.
    when 'Five '.
      jtab-result = 'Fifteen'.
    when 'Six  '.
      jtab-result = 'Sixteen'.
    when 'Seven'.
      jtab-result = 'Seventeen'.
    when 'Eight'.
      jtab-result = 'Eighteen'.
    when 'Nine '.
      jtab-result = 'Nineteen'.
    when space.
      jtab-result = 'Ten'.
  endcase.
  append jtab.
endform.                    "TEENS
*&      Form  CALCU
      text
form calcu .
  itab-index = sy-index.
  case cnam2.
    when '1'.
      itab-result = 'One'.
    when '2'.
      itab-result = 'Two'.
    when '3'.
      itab-result = 'Three'.
    when '4'.
      itab-result = 'Four'.
    when '5'.
      itab-result = 'Five'.
    when '6'.
      itab-result = 'Six'.
    when '7'.
      itab-result = 'Seven'.
    when '8'.
      itab-result = 'Eight'.
    when '9'.
      itab-result = 'Nine'.
    when '0'.
      itab-result = space.
  endcase.
  append itab.
endform.                    "CALCU
*&      Form  POINTS
      text
form points.
  if sy-index = 2.
    if fpoint = space.
      case jpoint.
        when '1'.
          lpoint1 = 'One'.
        when '2'.
          lpoint1 = 'Two'.
        when '3'.
          lpoint1 = 'Three'.
        when '4'.
          lpoint1 = 'Four'.
        when '5'.
          lpoint1 = 'Five'.
        when '6'.
          lpoint1 = 'Six'.
        when '7'.
          lpoint1 = 'Seven'.
        when '8'.
          lpoint1 = 'Eight'.
        when '9'.
          lpoint1 = 'Nine'.
        when '0'.
          lpoint1 = space.
      endcase.
    endif.
  endif.
  if sy-index = 1.
    case jpoint.
      when '1'.
        perform lpointy.
      when '2'.
        lpoint2 = 'Twenty'.
      when '3'.
        lpoint2 = 'Thirty'.
      when '4'.
        lpoint2 = 'Forty'.
      when '5'.
        lpoint2 = 'Fifty'.
      when '6'.
        lpoint2 = 'Sixty'.
      when '7'.
        lpoint2 = 'Seventy'.
      when '8'.
        lpoint2 = 'Eighty'.
      when '9'.
        lpoint2 = 'Ninety'.
      when '0'.
        lpoint2 = space.
    endcase.
  endif.
endform.                    "POINTS
*&      Form  LPOINTY
      text
form lpointy.
  case kpoint.
    when '1'.
      lpoint2 = 'Eleven'.
    when '2'.
      lpoint2 = 'Twelve'.
    when '3'.
      lpoint2 = 'Thirteen'.
    when '4'.
      lpoint2 = 'Fourteen'.
    when '5'.
      lpoint2 = 'Fifteen'.
    when '6'.
      lpoint2 = 'Sixteen'.
    when '7'.
      lpoint2 = 'Seventeen'.
    when '8'.
      lpoint2 = 'Eighteen'.
    when '9'.
      lpoint2 = 'Nineteen'.
    when '0'.
      lpoint2 = 'Ten'.
  endcase.
  lpoint1 = space.
  fpoint = 'X'.
endform.                    "LPOINTY

Similar Messages

  • Converting the amount into words in different languages

    Hi All,
    Is there any FM to convert the amount into words in a specific language.
    SPELL_AMOUNT FM is not working for some of the languages like portuguese, etc..
    Any idea on this.
    Thanks in Advance.

    Hi,
    Use the FM:
    CALL FUNCTION <b>'Y_AMOUNT_IN_WORDS'</b>
    Hope it helps.
    Reward if helpful.
    Regards,
    Sipra

  • Convert total amount into words

    Hi
    My requirement is to convert total amount into words.
    For this i used function module SPELL_AMOUNT.
    But its giving wrong (i.e. problem is in the paise).
    I tried with other function module also, its not giving output.
    how i can get exactly correct output.
    Reward points if helpful.

    Hi
    execute this code .
    REPORT  ZCOVERTION.
    TABLES SPELL.
    DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
    DATA : PAMOUNT LIKE SPELL-NUMBER  VALUE '23.45'.
    SY-TITLE = 'SPELLING NUMBER'.
    PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
    WRITE: 'NUMBERS', T_SPELL-WORD ,'and', T_SPELL-DECWORD.
    FORM SPELL_AMOUNT USING PWRBTR PWAERS.
      CALL FUNCTION 'SPELL_AMOUNT'
           EXPORTING
                AMOUNT    = PAMOUNT
                CURRENCY  = PWAERS
                FILLER    = SPACE
                LANGUAGE  = 'E'
           IMPORTING
                IN_WORDS  = T_SPELL
           EXCEPTIONS
                NOT_FOUND = 1
                TOO_LARGE = 2
                OTHERS    = 3.
    ENDFORM.                               " SPELL_AMOUNT
    Hope this will solve ur problem
    Thanks
    Krushna
    oputput:

  • I just updated pages, I can't count the amount of words with space anymore. Can anybody help me?

    I just updated pages, I can't count the amount of words with space anymore. Can anybody help me?

    Yes me too, tried re setting and enabling changes but no agree button anywhere?

  • SAP Script(calling FM to spell the amount in words)

    Hi Friends,
        I am getting error in calling a function module(HR_IN_CHG_INR_WRDS : To spell the amount in words) to a script form.It is giving a dump message : "Conversion type error".
    Could you guide me with small example ?
    I will reward for usefull responses.
    Pls. treat it as urgent.
    Thx in Adv.
    Bobby

    Hi
    execute this code .
    REPORT ZCOVERTION.
    TABLES SPELL.
    DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
    DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '23.45'.
    SY-TITLE = 'SPELLING NUMBER'.
    PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
    WRITE: 'NUMBERS', T_SPELL-WORD ,'and', T_SPELL-DECWORD.
    FORM SPELL_AMOUNT USING PWRBTR PWAERS.
    CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
    AMOUNT = PAMOUNT
    CURRENCY = PWAERS
    FILLER = SPACE
    LANGUAGE = 'E'
    IMPORTING
    IN_WORDS = T_SPELL
    EXCEPTIONS
    NOT_FOUND = 1
    TOO_LARGE = 2
    OTHERS = 3.
    ENDFORM. " SPELL_AMOUNT
    Hope this will solve ur problem
    Thanks
    sreelakshmi

  • Convert to amount in words

    hi,
    i want a procedure that convert a amount (number) to amount in words

    From that link ->
    create or replace function spell_indian_money
        ( p_number in number )
        return varchar2
    as
        type myArray is table of varchar2(255);
        l_str    myArray := myArray( ' Thousand ',
                                     ' Lakh ',
                                     ' Crore ',
                                     ' Arab ',
                                     ' Kharab ',
                                     ' Shankh ' );
        l_num varchar2(50) default trunc( p_number );
        l_return varchar2(4000);
    begin
        if ( 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' );
        end if;
        l_num := substr( l_num, 1, length(l_num)-3 );
        for i in 1 .. l_str.count
        loop
            exit when l_num is null;
            if ( substr(l_num, length(l_num)-1, 2) <> 0 )
            then
                l_return := to_char(
                                to_date(
                                 substr(l_num, length(l_num)-1, 2),
                                   'J' ),
                            'Jsp' ) || l_str(i) || l_return;
            end if;
            l_num := substr( l_num, 1, length(l_num)-2 );
        end loop;
        if to_char( p_number ) like '%.%'
        then
            l_num := substr( round( p_number, 2), instr( p_number, '.' )+1 );
            if l_num > 0
            then
                l_return := l_return || ' And '
                || to_char(
                       to_date(
                        l_num,
                         'J' ),
                   'Jsp' )
                || ' Paise';
            end if;
        end if;
        return l_return;
    end spell_indian_money;
    create or replace
    function spell_number_french( p_number in number )
    return varchar2
    as
    begin
        return replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace( replace( replace( replace( replace(
               replace(
               lower( spell_number( p_number ))
               , 'duodecillion', 'bidecillion'     )
               , 'quintillion' , 'cintillion'      )
               , 'billion'     , 'milliard'        )
               , 'thousand'    , 'mille'           )
               , 'hundred'     , 'cent'            )
               , 'ninety'      , 'quatre-vingt-dix')
               , 'eighty'      , 'quatre-vingt'    )
               , 'seventy'     , 'soixante-dix'    )
               , 'sixty'       , 'soixante'        )
               , 'fifty'       , 'cinquante'       )
               , 'forty'       , 'quarante'        )
               , 'thirty'      , 'trente'          )
               , 'twenty'      , 'vingt'           )
               , 'nineteen'    , 'dix-neuf'        )
               , 'eighteen'    , 'dix-huit'        )
               , 'seventeen'   , 'dix-sept'        )
               , 'sixteen'     , 'seize'           )
               , 'fifteen'     , 'quinze'          )
               , 'fourteen'    , 'quatorze'        )
               , 'thirteen'    , 'treize'          )
               , 'twelve'      , 'douze'           )
               , 'eleven'      , 'onze'            )
               , 'ten'         , 'dix'             )
               , 'nine'        , 'neuf'            )
               , 'eight'       , 'huit'            )
               , 'seven'       , 'sept'            )
               , 'five'        , 'cinq'            )
               , 'four'        , 'quatre'          )
               , 'three'       , 'trois'           )
               , 'two'         , 'deux'            )
               , 'one'         , 'un'              )
               , 'dix-six'     , 'seize'           )
               , 'dix-cinq'    , 'quinze'          )
               , 'dix-quatre'  , 'quatorze'        )
               , 'dix-trois'   , 'treize'          )
               , 'dix-deux'    , 'douze'           )
               , 'dix-un'      , 'onze'            )
               , '-un '        , '-une '           )
               , 'un cent'     , 'cent'            )
               , 'un mille'    , 'mille'           )
               , 'une'         , 'un' );
    end spell_number_french;
    please help me, it's urgentBad words..... :(
    Hope you didn't go with this word next time here.
    Regards.
    Satyaki De.

  • Converting USD amount into word

    Hi,
      I want to convert amount which is in USD into word  i am using below FM
    CALL FUNCTION 'SPELL_AMOUNT'
        EXPORTING
          amount          = dmbtr
          currency        = waers
        FILLER          = ' '
          language        = langu
        IMPORTING
          in_words        = spell
        EXCEPTIONS
          not_found       = 1
          too_large       = 2
          OTHERS          = 3.
      IF sy-subrc = 0.
    now my DMBTR  amount is 21960.00    which is atually 219.60 USD  but in dmbtr initially amount is coming as 21960.00  and when i convert it to word  it is coming as  USD : TWO HUNDRED NINETEEN,  AND CENTS AS SIX THOUSAND,  but acutally it should be  USD DOLLAR TWO HUNDRED NINETEEN AND CENTS SIXTY ONLY,    it is not coming peoprly  so is there any other functionn module for this to convert USD , JPY into word.
      regards,
       zafar

    Hi,
    Assign dmbtr to type PAYR_FI-RWBTR.
    PARAMETERS:   dmbtr type PAYR_FI-RWBTR.
                             OR
    If you didnt get from this try by using type P
    PARAMETERS:   dmbtr type P.
    Regards,
    kalandar
    Edited by: kalandar on Jun 16, 2010 9:48 AM

  • How do I convert the PDF to Word doc?  It is not working for me

    Just downloaded the conversation and I am not successful - need to convert PDF to WOrd doc -  step-by-step instructions please

    You need the ExportPDF forum. There, you'll find people who actually use the service (I have Acrobat and have never needed ExportPDF)

  • Adress bar search uses a different engine depending on the amount of words entered

    I've been trying to figure this one out for a bit... If I enter one word into the adress bar - gamespot for instance - it takes me to a bing.com search. As opposed to the gamespot.com site as it has always done up until a few hours ago. Now, at first I figured this was just a matter of firefox changing the default, so looked for a solution to this. The given solution in most cases is to change to change keyword.url - which I have done. It is set to the google url that according to most of the sites I checked is supposed to work. However, typing 'gamespot' still gives me a bing search (not a google search or the site in question).
    But here's the kicker; if I type 'game spot' it takes me to the gamespot.com website. So I tried something else. 'facebook' vs. 'face book' - same thing. 'fastcars' - bing search, 'fast cars' - google search. 'firefox' - bing.com search, 'fire fox' - mozilla homepage... I take it you see what I mean by now...
    I have no idea what is going on here. Seems a bit of an odd effect for any kind of malware - allthough I'm running a full scan as I type, just in case...
    == This happened ==
    Every time Firefox opened
    == no idea what triggered it. Just happened all of a sudden this evening. After using the comp all day without it acting like this - and no new installs that I know of.

    Hi,
    >>A CHAR datatype and VARCHAR2 datatype are stored identically (eg: the word 'WORD' stored in a CHAR(4) and a varchar2(4) consume exactly the same amount of space on disk, both have leading byte counts).
    Ok, but on the other hands:
    SGMS@ORACLE10> create table x (name char(10), name2 varchar2(10));
    Table created.
    SGMS@ORACLE10> insert into  x values ('hello','hello');
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select vsize(name),vsize(name2) from x;
    VSIZE(NAME) VSIZE(NAME2)
             10            5
    SGMS@ORACLE10> select dump(name),dump(name2) from x;
    DUMP(NAME)                                         DUMP(NAME2)
    Typ=96 Len=10: 104,101,108,108,111,32,32,32,32,32  Typ=1 Len=5: 104,101,108,108,111Cheers

  • Function to call to convert amount in words in R12

    Hi Experts,
    I am creating a custom report that will display invoice details. Included in the fields are AMOUNT and AMOUNT_IN_WORDS. I don't have problem for the AMOUNT field since i can retrieve it directly from the table. My concern is on the AMOUNT_IN_WORDS. Is there any function in EBS R12 which i can call directly in the SQL statement of my report to convert the AMOUNT into Words.
    Thanks,
    Nestor

    Hi mpautom,
    What i'm looking for is a built-in function within EBS R12. Because the client doesn't allow creation of function.
    Nestor

  • AMOUNT IN WORDS IN SMARTFORMS

    HI All,
    I need to convert the amount into words in my smartforms.
    How is this achieved?
    Thanks & Regards,
    Murthy

    Hi kan murthy ,
    let say in sf the amount is sf_amt...
    *Declare varibles in SF like this in global
    data: v_word type spell, "structure
            v_amt type string.
    *Calling Function SPELL_AMOUNT in Program Lines
    and Import parameters are V_AMT and Export Parameters are
    *V_WORD
    call function 'SPELL_AMOUNT'
    exporting
    amount = v_amt
    currency = 'INR'
    language = sy-langu
    importing
    in_words = v_word
    exceptions
    not_found = 1
    too_large = 2
    others = 3.
    Use V_WORD Where need to print
    Regards,
    sg

  • Spelling the amount

    Hi ,
    Can any body tell me which can convert the amount into words.  It should also convert the paise also into text.
    Thanks,
    BSV

    Hi,
    Try this sample code,
    TABLES SPELL.
    DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
    DATA : PAMOUNT(10) TYPE C  VALUE '1000'.
    SY-TITLE = 'SPELLING NUMBER'.
    PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
    WRITE: 'NUMBERS', T_SPELL-WORD." 'DECIMALS ', T_SPELL-DECWORD.
    FORM SPELL_AMOUNT USING PWRBTR PWAERS.
      CALL FUNCTION 'SPELL_AMOUNT'
           EXPORTING
                AMOUNT    = PAMOUNT
                CURRENCY  = PWAERS
                FILLER    = SPACE
                LANGUAGE  = 'E'
           IMPORTING
                IN_WORDS  = T_SPELL
           EXCEPTIONS
                NOT_FOUND = 1
                TOO_LARGE = 2
                OTHERS    = 3.
    ENDFORM.
    Thanks,
    Reward If Helpful.

  • Amount in Words (Indian Rupees)

    Dear All,
    I am using SAP 2007B PL 18.I have found out the below mentioned function for converting the amount to words in SDN only. But when i try and create the function it gives error "Incorrect Syntax near 00' . I think there is an incomplete syntax near the SubString function. Can someone please help me on the same and give the correct function.
    Create function [dbo].[AmountToWords] ( @InNumber Numeric(18,2) )
    --Returns the number as words.
    returns VARCHAR(2000)
    as
    BEGIN
    SET NoCount ON
    Declare @Num Varchar(20)
    Declare @Dec Varchar(3)
    Declare @Return Varchar(2000)
    Set @Dec = SubString(Convert(Varchar(20),@Innumber),Len(Convert(Varchar(20),@Innumber))-2,3)
    Set @Num = SubString(Convert(Varchar(20),@Innumber),1, Len(Convert(Varchar(20),@Innumber))-3)
    Declare @Hundred Char(8) Declare @HundredAnd Char(12) Declare @Thousand Char(9)
    Declare @Lakh Char(5)
    Declare @Lakhs Char(6)
    Declare @Crore Char(6)
    Declare @Crores Char(7)
    Set @Hundred = 'Hundred '
    Set @Thousand = 'Thousand '
    Set @Lakh = 'Lakh '
    Set @Lakhs = 'Lakhs '
    Set @Crore = 'Crore '
    Set @Crores = 'Crores '
    Set @HundredAnd = 'Hundred and '
    if Len(@Num) = 1
    -- One
    Begin
    Set @Return = dbo.GetTextValue(@Num)
    End
    Else if Len(@Num) = 2
    -- Ten
    Begin
    Set @Return = dbo.GetTextValue(@Num)
    End
    Else if Len(@Num) = 3
    -- Hundred
    Begin
    Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Hundred
    IF SubString(@num,2,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2))
    End
    Else if Len(@Num) = 4
    -- thousand
    Begin
    Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Thousand
    If SubString(@Num,2,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,1)) + @Hundred
    IF SubString(@num,3,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2))
    End
    Else if Len(@Num) = 5
    -- Ten Thousand
    Begin
    Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Thousand
    If SubString(@Num,3,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,1)) + @Hundred
    IF SubString(@num,4,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2))
    End
    Else if Len(@Num) = 6
    -- Lakh
    Begin
    If SubString(@Num,1,1) = '1'
    Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Lakh
    Else
    Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Lakhs
    If SubString(@Num,2,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2)) + @Thousand
    If SubString(@Num,4,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,1)) + @Hundred
    IF SubString(@num,5,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2))
    End
    Else if Len(@Num) = 7
    -- Ten Lakhs
    Begin
    Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Lakhs
    If SubString(@Num,3,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2)) + @Thousand
    If SubString(@Num,6,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,1)) + @Hundred
    IF SubString(@num,6,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2))
    End
    Else if Len(@Num) = 8
    -- Crore
    Begin
    Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Crore
    If SubString(@Num,2,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2)) + @Lakhs
    If SubString(@Num,4,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2)) + @Thousand
    If SubString(@Num,6,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,1)) + @Hundred
    IF SubString(@num,7,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2))
    End
    Else if Len(@Num) = 9
    -- Ten Crore
    Begin
    Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Crores
    If SubString(@Num,3,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2)) + @Lakhs
    If SubString(@Num,5,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2)) + @Thousand
    If SubString(@Num,7,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,1)) + @Hundred
    IF SubString(@num,8,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2))
    End
    Else if Len(@Num) = 10
    -- Hundred Crore
    Begin
    Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Hundred
    IF Substring(@Num,2,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2))
    Set @Return = @Return + @Crores
    If SubString(@Num,4,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2)) + @Lakhs
    If SubString(@Num,6,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2)) + @Thousand
    If SubString(@Num,8,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,1)) + @Hundred
    IF SubString(@num,9,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,2))
    End
    Else if Len(@Num) = 11
    -- Thousand Crore
    Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Thousand
    IF SubString(@Num,2,1) '0'
    Set @Return = @Return + dbo.GetTextValue(Substring(@Num,2,1)) + @Hundred
    IF Substring(@Num,3,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2))
    Set @Return = @Return + @Crores If SubString(@Num,5,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2)) + @Lakhs
    If SubString(@Num,7,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2)) + @Thousand
    If SubString(@Num,9,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,1)) + @Hundred
    IF SubString(@num,10,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,2))
    End
    Else if Len(@Num) = 12
    -- Ten thousand Crore
    Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,2)) + @Thousand
    IF SubString(@Num,3,1) '0'
    Set @Return = @Return + dbo.GetTextValue(Substring(@Num,3,1)) + @Hundred
    IF Substring(@Num,4,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2))
    Set @Return = @Return + @Crores If SubString(@Num,6,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2)) + @Lakhs
    If SubString(@Num,8,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2)) + @Thousand
    If SubString(@Num,10,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,1)) + @Hundred
    IF SubString(@num,11,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,11,2))
    End
    Else if Len(@Num) = 13
    -- Lakh Crore
    Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Lakh
    If Substring(@Num,2,2) '00'
    Set @Return = @Return + dbo.GetTextValue(Substring(@Num,2,2)) + @Thousand
    IF SubString(@Num,4,1) '0'
    Set @Return = @Return + dbo.GetTextValue(Substring(@Num,4,1)) + @Hundred
    IF Substring(@Num,5,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2))
    Set @Return = @Return + @Crores
    If SubString(@Num,7,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2)) + @Lakhs
    If SubString(@Num,9,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,2)) + @Thousand
    If SubString(@Num,11,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,11,1)) + @Hundred
    IF SubString(@num,12,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,12,2))
    End
    Else if Len(@Num) = 14
    -- Ten Lakh Crore
    Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,2)) + @Lakhs
    If Substring(@Num,3,2) '00'
    Set @Return = @Return + dbo.GetTextValue(Substring(@Num,3,2)) + @Thousand
    IF SubString(@Num,5,1) '0'
    Set @Return = @Return + dbo.GetTextValue(Substring(@Num,5,1)) + @Hundred
    IF Substring(@Num,6,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2))
    Set @Return = @Return + @Crores If SubString(@Num,8,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2)) + @Lakhs
    If SubString(@Num,10,2) '00'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,2)) + @Thousand
    If SubString(@Num,12,1) '0'
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,12,1)) + @Hundred
    IF SubString(@num,13,2) '00'
    Set @Return = @Return + 'And '
    Set @Return = @Return + dbo.GetTextValue(SubString(@Num,13,2))
    End
    If @Dec '.00'
    Set @Return = @Return + 'Rupees And ' + dbo.GetTextValue(SubString(@Dec,2,2)) + 'Paise Only'
    ELSE
    Set @Return =@Return+'Zero Rupees Only'
    Return @return
    End
    CREATE Function [dbo].[GetTextValue] ( @dblNumber Numeric )
    Returns Varchar(1000)
    As
    Begin
    Declare @StrWord Varchar(400)
    SET @strWord = Case @dblNumber
    When 1 Then 'One '
    When 2 Then 'Two '
    When 3 Then 'Three '
    When 4 Then 'Four '
    When 5 Then 'Five '
    When 6 Then 'Six '
    When 7 Then 'Seven '
    When 8 Then 'Eight '
    When 9 Then 'Nine '
    When 10 Then 'Ten '
    When 11 Then 'Eleven '
    When 12 Then 'Twelve '
    When 13 Then 'Thirteen '
    When 14 Then 'Fourteen '
    When 15 Then 'Fifteen '
    When 16 Then 'Sixteen '
    When 17 Then 'Seventeen '
    When 18 Then 'Eighteen '
    When 19 Then 'Nineteen '
    When 20 Then 'Twenty '
    When 21 Then 'Twenty One '
    When 22 Then 'Twenty Two '
    When 23 Then 'Twenty Three '
    When 24 Then 'Twenty Four '
    When 25 Then 'Twenty Five '
    When 26 Then 'Twenty Six '
    When 27 Then 'Twenty Seven '
    When 28 Then 'Twenty Eight '
    When 29 Then 'Twenty Nine '
    When 30 Then 'Thirty '
    When 31 Then 'Thirty One '
    When 32 Then 'Thirty Two '
    When 33 Then 'Thirty Three '
    When 34 Then 'Thirty Four '
    When 35 Then 'Thirty Five '
    When 36 Then 'Thirty Six '
    When 37 Then 'Thirty Seven '
    When 38 Then 'Thirty Eight '
    When 39 Then 'Thirty Nine '
    When 40 Then 'Fourty '
    When 41 Then 'Fourty One '
    When 42 Then 'Fourty Two '
    When 43 Then 'Fourty Three '
    When 44 Then 'Fourty Four '
    When 45 Then 'Fourty Five '
    When 46 Then 'Fourty Six '
    When 47 Then 'Fourty Seven '
    When 48 Then 'Fourty Eight '
    When 49 Then 'Fourty Nine '
    When 50 Then 'Fifty '
    When 51 Then 'Fifty One '
    When 52 Then 'Fifty Two '
    When 53 Then 'Fifty Three '
    When 54 Then 'Fifty Four '
    When 55 Then 'Fifty Five '
    When 56 Then 'Fifty Six '
    When 57 Then 'Fifty Seven '
    When 58 Then 'Fifty Eight '
    When 59 Then 'Fifty Nine '
    When 60 Then 'Sixty '
    When 61 Then 'Sixty One '
    When 62 Then 'Sixty Two '
    When 63 Then 'Sixty Three '
    When 64 Then 'Sixty Four '
    When 65 Then 'Sixty Five '
    When 66 Then 'Sixty Six '
    When 67 Then 'Sixty Seven '
    When 68 Then 'Sixty Eight '
    When 69 Then 'Sixty Nine '
    When 70 Then 'Seventy '
    When 71 Then 'Seventy One '
    When 72 Then 'Seventy Two '
    When 73 Then 'Seventy Three '
    When 74 Then 'Seventy Four '
    When 75 Then 'Seventy Five '
    When 76 Then 'Seventy Six '
    When 77 Then 'Seventy Seven '
    When 78 Then 'Seventy Eight '
    When 79 Then 'Seventy Nine '
    When 80 Then 'Eighty '
    When 81 Then 'Eighty One '
    When 82 Then 'Eighty Two '
    When 83 Then 'Eighty Three '
    When 84 Then 'Eighty Four '
    When 85 Then 'Eighty Five '
    When 86 Then 'Eighty Six '
    When 87 Then 'Eighty Seven '
    When 88 Then 'Eighty Eight '
    When 89 Then 'Eighty Nine '
    When 90 Then 'Ninety '
    When 91 Then 'Ninety One '
    When 92 Then 'Ninety Two '
    When 93 Then 'Ninety Three '
    When 94 Then 'Ninety Four '
    When 95 Then 'Ninety Five '
    When 96 Then 'Ninety Six '
    When 97 Then 'Ninety Seven '
    When 98 Then 'Ninety Eight '
    When 99 Then 'Ninety Nine '
    When 100 Then 'One hundred '
    else ' '
    End
    Return @strWord
    End
    Regards,
    Rahul

    Dear Rahul,
    Try this,
    ->> Create 1 UDF in Header on Requrie Documents (ex. Marketing Documents).
    ->> Create 3 Function in MSSQL Server Management.
    ->> Create 1 FMS in Query Generator and save as Query Manager then Assign to UDF for Amount in Words.
    for example:
    Create UDF in Header on Marketing Documents.
    ->> Choose Tools on Top menu.
    ->> User - Defined Fields. -> User Manage Fields.
    ->> Open the User Manage Fields Widnow.
    ->> Marketing Documents. -> Title.
    ->> Select Title and Click Add button in Bottom on User Manage Fields Window.
    ->> Create Amount in Words UDF(Code, Discription and Type - Character) and Add the UDF.
    Create Function in MSSQL Server Management.
    Check this Link, (have 3 Functions in Link).
    http://techcreeze.blogspot.com/2008/11/convert-amount-into-words-according-to_15.html
    1st Funciton - to Convert one Digit Number to words
    2nd Funciton - to convert 2 digit number to words.
    3rd Funciton - to convert amt in numbers to words.
    ->> Open the MSSQL Server Management Window.
    ->> Choose your Company database and Create NEW Query.
    ->> Create 3 Function Queries one by one.
    ->> Create 3 NEW Query Tab and 1st one put the 1st Function then Run the Function. and
    2nd New Query tab put the 2nd Function then Run the Function.
    3rd New Query tab put the 3rd Function then Run the Function.
    Create FMS in Query Generator and Save as Query Manager.
    ->> Adminstration.
    ->> Reports. -> Query Generator.
    ->> Open the Query Generator and put the below FMS query.
    for example : Purchase Order Doc. Toal(in wrods).
    declare @Doc_total numeric (19,6)
    set @Doc_total=$[OPOR.DocTotal]
    select  dbo.fNumToWords (@Doc_total)
    ->> Assign the FMS in UDF on Purchase Order.
    ->> Auto Refresh of Document Total.
    Ex.
    1. Goto the UDF and Clcik ShiftAltF2.
    2. Select the SEARCH BY SAVED QUERY.
    3. Assign the FMS Query.
    4. Select the AUTO REFRESH WHEN FIELD CHENGES.
    5. Select Document Total.
    6. Check the Display Saved Values.

  • How to display amount in words in the last page

    Hi,
    I am very new to Oracle Report, but v.good experience in Crystal report.
    How can i display amount in words for an invoice amount total in the last page of the invoice and after total amount. I created a new non repeating frame and put the amount in words inside that, and set the frames diplay property Print on Last Page, but the problem is already there is a repeating frame to print all the invoices item, and the total in figure. But the amount in words frame is not always coming after the total amount,either it should be at the bottom of the last page in fixed position, otherwise it should move just below the total amount.
    I am using Oracle 11g.
    Thanks in advance...
    Fsl

    Hi ,
    Use This function
    create or replace FUNCTION xxg4_zen_conv_words (p_amount IN Number) RETURN Varchar2 IS
    --Creation Date   :  11-DEC-2009
    --Purpose         :  This Function returns amount in words.
    --Parameters      :
    --1) p_amount : Only positive and negative values are allowed.
    Precision can be entered upto 10 digits and only 2 scales
    are allowed e.g 9999999999.99
    -- Index by Tables to store word list
    TYPE typ_word_list IS TABLE OF Varchar2(200) INDEX BY BINARY_INTEGER;
    t_typ_word_list typ_word_list;
    TYPE typ_word_gap IS TABLE OF Varchar2(200) INDEX BY BINARY_INTEGER;
    t_typ_word_gap typ_word_gap;
    -- Local Variables
    v_amount Number := p_amount;
    v_amount_length Number;
    v_words Varchar2(10000);
    v_point_found Varchar2(1) := 'N';
    v_point_value Number;
    BEGIN
    /*Getting value after point if found */
    v_point_value := SUBSTR(v_amount,(INSTR(v_amount,'.',1) + 1),2);
    /*Checking whether amount has any scale value also */
    v_point_found := CASE WHEN (INSTR(v_amount,'.',1)) = 0 THEN 'N'
    WHEN (INSTR(v_amount,'.',1)) > 0 THEN 'Y'
    END;
    /*Converting amount into pure numeric format */
    v_amount := FLOOR(ABS(v_amount));
    v_amount_length := LENGTH(v_amount);
    t_typ_word_gap(2) := 'and Paise';
    t_typ_word_gap(3) := 'Hundred';
    t_typ_word_gap(4) := 'Thousand';
    t_typ_word_gap(6) := 'Lakh';
    t_typ_word_gap(8) := 'Crore';
    t_typ_word_gap(10) := 'Arab';
    FOR i IN 1..99
    LOOP
    t_typ_word_list(i) := To_Char(To_Date(i,'J'),'Jsp');
    END LOOP;
    IF v_amount_length <= 2
    THEN
    /* Conversion 1 to 99 digits */
    v_words := t_typ_word_list(v_amount);
    ELSIF v_amount_length = 3
    THEN
    /* Conversion for 3 digits till 999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(3);
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2));
    ELSIF v_amount_length = 4
    THEN
    /* Conversion for 4 digits till 9999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(4);
    IF SUBSTR(v_amount,2,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,3,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,2));
    END IF;
    ELSIF v_amount_length = 5
    THEN
    /* Conversion for 5 digits till 99999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,2))||' '||t_typ_word_gap(4);
    IF SUBSTR(v_amount,3,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,4,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,2));
    END IF;
    ELSIF v_amount_length = 6
    THEN
    /* Conversion for 6 digits till 999999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(6);
    IF SUBSTR(v_amount,2,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2))||' '||t_typ_word_gap(4);
    END IF;
    IF SUBSTR(v_amount,4,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,5,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,5,2));
    END IF;
    ELSIF v_amount_length = 7
    THEN
    /* Conversion for 7 digits till 9999999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,2))||' '||t_typ_word_gap(6);
    IF SUBSTR(v_amount,3,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,2))||' '||t_typ_word_gap(4);
    END IF;
    IF SUBSTR(v_amount,5,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,5,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,6,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,6,2));
    END IF;
    ELSIF v_amount_length = 8
    THEN
    /* Conversion for 8 digits till 99999999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(8);
    IF SUBSTR(v_amount,2,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2))||' '||t_typ_word_gap(6);
    END IF;
    IF SUBSTR(v_amount,4,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,2))||' '||t_typ_word_gap(4);
    END IF;
    IF SUBSTR(v_amount,6,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,6,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,7,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,7,2));
    END IF;
    ELSIF v_amount_length = 9
    THEN
    /* Conversion for 9 digits till 999999999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,2))||' '||t_typ_word_gap(8);
    IF SUBSTR(v_amount,3,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,2))||' '||t_typ_word_gap(6);
    END IF;
    IF SUBSTR(v_amount,5,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,5,2))||' '||t_typ_word_gap(4);
    END IF;
    IF SUBSTR(v_amount,7,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,7,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,8,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,8,2));
    END IF;
    ELSIF v_amount_length = 10
    THEN
    /* Conversion for 10 digits till 9999999999 */
    v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(10);
    IF SUBSTR(v_amount,2,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2))||' '||t_typ_word_gap(8);
    END IF;
    IF SUBSTR(v_amount,4,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,2))||' '||t_typ_word_gap(6);
    END IF;
    IF SUBSTR(v_amount,6,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,6,2))||' '||t_typ_word_gap(4);
    END IF;
    IF SUBSTR(v_amount,8,1) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,8,1))||' '||t_typ_word_gap(3);
    END IF;
    IF SUBSTR(v_amount,9,2) != 0
    THEN
    v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,9,2));
    END IF;
    END IF;
    IF v_point_found = 'Y'
    THEN
    IF v_point_value != 0
    THEN
    v_words := v_words||' '||t_typ_word_gap(2)||' '||t_typ_word_list(CASE WHEN LENGTH(SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)) = 1 THEN SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)||'0'
    WHEN LENGTH(SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)) = 2 THEN SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)
    END);
    END IF;
    END IF;
    IF p_amount < 0
    THEN
    v_words := 'Minus '||v_words;
    ELSIF p_amount = 0
    THEN
    v_words := 'Zero';
    END IF;
    IF LENGTH(v_amount) > 10
    THEN
    v_words := 'Value larger than specified precision allowed to convert into words. Maximum 10 digits allowed for precision.';
    END IF;
    RETURN (v_words);
    END xxg4_Zen_Conv_Words;
    --Thanks
    SAGAR SANKPAL

  • Function Module to convert  amount to  amount in words

    Dear Guru ,
    I want to know is there any sap standard Function Module to convert  amount value   to  amount in words
    Thanks & Regards

    Hi..
    Use FM SPELL_AMOUNT.
    This function module converts an amount or number into words. It can be used as follows:
    Convert a number into words
    To do this, the transfer parameters LANGUAGE and AMOUNT have to be entered.
    Convert an amount into words
    To do this, the fields LANGUAGE, CURRENCY, and AMOUNT have to be entered.
    Program RF_SPELL contains a sample call of the function module. You can use it for test purposes.
    REPORT ZSPELL.
    TABLES SPELL.
    DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
    DATA : PAMOUNT LIKE SPELL-NUMBER  VALUE '1234510'.
    SY-TITLE = 'SPELLING NUMBER'.
    PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
    WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.
    FORM SPELL_AMOUNT USING PWRBTR PWAERS.
      CALL FUNCTION 'SPELL_AMOUNT'
           EXPORTING
                AMOUNT    = PAMOUNT
                CURRENCY  = PWAERS
                FILLER    = SPACE
                LANGUAGE  = 'E'
           IMPORTING
                IN_WORDS  = T_SPELL
           EXCEPTIONS
                NOT_FOUND = 1
                TOO_LARGE = 2
                OTHERS    = 3.
    ENDFORM.                               " SPELL_AMOUNT
    I hope it helps.
    Reward pts if helpful
    Regards
    - Rishika Bawa

Maybe you are looking for

  • Optical Drive Accesses for No Apparent Reason

    I have a new HP Pavilion dv7 laptop with Windows 7 64-bit OS. My question concerns accesses to the optical drive for no apparent reason. While it seems reasonable that when booting up the system the firmware will check the optical drive to see if the

  • How to display an image??

    Hello to all, I'm not a newbie on Forms development, but... I don't remember how to do the following! : - I have a form (.fmb and .fmx in d:\app\) with only one datablock and 2 text items and two buttons inside that datablock. I want to display an im

  • To display bill of lading info in FBL3N

    Dear Experts, Could any one please share experience with me that if it is possible to display bill of lading info in FBL3N? if so how what configuration needs to be done? Thanks a lot. Regards Simon

  • HP Imaging Device Functions causing errors on LAN

    I have 4 computers on my LAN.   For months now, I have been seeing errors on the Ethernet interfaces of 2 computers  (netstat -e). The errors occured at regular intervals and seemed to be asscociated with the HP Printer SW associated with the Photosm

  • Process in FIBF for account statement...

    In FIBF ,click on settings-process module of sap application..we could see many process .I need one process which could be used for account statement.That is customer or vendor account statement. Thanks and Regards