<?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: Help with Select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763010#M1461933</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please change that select query for me to understand clearly?&lt;/P&gt;&lt;P&gt;so basically i have to split the original table into 2 internal tables one which has od_docid and one which doesn have od_docid.&lt;/P&gt;&lt;P&gt;and do the selects accrodingly and append to the final table? &lt;/P&gt;&lt;P&gt;it will be helpful if you can change that select query. Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Apr 2010 15:08:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-12T15:08:48Z</dc:date>
    <item>
      <title>Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763007#M1461930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the below select query. The table it_dlv_item has  fields od_docid and docid. I basically want to pull information based on od_docid if thats populated and docid if its not populated.  I have snippet code below but i was wondering if there is an efficient way i could do this without using 2 select statements.  Note: in both the docids is always populated. if the od_docid is populated i want to pull information using that else from the docid. Please let me know ur advice. Thanks!&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if od_docid is not initial.
  SELECT *
   FROM XXX
INTO TABLE i_tab
FOR ALL ENTRIES IN it_dlv_item
  WHERE  docid EQ it_dlv_item-od_docid. 
else.
  SELECT *
   FROM XXX
INTO TABLE  i_tab
FOR ALL ENTRIES IN it_dlv_item
 WHERE  docid EQ it_dlv_item-docid.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 20:40:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763007#M1461930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T20:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763008#M1461931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can do it by constructing dynamic where condition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 22:36:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763008#M1461931</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T22:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763009#M1461932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please check for the below points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. In your internal table if od_docid is populated means, if it is same for all the entries, then simply read the first entry and code as you did now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. If it is different for few entries, then make use of another internal table, where just delete the entries with od_docid is initial and in the original table, delete entries where od_docid is not initial. Now select both and append to final internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Though it is two different select statement in case of pont 1, it will execute only 1 select command. So do not think interms of performance. And do not make it complicate by using dynamic selects here. It is not required in this scenario.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 23:05:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763009#M1461932</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T23:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763010#M1461933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please change that select query for me to understand clearly?&lt;/P&gt;&lt;P&gt;so basically i have to split the original table into 2 internal tables one which has od_docid and one which doesn have od_docid.&lt;/P&gt;&lt;P&gt;and do the selects accrodingly and append to the final table? &lt;/P&gt;&lt;P&gt;it will be helpful if you can change that select query. Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Apr 2010 15:08:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763010#M1461933</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-12T15:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763011#M1461934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also try to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SELECT *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; FROM XXX&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;INTO TABLE&amp;nbsp; i_tab&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR ALL ENTRIES IN it_dlv_item&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; WHERE ( docid EQ it_dlv_item-od_docid &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR docid EQ it_dlv_item-docid ).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 11:45:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763011#M1461934</guid>
      <dc:creator>former_member192854</dc:creator>
      <dc:date>2012-06-15T11:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763012#M1461935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: &amp;amp;quot;courier new&amp;amp;quot;, courier;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: &amp;amp;quot;courier new&amp;amp;quot;, courier;"&gt;Best way to solve this is to have 2 select statements&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: &amp;amp;quot;courier new&amp;amp;quot;, courier;"&gt;Assuming that rows in table it_dlv_item has atleast 1 of this od_docid docid populated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: &amp;amp;quot;courier new&amp;amp;quot;, courier;"&gt;1) Brake your internal table in 2 table , 1 with it_dlv_item-od_docid is not initial(it_div_item_1) &amp;amp; second where it_dlv_item-od_docid is initial(it_div_item_2).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: &amp;amp;quot;courier new&amp;amp;quot;, courier;"&gt;2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; FROM XXX&lt;/P&gt;&lt;P&gt;INTO TABLE i_tab_1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_dlv_item_1&lt;/P&gt;&lt;P&gt;&amp;nbsp; WHERE&amp;nbsp; docid EQ it_dlv_item_1-od_docid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) &lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; FROM XXX&lt;/P&gt;&lt;P&gt;INTO TABLE&amp;nbsp; i_tab_2&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_dlv_item_2&lt;/P&gt;&lt;P&gt; WHERE&amp;nbsp; docid EQ it_dlv_item_2-docid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now add records from table i_tab_1 &amp;amp; i_tab_2 in i_tab&lt;/P&gt;&lt;P&gt;(Note chances are there that you may get duplicate records in I_tab) please delete those according to your logic.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;Raj &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 14:53:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763012#M1461935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-06-15T14:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763013#M1461936</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;I think &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;if od_docid is not initial&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;is useless because &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;od_docid&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp; must be a variable that can't say anyrthing about all records of it_dlv_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; SELECT *&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; FROM XXX&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; INTO CORRESPONDING FIELD OF TABLE i_tab&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; FOR ALL ENTRIES IN it_dlv_item&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; WHERE ( docid EQ it_dlv_item-od_docid&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND NOT EXISTS( SELECT * FROM XXX WHERE docid EQ it_dlv_item-docid ) )&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR&amp;nbsp;&amp;nbsp; docid EQ it_dlv_item-docid. &lt;/STRONG&gt;&lt;/SPAN&gt;&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;Clemens Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 21:53:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-select-query/m-p/6763013#M1461936</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2012-06-15T21:53:45Z</dc:date>
    </item>
  </channel>
</rss>

