First Commit (2026.08.18)
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
class ZCL_CUSTOM_TAX_AMDP definition
|
||||
public
|
||||
final
|
||||
create public .
|
||||
|
||||
public section.
|
||||
|
||||
interfaces IF_AMDP_MARKER_HDB .
|
||||
|
||||
class-methods GET_ASSET_DEPR_PLAN
|
||||
for table function ZTF_ASSET_DEPR .
|
||||
protected section.
|
||||
private section.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_CUSTOM_TAX_AMDP IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD get_asset_depr_plan
|
||||
BY DATABASE FUNCTION
|
||||
FOR HDB
|
||||
LANGUAGE SQLSCRIPT
|
||||
OPTIONS READ-ONLY
|
||||
USING zttax0008 scal_tt_month.
|
||||
|
||||
RETURN
|
||||
select mandt,
|
||||
assettype,
|
||||
assetcode,
|
||||
* assetdate,
|
||||
* aname,
|
||||
* depr_method,
|
||||
* useful_life,
|
||||
month_cnt,
|
||||
start_ym,
|
||||
end_ym,
|
||||
* assetprice,
|
||||
yearmonth,
|
||||
seq_no,
|
||||
|
||||
* Round amt fixed.
|
||||
CASE when seq_no = month_cnt then
|
||||
( dep_amt + assetprice - (dep_amt * month_cnt ))
|
||||
ELSE dep_amt
|
||||
END as dep_amt,
|
||||
waers
|
||||
from (
|
||||
SELECT mandt,
|
||||
assettype,
|
||||
assetcode,
|
||||
* assetdate,
|
||||
* aname,
|
||||
* depr_method,
|
||||
* useful_life,
|
||||
useful_life * 12 as month_cnt,
|
||||
to_varchar(assetdate, 'yyyymm') as start_ym,
|
||||
to_varchar(add_months(assetdate, useful_life * 12 - 1 ), 'YYYYMM') as end_ym,
|
||||
assetprice,
|
||||
q.yearmonth,
|
||||
row_number() over (
|
||||
partition by p.assetcode
|
||||
order by q.yearmonth
|
||||
) as seq_no,
|
||||
|
||||
round(assetprice / (useful_life * 12), 2) as dep_amt,
|
||||
|
||||
waers
|
||||
from zttax0008 as p
|
||||
inner join scal_tt_month as q
|
||||
ON q.yearmonth >= to_varchar(assetdate, 'yyyymm')
|
||||
and q.yearmonth < to_varchar(add_months(assetdate, useful_life * 12 ), 'YYYYMM')
|
||||
where p.depr_method = '1'
|
||||
);
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user