2007 Feb 08 5:04 AM
I have two interface references like follwing.
data: o_storable type ref to IF_RECA_STORABLE.
data: contract_object type ref to IF_RECN_CONTRACT.
after calling following method i will receive instance of type IF_RECN_CONTRACT.
CALL METHOD cf_recn_contract=>find
EXPORTING
id_bukrs =
id_recnnr =
ID_ACTIVITY = RECA1_ACTIVITY-DISPLAY
IF_AUTH_CHECK = ABAP_FALSE
IF_ENQUEUE = ABAP_FALSE
IF_USE_ARCHIVE = ABAP_TRUE
receiving
ro_instance = <b>contract_object</b>
EXCEPTIONS
ERROR = 1
others = 2
After getting reference into <b>contract_object</b>, i will have to refer it to <b>o_storable</b>. Before refering i need to type cast <b>contract_object</b> of type IF_RECN_CONTRACT into IF_RECA_STORABLE.
Please explain me how can i do?.
2007 Feb 08 8:56 AM
HI,
I need more information:
IF_RECA_STORABLE and IF_RECN_CONTRACT are related to each other?
One can assign interface references to other interface/class reference variables, using the assignment operator (=) .
However, there are certain restrictions while doing so. When one does this in a program, system must be able to recognize in the syntax check whether an assignment is possible.
<iref> = <cref>, The class of the class reference <cref> must be implemnet the interface of the interface reference <iref>.
So, I need more information on relations between to interface and class of contract_object.
Thanks,
Chetan Shah