This chapter discusses:
PeopleCode behavior and limitations.
PeopleCode runtime code template.
Note the behavior and limitations discussed in this section when you write PeopleCode for a component interface.
PeopleCode events and functions that relate exclusively to GUI and online processing cannot be used by component interfaces. These include:
When you run a component interface, the SearchInit, SearchSave, and RowSelect events don’t fire. This means that any PeopleCode associated with these events will not run. The first event to run is RowInit.
Menu PeopleCode and pop-up menus.
The ItemSelected and PrePopup PeopleCode events are not supported. In addition, the CheckMenuItem, DisableMenuItem, EnableMenuItem, HideMenuItem, and UncheckMenuItem functions aren’t available.
Transfers between components, including modal transfers.
The TransferPage, DoModalPageGroup, and IsModalPageGroup functions cannot be used.
Functions related to this control, such as GetSelectedTreeNode, GetTreeNodeParent, GetTreeRecordName, RefreshTree, and TreeDetailInNode cannot be used.
The PSControlInit and PSLostFocus events are not supported, and the GetControl function cannot be used.
The DoSave() and DoSaveNow() pcode functions are not supported. You should use the component interface Save() method and wrap the DoSave() and DoSaveNow() functions so they don’t execute when called from a component interface.
Functions that are ignored in a component interface call.
Some PeopleCode functions are ignored if they are called through a component interface. These functions are:
WinMessage
CheckMenuItem
DisableMenuItem
EnableMenuItem
HideMenuItem
UncheckMenuItem
SetCursorPos
TransferPanel
TransferPage
DoModalComponent
IsModalComponent
DoModalPanelGroup
IsModalPanelGroup
GetSelectedTreeNode
GetTreeNodeParent
RefreshTree
TreeDetailInNode
GetControl
DoSave
DoSaveNow
Gray
Ungray
In previous PeopleSoft releases, CopyRowset* functions for component interfaces were not sensitive to the language code on PSCAMA. Because of this, related language processing did not take place when language code on PSCAMA was different than the base language code. PeopleSoft now detects the language code in PSCAMA.
Component interfaces can run on either the client or the server. By default, a component interface runs on the server. It runs on the client only if the code calling the component interface is running on a client machine.
Component interfaces must run either entirely on the server or entirely on the client. To ensure this runtime restriction, component interface references declared in PeopleCode must be declared as local, not global, variables.
Some built-in functions are always client-only; others are client-only under specific conditions.
Some built-in functions behave differently when used in three-tier mode, as opposed to two-tier mode.
To access a component interface using PeopleCode, Application Designer generates a template in the form of boilerplate PeopleCode that you can adapt to your purposes. This section describes how to generate the template code.
To generate a PeopleCode template for a component interface:
Open the desired component interface definition in Application Designer.
Insert the component interface into a project.
Select Insert, Current Object into Project.
Save the project.
Open the PeopleCode editor.
You can associate component interface PeopleCode with a record, a component, a service operation handler, or an Application Engine program.
Select the component interface from the project workspace.
Drag and drop the object from the project into the PeopleCode editor.
Make any necessary changes to the PeopleCode in the PeopleCode editor window.
The code shown in this section is a dynamically generated PeopleCode template that you can use as a starting point. Replace all default values or <*> notations with specific values or references to valid PeopleCode variables (replace this entire three-character string: <*> ).
Note. The requirement to populate a non-create key is no longer a requirement to do the initial save.
PeopleCode runs only if you are connected. This means that you do not have to explicitly connect. Instead, connect to the existing session, using the %Session system variable.
See Session Classes Methods and Properties.
You cannot connect to a different database through PeopleCode.
Set the PeopleSoft session error message mode. This property is used to determine how messages are output. This property takes either a numeric value or a constant. The default value is 1 (%PSMessages_CollectionOnly).
This property sets the value for the session. You can change modes during a session, for example, if you're starting a component interface. However, after you run the component interface, you should set the value back. Here is the list of modes that you can use:
Mode Value |
Purpose |
0 |
Return no messages |
1 |
Default. Log messages into the PSMessage collection. |
2 |
Pop up a message dialog box. |
3 |
Log messages into the PSMessage collection and pop up a message dialog box. |
See PSMessagesMode.
PeopleCode Template Notes
Get a reference to the component interface providing its name. (A runtime error occurs if the component interface does not exist.)
Set the keys for the component interface. In this example SDK_EMPLID is the Get key.
The get() method retrieves data from the database, associated with the key values.
Get and print properties at level 0.
Similar code is generated for the properties SDK_BIRTHDATE and SDK_DEPTID.
Get collection at level 1 (SDK_BUS_EXP_PER).
Get and print properties at level 1.
Similar code is generated for the properties SDK_EMPLID and SDK_BUS_EXP_SUM in the SDK_BUS_EXP_PER collection.
Get collection at level 2 (SDK_BUS_EXP_DTL).
&oSdkBusExpDtlCollection = &oSdkBusExpPer.SDK_BUS_EXP_DTL;
Get and print properties at level 2.
Similar code is generated for the properties SDK_EMPID, SDK_EXP_PER_DT, SDK_EXPENSE_CD, SDK_EXPENSE_AMT, SDK_CURRENCY_CD, SDK_BUS_PURPOSE, and SDK_DEPTID.