<?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: Read Internal Table record in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706979#M1295907</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear babbal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use events in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at Itab into wa.&lt;/P&gt;&lt;P&gt;at first &lt;/P&gt;&lt;P&gt;wa = &amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at last.&lt;/P&gt;&lt;P&gt;wa = &amp;lt;Field&amp;gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this . Hope this will help you to solve your problem.&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>Mon, 25 May 2009 12:08:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-25T12:08:51Z</dc:date>
    <item>
      <title>Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706976#M1295904</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;&lt;/P&gt;&lt;P&gt;my requirement is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose we have N rows in internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to read 1st row of particular column in var1.&lt;/P&gt;&lt;P&gt;and the last row for same column    in var 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is for same sales order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like my internal table is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vbeln                      airport&lt;/P&gt;&lt;P&gt;4520                      agra&lt;/P&gt;&lt;P&gt;4520                      delhi&lt;/P&gt;&lt;P&gt;4520                      jaipur&lt;/P&gt;&lt;P&gt;4520                      mumbai&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so i want &lt;/P&gt;&lt;P&gt;               var1 = agra&lt;/P&gt;&lt;P&gt;               var2 = mumbai&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;transfer &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; it_final-airport  = var1.&lt;/P&gt;&lt;P&gt;it_final-airport1 = var2.&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;P&gt;babbal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:01:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706976#M1295904</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706977#M1295905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There are several ways in whihc you can achieve this solution.&lt;/P&gt;&lt;P&gt;Use LOOP and the control break statements AT-NEW, AT-END.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read the SAP help on the same and try to achieve your output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:04:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706977#M1295905</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706978#M1295906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;be a bit more precise please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you need the first and last row of your group of sales oreders (same vbeln) or do you need just the first and last row?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:04:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706978#M1295906</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706979#M1295907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear babbal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use events in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at Itab into wa.&lt;/P&gt;&lt;P&gt;at first &lt;/P&gt;&lt;P&gt;wa = &amp;lt;field&amp;gt;.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at last.&lt;/P&gt;&lt;P&gt;wa = &amp;lt;Field&amp;gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this . Hope this will help you to solve your problem.&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>Mon, 25 May 2009 12:08:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706979#M1295907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706980#M1295908</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 can use in loop as follows.&lt;/P&gt;&lt;P&gt;LOOP AT t_final.&lt;/P&gt;&lt;P&gt;AT NEW AIRPORT.&lt;/P&gt;&lt;P&gt;t_final-airport = var1.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT END OF AIRPORT.&lt;/P&gt;&lt;P&gt;it_final-airport1 = var2.&lt;/P&gt;&lt;P&gt;ENDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND t_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:09:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706980#M1295908</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706981#M1295909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Picking up first and last row:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by vbeln airport ascending.&lt;/P&gt;&lt;P&gt;read itab into workarea index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab by vbeln airport descending.&lt;/P&gt;&lt;P&gt;read itab into workarea index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Guido Koopmann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:10:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706981#M1295909</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706982#M1295910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;try this logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create a variable of vbeln type (vbeln1)&lt;/P&gt;&lt;P&gt;just loop through table&lt;/P&gt;&lt;P&gt;if vbeln1is initial&lt;/P&gt;&lt;P&gt;vbeln1 = vbeln.&lt;/P&gt;&lt;P&gt;var1 = airport.&lt;/P&gt;&lt;P&gt;elseif.&lt;/P&gt;&lt;P&gt;vbeln nq vbeln1.&lt;/P&gt;&lt;P&gt;var2 = airport.&lt;/P&gt;&lt;P&gt;vbeln1 = vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;var2 = airport.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i assume that your table is shorted by vbeln as your example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: mayank jain on May 25, 2009 2:11 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:10:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706982#M1295910</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T12:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Read Internal Table record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706983#M1295911</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;PRE&gt;&lt;CODE&gt;DATA:BEGIN OF itab OCCURS 0,
     field1 TYPE i,
     field2(10) TYPE c,
     END OF itab.

DATA:var1(10),var2(10).

DATA:BEGIN OF itab_first OCCURS 0,
     field1 TYPE i,
     field2(10) TYPE c,
     END OF itab_first.

DATA:BEGIN OF itab_last OCCURS 0,
     field1 TYPE i,
     field2(10) TYPE c,
     END OF itab_last.

START-OF-SELECTION.
  itab-field1 = 4520.
  itab-field2 = 'agra'.
  APPEND itab.
  CLEAR itab.

  itab-field1 = '4520'.
  itab-field2 = 'delhi'.
  APPEND itab.
  CLEAR itab.

  itab-field1 = '4520'.
  itab-field2 = 'jaipur'.
  APPEND itab.
  CLEAR itab.

  itab-field1 = '4520'.
  itab-field2 = 'mumbai'.
  APPEND itab.
  CLEAR itab.
  SORT  itab BY field1 field2.

  LOOP AT itab.
    AT NEW field1.
      READ TABLE itab INDEX sy-tabix.
      IF sy-subrc EQ 0.
        MOVE itab TO itab_first.
        APPEND itab_first.
        CLEAR itab_first.
      ENDIF.
    ENDAT.
  ENDLOOP.

  LOOP AT itab.
    AT END OF field1.
      READ TABLE itab INDEX sy-tabix.
      IF sy-subrc EQ 0.
        MOVE itab TO itab_last.
        APPEND itab_last.
        CLEAR itab_last.
      ENDIF.

    ENDAT.
  ENDLOOP.

  LOOP AT itab_first.
    WRITE:/ itab_first-field1,itab_first-field2.
  ENDLOOP.

  LOOP AT itab_last.
    WRITE:/ itab_last-field1,itab_last-field2.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 12:12:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/read-internal-table-record/m-p/5706983#M1295911</guid>
      <dc:creator>former_member188829</dc:creator>
      <dc:date>2009-05-25T12:12:54Z</dc:date>
    </item>
  </channel>
</rss>

