cancel
Showing results for 
Search instead for 
Did you mean: 

issue to convert rupees to words through smartform

Former Member
0 Kudos

hi

i want to convert the rupees into word so that i used spell_word function module,

this i have to print through smartform, in one window i written the code in program line before that i declare one types for structure (tp_spell) and through this i declare one internal table in global definition as t_spell type table of tp_spell these for internal table for passing the structure to that function module

after declaring i used function module in main window program lines

DATA: PWAERS LIKE EKKO-WAERS.

DATA : PAMOUNT TYPE P DECIMALS 2.

PAMOUNT = GV_TOT.

PWAERS = IS_EKKO-WAERS.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = PAMOUNT

CURRENCY = PWAERS

FILLER = ' '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = T_SPELL[]

EXCEPTIONS

NOT_FOUND = 1

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

like this i written the code in that window program lines and executed its giving short dump.

and i tried to findout the error, pamount variable was getting data and pwaers also getting the data and it was not entered into function module

so please give me solution for this problem

thanks

pallavi

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

data : V_TEXT type SPELL.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = v_balance

CURRENCY = 'INR'

FILLER = SPACE

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = V_text

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.

Former Member
0 Kudos

Hi Pallavi,

Do not pass WAERS value directly with the type EKKO-WAERS, instead assign this value to a variable of type CURRENCY in SPELL_AMOUNT function module so that you dont get dump.

This applies good for PAMOUNT value as well.

Thanks,

Koteswar

Former Member
0 Kudos

hi

i taken pwaers as currency even though its given short dump

here i will show the msg which appears for dump observe and pls give the solution for this

Short text

Type conflict when calling a function module (field length).

What happened?

Error in the ABAP Application Program

The current ABAP program "/1BCDWB/SAPLSF00000131" had to be terminated because

it has

come across a statement that unfortunately cannot be executed.

A function module was called incorrectly.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught in

procedure "%CO45" "(FORM)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

The call to the function module "SPELL_AMOUNT" is incorrect:

In the function module interface, you can specify only

fields of a specific type and length under "IN_WORDS".

Although the currently specified field

"T_SPELL" is the correct type, its length is incorrect.

source code

7994 * FORM %CO45

7995 * NODE %CODE2

7996 *----


7997

7998 FORM %CO45.

7999

8000 DATA: PWAERS type currency.

8001 DATA : PAMOUNT TYPE P DECIMALS 2.

8002 BREAK-POINT.

8003 PAMOUNT = GV_TOT.

8004 PWAERS = IS_EKKO-WAERS.

>>>> CALL FUNCTION 'SPELL_AMOUNT'

8006 EXPORTING

8007 AMOUNT = PAMOUNT

8008 CURRENCY = PWAERS

8009 FILLER = ' '

8010 LANGUAGE = SY-LANGU

8011 IMPORTING

8012 IN_WORDS = T_SPELL[]

8013 EXCEPTIONS

8014 NOT_FOUND = 1

8015 TOO_LARGE = 2

8016 OTHERS = 3

8017 .

8018 IF SY-SUBRC <> 0.

8019 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

8020 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

8021 ENDIF.

8022

8023 ENDFORM. " %CO45

8024

pls give the solution as early as possible

Former Member
0 Kudos

hi..

use the same data elements for the field or use the same length char field for that ...

DATA : money TYPE p DECIMALS 2,

in_letters LIKE spell.

money = '1000.00'.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = money

IMPORTING

in_words = in_letters

EXCEPTIONS

not_found = 1

too_large = 2

OTHERS = 3.

WRITE : / in_letters-WORD.

Former Member
0 Kudos

Hi,

here you are declarinf T_SPELL as table type. But that is nt table type.

Check the data type for IN_WORDS (importing parameter) and declare with the same data type.

Regards

Sandeep Reddy

Former Member
0 Kudos

Hai Pallavi,

Try the following

***TO spell the amount in words.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = l_totamount

  • CURRENCY = 'INR'

  • FILLER = ' '

  • LANGUAGE = SY-LANGU

IMPORTING

in_words = l_amountwords

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.

***TO make the words to small letters

TRANSLATE l_amountwords-word+1(253) TO LOWER CASE.