cancel
Showing results for 
Search instead for 
Did you mean: 

FM for Display Foreign Currency Decimal Values in Words

Former Member
0 Kudos

Dear All,

Is it possible to display the foreign currency's decimal values in words. Like Paisa for INR, Cents for USD and Pence for Pounds. Is there any FM available for the same. I checked in threads but not getting relevant FM or solution for this.

Kindly help.

Regards:

Abhishek

Accepted Solutions (0)

Answers (2)

Answers (2)

bsivasankarreddy_reddy
Active Contributor
0 Kudos

hi

try this below logic and do the Z Function module

FUNCTION zmm_amount_words.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(CURRENCY) TYPE  WAERS

*"     REFERENCE(AMOUNT) LIKE  PC207-BETRG

*"  EXPORTING

*"     VALUE(IN_WORDS) TYPE  IN_WORDS

*"----------------------------------------------------------------------

   DATA wrk_decimal(20).

   DATA BEGIN OF it_decword OCCURS 1.

   DATA word(100) TYPE c.

   DATA END OF it_decword.

   DATA : w_inword TYPE spell.

   IF currency  = 'INR'.

     CALL FUNCTION 'Z_SPELL_AMOUNT_INDIA'

       EXPORTING

         amt_in_num   = amount

       IMPORTING

         amt_in_words = spell.

     IF sy-subrc <> 0.

     ENDIF.

*ENDIF.

*------------------------------------------------------------*

     SELECT SINGLE * FROM tcurc

                     WHERE waers = currency .

     CHECK sy-subrc EQ 0.

     SELECT SINGLE * FROM tcurt

                     WHERE waers = currency

                     AND   spras = 'E' .

     CHECK sy-subrc EQ 0.

     SET LOCALE LANGUAGE sy-langu.

     SET LOCALE LANGUAGE space.

     TRANSLATE tcurt-ktext TO UPPER CASE.

     CASE tcurc-waers.

       WHEN 'USD' OR 'EUR'.

         wrk_decimal = 'CENTS'.

       WHEN 'INR'.

         wrk_decimal = 'PAISE'.

       WHEN 'JPY'.

         wrk_decimal = 'YEN'.

       WHEN OTHERS.

         wrk_decimal = ' '.

     ENDCASE.

*

     REPLACE 'Rupees' IN spell WITH tcurt-ktext.

     REPLACE 'PAISE' IN spell WITH wrk_decimal.

     IF tcurc-waers = 'INR'.

       TRANSLATE spell TO  UPPER CASE.

       REPLACE 'RUPEE' IN spell WITH 'RUPEES'.

     ENDIF.

     in_words = spell.

     CLEAR spell.

   ELSE.

     CALL FUNCTION 'SPELL_AMOUNT'

       EXPORTING

         amount    = amount

         currency  = currency

*       FILLER    = ' '

*       LANGUAGE  = SY-LANGU

       IMPORTING

         in_words  = w_inword

       EXCEPTIONS

         not_found = 1

         too_large = 2

         OTHERS    = 3.

     IF sy-subrc <> 0.

* Implement suitable error handling here

     ENDIF.

     SELECT SINGLE * FROM tcurc

                 WHERE waers = currency .

     CHECK sy-subrc EQ 0.

     SELECT SINGLE * FROM tcurt

                     WHERE waers = currency

                     AND   spras = 'E' .

     CHECK sy-subrc EQ 0.

     SET LOCALE LANGUAGE sy-langu.

     SET LOCALE LANGUAGE space.

     TRANSLATE tcurt-ktext TO UPPER CASE.

     CASE tcurc-waers.

       WHEN 'USD' OR 'EUR'.

         wrk_decimal = 'CENTS'.

       WHEN 'INR'.

         wrk_decimal = 'PAISE'.

       WHEN 'JPY'.

         wrk_decimal = 'YEN'.

       WHEN OTHERS.

         wrk_decimal = ' '.

     ENDCASE.

     IF w_inword-decword IS NOT INITIAL.

       CONCATENATE tcurt-ktext  w_inword-word 'AND' w_inword-decword

       wrk_decimal INTO in_words SEPARATED BY space.

     ELSE.

       CONCATENATE tcurt-ktext  w_inword-word

   INTO in_words SEPARATED BY space.

     ENDIF.

   ENDIF.

ENDFUNCTION.


then system convert like below


CURRENCY                        USD

AMOUNT                                        213.34

Export parameters               Value

IN_WORDS                        US DOLLAR TWO HUNDRED THIRTEEN AND THIRTY-FOUR CENTS

Lakshmipathi
Active Contributor
0 Kudos

Try with CONVERT_TO_LOCAL_CURRENCY

G. Lakshmipathi

Former Member
0 Kudos

Dear Laksmipathi sir,

Thanks for reply. I tried with this, but this FM is converting Foreign Currency Amount in Local currency. I want a FM for converting the decimal values of foreign currency in words.

e.g. 213.34

USD : Two Hundred and Thirteen and Thirty Four Cents

Regards:

Abhishek

Lakshmipathi
Active Contributor
0 Kudos

Not sure what exactly your technical team done to achieve this but in general, if a function module is converting foreign currency into local currency, it also will convert decimals.  Please revisit this Function Module.

G. Lakshmipathi

kyusufzai
Participant
0 Kudos

Hi,

  Please try function module  SPELL_AMOUNT.

  Try FM     HR_IN_CHG_INR_WRDS for Indian currency