Tuesday, January 24, 2012

Accessing Application Package class object using CreateObject method.

Let’s say we have 2 application package.

1. UserID and

2. Notification.

Here Notification application package uses dynamic changing application package say based on setup.

For our example we are using UserID application package as setup driven application package and it has UserID as Class.


Structure of UserID application package.

class UserID
method GetOpridsByApplicationPack() Returns array of string;
property array of string oprid_arr;

method UserID


method GetOpridsByApplicationPack
/+ Returns Array of String +/

%This.oprid_arr = CreateArrayRept("", 0);
Local string &SupervisorId, &ReportsTo;

%This.oprid_arr.push('PS'); /* Logic to populate data in array. */

Return %This.oprid_arr;


Below is “Notification” application package structure.

In this application package we are using CreateObject to access “GetOpridsByApplicationPackmethod of UserID class of UserID application package .

We are passing Package name and Class Name while calling so they are variable for us. (In this case its UserID and UserID).

class NotificationManager
method GetOpridsByApplicationPack(&PkgRoot As string, &Appcls_Path As string) Returns array of string;


method NotificationManager


method GetOpridsByApplicationPack
/+ &PkgRoot as String, +/
/+ &Appcls_Path as String +/
/+ Returns Array of String +/
Local array of string &aryOpridTo;
Local string &Classname;
Local object &u;
&aryOpridTo = CreateArrayRept(" ", 0);
&Classname = &PkgRoot | ":" | &Appcls_Path;
&u = CreateObject(&Classname);
ObjectDoMethod(&u, "GetOpridsByApplicationPack");
&aryOpridTo = &u.oprid_arr;
Return &aryOpridTo;


Post a Comment