‎2007 May 17 10:20 AM
Hi gurus,
the following code:
<b><i>DATA: ref_cl_rsd_odso TYPE REF TO cl_rsd_odso,
ref_if_rsd_dta type ref to if_rsd_dta,
e_s_dta TYPE rsd_s_dta,
wa_e_s_dta TYPE rsd_s_dta.
START-OF-SELECTION.
create object ref_cl_rsd_odso.
CALL METHOD ref_cl_rsd_odso->if_rsd_dta~dta_get_info
IMPORTING
e_s_dta = e_s_dta.</i></b>
return an activation error:
"You cannot create an instance of the class "CL_RSD_ODSO" outside the class"
Could you help me?
Thanks in advance!
Bye!
Ferdinando
‎2007 May 17 10:39 AM
The class cl_rsd_odso has its instantiation set to 'Private' which means that you cannot create a public instance of the same in your program. The class can only be instantiated from within itself.
Your program should work if you comment out the 'Create object' statement.
Hope this helps.
Sudha
‎2007 May 17 10:38 AM
i think no need to create Instance for this class.
then code will be
DATA: ref_cl_rsd_odso TYPE REF TO cl_rsd_odso,
ref_if_rsd_dta type ref to if_rsd_dta,
e_s_dta TYPE rsd_s_dta,
wa_e_s_dta TYPE rsd_s_dta.
START-OF-SELECTION.
CALL METHOD ref_cl_rsd_odso->if_rsd_dta~dta_get_info
IMPORTING
e_s_dta = e_s_dta.
Regards
Peram
‎2007 May 17 10:39 AM
The class cl_rsd_odso has its instantiation set to 'Private' which means that you cannot create a public instance of the same in your program. The class can only be instantiated from within itself.
Your program should work if you comment out the 'Create object' statement.
Hope this helps.
Sudha
‎2007 May 17 10:52 AM
Hi,
if i comment "create object", the activation is ok, but there is a dump when
run pgm (OBJECTS_OBJREF_NOT_ASSIGNED, CX_SY_REF_IS_INITIAL).
HELP!!!!!!!!!!!!!!!!!!!!!!!!!!
tHANKS!
1
‎2007 May 17 11:30 AM
Hi,
Go through the below code,
We need to call the factory method to get the instance of this class.
DATA: ref_cl_rsd_odso TYPE REF TO cl_rsd_odso,
ref_if_rsd_dta type ref to if_rsd_dta ,
e_s_dta TYPE rsd_s_dta,
wa_e_s_dta TYPE rsd_s_dta.
START-OF-SELECTION.
CALL METHOD CL_RSD_ODSO=>FACTORY
EXPORTING
I_ODSOBJECT = SPACE
I_REFNM =
I_TXTLG =
I_TXTSH =
I_INFOAREA =
I_BWAPPL =
RECEIVING
R_R_ODSO = ref_cl_rsd_odso.
EXCEPTIONS
INPUT_INVALID = 1
CANCELLED = 2
others = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD ref_cl_rsd_odso->if_rsd_dta~dta_get_info
IMPORTING
e_s_dta = e_s_dta.
Regards,
Azaz Ali.
‎2007 May 17 10:46 AM
Hi,
Your class will be private thats the reason it is giving that error. You can create an instance of private class only in that class itself.
If you want to create object of that class declare static method in that class call that method using the syntax class_name=>method_name in the start-of-selection and then create the object in that method.
Regards,
Azaz Ali.