cancel
Showing results for 
Search instead for 
Did you mean: 

Amount printing problem

Former Member
0 Kudos

Dear All,

I am having a problem in printing the amount in words in smartform which is created in arabic as its original language , The problem is descriped below.

The invoice say 34000.000 is priniting as thirty four thousand.

But if the invoice amount is say 34569.000 then it is printing as hundred sixty nine thirty four thousand five.where as the correct value is thirty four thousand five hundred sixty nine

Please suggest

Thanks and Regards

Praveen S

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I think ur using SPELL_AMOUNT FM and Passing the Currency as KWD as result u will get that value.

If we use KWD as Currency the no: of Decimals are 3 where as if u use INR no: of Decimals are 2 and u get the correct value.

So always pass value 123.000 etc U Need to Pass 3 Decmials

surya

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Praveen,

Firstly the currency field cannot have 3 decimal places as u have written in the example above, if is it so then the Amount field is declared as a quantity field in the smartform.

So u just have to change that in smartform in the global Defination----->>>Currency/Quant. Field.

Define the field as a currency (Not Quantity) there with a refrence field declared with the same type in global defination .

and then use the following function module to change the Currency value to text.

HRCM_AMOUNT_TO_STRING_CONVERT - Convert amount to string.

Regards,

Akash Rana

Former Member
0 Kudos

Hi Akash

The three decimal places is just a typo error because here in kuwait we consider the currency to be three decimal places so by mistake I had typed wrongly three decimals please note that i am using spell_amount FM for gettting the amount in words and the data in words is also fetching correctly in the debugging only during printing it is going haywire the reason i suppose is the form is developed in Arabic login.Please suggest something for arabic language form.

Thanks & Regards

Praveen

Former Member
0 Kudos

Hi Praveen,

i think the problem is with the data declaration that u r using for the import parameter "IN_WORDS" in spell_words FM.

U have to define the import parameter Like SPELL, and lanuage u r passing should be 'EN', as u want in english, along with that u have to also pass the currency as 'KWD' which is kuwait dinar.

For example,

data: BILL_AMT_WOR like spell.

DATA: KURR(3) TYPE C,

DEC TYPE P DECIMALS 3,

DECTEXT(10) TYPE C,

SECONDLINE(40) TYPE C.

IF WA_FINAL-SUM_AMOUNT <> ' '.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = WA_FINAL-SUM_AMOUNT

CURRENCY = 'KWD'

FILLER = ' '

LANGUAGE = 'EN'

IMPORTING

IN_WORDS = BILL_AMT_WOR

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

KURR = 'KWD'.

DECTEXT = 'FILs'.

CONCATENATE KURR BILL_AMT_WOR-WORD INTO BILL_AMT_WOR-WORD SEPARATED BY SPACE.

DEC = FRAC( WA_FINAL-SUM_AMOUNT ). "to see the decimal places

IF NOT DEC IS INITIAL.

CONCATENATE 'AND' DECTEXT BILL_AMT_WOR-DECWORD 'ONLY'

INTO SECONDLINE SEPARATED BY ' '.

CONCATENATE BILL_AMT_WOR-WORD SECONDLINE

INTO BILL_AMT_WOR-WORD SEPARATED BY ' '.

ELSE.

CONCATENATE BILL_AMT_WOR-WORD 'ONLY'

INTO BILL_AMT_WOR-WORD SEPARATED BY SPACE.

ENDIF.

WA_FINAL-BILL_AMT_WOR = BILL_AMT_WOR-WORD.

hope this sloves ur issue.

Regards,

Akash Rana

Edited by: AKASH RANA on Aug 9, 2009 9:53 AM

Former Member
0 Kudos

Dear Akash,

Thanks for the reply but my problem is not what you have suggested to be , In debugging the value is coming perfectly fine in the variable that I have taken only when I am printing things are going into a disarray. Please note that the form is developed in arabic as its original language and arabic has created alll sorts for problem while ,so I guess that it is something related to arabic being its language . Please suggest something for the issue.

thanks

Praveen

Former Member
0 Kudos

Hi,

Please post the code u r using , that would be helpful to judge the issue.

Regards,

Akash Rana

former_member156446
Active Contributor
0 Kudos

try [this code|http://www.sap-img.com/fu001.htm]

Former Member
0 Kudos

Dear Jay ,

I have used the same function module in my code previously but still its not working probably because the form is created in arabic as original language can u suggest something else.

Please note that the problem is a special case because the form's original language is arabic language.

Thanks

Praveen