2008 Jul 29 6:07 AM
2008 Jul 29 6:08 AM
Hi,
Use the Function Module is ROUND.
Example ;-
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 0
input = w_data
SIGN = ' '
IMPORTING
OUTPUT = w_data.Best of luck,
Bhumika
2008 Jul 29 6:08 AM
2008 Jul 29 6:08 AM
Hi,
Use the Function Module is ROUND.
Example ;-
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 0
input = w_data
SIGN = ' '
IMPORTING
OUTPUT = w_data.Best of luck,
Bhumika
2008 Jul 29 7:48 AM
2008 Jul 29 7:52 AM
2008 Jul 29 7:58 AM
Hi,
i tried with that but i did not get. does it works for currency fields.
2008 Jul 29 6:09 AM
HI,
You can make use of FM ROUND and also try using Ceil and Floor statements.
Thanks,
Sriram Ponna.
2008 Jul 29 6:12 AM
Hi Chandrika,
Please check this links ,
https://forums.sdn.sap.com/click.jspa?searchID=14583409&messageID=5826784
https://forums.sdn.sap.com/click.jspa?searchID=14583409&messageID=5875936
https://forums.sdn.sap.com/click.jspa?searchID=14583409&messageID=5652864
Regards,
Sreekar.Kadiri
2008 Jul 29 6:13 AM
hi,
u can use it without using the function module . here 's d example of it:-
**********BEGIN - ROUND OFF EXAMPLE**********
DATA A TYPE P DECIMALS 3.
A = '123.456'.
WRITE: / A ROUND -2,
/ A ROUND -1,
/ A ROUND 1.
**********END - ROUND OFF EXAMPLE************
i hope it might be useful to you.
2008 Jul 29 6:14 AM
Hi
You can use the ROUND function instead of a Function Module.
Eg... y = ROUND( x ).
Hope it helps.
Murthy
2008 Jul 29 7:55 AM
Data num1 type p decimals 2 value '123456.78'.
Data num2 type p decimals 0.
Data num3 type p decimals 2.
num2 =num1.
num3=num2.
Write \ num3.
Regards
rajesh
2008 Jul 29 7:56 AM
Hi Chandrika,
In one of my developments I had done rounding for quantity fields as follows.
*Data declarations
DATA : lv_planned_deliv_qnty TYPE jdelquantity....
*Rounding up
lv_planned_deliv_qnty = CEIL( lv_planned_deliv_qnty ).
Note : This will round up the quantity field to nearest upper integer.
In case you want to keep only the interger part you can do the following
lv_planned_deliv_qnty = TRUNC( lv_planned_deliv_qnty ).
Hope this helps.
<removed_by_moderator>
Regards,
Swati Patnaik
Edited by: Julius Bussche on Jul 29, 2008 9:12 PM
2008 Jul 29 8:17 AM
Hi Chandrika ,
It worked for currency fields as well.
I wrote a dummy code to check...see the results
DATA : lv_curr1 TYPE WRBTR VALUE '234.87',
lv_curr2 TYPE WRBTR VALUE '687.23',
lv_curr3 TYPE WRBTR,
lv_int TYPE JDELQUANTITY.
write /2: ' Before TRUNC ' , lv_curr1.
lv_int = TRUNC( lv_curr1 ).
write /2: 'AFTER TRUNC lv_int' , lv_int.
write /2: ' before Ceil ' , lv_curr2.
lv_curr3 = CEIL( lv_curr2 ).
write /2: 'after Ceil ' , lv_curr3.
Output :
Before TRUNC
234,87
AFTER TRUNC lv_int
234,000
before Ceil
687,23
after Ceil
688,00
Edited by: Swati Patnaik on Jul 29, 2008 9:17 AM
2008 Jul 29 8:23 AM
if i give the value as 34.65 i should get the out as 35.
as after decimal value it is greater than .50 it should give the greater value.
and in my case ceil does not work.
2008 Jul 29 8:46 AM
Hi Chandrika,
Is your field TYPE CURR ???
In my case it is working fine.I have already sent you the output.
Try to use a predefined Data element for your currency field.
Say , if your Currency field lv_curr is ( 13, 2 ) Then you can use the data element WRBTR.
You can search for a suitable predefined data element in se11.
se11 --> Data Type --> Search for Data Elements --> A popup window " Input help Personal value List " appears
Click the Information System button in the bottom right side of the window.
A popup window " Repository Info System : Find Data Elements" appears
for example
enter Data element = wb*
enter the data type ( i.e., CURR ) and the desired length ( say 10 ).
A list of data elements of required type and size will appear.You can choose the one which suits your requirement.
Regards,
Swati Patnaik
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |