<?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: nested control statements in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668049#M1447341</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellant,   Getting  expected  result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Feb 2010 06:25:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-25T06:25:22Z</dc:date>
    <item>
      <title>nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668037#M1447329</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 want to nest  two fields Field1 and field4 then change cnt  as below example&lt;/P&gt;&lt;P&gt;I want  output  as cnt &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cnt  should  increse  when there is change in anlage  and  field4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Field1           firld2            field3           field4          cnt&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20100129|20100301  |     1 |&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100129|20100301  |    1 |&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20091230|20100128  |     2 |&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100101|20100128  |    2|&lt;/P&gt;&lt;P&gt;4003911795|IH-ONKW-B |20091230|20091231  |   1 |&lt;/P&gt;&lt;P&gt;4003911795|IH-OFKW-B |20091126|20091229  |    2 |&lt;/P&gt;&lt;P&gt;4003911796|IH-ONKW-B |20091126|20091229  |   2 |&lt;/P&gt;&lt;P&gt;4003911797|IH-OFKW-B |20090929|20091125  |    1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20091001|20091125  |    1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20090929|20090930  |     2 |&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 04:29:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668037#M1447329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T04:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668038#M1447330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using control break statement at new for  field1 and field4&lt;/P&gt;&lt;P&gt;you can define a new variable var and increment it everytime &lt;/P&gt;&lt;P&gt;and pass the same to cnt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 04:34:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668038#M1447330</guid>
      <dc:creator>GauthamV</dc:creator>
      <dc:date>2010-02-25T04:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668039#M1447331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Asha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your table is like:&lt;/P&gt;&lt;P&gt;first 2 records which has same field1 and field2 has count-1&lt;/P&gt;&lt;P&gt;next two records has count- 2&lt;/P&gt;&lt;P&gt;again count1, count2..&lt;/P&gt;&lt;P&gt;Can you explain how exactly you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also post your code as well so that it si easy to suggest the changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Swarna Munukoti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 04:39:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668039#M1447331</guid>
      <dc:creator>former_member217544</dc:creator>
      <dc:date>2010-02-25T04:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668040#M1447332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did  like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  sort it_ETTIFN3 descending by field1 field4.&lt;/P&gt;&lt;P&gt;  loop at it_ETTIFN3 into wa_ETTIFN3.&lt;/P&gt;&lt;P&gt;     cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;     wa_ETTIFN3-cnt = cnt.&lt;/P&gt;&lt;P&gt;            modify it_ETTIFN3 from wa_ETTIFN3 transporting cnt.&lt;/P&gt;&lt;P&gt;       at end of field1.  clear: cnt, wa_ETTIFN3-cnt. endat.&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;&lt;/P&gt;&lt;P&gt;output  showing as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eld1           firld2            field3           field4          cnt         need output as&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20100129|20100301  |     1 |    1&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100129|20100301  |    2 |     1&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20091230|20100128  |     3 |    2&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100101|20100128  |    4|     2&lt;/P&gt;&lt;P&gt;4003911795|IH-ONKW-B |20091230|20091231  |   1 |     1&lt;/P&gt;&lt;P&gt;4003911795|IH-OFKW-B |20091126|20091229  |    2 |    2  &lt;/P&gt;&lt;P&gt;4003911796|IH-ONKW-B |20091126|20091229  |   1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-OFKW-B |20090929|20091125  |    1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20091001|20091125  |    2 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20090929|20090930  |     3 |&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>Thu, 25 Feb 2010 04:42:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668040#M1447332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T04:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668041#M1447333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here I want to check  two  fields  field1 and field4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;both  fields field1  and field4  are same no  increse in counter, if  fields1 and  field 4  diff then  counter increses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;preset output   as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Field1           firld2            field3           field4          cnt&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20100129|20100301  |     1 |&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100129|20100301  |    2 |&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20091230|20100128  |     3 |&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100101|20100128  |    4|&lt;/P&gt;&lt;P&gt;4003911795|IH-ONKW-B |20091230|20091231  |   1 |&lt;/P&gt;&lt;P&gt;4003911795|IH-OFKW-B |20091126|20091229  |    2 |&lt;/P&gt;&lt;P&gt;4003911796|IH-ONKW-B |20091126|20091229  |   1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-OFKW-B |20090929|20091125  |    1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20091001|20091125  |    2 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20090929|20090930  |     3 |&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i mention as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at end of  field1.&lt;/P&gt;&lt;P&gt;  clear  cnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;need output as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Field1           firld2            field3           field4          cnt&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20100129|20100301  |     1 |&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100129|20100301  |    1 |&lt;/P&gt;&lt;P&gt;4003911794|IH-OFKW-B |20091230|20100128  |     2&lt;/P&gt;&lt;P&gt;4003911794|IH-ONKW-B |20100101|20100128  |    2&lt;/P&gt;&lt;P&gt;4003911795|IH-ONKW-B |20091230|20091231  |   1 |&lt;/P&gt;&lt;P&gt;4003911795|IH-OFKW-B |20091126|20091229  |    2 |&lt;/P&gt;&lt;P&gt;4003911796|IH-ONKW-B |20091126|20091229  |   1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-OFKW-B |20090929|20091125  |    1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20091001|20091125  |    1 |&lt;/P&gt;&lt;P&gt;4003911797|IH-ONKW-B |20090929|20090930  |     2 |&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>Thu, 25 Feb 2010 04:56:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668041#M1447333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T04:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668042#M1447334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Asha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep one more field field5 in the internal table and &lt;/P&gt;&lt;P&gt;concatenate field1 and field4 and keep it in field5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now in loop use&lt;/P&gt;&lt;P&gt;at end field5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swarna Munukoti.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 05:05:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668042#M1447334</guid>
      <dc:creator>former_member217544</dc:creator>
      <dc:date>2010-02-25T05:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668043#M1447335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like this&lt;/P&gt;&lt;P&gt;Restructure your internal table. Set Field4 as your second field in the internal table. so your table would be like&lt;/P&gt;&lt;P&gt;field1&lt;/P&gt;&lt;P&gt;field4&lt;/P&gt;&lt;P&gt;field2&lt;/P&gt;&lt;P&gt;field3&lt;/P&gt;&lt;P&gt;cnt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now run a loop on on the internal table&lt;/P&gt;&lt;P&gt;Loop at &amp;lt;internaltab&amp;gt; into &amp;lt;work area&amp;gt;.&lt;/P&gt;&lt;P&gt;at new &amp;lt;field 4&amp;gt;&lt;/P&gt;&lt;P&gt;cnt = cnt + 1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;modify the internal table with value of cnt.&lt;/P&gt;&lt;P&gt;at end of &amp;lt;field 4&amp;gt;&lt;/P&gt;&lt;P&gt;cnt = 0.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify the above pseudocode as per your requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sachin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 05:06:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668043#M1447335</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T05:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668044#M1447336</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;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can solves this problem using loop and read at the table. use below code, it will definitely work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at itab into wa_itab.
