Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Script : Amount in Words

Former Member
0 Likes
961

Dear All,

I am working on bank Check, I need to print the amount value in Words. Amount field &REGUD-SWNES&, I need to print this amount in words.

I mean to say that, regud-swnes = 1000.69, I have to print this as One Thousand and 69/100. please advice me, how Can I do that.

Thanking you.

with kind Regards

Venkat.

Dear All,

I am working on bank Check, I need to print the amount value in Words. Amount field &REGUD-SWNES&, I need to print this amount in words.

I mean to say that, regud-swnes = 1000.69, I have to print this as One Thousand and 69/100. please advice me, how Can I do that.

Thanking you.

with kind Regards

Venkat.

4 REPLIES 4
Read only

Former Member
0 Likes
785

Probably you can split it at the decimal point and pass the digits before the decimal to SPELL_AMOUNT and then decide how many digits are there after the decimal and then write it appropriately.

Search regud-swnes for '.'.

var1 = regud-swnes+0(sy-fdpos).

Now call the spell amount for var1.

var2 = regud-swnes+sy-fdpos(2).

Now you should be able write it.

Regards,

Ravi

Read only

0 Likes
785

HI,

Split the amount in to two variable i.e, var1 and var2 at '.' and print the var1 using FM SPELL_AMOUNT and then display var2 according to your requirement.

Read only

LucianoBentiveg
Active Contributor
0 Likes
785

Use FM spell_amount, this one exports structure SPELL in your case with:

WORD = One Thousand

DECWORD = sixty nine

Regards.

Read only

Former Member
0 Likes
785

hi venkat,

split the command at decimal and u can design ur code for 69/1000.for displaying 1000 u can use the fm 'SPELL_AMOUNT'.

sample:

TABLES SPELL.

DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.

DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '1234510'.

SY-TITLE = 'SPELLING NUMBER'.

PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.

WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.

FORM SPELL_AMOUNT USING PWRBTR PWAERS.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = PAMOUNT

CURRENCY = PWAERS

FILLER = SPACE

LANGUAGE = 'E'

IMPORTING

IN_WORDS = T_SPELL

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

ENDFORM.

reward if helpful.

regards,

keerthi.