<?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 Calculated field - CDS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715158#M2019393</link>
    <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
  &lt;P&gt;I'm using the CDS in hana studio, I need to have in final report a custom field ZFIELD like this:&lt;/P&gt;
  &lt;P&gt;IF budat =&amp;gt; sy-datum AND budat =&amp;lt; (sy-datum + 30). ZFIELD = '+30D'&lt;/P&gt;
  &lt;P&gt;ELSEIF budat &amp;lt; sy-datum AND budat =&amp;gt; (sy-datum - 30). ZFIELD = '-30D'&lt;/P&gt;
  &lt;P&gt;How can I have?&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 10 Mar 2023 11:08:33 GMT</pubDate>
    <dc:creator>f_allocca</dc:creator>
    <dc:date>2023-03-10T11:08:33Z</dc:date>
    <item>
      <title>Calculated field - CDS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715158#M2019393</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
  &lt;P&gt;I'm using the CDS in hana studio, I need to have in final report a custom field ZFIELD like this:&lt;/P&gt;
  &lt;P&gt;IF budat =&amp;gt; sy-datum AND budat =&amp;lt; (sy-datum + 30). ZFIELD = '+30D'&lt;/P&gt;
  &lt;P&gt;ELSEIF budat &amp;lt; sy-datum AND budat =&amp;gt; (sy-datum - 30). ZFIELD = '-30D'&lt;/P&gt;
  &lt;P&gt;How can I have?&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 11:08:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715158#M2019393</guid>
      <dc:creator>f_allocca</dc:creator>
      <dc:date>2023-03-10T11:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field - CDS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715159#M2019394</link>
      <description>&lt;P&gt;Hello &lt;/P&gt;&lt;P&gt;have an look at &lt;A href="https://4js.com/techdocs/fjs-fgl-manual/index.html#fgl-topics/c_fgl_odiaghdb_005.html" target="test_blank"&gt;https://4js.com/techdocs/fjs-fgl-manual/index.html#fgl-topics/c_fgl_odiaghdb_005.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Christian Fritsch &lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 12:38:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715159#M2019394</guid>
      <dc:creator>former_member128578</dc:creator>
      <dc:date>2023-03-10T12:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated field - CDS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715160#M2019395</link>
      <description>&lt;P&gt;Hi Francesco,&lt;/P&gt;&lt;P&gt;HANA CDS native ? Long time no see... In general documentation with syntax point to same behavior&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/b3d0daf2a98e49ada00bf31b7ca7a42e/de9843e69bd14989b8a592cf3e6c95d7.html" target="test_blank"&gt;https://help.sap.com/docs/SAP_HANA_PLATFORM/b3d0daf2a98e49ada00bf31b7ca7a42e/de9843e69bd14989b8a592cf3e6c95d7.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I didn't tested in CDS but I guess you can figure out with SQL sample below. Ignore the dummy party to create fake data and focus on zfield:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select *,
      case when budat &amp;gt;= current_date and budat &amp;lt;= (add_days(current_date,+30)) then '+30D'
           when budat &amp;lt;  current_date and budat &amp;gt;= (add_days(current_date,-30)) then '-30D'
           else ''
      end                                     as zfield
from 
(select current_date from dummy),
(select '20230305' as budat from dummy union
select '20230310' as budat from dummy union
select '20230311' as budat from dummy union
select '20230312' as budat from dummy union
select '20230315' as budat from dummy);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2147575-image.png" /&gt;&lt;/P&gt;&lt;P&gt;Regards, Fernando Da Rós&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 10:53:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calculated-field-cds/m-p/12715160#M2019395</guid>
      <dc:creator>fedaros</dc:creator>
      <dc:date>2023-03-11T10:53:20Z</dc:date>
    </item>
  </channel>
</rss>