v_index = sy-tabix.
if v_index = 1.
 move-corresponding wa_itab to wa_final.
 wa_final-count = 1.
 v_count = wa_final-count.
 append wa_final to i_final.
else.
 v_index = v_index - 1.
 read table itab into wa_itab_new with index v_index.
  if wa_itab-field1 EQ wa_itab_new-field1.
   if wa_itab-field4 NE wa_itab_new-field4.
    move-corresponding wa_itab to wa_final_new.
    wa_final-count = v_count + 1.
    append wa_final to i_final.
    v_count = wa_final-count.
   endif.
  elseif wa_itab-field1 NE wa_itab_new-field1.
   if wa_itab-field4 NE wa_itab_new-field4.
    v_count = 1.
    move-corresponding wa_itab to wa_final.
    wa_final-count = v_count.
    append wa_final to i_final.
    v_count = wa_final-count.
   endif.
  elseif wa_itab-field1 NE wa_itab_new-field1.
   if wa_itab-field4 EQ wa_itab_new-field4.
    move-corresponding wa_itab to wa_final_new.
    wa_final-count = v_count.
    append wa_final to i_final.
    v_count = wa_final-count.
   endif.
  elseif wa_itab-field1 EQ wa_itab_new-field1.
   if wa_itab-field4 EQ wa_itab_new-field4.
    move-corresponding wa_itab to wa_final_new.
    wa_final-count = v_count.
    append wa_final to i_final.
    v_count = wa_final-count.
   endif.
  endif.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 05:43:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668044#M1447336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T05:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668045#M1447337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here,&lt;/P&gt;&lt;P&gt;I want to get result  based on  two  fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;f1   f2      1&lt;/P&gt;&lt;P&gt;f1   f2      1&lt;/P&gt;&lt;P&gt;f1   f3      2&lt;/P&gt;&lt;P&gt;f2   f11    1&lt;/P&gt;&lt;P&gt;f2   f22    2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 05:53:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668045#M1447337</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T05:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668046#M1447338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Asha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you need to change count based on two fields, you can't use At endat. You need to consider all conditions based on field1 and field4. So, in the above code i gave, i am considering all those conditions and based on that count will be set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, please try out that code and let me know if it is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 05:58:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668046#M1447338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T05:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668047#M1447339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT  ZEX_VIJ.

data : begin of itab occurs 0,
       f1(10) type c,
       f2(10) type c,
       f3 type d,
       f4 type d,
       f5(2) type c,
       end of itab.

