on 04-25-2014 8:45 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try with CONVERT_TO_LOCAL_CURRENCY
G. Lakshmipathi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.