<?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 ABAP table reading code keeps hanging in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590472#M864466</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;I have copied some code from a book, and modified it, in order to learn ABAP.  The program keeps hanging, and I do not know why.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have less than 2 weeks of experience with ABAP, so clearly explain everything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Al Lal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: w_key(10) type c.
data: begin of ikey,
      city(10) type c,
      state(2) type c,
      zip(5) type c,
      end of ikey.

data: begin of itab2 occurs 10000,
      city(10) type c,
      state(2) type c,
      zip(5) type c,
      name(15) type c,
      address(20) type c,
      phone(10) type c,
      end of itab2.

move 'Miami' to itab2-city.
move 'FL' to itab2-state.
move '99999' to itab2-state.
append itab2.
clear itab2.

move 'New York' to itab2-city.
move 'NY' to itab2-state.
move '99999' to itab2-zip.
append itab2.
clear itab2.

move 'New York' to w_key.
while sy-subrc = 0.
  read table itab2 with key w_key.
  if sy-subrc = 0.
    write itab2.
  endif.
endwhile.

move 'New York' to ikey-city.
move 'NY' to ikey-state.
move '99999' to ikey-zip.
while sy-subrc = 0.
  read table itab2 with key ikey.
  if sy-subrc = 0.
    write itab2.
  endif.
endwhile.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Mar 2008 09:56:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-26T09:56:37Z</dc:date>
    <item>
      <title>ABAP table reading code keeps hanging</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590472#M864466</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;I have copied some code from a book, and modified it, in order to learn ABAP.  The program keeps hanging, and I do not know why.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have less than 2 weeks of experience with ABAP, so clearly explain everything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Al Lal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: w_key(10) type c.
data: begin of ikey,
      city(10) type c,
      state(2) type c,
      zip(5) type c,
      end of ikey.

data: begin of itab2 occurs 10000,
      city(10) type c,
      state(2) type c,
      zip(5) type c,
      name(15) type c,
      address(20) type c,
      phone(10) type c,
      end of itab2.

move 'Miami' to itab2-city.
move 'FL' to itab2-state.
move '99999' to itab2-state.
append itab2.
clear itab2.

move 'New York' to itab2-city.
move 'NY' to itab2-state.
move '99999' to itab2-zip.
append itab2.
clear itab2.

move 'New York' to w_key.
while sy-subrc = 0.
  read table itab2 with key w_key.
  if sy-subrc = 0.
    write itab2.
  endif.
endwhile.

move 'New York' to ikey-city.
move 'NY' to ikey-state.
move '99999' to ikey-zip.
while sy-subrc = 0.
  read table itab2 with key ikey.
  if sy-subrc = 0.
    write itab2.
  endif.
endwhile.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2008 09:56:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590472#M864466</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-26T09:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP table reading code keeps hanging</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590473#M864467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best way to resolve issues is to run the program in debug mode. Anyway, its prob this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move 'New York' to w_key.&lt;/P&gt;&lt;P&gt;while sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  read table itab2 with key w_key.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    write itab2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The return code will always be zero. Change it to this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move 'New York' to w_key.&lt;/P&gt;&lt;P&gt;  read table itab2 with key w_key.&lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    write itab2.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2008 09:59:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590473#M864467</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-26T09:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP table reading code keeps hanging</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590474#M864468</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;Remove while-endwhile...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while reading a table you always check sy-subrc.&lt;/P&gt;&lt;P&gt;If the entry is available it will show sy-subrc = 0.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2008 10:05:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-table-reading-code-keeps-hanging/m-p/3590474#M864468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-26T10:05:02Z</dc:date>
    </item>
  </channel>
</rss>

