<?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: fields sequence in the select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980989#M1340844</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you for the answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my internal table has the fields in this sequence&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab :-&lt;/P&gt;&lt;P&gt;vbeln&lt;/P&gt;&lt;P&gt; posnr&lt;/P&gt;&lt;P&gt; erdat &lt;/P&gt;&lt;P&gt;erzet&lt;/P&gt;&lt;P&gt; vkorg &lt;/P&gt;&lt;P&gt;vtweg&lt;/P&gt;&lt;P&gt;kunnr &lt;/P&gt;&lt;P&gt; matnr &lt;/P&gt;&lt;P&gt;bmeng &lt;/P&gt;&lt;P&gt;status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)so which select query i need to use in the above for this sequence either first or second, if so why not other&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) do i need to use the into corresponding fields addition because i am not using the fields bmeng and status and also in the first query the posnr in not in sequence to itab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Aug 2009 02:41:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-18T02:41:32Z</dc:date>
    <item>
      <title>fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980986#M1340841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;experts, help needed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab has following fields,&lt;/P&gt;&lt;P&gt;vbeln posnr erdat erzet vkorg vtweg&lt;/P&gt;&lt;P&gt;kunnr posnr matnr bmeng status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have written like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;vbeln a&lt;/SUB&gt;erdat a&lt;SUB&gt;erzet a&lt;/SUB&gt;vkorg a~vtweg&lt;/P&gt;&lt;P&gt;a&lt;SUB&gt;kunnr b&lt;/SUB&gt;posnr b~matnr&lt;/P&gt;&lt;P&gt;FROM vbak AS a INNER JOIN vbap AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;INTO TABLE itab1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN itab&lt;/P&gt;&lt;P&gt;WHERE a~vbeln = itab-vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but my internal table fields sequence are different. so i changed the posnr field in the select query to the second place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;vbeln  b&lt;/SUB&gt;posnr  a&lt;SUB&gt;erdat a&lt;/SUB&gt;erzet a&lt;SUB&gt;vkorg a&lt;/SUB&gt;vtweg&lt;/P&gt;&lt;P&gt;a&lt;SUB&gt;kunnr b&lt;/SUB&gt;matnr &lt;/P&gt;&lt;P&gt;FROM vbak AS a INNER JOIN vbap AS b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;INTO TABLE itab1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN itab&lt;/P&gt;&lt;P&gt;WHERE a~vbeln = itab-vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so in above two select statements which one is right , according to coding standards,?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this case do i need to use the into corresponding fields addition because i am not selecting bmeng , status fields into the itab?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 02:14:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980986#M1340841</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T02:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980987#M1340842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;      Change the field sequence in the internal table as per the first select query. I don't think there will be any performance/ run time difference between first and second select statements. Also, avoid using corresponding fields addition as it a performance killer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 02:31:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980987#M1340842</guid>
      <dc:creator>SG141</dc:creator>
      <dc:date>2009-08-18T02:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980988#M1340843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The second one is right and can have a better performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 02:36:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980988#M1340843</guid>
      <dc:creator>daixiong_jiang3</dc:creator>
      <dc:date>2009-08-18T02:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980989#M1340844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you for the answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my internal table has the fields in this sequence&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab :-&lt;/P&gt;&lt;P&gt;vbeln&lt;/P&gt;&lt;P&gt; posnr&lt;/P&gt;&lt;P&gt; erdat &lt;/P&gt;&lt;P&gt;erzet&lt;/P&gt;&lt;P&gt; vkorg &lt;/P&gt;&lt;P&gt;vtweg&lt;/P&gt;&lt;P&gt;kunnr &lt;/P&gt;&lt;P&gt; matnr &lt;/P&gt;&lt;P&gt;bmeng &lt;/P&gt;&lt;P&gt;status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)so which select query i need to use in the above for this sequence either first or second, if so why not other&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) do i need to use the into corresponding fields addition because i am not using the fields bmeng and status and also in the first query the posnr in not in sequence to itab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 02:41:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980989#M1340844</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T02:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980990#M1340845</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;1. Use second query because select statement will always fill internal table in a sequence order in which fields have been declared.&lt;/P&gt;&lt;P&gt;2. For second query u do not need to use 'INTO CORRESPONDING FIELDS OF' because the field names in select query is in same sequence with internal table fields. Since 'bmeng' and 'status' fields is at the end it will affect the sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'INTO CORRESPONDING FIELDS OF'  is only used when sequence of field names in select query and internal table declaration differs. Otherwise type and length mismatch of fields will occur.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 03:58:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980990#M1340845</guid>
      <dc:creator>awin_prabhu</dc:creator>
      <dc:date>2009-08-18T03:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980991#M1340846</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;Of the two select statements, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT a~vbeln b~posnr a~erdat a~erzet a~vkorg a~vtweg
a~kunnr b~matnr 
FROM vbak AS a INNER JOIN vbap AS b
ON a~vbeln = b~vbeln
INTO TABLE itab1
FOR ALL ENTRIES IN itab
WHERE a~vbeln = itab-vbeln.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is the better one. I,e specifyiig the field sequence exactly as you have in the internal table. Even according to standards, this is better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are chaning the sequence of select fields, then you have to use the INTO CORRESPONDING FILEDS OF TABLE addition, so that the system itself finds the relevant order of fields and fill them automatically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a additional work which has to be performed by the compiler. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus its better to use INTO CORRESPONDING FILEDS OF TABLE only when you are using select * , or when you are not sure of the field sequence inthe table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 04:04:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980991#M1340846</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T04:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980992#M1340847</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;This will be good select query in accordance with performance and standard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not itab[] is initial.&lt;/P&gt;&lt;P&gt;  SELECT a&lt;SUB&gt;vbeln b&lt;/SUB&gt;posnr a&lt;SUB&gt;erdat a&lt;/SUB&gt;erzet&lt;/P&gt;&lt;P&gt;              a&lt;SUB&gt;vkorg a&lt;/SUB&gt;vtweg a&lt;SUB&gt;kunnr b&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;             FROM vbak AS a INNER JOIN vbap AS b&lt;/P&gt;&lt;P&gt;             ON a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;            INTO TABLE itab1&lt;/P&gt;&lt;P&gt;            FOR ALL ENTRIES IN itab&lt;/P&gt;&lt;P&gt;           WHERE a~vbeln = itab-vbeln.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 04:09:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980992#M1340847</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T04:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: fields sequence in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980993#M1340848</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;P&gt;You should always follow ABAP standard while coding. Select query should have all the fields in sequence as per the order defined in the database table. This will definetly help indexes to improve performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Augustin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 05:21:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fields-sequence-in-the-select-statement/m-p/5980993#M1340848</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-18T05:21:24Z</dc:date>
    </item>
  </channel>
</rss>

