<?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: internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750780#M1114287</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 try the following sample:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of t_stru,
        start_date type SYDATS,
        end_date type SYDATS,
       end of t_stru.

data: itab type standard table of t_stru.

Data: wa1 like line of itab,
      wa like line of itab.

Data: l_tabix like sy-tabix,
      l_tabix1 like sy-tabix.

wa-start_date = '20081001'.
wa-end_date = '20081002'.
append wa to itab.

wa-start_date = '20081002'.
wa-end_date = '20081003'.
append wa to itab.

wa-start_date = '20081005'.
wa-end_date = '20081007'.
append wa to itab.

wa-start_date = '20081003'.
wa-end_date = '20081004'.
append wa to itab.

clear wa.

Sort itab by start_date  end_date.

Loop at itab into wa1.

l_tabix = sy-tabix .

Clear wa.

l_tabix1 =  l_tabix + 1.
loop at itab into wa  from l_tabix1.

if wa1-end_date = wa-start_date.

wa1-end_date = wa-end_date .
modify itab from wa1 index l_tabix transporting end_date.
delete itab index l_tabix1.
else.
continue.
endif.

endloop.

Endloop.

clear: wa, wa1.

loop at itab into wa.
write: / wa-start_date ,'and ', wa-end_date.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chris Gu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Gu Chris on Nov 10, 2008 4:32 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Nov 2008 03:32:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-10T03:32:28Z</dc:date>
    <item>
      <title>internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750778#M1114285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  I have an internal table where we have x number of records. For example if we have 3 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to compare if the first records end date and 2nd records start date are same. if they are same combine them to one. now check if this records end date is same as the start date of 3rd record. if this is same combine them. if they are not same leave them as they are. if the consecutive records have same start and end dates combine else leave them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my question is how will i compare the first records start date and second records end date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate the help.&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, 09 Nov 2008 05:15:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750778#M1114285</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-09T05:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750779#M1114286</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;Data: wa like line of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data; l_tabix like sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort itab with key start_date, end_date.&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;l_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clear wa.&lt;/P&gt;&lt;P&gt;Read table itab into wa index l_tabix + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab-end_date = wa-start_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Combine the two records.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Nov 2008 05:25:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750779#M1114286</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-09T05:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750780#M1114287</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 try the following sample:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of t_stru,
        start_date type SYDATS,
        end_date type SYDATS,
       end of t_stru.

data: itab type standard table of t_stru.

Data: wa1 like line of itab,
      wa like line of itab.

Data: l_tabix like sy-tabix,
      l_tabix1 like sy-tabix.

wa-start_date = '20081001'.
wa-end_date = '20081002'.
append wa to itab.

wa-start_date = '20081002'.
wa-end_date = '20081003'.
append wa to itab.

wa-start_date = '20081005'.
wa-end_date = '20081007'.
append wa to itab.

wa-start_date = '20081003'.
wa-end_date = '20081004'.
append wa to itab.

clear wa.

Sort itab by start_date  end_date.

Loop at itab into wa1.

l_tabix = sy-tabix .

Clear wa.

l_tabix1 =  l_tabix + 1.
loop at itab into wa  from l_tabix1.

if wa1-end_date = wa-start_date.

wa1-end_date = wa-end_date .
modify itab from wa1 index l_tabix transporting end_date.
delete itab index l_tabix1.
else.
continue.
endif.

endloop.

Endloop.

clear: wa, wa1.

loop at itab into wa.
write: / wa-start_date ,'and ', wa-end_date.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chris Gu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Gu Chris on Nov 10, 2008 4:32 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2008 03:32:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750780#M1114287</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-10T03:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750781#M1114288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Oscar,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: wa_table type t_itab.

loop at itab.
  wa_itab = itab.
  if itab-condition = wa_itab-condition.
   it_final-total = it_final-total + wa_tab-total.
   else.
     append it_final.
  endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chidanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2008 03:47:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-table/m-p/4750781#M1114288</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-10T03:47:42Z</dc:date>
    </item>
  </channel>
</rss>

