‎2009 Apr 16 3:35 PM
Hi expert,
I have problem with "CLASS":
In my program i'm calling a method wich give me :
.
I want just the first : How can i do not to take the second?
How can right in abap :
if ... eq CLASS=CL_RETM_PERIOD_MNGR
exit.
endif.
Thanks a lot,
‎2009 Apr 16 6:32 PM
Hello
Perhaps for this requirement SAP provides a corresponding method:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_IS_INSTANCE_OF
*&
*&---------------------------------------------------------------------*
*& Thread: Problem with Abap Object
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1309987"></a>
*&---------------------------------------------------------------------*
REPORT zus_sdn_is_instance_of.
DATA:
go_term_mngr TYPE REF TO cl_reaj_term_mngr,
to_period_mngr TYPE REF TO cl_retm_period_mngr.
START-OF-SELECTION.
" NOTE: Direct instantiation not possible => fake coding
CREATE OBJECT go_term_mngr.
CREATE OBJECT go_period_mngr.
IF ( cf_reca_object=>get_classname( go_term_mngr ) = 'CL_REAJ_TERM_MNGR' ).
ELSE.
ENDIF.
END-OF-SELECTION.
Perhaps it is necessary to use the underlying interfaces instead of the classes:
IF_REAJ_TERM_MNGR
IF_RETM_PERIOD_MNGRRegards
Uwe
Regards
Uwe
‎2009 Apr 16 3:45 PM
DATA: lv_vbap TYPE REF TO <class_name>.
CREATE OBJECT lv_vbap.
if lv_vbap eq CL_RETM_PERIOD_MNGR.
do ...this
else.
donot .. do this
endif.
‎2009 Apr 16 4:11 PM
Thank u for your response but it doesn't work.
the problem is here:
if lv_vbap eq CL_RETM_PERIOD_MNGR.
It takes CL_RETM_PERIOD_MNGR as a field and not as class, and gives: CL_RETM_PERIOD_MNGR is unknown
‎2009 Apr 16 4:18 PM
‎2009 Apr 16 4:24 PM
You mean: ?
IF lo_specific_term_mngr EQ {O:153*\CLASS=CL_REAJ_TERM_MNGR}.
DO.
go_adjmterm_mngr ?= lo_specific_term_mngr.
ENDDO.
ENDIF.
If it's that , it doesn't work: the error message: {0 is unknown.
‎2009 Apr 16 6:32 PM
Hello
Perhaps for this requirement SAP provides a corresponding method:
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_IS_INSTANCE_OF
*&
*&---------------------------------------------------------------------*
*& Thread: Problem with Abap Object
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1309987"></a>
*&---------------------------------------------------------------------*
REPORT zus_sdn_is_instance_of.
DATA:
go_term_mngr TYPE REF TO cl_reaj_term_mngr,
to_period_mngr TYPE REF TO cl_retm_period_mngr.
START-OF-SELECTION.
" NOTE: Direct instantiation not possible => fake coding
CREATE OBJECT go_term_mngr.
CREATE OBJECT go_period_mngr.
IF ( cf_reca_object=>get_classname( go_term_mngr ) = 'CL_REAJ_TERM_MNGR' ).
ELSE.
ENDIF.
END-OF-SELECTION.
Perhaps it is necessary to use the underlying interfaces instead of the classes:
IF_REAJ_TERM_MNGR
IF_RETM_PERIOD_MNGRRegards
Uwe
Regards
Uwe
‎2009 Apr 17 8:39 AM