@EndUserText.label : 'age of data example'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #ALLOWED
define table zage_example {
key client : abap.clnt not null;
key example_no : numc2 not null;
key birthday : dats not null;
}
CLASS zcl_age_example DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_age_example IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
SELECT example_no,
birthday,
dats_days_between( birthday, @sy-datum ) AS age_in_days,
div( dats_days_between( birthday, @sy-datum ), 365 ) AS age_in_years
FROM zage_example
INTO TABLE @DATA(result).
out->write( result ).
ENDMETHOD.
ENDCLASS.
@AbapCatalog.sqlViewName: 'ZAGEOFDATA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'age of data example'
define view AGE_EXAMPLE
as select from zage_example
{
client,
example_no,
birthday,
dats_days_between(birthday,$session.system_date) as age_in_days,
div(dats_days_between(birthday,$session.system_date),365) as age_in_years
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |