‎2008 Nov 27 12:54 PM
I am using Function module SPELL_AMOUNT to convert a number to word.
data:lv_no(5) TYPE i.
.
lv_no = 100.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = lv_no
CURRENCY = ' '
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = spell
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3
.
Example : If i Give Input as 100 then its giving O/P as 000000000000100000#ONE HUNDRED
But i need only ONE HUNDRED
Please Guide regarding this.
Regards,
Neelima.
‎2008 Nov 27 12:55 PM
Get amount in words
*data: lv_name type spell,
lv_currency type string.
*
*SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 10(22) text-001 FOR FIELD p_amt.
*PARAMETER: p_amt type i.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK blk1.
*
*START-OF-SELECTION.
*
*CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = p_amt
CURRENCY = 'INR'
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = lv_name
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.
*
*WRITE: / 'The amount in words is:',lv_name-word.
*LEAVE to LIST-PROCESSING.
‎2008 Nov 27 12:55 PM
‎2008 Nov 27 12:56 PM
Hi,
If currency is INR use
DATA : amt TYPE pc207-betrg VALUE '100',
amt_w TYPE char100.
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = amt
IMPORTING
amt_in_words = amt_w
EXCEPTIONS
data_type_mismatch = 1
OTHERS = 2.
IF sy-subrc = 0.
WRITE amt_w.
ENDIF.Regards
‎2008 Nov 27 12:59 PM
Sammeta,
Your answer is in a structure and hence the long answer. If you just want the number 100, you can obtain it by writing or assigning in_words-word.
Sojan
Note : You need to dig little more deep into abap
‎2008 Nov 27 1:01 PM
‎2008 Nov 27 1:01 PM
>
> Example : If i Give Input as 100 then its giving O/P as 000000000000100000#ONE HUNDRED
> But i need only ONE HUNDRED
> Please Guide regarding this.
The output of the FM is a structure (spell in your case), the value ONE HUNDRED will be in field word. So you need to check spell-word (not spell, what you actually do)
‎2008 Nov 27 1:04 PM
Here, importing parameter IN_WORDS is a table. Refer the field IN_WORDS-WORD, this will give the amount in words only. If the filler is filled with any symbol like * then the prefix and suffix of output(ONE HUNDRED) contains *s like ONE HUNDRED***************
Regards,
Kiran Bobbala
‎2008 Nov 27 1:09 PM
‎2008 Nov 27 1:06 PM