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

About Packed values

former_member532868
Participant
0 Likes
840

Hi

I want to pick up decimals only in packed value.

Example

data: I_TOTAL LIKE J_1ITAXVAR-J_1ITAXAM1.

round off bellow value to my conditions.

if value is 1994.50 and bellow .50. i want to change 1994.

if value is 1994.51 and above .51 then only change to 1995

which function module works like as above my conditions.

or send to the detail code

Please send me as early as possible.

Regards,

Hari

6 REPLIES 6
Read only

Former Member
0 Likes
803

Hi,

Use Ceil of floor or round.

do like this

data: x type p decimals 2.

x = frac(i_total).

if x <= 0.5.

floor(i_total).

else

ceil(i_total).

endif.

Regards

Read only

Former Member
0 Likes
803

data: a TYPE p VALUE '12.49'.

data: b TYPE i.

b = a.

WRITE b.

reward points please....

Read only

Former Member
0 Likes
803

Declare a variable with Type P and pass the value to that variable, You can see the changes.

Regards

Vinayak

Read only

Former Member
0 Likes
803

hi ,

this is more appropriate that what u what.

parameters:p_test type p decimals 2,

output(15).

output = p_test.

write:/ output.

reward points if useful,

venkat.

Read only

Former Member
0 Likes
803

Hi,

define one local variable with type i,

then move your value to this varible then automaticaly it shows like round figure.

ex:

data: I_TOTAL LIKE J_1ITAXVAR-J_1ITAXAM1 value '1994.51',

l_variable type i.

l_variable = I_TOTAL.

here i_variable becomes 1995, that's it no need with FM.

seshu.

Read only

Former Member
0 Likes
803

hi,

HR_ROUND_NUMBER – Rounds a number according to rules

ROUND – Rounds value to a number of decimal places

ROUND_AMOUNT – Rounding based on company and currency

UNIT_CONVERSION_SIMPLE – Converts measurement unit values and rounds

Hope this is helpful, Do reward.