Former Member

### how to find the number of decimals in a given value

Hi all,

i have a value called 5987.45

and decimal places are 45 that is 2 numbers

2) 765.987

number of digits in decimals are 3.

3) 67543.1

number of digits in decimals are 1.

for this i need a coding

thanks.

10|10000 characters needed characters exceeded

• Former Member
Jun 23, 2009 at 12:48 PM

Hi,

While printing your text element give as;

`&wa_tab-dec_value(.2C)&`

This will always print everything with 2 decimals.

Regards

Karthik D

10|10000 characters needed characters exceeded
• Jun 23, 2009 at 12:48 PM

Hi,

Use the FM SWA_DETERMINE_DECIMALS.

regards,

Ankur Parab

10|10000 characters needed characters exceeded
• Former Member
Jun 23, 2009 at 03:56 PM

HI,

split your value at '.' into two variables and find the number of characters of the decimal part.

eg.

if value = '123.567'.

split value at '.' into integer_part decimal_part.

no_of_decimals = numofchar( decimal_part.) .

10|10000 characters needed characters exceeded
• Former Member
Jun 24, 2009 at 01:44 AM

Hi,

Use FM SWA_DETERMINE_DECIMALS to calculate the decimal count value.

Hope this may be useful..

Regards,

Prashant