I work on a Peoplesoft project and I am struggling with Peoplecode. I want to create an object with a dynamic classname within Peoplecode. Kind of like in Java. This would look like something like this :
&my_object = create My_Application_Package : Class_string_name()
&my_object.commonMethodCall();
where "Class_string_name" would be dynamic. Is this possible ? And do I mandatoraly need to create an interface for all the concerned classes ?
Any help or advise is welcomed
Thanks
Finally, it is quite simple.
I just used CreateObject function :
CreateObject(str_class_name, create_par, . . .)
Where str_class_name either:
—identifies a class by class name
—identifies a class of OLE Automation object in the form:
app_name.object_name
Description
Use the CreateObject function to return an instance of a class. You can use this function to access an Application Class, a PeopleCode built-in object (like a chart), or an OLE Automation object.
If the class you are creating requires values to be passed, use the create_par parameters to supply them, or use the CreateObjectArray function.
Considerations Using Application Classes
You can use the CreateObject function to access an Application Class. You would want to do this when you were programming at a high-level, when you might not know the name of the class you wanted to access until runtime. You must specify a fully-qualified class name. In addition, the class name is case-sensitive.
The returned object has the type of class you specified.