<?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 problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511908#M844800</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;Try using Select single *.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arunsri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2008 10:14:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-27T10:14:50Z</dc:date>
    <item>
      <title>select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511906#M844798</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 am trying to fetch data from table s003 into internal table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have selection screen designed for entering fields as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)material&lt;/P&gt;&lt;P&gt;2)sales organization&lt;/P&gt;&lt;P&gt;3)distribution channel&lt;/P&gt;&lt;P&gt;4)currency&lt;/P&gt;&lt;P&gt;5)period&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now the problem is when ever user fills any one or some or all of  input selection screen fields, only data relating to that should be fetchd from table s003.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example,... here when i give material number, all the data based on this material only should be fetched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what is happening is , all the records in the table s003 are being fetched. if i give only one input screen field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my code. please correct and suggest me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;___________________________________________&lt;/P&gt;&lt;P&gt;REPORT  Zmaterial_analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: MVKE, S003, MCS0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;       SPBUP  LIKE S003-SPBUP,&lt;/P&gt;&lt;P&gt;       VKORG  LIKE S003-VKORG,&lt;/P&gt;&lt;P&gt;       VTWEG  LIKE S003-VTWEG,&lt;/P&gt;&lt;P&gt;       MATNR LIKE S003-MATNR,&lt;/P&gt;&lt;P&gt;       STWAE  LIKE S003-STWAE,&lt;/P&gt;&lt;P&gt;       AENETWR LIKE S003-AENETWR,&lt;/P&gt;&lt;P&gt;       UMNETWR LIKE S003-UMNETWR,&lt;/P&gt;&lt;P&gt;       UMMENGE LIKE S003-UMMENGE,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      MVGR1  LIKE MVKE-MVGR1,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      MVGR2  LIKE MVKE-MVGR2,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      MVGR3  LIKE MVKE-MVGR3,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  END OF ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF I_MVKE OCCURS 0,&lt;/P&gt;&lt;P&gt;      MATNR LIKE MVKE-MATNR,&lt;/P&gt;&lt;P&gt;      MVGR1 LIKE MVKE-MVGR1,&lt;/P&gt;&lt;P&gt;      MVGR2 LIKE MVKE-MVGR2,&lt;/P&gt;&lt;P&gt;      MVGR3 LIKE MVKE-MVGR3,&lt;/P&gt;&lt;P&gt;      END OF I_MVKE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-003.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_MATNR FOR S003-MATNR.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_VKORG FOR S003-VKORG.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_VTWEG FOR S003-VTWEG.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK B1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_STWAE FOR S003-STWAE NO INTERVALS NO-EXTENSION.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK B2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-002.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: S_SPBUP FOR MCS0-SPBUP.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK B3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SPBUP&lt;/P&gt;&lt;P&gt;         VKORG&lt;/P&gt;&lt;P&gt;         VTWEG&lt;/P&gt;&lt;P&gt;         MATNR&lt;/P&gt;&lt;P&gt;         STWAE&lt;/P&gt;&lt;P&gt;         AENETWR&lt;/P&gt;&lt;P&gt;         UMNETWR&lt;/P&gt;&lt;P&gt;         UMMENGE&lt;/P&gt;&lt;P&gt;  FROM S003&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE ITAB&lt;/P&gt;&lt;P&gt;  WHERE MATNR IN S_MATNR&lt;/P&gt;&lt;P&gt;  OR VKORG IN S_VKORG&lt;/P&gt;&lt;P&gt;  OR VTWEG IN S_VTWEG&lt;/P&gt;&lt;P&gt;  OR SPBUP IN S_SPBUP&lt;/P&gt;&lt;P&gt;  OR STWAE EQ S_STWAE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT MATNR MVGR1 MVGR2 MVGR3 FROM MVKE&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE I_MVKE&lt;/P&gt;&lt;P&gt;  FOR ALL ENTRIES IN ITAB&lt;/P&gt;&lt;P&gt;  WHERE MATNR EQ ITAB-MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;    WRITE:/ ITAB-MATNR,ITAB-VKORG,ITAB-VTWEG.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 10:09:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511906#M844798</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T10:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511907#M844799</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;replace all ORs with ANDs in your selection:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SPBUP&lt;/P&gt;&lt;P&gt;VKORG&lt;/P&gt;&lt;P&gt;VTWEG&lt;/P&gt;&lt;P&gt;MATNR&lt;/P&gt;&lt;P&gt;STWAE&lt;/P&gt;&lt;P&gt;AENETWR&lt;/P&gt;&lt;P&gt;UMNETWR&lt;/P&gt;&lt;P&gt;UMMENGE&lt;/P&gt;&lt;P&gt;FROM S003&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE ITAB&lt;/P&gt;&lt;P&gt;WHERE MATNR IN S_MATNR&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt; VKORG IN S_VKORG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt; VTWEG IN S_VTWEG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt; SPBUP IN S_SPBUP&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt; STWAE EQ S_STWAE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;P&gt;ec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 10:14:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511907#M844799</guid>
      <dc:creator>JozsefSzikszai</dc:creator>
      <dc:date>2008-02-27T10:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511908#M844800</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;Try using Select single *.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arunsri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 10:14:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511908#M844800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T10:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511909#M844801</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;Do like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SPBUP&lt;/P&gt;&lt;P&gt;VKORG&lt;/P&gt;&lt;P&gt;VTWEG&lt;/P&gt;&lt;P&gt;MATNR&lt;/P&gt;&lt;P&gt;STWAE&lt;/P&gt;&lt;P&gt;AENETWR&lt;/P&gt;&lt;P&gt;UMNETWR&lt;/P&gt;&lt;P&gt;UMMENGE&lt;/P&gt;&lt;P&gt;FROM S003&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE ITAB&lt;/P&gt;&lt;P&gt;WHERE MATNR IN S_MATNR&lt;/P&gt;&lt;P&gt;AND VKORG IN S_VKORG&lt;/P&gt;&lt;P&gt;AND  VTWEG IN S_VTWEG&lt;/P&gt;&lt;P&gt;AND SPBUP IN S_SPBUP&lt;/P&gt;&lt;P&gt;AND  STWAE EQ S_STWAE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab[] is initial.&lt;/P&gt;&lt;P&gt;SELECT MATNR MVGR1 MVGR2 MVGR3 FROM MVKE&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE I_MVKE&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN ITAB&lt;/P&gt;&lt;P&gt;WHERE MATNR EQ ITAB-MATNR.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 10:17:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511909#M844801</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2008-02-27T10:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511910#M844802</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;You r using OR in ur select query  for where conditon this means any of the input field is entered  then the  data  is fetching.&lt;/P&gt;&lt;P&gt;If u use AND in select query u will get relevent data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;kavitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 10:22:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511910#M844802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T10:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511911#M844803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for quick reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i am facing the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;not problem with the second select query in the code that i have put.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please look at the first one only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if i use in the where clause&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;or&lt;/STRONG&gt; --&amp;gt; it is fetching all the records in database table.( when one selection screen input is given on screen.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;--&amp;gt; it is not fetching at all any records if all the fields are not filled mandatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my problem is all the fields on selection screen are not mandatory. so whether i enter single or two or three or four or five(i.e. all screen inputs) i should get records basing on that selection criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one more thing is u have to observe is my screen fields are select-optins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: krishna chaitanya on Feb 27, 2008 11:44 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 10:42:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511911#M844803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T10:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: select query problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511912#M844804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks to one and all of you for efforts in replying to my question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my problem is solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have used and in the where clause&lt;/P&gt;&lt;P&gt;but for selection field of type cuky i used or operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is some problem with cuky type on select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if use and operator for that type, data is not fetched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks to all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am awarding points to all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:09:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-problem/m-p/3511912#M844804</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:09:53Z</dc:date>
    </item>
  </channel>
</rss>

