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

Function Modules

Former Member
0 Likes
735

Hi I need a funcion module to separate a real number in to its integer part and decimal part.

Eg. The number 3.45 should be separated as 3 and 45.

Please help me out.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
706

Just write this coding ...

data : v_type type p decimals 2 value '3.45'.

data : v_type1(10),

v_1(10),

v_2(10).

v_type1 = v_type.

split v_type1 at '.' into v_1 v_2.

7 REPLIES 7
Read only

Former Member
0 Likes
706

Hi,

U can get them using

ceil and frac statements

x = ceil(3.45) = 3

y = frac(3.45) =0.45

write:/ x , y.

Regards

Read only

Former Member
0 Likes
706

Hi Abhishek,

try this

DATA : TEMP TYPE P DECIMALS 3.

I = TRUNC( TEMP ). " integer part

D = FRAC( TEMP ). " decimal part

Read only

Former Member
0 Likes
707

Just write this coding ...

data : v_type type p decimals 2 value '3.45'.

data : v_type1(10),

v_1(10),

v_2(10).

v_type1 = v_type.

split v_type1 at '.' into v_1 v_2.

Read only

0 Likes
706

Hi could you please provide me a function module for the same thing. It will be really helpful.

Read only

0 Likes
706

there is no inbuilt function module

Read only

0 Likes
706

Look at this FM :

C147_STRING_SPLIT_AT_POSITION But U need to give the

position where to split ...

Read only

0 Likes
706

If you really need a FM you will have to write one yourself.