<?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: Can I use Read table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985130#M402354</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;Yes you can use read instead of nested loops and select which will affect the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zkeerthi_ITABLE9                          .&lt;/P&gt;&lt;P&gt;tables:vbap,vbak,vbkd.&lt;/P&gt;&lt;P&gt;data:begin of it_vbap occurs 0,&lt;/P&gt;&lt;P&gt;     vbeln like vbap-vbeln,&lt;/P&gt;&lt;P&gt;     matnr like vbap-matnr,&lt;/P&gt;&lt;P&gt;     end of it_vbap.&lt;/P&gt;&lt;P&gt;data:begin of it_vbak occurs 0,&lt;/P&gt;&lt;P&gt;     erdat like vbak-erdat,&lt;/P&gt;&lt;P&gt;     ernam like vbak-ernam,&lt;/P&gt;&lt;P&gt;     vbeln like vbak-vbeln,&lt;/P&gt;&lt;P&gt;     end of it_vbak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_vbkd occurs 0,&lt;/P&gt;&lt;P&gt;     konda like vbkd-konda,&lt;/P&gt;&lt;P&gt;     kdgrp like vbkd-kdgrp,&lt;/P&gt;&lt;P&gt;     vbeln like vbkd-vbeln,&lt;/P&gt;&lt;P&gt;     end of it_vbkd.&lt;/P&gt;&lt;P&gt;data:begin of it_final occurs 0,&lt;/P&gt;&lt;P&gt;     vbeln like vbap-vbeln,&lt;/P&gt;&lt;P&gt;     matnr like vbap-matnr,&lt;/P&gt;&lt;P&gt;     erdat like vbak-erdat,&lt;/P&gt;&lt;P&gt;     ernam like vbak-ernam,&lt;/P&gt;&lt;P&gt;      konda like vbkd-konda,&lt;/P&gt;&lt;P&gt;     kdgrp like vbkd-kdgrp,&lt;/P&gt;&lt;P&gt;     end of it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters:v_matnr  type vbap-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select vbeln&lt;/P&gt;&lt;P&gt;       matnr&lt;/P&gt;&lt;P&gt;       from vbap&lt;/P&gt;&lt;P&gt;       into table  it_vbap&lt;/P&gt;&lt;P&gt;       where matnr = v_matnr.&lt;/P&gt;&lt;P&gt;select erdat&lt;/P&gt;&lt;P&gt;       ernam&lt;/P&gt;&lt;P&gt;       vbeln&lt;/P&gt;&lt;P&gt;       from vbak&lt;/P&gt;&lt;P&gt;       into table it_vbak&lt;/P&gt;&lt;P&gt;       for all entries in it_vbap&lt;/P&gt;&lt;P&gt;       where vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;select konda&lt;/P&gt;&lt;P&gt;       kdgrp&lt;/P&gt;&lt;P&gt;       vbeln&lt;/P&gt;&lt;P&gt;       from vbkd&lt;/P&gt;&lt;P&gt;       into table it_vbkd&lt;/P&gt;&lt;P&gt;       for all entries in it_vbap&lt;/P&gt;&lt;P&gt;       where vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;loop at it_vbap.&lt;/P&gt;&lt;P&gt;read table it_vbak with key vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;move :it_vbak-erdat to it_final-erdat,&lt;/P&gt;&lt;P&gt;      it_vbak-ernam to it_final-ernam,&lt;/P&gt;&lt;P&gt;      it_vbap-vbeln to it_final-vbeln,&lt;/P&gt;&lt;P&gt;      it_vbap-matnr to it_final-matnr.&lt;/P&gt;&lt;P&gt;      append it_final.&lt;/P&gt;&lt;P&gt;read table it_vbkd with key vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;move:it_vbkd-konda to it_final-konda,&lt;/P&gt;&lt;P&gt;     it_vbkd-kdgrp to it_final-kdgrp.&lt;/P&gt;&lt;P&gt;     append it_final.&lt;/P&gt;&lt;P&gt;endloop  .&lt;/P&gt;&lt;P&gt;sort it_final by matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_final.&lt;/P&gt;&lt;P&gt;write:/ it_final-vbeln,&lt;/P&gt;&lt;P&gt;     it_final-matnr,&lt;/P&gt;&lt;P&gt;     it_final-erdat,&lt;/P&gt;&lt;P&gt;     it_final-ernam,&lt;/P&gt;&lt;P&gt;      it_final-konda,&lt;/P&gt;&lt;P&gt;     it_final-kdgrp.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Feb 2007 03:40:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-08T03:40:14Z</dc:date>
    <item>
      <title>Can I use Read table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985129#M402353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can I use read table instead of multiple select &amp;amp; loop statements.&lt;/P&gt;&lt;P&gt;Any one please give me the sample code ..how to do it.&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>Thu, 08 Feb 2007 03:34:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985129#M402353</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T03:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use Read table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985130#M402354</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;Yes you can use read instead of nested loops and select which will affect the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zkeerthi_ITABLE9                          .&lt;/P&gt;&lt;P&gt;tables:vbap,vbak,vbkd.&lt;/P&gt;&lt;P&gt;data:begin of it_vbap occurs 0,&lt;/P&gt;&lt;P&gt;     vbeln like vbap-vbeln,&lt;/P&gt;&lt;P&gt;     matnr like vbap-matnr,&lt;/P&gt;&lt;P&gt;     end of it_vbap.&lt;/P&gt;&lt;P&gt;data:begin of it_vbak occurs 0,&lt;/P&gt;&lt;P&gt;     erdat like vbak-erdat,&lt;/P&gt;&lt;P&gt;     ernam like vbak-ernam,&lt;/P&gt;&lt;P&gt;     vbeln like vbak-vbeln,&lt;/P&gt;&lt;P&gt;     end of it_vbak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of it_vbkd occurs 0,&lt;/P&gt;&lt;P&gt;     konda like vbkd-konda,&lt;/P&gt;&lt;P&gt;     kdgrp like vbkd-kdgrp,&lt;/P&gt;&lt;P&gt;     vbeln like vbkd-vbeln,&lt;/P&gt;&lt;P&gt;     end of it_vbkd.&lt;/P&gt;&lt;P&gt;data:begin of it_final occurs 0,&lt;/P&gt;&lt;P&gt;     vbeln like vbap-vbeln,&lt;/P&gt;&lt;P&gt;     matnr like vbap-matnr,&lt;/P&gt;&lt;P&gt;     erdat like vbak-erdat,&lt;/P&gt;&lt;P&gt;     ernam like vbak-ernam,&lt;/P&gt;&lt;P&gt;      konda like vbkd-konda,&lt;/P&gt;&lt;P&gt;     kdgrp like vbkd-kdgrp,&lt;/P&gt;&lt;P&gt;     end of it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters:v_matnr  type vbap-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select vbeln&lt;/P&gt;&lt;P&gt;       matnr&lt;/P&gt;&lt;P&gt;       from vbap&lt;/P&gt;&lt;P&gt;       into table  it_vbap&lt;/P&gt;&lt;P&gt;       where matnr = v_matnr.&lt;/P&gt;&lt;P&gt;select erdat&lt;/P&gt;&lt;P&gt;       ernam&lt;/P&gt;&lt;P&gt;       vbeln&lt;/P&gt;&lt;P&gt;       from vbak&lt;/P&gt;&lt;P&gt;       into table it_vbak&lt;/P&gt;&lt;P&gt;       for all entries in it_vbap&lt;/P&gt;&lt;P&gt;       where vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;select konda&lt;/P&gt;&lt;P&gt;       kdgrp&lt;/P&gt;&lt;P&gt;       vbeln&lt;/P&gt;&lt;P&gt;       from vbkd&lt;/P&gt;&lt;P&gt;       into table it_vbkd&lt;/P&gt;&lt;P&gt;       for all entries in it_vbap&lt;/P&gt;&lt;P&gt;       where vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;loop at it_vbap.&lt;/P&gt;&lt;P&gt;read table it_vbak with key vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;move :it_vbak-erdat to it_final-erdat,&lt;/P&gt;&lt;P&gt;      it_vbak-ernam to it_final-ernam,&lt;/P&gt;&lt;P&gt;      it_vbap-vbeln to it_final-vbeln,&lt;/P&gt;&lt;P&gt;      it_vbap-matnr to it_final-matnr.&lt;/P&gt;&lt;P&gt;      append it_final.&lt;/P&gt;&lt;P&gt;read table it_vbkd with key vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;move:it_vbkd-konda to it_final-konda,&lt;/P&gt;&lt;P&gt;     it_vbkd-kdgrp to it_final-kdgrp.&lt;/P&gt;&lt;P&gt;     append it_final.&lt;/P&gt;&lt;P&gt;endloop  .&lt;/P&gt;&lt;P&gt;sort it_final by matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_final.&lt;/P&gt;&lt;P&gt;write:/ it_final-vbeln,&lt;/P&gt;&lt;P&gt;     it_final-matnr,&lt;/P&gt;&lt;P&gt;     it_final-erdat,&lt;/P&gt;&lt;P&gt;     it_final-ernam,&lt;/P&gt;&lt;P&gt;      it_final-konda,&lt;/P&gt;&lt;P&gt;     it_final-kdgrp.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 03:40:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985130#M402354</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T03:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use Read table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985131#M402355</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;   U cannot read a table directly.. U need to Select required data&lt;/P&gt;&lt;P&gt;   into an Internal Table and then read this Internal table ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   select * from &amp;lt;table &amp;gt; into table &amp;lt;it&amp;gt; where ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   read table &amp;lt;it&amp;gt; with key .... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;GSR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 03:40:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985131#M402355</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T03:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use Read table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985132#M402356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ramana,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can avoid using Nested Loop or Nested Select using READ statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say you have to Select records from MARA and MARC table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either you can first select entries from MARA using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &amp;lt;req fields&amp;gt; FROM MARA INTO wa_mara WHERE &amp;lt;select condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    SLECT &amp;lt;req field&amp;gt; FROM MARC INTO wa_marc WHERE matnr = wa_mara-matnr.&lt;/P&gt;&lt;P&gt;    &amp;lt;Now move the req fields in the final ITAB using move statements&amp;gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can avoid this nested select as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &amp;lt;req fields&amp;gt; INTO TABLE IT_MARA FROM MARA WHERE &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &amp;lt;req fields&amp;gt; INTO TABLE IT_MARC FROM MARC FOR ALL ENTRIES IN TABLE IT_MARA WHERE matnr = it_mara-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_MARA.&lt;/P&gt;&lt;P&gt;  READ TABLE it_marc WITH KEY matnr = it_mara-matnr.&lt;/P&gt;&lt;P&gt;  &amp;lt;Move req field in the final table ITAB&amp;gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 03:43:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/can-i-use-read-table/m-p/1985132#M402356</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T03:43:17Z</dc:date>
    </item>
  </channel>
</rss>

