<?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: Select statement queries. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827756#M353010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess you should build logic similar to below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters: p_table type tabname,
            p_field type fieldname.

concatenate p_table 'XXX'  into p_table.

select * into itab
  from (p_table)
  where &amp;lt;cond&amp;gt;.
  
  
select single fieldname into p_field
  from dd03l 
  where tabname = p_table
  and   fieldname = p_field.
  
If sy-subrc eq 0.
  write:/ 'Yes the field exists in table'.
Else.
  write:/ 'No the field doesnt exist'.
Endif.&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>Mon, 29 Jan 2007 05:33:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-29T05:33:57Z</dc:date>
    <item>
      <title>Select statement queries.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827755#M353009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to write code for the following two requirements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I am accepting a value as parameter in p_param (say). I am then concatenating a few characters to this value in p_param and putting it back in p_param. Now I want perform a select statement with the value in p_param as the table name in the select statement. Although a table with the value in p_param exists, the system is not allowing me to use the parameter p_param in the select statement saying that p_param is not defined in DataBase Dictionary as Table or projection or database view. But I would still like to use it in select statement. How can I do it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. The user inputs the name of a field as a parameter in p_field. I want to first check if the database table contains any field with the name the User entered in p&lt;/P&gt;&lt;P&gt;_field. How do I write this logic?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 05:27:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827755#M353009</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T05:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement queries.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827756#M353010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess you should build logic similar to below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters: p_table type tabname,
            p_field type fieldname.

concatenate p_table 'XXX'  into p_table.

select * into itab
  from (p_table)
  where &amp;lt;cond&amp;gt;.
  
  
select single fieldname into p_field
  from dd03l 
  where tabname = p_table
  and   fieldname = p_field.
  
If sy-subrc eq 0.
  write:/ 'Yes the field exists in table'.
Else.
  write:/ 'No the field doesnt exist'.
Endif.&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>Mon, 29 Jan 2007 05:33:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827756#M353010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T05:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select statement queries.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827757#M353011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran,&lt;/P&gt;&lt;P&gt; Adding to Eswar's reply, U can even check that whether the table with that name exists or not in table DD02L. Like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_table type tabname,&lt;/P&gt;&lt;P&gt;            p_field type fieldname.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;concatenate p_table 'XXX'  into p_table.&lt;/P&gt;&lt;P&gt;select single tabname from dd02l into tabname where tabname = p_table.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt; Message 'Table Exists'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt; Message 'Table Does not exist'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-SatyaPriya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jan 2007 04:06:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement-queries/m-p/1827757#M353011</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-30T04:06:43Z</dc:date>
    </item>
  </channel>
</rss>

