<?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: Confusion in loop inside loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708444#M892863</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;CLEAR act_billing.&lt;/P&gt;&lt;P&gt;IF sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;MOVE wa_final-wlp08 TO t_act_billing.&lt;/P&gt;&lt;P&gt;act_billing = act_billing + t_act_billing.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CLEAR: it_prps, it_final.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your problem comes from here&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLEAR: it_prps, it_final&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are clearing the header line of it_prps wherein it is used as a condition for the 2nd loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2008 03:36:06 GMT</pubDate>
    <dc:creator>peter_ruiz2</dc:creator>
    <dc:date>2008-05-06T03:36:06Z</dc:date>
    <item>
      <title>Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708443#M892862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have some confution in below code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here am trying to calculate  Actual Billing and Planned Revenue. but here for each value am looping it_final table inside the main loop. &lt;/P&gt;&lt;P&gt;but the prob is if i loop it_final for one value it is giving value, but if i try to loop 2 times for 2 values, it is not giving first value also.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e if i comment loop for Planned Revenue then Actual Billing is displaying, if i try for 2 values, then its giving zeros for 2 values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so could anyone check is there any mistake i did.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: it_prps, it_final, wa_final, wa_it_prps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_prps.&lt;/P&gt;&lt;P&gt;    CASE month.&lt;/P&gt;&lt;P&gt;      WHEN '08'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="20" type="ul"&gt;&lt;P&gt;  ACTUAL BILLING&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        LOOP AT it_final INTO wa_final&lt;/P&gt;&lt;P&gt;         WHERE posid = it_prps-posid&lt;/P&gt;&lt;P&gt;            AND wrttp = c_04&lt;/P&gt;&lt;P&gt;            AND beltp = c_02&lt;/P&gt;&lt;P&gt;            AND versn = c_0&lt;/P&gt;&lt;P&gt;            AND ( vorga = c_coin OR vorga = c_rku2 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CLEAR act_billing.&lt;/P&gt;&lt;P&gt;          IF sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;            MOVE wa_final-wlp08 TO t_act_billing.&lt;/P&gt;&lt;P&gt;            act_billing = act_billing + t_act_billing. &lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;          CLEAR: it_prps, it_final.&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*************PLANNED REVENUE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        LOOP AT it_final INTO wa_final&lt;/P&gt;&lt;P&gt;                         WHERE posid = it_prps-posid&lt;/P&gt;&lt;P&gt;                         AND wrttp = c_01&lt;/P&gt;&lt;P&gt;                         AND beltp = c_02&lt;/P&gt;&lt;P&gt;                         AND versn = c_0&lt;/P&gt;&lt;P&gt;                         AND ( vorga = c_sdor OR vorga = c_rkp5 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CLEAR plan_rev.&lt;/P&gt;&lt;P&gt;          IF sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;            MOVE wa_final-wlp08 TO t_plan_rev.&lt;/P&gt;&lt;P&gt;            plan_rev = plan_rev + t_plan_rev.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;          CLEAR: it_prps, it_final.&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt; ENDCASE.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;WRITE:/10 'Actual Billing is',act_billing.&lt;/P&gt;&lt;P&gt;WRITE:/20 'Actual Cost is........', actu_cost.&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 in advace,&lt;/P&gt;&lt;P&gt;sudharsan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 03:24:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708443#M892862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T03:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708444#M892863</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;CLEAR act_billing.&lt;/P&gt;&lt;P&gt;IF sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;MOVE wa_final-wlp08 TO t_act_billing.&lt;/P&gt;&lt;P&gt;act_billing = act_billing + t_act_billing.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CLEAR: it_prps, it_final.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your problem comes from here&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLEAR: it_prps, it_final&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are clearing the header line of it_prps wherein it is used as a condition for the 2nd loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 03:36:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708444#M892863</guid>
      <dc:creator>peter_ruiz2</dc:creator>
      <dc:date>2008-05-06T03:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708445#M892864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;as peter said dont clear the internal table clear the work area only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sandipan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 03:53:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708445#M892864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T03:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708446#M892865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No Friends, if i clear work area also it is not giving values, if i try for 2 values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; please check is there any other reason?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance,&lt;/P&gt;&lt;P&gt;sudharsan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 04:10:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708446#M892865</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T04:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708447#M892866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi SUDHARSAN RAO &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U r clearing the headers and tables. So u cannot use the values on the nested loops  as u have cleared the values. There wont be anything in the workare ur using in where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the below comments that I kept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; LOOP AT it_prps.&lt;/P&gt;&lt;P&gt;ACTUAL BILLING &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_final INTO wa_final&lt;/P&gt;&lt;P&gt;WHERE posid = it_prps-posid&lt;/P&gt;&lt;P&gt;AND wrttp = c_04&lt;/P&gt;&lt;P&gt;AND beltp = c_02&lt;/P&gt;&lt;P&gt;AND versn = c_0&lt;/P&gt;&lt;P&gt;AND ( vorga = c_coin OR vorga = c_rku2 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR act_billing.&lt;/P&gt;&lt;P&gt;IF sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;MOVE wa_final-wlp08 TO t_act_billing.&lt;/P&gt;&lt;P&gt;act_billing = act_billing + t_act_billing. &lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;*******************************************&lt;/P&gt;&lt;P&gt;CLEAR: it_prps, it_final.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Here IT_FINAL is cleared by u... should not be cleared&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;********************************************&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*************PLANNED REVENUE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_final INTO wa_final&lt;/P&gt;&lt;P&gt;WHERE posid = it_prps-posid&lt;/P&gt;&lt;P&gt;AND wrttp = c_01&lt;/P&gt;&lt;P&gt;AND beltp = c_02&lt;/P&gt;&lt;P&gt;AND versn = c_0&lt;/P&gt;&lt;P&gt;AND ( vorga = c_sdor OR vorga = c_rkp5 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR plan_rev.&lt;/P&gt;&lt;P&gt;IF sy-subrc IS INITIAL.&lt;/P&gt;&lt;P&gt;MOVE wa_final-wlp08 TO t_plan_rev.&lt;/P&gt;&lt;P&gt;plan_rev = plan_rev + t_plan_rev.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Again ur clearing both tables.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLEAR: it_prps, it_final.&lt;/P&gt;&lt;P&gt;********************************&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;WRITE:/10 'Actual Billing is',act_billing.&lt;/P&gt;&lt;P&gt;WRITE:/20 'Actual Cost is........', actu_cost.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 04:12:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708447#M892866</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T04:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708448#M892867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi sudharsan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace this code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLEAR: it_prps, it_final.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  append wa_final to it_final.
  clear wa_final.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are not appending the data to the internal table that is why only one record is being displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 05:17:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708448#M892867</guid>
      <dc:creator>peter_ruiz2</dc:creator>
      <dc:date>2008-05-06T05:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708449#M892868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to append wa_final TO it_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;actually we are getting values from it_final into wa_final while looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;btu i tried like u also, eventhrough not working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;sudharsan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 07:03:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708449#M892868</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T07:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708450#M892869</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;I see that you are clearing the variable ACT_BILLING inside the loop (LOOP at IT_FINAL).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is the variable which holds the total and you are clearing inside the loop. that is the reason when there are multiple records it is not working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remove that clear statement. similar case for PLAN_REV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These variables can be cleared before the loop actually begins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Lakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 07:15:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708450#M892869</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-06T07:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion in loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708451#M892870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i agree with Santhanalakshmi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;remove this lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR act_billing.&lt;/P&gt;&lt;P&gt;CLEAR plan_rev.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;another reason for this is that your are displaying actu_cost here&lt;/P&gt;&lt;P&gt;WRITE:/20 'Actual Cost is........', actu_cost.&lt;/P&gt;&lt;P&gt;wherein you are using plan_rev.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2008 07:30:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/confusion-in-loop-inside-loop/m-p/3708451#M892870</guid>
      <dc:creator>peter_ruiz2</dc:creator>
      <dc:date>2008-05-06T07:30:59Z</dc:date>
    </item>
  </channel>
</rss>

