<?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 Problem in select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486604#M1419765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a following query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF customer_name IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;SELECT kunnr FROM kna1 INTO lv_kunnr&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN customer_name&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;name1 = customer_name-NAME1.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when I just give 1 customer_name say Ajay, I should ideally get just 1 KUNNR based on that (based on the data in my system).&lt;/P&gt;&lt;P&gt;But I am getting multiple entries. Where is the mistake?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ajay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Dec 2009 15:48:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-17T15:48:04Z</dc:date>
    <item>
      <title>Problem in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486604#M1419765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a following query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF customer_name IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;SELECT kunnr FROM kna1 INTO lv_kunnr&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN customer_name&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;name1 = customer_name-NAME1.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when I just give 1 customer_name say Ajay, I should ideally get just 1 KUNNR based on that (based on the data in my system).&lt;/P&gt;&lt;P&gt;But I am getting multiple entries. Where is the mistake?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ajay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2009 15:48:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486604#M1419765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-17T15:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486605#M1419766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because you are checking the internal table header line, not the actual table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Dec 17, 2009 11:27 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2009 16:13:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486605#M1419766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-17T16:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486606#M1419767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;place [] for internal table check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

IF customer_name[] IS NOT INITIAL.
SELECT kunnr FROM kna1 INTO lv_kunnr
FOR ALL ENTRIES IN customer_name
WHERE
name1 = customer_name-NAME1.
endselect.
ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; better use thsi way..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare an internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 

types :
  begin of ty_kna1,
     kunnr type kunnr,
end of ty_kna1.

data : 
   it_kna1 type standard table of ty_kna1.

IF customer_name[] IS NOT INITIAL.
SELECT kunnr FROM kna1 INTO table it_kna1
FOR ALL ENTRIES IN customer_name
WHERE
name1 = customer_name-NAME1

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me know if any problem further...&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2009 16:19:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486606#M1419767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-17T16:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486607#M1419768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you have multiple entries in the internal table, your statement (for all entries) will process a select for every entry in internal table customer_name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you only want to select one record from the database table, you have to omit the "for all entries" clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single kunnr &lt;/P&gt;&lt;P&gt;    into lv_kunnr&lt;/P&gt;&lt;P&gt;   from kna1&lt;/P&gt;&lt;P&gt;   where name = customer_name-name1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR, Helmut&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2009 18:44:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-query/m-p/6486607#M1419768</guid>
      <dc:creator>helmut_berger</dc:creator>
      <dc:date>2009-12-17T18:44:47Z</dc:date>
    </item>
  </channel>
</rss>

