Former Member

abap % calc

Hi ,

i have a requirment where i need to calculate the % discount for a order.

actual value before discount i_value = 165.

discount rate = 75.23%.

net value after discount will be = 40.87 (output)

able to get i_value as = 165.

discount value i am getting while reading into variable is = 752.30-

Can you please let me know how to calculate to get the value as '40.87'.

Vind.

10|10000 characters needed characters exceeded

• Former Member
Posted on Sep 28, 2007 at 12:42 PM

hi,

try like this.

If discout on 100 is 75.23 so how much on 165?

means (165 * 75.23)/ 100.

now subtract that value from 165.

reward if useful.

10|10000 characters needed characters exceeded
• Former Member
Posted on Sep 28, 2007 at 12:48 PM

Hi

data: P type p decimals 2, dis type p decimals 2.

dis = 165 * 7523 / 10000.

p = 165 - dis.

write / P.

Regards

anji

10|10000 characters needed characters exceeded
• Former Member Former Member

Hi,

U can use ABS to avoid '-' sign.

<b>i_per = ABS( i_per ).</b>

Regards,

• Former Member
Posted on Sep 28, 2007 at 12:49 PM

Hello Vind,

Check this:

```REPORT ZV_TEST_SDN .

PARAMETERS: INPUT TYPE P DECIMALS 2,
DISCOUNT TYPE P DECIMALS 2.

DATA: OUTPUT TYPE P DECIMALS 2,
INPUT1 LIKE OUTPUT.
INPUT1 = INPUT / 100.
DISCOUNT = DISCOUNT * INPUT1.
OUTPUT =  INPUT - DISCOUNT.
WRITE OUTPUT.
```

Cheers,

Vasanth