Skip to Content
0
Aug 04, 2022 at 02:29 PM

CREATE_OBJECT_CLASS_NOT_FOUND by CREATE-TYPE field name

52 Views Last edit Aug 04, 2022 at 02:46 PM 3 rev

Hello to everyone.

It's faster to put the code before to explain:

REPORT  Zmassimiliano LINE-SIZE 356 NO STANDARD PAGE HEADING.

CLASS cl_ZPP15 DEFINITION.

 PUBLIC SECTION.
    METHODS constructor.

ENDCLASS. "cl_ZPP15

*---------------------------------------------------------------------*
*       Classe figlio implementazione: ZPP15 (Etichettatrice)
*---------------------------------------------------------------------*
CLASS cl_ZPP15 IMPLEMENTATION.

  METHOD constructor.
    WRITE 'CIAO'.
  ENDMETHOD.

ENDCLASS. "cl_ZPP15

DATA:  ro_zpp TYPE REF TO object,
       ro_zpp15 TYPE REF TO cl_ZPP15,
       wa_zmaildef TYPE zmail_def.

*---------------------------------------------------------
START-OF-SELECTION.

      wa_zmaildef-cc = 'cl_ZPP15'.

*      CREATE OBJECT ro_zpp15.   " Works fine

*      CREATE OBJECT ro_zpp TYPE cl_ZPP15.   " Works fine

       CREATE OBJECT ro_zpp TYPE (wa_zmaildef-cc). " DOESN'T WORK !!!

      FREE ro_zpp.

The first and the second "CREATE OBJECT" work fine, the third give me the error "CREATE_OBJECT_CLASS_NOT_FOUND - CREATE OBJECT: The class "cl_ZPP15" was not found".

It recognizes the field value "cl_ZPP15" and looks for this class (declared just above) but it can't find it.

What am I doing wrong? The statement "CREATE OBJECT ro_zpp TYPE cl_ZPP15." works fine: isn't this the same thing?