<?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: Dynamic SQL oder n-records with condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541531#M1935995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure to get your point correctly, but I guess you could play around with a outer join on the same table (using 2 different aliases and removing duplicates afterwards) and then check your result table against input entries to find out if you have a full match or not. In other words, with PETER, PAUL, MARY you will get 3 entries with the same lastname (means it's a match); With PETER, MARY you will get the same 3 entries (so 2 input for 3 given in the result set, so no matching), ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Feb 2016 13:42:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2016-02-23T13:42:00Z</dc:date>
    <item>
      <title>Dynamic SQL oder n-records with condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541530#M1935994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assming I got a database table just with the fields&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;firstname&lt;/LI&gt;&lt;LI&gt;lastname&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assumung the table is filled with:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;firstname&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;lastname&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;peter&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;nixon&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;paul&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;nixon&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;mary&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;nixon&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;john&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;kennedy&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;james&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;kennedy&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;anna&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;kennedy&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;julia&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;kennedy&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the selection screen there is only the option for the firstnames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the user fills the firstnames with peter, paul, mary&amp;nbsp; I want to get nixon&lt;/P&gt;&lt;P&gt;If the user fills the firstnames with peter mary&amp;nbsp; I want to get a sy-subrc NE 0, because I do not find a matching lastname&amp;nbsp; &lt;/P&gt;&lt;P&gt;If the user fills the firstnames with peter, john,&amp;nbsp; mary&amp;nbsp; I want to get a sy-subrc NE 0, because I do not find a matching&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is tricky because the select should be dynamic.&lt;/P&gt;&lt;P&gt;With oder word: It could have families with e.g. 10 members.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mario&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 10:51:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541530#M1935994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-02-23T10:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL oder n-records with condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541531#M1935995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure to get your point correctly, but I guess you could play around with a outer join on the same table (using 2 different aliases and removing duplicates afterwards) and then check your result table against input entries to find out if you have a full match or not. In other words, with PETER, PAUL, MARY you will get 3 entries with the same lastname (means it's a match); With PETER, MARY you will get the same 3 entries (so 2 input for 3 given in the result set, so no matching), ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 13:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541531#M1935995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-02-23T13:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL oder n-records with condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541532#M1935996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mario,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not think you will be able to do what you have described in ONE SQL Statement. But in two it should be possible. I I had this Problem to solve I would run 2 SELECTs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SELECT lastname Count(*) INTO TABLE ... FROM &amp;lt;your table&amp;gt; GOUP BY lastname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. SELECT lastname Count(*) INTO TABLE ... FROM &amp;lt;your table&amp;gt; GOUP BY lastname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE firstname in &amp;lt;your select-Option&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All entries which have in both result tables the same number in column 2 with the same lastname in column 1 are a match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Oliver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 17:57:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541532#M1935996</guid>
      <dc:creator>oliver_wurm</dc:creator>
      <dc:date>2016-02-23T17:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL oder n-records with condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541533#M1935997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply. I already considered your suggestions. I'd like to find a appropriate SQL Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mario&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2016 05:20:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541533#M1935997</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-02-24T05:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL oder n-records with condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541534#M1935998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a~firstname a~lastname from ztable as a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; left outer join ztable as b on a~lastname = b~lastname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; into [corresponding fields of] table itab&lt;/P&gt;&lt;P&gt;where a~firstname in t_firstname_range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2016 08:53:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-oder-n-records-with-condition/m-p/11541534#M1935998</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-02-25T08:53:17Z</dc:date>
    </item>
  </channel>
</rss>

