<?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 question in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715219#M312665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Surya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Check the below code to get some idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  tables: ztab.
  select-options: p_fld1 for ztab-fld1,
                  p_fld2 for ztab-fld2,
                  p_fld3 for ztab-fld3,
                  p_fld4 for ztab-fld4,
                  p_fld5 for ztab-fld5.
  .....
  start-of-selection.

    select &amp;lt;fields&amp;gt; into table itab
           from ztab
           where fld1 in p_fld1
           and   fld2 in p_fld2
           and   fld3 in p_fld3
           and   fld4 in p_fld4
           and   fld5 in p_fld5.

   .....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Oct 2006 02:35:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-25T02:35:56Z</dc:date>
    <item>
      <title>Select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715217#M312663</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 have 5 select options on the screen. I want to build a select statment on a z table. user may enter values in atleast one select option. the problem is if I use and in where clause, it is resulting no rows. if I use 'or' for all it returns all rows in the table. suppose user enter a vendor #, then only rows related to that vendor need to be retrieved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your help is appriciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;surya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 22:20:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715217#M312663</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-24T22:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715218#M312664</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;For select-options if you use IN it will automatically filter the records..&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;TABLES: MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: SO_ERSDA FOR MARA-ERSDA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN.&lt;/P&gt;&lt;P&gt;IF SO_MATNR[] IS INITIAL.&lt;/P&gt;&lt;P&gt;  MESSAGE E000.&lt;/P&gt;&lt;P&gt;ENDIF.&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 * FROM MARA&lt;/P&gt;&lt;P&gt;       INTO TABLE ITAB&lt;/P&gt;&lt;P&gt;       WHERE MATNR IN SO_MATNR&lt;/P&gt;&lt;P&gt;       AND   ERSDA IN SO_ERSDA.&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.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 22:27:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715218#M312664</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-24T22:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715219#M312665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Surya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Check the below code to get some idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  tables: ztab.
  select-options: p_fld1 for ztab-fld1,
                  p_fld2 for ztab-fld2,
                  p_fld3 for ztab-fld3,
                  p_fld4 for ztab-fld4,
                  p_fld5 for ztab-fld5.
  .....
  start-of-selection.

    select &amp;lt;fields&amp;gt; into table itab
           from ztab
           where fld1 in p_fld1
           and   fld2 in p_fld2
           and   fld3 in p_fld3
           and   fld4 in p_fld4
           and   fld5 in p_fld5.

   .....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2006 02:35:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715219#M312665</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-25T02:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715220#M312666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   For your case best thing is to use a CHAR type variable to pass the where clause string. That is you can build a string which contains your where clause and the pass it to the select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex.&lt;/P&gt;&lt;P&gt;DATA: where_string type stirng.&lt;/P&gt;&lt;P&gt;if sel_opt1 is not initial.&lt;/P&gt;&lt;P&gt;concatenate where_string 'filed1 IN sel_opt1' to where_string separated by space.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go on building this string and then call. Do not forget to use AND or OR when you are building this string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from table where ( where_string ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Seshatalpasai Madala&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2006 04:56:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715220#M312666</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2006-10-25T04:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715221#M312667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Naren/ Eswar / Madala,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is working fine. but failing due to the difference of internal and external formats of vendor # and po #. I tried to use CONVERSION_EXIT_ALPHA_RANGE_I/O'. I can not able to get the desired results. basically I want to convert ranges to internal / external format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your help is appriciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;surya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2006 14:33:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-question/m-p/1715221#M312667</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-25T14:33:18Z</dc:date>
    </item>
  </channel>
</rss>

