<?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 for selection-option??? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403038#M817147</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 am trying to select a table from the parameters (range ) , but every time i run it give me a dump witn error in  where ...(itab)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First i declare :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : cond(72) TYPE C,&lt;/P&gt;&lt;P&gt;         itab LIKE TABLE OF cond .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options: p_auart  FOR vbak-auart ,&lt;/P&gt;&lt;P&gt;                      p_vkorg FOR vbak-vkorg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not p_auart is initial.&lt;/P&gt;&lt;P&gt;    cond = 'auart IN p_auart' .&lt;/P&gt;&lt;P&gt;APPEND cond To itab.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the i do select:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from vbak where (itab).&lt;/P&gt;&lt;P&gt;---&amp;gt; I give a dum in where clause....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So could you please help me out of this&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Feb 2008 05:12:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-20T05:12:14Z</dc:date>
    <item>
      <title>Dynamic SQL for selection-option???</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403038#M817147</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 am trying to select a table from the parameters (range ) , but every time i run it give me a dump witn error in  where ...(itab)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First i declare :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : cond(72) TYPE C,&lt;/P&gt;&lt;P&gt;         itab LIKE TABLE OF cond .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options: p_auart  FOR vbak-auart ,&lt;/P&gt;&lt;P&gt;                      p_vkorg FOR vbak-vkorg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not p_auart is initial.&lt;/P&gt;&lt;P&gt;    cond = 'auart IN p_auart' .&lt;/P&gt;&lt;P&gt;APPEND cond To itab.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the i do select:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from vbak where (itab).&lt;/P&gt;&lt;P&gt;---&amp;gt; I give a dum in where clause....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So could you please help me out of this&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 05:12:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403038#M817147</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T05:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for selection-option???</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403039#M817148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friend,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Make the following corrections.Your code will work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the statement- 'itab LIKE TABLE OF cond .' you meant to create a table of the type 'COND' which should be a structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, here lies the problem.In your case COND is a char type variable and you are trying to mimic the table 'itab' from it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a rule of thumb,a table should mimic a std., table or a structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So remove the following lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : cond(72) TYPE C,&lt;/P&gt;&lt;P&gt;itab LIKE TABLE OF cond .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Include the following lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type: begin og itab_record,&lt;/P&gt;&lt;P&gt;        cond(72) TYPE C,&lt;/P&gt;&lt;P&gt;        end of itab_record."Declaration of structure itab_record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: itab type standard table of itab_record initial size 0 with header line."Declaration of the table itab which mimics the       structure itab_record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify these two statements,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cond = 'auart IN p_auart' .&lt;/P&gt;&lt;P&gt;APPEND cond To itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab_record-cond = 'auart IN p_auart' .&lt;/P&gt;&lt;P&gt;append itab_record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other lines are exact,make these changes,execute it and seek my assistance if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lakshmanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 05:32:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403039#M817148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T05:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic SQL for selection-option???</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403040#M817149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best way is to check the contents of ITAB in debug mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per what i see you havent handled the case whereby no input is given to select-option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover P_AUART is &lt;STRONG&gt;select-option&lt;/STRONG&gt;, so your condition should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
If not p_auart[] is initial.  " Note the brackets '[]' as p_auart should be treated as internal table, p_auart without brackets is considered as the WA and it will be empty 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2008 05:37:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-sql-for-selection-option/m-p/3403040#M817149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-20T05:37:02Z</dc:date>
    </item>
  </channel>
</rss>

