<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Current date in ABAP CDS views in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174161#M1908468</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since 7.50 there are &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abencds_f1_date_functions.htm"&gt;built-in functions&lt;/A&gt; for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Aug 2016 08:17:37 GMT</pubDate>
    <dc:creator>retired_member</dc:creator>
    <dc:date>2016-08-26T08:17:37Z</dc:date>
    <item>
      <title>Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174155#M1908462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to get current system date into a variable (in the form of parameter) as shown below :&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/749234" width="450" /&gt;&lt;/P&gt;&lt;P&gt;What I need is&amp;nbsp; : If the end date is less than today's date, it's fine(continue with the end date)&amp;nbsp; else replace it with today's date (that's get it from the system's date) . But I am getting error such that it is not supported. &lt;/P&gt;&lt;P&gt;Can anyone suggest a workaround solution at the earliest ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Kind Regards,&lt;/P&gt;&lt;P&gt;Anita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 10:50:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174155#M1908462</guid>
      <dc:creator>anita_dixit</dc:creator>
      <dc:date>2015-07-16T10:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174156#M1908463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anita,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think one (dirty) workaround in your scenario could be to define a second CDS view with identical interface as wrapper and use the parameter as colum output. Maybe you can try something like this (untested):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;1. Adjust your CDS view by adding a column with system date, e.g.:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;define view ZEMP_YEARS_1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;with parameters&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;@Environment.systemField: #SYSTEM_DATE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;@EndUserText.label: 'Test'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;p_start_date : abap.dats&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;as select from ZAD_EMPSTAFFING{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; -- your column fields...&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; $parameters.p_start_date as sydatum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;2. Create new CDS view, e.g.:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;define view ZEMP_YEARS_1_WRAP&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;with parameters&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;@Environment.systemField: #SYSTEM_DATE&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;@EndUserText.label: 'Test'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;p_start_date : abap.dats&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;as select from ZEMP_YEARS_1( p_start_date: $parameters.p_start_date ){&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; -- your column fields...&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; case &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; when ZEMP_YEARS_1.EndDate &amp;lt; ZEMP_YEARS_1.sydatum then ZEMP_YEARS_1.EndDate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else ZEMP_YEARS_1.sydatum end as EndDateU&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps and all the best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Aug 2016 14:36:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174156#M1908463</guid>
      <dc:creator>michaelwurst</dc:creator>
      <dc:date>2016-08-11T14:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174157#M1908464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anita,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abencds_f1_case_expression.htm"&gt;result1, result2, ...&lt;/A&gt; of a CASE expression cannot be parameters (up to now).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, hey, they can be CAST expressions. Therefore, a cheap trick that gives no error in 7.50:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;@AbapCatalog.sqlViewName: 'KELLERH_V_TEST'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;define view kellerh_cds_test&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; with parameters&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Environment.systemField: #SYSTEM_DATE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_start_date : abap.dats&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; as select from demo_expressions&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; dats1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; dats2,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; case when dats2 &amp;lt; $parameters.p_start_date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; then dats2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else cast( $parameters.p_start_date as abap.dats )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end as res&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Horst&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 06:03:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174157#M1908464</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2016-08-12T06:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174158#M1908465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. I did it long time back.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 06:25:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174158#M1908465</guid>
      <dc:creator>anita_dixit</dc:creator>
      <dc:date>2016-08-12T06:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174159#M1908466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot . It worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 06:26:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174159#M1908466</guid>
      <dc:creator>anita_dixit</dc:creator>
      <dc:date>2016-08-12T06:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174160#M1908467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;Is there any way to do arithmatic on date and time fields?&lt;/P&gt;&lt;P&gt;would you pls let me know syntax.&lt;/P&gt;&lt;P&gt;normal CDS view or Query type CDS view (@Analytics.query: true)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2016 08:06:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174160#M1908467</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-26T08:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174161#M1908468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since 7.50 there are &lt;A href="http://help.sap.com/abapdocu_750/en/index.htm?file=abencds_f1_date_functions.htm"&gt;built-in functions&lt;/A&gt; for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2016 08:17:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174161#M1908468</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2016-08-26T08:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174162#M1908469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saif,&lt;/P&gt;&lt;P&gt;I am using normal CDS view (dataCategory: #CUBE).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2016 06:23:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174162#M1908469</guid>
      <dc:creator>anita_dixit</dc:creator>
      <dc:date>2016-09-01T06:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174163#M1908470</link>
      <description>&lt;P&gt;Hi Experts,&lt;BR /&gt;Without using Parameters , do we get the system field in Plain CDS View.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Sumanth&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 05:51:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174163#M1908470</guid>
      <dc:creator>former_member597044</dc:creator>
      <dc:date>2021-09-18T05:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174164#M1908471</link>
      <description>&lt;P&gt;Hi Sumanth,&lt;/P&gt;&lt;P&gt;Maybe, it can help.&lt;/P&gt;&lt;P&gt;"tstmp_to_tims(TSTMP_CURRENT_UTCTIMESTAMP(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL') as SYSTIME ,"&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Carlos&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 00:15:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174164#M1908471</guid>
      <dc:creator>carlos_candido</dc:creator>
      <dc:date>2021-09-24T00:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Current date in ABAP CDS views</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174165#M1908472</link>
      <description>&lt;P&gt;I know this question is old, but I just had the same "challenge".&lt;/P&gt;&lt;P&gt;It depends on the release you are working on.&lt;/P&gt;&lt;P&gt;Release 7.51 and higher provides a session-variable that gives us directly the current date.&lt;/P&gt;&lt;P&gt;$session.system_date&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abencds_f1_session_variable.htm" target="test_blank"&gt;https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abencds_f1_session_variable.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 15:47:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/current-date-in-abap-cds-views/m-p/11174165#M1908472</guid>
      <dc:creator>dob1</dc:creator>
      <dc:date>2023-03-01T15:47:02Z</dc:date>
    </item>
  </channel>
</rss>

