<?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: select statement problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352951#M1540909</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the IN operator in the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT PROFN&lt;/P&gt;&lt;P&gt;           AUTH&lt;/P&gt;&lt;P&gt;      INTO TABLE I_AUTH&lt;/P&gt;&lt;P&gt;      FROM UST10S&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN I_PROFILES&lt;/P&gt;&lt;P&gt;     WHERE PROFN = I_PROFILES-PROFILE&lt;/P&gt;&lt;P&gt;       AND AKTPS = LC_A&lt;/P&gt;&lt;P&gt;      AND  OBJCT IN ( LC_REL_STRATEGY , LC_COM_CODE ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF Either of one value matches with the field value in the table. the record is fetched and sy-subrc will be 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it shall be useful .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Oct 2010 05:18:12 GMT</pubDate>
    <dc:creator>santosh_kumarm</dc:creator>
    <dc:date>2010-10-20T05:18:12Z</dc:date>
    <item>
      <title>select statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352949#M1540907</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;below select statement's  sy-subrc  is 4.But entry is in table.&lt;/P&gt;&lt;P&gt;i think something wrong in AND ( OBJCT = LC_REL_STRATEGY and OBJCT =  LC_COM_CODE ). &lt;/P&gt;&lt;P&gt;how to rectify this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT PROFN
           AUTH
      INTO TABLE I_AUTH
      FROM UST10S
      FOR ALL ENTRIES IN I_PROFILES
     WHERE PROFN = I_PROFILES-PROFILE
       AND AKTPS = LC_A
      AND ( OBJCT = LC_REL_STRATEGY and OBJCT =  LC_COM_CODE ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 05:05:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352949#M1540907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T05:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: select statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352950#M1540908</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  LC_REL_STRATEGY and  LC_COM_CODE  have different contents you will never get data. Maybe you want an OR for either LC_REL_STRATEGY or LC_COM_CODE   for OBJCT here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 05:11:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352950#M1540908</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T05:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: select statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352951#M1540909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the IN operator in the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT PROFN&lt;/P&gt;&lt;P&gt;           AUTH&lt;/P&gt;&lt;P&gt;      INTO TABLE I_AUTH&lt;/P&gt;&lt;P&gt;      FROM UST10S&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN I_PROFILES&lt;/P&gt;&lt;P&gt;     WHERE PROFN = I_PROFILES-PROFILE&lt;/P&gt;&lt;P&gt;       AND AKTPS = LC_A&lt;/P&gt;&lt;P&gt;      AND  OBJCT IN ( LC_REL_STRATEGY , LC_COM_CODE ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF Either of one value matches with the field value in the table. the record is fetched and sy-subrc will be 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it shall be useful .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 05:18:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352951#M1540909</guid>
      <dc:creator>santosh_kumarm</dc:creator>
      <dc:date>2010-10-20T05:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: select statement problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352952#M1540910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Kumar&lt;/P&gt;&lt;P&gt;I think your query is correct but want to ask some questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-does your table I_AUTH containes only two fields ( PROFN and AUTH)?&lt;/P&gt;&lt;P&gt;-what is LC_A? Is it a constant defined with initial value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;some points&lt;/P&gt;&lt;P&gt;-Before using FOR ALL ENTRIES always check whether your table which you are using for all entires is  empty or not?&lt;/P&gt;&lt;P&gt;-sort it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to add all the primary keys in your where condition. Like, if you have 5 prim keys and don't want them in your selection, then you need to define constants for those 5 prim keys with their initial values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like&lt;/P&gt;&lt;P&gt;Constants: C_KEY1 type PRIM_KEY1 value is intial,&lt;/P&gt;&lt;P&gt;           C_KEY2 type PRIM_KEY2 value is intial,&lt;/P&gt;&lt;P&gt;           C_KEY3 type PRIM_KEY3 value is intial,&lt;/P&gt;&lt;P&gt;           C_KEY4 type PRIM_KEY4 value is intial,&lt;/P&gt;&lt;P&gt;           C_KEY5 type PRIM_KEY5 value is intial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now your query will be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT PROFN&lt;/P&gt;&lt;P&gt;       AUTH&lt;/P&gt;&lt;P&gt;      INTO TABLE I_AUTH&lt;/P&gt;&lt;P&gt;      FROM UST10S&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN I_PROFILES&lt;/P&gt;&lt;P&gt;     WHERE PROFN = I_PROFILES-PROFILE AND&lt;/P&gt;&lt;P&gt;           AKTPS = LC_A  AND&lt;/P&gt;&lt;P&gt;           OBJCT = LC_REL_STRATEGY and&lt;/P&gt;&lt;P&gt;           OBJCT =  LC_COM_CODE &lt;/P&gt;&lt;P&gt;           prim_key1 GT c_key1 &lt;/P&gt;&lt;P&gt;           prim_key2 GT c_key2&lt;/P&gt;&lt;P&gt;           prim_key3 GT c_key3&lt;/P&gt;&lt;P&gt;           prim_key4 GT c_key4&lt;/P&gt;&lt;P&gt;           prim_key5 GT c_key5.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Try this and I hope it will resolve your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Lalit Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 05:20:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-problem/m-p/7352952#M1540910</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T05:20:17Z</dc:date>
    </item>
  </channel>
</rss>

