Skip to Content

Problem with Standara Inheritance in SAP CRM

I Inherited a Standard Class to cl_cmpic_mail_wrapper_base to CL_CMPIC_MAIL_WRAPPER_BASE to YCL_CMPIC_MAIL_WRAPPER_BASE and written below code.

DATA : lr_obj TYPE REF TO cl_cmpic_mail_wrapper_base,

lr_sub_obj TYPE REF TO ycl_cmpic_mail_wrapper_base,

lr_cx_move TYPE REF TO cx_sy_move_cast_error,

lv_error_txt TYPE string.

CREATE OBJECT lr_obj.

TRY .

lr_sub_obj ?= lr_obj.

CATCH cx_sy_move_cast_error INTO lr_cx_move.

lv_error_txt = lr_cx_move->get_text( ).

WRITE:/ lv_error_txt.

ENDTRY.



As per the standard inheritance the obj lr_sub_obj should get the reference of lr_obj. But it is giving the error like below.

Source type \CLASS=CL_CMPIC_MAIL_WRAPPER_BASE is not compatible, for the purposes of assignment, with target type \CLASS=YCL_CMPIC_MAIL_WRAPPER_BASE. Can any one explain this.


Thanks.

Ravichand.

sub1.PNG (19.8 kB)
sub2.PNG (17.5 kB)
sub3.PNG (6.6 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 18, 2016 at 11:48 PM

    Hi Rav,

    I test the same code. I get no syntax error. You may need to check your YCL_* class if it is active and all the methods are active.

    See my screenshots.

    1, my class.

    2, my report and no error upon code checking.

    Spencer


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 19, 2016 at 09:49 AM

    it does not throw any syntax error. Just execute the program then check.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.