<?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: INITIAL vs. NOT BOUND in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876225#M675142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well,  the only thing that I would say is, that the IS BOUND syntax is specific to object references, so when you see this in your code, you automatically know that you are talking about an object,  if you use IS INITIAL, it becomes ambiguous as to what you are talking about, since it could be a variable, internal table, or object reference.  I believe that the IS BOUND syntax should always be used when referring to object references, this provides for better readibility and maintance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Sep 2007 15:31:56 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2007-09-19T15:31:56Z</dc:date>
    <item>
      <title>INITIAL vs. NOT BOUND</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876224#M675141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you explain me the difference? I understand that IS BOUND is to know if a reference holds an instance of an object. But using INITIAL appears to fulfill this requirement also, so there must be other difference I'm not seeing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've done this code for testing this and the output is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;INITIAL before CREATE OBJECT: TRUE&lt;/P&gt;&lt;P&gt;NOT BOUND before CREATE OBJECT: TRUE&lt;/P&gt;&lt;P&gt;INITIAL after CREATE OBJECT: FALSE&lt;/P&gt;&lt;P&gt;NOT BOUND after CREATE OBJECT: FALSE&lt;/P&gt;&lt;P&gt;INITIAL after CLEAR: TRUE&lt;/P&gt;&lt;P&gt;NOT BOUND after CLEAR: TRUE&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS lcl_test DEFINITION.
  PUBLIC SECTION.
    DATA:
      atrib1 TYPE i.
    METHODS:
      constructor.
ENDCLASS.                    "lcl_test DEFINITION

*----------------------------------------------------------------------*
*       CLASS lcl_test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_test IMPLEMENTATION.

  METHOD constructor.
    atrib1 = 1.
  ENDMETHOD.                    "lcl_test

ENDCLASS.                    "lcl_test DEFINITION

CONSTANTS: c_true   TYPE string VALUE 'TRUE',
           c_false  TYPE string VALUE 'FALSE'.

DATA: o_test TYPE REF TO lcl_test,
      g_bool TYPE string.

START-OF-SELECTION.

  IF o_test IS INITIAL.
    g_bool = c_true.
  ELSE.
    g_bool = c_false.
  ENDIF.
  WRITE: /,'INITIAL before CREATE OBJECT:',g_bool.

  IF o_test IS NOT BOUND.
    g_bool = c_true.
  ELSE.
    g_bool = c_false.
  ENDIF.
  WRITE: /,'NOT BOUND before CREATE OBJECT:',g_bool.

*************************
  CREATE OBJECT o_test.
*************************

  IF o_test IS INITIAL.
    g_bool = c_true.
  ELSE.
    g_bool = c_false.
  ENDIF.
  WRITE: /,'INITIAL after CREATE OBJECT:',g_bool.

  IF o_test IS NOT BOUND.
    g_bool = c_true.
  ELSE.
    g_bool = c_false.
  ENDIF.
  WRITE: /,'NOT BOUND after CREATE OBJECT:',g_bool.

*************************
  CLEAR o_test.
*************************

  IF o_test IS INITIAL.
    g_bool = c_true.
  ELSE.
    g_bool = c_false.
  ENDIF.
  WRITE: /,'INITIAL after CLEAR:',g_bool.

  IF o_test IS NOT BOUND.
    g_bool = c_true.
  ELSE.
    g_bool = c_false.
  ENDIF.
  WRITE: /,'NOT BOUND after CLEAR:',g_bool.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please explain the difference?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alejandro Bindi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 15:20:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876224#M675141</guid>
      <dc:creator>alejandro_bindi</dc:creator>
      <dc:date>2007-09-19T15:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: INITIAL vs. NOT BOUND</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876225#M675142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well,  the only thing that I would say is, that the IS BOUND syntax is specific to object references, so when you see this in your code, you automatically know that you are talking about an object,  if you use IS INITIAL, it becomes ambiguous as to what you are talking about, since it could be a variable, internal table, or object reference.  I believe that the IS BOUND syntax should always be used when referring to object references, this provides for better readibility and maintance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2007 15:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876225#M675142</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-09-19T15:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: INITIAL vs. NOT BOUND</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876226#M675143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, thanks Rich it's clear now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 03:19:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876226#M675143</guid>
      <dc:creator>alejandro_bindi</dc:creator>
      <dc:date>2007-09-20T03:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: INITIAL vs. NOT BOUND</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876227#M675144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &amp;lt;u&amp;gt;ref IS [NOT] BOUND&amp;lt;/u&amp;gt; statement queries whether reference variable ref contains a valid reference. &amp;lt;i&amp;gt;ref&amp;lt;/i&amp;gt; has to be a data reference variable or object reference variable here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When a data reference is involved, this logical expression is true if it can be dereferenced; when an object reference is involved, it is true if it points to an object. The logical expression is always false if &amp;lt;i&amp;gt;ref&amp;lt;/i&amp;gt; contains the null reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In comparison, the logical expression &amp;lt;u&amp;gt;ref IS [NOT] INITIAL&amp;lt;/u&amp;gt; merely lets you determine whether or not &amp;lt;i&amp;gt;ref&amp;lt;/i&amp;gt; contains the null reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A little bit philosophical &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 11:18:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876227#M675144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T11:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: INITIAL vs. NOT BOUND</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876228#M675145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually this is not exactly the difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IS INITIAL - can be used with normal data-type and with reference-data-types&lt;/P&gt;&lt;P&gt;IS BOUND - is valid only for references. These are both object- and data-references.&lt;/P&gt;&lt;P&gt;(i.e. "TYPE REF TO object" or "TYPE REF TO data")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For object references, it doesn't matter, wether you use IS BOUND or IS INITIAL (IS BOUND is always preferable for references, tho)&lt;/P&gt;&lt;P&gt;The major difference is the handling of data-references. For data-references it is possible, that IS INITIAL is &lt;STRONG&gt;false&lt;/STRONG&gt; and IS BOUND is &lt;STRONG&gt;false&lt;/STRONG&gt;!!! &lt;/P&gt;&lt;P&gt;This happens when your reference points to local variable, which was automatically deleted at the end of a routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Hristo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2007 15:39:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/initial-vs-not-bound/m-p/2876228#M675145</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-20T15:39:35Z</dc:date>
    </item>
  </channel>
</rss>

