<?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: Dynamic where condition in Select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7705001#M1578388</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also have a strange feeling that the IN operator has been re-invented in this thread...just slightly more complicated.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Feb 2011 15:02:36 GMT</pubDate>
    <dc:creator>ThomasZloch</dc:creator>
    <dc:date>2011-02-18T15:02:36Z</dc:date>
    <item>
      <title>Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704994#M1578381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have 10 fields on selection-screeen. In which ever field the user enters single values or ranges,i should pick that field dynamically and pass that field along with value range to &lt;STRONG&gt;Where&lt;/STRONG&gt; condition of Select statement.How can i achieve this? Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;K Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 06:57:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704994#M1578381</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-18T06:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704995#M1578382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
call function 'RH_DYNAMIC_WHERE_BUILD'
  exporting
    dbtable         = space " can be empty
  tables
    condtab         = gt_condtab
    where_clause    = gt_where_clauses
  exceptions
    empty_condtab   = 01
    no_db_field     = 02
    unknown_db      = 03
    wrong_condition = 04.
            .

select matnr from mara into table itab where (gt_where_clauses).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 07:07:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704995#M1578382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-18T07:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704996#M1578383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.How  the entries should be populated to gt_condtab and gt_where_clauses.When im executing  the FM,entering db name im not getting values in  gt_condtab  and gt_where_clauses. Pls help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;K Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 08:02:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704996#M1578383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-18T08:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704997#M1578384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see the following example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : begin of itab occurs 0,
         matnr like mara-matnr,
end of itab.

ypes: begin of ty_s_clause.
types:   line(72)  type c.
types: end of ty_s_clause.

data : begin of gt_condtab occurs 0.
        include structure hrcond.
data : end   of gt_condtab.

FIELD-SYMBOLS &amp;lt;fs_wherecond&amp;gt; TYPE ty_s_clause.
data:
  gt_where_clauses  type standard table of ty_s_clause
                    with default key.


gt_condtab-field = 'MATNR'.
gt_condtab-opera = 'EQ'.
gt_condtab-low = '000000000000000111'.
append  gt_condtab.
clear  gt_condtab.

call function 'RH_DYNAMIC_WHERE_BUILD'
  exporting
    dbtable         = space " can be empty
  tables
    condtab         = gt_condtab
    where_clause    = gt_where_clauses
  exceptions
    empty_condtab   = 01
    no_db_field     = 02
    unknown_db      = 03
    wrong_condition = 04.
            .
 
select matnr from mara into table itab where (gt_where_clauses).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 08:07:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704997#M1578384</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-18T08:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704998#M1578385</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;Simply check the fields whether they are populated or not and build the where clause.&lt;/P&gt;&lt;P&gt;[Dynamic Where Clause|http://www.howforge.com/dynamic-where-clause-in-abap-4]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 08:13:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704998#M1578385</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-18T08:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704999#M1578386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We can use a simple STRING concatenated also. Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : l_where TYPE string,
       i_marc TYPE STANDARD TABLE OF marc.

CONSTANTS: l_quote TYPE char1 VALUE ''''.

PARAMETERS : p_plant TYPE marc-werks.

CONCATENATE 'WERKS' space '=' space l_quote p_plant l_quote space
            'AND' space 'PERKZ' space '=' space l_quote 'M' l_quote
       INTO l_where RESPECTING BLANKS.

SELECT * FROM marc INTO TABLE i_marc WHERE (l_where).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 08:24:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7704999#M1578386</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-18T08:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7705000#M1578387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are the screen elements PARAMETERS or SELECT-OPTIONS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If they are all SELECT-OPTIONS you can use all the elements in the WHERE clause of the SELECT statement e.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT field1 field2 field3
FROM dbtable
INTO TABLE itab
WHERE
field1 = s_elem1 AND
field2 = s_elem2 AND
field3 = s_elem3 .... so on &amp;amp; so forth&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 08:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7705000#M1578387</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-02-18T08:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic where condition in Select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7705001#M1578388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also have a strange feeling that the IN operator has been re-invented in this thread...just slightly more complicated.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Feb 2011 15:02:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-condition-in-select-statement/m-p/7705001#M1578388</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2011-02-18T15:02:36Z</dc:date>
    </item>
  </channel>
</rss>