*****************internal table ...
*1
itab-f1 = '4003911794'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20100129'.
itab-f4 = '20100301'.
append itab.

*2
itab-f1 = '4003911794'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20100129'.
itab-f4 = '20100301'.
append itab.

*3
itab-f1 = '4003911794'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20100129'.
itab-f4 = '20100328'.
append itab.

*4
itab-f1 = '4003911794'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20100129'.
itab-f4 = '20100328'.
append itab.

*5
itab-f1 = '4003911795'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20091230'.
itab-f4 = '20091131'.
append itab.

itab-f1 = '4003911795'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20091230'.
itab-f4 = '20091231'.
append itab.

itab-f1 = '4003911796'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20091230'.
itab-f4 = '20091231'.
append itab.

itab-f1 = '4003911797'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20091230'.
itab-f4 = '20091125'.
append itab.

itab-f1 = '4003911797'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20091230'.
itab-f4 = '20091125'.
append itab.

itab-f1 = '4003911797'.
itab-f2 = 'IH-OFKW-B'.
itab-f3 = '20091230'.
itab-f4 = '20090930'.
append itab.

*****************internal table ...
data : lv_flag type c ,
       lv_cnt type i  ,
       lv_date type d.
sort itab by f1.
  loop at itab.
    at new f1.
     lv_flag = 'X'.
    endat.

    if lv_flag = 'X'.
    lv_cnt = 1.
    lv_date = itab-f4.
    lv_flag = ''.
    endif.

    if lv_date = itab-f4.
    lv_cnt = lv_cnt.
    else.
    lv_date = itab-f4.
    lv_cnt = lv_cnt + 1.
    endif.

    itab-f5 = lv_cnt .

    modify itab index sy-tabix.

    at end of f1.
    clear: lv_flag, lv_date,lv_cnt.
    endat.
  write :/ itab-f1, itab-f2, itab-f3, itab-f4, itab-f5.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Execute this and check if this meets ur requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br, &lt;/P&gt;&lt;P&gt;Vijay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 06:12:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668047#M1447339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T06:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668048#M1447340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;v_index = v_index - 1.&lt;/P&gt;&lt;P&gt; read table itab into wa_itab_new with index v_index.&lt;/P&gt;&lt;P&gt;  if wa_itab-field1 EQ wa_itab_new-field1.&lt;/P&gt;&lt;P&gt;   if wa_itab-field4 NE wa_itab_new-field4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iam  getting  syntax  error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could  you help me in read  statment&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 06:19:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668048#M1447340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T06:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668049#M1447341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellant,   Getting  expected  result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 06:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668049#M1447341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T06:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668050#M1447342</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;Sorry for mistake. Syntax should be as below. Also, you can check syntax for such statements by pressing F1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;read table itab into wa_itab_new index v_index.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 06:26:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668050#M1447342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T06:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: nested control statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668051#M1447343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Asha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : BEGIN OF itab OCCURS 0,
       f1(10) TYPE c,
       f2(10) TYPE c,
       f3 TYPE d,
       f4 TYPE d,
       f5(2) TYPE c,
       count TYPE i,  " Add this 
       END OF itab.


DATA : jtab LIKE itab OCCURS 0 WITH HEADER LINE.

jtab[] = itab[].
SORT itab BY f1 ASCENDING f4 ASCENDING.
SORT jtab BY f1 ASCENDING f4 ASCENDING.

LOOP AT itab.
  tabix = sy-tabix.
  CLEAR itab-count.
  LOOP AT jtab WHERE f1 = itab-f1 AND f4 = itab-f4.
    itab-count = itab-count + 1.
  ENDLOOP.
  MODIFY itab INDEX tabix.
  WRITE :/ itab-f1, sy-vline,
  itab-f2, sy-vline,
  itab-f3, sy-vline,
  itab-f4, sy-vline,
  itab-count, sy-vline.
ENDLOOP.
"This is the output

4003911794   IH-OFKW-B    29012010   01032010            2
4003911794   IH-OFKW-B    29012010   01032010            2
4003911794   IH-OFKW-B    29012010   28032010            2
4003911794   IH-OFKW-B    29012010   28032010            2
4003911795   IH-OFKW-B    30122009   31112009            1
4003911795   IH-OFKW-B    30122009   31122009            1
4003911796   IH-OFKW-B    30122009   31122009            1
4003911797   IH-OFKW-B    30122009   30092009            1
4003911797   IH-OFKW-B    30122009   25112009            2
4003911797   IH-OFKW-B    30122009   25112009            2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this serves your purpse.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Feb 2010 06:34:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-control-statements/m-p/6668051#M1447343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-25T06:34:56Z</dc:date>
    </item>
  </channel>
</rss>

