<?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 variable table name in native SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816131#M1681690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;We have an ABAP program which writes data to a database, then updates a header table to say it is finished.&amp;nbsp; Our problem is that the program is run from various different places, so the header table is different each time, so we tried to pass the table name as an input. e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT z_myData.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN:...&lt;/P&gt;&lt;P&gt;PARAMETERS: ip_table.&lt;/P&gt;&lt;P&gt;PARAMETERS: ip_ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...connect to oracle database...&lt;/P&gt;&lt;P&gt;...write data... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UPDATE :ip_table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET FINISHED = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE DOWNLOAD_ID = :ip_ID&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...commit...&lt;/P&gt;&lt;P&gt;...disconnect...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great if we change it to "UPDATE z_table1...", but returns an oracle error "ORA-00903: invalid table name" with the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can the table name be passed in this way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Jun 2012 07:41:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-06-15T07:41:26Z</dc:date>
    <item>
      <title>variable table name in native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816131#M1681690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;We have an ABAP program which writes data to a database, then updates a header table to say it is finished.&amp;nbsp; Our problem is that the program is run from various different places, so the header table is different each time, so we tried to pass the table name as an input. e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT z_myData.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN:...&lt;/P&gt;&lt;P&gt;PARAMETERS: ip_table.&lt;/P&gt;&lt;P&gt;PARAMETERS: ip_ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...connect to oracle database...&lt;/P&gt;&lt;P&gt;...write data... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXEC SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UPDATE :ip_table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET FINISHED = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE DOWNLOAD_ID = :ip_ID&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...commit...&lt;/P&gt;&lt;P&gt;...disconnect...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great if we change it to "UPDATE z_table1...", but returns an oracle error "ORA-00903: invalid table name" with the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can the table name be passed in this way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 07:41:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816131#M1681690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-06-15T07:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: variable table name in native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816132#M1681691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot use dynamic variables with native sql. Use &lt;SPAN class="h1"&gt;ADBC &lt;/SPAN&gt;classes and do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer the documentation here: &lt;A href="http://help.sap.com/abapdocu_702/en/abenadbc.htm" title="http://help.sap.com/abapdocu_702/en/abenadbc.htm"&gt;http://help.sap.com/abapdocu_702/en/abenadbc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the demo program adbc_demo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 07:52:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816132#M1681691</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2012-06-15T07:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: variable table name in native SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816133#M1681692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you look into using the ADBC functionality?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/abapdocu_702/en/abenadbc.htm"&gt;http://help.sap.com/abapdocu_702/en/abenadbc.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would be able to dynamically construct the query, as in this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/abapdocu_702/en/abenadbc_query_abexa.htm"&gt;http://help.sap.com/abapdocu_702/en/abenadbc_query_abexa.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. somebody was quicker &lt;SPAN __jive_emoticon_name="laugh" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/797/images/emoticons/laugh.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 07:55:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/variable-table-name-in-native-sql/m-p/8816133#M1681692</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2012-06-15T07:55:00Z</dc:date>
    </item>
  </channel>
</rss>

