Skip to Content
-1

get current year in ABAP CDS view

Hello,

I need to get the revenue of the current year in my ABAP CDS view. I tried using the environment variables which provides me the entire date. Is there any feature in ABAP CDS where I can I simply get the year like I get lv_date+0(4) in ABAP ?

Thanks,

Kabir

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Feb 09 at 07:48 AM
    Add comment
    10|10000 characters needed characters exceeded

    • The idea is to get the year from system date. for e.g. (20170101). The idea was I'll get 2017 as result. I plead guilty to my stupidity in calling function in parameter declarations. An act of desparation.

  • Mar 23 at 10:02 PM

    I used AMDP and Table Functions to overcome this.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 30 at 10:21 AM

    use Parameter Annotation to pass ABAP system field value to Input Parameter

    define view ZSAM2 
    with parameters 
        @Environment.systemField : #SYSTEM_DATE
        p_cdate : abap.dats 
    as select from scarr {
        carrid,
        carrname,
        :p_cdate as today
    }
    Add comment
    10|10000 characters needed characters exceeded