<?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 Details in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750475#M902311</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   The select command is the most fundamental function of writing ABAP programs allowing the retrieval of&lt;/P&gt;&lt;P&gt;data from SAP database tables. The most efficient use of the select statement is to retrieve data directly into an internal table, Below &lt;/P&gt;&lt;P&gt;is an example of how this would be performed.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZSELECTCOMMAND.
*Code to demonstrate select into internal table command
data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

*Select directly into an internal table
SELECT *  "all fields
  FROM ekko
  INTO TABLE it_ekko.
write:/ 'SELECT directly into an internal table'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Select-End Select Command.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZSELECTCOMMAND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

SELECT ebeln BUKRS BSTYP BSART
  FROM ekko
  INTO wa_ekko.

  APPEND wa_ekko TO it_ekko.
ENDSELECT.
write:/ 'SELECT... endselect command'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT directly into an internal table when field order is different&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZSELECTCOMMAND.
*Code to demonstrate select into internal table command
data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

*Select directly into an internal table
* Please note the order of these field are not different but you can still see the code 
* that would perform this functionality if they were!
SELECT *  "all fields
  FROM ekko
  INTO TABLE it_ekko.
write:/ 'SELECT directly into an internal table'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT for all entries command&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

SELECT *
  UP TO 100 ROWS  "only return first 100 hits
  FROM ekko
  INTO TABLE it_ekko
 where ebeln = '0000154421'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.

IF sy-subrc EQ 0.
* The FOR ALL ENTRIES comand only retrieves data which matches
* entries within a particular internal table.
  SELECT *
    FROM ekpo
    INTO TABLE it_ekpo
    FOR ALL ENTRIES IN it_ekko
    WHERE ebeln EQ it_ekko-ebeln.
  write:/ 'FOR ALL ENTRIES comand '.
  loop at it_ekpo into wa_ekpo.
    write:/ wa_ekpo-ebeln, wa_ekpo-ebelp.
  endloop.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Pls reward if useful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sirisha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 May 2008 07:37:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-02T07:37:04Z</dc:date>
    <item>
      <title>Select Details</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750474#M902310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guru's,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select query is how many type ,  type wise example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it's needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;S.Hari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 06:10:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750474#M902310</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T06:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select Details</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750475#M902311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   The select command is the most fundamental function of writing ABAP programs allowing the retrieval of&lt;/P&gt;&lt;P&gt;data from SAP database tables. The most efficient use of the select statement is to retrieve data directly into an internal table, Below &lt;/P&gt;&lt;P&gt;is an example of how this would be performed.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZSELECTCOMMAND.
*Code to demonstrate select into internal table command
data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

*Select directly into an internal table
SELECT *  "all fields
  FROM ekko
  INTO TABLE it_ekko.
write:/ 'SELECT directly into an internal table'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Select-End Select Command.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZSELECTCOMMAND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

SELECT ebeln BUKRS BSTYP BSART
  FROM ekko
  INTO wa_ekko.

  APPEND wa_ekko TO it_ekko.
ENDSELECT.
write:/ 'SELECT... endselect command'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT directly into an internal table when field order is different&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZSELECTCOMMAND.
*Code to demonstrate select into internal table command
data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

*Select directly into an internal table
* Please note the order of these field are not different but you can still see the code 
* that would perform this functionality if they were!
SELECT *  "all fields
  FROM ekko
  INTO TABLE it_ekko.
write:/ 'SELECT directly into an internal table'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT for all entries command&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko,
      it_ekpo type standard table of ekpo,
      wa_ekpo like line of it_ekpo.

SELECT *
  UP TO 100 ROWS  "only return first 100 hits
  FROM ekko
  INTO TABLE it_ekko
 where ebeln = '0000154421'.
loop at it_ekko into wa_ekko.
  write:/ wa_ekko-ebeln.
endloop.

IF sy-subrc EQ 0.
* The FOR ALL ENTRIES comand only retrieves data which matches
* entries within a particular internal table.
  SELECT *
    FROM ekpo
    INTO TABLE it_ekpo
    FOR ALL ENTRIES IN it_ekko
    WHERE ebeln EQ it_ekko-ebeln.
  write:/ 'FOR ALL ENTRIES comand '.
  loop at it_ekpo into wa_ekpo.
    write:/ wa_ekpo-ebeln, wa_ekpo-ebelp.
  endloop.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Pls reward if useful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sirisha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 07:37:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750475#M902311</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T07:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select Details</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750476#M902312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please have a look at below link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Select Statement|http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/frameset.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it gives all the details you are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 07:43:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750476#M902312</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T07:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Select Details</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750477#M902313</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;Check This Link for &lt;STRONG&gt;Select Details&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/af/a16c3c50ac854ce10000000a11405a/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/af/a16c3c50ac854ce10000000a11405a/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward Points if Usefull&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Fareedas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2008 10:04:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-details/m-p/3750477#M902313</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-02T10:04:24Z</dc:date>
    </item>
  </channel>
</rss>

