cancel
Showing results for 
Search instead for 
Did you mean: 

printing the totals in words in footer window

Former Member
0 Kudos

Hi all,

I am trying to modify the standard form : RVINVOICE01.

In main window i am getting the total Amount in Numbers. My requirement is to print that total Amount in Words in a Footer Window.

Example:

In Main Window if i get Total : 1160 (KOMK-FKWRT)

Then in Footer Window i have to display like this

Total in words :One Thousand One hundred sixty.

for this i am using Subrotines, but it is giving Dump. Check my code below and correct me .

I have written like this in Footer Window..

/: PERFORM ZK_WORD IN PROGRAM ZADIN01

/: USING &KOMK-FKWRT&

/: CHANGING &WORD1&

/: ENDPERFORM

AS Total in Words : &WORD1&

-


And in SE38 i have created a Subroutine Pool program ZADIN01 as follows.

FORM ZK_WORD tables input structure ITCSY

output structure ITCSY.

DATA: v_int type p decimals 2.

words like spell.

READ table input index 1.

if sy-subrc = 0.

move input-value to v_int.

endif.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = V_INT

IMPORTING

IN_WORDS = WORDS

EXEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

-


I am getting the Dump with the above code.

The error that i am getting is : Unable to interpret '1160' as a number , but since the value contravences

the rules for correct number formats, this was not possible.

and it is stating that the error is in move input-value to v_int.

How to solve this ?

Thanks in advance

KR

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member196280
Active Contributor
0 Kudos

try to add the below code..

DO.

REPLACE ',' WITH ' ' INTO v_int.

IF SY-SUBRC NE 0.

CONDENSE v_int NO-GAPS.

EXIT.

ENDIF.

ENDDO.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = V_INT

IMPORTING

IN_WORDS = WORDS

EXEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

Regards,

SaiRam

Former Member
0 Kudos

Hi sairam,

Thanks for reply. I did the changes according to your suggestions .

My shortdump issuse hasbeen solved , but the amount is not been displaying in words ?

any idea pls ?

Thanks

KR

sangeetha_sk
Participant
0 Kudos

Hi,

add

/: define word1 = ' '

/: PERFORM ZK_WORD IN PROGRAM ZADIN01

/: USING &KOMK-FKWRT&

/: CHANGING &WORD1&

/: ENDPERFORM

AS Total in Words : &WORD1&

FORM ZK_WORD tables input structure ITCSY

output structure ITCSY.

DATA: v_int type p decimals 2.

word1 like spell.

READ table input index 1.

if sy-subrc = 0.

move input-value to v_int.

endif.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = V_INT

IMPORTING

IN_WORDS = WORD1

EXEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

add this in ur form also.

READ TABLE OUTPUT INDEX 1.

IF SY-SUBRC = 0.

OUT_PAR-VALUE = WORD1.

MODIFY OUTPUT INDEX SY-TABIX.

ENDIF.

Hope this will be useful for you

Vijay
Active Contributor
0 Kudos

hi

to print amount in words use

FM:SPELL_AMOUNT

regards

vijay

reward points if helpful