cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Decimal Parts / Alter Code

Former Member
0 Kudos
303

This CReport code results a number into words ,how can i remove the decimal parts from this?If the number is 5678.67 the output should be "Five Thousand six hundred and seventy eight" .

numbervar RmVal:=0; numbervar Amt:=0; numbervar pAmt:=0; stringvar InWords :=""; Amt:= sum({Command.Value}); if Amt > 10000000 then RmVal := truncate(Amt/10000000); if Amt = 10000000 then RmVal := 1; if RmVal = 1 then InWords := InWords + " " + towords(RmVal,0) + " Crore" else if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + " Crores"; Amt := Amt - Rmval * 10000000; RmVal :=0; if Amt > 100000 then RmVal := truncate(Amt/100000); if Amt = 100000 then RmVal := 1; if RmVal >=1 then InWords := InWords + " " + towords(RmVal,0) + " Lakhs"; Amt := Amt - Rmval * 100000; RmVal :=0; if Amt > 0 then InWords := InWords + " " + towords(truncate(Amt),0); pAmt := (Amt - truncate(Amt)) * 100; if pAmt > 0 then InWords := Propercase(InWords + " and " + towords(pAmt,0) + " Paisa only") else InWords := propercase(InWords + " Only");

View Entire Topic
former_member205840
Active Contributor

Hi

Int(1.22) will display 1.00 , so you can even use int(),

Thanks,

Sastry

Former Member
0 Kudos

Hi,

Please be a member in my whatsapp group for SAP Support.

https://chat.whatsapp.com/FbNZK3T4hgHAPQWe3ukEw6