<?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 CDS view Case statement/ Nested condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817033#M42350</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Scenario:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;IF Purch. doc. Category (EKPO-bstyp) = ‘F’ then Display Purchasing Document (EBLEN)for &lt;EM&gt;each unique Material + Vendor (EKKO Table) Combination&lt;/EM&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;IF Purch. doc. Category (EKPO-bstyp) != ‘F’ (or it doesn’t exists) then Display Purchasing Document (EBLEN)where Purch. doc. Category (bstyp) = ‘K’&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;What We have tried : &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;UL&gt; 
  &lt;/UL&gt;
  &lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt;&lt;STRONG&gt;&lt;U&gt;case&lt;/U&gt;&lt;/STRONG&gt;&lt;STRONG&gt;when&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;=&lt;/STRONG&gt;'F'&lt;STRONG&gt;then&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;ebeln&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;when&lt;/STRONG&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;&amp;lt;&amp;gt;&lt;/STRONG&gt;'F'&lt;STRONG&gt;and&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;=&lt;/STRONG&gt;'K'&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;STRONG&gt;then&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;ebeln &lt;STRONG&gt;end&lt;/STRONG&gt;&lt;STRONG&gt;as&lt;/STRONG&gt; PO&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/260003-capture.png" /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Jan 2019 13:55:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2019-01-16T13:55:41Z</dc:date>
    <item>
      <title>CDS view Case statement/ Nested condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817033#M42350</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Scenario:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;IF Purch. doc. Category (EKPO-bstyp) = ‘F’ then Display Purchasing Document (EBLEN)for &lt;EM&gt;each unique Material + Vendor (EKKO Table) Combination&lt;/EM&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;IF Purch. doc. Category (EKPO-bstyp) != ‘F’ (or it doesn’t exists) then Display Purchasing Document (EBLEN)where Purch. doc. Category (bstyp) = ‘K’&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;What We have tried : &lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
  &lt;UL&gt; 
  &lt;/UL&gt;
  &lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt;&lt;STRONG&gt;&lt;U&gt;case&lt;/U&gt;&lt;/STRONG&gt;&lt;STRONG&gt;when&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;=&lt;/STRONG&gt;'F'&lt;STRONG&gt;then&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;ebeln&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;when&lt;/STRONG&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;&amp;lt;&amp;gt;&lt;/STRONG&gt;'F'&lt;STRONG&gt;and&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;=&lt;/STRONG&gt;'K'&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;STRONG&gt;then&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;ebeln &lt;STRONG&gt;end&lt;/STRONG&gt;&lt;STRONG&gt;as&lt;/STRONG&gt; PO&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/260003-capture.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 13:55:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817033#M42350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-16T13:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: CDS view Case statement/ Nested condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817034#M42351</link>
      <description>&lt;P&gt;Your logic seems to be ok only the condition ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;&amp;lt;&amp;gt;&lt;/STRONG&gt;'F' is redundant. Are you facing any issues with these statements?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jan 2019 18:51:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817034#M42351</guid>
      <dc:creator>monalisa_biswal</dc:creator>
      <dc:date>2019-01-16T18:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: CDS view Case statement/ Nested condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817035#M42352</link>
      <description>&lt;P&gt;Why don't you use the direct check in case statement instead of using not equal to F in second condition.When your condition satisfies then if will fill data.If both the conditions doesn't satisfies then use others statements to set default values.&lt;/P&gt;&lt;P&gt;case ekpo.ebeln.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;when&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;=&lt;/STRONG&gt;'F'&lt;STRONG&gt;then&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;ebeln&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;when &lt;/STRONG&gt;ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;bstyp &lt;STRONG&gt;=&lt;/STRONG&gt;'K' &lt;STRONG&gt;then&lt;/STRONG&gt; ekpo&lt;STRONG&gt;.&lt;/STRONG&gt;ebeln &lt;STRONG&gt;end&lt;/STRONG&gt;&lt;STRONG&gt;as&lt;/STRONG&gt; PO&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;when others&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endcase.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 06:51:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817035#M42352</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-17T06:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: CDS view Case statement/ Nested condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817036#M42353</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Refer demo CDS view - DEMO_CDS_SEARCHED_CASE 

cast( case when ekpo.bstyp= 'F'                         // Purchase Order   
              then  ekpo.ebeln
            when ekpo.ebeln = 'K'                        // Contract    
               then  ekpo.ebeln   
            when others 
      end  as ebeln )        as  DocumentNumber

Regards,
Shyam&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jan 2019 07:50:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817036#M42353</guid>
      <dc:creator>ShyamPindiproli</dc:creator>
      <dc:date>2019-01-17T07:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: CDS view Case statement/ Nested condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817037#M42354</link>
      <description>&lt;P&gt;Hello Shyam,&lt;/P&gt;&lt;P&gt;Thank you so much for the
response. Our requirement if Flag=’F’ condition is met for any material +
Vendor combination then we need to ignore all the EBELN records where Flag =
‘K’.&lt;/P&gt;&lt;P&gt;As of now with the use of your
suggested CAST(CASE STATEMENT), we are able to mask the records where Flag=K
with ‘#’, but question is can we remove this record line (#) as well from the
result set.&lt;/P&gt;&lt;P&gt;Attached is the Screenshot for
the same (CAST_CASE_STATEMENT).&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/263248-capture.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 15:42:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817037#M42354</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-17T15:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: CDS view Case statement/ Nested condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817038#M42355</link>
      <description>&lt;P&gt;In case you want to remove then your where clause condition has to do the same. Please share your complete CDS code &lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 08:06:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cds-view-case-statement-nested-condition/m-p/817038#M42355</guid>
      <dc:creator>nabheetscn</dc:creator>
      <dc:date>2019-01-23T08:06:17Z</dc:date>
    </item>
  </channel>
</rss>

