<?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 SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206896#M1005387</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's Dynamic SQL and Static SQL? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Difference between DYnami and Static SQL ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody  please share this information?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Jul 2008 07:38:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-15T07:38:43Z</dc:date>
    <item>
      <title>Dynamic SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206896#M1005387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's Dynamic SQL and Static SQL? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Difference between DYnami and Static SQL ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody  please share this information?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 07:38:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206896#M1005387</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T07:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206897#M1005388</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;&lt;STRONG&gt;Dynamic SQL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9d/05b8d660f77f4387d6d054d7655ecb/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9d/05b8d660f77f4387d6d054d7655ecb/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/d2/b685c05725bc4db947d0856daae9b1/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/d2/b685c05725bc4db947d0856daae9b1/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Static SQL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/b9/817f8d8e246e42b9d64be39c736daf/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/b9/817f8d8e246e42b9d64be39c736daf/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/67/1c914e1e96f5498c633c8ec641bd2d/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/67/1c914e1e96f5498c633c8ec641bd2d/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Snehi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: snehi chouhan on Jul 15, 2008 9:42 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 07:42:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206897#M1005388</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T07:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206898#M1005389</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;&lt;A href="http://www.susanto.id.au/papers/DynOpenSQL.asp" target="test_blank"&gt;http://www.susanto.id.au/papers/DynOpenSQL.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex:&lt;/P&gt;&lt;P&gt;  SELECT *&lt;/P&gt;&lt;P&gt;              FROM (w_table)&lt;/P&gt;&lt;P&gt;              INTO CORRESPONDING FIELDS OF  wa_consolidate&lt;/P&gt;&lt;P&gt;             WHERE kappl EQ wa_kona-kappl&lt;/P&gt;&lt;P&gt;               AND kschl EQ wa_t6b2f-kschl&lt;/P&gt;&lt;P&gt;               AND vkorg EQ wa_kona-vkorg&lt;/P&gt;&lt;P&gt;               AND vtweg EQ wa_kona-vtweg&lt;/P&gt;&lt;P&gt;               AND datbi GE p_datbi&lt;/P&gt;&lt;P&gt;               AND knuma EQ wa_kona-knuma.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here table is select ed dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 07:49:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206898#M1005389</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T07:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206899#M1005390</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;It means the table and where condition are managed dynamically in the program, so they aren't hardcoded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: tablename(30) TYPE c.

DATA: t_cond(1000) TYPE c OCCURS 0 WITH HEADER LINE.

DATA: wa TYPE REF TO data.
FIELD-SYMBOLS: &amp;lt;wa&amp;gt; TYPE ANY.

START-OF-SELECTION.

  tablename = 'BKPF'.

* Create a workarea
  CREATE DATA wa TYPE (tablename).
  ASSIGN wa-&amp;gt;* TO &amp;lt;wa&amp;gt;.



  CONCATENATE 'BUKRS =' '''' '1000' '''' INTO t_cond.
  APPEND t_cond.


  CONCATENATE 'AND GJAHR = ' '''' '2008' '''' INTO t_cond.
  APPEND t_cond.

  SELECT * FROM (tablename) INTO &amp;lt;wa&amp;gt; WHERE (t_cond).
  ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query above it can write statically:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM BKPF WHERE BUKRS = '1000'
                                         AND GJAHR = '2008'.
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The main difference is it can't use a SELECT-OPTIONS or RANGES in the dynamic sql, but the WHERE condition has to have constants value only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The performance should be better for the static sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 07:53:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql/m-p/4206899#M1005390</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T07:53:18Z</dc:date>
    </item>
  </channel>
</rss>

