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

abap % calc

Former Member
0 Likes
1,013

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'.

Thanks in advance,

Vind.

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'.

Thanks in advance,

Vind.

5 REPLIES 5
Read only

Former Member
0 Likes
969

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.

Read only

Former Member
0 Likes
969

Hi

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

dis = 165 * 7523 / 10000.

p = 165 - dis.

write / P.

Regards

anji

Read only

0 Likes
969

Hi ,

i am able to get the per value in the variable i_per = 752.30- .

This should be shown as 75.23% on the sap script.

Please let me know how to get this and avoid the '-' sign at the end .

Thanks,

Vind.

Read only

0 Likes
969

Hi,

U can use ABS to avoid '-' sign.

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

Regards,

Padmam.

Read only

Former Member
0 Likes
969

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