Documente Academic
Documente Profesional
Documente Cultură
A section is a set of ordered steps that is executed as part of a program. You can call sections (and
other programs) from steps within other sections.
rem ***** Set the PeopleSoft Session Error Message Mode *****;
&oSession.PSMessagesMode = 1;
&oTmJobSalUplCi = &oSession.GetCompIntfc(CompIntfc.TM_JOB_SAL_UPL_CI);
&err1 = errorHandler();
End-If;
&oTmJobSalUplCi.GetHistoryItems = True;
&oTmJobSalUplCi.EditHistoryItems = True;
&oTmJobSalUplCi.EMPLID = RTrim(LTrim(&EMPLID));
&oTmJobSalUplCi.EMPL_RCD = &empl_rcd;
rem ***** Set/Get JOB Collection Field Properties -- Parent: PS_ROOT Collection *****;
&err2 = errorHandler();
End-If;
rem ***** Set/Get JOB Collection Field Properties -- Parent: PS_ROOT Collection *****;
&oJobCollection = &oTmJobSalUplCi.JOB;
rem End-If;
If &itemno = 0 Then
Else
&effseq1 = &effseq + 1;
Else
&effseq1 = 0;
End-If;
&oJob.EFFDT_0 = &effdt1;
&oJob.EFFSEQ = &effseq1;
&oJob.ACTION_0 = &action;
&oJob.ACTION_REASON = &action_reason;
&oJob.ANNUAL_RT_0 = &ANNUAL_RT;
&oJob.LASTUPDDTTM = %Datetime;
&oJob.OPRID = %OperatorId;
rem MessageBox(0, " ", 0, 0, " It is inseting ????? " | &oJob | "&oJob.EMPLID " | &oJob.EMPLID |
"&oJob.EFFDT_0 " | "&effseq1 " | &oJob.EFFSEQ | "&oJob.ACTION_0:::" | &oJob.ACTION_0 |
"&oJob.ACTION_REASON :::" | &oJob.ACTION_REASON | "&oJob.ANNUAL_RT:::" |
&oJob.ANNUAL_RT_0);
rem MessageBox(0, "", 0, 0, "Save " | &EMPLID | " " | &effdt1 | " " | &effseq1 | " " | &action | " " |
&action_reason | " " | &ANNUAL_RT);
&err3 = errorHandler();
End-If;
End-If;
End-If;
&oTmJobSalUplCi.Cancel();
end-try;*/
rem End-If;
The SaveEdit event is intiated whenever a user attempts to save the component. You can use
SaveEditPeopleCode to validate the consistency of data in component fields. Whenever a validation
involves more than one component field, you should use SaveEditPeopleCode.
The component processor applies SaveEditpeoplecode to all non-deleted rows of data in the
buffers & all pages in component
SaveEdit is better suited than FieldEdit if the validation refrences more than one field or row of
data.
An Error statement in SaveEditPeopleCode displays a message and redisplays the component
without saving data. A Warning statement enables the user to click OK and save the data, or to
click Cancel and return to the component without saving.
Use the SetCursorPos function to set the cursor position to a specific page field following a warning
or error in SaveEdit, to show the user the field (or at least one of the fields) that is causing the
problem. Make sure to call SetCursorPos before the error or warning, because these may terminate
the PeopleCode program.
Associated with record fields and Components.
When an error message is issued in PeopleSoft(Component Processor) from the SAVEEDIT event, the
cursor will not be directed to the corresponding field (value) for which the message is thrown. And the
field also doesnot turn into red color as is the behaviour with the error messages issued from the
FIELDEDIT event. Use SetCursorPos as shown above to set the cursor position. Here is example below
written in SAVEEDIT.
IF NONE(RECORD1.FIELD1) THEN
RECORD1.FIELD1.Setcursorpos(%Page);
REM To Display field in Red Color
RECORD1.FIELD1.Style = "PSERROR";
Error ("The Field is Required");
END-IF;
The SavePreChange event is initiated after SaveEdit completes without errors.
SavePreChangePeopleCode provides one final opportunity to manipulate data before the system
updates the database; for instance, you could use SavePreChangePeopleCode to set sequential
high-level keys
If SavePreChange runs successfully, a Workflow event is generated, and then the Component
Processor issues appropriate Insert, Update, or Delete SQL statements.
An Error statement in SaveEditPeopleCode displays a message and redisplays the component
without saving data. A Warning statement enables the user to click OK and save the data, or to
click Cancel and return to the component without saving.
Used to change display characteristics and validations
SavePreChangePeopleCode can be associated with record fields, components, and component
records.
After the Component Processor updates the database, it initiates the SavePostChange event. You can
use SavePostChangePeopleCode to update tables not in your component using the SQLExec built-in
function.
Performs after SavePreChange and Workflow have completed successfully. SavePostChange is not
executed if workflow fails or component is not saved due to any error.
Donot use Error and Warnings in this event
The system issues a SQL Commit statement after SavePostChangePeopleCode completes
successfully.
Other than updating tables that are not in your component, it is also used to send an email , say
for approval.
SavePostChangePeopleCode can be associated with record fields, components, and component
records.
Be Sociable, Share!
************************************************************************************
Get keys: - These are mapped to the fields marked as scrh in the component’s search record.
Automatically “Search key” fields in search record become Get keys.
Find keys: - These are mapped to fields marked as Alt or Srch in the component search record.
You may remove Find keys that you do not wish to make available for searching.
Create Keys: - It is generated from the key fields for the search record. If Add search record is
present then its key fields are taken. We cannot change it.
Field Change peoplecode event is for recalculating field values based on changes
made to other fields e.g suppose u have 2 fields one is rate and other is quantity and there is another field which
shows the total cost so whenever a value is changed in any of the above 2 field (rate and quantity) the total cost
will also change so on field change event of these 2 fields u can write code to calculate the total cost.
Field edit event is used for validating field values if the field doe'snt pass the validation an error msg is diaplayed
and the page is redisplayed with the field marked in red e.g to this could be that u may want that the quantity
should not exceed 1000 if it does the system should display an error so u can write a peoplecode for that which
will chk the quantity if it is greater than 1000 error msg will be displayed.
1. Define PeopleCode? PeopleCode is
an object oriented proprietary (case-insensitive) language used to express business logic for PeopleSoft
applications.
1. Searchinit
2. Searchsave
3. Rowselect
4. Prebuild
5. Field Default
6. Field Formula
7. RowInit
8. PostBuild
9. Activate
10. FieldEdit
12. RowInsert
13. RowDelete
14. SaveEdit
15. SavePreChange.
16. WorkFlow
17. SavePostChnage.
After the save pre change work flow event get fired.
6. What are the types of data types are available in PC? Give me some ex for each?
Two types
1. Conventional data type (Any, Boolean, float, integer, object, string, time, date, number)
2.Object data type (record, rowset)
/* PeopleCode Statements
*/
Nested Comments:
<*
/* More comments */
*>
Level. Add the field ATTACHADD to this record and save the record as APT_ATTACH_FUNC. PeopleSoft
recommends placing FUNCLIB PeopleCode in the FieldFormula event.
17. What is
deferred processing? Deferred processing is
used speed up the data-entry process. This means that the system does not validate the data for each
field as you Tab through a page. You can enter in all the data for your page without unnecessary trips to
the server for data validation. Entered data is validated when:
The default method for the Rowset class is GetRow. This means you can specify just a row number, and not use the GetRow
method. For example, the following two lines of code are equivalent &MyRow = GetRowset()(5); or &MyRow =
GetRowset ().GetRow(5)
19. Order of events PC events firing in deferred processing?
this is similar to Interactive Processing where as in this Field Change, Field Edit Peoplecode events &
System edits will be differed until we press the Save Button.
Fieldedit event is fired every time for each row when field is edited where as saveedit is fired only once
when a user click on save button
The FieldFormula event is not currently used. Because FieldFormula PeopleCode initiates in many
different contexts and triggers PeopleCode on every field on every row in the component buffer, it can
seriously degrade application performance. Use RowInit and FieldChange events rather than
FieldFormula.
If a field value is changed, whether through PeopleCode or by a user, the IsChanged property for the
row is usually set to True. However, if a value is set in FieldDefault or FieldFormula, the row is not
marked as changed. At save time, all newly inserted and changed rows are written to the database. All
newly inserted but not changed rows are not written to the database.
As a matter of convention, FieldFormula is now often used in FUNCLIB_ (function library) record
definitions to store shared functions. However, you can store shared functions in any PeopleCode event.
FieldFormula PeopleCode is only associated with record fields.
PreBuild fires before any PeopleCode events on all the rows and fields in the component such as
FieldDefault and RowInit. During the PreBuild event there will not be any data in the component buffer
structure other than search record as its executing prior to the component build process. That’s why it is
called PreBuild.
During the PostBuild event you will have access to the data read from the database into the component
buffer structure. That’s why it is called PostBuild.
b) MsgGet function message number is mandatory parameter, but there is no such parameter in
WinMessage.
Use the Ungray function to make a gray (non-editable) page field editable .If the field was grayed with
call to the Gray function. If the page field is made display-only in page the field properties dialog, then
Ungray has no effect.
27. What are the PC function use to control the translate values
dynamically? a) AddDropDownItem: The AddDropDownItem method adds an
item to the dropdown list in the control for the field. The first time this method is called, it overrides the
prompt table or translate table used to populate the list. Those items no longer appear in the list. Only
the items added using this method display. Subsequent calls to this method add additional items to the
dropdown list. The items added with the first call to the method also display. If there is an existing value
and the dropdown list is changed with these functions, the selection shows as (Invalid value) unless the
new list contains an entry with the same code as the existing value. Syntax: AddDropDownItem
(CodeString, DescriptionString).
b) ClearDropDownItem: The ClearDropDownList method clears all items added to the dropdown list
using the AddDropDownItem method. In addition, this method causes the prompt table or translates
table values defined for the list to come back into effect again (unless they’re subsequently overridden
again with AddDropDownItem).
28. What are the foundations classes which are useful to access component
buffer? Rowset, row, record and field.
29. Syantax to declare a variables in PC? Local
variable-type & varname;
CreateRowset is used to create rowset for a record which is in database, and is also called as
standalone rowset.
32. Use of scrollflush() : Used to remove all rows inside target scroll area and frees it associated buffer.
Rows that are flushed are not deleted from the database. This function is often used to clear work scroll
before a call to ScrollSelect.
Think-time function hold avoids the following events: SavePreChange, Workflow, RowSelect,
SavePostChange.
CallAppEngine Cannot use in Application engine PeopleCode actions. If you need to access one
application engine program from another application engine program, use the CallSection action
An error in SaveEdit prevents the system from saving any row of data. A warning in SaveEdit also is
applied to all data in the page or component, but the component processor will accept the data
Use the AddAttachment function to upload a file from an end-user machine to a specified storage
destination. Note that it is the responsibility of the calling PeopleCode program to store the returned file
name for further use.
b) DeleteAttachment
Use the DeleteAttachment function to delete a file from the specified storage location.
DeleteAttachment does not generate any type of "Are you sure" message. If you want the user to verify
the deletion before it is performed, you must write your own checking code in your application
c) DetachAttachment
Use the DetachAttachment function to enable a user to make a copy of an attached file on their local
client system. The file is sent to the browser with appropriate HTTP headers to cause the browser to
display a save dialog box to the user. The user can save the copy of the file with any filename.
d) ViewAttachment.
40. Define PC editor? Any method of accessing PeopleCode programs displays a window where
PeopleCode programs can be input or modified. This window is the PeopleCode editor. The PC editor
enables you to edit and navigate all pc programs that belong to the same parent definition.
On the left side of the window is a drop-down list box showing the current field and other available
fields, records, and components. Any field with PeopleCode attached is listed in bold. The right side of
the window has a drop-down list box listing the current PeopleCode event and other acceptable events
for that definition. Events already containing PeopleCode for that definition are listed in bold.
MetaSQL: - %Bind, %Execute Edits, %Select, %SelectInit, %Sql, %Table, %Truncate Table.
SQL: The SQL statements are used to fetch/retrieve, update, insert, delete data from the database. In PeopleSoft we use the SQL
statements using SQLExec or CreateSQL. Different SQL statements are: Select, Insert, Update, Create and Delete.
MetaSQL: Different RDBMS have different date and time formats. Though the component processor takes care of the automatic
conversion but at the time of using the SQLExec the automatic conversion does not take place. So in order to understand this,
MetaSQL concept has come. Which we can use in diff SQL stmts. for example %datetimein, %date, %time, %currentdatetime,
%datetimeout etc.
43. When is PeopleCode case sensitive? PeopleCode is only case sensitive within a quoted literal.
44. In which PeopleCode would you code errors and warnings? SearchSave,
FieldEdit, SaveEdit and RowDelete primarily. You may also code errors and warnings in RowSelect.
45. What is the biggest drawback to Fieldformula? Since FieldFormula is performed every time the panel is displayed on
every row of data, its biggest drawback is the performance overhead it adds.
46. What other PeopleCode event might you expect to find with RowInit? FieldChange. Since RowInit
initializes the data before it is displayed, usually it is used along with FieldChange to accommodate any of the changes that are
performed by the operator once the panel is displayed.
47. How does SavePostChg differ from all other Peoplecode events? SavePostChg is different from all
other Peoplecode events since it is performed after the updates are made on the database.
49. Why are application specific people-code functions used? PeopleCode functions are used to
perform the same logic in multiple programs while only having to maintain it in one place.
50. How is a PeopleCode function called? A PeopleCode function is called by referencing the function name and then passing
the function the appropriate number of parameters in parentheses.
51. How a PeopleCode function be defined so that it can be used as a variable in the calling program? In order for a PeopleCode
function to be used as a variable, it must be defined using a "Returns" in the Function statement. Also, at least one "Return"
statement must be used in the function code.
53. How is a message added to the Message Catalog? To add a new message
to the Message Catalog, the correct message set should first be retrieved. A new message can be added to the set by performing a
row insert (F7). The new message number will automatically be assigned.
54. Which message sets does PeopleSoft reserve as its own? Message sets 1 through
19,999 are reserved for use by PeopleSoft applications. Message sets 20,000 through 29,000 can be used by PS users.
55. How is a message retrieved from the Message Catalog in PeopleCode? To retrieve a message
from the Message catalog in PeopleCode, the MsgGet built in function is used. The required parameters of the function are
message set, number and a default message.
67. How do you turn off the PeopleCode trace? The PeopleCode trace can
be stopped by turning off all of the check boxes on the PeopleCode trace control panel and selecting the set push
button. It can also be turned off within PeopleCode by passing the parameter
zero to the SetTracePC built-in function. Once the
PeopleSoft session is closed, the PeopleCode trace will also automatically be turned off.
68. How many rows of data can there be at occurs level 0? There can only be one row
of data for each record definition at occurs level 0. Scroll bars are not allowed at this level.
69. How many rows of data can be there at occurs level 1? There can be multiple
rows of data for each record definition at occurs level 1 since a scroll bar can be used to navigate between them.
70. What must exist at occurs levels 1,2,and 3 but not occurs level 0? - A scroll bar.
71. How does the application processor allocate buffers to hold data? The application processor
starts allocating buffers at occurs level 0 and then works its way down. It uses the panel and record definitions to determine the data
it needs. From a panel definition, fields are allocated in TAB order. Generally, if there is one field from record definition on the panel,
the entire row will be brought into the buffers. The exceptions are fields that are in the search dialog box, derived work fields and
related display fields.
72. What record definitions will perform PeopleCode in a panel group? Any record definition that is
not used as a related display record will perform PeopleCode in a panel group.
73. In what order will PeopleCode be performed on the buffers in a panel group? PeopleCode starts at the
top of the buffers in a panel group and works its way down to the bottom. The PeopleCode programs on a given row will be
performed in the same order as the fields on the record definition.
74. When should the SQLExec function be used instead of the scroll buffer functions? Dates are converted
within SQLExec built-in function by using the system variables %DateIn and %DateOut.
75. What are the drawbacks of using a SQLExec built in function? Since the SQL statement is
contained within quotes, it is a black box to PeopleSoft. Means the programmer is responsible for the syntax, efficiency and
maintenance of the SQL. Also, if a SQLSelect is being performed within the function, only one row of data can be returned.
76. What are Inline variables? How are they used? Inline variables are used
to reference the value of fields stored in the buffers in SQL statements. An inline variable consists of a colon followed by the
appropriate record and field name to be referenced. 136. How are dates converted within SQLExec statements? Dates are
converted within SQLExec built-in function by using the system variables %DateIn and %DateOut.
77. What parameters are passed to the built-in function SQLExec? The SQLExec built-in
function is passed the SQL statement to perform within quotes, followed by any bind variables or output variables if necessary.
78. What PeopleCode event is fired before a popup menu is displayed? PrePopup. It allows you to alter
the appearance of the popup menu.
79. What functions may be used to alter the appearance of a menu item? DisableMenuItem,
EnableMenuItem, HideMenuItem, CheckMenuItem and UnCheckMenuItem.
80. When is the ScrollFlush function used? Is used to remove the rows
of data from within a scroll bar without deleting them from the database.
81. What are the parameters of a ScrollFlush function? Name of the primary
record definition for the scroll bar where the rows of data will be removed.
The code above will sleep for 1000 milliseconds (1 second). Note that this approach uses up CPU cycles
and has a performance hit on the application server. If you find this to be an issue, then the second
approach may be better suited if you have an Oracle database.
Using DBMS_LOCK.SLEEP()
SQLExec("exec DBMS_LOCK.SLEEP(1)"); The code above will sleep for 1 second.
88. How is searchinit is most often in PeopleSoft application? The SearchInit event is
generated just before a search, add, or data-entry dialog box is displayed. SearchInit triggers associated PeopleCode in the search
key fields of the search record. This enables you to control processing before a user enters values for search keys in the dialog box.
89. Explain about hide and unhide? Use the Hide function to
make a page field invisible. It usually appear in RowInit programs that set up the initial display of data, and in FieldChange programs
that change field display based on changes the user makes to a field. Syntax: Hide (fieldname);
Use the Unhide function to make a field visible that was previously hidden with Hide. If the field was hidden by setting its Invisible
property in the Page Field Properties dialog box, then Unhide has no effect. Generally, you want to put this function on the same
scroll level as the field that is being changed in RowInit (which executes on every row) or FieldChange (which executes on the
current row). This simplifies the function’s syntax to: Syntax:Unhide(fieldname);
%Component returns an uppercase character string containing the name of the current component, as
set in the component definition.
&MYARRAY.Push (100);
&MYARRAY.Push (200);
&MYARRAY.Push (300);
94. Explain the relationship b/w the classes? The 4 Buffer classes
relate in following manner:
A Record contains one or more Fields. Records contain the Fields that makes up the Record.
A Row contains one or more Records and zero or more child Rowsets. A Row contains the records that make up that
row. A Rowset contain one or more Rows. A
Rowset is a data structure that describes hierarchal data.
a) Using EDITTABLE fields for Prompt Table. I.e., Prompt table property of Record Fields should be assigned with %EDITTABLE
value.
97. Where we write the PC in app packages? In OnExecute event we write our PeopleCode.
98. What is the use of findin option regarding PC? : Search through all
PeopleCode or SQL Programs for a text string that would describe in a dialogue box. You can also specify which type of
PeopleCode and SQL programs to search.
PostBuild Event
PreBuild Event
SavePostChange Event
SavePreChange Event
Workflow Event
Dates are converted within SQLExec built-in function by using the system variables %DateIn and %DateOut.