Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does the second CREATE OBJECT generate a short dump?
    primarykey
    data
    text
    <p>I have got a following case.</p> <p>An include with a local interface definition</p> <pre><code>*&amp;---------------------------------------------------------------------* *&amp; Include ZZZ_INCL_INTERFACE *&amp;---------------------------------------------------------------------* INTERFACE lif_test. METHODS: test. ENDINTERFACE. "lif_test </code></pre> <p>A report which uses this include and defines a class implementing this interface.</p> <pre><code>*&amp;---------------------------------------------------------------------* *&amp; Report ZZZ_IMPL_A *&amp; *&amp;---------------------------------------------------------------------* *&amp; *&amp; *&amp;---------------------------------------------------------------------* REPORT zzz_impl_a. INCLUDE zzz_incl_interface. *----------------------------------------------------------------------* * CLASS lcl_test_a DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_test_a DEFINITION FINAL. PUBLIC SECTION. INTERFACES: lif_test. ENDCLASS. "lcl_test_a DEFINITION *----------------------------------------------------------------------* * CLASS lcl_test_a IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_test_a IMPLEMENTATION. METHOD lif_test~test. ENDMETHOD. "lif_test~test ENDCLASS. "lcl_test_a IMPLEMENTATION </code></pre> <p>And a second report which also uses this include and defines a new class also implementing the same interface defined in the include.</p> <pre><code>*&amp;---------------------------------------------------------------------* *&amp; Report ZZZ_IMPL_B *&amp; *&amp;---------------------------------------------------------------------* *&amp; *&amp; *&amp;---------------------------------------------------------------------* REPORT zzz_impl_b. INCLUDE zzz_incl_interface. *----------------------------------------------------------------------* * CLASS lcl_test_b DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_test_b DEFINITION FINAL. PUBLIC SECTION. INTERFACES: lif_test. ENDCLASS. "lcl_test_b DEFINITION *----------------------------------------------------------------------* * CLASS lcl_test_b IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_test_b IMPLEMENTATION. METHOD lif_test~test. ENDMETHOD. "lif_test~test ENDCLASS. "lcl_test_b IMPLEMENTATION CLASS lcl_main DEFINITION FINAL CREATE PRIVATE. PUBLIC SECTION. CLASS-METHODS: main. ENDCLASS. CLASS lcl_main IMPLEMENTATION. METHOD main. DATA: l_rif_test TYPE REF TO lif_test. CREATE OBJECT l_rif_test TYPE ('\PROGRAM=ZZZ_IMPL_B\CLASS=LCL_TEST_B'). CREATE OBJECT l_rif_test TYPE ('\PROGRAM=ZZZ_IMPL_A\CLASS=LCL_TEST_A'). ENDMETHOD. ENDCLASS. END-OF-SELECTION. lcl_main=&gt;main( ). </code></pre> <p>The line <code>CREATE OBJECT l_rif_test TYPE ('\PROGRAM=ZZZ_IMPL_A\CLASS=LCL_TEST_A')</code> generates a short dump saying that the dynamically created object is not an implementation of <code>lif_test</code>. Could one explain why it is like that? It looks like a great hole in the language definition. To stop any discussion at the very beginning: No I cannot use dictionary definition of the interface.</p> <p>EDIT: More descriptive short dump is obtained when trying to cast the instance of the object created by the second <code>CREATE OBJECT</code>.</p> <pre><code>DATA: l_rcl_object TYPE REF TO object. *... CREATE OBJECT l_rcl_object TYPE ('\PROGRAM=ZZZ_IMPL_A\CLASS=LCL_TEST_A'). l_rif_test ?= l_rcl_object. </code></pre> <p>The short dump has it that</p> <pre><code>The content of the source variable does not fit in the target variable. Source type: "\PROGRAM=ZZZ_IMPL_A\CLASS=LCL_TEST_A" Target type: "\PROGRAM=ZZZ_IMPL_B\INTERFACE=LIF_TEST" </code></pre> <p>It looks like when I include a local definition of an interface in two places they become a two separate definitions, one of program <code>ZZZ_IMPL_B</code> and the second of <code>ZZZ_IMPL_A</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload