‎2007 Aug 23 11:34 PM
Hi
I have a question to all ABAP gurus.There is a standard class called CL_RSPLS_ALVL and I wish to execute mathod ACTIVATE . Since this method is defined as "Instance Method" , it doesnot appear when I try to execute this class using F8 transaction. It only shows me static methods to run.
How do I test this method ? by executing this class?
Is there any other way I can execute this method?
Thanks
AG
‎2007 Aug 23 11:46 PM
Not sure what this class does, or even if calling the method ACTIVATE will do anything, but you would need to create a instance of the object, you should be able to do this in SE24, using the Test button, create the instance, then call the method. Or you can write a short test program. Of course, if this method has parameters you will need to handle them as well as well as any parameters in the constructor method.
data: o_ref type ref to CL_RSPLS_ALVL.
create object o_ref.
call method o_ref->activate( ).Regards,
Rich Heilman
Regards,
RIch Heilman
‎2007 Aug 23 11:46 PM
Not sure what this class does, or even if calling the method ACTIVATE will do anything, but you would need to create a instance of the object, you should be able to do this in SE24, using the Test button, create the instance, then call the method. Or you can write a short test program. Of course, if this method has parameters you will need to handle them as well as well as any parameters in the constructor method.
data: o_ref type ref to CL_RSPLS_ALVL.
create object o_ref.
call method o_ref->activate( ).Regards,
Rich Heilman
Regards,
RIch Heilman
‎2007 Aug 23 11:54 PM
Hi Rich
I am not a good programmer . I tried copy the code that you given below and I got into another syntax error that says - "You cannot create an instance of the class "CL_RSPLS_ALVL" outside the class". I actually create a small test program and paste your code.
Can you please help. When I tried executing the class, option to create instance of the class was greyed out so I could not even do that step.
Thanks
AG
‎2007 Aug 23 11:57 PM
‎2007 Aug 23 11:59 PM
Can you or someone help to understand how to do that ?
Thanks a lot
AG
‎2007 Aug 24 12:06 AM
I'm looking at the class now, it has private instaniation, which means that you can not call the CONSTRUCTOR, but it does have a static method called FACTORY which a lot of times will give you an instance of the class, it appears that in this case it does. So when in the class in SE24, click the "Test" button, you will see a list of methods, execute the factory method, give the parameters and continue executing, I think at the next point you will be able to execute the ACTIVATE method.
I am not at all familar with this class, so I don't know what its for, what it does, or even what it needs as far as parameters are concerned.
Regards,
Rich Heilman
‎2007 Aug 24 12:14 AM
Thanks Rich.
I think now I can execute this ACTIVATE method after executing the FACTORY method. If I wish to put all this execution steps into code then is it too much of effort? Is it going to be few lines of code or not a good idea to write that complex code? Can you help if possible.
Thanks
Appreciated your help
AG
‎2007 Aug 24 12:21 AM
Well, since you are testing this class, I would think that the end result would be that you want to use it in your code somehow, right? But as far as calling it in code, you would need to pass the parameters and call the method. SOmething like this.
DATA: o_ref TYPE REF TO cl_rspls_alvl.
TRY.
CALL METHOD cl_rspls_alvl=>factory
EXPORTING
i_aggrlevel = '1' "Whatever value here
* i_new = rs_c_false
* i_reload = rs_c_false
* i_txtlg =
* i_txtsh =
* i_infoarea =
* i_bwappl =
* i_infoprov =
RECEIVING
r_r_alvl = o_ref
.
CATCH cx_rspls_object_not_found .
CATCH cx_rs_msg .
CATCH cx_rs_not_found .
ENDTRY.
CALL METHOD o_ref->activate( ).
Regards,
Rich Heilman
‎2007 Aug 24 12:25 AM
Thanks Rich
Appreciated your help
Full points awarded .
Have a good day
AG
‎2007 Aug 24 12:32 AM
Hi Al,
this class has been designed to only allow it to instantiate itself.
there will probably be a static method for instantiation that returns the reference to the object.
You will need to do something like this.
data: myobj type ref CL_RSPLS_ALVL.
myobj = CL_RSPLS_ALVL=>INSTANTIATE( ).Obviously the method name will be different and it may require you to pass parameters.
Cheers
Graham