cancel
Showing results for 
Search instead for 
Did you mean: 

CX_SY_MOVE_CAST_ERROR - Source type CLASS=CL_SRQM_INC_INCIDENTSRL_CN00 is

Former Member
0 Kudos

Hi,

I added a Z field with AET. After adding AET field I generated Getter and Setter methods. After adding Getter and setter methods WEB UI started to give below error;

"CX_SY_MOVE_CAST_ERROR - Source type CLASS=CL_SRQM_INC_INCIDENTSRL_CN00 is not compatible, for the purposes of assignment, with target type CLASS=ZL_SRQM_INC_INCIDENTSRL_CN00 "

I know after generating Getter and Setter for Z fields, CL_SRQM_INC_INCIDENTSRL_CN00 now differs from ZL_SRQM_INC_INCIDENTSRL_CN00. I have copied super class of ZL_SRQM_INC_INCIDENTSRL_CN00, I changed class names from CL.. to ZL but it did not work.

How can i fix it up? Could someone help me? I need to use Getter and Setter methods of Z fields. What is your advice?

Best wishes,

Ümit Yılmaz

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Solution is

go to class ZL_SRQM_INC_INCIDENTSRL_IMPL

then go method WD_CREATE_CONTEXT

correct the code as the following;

method WD_CREATE_CONTEXT.

  • create the context

super->wd_create_context( ).

context = cl_bsp_wd_context=>get_instance(

iv_controller = me

iv_type = 'ZL_SRQM_INC_INCIDENTSRL_CTXT' ).

typed_context ?= context.

ztyped_context ?= context.

  • super->wd_create_context( ).

  • Added by wizard

endmethod.

0 Kudos

Hi Umit,

What is the super class of ZL_SRQM_INC_INCIDENTSRL_CN00?

Give the class CL_SRQM_INC_INCIDENTSRL_CN00 as superclass.

Regards,

Leon

Former Member
0 Kudos

I wrote the issue to SAP OSS. They sent me a solution, it was helpful but incomplete. I completed the solution. Solution is as the following;

Go to class ZL_SRQM_INC_INCIDENTSRL_IMPL's method WD_CREATE_CONTEXT;

Code of method should be like this;

method WD_CREATE_CONTEXT.
*   create the context
  super->wd_create_context( ).

  context = cl_bsp_wd_context=>get_instance(
          iv_controller = me
          iv_type = 'ZL_SRQM_INC_INCIDENTSRL_CTXT' ).

  typed_context ?= context.
  ztyped_context ?= context.

endmethod.

mukundkansara
Participant
0 Kudos

Umit

First thing u dont hv to copy super class. when u enhance it SAP automatically manage it everything. Just simply create Setter Getter method. It sud work.

Former Member
0 Kudos

Hi,

I had tried it earlier steps, after folowing standard procedure as you said, i had the error mentioned above. Do you have another advice?

Thanks,

Best regards,

Ümit Yılmaz

kavindra_joshi
Active Contributor
0 Kudos

CHeck this SAP NOTE 1316083. It may solve your problem.

Regards

Kavindra

VishnAndr
Active Contributor
0 Kudos

Where exactly do you have an error? I mean exact peace of code.

It seems that you try to call some method which return standard class.

Former Member
0 Kudos

Hi Joshi,

I applied that before. It resolves only the problem of generating getter and setter for fields created EEWB and AET. My problem is different from this.

Hi Andrei,

I tell you what i did exactly;

Firstly, I created a Z field with AET. The name of field is ZZAFLD000008.

Secondly, I extended SRQM_INCIDENT_S's IncidentSRL view.

After second step there is no problem I can use view wthout any problem.

Thirdly, I generated getter and setter of ZZAFLD000008.

After third step I get error

"CX_SY_MOVE_CAST_ERROR - Source type CLASS=CL_SRQM_INC_INCIDENTSRL_CN00 is not compatible, for the purposes of assignment, with target type CLASS=ZL_SRQM_INC_INCIDENTSRL_CN00 "

Then my intention is adding a Z field and change its value when listing service request.

Thanks

Ümit Yılmaz

VishnAndr
Active Contributor
0 Kudos

Ümit Yılmaz,

when the error is generated it's also shown the place (class and method) and the code line of the error (line number). I've asked what exactly in the line which is generated the error.

Former Member
0 Kudos

Complete error message

Cannot display view SRQM_INCIDENT_S/IncidentSRL of UI Component SRQM_INCIDENT_S

An exception has occurred Exception Class CX_SY_MOVE_CAST_ERROR - Source type \CLASS=CL_SRQM_INC_INCIDENTSRL_CN00 is not compatible, for the purposes of assignment, with target type \CLASS=ZL_SRQM_INC_INCIDENTSRL_CN00

Method: CL_BSP_PAGE_BASE=>IF_BSP_PAGE~SET_ATTRIBUTE

Source Text Row: 24

Source code line;

method IF_BSP_PAGE~SET_ATTRIBUTE .


* uses ****************************************************************

* data ****************************************************************
  data: valtype.
  field-symbols: <value> type any.

* code ****************************************************************

  translate name to upper case. "#EC NOTEXT

  assign me->(name) to <value>.
  if sy-subrc <> 0.
    raise exception type cx_bsp_inv_attr_name
      exporting name = name.
  endif.

  describe field value type valtype.

  if valtype = 'r' or
     valtype = 'l'.
    <value> ?= value.
  else.
    <value> = value.
  endif.

endmethod.

The above method is standard method, I think I did something wrong or incomplete.

VishnAndr
Active Contributor
0 Kudos

First of all put a break-point in this method (CL_BSP_PAGE_BASE=>IF_BSP_PAGE~SET_ATTRIBUTE). And check the call stack. You'll see from where it is called.

Seems that for some reason you (or generated code in Z-class) call a SET-method.

I've actually checked the component and it seems that this is search result view. If so you do not need to have SET-method at all because it's only a list and get-methods only are required.