<?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 Dynamic Where clause in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712322#M311514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;I want to create the dynamic where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: GI_WHERE(72) OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;INTO TABLE GI_VBAK&lt;/P&gt;&lt;P&gt;FROM VBAK&lt;/P&gt;&lt;P&gt;WHERE (GI_WHERE).&lt;/P&gt;&lt;P&gt;In that where clause contain ranges.&lt;/P&gt;&lt;P&gt;for eg.&lt;/P&gt;&lt;P&gt;GI_WHERE = 'VBELN IN S_VBELN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Suresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Oct 2006 18:11:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-24T18:11:47Z</dc:date>
    <item>
      <title>Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712322#M311514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;I want to create the dynamic where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: GI_WHERE(72) OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;INTO TABLE GI_VBAK&lt;/P&gt;&lt;P&gt;FROM VBAK&lt;/P&gt;&lt;P&gt;WHERE (GI_WHERE).&lt;/P&gt;&lt;P&gt;In that where clause contain ranges.&lt;/P&gt;&lt;P&gt;for eg.&lt;/P&gt;&lt;P&gt;GI_WHERE = 'VBELN IN S_VBELN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Suresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 18:11:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712322#M311514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-24T18:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712323#M311515</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 believe you cannot use variables in the dynamic where clause..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It can only be literals..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allowing&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;data: itab(72) occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab = ' MATNR = ''TEST'' '.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from mara&lt;/P&gt;&lt;P&gt;       where (itab).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not allowing (giving short dump)&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;TABLES: MARA.&lt;/P&gt;&lt;P&gt;data: itab(72) 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;&lt;/P&gt;&lt;P&gt;itab = ' MATNR IN SO_MATNR '.&lt;/P&gt;&lt;P&gt;APPEND ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from mara&lt;/P&gt;&lt;P&gt;       where (itab).&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;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2006 18:24:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712323#M311515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-24T18:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712324#M311516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can do this by building a String of what you want to put in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;DATA: where_string type string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate where_string 'VBELN IN S_VBELN' into where_string separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use variable to build this string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also check if this variable is having any value and then build&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if var is not initial.&lt;/P&gt;&lt;P&gt;build the where_stirng here.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use it like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM table_name into table it_tab where ( where_string ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2006 07:55:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712324#M311516</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2006-10-25T07:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712325#M311517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can do this the syntax is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from (query_table) into &amp;lt;itab&amp;gt; where (options).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options is of type standard table of RFC_DB_OPT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in options you would pass values like&lt;/P&gt;&lt;P&gt;CARRID = 'LH'&lt;/P&gt;&lt;P&gt;check this code in FM RFC_READ_TABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Oct 2006 09:47:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712325#M311517</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-10-29T09:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712326#M311518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Suresh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are already working an 6.40 (or higher) than you can simply concatenate the WHERE condition into a string and code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  gd_where_conditions  TYPE string.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT * FROM ...&lt;/P&gt;&lt;P&gt;   WHERE ( gd_where_conditions ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if you are working on 6.20 (or less) than you could use the following function module to create your dynamic WHERE condition(s): RH_DYNAMIC_WHERE_BUILD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function module returns the WHERE conditions in CONDTAB. Thus, you could code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_s_clause.&lt;/P&gt;&lt;P&gt;TYPES:   line(72)  TYPE c.&lt;/P&gt;&lt;P&gt;TYPES: END OF ty_s_clause.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  gt_where_clauses  TYPE STANDARD TABLE OF ty_s_clause&lt;/P&gt;&lt;P&gt;                    WITH DEFAULT KEY.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  gt_condtab     TYPE STANDARD TABLE OF hrcond.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill gt_condtab with the required conditions&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'RH_DYNAMIC_WHERE_BUILD'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            dbtable         = space " can be empty&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            condtab         = gt_condtab&lt;/P&gt;&lt;P&gt;            where_clause    = gt_where_clauses&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            empty_condtab   = 01&lt;/P&gt;&lt;P&gt;            no_db_field     = 02&lt;/P&gt;&lt;P&gt;            unknown_db      = 03&lt;/P&gt;&lt;P&gt;            wrong_condition = 04.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select your data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  SELECT * FROM ...&lt;/P&gt;&lt;P&gt;    WHERE (gt_where_clauses).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls mark all hlpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Oct 2006 09:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712326#M311518</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-10-29T09:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712327#M311519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please find the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gi_where TYPE STANDARD TABLE OF rsdswhere,&lt;/P&gt;&lt;P&gt;      wa_where TYPE rsdswhere.&lt;/P&gt;&lt;P&gt;*rsdswhere is the structure to be used for dynamic where &lt;/P&gt;&lt;P&gt;*conditions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_where = 'VBELN IN S_VBELN'.&lt;/P&gt;&lt;P&gt;  APPEND wa_where TO gi_where.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT *&lt;/P&gt;&lt;P&gt;  FROM VBAK&lt;/P&gt;&lt;P&gt;  INTO it_vbak&lt;/P&gt;&lt;P&gt;  WHERE gi_where.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghavendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 06:30:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712327#M311519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T06:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Where clause</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712328#M311520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;CONCATENATE 'VBELN' 'IN' 'S_VBELN.'&lt;/P&gt;&lt;P&gt;INTO CONDITION SEPARATED BY SPACE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM VBAK INTO TABLE GI_VBAK&lt;/P&gt;&lt;P&gt;WHERE (CONDITION).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also have a look at below info.&lt;/P&gt;&lt;P&gt;To specify a condition dynamically, use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT... WHERE (itab)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where itab is an internal table with line type c and maximum length 72 characters. All of the conditions listed above except for selection tables, can be written into the lines of itab. However, you may only use literals, and not the names of data objects. The internal table itab can also be left empty. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you only want to specify a part of the condition dynamically, use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT... WHERE cond AND (itab)...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot link a static and a dynamic condition using OR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may only use dynamic conditions in the WHERE clause of the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 06:36:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-where-clause/m-p/1712328#M311520</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T06:36:46Z</dc:date>
    </item>
  </channel>
</rss>

