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

FM

Former Member
0 Likes
1,003

Hi Experts,

can anybody plz suggest me any Function Module name for convering any quanttity field e.g '12543.012' to a round value fiend such as '12543'.

Thanks

Sangram

8 REPLIES 8
Read only

Former Member
0 Likes
973

chk FM ROUND

Read only

Former Member
0 Likes
973

Simply assign it to a integer variable.

Data : l_dat type p decimals 2,

l_final type i.

l_dat = '12543.012'.

move l_dat to l_final.

Read only

Former Member
0 Likes
973

hi,

assign the value '12543.012' to a variable of type i.

thanks,

Read only

Former Member
0 Likes
973

Hi,

You can multiply the value, then the result is assigned to integer.

DATA l_result TYPE i.

l_result = 12543.012 * 1.

l_result will contain the round of the value.

Read only

Former Member
0 Likes
973

DATA: X TYPE P DECIMALS 2 VALUE '123456.56'.

y = FLOOR x.

write y.

Hope u can use CEIL or FLOOR based on the result u want.

Regards

Read only

Former Member
0 Likes
973

DATA: X TYPE P DECIMALS 2 VALUE '123456.56'.

y = FLOOR x.

write y.

Hope u can use CEIL or FLOOR based on the result u want.

refer

https://forums.sdn.sap.com/click.jspa?searchID=5091884&messageID=2092039

Regards

Read only

Former Member
0 Likes
973

Define it as packed decimal.

Type : A type P decimals 0

Read only

Former Member
0 Likes
973

Hi,

Try with this code:

DATA pack TYPE p VALUE '12543.012'

DECIMALS 3.

WRITE pack DECIMALS 2.

WRITE: / pack DECIMALS 0.

WRITE: / pack ROUND -2,

/ pack ROUND -1,

/ pack ROUND 1,

/ pack ROUND 2.

Regards,

Bhaskar