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 amount in words - smartforms

Former Member
0 Likes
2,501

hi ,

i have prepared an invoice bill in smartform.i want the grandtotal value to be displayed in words..is there any function module what we have script like convert_amount_in_words...do we have any such in smartforms.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,861

Hi,

you can use HR_IN_CHG_INR_WRDS.

Hi,

you can use HR_IN_CHG_INR_WRDS.

7 REPLIES 7
Read only

GauthamV
Active Contributor
0 Likes
1,861

hi,

use SPELL_AMOUNT function module.

Read only

Former Member
0 Likes
1,861

u this Fm


CALL FUNCTION 'SPELL_AMOUNT'
  EXPORTING
    amount   = a
  IMPORTING
    in_words = gv_words.

Read only

Former Member
0 Likes
1,862

Hi,

you can use HR_IN_CHG_INR_WRDS.

Read only

Former Member
0 Likes
1,861

Hi,



this is my own customised Function Module..You can use this...
import
AMOUNT	TYPE	KONV-KAWRT	                     	Condition base value
CURRENCY	TYPE	CHAR3	                     	3-Byte field

export
WORDS	TYPE	C
FUNCTION zconvert_amnt_to_words.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(AMOUNT) TYPE  KONV-KAWRT
*"     REFERENCE(CURRENCY) TYPE  CHAR3
*"  EXPORTING
*"     REFERENCE(WORDS) TYPE  C
*"----------------------------------------------------------------------
  DATA: w_amount(255)  TYPE c,
          w_out_amt(255) TYPE c,
          amt_in_inr TYPE pc207-betrg.

  amt_in_inr = amount.
  IF currency = 'INR'.
    CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
      EXPORTING
        amt_in_num         = amt_in_inr
      IMPORTING
        amt_in_words       = w_amount
      EXCEPTIONS
        data_type_mismatch = 1
        OTHERS             = 2.
    IF sy-subrc <> 0.
*    RAISE data_type_mismatch.
    ENDIF.

    IF w_amount CS 'Rupee' AND w_amount NS 'Rupees'.
      IF w_amount CS 'Paise'.
        REPLACE 'Rupee' WITH 'And' INTO w_amount.
      ELSE.
        REPLACE 'Rupee' WITH space INTO w_amount.
      ENDIF.
      CONCATENATE  w_amount ' Only' INTO w_amount.
    ELSEIF w_amount CS 'Rupees'.
      IF w_amount CS 'Paise'.
        REPLACE 'Rupees' WITH 'And' INTO w_amount.
      ELSE.
        REPLACE 'Rupees' WITH space INTO w_amount.
      ENDIF.
      CONCATENATE  w_amount ' Only' INTO w_amount.
    ELSE.
      CONCATENATE w_amount ' Only' INTO w_amount.
    ENDIF.

    TRANSLATE w_amount TO UPPER CASE.

    words = w_amount.
  ENDIF.



ENDFUNCTION.

i think this will help you.

Arunima

Read only

Former Member
0 Likes
1,861

PERFORM convert_2_words USING EXCISE_AMT

CHANGING EXCISE_WRDS.

&----


*& Form convert_2_words

&----


  • text

----


  • -->AMT text

  • -->WRDS text

----


FORM convert_2_words USING amt

CHANGING wrds.

DATA : input TYPE pc207-betrg.

input = amt.

CALL FUNCTION 'HR_IN_CHG_INR_WRDS'

EXPORTING

amt_in_num = input

IMPORTING

amt_in_words = wrds

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.

ENDFORM. "convert_2_words

Read only

Former Member
0 Likes
1,861

Hi:

the same function module can be used in Smartform.

Regards

Shashi

Read only

Former Member
0 Likes
1,861

This message was moderated.