‎2008 Jun 23 9:51 AM
Hi all,
I need to remove decimal places, wats the best way to do that,
Eg: DMBTR = 3900.00, but i just want to display as 3,900
Thanks in advance
‎2008 Jun 23 9:54 AM
Hi,
define a variable from type int and move your value inside it before you give it out.
Regards
Nicole
‎2008 Jun 23 9:55 AM
Move the values to another varaiable of data type 'I' , it will display the whole numbers.
Thanks,
Ponraj.s.
‎2008 Jun 23 9:57 AM
data : v_DMBTR type DMBTR value '3900.00'.
write v_DMBTR decimals 0.
‎2008 Jun 23 9:59 AM
hiii
just move values in type ' I '..it will round your values.so output will be without decimal.
reward if useful
thx
twinkal
‎2008 Jun 23 9:59 AM
hi
You can use below code :
data : var1 type p decimasl 3 value '100.000'.
data : var2 type i.
var2 = var1.
write : var2.
O/P : 100.
Reward points
Cheers
Snehi
‎2008 Jun 23 10:03 AM
data: v_test type p decimals 2 value '3900.00'.
data: out type p .
out = v_test .
write:/ out decimals 0.
‎2008 Jun 23 10:03 AM
I did try to do the same , declared variable type int and tried to move the value, but wen i update the amount to internal table again it takes as 3900.00,
I am trying to avoid decimals because IDR dosent support decimal, expected result is 3,900,
but what I am getting is 390,000.
‎2008 Jun 23 10:49 AM
This problem is becouse of the veriable you are using for your internal table
it is happening like this
Value in the field of internal table is : 3900.25
now you take this to an integer value it will be 3900
But when you will update this value back to ur internal table it will be 3900.00
Just declear one more internal table with same structure just change that particular field to char or integer type loop on the first table and copy the values to secand table.
delete the first table now you use your secand table in your program for further processing.
Reward points if helpful
Regards
Bikas
‎2008 Jun 23 10:16 AM
if you want to print dmbtr without decimal then try dmbtr(C) , C will remove decimal
‎2008 Jun 23 10:32 AM
Hi Soyunee,
Take the value into a character type field using write statement with currency or unit depanding on the type(i think for you it should be CURRENCY )
WRITE VALUE TO L_NETP CURRENCY WAERK.
here Value = 3900.00 and L_NETP is character field of same size as VALUE.
CURRENCY WAERK is the syntax try to put it as it is.
if any problem please let me know
3,900 (For comma) depends on decimal format defind in T005X table.
Thanks & Regards
Ankur
‎2008 Jun 23 10:50 AM
Hi Ankur,
Here is the code for clear understading,
ORIGINAL
SELECT SINGLE * FROM tcurf WHERE fcurr EQ tbl_i_vbkpf-waers
AND tcurr = tbl_i_vbkpf-hwaer.
IF sy-subrc = 0.
l_kursf = tbl_i_vbkpf-kursf * ( tcurf-tfact ) / ( tcurf-ffact ).
ENDIF.
IF tbl_i_vbkpf-waers NE 'IDR'.
tbl_i_vbsegs-dmbtr = tbl_i_vbsegs-wrbtr * g_tbl_i_vbkpf-kursf * 10.
ENDIF.
Note: Local curreny is always IDR.
with the above coding I am facing issues when the document currency is JPY, the result is multiple of 10 for the original amount coz its multiplied by 10.
MODIFIED
tbl_i_vbsegs-dmbtr = tbl_i_vbsegs-wrbtr * l_kursf.
With this JPY to IDR is fine but the result USD to IDR is multiple of 100.
Can anyone please help me on this.
‎2008 Jun 23 11:11 AM
DATA: LV_DEC TYPE P DECIMALS 2,
LV_CHAR TYPE CHAR20,
LV_NUM TYPE CHAR20,
LV_DEC1 TYPE CHAR20.
LV_DEC = '3902.00'.
LV_CHAR = LV_DEC.
SPLIT LV_CHAR AT '.' INTO LV_NUM LV_DEC1.
WRITE: LV_NUM.
Hope this helps...
Reward points if useful,
Janani
‎2008 Jun 23 11:27 AM
Hi soyunee,
you are facing this problem probably because you are multiplying value with character value try to do all manupalation ,multiplication,operation with the original type not with the character type you have taken.
and at last convert
WRITE tbl_i_vbsegs-dmbtr TO L_VALUE CURRENCY tbl_i_vbkpf-waers
stil face problem tell me exact place you are using write statement
Thanks & Regards
Ankur