Session Object Declaration

All session objects are declared as type ApiObject. For example,

Local ApiObject &MYSESSION;
Global ApiObject &PSMessage;

The following session objects can be declared as Global or Component:

  • Session

  • PSMessages Collection

  • PSMessage

All other session objects must be declared as Local.

In this section, we discuss the following topics:

  • State considerations.

  • Considerations for declaring conditions.

In the PeopleSoft Pure Internet Architecture, all processing occurs on the server. If you do something in your PeopleCode program that causes a trip back to the user before the end of your PeopleCode program, the PeopleCode program cannotregain its state, that is, it can't reset local variables, and so on. This applies to all APIs that use the Session object.

If you must go back to the user before the end of your PeopleCode program, you must set all your objects to NULL before you go, or else you receive a runtime error.

For example, the following code causes an error:

&Session = %Session;
Rem &Session = Null;
WinMessage("Hello");

The following example does not cause an error:

&Session = %Session;
&Session = Null;
WinMessage("Hello");

You must declare all collections for C/C++ and COM as objects, or else you receive errors at runtime.

For example if you're using RegionalSettings, include the following your declarations for a VB program:

Dim oRegionalSettings As Object

Then, use the following code to populate this variable:

Set oRegionalSettings = oCISession.RegionalSettings
oRegionalSettings.LanguageCd = "GER"