Regarding accrual/deferral function in treasury, there is Acc./Defer.Method named "Pro rata temporis with linear discounting", here is the online help:
The amount is accrued/deferred on linear basis over the calculation period and then discounted on a linear basis. This method is used for Commercial Paper, for example.
System will calculate with below steps:
1) calculate interest linearly
amount = flow-bzbetr * hlp_days / flow-atage.
flow-bzbetr nominal interest amt
flow-atage no. of days of the interest period
hlp_days no. of days to key date
2)
hlp_float = ( flow-bzbetr - amount ) /
( 1 + ( hlp_days * flow-pkond
/ ( flow-abastage * 100 ) ) ).
flow-bzbetr nominal Interest amount
amount result of step 1)
hlp_days no. of days to key date
flow-pkond interest rate
flow-abastage base days
3) hlp_float = flow-bzbetr - hlp_float.
amount = hlp_float.
You can find the coding in Function Module: TB_ACCR_DEFR_ACCU_FOR_FLOW.