‎2008 Jun 17 4:41 AM
Hi,
I want to use a method which is part of global calss in my custom program. But I am not able to create object to use the same.
Class Name : CL_SA_TAB_PROJECTDOCU
Method : UPDATE_NEW_DOC
Can some one explain me how to call it from custom program and what are the constrains to do the same.
Thanks in advacne.
Regards,
avis
‎2008 Jun 17 7:14 AM
Hi,
Please check if the class CL_SA_TAB_PROJECTDOCU has a method called "constructor" or not.
If yes, then there is a possibility that the constructor may have some parameters that needs to be passed.
Just for your info:
Constructor is a method that is called by default while creating the object of the class. If this method has a parameter then that needs to be passed when you create the object.
If no,
then as already mentioned, you have to check if the method has some obligatory parameter that needs to be passed.
But looking at you update it seems you are getting an error while creating the object. So I guess it is related to the constructor.
Regards,
Saurabh
‎2008 Jun 17 4:51 AM
may be class or method is abstract. and you should implement that class
or it's method.
another reason is method you want call defined as private or protected method.
‎2008 Jun 17 4:55 AM
‎2008 Jun 17 4:52 AM
create an object of the class and then try to call the method..
‎2008 Jun 17 4:57 AM
when i am declaring for create object, i am getting the error as obligatory parameter "TAB_VIS_REF" had no value assigned to it.
‎2008 Jun 17 5:01 AM
‎2008 Jun 17 4:59 AM
did you instantiate object? if not, write following:
data o type ref to CL_SA_TAB_PROJECTDOCU.
create object o.
call method o->UPDATE_NEW_DOC
"importing
".......
"exporting
"............
.or if that method is static method you can call it without instantiating object of class:
call method CL_SA_TAB_PROJECTDOCU->UPDATE_NEW_DOC
"importing
".......
"exporting
"............
.
‎2008 Jun 17 7:14 AM
Hi,
Please check if the class CL_SA_TAB_PROJECTDOCU has a method called "constructor" or not.
If yes, then there is a possibility that the constructor may have some parameters that needs to be passed.
Just for your info:
Constructor is a method that is called by default while creating the object of the class. If this method has a parameter then that needs to be passed when you create the object.
If no,
then as already mentioned, you have to check if the method has some obligatory parameter that needs to be passed.
But looking at you update it seems you are getting an error while creating the object. So I guess it is related to the constructor.
Regards,
Saurabh
‎2008 Jun 17 7:31 AM
Dude its simple...
the way you are creating object of the class in not correct.
the constructor of the class is expecting some parameter and you have not passed it. Pass all the obligatory parameters and job done.
For reference read the article Constructors in chapter Object Oriented ABAP on the site
[www.abaplearning.com|www.abaplearning.com]
direct link: http://www.abaplearning.com/index.php?option=com_content&view=section&id=1&Itemid=5
You will have to log in on the site to see the examples and tutorials.
--
Keep Learning
‎2008 Jun 17 12:26 PM