10-30-2007 8:35 AM
Hi,
Can anyone clarify my doubt.
i am able to convert the amount in words by using SPELL_AMOUNT function module. But in that it is printing the amount like,
5633 -- > Five thousand six hundard thirty three only.
but i want to print Five thousand and six hundard thiry three only.
How can i do that. Please let me know as soon as possible.
Thank u very much.
Bye.
10-30-2007 8:38 AM
10-30-2007 8:42 AM
Hi,
In case of SPELL amount you will have to manually insert 'hundred' and so on as per your requirement.
There is no other way with FM: SPELL_Amount.
Use FM
HR_IN_CHG_INR_WRDS
Regards,
GURU
10-30-2007 8:42 AM
Hi
that fun module will give output like that only
you can concatenate this word 'and' by splitting the actual string you got from fun module
or there is a table which will spell the numbers in words, use that
Regards
Anji
10-30-2007 8:42 AM
you can not do this with FM try below code
DATA: lv_waers(7) TYPE c,
lv_word TYPE string,
lv_word1 TYPE string,
lv_word2 TYPE string,
lv_word3 TYPE string,
lv_word4 TYPE string,
lv_word5 TYPE string,
lv_word6 TYPE string,
lv_word7 TYPE string,
lv_word8 TYPE string,
lv_final TYPE string.
TO read the values from the table INTAB into local variable for currency
CLEAR gs_itcsy.
READ TABLE intab INTO gs_itcsy WITH KEY name = 'GV_WAERS'.
IF sy-subrc = 0.
MOVE gs_itcsy-value TO lv_waers.
ENDIF.
TO read the values from the table INTAB into local variable for Spell word
CLEAR gs_itcsy.
READ TABLE intab INTO gs_itcsy WITH KEY name = 'GV_WORD'.
IF sy-subrc = 0.
MOVE gs_itcsy-value TO lv_word.
ENDIF.
CLEAR intab.
IF lv_waers EQ 'GBP'.
lv_waers = 'POUNDS'.
ELSE.
lv_waers = gs_itcsy-value.
ENDIF.
SEARCH lv_word FOR 'HUNDRED'.
IF sy-subrc = 0 AND sy-fdpos NE 0.
REPLACE
ALL OCCURRENCES OF SUBSTRING 'HUNDRED'
IN lv_word WITH 'HUNDRED,'.
ELSE.
REPLACE
ALL OCCURRENCES OF SUBSTRING 'THOUSAND'
IN lv_word WITH 'THOUSAND,'.
ENDIF.
SPLIT lv_word AT ',' INTO lv_word1 lv_word2 lv_word3 lv_word4.
IF lv_word4 IS NOT INITIAL.
CONCATENATE lv_word1 lv_word2 lv_word3 ' AND' lv_word4 INTO lv_final.
ELSEIF lv_word3 IS NOT INITIAL.
SEARCH lv_word3 FOR 'HUNDRED'.
IF sy-subrc = 0 AND sy-fdpos NE 0.
REPLACE
ALL OCCURRENCES OF SUBSTRING 'THOUSAND'
IN lv_word3 WITH 'THOUSAND,'.
SPLIT lv_word3 AT ',' INTO lv_word5 lv_word6.
CONCATENATE lv_word1 lv_word2 lv_word5 ' AND' lv_word6 INTO lv_final.
ELSE.
CONCATENATE lv_word1 lv_word2 ' AND' lv_word3 INTO lv_final.
ENDIF.
ELSEIF lv_word2 IS NOT INITIAL.
SEARCH lv_word2 FOR 'HUNDRED'.
IF sy-subrc = 0 AND sy-fdpos NE 0.
REPLACE
ALL OCCURRENCES OF SUBSTRING 'THOUSAND'
IN lv_word2 WITH 'THOUSAND,'.
SPLIT lv_word2 AT ',' INTO lv_word7 lv_word8.
CONCATENATE lv_word1 lv_word7 ' AND' lv_word8 INTO lv_final.
ELSE.
CONCATENATE lv_word1 ' AND' lv_word2 INTO lv_final.
ENDIF.
ELSE.
lv_final = lv_word1.
ENDIF.
CLEAR gs_itcsy.
READ TABLE outtab INTO gs_itcsy WITH KEY name = 'LV_WAERS'.
IF sy-subrc = 0.
gs_itcsy-value = lv_waers.
MODIFY outtab FROM gs_itcsy INDEX sy-tabix.
ENDIF.
CLEAR gs_itcsy.
READ TABLE outtab INTO gs_itcsy WITH KEY name = 'LV_WORD'.
IF sy-subrc = 0.
gs_itcsy-value = lv_final.
MODIFY outtab FROM gs_itcsy INDEX sy-tabix.
ENDIF.
Rewards if useful..........
Minal