<?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: Clearing a local variable in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686122#M1669550</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;All the above statements are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, I believe that is better to write an extra line of code clearing a local variable that to omit it and under certain circumstances ( loop etc ) have a data error in a report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think that the code is written by amateurs when I see a clear statement for a local variable as mentioned above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2012 12:23:16 GMT</pubDate>
    <dc:creator>laurent_fournier2</dc:creator>
    <dc:date>2012-05-29T12:23:16Z</dc:date>
    <item>
      <title>Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686115#M1669543</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;I was having a discussion with someone who wanted me to remove CLEAR statement with local variable. I use to follow the rule that we should always clear a variable before use. But now I couldn't find any reason why we should do this. Expert comments needed. Also, what does official SAP standards say?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 17:40:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686115#M1669543</guid>
      <dc:creator>Bhaskar_Tripath</dc:creator>
      <dc:date>2012-05-11T17:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686116#M1669544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Clearing variable before use is always better. But in this case you are using a local field which will get&amp;nbsp; declared only in that subroutine. Hence even if you dont clear it, field will be initial. &lt;/P&gt;&lt;P&gt;But inside a loop, you will have to clear(depending on circumstances).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 18:13:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686116#M1669544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-05-11T18:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686117#M1669545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Hi :If you are using subroutines, f.m , methods in a loop &lt;/SPAN&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;its always good to clear local variables since you follow this practice i would advice there is no harm in doing so performance wise etc.&lt;/SPAN&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt; only exist for as long as the procedure is running.&amp;nbsp; Here procedure is subroutine,f.m , methods&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From official standards:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Global variables:Variables that you declare with the DATA statement live for as long as the context in which they are defined. So variables in an ABAP main program exist for the entire runtime of the program, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;local variables: in subroutines, function modules , methods&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial;"&gt;Hope this helps in explaining the fact that clearing local variable depends on circumstances.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 18:31:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686117#M1669545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-05-11T18:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686118#M1669546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Clearing a local variable prior to use is almost a replication of the data statement that created it.&amp;nbsp; I can't figure out why one of my ex-colleagues did that in every form...endform.&amp;nbsp; I can't begin to imagine how many of these time-wasters I've removed...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question: what's the point of:&lt;/P&gt;&lt;P&gt;form....&lt;/P&gt;&lt;P&gt;data: lv_var(1) type c. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; clear lv_var.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Answer:&amp;nbsp; Just looks like an amateur wrote the code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 18:33:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686118#M1669546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-05-11T18:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686119#M1669547</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;local vars do not need to be clear prior to use. They are by definition cleared after the data declaration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course as mentioned before if you are using them in a LOOP then you might need to clear, depending on the situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Adi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 19:22:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686119#M1669547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-05-11T19:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686120#M1669548</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 believe we not need to clear local variables (Of course on &lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;circumstances&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;As we know the purpose of local variable is just within some scope (FORM...ENDFORM, Function Module, etc), It is no need to clear local variables all the time as global variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;nimz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2012 15:06:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686120#M1669548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-05-13T15:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686121#M1669549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Yes this piece of code is absolutely not required for local variables used inside the sub-routines.Well few things should always be applied depending on LOGIC and may not require to search for so called SAP standards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;Supratim Saha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 11:34:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686121#M1669549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-05-29T11:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Clearing a local variable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686122#M1669550</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;All the above statements are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, I believe that is better to write an extra line of code clearing a local variable that to omit it and under certain circumstances ( loop etc ) have a data error in a report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think that the code is written by amateurs when I see a clear statement for a local variable as mentioned above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2012 12:23:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/clearing-a-local-variable/m-p/8686122#M1669550</guid>
      <dc:creator>laurent_fournier2</dc:creator>
      <dc:date>2012-05-29T12:23:16Z</dc:date>
    </item>
  </channel>
</rss>

