PeopleSoft Component Interface PeopleCode Generator
This generator writes the PeopleCode that opens a PeopleSoft Component Interface, gets or creates an instance by key, sets properties, saves and reports errors from the PSMessages collection. It also gives a CallAppEngine call with a state record.
Fill in
Exact key property name as shown in the CI definition in Application Designer.
Get opens an existing instance; Create starts a new one.
True loads all effective-dated rows (like Update/Display All); False loads current and future rows only (like Update/Display).
Replace with real property names from your CI.
Component Interface: open, Get, set, save
Local ApiObject &oSession;
Local ApiObject &oCi;
Local integer &i;
&oSession = %Session;
&oSession.PSMessagesMode = 1;
&oCi = &oSession.GetCompIntfc(CompIntfc.CI_PERSONAL_DATA);
If &oCi = Null Then
Error ("Unable to get Component Interface CI_PERSONAL_DATA");
End-If;
&oCi.InteractiveMode = False;
&oCi.GetHistoryItems = True;
&oCi.EditHistoryItems = False;
&oCi.EMPLID = "KU0001";
If Not &oCi.Get() Then
For &i = 1 To &oSession.PSMessages.Count
MessageBox(0, "", 0, 0, &oSession.PSMessages.Item(&i).Text);
End-For;
&oSession.PSMessages.DeleteAll();
Error ("Get failed for EMPLID = KU0001");
End-If;
&oCi.PROPERTY_ONE = "Value 1";
&oCi.PROPERTY_TWO = "Value 2";
If Not &oCi.Save() Then
For &i = 1 To &oSession.PSMessages.Count
MessageBox(0, "", 0, 0, &oSession.PSMessages.Item(&i).Text);
End-For;
&oSession.PSMessages.DeleteAll();
End-If;
&oCi.Cancel();CallAppEngine with a state record
Local Record &stateRec;
&stateRec = CreateRecord(Record.MY_AET);
/* set state record fields the program reads, for example: */
/* &stateRec.EMPLID.Value = "KU0001"; */
CallAppEngine("MY_AE_PROG", &stateRec);The fastest way to get exact property and collection names is to open the CI in Application Designer and drag it into a PeopleCode editor window, which generates a full template. The user running the code needs the CI and its methods granted on a permission list (Component Interfaces tab). CallAppEngine runs synchronously in the current session; for long runs, schedule the program with a ProcessRequest object instead.
Planning a large CI load?
Send us the component, row counts and target window and we will review the CI approach against set-based alternatives.
Optional. The tool and every export work without this. No spam.
How to use it
Type the CI name, its key property and a test key value, choose Get for an existing row or Create for a new one, and paste your property assignments as PeopleCode lines. The generated code runs from an Application Engine PeopleCode action, an application class or a component event. For effective-dated components, set GetHistoryItems to True when you need to see or insert history rows, and keep EditHistoryItems False unless you deliberately want to change past rows. For collections (child scrolls), the generated template from Application Designer shows the collection names, InsertItem and Item methods you need.
- Get: set all key properties, then call Get().
- Create: set create keys, then call Create().
- Save validates exactly like the online component, including SaveEdit and SavePreChange PeopleCode.
Why the CI and not SQL
A Component Interface runs the component's own edits, prompt validation, PeopleCode and save logic, so data written through it behaves as if a user keyed it into the page. Direct SQL updates skip all of that and can leave audit records, effective-dated rows and derived tables out of step. The trade-off is speed: CIs are slower than set-based SQL, so for very large loads consider an Application Engine with set-based SQL plus the delivered audit and validation steps, or a delivered Excel to CI or integration where one exists.
Errors and messages
PSMessagesMode = 1 sends messages to the PSMessages collection instead of raising them, so your loop can log every error and continue with the next row. When Get, Create or Save returns False, loop from 1 to PSMessages.Count and read Item(&i).Text, then call DeleteAll() so the next row starts clean. InteractiveMode False defers field edits until Save, which is the normal batch setting and much faster. Call Cancel() after each instance so the CI releases its buffer before the next key.
- Wrap per-row work in try-catch so one bad row does not end the program.
- Commit frequency in Application Engine controls how much work is lost on failure.
Frequently Asked Questions
How do I call a Component Interface from PeopleCode?
Get the session with %Session, call GetCompIntfc(CompIntfc.NAME), set InteractiveMode, GetHistoryItems and EditHistoryItems, set the key properties, and call Get() or Create(). Then set properties and call Save(). Check the Boolean return of each method and read errors from the session PSMessages collection.
How do I call an Application Engine from PeopleCode?
Use CallAppEngine("PROGRAM_NAME", &stateRecord) where the state record is a record object of the program's state record with the input fields populated. It runs synchronously in the same session. For anything long-running or that should appear in Process Monitor, create a ProcessRequest object and schedule the program instead.
What does GetHistoryItems do on a CI?
When True, the CI loads all effective-dated rows, like opening the component in Update/Display All mode. When False, it loads only current and future rows, like Update/Display. Setting EditHistoryItems True as well gives Correction mode, which allows changes to history rows and needs a user with Correction access on that component.
Why does my Component Interface Save fail with no message?
Usually PSMessagesMode is not set, or the loop that reads PSMessages runs after DeleteAll. Set PSMessagesMode = 1, read every item after a False return, and check that the running user has the CI methods granted on a permission list. Missing required fields and prompt table edits are the most common real causes.
If you want staff to look up and check PeopleSoft records in plain English on your own servers before a CI load runs, we can set that up as a private AI layer.
Related Tools
PeopleSoft PeopleCode SQLExec, CreateSQL Fetch and Try-Catch Snippet Generator
Fill in a record, key field and message set and get ready-to-paste PeopleCode for SQLExec, CreateSQL Fetch loops, try-catch error handling, MsgGet and rowset loops.
Developer ToolsPeopleSoft REST Service Operation Request Generator (RESTListeningConnector)
Generate the exact /PSIGW/RESTListeningConnector URL, HTTP request, curl command and OnRequest handler skeleton for a PeopleSoft REST service operation.
OraclePeopleSoft Application Engine Trace Flag Calculator (-TRACE value)
Turn trace options on and off to get the -TRACE, -TOOLSTRACESQL and -TOOLSTRACEPC values for an Application Engine run, as documented in PeopleBooks.
More Developer Tools tools
See all- PeopleSoft Portal Navigation Path SQL Generator (PSPRSMDEFN)
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton
- ABAP Custom Exception Class Generator
Keep exploring
Free tools
- PeopleSoft PeopleCode Events and Firing Order ReferenceA searchable table of PeopleCode events in component processor order, showing where each event is defined, what it is for, whether Error and Warning are appropriate, and common mistakes.
- Oracle PeopleSoft Private AI Layer Blueprint GeneratorFill in your Oracle PeopleSoft version, database, hosting and users to get a shareable architecture plan for a private, on-prem AI assistant.
- PeopleSoft PeopleCode SQLExec, CreateSQL Fetch and Try-Catch Snippet GeneratorFill in a record, key field and message set and get ready-to-paste PeopleCode for SQLExec, CreateSQL Fetch loops, try-catch error handling, MsgGet and rowset loops.
ERP fixes and how-tos
- How to Add a Private AI Layer to PeopleSoft On-PremReference architecture for AI on PeopleSoft FSCM and HCM: PS Query and Integration Broker access, security join tables, a local model and approved write-back.
- How to Import AP Invoices in Oracle EBS with Payables Open Interface ImportStep-by-step guide to importing AP invoices into Oracle EBS Payables using the AP_INVOICES_INTERFACE tables and the Payables Open Interface Import program.