<?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 query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078183#M1505583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I suggest do it in a better way. HKONT is not a key field &amp;amp; you are using only one key field in your select statement 'BELNR'. Instead of heaving two select statements, you rather TRY TO use your complete primary key BUKRS, BELNR, GJAHR &amp;amp; LINE ITEM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After selecting the data, loop this itab and filter your data into two separate itabs and also perform any operations and calculation in the same loop. This way, you can avoid 2 selects and fetching data with flash card signs and non-key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jul 2010 14:30:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-07-26T14:30:38Z</dc:date>
    <item>
      <title>Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078181#M1505581</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;S114010001&lt;/P&gt;&lt;P&gt;S118000001&lt;/P&gt;&lt;P&gt;S840100001&lt;/P&gt;&lt;P&gt;S168000001&lt;/P&gt;&lt;P&gt;S840100001&lt;/P&gt;&lt;P&gt;S128000001&lt;/P&gt;&lt;P&gt;S840100001&lt;/P&gt;&lt;P&gt;S128000001&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to write a select queries where I need to pick the entries starting with S11* or S12*.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similar way another query where it picks entries that will not start with S11* or S12*.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single hkont into x_hkont from bseg where&lt;/P&gt;&lt;P&gt; belnr = vbrk-vbeln&lt;/P&gt;&lt;P&gt; and hkont like 'S11%'&lt;/P&gt;&lt;P&gt; or hkont like 'S12%'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will the above query works? also I need other query where hkont is not equal to S11% or S12% that means it should select other than S11* or S12*.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;MS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 14:15:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078181#M1505581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-26T14:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078182#M1505582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you must be carefule with: and / or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single hkont into x_hkont from bseg &lt;/P&gt;&lt;P&gt;where belnr = vbrk-vbeln&lt;/P&gt;&lt;P&gt;and ( hkont like 'S11%'&lt;/P&gt;&lt;P&gt;or hkont like 'S12%' ) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(or better here : use select-options or ranges -&amp;gt;  S_HKONT for BSEG-HKONT )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;btw: this is a "bad" select-query becaus table bseg can rapid increase to 10.000.000++ documents&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so be careful and try to use (here)  tables bsis or bsas - otherwise use first table bkpf&lt;/P&gt;&lt;P&gt;-&amp;gt; and select bseg with key BUKRS,BELNR,GJAHR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;grx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Andreas Mann on Jul 26, 2010 4:28 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 14:28:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078182#M1505582</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2010-07-26T14:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078183#M1505583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I suggest do it in a better way. HKONT is not a key field &amp;amp; you are using only one key field in your select statement 'BELNR'. Instead of heaving two select statements, you rather TRY TO use your complete primary key BUKRS, BELNR, GJAHR &amp;amp; LINE ITEM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After selecting the data, loop this itab and filter your data into two separate itabs and also perform any operations and calculation in the same loop. This way, you can avoid 2 selects and fetching data with flash card signs and non-key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 14:30:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078183#M1505583</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-26T14:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078184#M1505584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suresh.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;definitely follow what kiran said.. but still if you just want your code to work..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you need to put the or condition in bracket..else it wont work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it should be like..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select single hkont into x_hkont from bseg where
belnr = vbrk-vbeln and 
( hkont like 'S11%'                  "===&amp;gt; i have added brackets..
or hkont like 'S12%' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 14:37:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078184#M1505584</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-26T14:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078185#M1505585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - Please do not ask or answer basic questions - thread locked

Rob&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jul 2010 14:47:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/7078185#M1505585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-26T14:47:46Z</dc:date>
    </item>
  </channel>
</rss>

