<?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 ABout SELECT Query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945519#M1335369</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;I have a custom table where user maintains the data in the following format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;project  month  year  amt1  amt2  amt3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proj1   april    2009   100.00  25.50  356.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proj1  may     2009   100.00  25.50  356.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proj1  june   2009   100.00  25.50  356.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i would like to query this table based on Project, Month and Year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from TABLE&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where pspid = v1&lt;/P&gt;&lt;P&gt;and month between v_month1 and v_month2&lt;/P&gt;&lt;P&gt;and year = v_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here v_month1 = april and v_month2 = june.&lt;/P&gt;&lt;P&gt;Hence i would like to get the data from month april to june (april, may and june rows).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to write code for this selection...???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jul 2009 12:52:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-09T12:52:34Z</dc:date>
    <item>
      <title>ABout SELECT Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945519#M1335369</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;I have a custom table where user maintains the data in the following format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;project  month  year  amt1  amt2  amt3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proj1   april    2009   100.00  25.50  356.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proj1  may     2009   100.00  25.50  356.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proj1  june   2009   100.00  25.50  356.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i would like to query this table based on Project, Month and Year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from TABLE&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where pspid = v1&lt;/P&gt;&lt;P&gt;and month between v_month1 and v_month2&lt;/P&gt;&lt;P&gt;and year = v_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here v_month1 = april and v_month2 = june.&lt;/P&gt;&lt;P&gt;Hence i would like to get the data from month april to june (april, may and june rows).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to write code for this selection...???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 12:52:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945519#M1335369</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T12:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: ABout SELECT Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945520#M1335370</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;see the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 select * from TABLE
 into table itab
 where pspid = v1
 and month in ( 'april ' , 'may', 'June').
 and year = v_year.
"Itab contains april may june data
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 select * from TABLE
 into table itab
 where pspid = v1
 and month between v_month1 and v_month2
 and year = v_year.

loop at itab where v_month1in ( 'april ' , 'may', 'June').

append to t_output.

endloop. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or try tjis way..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab .
if v_month1= 'april '  or v_month1=  'may' or v_month1= 'June'.
continue.
else.
delete itab index sy-tabix.
endif.
endloop. 
"Now the itab contains only april may june months data..

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prabhu Das on Jul 9, 2009 6:29 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 12:58:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945520#M1335370</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T12:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABout SELECT Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945521#M1335371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI try this.&lt;/P&gt;&lt;P&gt;select * from TABLE&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where pspid = v1&lt;/P&gt;&lt;P&gt;and month In ( 'april' , 'may' , 'June' )&lt;/P&gt;&lt;P&gt;and year = v_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 12:59:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945521#M1335371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T12:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABout SELECT Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945522#M1335372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh well, you better had made up your mind when creating this custom table. now its too late and you gotta live with it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you really have "april 2009" in your table? cause then you can simple forget about selecting anything of basis on Date.&lt;/P&gt;&lt;P&gt;all you can do is to select all, and when looping over your itab you can try to meet the conditions by string operations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 13:00:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945522#M1335372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T13:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: ABout SELECT Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945523#M1335373</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;The easy answer is to use the month number in the table rather than the name, but I guess you are where you are.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you'll need to do is convert the from and to month to numbers (e.g. april = 04, june = 06).&lt;/P&gt;&lt;P&gt;Then turn this range into a list (e.g. 04, 05, 06).&lt;/P&gt;&lt;P&gt;Then turn the list of numbers into a list of months (e.g. april, may, june)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your select statement you should then check that month is in this list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'd just redesign the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 13:03:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945523#M1335373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T13:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: ABout SELECT Query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945524#M1335374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pavan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, you can't compare the month text and use between operator. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do it by changing the month (char type size 2) field in the custom table and write query based on that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex: if the selection is made for april &amp;amp; june then maintain a internal table(say i_month) with fields index, month text and read this internal table, use the index value in the select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't want to change the custom table, then you can use the internal table(i_month) for month with index, read the index for the selection (say you got 04 for april and 06 for june). Now &lt;/P&gt;&lt;P&gt;loop at i_month where index GE 04 and index LE 06.&lt;/P&gt;&lt;P&gt; maintain a range table for month and populate it here&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;Use this month range field in the select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Muthu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Muthu Prabakaran Selvam on Jul 9, 2009 6:40 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 13:06:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/about-select-query/m-p/5945524#M1335374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T13:06:15Z</dc:date>
    </item>
  </channel>
</rss>

