cancel
Showing results for 
Search instead for 
Did you mean: 

how to find the number of decimals in a given value

Former Member
0 Kudos

Hi all,

Can u please help me in solving the problem,

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.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Use FM SWA_DETERMINE_DECIMALS to calculate the decimal count value.

Hope this may be useful..

Regards,

Prashant

Former Member
0 Kudos

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

former_member555112
Active Contributor
0 Kudos

Hi,

Use the FM SWA_DETERMINE_DECIMALS.

regards,

Ankur Parab

Former Member
0 Kudos

Hi,

While printing your text element give as;

&wa_tab-dec_value(.2C)&

This will always print everything with 2 decimals.

Regards

Karthik D