<?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 How to create a dynamic selection clause? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931698#M1485843</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 to select data from mara using different selection parameters coming from TVARVC but I do not know how to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT matnr
FROM mara
WHERE matnr in r_matnr
   AND mtart in r_mtart.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the users must be able to add or to suppress fields from the where clause. The fields and there values will be in the table TVARVC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT TVARVC

Here must I create ranges from different types to put the values in... (How to do this?)

fieldname (eg MATNR)
fieldvalue (eg MATERIAL-0001)

=&amp;gt; where clause
ENDLOOP

SELECT matnr
FROM MARA
(where).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Apr 2010 14:02:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-26T14:02:22Z</dc:date>
    <item>
      <title>How to create a dynamic selection clause?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931698#M1485843</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 to select data from mara using different selection parameters coming from TVARVC but I do not know how to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT matnr
FROM mara
WHERE matnr in r_matnr
   AND mtart in r_mtart.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the users must be able to add or to suppress fields from the where clause. The fields and there values will be in the table TVARVC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT TVARVC

Here must I create ranges from different types to put the values in... (How to do this?)

fieldname (eg MATNR)
fieldvalue (eg MATERIAL-0001)

=&amp;gt; where clause
ENDLOOP

SELECT matnr
FROM MARA
(where).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Apr 2010 14:02:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931698#M1485843</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-26T14:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic selection clause?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931699#M1485844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the only way is to create several select-options with the values of the clause WHERE fields, so the user can add o not data to those select options.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Apr 2010 15:24:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931699#M1485844</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-26T15:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic selection clause?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931700#M1485845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After a discussion, we decide to change the rules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We decide to write the where clause in SQL It should be simplier but...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA : w_where(60) TYPE c.
 
 LOOP AT tvarvc.
....
  CONCATENATE tvarvc-low
   INTO w_where.
...
 ENDLOOP.

(w_where: MTART = TEST; i tried MTART = "TEST")

   SELECT matnr
    INTO TABLE t_marx
    FROM mara
    WHERE (w_where).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This simple code dump... I try to have MTART = 'TEST' but same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: David31 on Apr 26, 2010 6:58 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Apr 2010 16:46:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931700#M1485845</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-26T16:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic selection clause?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931701#M1485846</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 should have tried with MTART = 'TEST' instead of "TEST". Observe the quotes!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check below sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: i_mara  TYPE TABLE OF mara,
      w_where TYPE string.

CONCATENATE 'MTART =' '''TEST'''  INTO w_where SEPARATED BY space.  "Look at the quotes

SELECT * INTO TABLE i_mara
FROM mara
WHERE (w_where).
WRITE sy-subrc.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check F1 help for more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subject line confused me little bit. It is where clause instead of selection clause:-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Apr 2010 17:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-dynamic-selection-clause/m-p/6931701#M1485846</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2010-04-26T17:35:04Z</dc:date>
    </item>
  </channel>
</rss>

