Application Development 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: 

Rounding off tax amt

Former Member
0 Kudos

hi all,

my requirement is i want the tax amount to get round off in different way i.e. if the amount is 1042.36 it shld be like 1045

and if it is 1047.36 it shld get like 1050. os is there any function module or any alternate technique available for this kind of rounding off..?

thanks a lot.

1 ACCEPTED SOLUTION

rajesh_kumar2
Active Participant
0 Kudos

You can use the function module "BKK_STAND_ORDER_AMOUNT_ROUND"

Pass the parameter : I_ROUNDING = 1.

Thanks,

Rajesh

6 REPLIES 6

rajesh_kumar2
Active Participant
0 Kudos

You can use the function module "BKK_STAND_ORDER_AMOUNT_ROUND"

Pass the parameter : I_ROUNDING = 1.

Thanks,

Rajesh

0 Kudos

>

> You can use the function module "BKK_STAND_ORDER_AMOUNT_ROUND"

> Pass the parameter : I_ROUNDING = 1.

>

> Thanks,

> Rajesh

first, thanks a lot for ur reply

its fullfilling my first req. i.e. its giving me 1042.00 for iinput value 1042.42

but its giving me 1040.00 for the amount 1047.42 it should give me the nearest greater value i.e. 1050.

what coould be the solution for this?

0 Kudos

Hi Use the below code .

Even you can make a function module out of it.

Parameter: C_AMOUNT  type  p decimals 2.


DATA: L_AMOUNT1 LIKE BKKSO-T_AMOUNT,
      L_AMOUNT2 LIKE BKKSO-T_AMOUNT,
      l_temp    LIKE BKKSO-T_AMOUNT.



L_AMOUNT1 =   C_AMOUNT / 10..

l_temp = L_AMOUNT1.

l_temp = frac( l_temp ).

L_AMOUNT2 = TRUNC(  L_AMOUNT1 ).


C_AMOUNT =  L_AMOUNT2  * 10.

if l_temp > '0.5' .

  c_amount = c_amount + 10.

elseif ( l_temp >= '0.25' and l_temp <= '0.5' ).

  c_amount = c_amount + 5.

endif.

write c_amount.

Thanks,

Rajesh Kumar.

0 Kudos

>

> Hi Use the below code .

> Even you can make a function module out of it.

>

>

Parameter: C_AMOUNT  type  p decimals 2.
> 
> 
> DATA: L_AMOUNT1 LIKE BKKSO-T_AMOUNT,
>       L_AMOUNT2 LIKE BKKSO-T_AMOUNT,
>       l_temp    LIKE BKKSO-T_AMOUNT.
> 
> 
> 
> L_AMOUNT1 =   C_AMOUNT / 10..
> 
> l_temp = L_AMOUNT1.
> 
> l_temp = frac( l_temp ).
> 
> L_AMOUNT2 = TRUNC(  L_AMOUNT1 ).
> 
> 
> C_AMOUNT =  L_AMOUNT2  * 10.
> 
> if l_temp > '0.5' .
> 
>   c_amount = c_amount + 10.
> 
> elseif ( l_temp >= '0.25' and l_temp <= '0.5' ).
> 
>   c_amount = c_amount + 5.
> 
> endif.
> 
> write c_amount.

>

> Thanks,

> Rajesh Kumar.

Thanks a lot for ur help.....

i have tried it & its working fine i.e. as per my requirement.

thahks again.

kesavadas_thekkillath
Active Contributor
0 Kudos

DATA:lv_rrem TYPE i,
     lv_val TYPE p DECIMALS 2.

lv_val = '1042.36'.  "Pass your values here

COMPUTE lv_rrem = lv_val mod 5.

IF lv_rrem > 0.
  lv_val = CEIL( lv_val ).
  DO.
    COMPUTE lv_rrem =  lv_val mod 5.
    IF lv_rrem = 0.
      EXIT.
    ENDIF.
    add 1 to lv_val.
  ENDDO.
ENDIF.

WRITE lv_val.

Former Member
0 Kudos

Thanks for all the replies.

my issue has been resolved by code given by Mr. Rajesh Kumar

only there was 1 change i.e. it was giving 1085 for 1083. but it should give 1080. so i have just removed the code line


c_amount = c_amount + 5.

and now its working fine

thanks a lot for all the response.