<?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: Comparison data in Internal Table. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680645#M1100657</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;Thanks for the replies.&lt;/P&gt;&lt;P&gt;I have think of doing it in this way. So far the output is working fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any place in the code which I enhance to make it work better?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT XRLDRI
        lv_counter = lv_counter + 1.

        IF lv_counter &amp;gt;= 13.
          call function 'CONTROL_FORM'
             exporting
                  command = 'NEW-WINDOW'.
          CLEAR: lv_counter, FLG_HU_PRINT.
        ENDIF.

        IF NOT lv_tanum IS INITIAL AND NOT lv_vltyp IS INITIAL.
          IF lv_tanum &amp;lt;&amp;gt; XRLDRI-tanum OR lv_vltyp &amp;lt;&amp;gt; XRLDRI-vltyp.
            call function 'CONTROL_FORM'
               exporting
                    command = 'NEW-WINDOW'.

            lv_tanum = XRLDRI-tanum.
            lv_vltyp = XRLDRI-vltyp.
            CLEAR: lv_counter, FLG_HU_PRINT.
          ENDIF.
        ELSE.
          lv_tanum = XRLDRI-tanum.
          lv_vltyp = XRLDRI-vltyp.
        ENDIF.

        PERFORM MULTI_PRINT.
    ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Oct 2008 02:17:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-15T02:17:36Z</dc:date>
    <item>
      <title>Comparison data in Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680641#M1100653</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;If I have an internal table as below: -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITEM	TANUM		VLTYP&lt;/P&gt;&lt;P&gt;1	0000002627	CR3&lt;/P&gt;&lt;P&gt;2	0000002627	CR3&lt;/P&gt;&lt;P&gt;3	0000002627	CR3&lt;/P&gt;&lt;P&gt;4	0000002627	TTY&lt;/P&gt;&lt;P&gt;5	0000002627	MRK&lt;/P&gt;&lt;P&gt;6	0000002627	MRK&lt;/P&gt;&lt;P&gt;7	0000002627	MRK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How could I do like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If Item 1 and Item 2 are same TANUm &amp;amp; VLTYP, PERFORM FUNCTION_ABC. If not, PERFORM FUNCTION DEF.&lt;/P&gt;&lt;P&gt;If Item 2 and Item 3 are same TANUm &amp;amp; VLTYP, PERFORM FUNCTION_ABC. If not, PERFORM FUNCTION DEF.&lt;/P&gt;&lt;P&gt;If Item 3 and Item 4 are same TANUm &amp;amp; VLTYP, PERFORM FUNCTION_ABC. If not, PERFORM FUNCTION DEF.&lt;/P&gt;&lt;P&gt;If Item 4 and Item 5 are same TANUm &amp;amp; VLTYP, PERFORM FUNCTION_ABC. If not, PERFORM FUNCTION DEF.&lt;/P&gt;&lt;P&gt;If Item 5 and Item 6 are same TANUm &amp;amp; VLTYP, PERFORM FUNCTION_ABC. If not, PERFORM FUNCTION DEF.&lt;/P&gt;&lt;P&gt;If Item 6 and Item 7 are same TANUm &amp;amp; VLTYP, PERFORM FUNCTION_ABC. If not, PERFORM FUNCTION DEF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 15:23:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680641#M1100653</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T15:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison data in Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680642#M1100654</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;First copy the body of table itab into other table jtab..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab[ ] = jtab[ ].&lt;/P&gt;&lt;P&gt;v_index = sy-tabix.&lt;/P&gt;&lt;P&gt;v_index1 = v_index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table jtab with key index = v_index1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if jtab-num eq itab-num and  jtab-no eq itab-no .&lt;/P&gt;&lt;P&gt;perform abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform xyz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&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;rgds,&lt;/P&gt;&lt;P&gt;paras&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 15:30:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680642#M1100654</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T15:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison data in Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680643#M1100655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;For this type of requirement you need to play around with the index number in the internal table&lt;/P&gt;&lt;P&gt;What you need to do is loop at the internal table and then read the current index and read current index + 1. &lt;/P&gt;&lt;P&gt;then on the basis of the condition Put your logic behind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chdianand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 15:34:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680643#M1100655</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T15:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison data in Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680644#M1100656</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;Just as Chdianand while loop the table read the next record too, use a workarea like your table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: WA LIKE ITAB,
           CURRENT_INDEX TYPE I,
           NEXT_INDEX        TYPE I.

LOOP AT ITAB.
   CURRENT_INDEX = SY-TABIX.
   NEXT_INDEX        = SY-TABIX + 1.
    
   READ TABLE ITAB INTO WA INDEX NEXT_INDEX.
   IF SY-SUBRC = 0.
     IF ITAB = WA.
     ELSE.
     ENDIF.
   ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 15:52:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680644#M1100656</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T15:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison data in Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680645#M1100657</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;Thanks for the replies.&lt;/P&gt;&lt;P&gt;I have think of doing it in this way. So far the output is working fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any place in the code which I enhance to make it work better?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT XRLDRI
        lv_counter = lv_counter + 1.

        IF lv_counter &amp;gt;= 13.
          call function 'CONTROL_FORM'
             exporting
                  command = 'NEW-WINDOW'.
          CLEAR: lv_counter, FLG_HU_PRINT.
        ENDIF.

        IF NOT lv_tanum IS INITIAL AND NOT lv_vltyp IS INITIAL.
          IF lv_tanum &amp;lt;&amp;gt; XRLDRI-tanum OR lv_vltyp &amp;lt;&amp;gt; XRLDRI-vltyp.
            call function 'CONTROL_FORM'
               exporting
                    command = 'NEW-WINDOW'.

            lv_tanum = XRLDRI-tanum.
            lv_vltyp = XRLDRI-vltyp.
            CLEAR: lv_counter, FLG_HU_PRINT.
          ENDIF.
        ELSE.
          lv_tanum = XRLDRI-tanum.
          lv_vltyp = XRLDRI-vltyp.
        ENDIF.

        PERFORM MULTI_PRINT.
    ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 02:17:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680645#M1100657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T02:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison data in Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680646#M1100658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi myahsam wong,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          Do like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data : begin of itab occurs 0,
            item,
            tanum,
            vltyp, 
         end of itab.
data : item1 like itab-item.
data : item2 like itab-item.
Loop at itab.
   item1 = itab-item.
   if item1 = item2.
       perform  FUNCTION_DEF.
   endif.
   item2 = item1.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ragu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 03:46:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparison-data-in-internal-table/m-p/4680646#M1100658</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T03:46:15Z</dc:date>
    </item>
  </channel>
</rss>

