<?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 query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316583#M794423</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fields specification is madatory while using a select statement.&lt;/P&gt;&lt;P&gt;Onle alternative to it can be as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can define a zstructure with the fields dty01 to dty20 (having same type as the similar elements from pa0167 table  )in it and then use: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1: Declare an internal table itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: itab TYPE TABLE OF ZStructure WITH HEADER LINE.&lt;/P&gt;&lt;P&gt; and then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from pa0167 into CORRESPONDING FIELDS OF TABLE ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards if useful,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2008 06:56:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-23T06:56:21Z</dc:date>
    <item>
      <title>select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316579#M794419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;  below shown is my select query how can i replace it by defining globally the field and using it in select instead of writing dty01 to dty20. please suggest me some procedure with example.&lt;/P&gt;&lt;P&gt;      SELECT pernr endda begda depcv&lt;/P&gt;&lt;P&gt;           dty01 dty01 dty02 dty02&lt;/P&gt;&lt;P&gt;           dty03 dty03 dty04 dty04&lt;/P&gt;&lt;P&gt;           dty05 dty05 dty06 dty06&lt;/P&gt;&lt;P&gt;           dty07 dty07 dty08 dty08&lt;/P&gt;&lt;P&gt;           dty09 dty09 dty10 dty10&lt;/P&gt;&lt;P&gt;           dty11 dty11 dty12 dty12&lt;/P&gt;&lt;P&gt;           dty13 dty13 dty14 dty14&lt;/P&gt;&lt;P&gt;           dty15 dty15 dty16 dty16&lt;/P&gt;&lt;P&gt;           dty17 dty17 dty18 dty18&lt;/P&gt;&lt;P&gt;           dty19 dty19 dty20 dty20&lt;/P&gt;&lt;P&gt;    INTO  TABLE g_i_pa0167&lt;/P&gt;&lt;P&gt;    FROM  pa0167&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN g_i_pa0000&lt;/P&gt;&lt;P&gt;    WHERE pernr EQ g_i_pa0000-pernr&lt;/P&gt;&lt;P&gt;      AND begda LE g_begda&lt;/P&gt;&lt;P&gt;      AND endda GE g_endda.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 06:37:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316579#M794419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T06:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316580#M794420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abinash,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not possible to use Variables within a Select query as an alternative for the field names that are needed to be selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward points if this clarifies,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Kiran&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 06:39:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316580#M794420</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T06:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316581#M794421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  There is no way of avoiding field specification in Select query.&lt;/P&gt;&lt;P&gt;But you can do one thing. Define 'g_i_pa0167'  with the same strucutre of table 'pa0167' and use  '*'(asterisk) in the Select. &lt;/P&gt;&lt;P&gt;this is the only option available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select *  FROM pa0617&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 06:44:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316581#M794421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T06:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316582#M794422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u r using this query again and again u can do this.......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select (column_syntax) from...........&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... (column_syntax) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Instead of static data, a data object column_syntax in brackets can be specified, which, when the command is executed, either contains the syntax shown with the static data, or is initial. The data object column_syntax can be a character-type data object or an internal table with a character-type data type. The syntax in column_syntax, like in the ABAP editor, is not case-sensitive. When specifying an internal table, you can distribute the syntax over multiple rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If column_syntax is initial when the command is executed, columns is implicitly set to * and all columns are read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If columns are specified dynamically without the SINGLE addition, the resulting set is always regarded as having multiple rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;Before Release 6.10, you could only specify an internal table with a flat character-type row type for column_syntax with a maximum of 72 characters. Also, before Release 6.10, if you used the DISTINCT addition for dynamic access to pool tables or cluster tables, this was ignored, but since release 6.10, this causes a known exception. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If column_syntax is an internal table with header line, the table body and not the header line is evaluated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Read out how many flights go to and from a city. The SELECT command is implemented only once in a sub-program. The column data, including aggregate function and the data after GROUP BY, is dynamic. Instead of adding the column data to an internal l_columns table, you could just as easily concatenate it in a character-type l_columns field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM my_select USING `CITYFROM`. &lt;/P&gt;&lt;P&gt;ULINE. &lt;/P&gt;&lt;P&gt;PERFORM my_select USING `CITYTO`. &lt;/P&gt;&lt;P&gt;FORM my_select USING l_group TYPE string. &lt;/P&gt;&lt;P&gt;  DATA: l_columns   TYPE TABLE OF string, &lt;/P&gt;&lt;P&gt;        l_container TYPE string, &lt;/P&gt;&lt;P&gt;        l_count     TYPE i. &lt;/P&gt;&lt;P&gt;  APPEND l_group TO l_columns. &lt;/P&gt;&lt;P&gt;  APPEND `count( * )` TO l_columns. &lt;/P&gt;&lt;P&gt;  SELECT (l_columns) &lt;/P&gt;&lt;P&gt;         FROM spfli &lt;/P&gt;&lt;P&gt;         INTO (l_container, l_count) &lt;/P&gt;&lt;P&gt;         GROUP BY (l_group). &lt;/P&gt;&lt;P&gt;    WRITE: / l_count, l_container. &lt;/P&gt;&lt;P&gt;  ENDSELECT. &lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 06:53:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316582#M794422</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T06:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316583#M794423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fields specification is madatory while using a select statement.&lt;/P&gt;&lt;P&gt;Onle alternative to it can be as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can define a zstructure with the fields dty01 to dty20 (having same type as the similar elements from pa0167 table  )in it and then use: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1: Declare an internal table itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: itab TYPE TABLE OF ZStructure WITH HEADER LINE.&lt;/P&gt;&lt;P&gt; and then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select * from pa0167 into CORRESPONDING FIELDS OF TABLE ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rewards if useful,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2008 06:56:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query/m-p/3316583#M794423</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-23T06:56:21Z</dc:date>
    </item>
  </channel>
</rss>

