<?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 select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114788#M107096</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;Iam trying to get the data like this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: begin of t_hdr occurs 0,
        aufnr like aufk-aufnr,
        revnr like afih-revnr,
      end of t_hdr.

data: begin of t_det occurs 0,
        aufnr like resb-aufnr,
        matnr like resb-matnr,
        bdmng like resb-bdmng,
        lgort like resb-lgort,
        maktx like makt-maktx,
        labst like mard-labst,
      end of t_det.

  select aufk~aufnr afih~revnr from aufk inner join afih
             on aufk~aufnr = afih~aufnr into
             corresponding fields of table t_hdr.


  check not t_hdr[] is initial.


  select aufnr matnr bdmng lgort
       into corresponding fields of
       table t_det from resb
       for all entries in t_hdr where aufnr = t_hdr-aufnr.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; since RESB table having millions of records,it is taking lot of time.Is there any way to get the data faster?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward guaranteed&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;kaki&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Feb 2006 01:57:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-13T01:57:20Z</dc:date>
    <item>
      <title>select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114788#M107096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;Iam trying to get the data like this.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: begin of t_hdr occurs 0,
        aufnr like aufk-aufnr,
        revnr like afih-revnr,
      end of t_hdr.

data: begin of t_det occurs 0,
        aufnr like resb-aufnr,
        matnr like resb-matnr,
        bdmng like resb-bdmng,
        lgort like resb-lgort,
        maktx like makt-maktx,
        labst like mard-labst,
      end of t_det.

  select aufk~aufnr afih~revnr from aufk inner join afih
             on aufk~aufnr = afih~aufnr into
             corresponding fields of table t_hdr.


  check not t_hdr[] is initial.


  select aufnr matnr bdmng lgort
       into corresponding fields of
       table t_det from resb
       for all entries in t_hdr where aufnr = t_hdr-aufnr.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; since RESB table having millions of records,it is taking lot of time.Is there any way to get the data faster?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward guaranteed&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;kaki&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 01:57:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114788#M107096</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-13T01:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114789#M107097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will need to make the connection to RESB via the reservation number, RSNUM.  You can use the RSNUM from table afko.  I pretty sure that it is in AFKO, if not, then it is in AUFK.  Please see the updated code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: begin of t_hdr occurs 0,
        aufnr like aufk-aufnr,
&amp;lt;b&amp;gt;        rsnum like afko-rsnum,&amp;lt;/b&amp;gt;
        revnr like afih-revnr,
      end of t_hdr.
 
data: begin of t_det occurs 0,
        aufnr like resb-aufnr,
        matnr like resb-matnr,
        bdmng like resb-bdmng,
        lgort like resb-lgort,
        maktx like makt-maktx,
        labst like mard-labst,
      end of t_det.
 
  select aufk~aufnr &amp;lt;b&amp;gt;afko~rsnum&amp;lt;/b&amp;gt; afih~revnr 
       from aufk
&amp;lt;b&amp;gt;            inner join afko
             on aufk~aufnr = afko~aufnr&amp;lt;/b&amp;gt;
            inner join afih
             on aufk~aufnr = afih~aufnr into
             corresponding fields of table t_hdr.
* You should also probably try to limit this select
* with a where clause
 
  check not t_hdr[] is initial.
 
&amp;lt;b&amp;gt;sort t_hdr ascending by aufnr rsnum .&amp;lt;/b&amp;gt;

  select aufnr matnr bdmng lgort
       into corresponding fields of
       table t_det from resb
       for all entries in t_hdr
&amp;lt;b&amp;gt;                where rsnum = t_hdr-rsnum.&amp;lt;/b&amp;gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 02:18:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114789#M107097</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-13T02:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114790#M107098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kaki,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESB is a very Huge table and you are trying to retrive the data witj out using the key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of t_hdr occurs 0,&lt;/P&gt;&lt;P&gt;        aufnr like aufk-aufnr,&lt;/P&gt;&lt;P&gt;        revnr like afih-revnr,&lt;/P&gt;&lt;P&gt;        rsnum like resb-rsnum,   --&amp;lt;u&amp;gt;Add this field&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;      end of t_hdr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;data: begin of t_det occurs 0,&lt;/P&gt;&lt;P&gt;        aufnr like resb-aufnr,&lt;/P&gt;&lt;P&gt;        matnr like resb-matnr,&lt;/P&gt;&lt;P&gt;        bdmng like resb-bdmng,&lt;/P&gt;&lt;P&gt;        lgort like resb-lgort,&lt;/P&gt;&lt;P&gt;        maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;        labst like mard-labst,&lt;/P&gt;&lt;P&gt;      end of t_det.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Replace &amp;lt;u&amp;gt;aufk&amp;lt;/u&amp;gt; with view &amp;lt;b&amp;gt;CAUFV&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select CAUFV&lt;SUB&gt;aufnr afih&lt;/SUB&gt;revnr CAUFV~RSNUM from &amp;lt;b&amp;gt;CAUFV&amp;lt;/b&amp;gt;  inner join afih&lt;/P&gt;&lt;P&gt;             on aufk&lt;SUB&gt;aufnr = afih&lt;/SUB&gt;aufnr into&lt;/P&gt;&lt;P&gt;             corresponding fields of table t_hdr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  check not t_hdr[] is initial.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  select aufnr matnr bdmng lgort&lt;/P&gt;&lt;P&gt;       into corresponding fields of&lt;/P&gt;&lt;P&gt;       table t_det from resb&lt;/P&gt;&lt;P&gt;       for all entries in t_hdr &lt;/P&gt;&lt;P&gt;                 where aufnr = t_hdr-aufnr&lt;/P&gt;&lt;P&gt;                 and   RSNUM = t_hdr-rsnum. -- &amp;lt;u&amp;gt;add&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RSNUM is a key field in RESEB then it will fetch the data faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this may help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lanka&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 02:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114790#M107098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-13T02:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114791#M107099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rich &amp;amp; Lanka,&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;points alloted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;kaki&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2006 02:34:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1114791#M107099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-13T02:34:03Z</dc:date>
    </item>
  </channel>
</rss>

