在CDS使用中,除常用的日期函数、字符串函数外,还有其它的些函数,在此收集整理.
1.一、整数补零
当一个整数,需要转换为NUMC类型的补0的时候可以LPAD,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
@AbapCatalog.sqlViewName: 'ZV_MONSTERS' @AbapCatalog.compiler.compareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Monster CDS views' define view zcds_monsters as select from ztmonster_header as monster_header inner join ztmonster_items as monster_items on monster_header.db_key = monster_items.db_key left outer join ztmonster_pets as monster_pets on monster_header.monster_number = monster_pets.owner { key monster_header.monster_number as monster_number , monster_header.name as monster_name , LPAD ( monster_header.tax_number, 10 , '0' ) as hat_size , SUBSTRING ( monster_header.name, 1 , 1 ) as first_initial , case monster_header.evilness when 'BANKER_STYLE_EVIL' then 'REALLY SCARY' when 'EVIL' then case monster_header.strength when 'REALLY STRONG ' then 'SCARY' else ' NOT SO SCARY REALLY ' end when 'SLIGHTLY_EVIL' then 'SLIGHTLY SCARY ' else 'NOT REALLY SCARY AT ALL ' end as scariness } where monster_header.sanity < 10 and monster_header.color = 'GREEN' |