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

convert quantiy

Former Member
0 Likes
811

Hi friends,

How to convert the quantity field value into words. For example let my quantity field value is 12.12 I need to convert this to twelve point twelve. .How to do this. Can I use the function module spell amount for quantity? I tried but I didn’t get proper result. Please help me.

Thanks to all

6 REPLIES 6
Read only

Former Member
0 Likes
779

Hi,

Pass the amount after Decimal to the Spell amount seperately and then concatenate the two parts of the amount.

For example : 130.60 Rs

Store the amount in a character string. Split the string at decimal point using a SPLIT statement.

DATA: amount_total(10),

round(7),

dec_part(3).

DATA: dec(1) TYPE c VALUE '.',

amount_total = '130.60'.

SPLIT amount_total AT dec INTO round dec_part.

First pass variable 'round' to Spell_amount and then in the second call pass variable 'DEC_PART' and concatenate the two results.

then concatenate the results. and the resulting string will be 130 Rs 60 paise.

Regards

Richa

Read only

Former Member
0 Likes
779

Hi

Try with the table <b>T015Z</b>but you have to pass each digit to it and concatenate that result

or see the fun module SPELL_AMOUNT.

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
779

hi..

check this code...

Use FM HR_IN_CHG_INR_WRDS or SPELL_AMOUNT

Here is the sample code

DATA AMT_IN_NUM LIKE PC207-BETRG.

DATA AMT_IN_WORDS(100) TYPE c.

PARAMETERS: AMOUNT LIKE AMT_IN_NUM.

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING

amt_in_num = AMOUNT

IMPORTING

AMT_IN_WORDS = AMT_IN_WORDS

EXCEPTIONS

DATA_TYPE_MISMATCH = 1

OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

WRITE AMT_IN_WORDS.

Reward if useful

Regards

ashu

Read only

Former Member
0 Likes
779

HI,

THIS MIGHT HEALP YOU OUT

IN SE71

PERFORM GETWORD IN PROGRAM ZSUB

USING &KOMK-FKNIT(&I13)&

CHANGING &V_WORDS&

ENDPERFORM.

&V_WORDS&.

IN SE38

DATA VAR LIKE SPELL.

FORM GETWORD TABLES IN_TABLES.

RAD TABLE IN_TABLE INDEX1.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = IN_TABLE-VALUE.

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = VAR

READ TABLE OUT_TABLE INDEX1.

MOVE VAR-WORD TO OUT-TABLE-VALUE.

MODIFY OUT_TABLE INDEX1.

ENDPERFORM.

Read only

Former Member
0 Likes
779

Hi,

Try this Code,U will get tha Answer,

DATA: QUANTITY TYPE SPELL-NUMBER VALUE '12.12',

WORDS LIKE SPELL.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = QUANTITY

CURRENCY = 'IND'

  • FILLER = ' '

  • LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = WORDS

  • 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.

WRITE : /'Rounded Value' , WORDS-WORD,'Decimal Value',WORDS-DECWORD.

Regards,

Padmam.

Read only

former_member196280
Active Contributor
0 Likes
779

Ex:

Pass it to character field.

Char = 12.12.

Split char at . into char1 char2.

Use FM SPELL AMOUNT, pass char1 first and then char2.

I guess from here you can do this.

Reward points if useful.

Regards,

SaiRam