2007 May 22 6:44 AM
Hi Experts,
I have a field dtvbdpr-grwrt which is of type CURR (Currency format length = 13, decimal = 2). Now the value for this field coming in debugging is 25515.00, however I need to store only 25515 in this field without decimals. How can I do that?
I tried dtvbdpr-grwrt = floor( dtvbdpr-grwrt ) and dtvbdpr-grwrt = TRUNC( dtvbdpr-grwrt ); it does not work.
Its quite urgent. Rewards will given for any helpful suggestion.
Regards,
Raman
Hi Experts,
I have a field dtvbdpr-grwrt which is of type CURR (Currency format length = 13, decimal = 2). Now the value for this field coming in debugging is 25515.00, however I need to store only 25515 in this field without decimals. How can I do that?
I tried dtvbdpr-grwrt = floor( dtvbdpr-grwrt ) and dtvbdpr-grwrt = TRUNC( dtvbdpr-grwrt ); it does not work.
Its quite urgent. Rewards will given for any helpful suggestion.
Regards,
Raman
2007 May 22 6:46 AM
Hi
Declare a TYPE I field and move that field to I type field and see.In script you can use (.0) along with the field for not displaying the decimals. &VBDKR-NETWR(.0)&
Explore the following maths related functions.
<b>abs</b> -Absolute value of the argument arg
<b>sign-</b> Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.
<b>ceil</b> -Smallest integer number that is not smaller than the value of the argument arg.
<b>floor-</b> Largest integer number that is not larger than the value of the argument arg.
<b>trunc</b>- Value of the integer part of the argument arg
<b>frac</b>- Value of the decimal places of the argument arg
Reward points if useful
Regards
Anji
Message was edited by:
Anji Reddy Vangala
2007 May 22 7:15 AM
Thanks for the quick reply Anji,
If i store it in a CHAR field, then there is no issues. But my requirement is that i need to store it in the currency field dtvbdpr-grwrt only.
Regards,
Raman
2007 May 22 7:20 AM
hi,
Use any of these FM.
HR_IN_ROUND_AMT
HR_NZ_ROUNDING_DECIMALS
Alternatively use the FM's
1) ROUND_AMOUNT
2) FI_ROUND_AMOUNTRegards
Reshma
2007 May 22 7:20 AM
Hi
you can use simply.
dtvbdpr-grwrt = dtvbdpr-grwrt(5) na.
U can use the FM's
ROUND_AMOUNT also for the same purpose.
Regards,
Sreeram Kumar.Madisetty
Message was edited by:
sree ram
2007 May 22 7:28 AM
Hi Sree,
I tried dtvbdpr-grwrt(5) but it gives me a syntax error that this operation cannot be performed on currency fields.
Regards,
Raman
2007 May 22 7:35 AM
2007 May 22 7:38 AM
Hi Raman,
you can't achieve this functionality as system internally treat this field as field with two decimals.
So either you have define a char field and pass value to it.
Reward points if useful.
Regards,
Atish
2007 Nov 04 10:09 AM
Hi Raman,
SAP stores all currency type fields internally with 2 decimals. Currency amout field is linked to the currency and formatted based on the specific currency configuration. For example Bahrain dinar which has decimal places, an amount of 2320.234, will be stored internally as 23202.34. So the requirement for rounding shoulb be based on currency.
This might be helpful to you .
<a href="http://raviinsap.blogspot.com/2007/10/roundinf-off-of-amount-fields-in-sap.html">Rounding off Amount fields in SAP</a>
Ravi
2007 Nov 04 10:12 AM
Hi Raman,
Alternatively, you can define a new currency just for your purpose with number of decimals 0, similar to Japanese yen.
Ravi
2007 Nov 05 2:26 AM
Hi USe :
Write dtvbdpr-grwrt to l_grwrt CURRENCY 'JPY' .
where l_grwrt will be type C(15)
It will work!!
Thanks Praveen
2007 Nov 05 8:58 AM
For moving currency amounts into your field, you should use FM CURRENCY_AMOUNT_IDOC_TO_SAP. For displaying the amount from your field, you should use either WRITE ... CURRENCY ... either FM CURRENCY_AMOUNT_SAP_TO_IDOC. By this may, SAP always take care of decimals according to the currency and you never have to multiply or divide by 100.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |