Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dump when using Widening Cast

Former Member
0 Kudos

Hi,

Variable declaration

DATA:

lo_busobj TYPE REF TO if_reca_bus_object,

lo_sub TYPE REF TO zcl_reor_rental_request_ci,

lo_parent TYPE REF TO cl_reor_rental_request.

this is the super class -> cl_reor_rental_request

this is the sub class ->zcl_reor_rental_request_ci

lo_busobj - > this refrence contains the reference to the object 'cl_reor_rental_request'

I want to call the redefined method of my class zcl_reor_rental_request_ci. so for this i assign the object of the class (zcl_reor_rental_request_ci) to the interface reference. BUT

The problem is the already assigned referance of the super class has some attributes assigned in it so I need to copy those attributes in my sub class object and then pass it to the interface reference variable so that all operation are carried out as in normal case, otherwise if i direclty assign the newly created subclass object to the interface reference variable it will call the redefined method but the nothing will happen.

For this reason i tried to assign the super class object to the sub class object i.e WIDENING CAST but it gives a dump


*****************Part of DUMP************************
However, the current content of the source variable does not fit into the target variable.
 source type: "CLASS=CL_REOR_RENTAL_REQUEST"
 target type: "CLASS=ZCL_REOR_RENTAL_REQUEST_CI"

Help is very much appreciated.

Regards,

Khusro Habib

1 REPLY 1

Former Member
0 Kudos

Can you please send the screen shot of the dump.

Sometimes when u create some subclasses from main clases, some components(attributes and methods) have to be redefined.

It might not(generally will not) show these errors while checking, activating or generating your subclass. This could be one important problem for dump.

So check step wise or give some detailed context of the scenario.

reward if satisfied

regards,

Sandeep Josyula