Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in Total displaying and calculating in terms of words

Hi All,

Pl help me out in the following scenario. I have been trying this since 5 days but could not know how to find the solution.

I have a check form and in tha ti need to display the amount in words but in terms of digit format. Say for ex., we have a number in the total field as 234567

In the check, it will be like

hundredthousand tenthousand thousand hundred tens units cents

The digits shud be displayed in their respective columns...

Now, for this, i have created separate windows like for displaying the digits in units, i have created window called win_units, like that i created 6 windows for displaying all the 6 digits.

In those window, i am writing code as follows:(say for units window)

DEFINE &L_WAERS& = 'USD'

DEFINE &L_SPRAS& = 'EN'

PERFORM SET_unit_SPELL IN PROGRAM prog name

USING &REGUH-RWBTR&

USING &L_WAERS&

USING &L_SPRAS&

USING &HLP_FILLER&

CHANGING &H_SPELLW&

CHANGING &H_SPELLD&

ENDPERFORM

im displaying the value as: &H_SPELLW&

In the progra, in the routine im writing the code as follows:

FORM set_un_spell TABLES input_fields STRUCTURE itcsy

output_fields STRUCTURE itcsy.

DATA: rwbtr(18) TYPE c,

snett LIKE regud-snett,

waers LIKE t001-waers,

spras LIKE sy-langu,

fill(1) TYPE c.

DATA: l_val TYPE regud-snett,

l_ch_val TYPE spell-word.

READ TABLE input_fields INDEX 1.

rwbtr = input_fields-value.

IF rwbtr NE 'XXXXXXXXXXXXXX.XXX'.

TRANSLATE rwbtr USING ', '.

TRANSLATE rwbtr USING '. '.

CONDENSE rwbtr NO-GAPS.

PACK rwbtr TO snett.

READ TABLE input_fields INDEX 2.

waers = input_fields-value.

READ TABLE input_fields INDEX 3.

spras = input_fields-value.

READ TABLE input_fields INDEX 4.

fill = input_fields-value.

  • Units

l_val = snett MOD 10.

PERFORM spell_amt USING l_val l_ch_val spras waers fill.

CONDENSE l_ch_val.

READ TABLE output_fields INDEX 1.

output_fields-value = l_ch_val.

MODIFY output_fields INDEX 1.

CLEAR l_ch_val.

ENDIF.

ENDFORM. "set_un_spell

the spell amt routineis as follows:

FORM spell_amt USING l_val TYPE regud-snett

l_ch_val TYPE spell-word

spras TYPE sylangu

waers TYPE sywaers

fill TYPE c.

DATA: h_spell LIKE spell.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

language = spras

currency = waers

amount = l_val

filler = fill

IMPORTING

in_words = h_spell

EXCEPTIONS

not_found = 1

too_large = 2.

l_ch_val = h_spell-word.

ENDFORM. "spell_amt

Nowm, when im executing the program, when there is an amount field called 12.00, it is displaying "TWELVE" in all the windows..i am not able to understand wehre the problem is...

can any one please suggest me whether my code is correct. if not, pl suggest me the rite code... i m going mad by executing th same thing hundred times...

pl suggest me the rite way to solve the problem.

Regards,

\

Priya

Former Member
Not what you were looking for? View more on this topic or Ask a question