AMDP-CDS 代码
Posted ZJY-1314
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AMDP-CDS 代码相关的知识,希望对你有一定的参考价值。
AMDP :--------------
CLASS zcl_amdp_fi006 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb .
CLASS-METHODS get_faglflext_with_exclusion FOR TABLE FUNCTION zficds006.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_amdp_fi006 IMPLEMENTATION.
METHOD get_faglflext_with_exclusion
BY DATABASE FUNCTION FOR HDB LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY
USING: zfit006d zfit006f zficdsv006b bp001.
_fi040a_bukrs = select mandt, bukrs, zbukrs FROM zfit006d WHERE bukrs = p_bukrs;
_fi040a_bbhc = SELECT DISTINCT mandt, racct_from, racct_to FROM zfit006f WHERE bukrs = p_bukrs;
_fi040a_flext = SELECT b.client, b.rbukrs, b.ryear, b.racct, b.rfarea, b.hslvt, b.hsl,
bbhc.racct_from as zbbhc
from zficdsv006b( p_monat ) as b left join :_fi040a_bbhc as bbhc
on b.client = bbhc.mandt
and b.racct between bbhc.racct_from and bbhc.racct_to
left join bp001 as bp
on b.client = bp.client
* and b.partner = bp.partner
where exists ( select * from :_fi040a_bukrs where mandt = b.client AND ( bukrs = b.rbukrs or zbukrs = b.rbukrs ) );
_fi040a_flext_result = SELECT *
FROM :_fi040a_flext
WHERE zbbhc IS NULL
OR NOT ( zbbhc IS NOT NULL );
RETURN SELECT client, rbukrs, ryear, racct, rfarea, hslvt, hsl FROM :_fi040a_flext_result;
ENDMETHOD.
ENDCLASS.
CDS:--------------------
@EndUserText.label: \'管理合并 - 资产负债表 table function\'
define table function zficds006
with parameters
@Environment.systemField: #CLIENT
clnt : abap.clnt,
p_bukrs : bukrs, // 合并主体
p_monat : monat // 查询期间
returns
client : mandt;
rbukrs : bukrs;
ryear : gjahr;
racct : racct;
rfarea : fkber;
hslvt : hslvt;
//zzfzhslb : zzfzhslb;
//zzfzhsnr : zzfzhsnr;
//zzkunnr : zzkunnr;
//zzlifnr : zzlifnr;
//zzhtbh : zzhtbh;
hsl : hslxx12;
implemented by method
zcl_amdp_fi006=>get_faglflext_with_exclusion;
@AbapCatalog.sqlViewName: \'ZFIDDLS0040B\' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: \'FAGLFLEXT 整理\' define view zficdsv006b with parameters p_month : month as select from faglflext rclnt as client, rbukrs, ryear, racct, rfarea, hslvt, zzassacc01, zzassacc02, zzassacc03, case $parameters.p_month when \'01\' then hslvt + hsl01 when \'02\' then hslvt + hsl01 + hsl02 when \'03\' then hslvt + hsl01 + hsl02 + hsl03 when \'04\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 when \'05\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 when \'06\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 when \'07\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 + hsl07 when \'08\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 + hsl07 + hsl08 when \'09\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 + hsl07 + hsl08 + hsl09 when \'10\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 + hsl07 + hsl08 + hsl09 + hsl10 when \'11\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 + hsl07 + hsl08 + hsl09 + hsl10 + hsl11 when \'12\' then hslvt + hsl01 + hsl02 + hsl03 + hsl04 + hsl05 + hsl06 + hsl07 + hsl08 + hsl09 + hsl10 + hsl11 + hsl12 + hsl13 + hsl14 + hsl15 + hsl16 end as hsl where rldnr = \'0L\' and rrcty = \'0\' and rvers = \'001\'
@AbapCatalog.sqlViewName: \'ZFIDDLS006C\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: \'FAGLFLEXT 整理 SUM\'
define view zficdsv006c
with parameters
p_month : month
as select from zficdsv006b(p_month : $parameters.p_month )
//zficdsv0040b
rbukrs,
ryear,
racct,
sum( hslvt ) as hslvt,
sum( hsl ) as hsl
group by
rbukrs,
ryear,
racct
@AbapCatalog.sqlViewName: \'ZFIDDLS006E\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: \'配置表公司代码行项目\'
define view zficdsv006e
with parameters
p_bukrs : bukrs
as select distinct from zfit006c
//zfit006c
zwz,
zbbhc
where
bukrs = $parameters.p_bukrs
@AbapCatalog.sqlViewName: \'ZFIDDLS006F\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: \'配置表整合\'
define view zficdsv006f
with parameters
p_bukrs : bukrs
as select from zficdsv006d
left outer join zficdsv006e( p_bukrs : $parameters.p_bukrs ) on zficdsv006d.zbbhc = zficdsv006e.zbbhc
and zficdsv006d.zwz = zficdsv006e.zwz
case when zficdsv006e.zbbhc is not null then \'B\' //公司层级
else \'A\' //集团层级
end as ztable,
zficdsv006d.zwz,
zficdsv006d.zbbhc
@AbapCatalog.sqlViewName: \'ZFIDDLS006G\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: \'配置表内容获取\'
define view zficdsv006g
with parameters
p_bukrs : bukrs
as select from zficdsv006f( p_bukrs : $parameters.p_bukrs )
left outer join zfit006 on zfit006.zwz = zficdsv006f.zwz
and zfit006.zbbhc = zficdsv006f.zbbhc
and zficdsv006f.ztable = \'A\'
left outer join zfit006c on zfit006c.zwz = zficdsv006f.zwz
and zfit006c.zbbhc = zficdsv006f.zbbhc
and zfit006c.bukrs = $parameters.p_bukrs
and zficdsv006f.ztable = \'B\'
//zficdsv006f
ztable,
zficdsv006f.zwz,
zficdsv006f.zbbhc,
case when zfit006c.zqzfh is not null then zfit006c.zqzfh
else zfit006.zqzfh
end as zqzfh,
case when zfit006c.zbbxms is not null then zfit006c.zbbxms
else zfit006.zbbxms
end as zbbxms,
case when zfit006c.zhcjs is not null then zfit006c.zhcjs
else zfit006.zhcjs
end as zhcjs,
case when zfit006c.racct_from is not null then zfit006c.racct_from
else zfit006.racct_from
end as racct_from,
case when zfit006c.racct_to is not null then zfit006c.racct_to
else zfit006.racct_to
end as racct_to,
case when zfit006c.zyefx is not null then zfit006c.zyefx
else zfit006.zyefx
end as zyefx,
case when zfit006c.zcyfy is not null then zfit006c.zcyfy
else zfit006.zcyfy
end as zcyfy,
//case when zfit006c.ztscl is not null then zfit006c.ztscl
//else zfit006.ztscl
//end as ztscl,
case when zfit006c.zbz is not null then zfit006c.zbz
else zfit006.zbz
end as zbz
@AbapCatalog.sqlViewName: \'ZFIV001\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: \'银行流水透明表数据整理\'
define view ZFIV_CDS_001
as select from zfit002
left outer join zfit003 on zfit002.bukrs = zfit003.zbfbukrs
and zfit002.zlsm = zfit003.zlsm
bukrs,
left (zfit002.zlsm, 6) as zmonth,
zfit002.zlsm,
left (zfit002.zlsm, 4) as zzyear,
substring(zfit002.zlsm, 5, 2) as zzmonth,
right(zfit002.zlsm, 5) as squence,
cast( left( zfit002.zlsm , 8 ) as abap.dats ) as budat,
zbfzh,
//zye,
zsfse,
zhfse,
zfit003.zssdh,
zfit003.zwlkxxz
@AbapCatalog.sqlViewName: \'ZFIV002\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: \'银行流水期初最大流水码\'
define view ZFIV_CDS_002
as select from ZFIV_CDS_001
//ZFIV_CDS_001
bukrs,
zmonth,
zbfzh,
max( zlsm ) as zlsm
group by
bukrs,
zmonth,
zbfzh
@AbapCatalog.sqlViewName: \'ZFIV003\'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: \'fclm_bam_amd 最新技术标识\'
define view ZFIV_CDS_003
as select from fclm_bam_amd
bukrs,
acc_num,
max( acc_id ) as acc_id
group by
bukrs,
acc_num
Java中普通代码块,构造代码块,静态代码块区别及代码示例2 构造代码块
//执行顺序:(优先级从高到低。)静态代码块>mian方法>构造代码块>构造方法。
其中静态代码块只执行一次。构造代码块在每次创建对象是都会执行。
1 普通代码块
1 //普通代码块:在方法或语句中出现的就称为普通代码块。普通代码块和一般的语句执行顺序由他们在代码中出现的次序决定--“先出现先执行” 2 public class CodeBlock01 3 public static void main(String[] args) 4 5 6 int x=3; 7 System.out.println("1,普通代码块内的变量x="+x); 8 9 10 int x=1; 11 System.out.println("主方法内的变量x="+x); 12 13 14 int y=7; 15 System.out.println("2,普通代码块内的变量y="+y); 16 17 18 19 20 /* 21 运行结果: 22 1,普通代码块内的变量x=3 23 主方法内的变量x=1 24 2,普通代码块内的变量y=7 25 */ 26
2 构造代码块
//构造块:直接在类中定义且没有加static关键字的代码块称为构造代码块。构造代码块在创建对象时被调用,每次创建对象都会被调用,并且构造代码块的执行次序优先于类构造函数。 public class CodeBlock02 System.out.println("第一代码块"); public CodeBlock02() System.out.println("构造方法"); System.out.println("第二构造块"); public static void main(String[] args) new CodeBlock02(); new CodeBlock02(); new CodeBlock02(); /* * 执行结果: 第一代码块 第二构造块 构造方法 第一代码块 第二构造块 构造方法 第一代码块 第二构造块 构造方法 */
3 静态代码块
//静态代码块:在java中使用static关键字声明的代码块。静态块用于初始化类,为类的属性初始化。每个静态代码块只会执行一次。由于JVM在加载类时会执行静态代码块,所以静态代码块先于主方法执行。 //如果类中包含多个静态代码块,那么将按照"先定义的代码先执行,后定义的代码后执行"。 //注意:1 静态代码块不能存在于任何方法体内。2 静态代码块不能直接访问静态实例变量和实例方法,需要通过类的实例对象来访问。 class Code System.out.println("Code的构造块"); static System.out.println("Code的静态代码块"); public Code() System.out.println("Code的构造方法"); public class CodeBlock03 System.out.println("CodeBlock03的构造块"); static System.out.println("CodeBlock03的静态代码块"); public CodeBlock03() System.out.println("CodeBlock03的构造方法"); public static void main(String[] args) System.out.println("CodeBlock03的主方法"); new Code(); new Code(); new CodeBlock03(); new CodeBlock03(); /* CodeBlock03的静态代码块 CodeBlock03的主方法 Code的静态代码块 Code的构造块 Code的构造方法 Code的构造块 Code的构造方法 CodeBlock03的构造块 CodeBlock03的构造方法 CodeBlock03的构造块 CodeBlock03的构造方法 */
以上是关于AMDP-CDS 代码的主要内容,如果未能解决你的问题,请参考以下文章
Java中普通代码块,构造代码块,静态代码块区别及代码示例2 构造代码块