<?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 loop to detect repeated value or no entry in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589376#M1567053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;Need to get advice on the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table. &lt;/P&gt;&lt;P&gt;when there is a start of id 1, it is considered as new group.&lt;/P&gt;&lt;P&gt;in each group i must check that the register value only show 1 time. repeated in the group or no entry in register at all in the group, will print message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;correct&lt;/P&gt;&lt;P&gt;id     register&lt;/P&gt;&lt;P&gt;1      y&lt;/P&gt;&lt;P&gt;2      &lt;/P&gt;&lt;P&gt;1    &lt;/P&gt;&lt;P&gt;2      y&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;incorrect if repeated&lt;/P&gt;&lt;P&gt;id    register&lt;/P&gt;&lt;P&gt;1     y&lt;/P&gt;&lt;P&gt;2     y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;incorrect if no entry at all&lt;/P&gt;&lt;P&gt;id    register&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Dec 2010 07:16:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-12-26T07:16:37Z</dc:date>
    <item>
      <title>loop to detect repeated value or no entry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589376#M1567053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;Need to get advice on the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table. &lt;/P&gt;&lt;P&gt;when there is a start of id 1, it is considered as new group.&lt;/P&gt;&lt;P&gt;in each group i must check that the register value only show 1 time. repeated in the group or no entry in register at all in the group, will print message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;correct&lt;/P&gt;&lt;P&gt;id     register&lt;/P&gt;&lt;P&gt;1      y&lt;/P&gt;&lt;P&gt;2      &lt;/P&gt;&lt;P&gt;1    &lt;/P&gt;&lt;P&gt;2      y&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;incorrect if repeated&lt;/P&gt;&lt;P&gt;id    register&lt;/P&gt;&lt;P&gt;1     y&lt;/P&gt;&lt;P&gt;2     y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;incorrect if no entry at all&lt;/P&gt;&lt;P&gt;id    register&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Dec 2010 07:16:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589376#M1567053</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-26T07:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: loop to detect repeated value or no entry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589377#M1567054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gengis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if your iinternal table structure has the first field ID and a second field register, it may me like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:
  lv_register   type string,
  lv_multiple type flag.  
field-symbols:
  &amp;lt;record&amp;gt; like line of itab.
sort itab by id.
loop at itab assigning &amp;lt;record&amp;gt;.
  if lv_register is not initial and &amp;lt;record&amp;gt;-register is not initial.
    lv_multiple = 'X'.
  endif.
  lv_register = &amp;lt;record&amp;gt;-register.
  at end of id.
    if lv_register is initial.
      write: /  'error no regsiter in group'
    elseif lv_multiple is not initial.
      write: /  'error more than one register in group'.
    endif.
    clear: lv_register, lv_multiple.
  endat.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adapt according to your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: To make sure the AT events are triggered correctly, ID &lt;STRONG&gt;must&lt;/STRONG&gt; be first field in itab.&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;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Dec 2010 10:54:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589377#M1567054</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-12-26T10:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: loop to detect repeated value or no entry</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589378#M1567055</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;Please check whether the below code helps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB INTO WA1.&lt;/P&gt;&lt;P&gt;  IF WA1-ID EQ 1.&lt;/P&gt;&lt;P&gt;    FLAG = 1.&lt;/P&gt;&lt;P&gt;    PERFORM CHECK_GROUP.&lt;/P&gt;&lt;P&gt;    IF FLAG EQ 1.&lt;/P&gt;&lt;P&gt;      WRITE : / 'GROUP NO :', INDEX.&lt;/P&gt;&lt;P&gt;      INDEX = INDEX + 1.&lt;/P&gt;&lt;P&gt;      APPEND WA1 TO ITAB1.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    APPEND WA1 TO ITAB1.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  CLEAR WA1.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;PERFORM CHECK_GROUP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  check_group&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM CHECK_GROUP.&lt;/P&gt;&lt;P&gt;  CLEAR : flag1,num.&lt;/P&gt;&lt;P&gt;  IF ITAB1 IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;    LOOP AT ITAB1 INTO WA2.&lt;/P&gt;&lt;P&gt;      IF WA2-REG EQ 'Y'.&lt;/P&gt;&lt;P&gt;        num = num + 1.&lt;/P&gt;&lt;P&gt;        FLAG1 = 0.&lt;/P&gt;&lt;P&gt;         CONTINUE.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        FLAG1 = 1.&lt;/P&gt;&lt;P&gt;        CONTINUE.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    IF FLAG1 = 1.&lt;/P&gt;&lt;P&gt;      WRITE  'NO REGISTER FOUND'.&lt;/P&gt;&lt;P&gt;      ELSEIF NUM GT 1.&lt;/P&gt;&lt;P&gt;        WRITE  'INCORRECT ENTRIES'.&lt;/P&gt;&lt;P&gt;        ELSE.&lt;/P&gt;&lt;P&gt;          WRITE 'ENTRIES ARE CORRECT'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  REFRESH ITAB1.&lt;/P&gt;&lt;P&gt;  CLEAR WA2.&lt;/P&gt;&lt;P&gt;  ENDFORM.                    "check_group&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Dec 2010 13:10:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-to-detect-repeated-value-or-no-entry/m-p/7589378#M1567055</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-27T13:10:36Z</dc:date>
    </item>
  </channel>
</rss>

