Peoplesoft Application Package - Application Class/Application Package peoplecode and Calling them anywhere
Peoplesoft Application Package - Define Application Class and Calling Application class and Application Class Method from any Peoplecode event:
Step 1:
Create New Application Package - MYPACKAGE
Step2:
Add a new application class in it. - MyClass
Step 3:
Defining Class and methods inside (Public or Private)
1. We can define classes here
2. We can define methods here
3. We can define Class Property
Code to write inside a class to define class and its method:
class MyClass
method MyMethod (&smyInput as String, &nmyInput as Number) returns string;
private
method MyPrivateMethod (&sInput as String) returns boolean;
property string &sVar;
property number &nVar;
end-class;
method MyMethod
/*+Method Body+*/
returns &sVar;
end-method;
method MyPrivateMethod
/*+Method Body+*/
returns &bVar;
end-method;
Code to write call a class and run its method:
import MYPACKAGE:MyClass;
Local string &sGetMethodData;
Local MYPACKAGE:MyClass &oClassObjectVariable = create MYPACKAGE:MyClass();
/*+ If function is returning data, we need to assign it into a variable+*/
&sGetMethodData = &oClassObjectVariable.MyMethod(&smyInput, &nmyInput);
/*+ If function is not returning data+*/
&oClassObjectVariable.MyMethod(&smyInput, &nmyInput);
Thank You for coming to my blog, keep following it and let me know in case of any help in comment section.
Let me know in comments if you want me to cover any peoplesoft topic in my blog.
Keep Learning, Keep Sharing.