Skip to Content
0
Former Member
Jan 18, 2013 at 02:19 AM

RE:HOW TO DISPLAY AMOUNT IN WORDS IN RUPEES ONLY IN SMARTFORMS

616 Views

hi abapers

/h

in smartforms i want to display amount in words in rupees only and rupees and paise only. for example if the amount is 51.50 it is displaying fifty one rupees and fifty paise only correctly. if the amount is 51.00 it is displaying fifty one rupees and. i want to remove the and. below is my code.

FORM convert_cmount_into_word.
** amount = wa_head-po_value.

DATA : inp_amt LIKE j_1itaxvar-j_1itaxam1,
out_amt LIKE j_1itaxvar-j_1itaxam1.
CLEAR : inp_amt. " = wa_head-po_value.
inp_amt = wa_head-zgtot.


amount = inp_amt.
CLEAR : wa_head-zgtot.
wa_head-zgtot = inp_amt.

IF ekko-waers = 'INR'.
* To convert amount into word for INR (Rupees) - FM name is HR_IN_CHG_INR_WRDS
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = amount
IMPORTING
amt_in_words = amt_in_word
EXCEPTIONS
data_type_mismatch = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
" code added by nag
REPLACE 'Rupees' WITH 'Rupees And ' INTO amt_in_word.
* CONCATENATE amt_in_word 'Rupees ONLY' INTO amt_in_word SEPARATED BY space.

REPLACE 'Paise' WITH 'Paise Only ' INTO amt_in_word.
* CONCATENATE amt_in_word 'Paise ONLY' INTO amt_in_word SEPARATED BY space.
" end
wa_head-amt_wrd = amt_in_word.

ELSE.
* To converT amount into word for Forigen currency - FM name is SPELL_AMOUNT
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = amount
currency = ekko-waers
* FILLER = ' '
language = sy-langu
IMPORTING
in_words = amtinword
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
amt_in_word = amtinword-word.

wa_head-amt_wrd = amt_in_word.
ENDIF.

ENDFORM. "convert_cmount_into_word

<Priority normalized by moderator>


/h

with warm regards

nagaraj

Message was edited by: Vinod Kumar