<?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: abap object in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371324#M809255</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; &lt;STRONG&gt;Narrowing Cast:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Getting a super class variable to refer to a subclass variable is called Narrowing Cast&lt;/P&gt;&lt;P&gt;E.g. Obj_super = obj_sub.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After Narrowing cast, you can use the super class reference to access the components of the subclass instance that were inherited from super class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The components inherited from the superclass can be addressed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also called &amp;#147;Up-Cast&amp;#148;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use: A user who is not interested in the finer points of subclasses, but only in the attributes of the superclass, does not need to know about them. The user only wants to work with references to the superclass. Hence in order to allow the user to work with subclass objects, you need a Narrowing cast&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also used to access interface components&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Widening Cast:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Getting a sub class variable to refer to a superclass variable is called Widening Cast&lt;/P&gt;&lt;P&gt;Also called &amp;#147;Down-Cast&amp;#148;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem (Need for widening cast):&lt;/P&gt;&lt;P&gt;Data: r_vehicle TYPE REF To lcl_vehicle.&lt;/P&gt;&lt;P&gt;LOOP AT vehicle_list INTO r_vehicle.&lt;/P&gt;&lt;P&gt;*Only for trucks&lt;/P&gt;&lt;P&gt;*	&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;The solution (Widening cast):&lt;/P&gt;&lt;P&gt;Data: r_vehicle TYPE REF To lcl_vehicle,&lt;/P&gt;&lt;P&gt;          r_truck TYPE REF TO lcl_truck.&lt;/P&gt;&lt;P&gt;LOOP AT vehicle_list INTO r_vehicle.&lt;/P&gt;&lt;P&gt;  TRY.&lt;/P&gt;&lt;P&gt;    r_truck ?= r_vehicle.&lt;/P&gt;&lt;P&gt;*processing for trucks&lt;/P&gt;&lt;P&gt;    CATCH CX_SY_MOVE_CAST_ERROR INTO r_exception.&lt;/P&gt;&lt;P&gt;*processing for error situation&lt;/P&gt;&lt;P&gt;    CLEANUP.&lt;/P&gt;&lt;P&gt;  ENDTRY.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZTRG_OBJ6                                                   *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ztrg_obj7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_super DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_super DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS: m1,&lt;/P&gt;&lt;P&gt;             m2,&lt;/P&gt;&lt;P&gt;             constructor.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: v1 TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_super DEFINITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_super IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_super IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD m1.&lt;/P&gt;&lt;P&gt;    WRITE: /, 'v1: ', v1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD m2.&lt;/P&gt;&lt;P&gt;    WRITE /'super'.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    v1 = 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_super IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub1DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub1 DEFINITION INHERITING FROM lcl_super.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS: m2 REDEFINITION,&lt;/P&gt;&lt;P&gt;             m3,&lt;/P&gt;&lt;P&gt;             constructor.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: v1 TYPE i,&lt;/P&gt;&lt;P&gt;          v2 TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub DEFINITION&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub1IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub1 IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD m2.&lt;/P&gt;&lt;P&gt;    WRITE: 'sub',&lt;/P&gt;&lt;P&gt;           /, 'v1: ', v1,&lt;/P&gt;&lt;P&gt;           /, 'v2: ', v2.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;m2.  "THIS WILL CALL M2 OF THE SUPER-CLASS&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD m2. "THIS WILL CALL M2 OF THE SUB-CLASS&lt;/P&gt;&lt;P&gt;ENDMETHOD.                    "constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; METHOD m3.&lt;/P&gt;&lt;P&gt;   WRITE 'Test'.&lt;/P&gt;&lt;P&gt; ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub2 dEFINITION INHERITING FROM lcl_super.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS: m2 REDEFINITION,&lt;/P&gt;&lt;P&gt;             m3,&lt;/P&gt;&lt;P&gt;             constructor.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: v1 TYPE i,&lt;/P&gt;&lt;P&gt;          v2 TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub DEFINITION&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub2 IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD m2.&lt;/P&gt;&lt;P&gt;    WRITE: 'sub',&lt;/P&gt;&lt;P&gt;           /, 'v1: ', v1,&lt;/P&gt;&lt;P&gt;           /, 'v2: ', v2.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;m2.  "THIS WILL CALL M2 OF THE SUPER-CLASS&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD m2. "THIS WILL CALL M2 OF THE SUB-CLASS&lt;/P&gt;&lt;P&gt;ENDMETHOD.                    "constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; METHOD m3.&lt;/P&gt;&lt;P&gt;   WRITE 'Test'.&lt;/P&gt;&lt;P&gt; ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  DATA: obj TYPE REF TO lcl_super,&lt;/P&gt;&lt;P&gt;        obj1 TYPE REF TO lcl_sub1,&lt;/P&gt;&lt;P&gt;        obj2 TYPE REF TO lcl_sub2,&lt;/P&gt;&lt;P&gt;        OBJECT_LIST TYPE TABLE OF REF TO lcl_super.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj1.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append obj1 to OBJECT_LIST.&lt;/P&gt;&lt;P&gt;  append obj2 to OBJECT_LIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at OBJECT_LIST into obj.&lt;/P&gt;&lt;P&gt;    TRY.&lt;/P&gt;&lt;P&gt;      obj1 ?= obj.&lt;/P&gt;&lt;P&gt;      write 'Obj1 found'.&lt;/P&gt;&lt;P&gt;      CATCH CX_SY_MOVE_CAST_ERROR.&lt;/P&gt;&lt;P&gt;       write 'Exception caught'.&lt;/P&gt;&lt;P&gt;    ENDTRY.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Feb 2008 11:32:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-06T11:32:45Z</dc:date>
    <item>
      <title>abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371320#M809251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know some what knowledge about abap objects. I am little confuting on casting. Please guide me. Don&amp;#146;t send link because I can understand from that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 09:34:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371320#M809251</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-06T09:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371321#M809252</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;Go to ABAPDOCU tcode and see example programs in abap objects section, you will find separate programs for upcasting and downcasting .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Up-Cast (Widening Cast)&lt;/P&gt;&lt;P&gt;Variables of the type reference to superclass can also refer to subclass instances at runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you assign a subclass reference to a superclass reference, this ensures that&lt;/P&gt;&lt;P&gt;all components that can be accessed syntactically after the cast assignment are&lt;/P&gt;&lt;P&gt;actually available in the instance. The subclass always contains at least the same&lt;/P&gt;&lt;P&gt;components as the superclass. After all, the name and the signature of redefined&lt;/P&gt;&lt;P&gt;methods are identical.&lt;/P&gt;&lt;P&gt;The user can therefore address the subclass instance in the same way as the&lt;/P&gt;&lt;P&gt;superclass instance. However, he/she is restricted to using only the inherited&lt;/P&gt;&lt;P&gt;components.&lt;/P&gt;&lt;P&gt;In this example, after the assignment, the methods GET_MAKE, GET_COUNT,&lt;/P&gt;&lt;P&gt;DISPLAY_ATTRIBUTES, SET_ATTRIBUTES and ESTIMATE_FUEL of the&lt;/P&gt;&lt;P&gt;instance LCL_TRUCK can only be accessed using the reference R_VEHICLE.&lt;/P&gt;&lt;P&gt;If there are any restrictions regarding visibility, they are left unchanged. It is not&lt;/P&gt;&lt;P&gt;possible to access the specific components from the class LCL_TRUCK of the&lt;/P&gt;&lt;P&gt;instance (GET_CARGO in the above example) using the reference R_VEHICLE.&lt;/P&gt;&lt;P&gt;The view is thus usually narrowed (or at least unchanged). That is why we&lt;/P&gt;&lt;P&gt;describe this type of assignment of reference variables as up-cast. There is a&lt;/P&gt;&lt;P&gt;switch from a view of several components to a view of a few components. As&lt;/P&gt;&lt;P&gt;the target variable can accept more dynamic types in comparison to the source&lt;/P&gt;&lt;P&gt;variable, this assignment is also called Widening Cast&lt;/P&gt;&lt;P&gt;Static and Dynamic Types of References&lt;/P&gt;&lt;P&gt;A reference variable always has two types at runtime: static and dynamic.&lt;/P&gt;&lt;P&gt;In the example, LCL_VEHICLE is the static type of the variable R_VEHICLE.&lt;/P&gt;&lt;P&gt;Depending on the cast assignment, the dynamic type is either LCL_BUS or&lt;/P&gt;&lt;P&gt;LCL_TRUCK. In the ABAP Debugger, the dynamic type is specified in the form&lt;/P&gt;&lt;P&gt;of the following object display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Down-cast (Narrowing Cast)&lt;/P&gt;&lt;P&gt;Variables of the type &amp;#147;reference to superclass&amp;#148; can also refer to subclass instances&lt;/P&gt;&lt;P&gt;at runtime. You may now want to copy such a reference (back) to a suitable&lt;/P&gt;&lt;P&gt;variable of the type &amp;#147;reference to subclass&amp;#148;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to assign a superclass reference to a subclass reference, you must&lt;/P&gt;&lt;P&gt;use the down-cast assignment operator MOVE ... ?TO ... or its short form&lt;/P&gt;&lt;P&gt;?=. Otherwise, you would get a message stating that it is not certain that all&lt;/P&gt;&lt;P&gt;components that can be accessed syntactically after the cast assignment are&lt;/P&gt;&lt;P&gt;actually available in the instance. As a rule, the subclass class contains more&lt;/P&gt;&lt;P&gt;components than the superclass.&lt;/P&gt;&lt;P&gt;After assigning this type of reference (back) to a subclass reference to the&lt;/P&gt;&lt;P&gt;implementing class, clients are no longer limited to inherited components: In the&lt;/P&gt;&lt;P&gt;example given here, all components of the LCL_TRUCK instance can be accessed&lt;/P&gt;&lt;P&gt;(again) after the assignment using the reference R_TRUCK2.&lt;/P&gt;&lt;P&gt;The view is thus usually widened (or at least unchanged). That is why we describe&lt;/P&gt;&lt;P&gt;this type of assignment of reference variables as down-cast. There is a switch&lt;/P&gt;&lt;P&gt;from a view of a few components to a view of more components. As the target&lt;/P&gt;&lt;P&gt;variable can accept less dynamic types after the assignment, this assignment is&lt;/P&gt;&lt;P&gt;also called Narrowing Cast&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward if found helpfull,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Chaitanya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 09:37:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371321#M809252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-06T09:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371322#M809253</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;One of the significant principles of inheritance is that an instance from a subclass can be used in every&lt;/P&gt;&lt;P&gt;context in which an instance from the superclass appears. This is possible because the subclass has&lt;/P&gt;&lt;P&gt;inherited all components from the superclass and therefore has the same interface as the superclass. The&lt;/P&gt;&lt;P&gt;user can therefore address the subclass instance in the same way as the superclass instance.&lt;/P&gt;&lt;P&gt;Variables of the type &amp;#147;reference to superclass&amp;#148; can also refer to subclass instances at runtime.&lt;/P&gt;&lt;P&gt;The assignment of a subclass instance to a reference variable of the type &amp;#147;reference to superclass&amp;#148; is&lt;/P&gt;&lt;P&gt;described as a narrowing cast, because you are switching from a view with more detail to a view with less&lt;/P&gt;&lt;P&gt;detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A reference variable always has two types: static and dynamic:&lt;/P&gt;&lt;P&gt;- The static type of a reference variable is determined by variable definition using TYPE REF TO. It cannot&lt;/P&gt;&lt;P&gt;and does not change. It establishes which attributes and methods can be addressed&lt;/P&gt;&lt;P&gt;- The dynamic type of a reference variable is the type of the instance currently being referred to, it is&lt;/P&gt;&lt;P&gt;therefore determined by assignment and can change during the program run. It establishes what coding is&lt;/P&gt;&lt;P&gt;to be executed for redefined methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The static type of a reference variable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is determined using TYPE REF TO&lt;/P&gt;&lt;P&gt;Remains constant throughout the program run&lt;/P&gt;&lt;P&gt;Establishes which attributes and methods can be&lt;/P&gt;&lt;P&gt;addressed&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The dynamic type of a reference variable&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is determined by assignment&lt;/P&gt;&lt;P&gt;Can change during the program run&lt;/P&gt;&lt;P&gt;Establishes what coding is to be executed for redefined&lt;/P&gt;&lt;P&gt;methods&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The widening cast logically represents the opposite of the narrowing cast. The widening cast cannot be&lt;/P&gt;&lt;P&gt;checked statically, only at runtime. The Cast Operator &amp;#147;?=&amp;#148; (or the equivalent &amp;#147;MOVE ... ?TO &amp;#133;&amp;#148;) must be&lt;/P&gt;&lt;P&gt;used to make this visible.&lt;/P&gt;&lt;P&gt;With this kind of cast, a check is carried out at runtime to ensure that the current content of the source&lt;/P&gt;&lt;P&gt;variable corresponds to the type requirements of the target variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this is helpful, Do reward.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 11:01:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371322#M809253</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-06T11:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371323#M809254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Follow the link and download the PDF for abap objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.esnips.com/doc/6d16a298-9227-4d32-acf1-e91164c89daf/3-ABAP-Objects(P283)" target="test_blank"&gt;http://www.esnips.com/doc/6d16a298-9227-4d32-acf1-e91164c89daf/3-ABAP-Objects(P283)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope this is helpful, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 11:05:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371323#M809254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-06T11:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371324#M809255</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; &lt;STRONG&gt;Narrowing Cast:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Getting a super class variable to refer to a subclass variable is called Narrowing Cast&lt;/P&gt;&lt;P&gt;E.g. Obj_super = obj_sub.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After Narrowing cast, you can use the super class reference to access the components of the subclass instance that were inherited from super class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The components inherited from the superclass can be addressed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also called &amp;#147;Up-Cast&amp;#148;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use: A user who is not interested in the finer points of subclasses, but only in the attributes of the superclass, does not need to know about them. The user only wants to work with references to the superclass. Hence in order to allow the user to work with subclass objects, you need a Narrowing cast&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also used to access interface components&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Widening Cast:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Getting a sub class variable to refer to a superclass variable is called Widening Cast&lt;/P&gt;&lt;P&gt;Also called &amp;#147;Down-Cast&amp;#148;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem (Need for widening cast):&lt;/P&gt;&lt;P&gt;Data: r_vehicle TYPE REF To lcl_vehicle.&lt;/P&gt;&lt;P&gt;LOOP AT vehicle_list INTO r_vehicle.&lt;/P&gt;&lt;P&gt;*Only for trucks&lt;/P&gt;&lt;P&gt;*	&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;The solution (Widening cast):&lt;/P&gt;&lt;P&gt;Data: r_vehicle TYPE REF To lcl_vehicle,&lt;/P&gt;&lt;P&gt;          r_truck TYPE REF TO lcl_truck.&lt;/P&gt;&lt;P&gt;LOOP AT vehicle_list INTO r_vehicle.&lt;/P&gt;&lt;P&gt;  TRY.&lt;/P&gt;&lt;P&gt;    r_truck ?= r_vehicle.&lt;/P&gt;&lt;P&gt;*processing for trucks&lt;/P&gt;&lt;P&gt;    CATCH CX_SY_MOVE_CAST_ERROR INTO r_exception.&lt;/P&gt;&lt;P&gt;*processing for error situation&lt;/P&gt;&lt;P&gt;    CLEANUP.&lt;/P&gt;&lt;P&gt;  ENDTRY.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  ZTRG_OBJ6                                                   *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;*&amp;amp;                                                                     *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ztrg_obj7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_super DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_super DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS: m1,&lt;/P&gt;&lt;P&gt;             m2,&lt;/P&gt;&lt;P&gt;             constructor.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: v1 TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_super DEFINITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_super IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_super IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD m1.&lt;/P&gt;&lt;P&gt;    WRITE: /, 'v1: ', v1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD m2.&lt;/P&gt;&lt;P&gt;    WRITE /'super'.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    v1 = 1.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_super IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub1DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub1 DEFINITION INHERITING FROM lcl_super.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS: m2 REDEFINITION,&lt;/P&gt;&lt;P&gt;             m3,&lt;/P&gt;&lt;P&gt;             constructor.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: v1 TYPE i,&lt;/P&gt;&lt;P&gt;          v2 TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub DEFINITION&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub1IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub1 IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD m2.&lt;/P&gt;&lt;P&gt;    WRITE: 'sub',&lt;/P&gt;&lt;P&gt;           /, 'v1: ', v1,&lt;/P&gt;&lt;P&gt;           /, 'v2: ', v2.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;m2.  "THIS WILL CALL M2 OF THE SUPER-CLASS&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD m2. "THIS WILL CALL M2 OF THE SUB-CLASS&lt;/P&gt;&lt;P&gt;ENDMETHOD.                    "constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; METHOD m3.&lt;/P&gt;&lt;P&gt;   WRITE 'Test'.&lt;/P&gt;&lt;P&gt; ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub2 dEFINITION INHERITING FROM lcl_super.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    METHODS: m2 REDEFINITION,&lt;/P&gt;&lt;P&gt;             m3,&lt;/P&gt;&lt;P&gt;             constructor.&lt;/P&gt;&lt;P&gt;  PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: v1 TYPE i,&lt;/P&gt;&lt;P&gt;          v2 TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub DEFINITION&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_sub IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_sub2 IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD m2.&lt;/P&gt;&lt;P&gt;    WRITE: 'sub',&lt;/P&gt;&lt;P&gt;           /, 'v1: ', v1,&lt;/P&gt;&lt;P&gt;           /, 'v2: ', v2.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;m2.  "THIS WILL CALL M2 OF THE SUPER-CLASS&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "m2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  METHOD constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD super-&amp;gt;constructor.&lt;/P&gt;&lt;P&gt;    CALL METHOD m2. "THIS WILL CALL M2 OF THE SUB-CLASS&lt;/P&gt;&lt;P&gt;ENDMETHOD.                    "constructor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; METHOD m3.&lt;/P&gt;&lt;P&gt;   WRITE 'Test'.&lt;/P&gt;&lt;P&gt; ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_sub IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  DATA: obj TYPE REF TO lcl_super,&lt;/P&gt;&lt;P&gt;        obj1 TYPE REF TO lcl_sub1,&lt;/P&gt;&lt;P&gt;        obj2 TYPE REF TO lcl_sub2,&lt;/P&gt;&lt;P&gt;        OBJECT_LIST TYPE TABLE OF REF TO lcl_super.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj1.&lt;/P&gt;&lt;P&gt;  CREATE OBJECT obj2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append obj1 to OBJECT_LIST.&lt;/P&gt;&lt;P&gt;  append obj2 to OBJECT_LIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at OBJECT_LIST into obj.&lt;/P&gt;&lt;P&gt;    TRY.&lt;/P&gt;&lt;P&gt;      obj1 ?= obj.&lt;/P&gt;&lt;P&gt;      write 'Obj1 found'.&lt;/P&gt;&lt;P&gt;      CATCH CX_SY_MOVE_CAST_ERROR.&lt;/P&gt;&lt;P&gt;       write 'Exception caught'.&lt;/P&gt;&lt;P&gt;    ENDTRY.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 11:32:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/3371324#M809255</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-06T11:32:45Z</dc:date>
    </item>
  </channel>
</rss>

