<?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 What is wrong in my select statement (using dynamic tables in BAPI) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810834#M1468938</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SAP gurus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a bapi that accepts table name, fields, where to condition dynamically and returns the result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the following statements, I keep getting errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following staments please note that SELECTCOL, TABNAME, WHERECOL and VALUE ARE ALL DYNAMICALLY SENT VIA BAPI IMPORT TABS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I tried&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STATEMENT 1  and THE ERROR I got were as follows&lt;/P&gt;&lt;P&gt;             &lt;/P&gt;&lt;P&gt;  SELECT (SELECTCOL)  &lt;/P&gt;&lt;P&gt;  from (TABNAME) &lt;/P&gt;&lt;P&gt;  WHERE (WHERECOL) = (VALUE) &lt;/P&gt;&lt;P&gt;  into corresponding fields of table &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 1&lt;/P&gt;&lt;P&gt;If the name of the database table is not&lt;/P&gt;&lt;P&gt;determined until runtime, you must specify&lt;/P&gt;&lt;P&gt;an out put area with "INTO.."&lt;/P&gt;&lt;P&gt;=========================================================&lt;/P&gt;&lt;P&gt;STATEMENT 2 and the error I got were as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT (SELECTCOL)&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE &amp;lt;dyn_table&amp;gt;&lt;/P&gt;&lt;P&gt;FROM (TABNAME)&lt;/P&gt;&lt;P&gt;WHERE (WHERECOL) = (VALUE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;incorrect expression "=" in logical condition.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THe select statement works with '*" which gets everything, but I want only the columns that meets the condtion&lt;/P&gt;&lt;P&gt;specified with WHERE Clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback or suggestions will be highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prasad Ram on Mar 27, 2010 6:31 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Mar 2010 05:29:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-27T05:29:17Z</dc:date>
    <item>
      <title>What is wrong in my select statement (using dynamic tables in BAPI)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810834#M1468938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SAP gurus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a bapi that accepts table name, fields, where to condition dynamically and returns the result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the following statements, I keep getting errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the following staments please note that SELECTCOL, TABNAME, WHERECOL and VALUE ARE ALL DYNAMICALLY SENT VIA BAPI IMPORT TABS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I tried&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STATEMENT 1  and THE ERROR I got were as follows&lt;/P&gt;&lt;P&gt;             &lt;/P&gt;&lt;P&gt;  SELECT (SELECTCOL)  &lt;/P&gt;&lt;P&gt;  from (TABNAME) &lt;/P&gt;&lt;P&gt;  WHERE (WHERECOL) = (VALUE) &lt;/P&gt;&lt;P&gt;  into corresponding fields of table &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 1&lt;/P&gt;&lt;P&gt;If the name of the database table is not&lt;/P&gt;&lt;P&gt;determined until runtime, you must specify&lt;/P&gt;&lt;P&gt;an out put area with "INTO.."&lt;/P&gt;&lt;P&gt;=========================================================&lt;/P&gt;&lt;P&gt;STATEMENT 2 and the error I got were as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT (SELECTCOL)&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE &amp;lt;dyn_table&amp;gt;&lt;/P&gt;&lt;P&gt;FROM (TABNAME)&lt;/P&gt;&lt;P&gt;WHERE (WHERECOL) = (VALUE).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;incorrect expression "=" in logical condition.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THe select statement works with '*" which gets everything, but I want only the columns that meets the condtion&lt;/P&gt;&lt;P&gt;specified with WHERE Clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback or suggestions will be highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prasad Ram on Mar 27, 2010 6:31 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Mar 2010 05:29:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810834#M1468938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-27T05:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in my select statement (using dynamic tables in BAPI)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810835#M1468939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Prasad&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the following Sample Code hope this will help you to solve out your problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: itab_ref TYPE REF TO data,
      tabname like RSRD1-TBMA_VAL VALUE 'pa0001',
      fields TYPE string,
      where TYPE string.

CREATE DATA itab_ref TYPE STANDARD TABLE OF (tabname).
FIELD-SYMBOLS: &amp;lt;itab&amp;gt; TYPE STANDARD TABLE.
ASSIGN itab_ref-&amp;gt;* TO &amp;lt;itab&amp;gt;.

DEFINE dselect.
  SELECT (&amp;amp;1) FROM (&amp;amp;2) INTO CORRESPONDING FIELDS OF TABLE &amp;amp;3 WHERE (&amp;amp;4).
END-OF-DEFINITION.

START-OF-SELECTION.
  fields = 'pernr begda endda'.
  where = 'pernr = ''1000'''.
  dselect fields tabname &amp;lt;itab&amp;gt; where.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Reply in case of any Issue,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Mar 2010 06:49:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810835#M1468939</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2010-03-27T06:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in my select statement (using dynamic tables in BAPI)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810836#M1468940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help. It solved my problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 00:50:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-my-select-statement-using-dynamic-tables-in-bapi/m-p/6810836#M1468940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-29T00:50:17Z</dc:date>
    </item>
  </channel>
</rss>

