<?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: loop through table where two fields value are not equal in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283533#M1988928</link>
    <description>&lt;P&gt;Per WHERE clause in LOOP &lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abaploop_at_itab_cond.htm#!ABAP_ADDITION_3@3@"&gt;documentation&lt;/A&gt;, the second operand(old_product_id) can &lt;STRONG&gt;NOT&lt;/STRONG&gt; be a component of internal table; but it can be a component of a VARIABLE (gs_alv3).&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; portion of text from help.sap.com&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;The remaining operands of a relational expression are general expression positions at which any suitable individual operands or expressions can be specified, &lt;B&gt;but no components of the internal table.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;end&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2020 21:52:17 GMT</pubDate>
    <dc:creator>kartikrajag</dc:creator>
    <dc:date>2020-09-01T21:52:17Z</dc:date>
    <item>
      <title>loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283526#M1988921</link>
      <description>&lt;P&gt;I want to loop through a itab for these rows which value is not equal.&lt;/P&gt;
  &lt;P&gt;So I wrote code like &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;LOOP AT gt_alv3 INTO gs_alv3 where product_id &amp;lt;&amp;gt; old_product_id .
......
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;And it has error. And the following code has no error. &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;LOOP AT gt_alv3 INTO gs_alv3 where product_id &amp;lt;&amp;gt; gs_alv3-old_product_id .
......
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;But I wonder is this correct? And by writng this will it only loop through those line under the condition?Thx.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 01:48:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283526#M1988921</guid>
      <dc:creator>former_member625844</dc:creator>
      <dc:date>2020-09-01T01:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283527#M1988922</link>
      <description>&lt;P&gt;HI, &lt;/P&gt;&lt;P&gt;Create gt_alv_temp as a temporary table &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;gt_alv_temp[] =  gt_alv3[].
delete gt_alv_temp where product_id ne old_product_id .
loop at gt_alv_temp.

Endloop. &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Sep 2020 01:56:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283527#M1988922</guid>
      <dc:creator>Abinathsiva</dc:creator>
      <dc:date>2020-09-01T01:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283528#M1988923</link>
      <description>&lt;P&gt;What is the error with first code set?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 02:44:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283528#M1988923</guid>
      <dc:creator>GK817</dc:creator>
      <dc:date>2020-09-01T02:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283529#M1988924</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;What is the error? &lt;BR /&gt;&lt;/STRONG&gt;The community can only help to fix an error, if they know the error and dont have to guess it. Since you are not describing the entire relevant scenario and you are not showing all the relevant coding, answers will be based on guessing only.&lt;/LI&gt;&lt;LI&gt;Is it a syntax check error and the programm doesnt run without fixing the error,&lt;BR /&gt;Or is it a functional error when running the programm and the coding doesnt work as expected?&lt;/LI&gt;&lt;LI&gt;Check the underlying data type for old_product_id and compare it to the one of gs_alv3-old_product_id. They should be the same in order to work properly&lt;/LI&gt;&lt;LI&gt;Is old_product_id accessible? Where has old_product_id been defined vs. gs_alv3, in the same 'block' (event/form/method) or on a global level? Both should be accessible in the same block.&lt;/LI&gt;&lt;LI&gt;How does the old_product_id value get filled vs. the value for gs_alv3-old_product_id. When you check those in the debugger, does one have leading zeros and the other doesnt? In this case the values can only be compared if they are adjusted for either input (leading zeros) or output mode (no leading zeros).&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 01 Sep 2020 04:36:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283529#M1988924</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-09-01T04:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283530#M1988925</link>
      <description>&lt;P&gt;It's a syntax check error in Eclipse and I can't activate it with this error.. The error code is &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;The field "OLD_PRODUCT_ID" is unknown, but there is a field with the similar name "LV_PRODUCT_ID". "LV_PRODUCT_ID".&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;what I want is in internal table gt_alv3, there are columns product_id and old_product_id, and I want to loop through rows which these two columns has different value. and I'm sure they exist in the table and has same data type.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 05:16:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283530#M1988925</guid>
      <dc:creator>former_member625844</dc:creator>
      <dc:date>2020-09-01T05:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283531#M1988926</link>
      <description>&lt;P&gt;Unfortunately, with LOOP you cannot compare two attributes of an internal table against each other.&lt;/P&gt;&lt;P&gt;The first operand (operand1) is a component of the internal table and the second operand (operand2) is any object other then one of the internal table. Please always check the SAP ABAP documentation when trying to understand ABAP statements.&lt;/P&gt;&lt;P&gt; (You can however do this logic with a SELECT statement, maybe that would be another possibility for you.) &lt;/P&gt;&lt;P&gt;So to solve your problem for a given internal table, you need to check for a difference in product_id and old_product_id from within the loop. Is old_product_id always filled, even if it is the same, otherwise you would also have to check for not initial.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT gt_alv3 INTO gs_alv3.
  CHECK gs_alv3-product_id &amp;lt;&amp;gt; gs_alv3-old_product_id.
  CHECK gs_alv3-old_product_id IS NOT INITIAL.
  ...
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Sep 2020 05:50:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283531#M1988926</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-09-01T05:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283532#M1988927</link>
      <description>&lt;P&gt;I post here the important part of the question added by the OP (&lt;A href="https://answers.sap.com/comments/13127859/view.html"&gt;this comment&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;"It's a syntax check error in Eclipse and I can't activate it with this error.. The error code is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;The field"OLD_PRODUCT_ID" is unknown, but there is a field with the similar name "LV_PRODUCT_ID".&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;"what I want is in internal table gt_alv3, there are columns product_id and old_product_id, and I want to loop through rows which these two columns has different value. and I'm sure they exist in the table and has same data type.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 07:35:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283532#M1988927</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-09-01T07:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: loop through table where two fields value are not equal</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283533#M1988928</link>
      <description>&lt;P&gt;Per WHERE clause in LOOP &lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abaploop_at_itab_cond.htm#!ABAP_ADDITION_3@3@"&gt;documentation&lt;/A&gt;, the second operand(old_product_id) can &lt;STRONG&gt;NOT&lt;/STRONG&gt; be a component of internal table; but it can be a component of a VARIABLE (gs_alv3).&lt;/P&gt;&lt;P&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; portion of text from help.sap.com&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;The remaining operands of a relational expression are general expression positions at which any suitable individual operands or expressions can be specified, &lt;B&gt;but no components of the internal table.&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;end&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 21:52:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-through-table-where-two-fields-value-are-not-equal/m-p/12283533#M1988928</guid>
      <dc:creator>kartikrajag</dc:creator>
      <dc:date>2020-09-01T21:52:17Z</dc:date>
    </item>
  </channel>
</rss>

