<?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 Re: Parameters in Open SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268055#M492391</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

PARAMETERS: p_param1 LIKE table-cod_param1

if p_param1 is initial.
Select * into it_table
from table .  " No where condition
else.
Select * into it_table
from table
where cod_param1 = p_param1
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 May 2007 16:30:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-22T16:30:55Z</dc:date>
    <item>
      <title>Parameters in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268054#M492390</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 have defined a parameter:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_param1 LIKE table-cod_param1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to use this parameter in a SQL Sentence and this parameter isn´t obligatory.&lt;/P&gt;&lt;P&gt;How I can build de sentence ??  I don´t have problems if the parameter is defined as select-options.&lt;/P&gt;&lt;P&gt;(this is an example, my sql sentence has many parameters)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * into it_table&lt;/P&gt;&lt;P&gt;from table&lt;/P&gt;&lt;P&gt;where cod_param1 = p_param1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 16:27:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268054#M492390</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T16:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268055#M492391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

PARAMETERS: p_param1 LIKE table-cod_param1

if p_param1 is initial.
Select * into it_table
from table .  " No where condition
else.
Select * into it_table
from table
where cod_param1 = p_param1
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 16:30:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268055#M492391</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T16:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268056#M492392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Since this parameter is not an obligatory field it is always better to declare this as select options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS: p_param1 for table-cod_param1&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;if not p_param1[] is initial.&lt;/P&gt;&lt;P&gt;Select * into it_table&lt;/P&gt;&lt;P&gt;from table&lt;/P&gt;&lt;P&gt;where cod_param1 in p_param1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is declared as parameter, when you don't enter a value it will take space as default value and fetch the wrong data.&lt;/P&gt;&lt;P&gt;where as in select options, even if you don't enter any value it will take all values and fetches the correct values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2007 16:35:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parameters-in-open-sql/m-p/2268056#M492392</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-22T16:35:32Z</dc:date>
    </item>
  </channel>
</rss>

