68
PeopleSoft PeopleTools Meta-Tables PeopleSoft Projects PSPROJECTDEFN table stores information about projects created in Application Designer. Try it out: SELECT * FROM PSPROJECTDEFN WHERE PROJECTNAME = 'Your_Project_name'; PSPROJECTITEM table stores objects inserted into your Application Designer project. Try it out: SELECT * FROM PSPROJECTITEM WHERE PROJECTNAME = 'Your_Project_name'; Portal Structure PSPRSMDEFN is a Portal Structure Definition table. A good example is to use this table to find portal path for a specific component. Take a closer look on how this is done!. Query for Component Path within PeopleSoft Portal 1) Run the below SQL to get the content reference name for your component SELECT PORTAL_NAME, PORTAL_OBJNAME AS CONTENT_REFERENCE, PORTAL_LABEL, PORTAL_URI_SEG1 AS MENU, PORTAL_URI_SEG2 AS COMPONENT,

PeopleTools Tables

Embed Size (px)

DESCRIPTION

PeopleTools Tables

Citation preview

Page 1: PeopleTools Tables

PeopleSoft PeopleTools Meta-Tables

PeopleSoft Projects

PSPROJECTDEFN table stores information about projects created in Application Designer.

Try it out:

SELECT * FROM PSPROJECTDEFN

WHERE PROJECTNAME = 'Your_Project_name';

PSPROJECTITEM table stores objects inserted into your Application Designer project.

Try it out:

SELECT * FROM PSPROJECTITEM

WHERE PROJECTNAME = 'Your_Project_name';

Portal Structure

PSPRSMDEFN is a Portal Structure Definition table. A good example is to use this table to find portal path for a specific component. Take a closer look on how this is done!.

Query for Component Path within PeopleSoft Portal

1) Run the below SQL to get the content reference name for your component

SELECT PORTAL_NAME,

PORTAL_OBJNAME AS CONTENT_REFERENCE,

PORTAL_LABEL,

PORTAL_URI_SEG1 AS MENU,

PORTAL_URI_SEG2 AS COMPONENT,

PORTAL_URI_SEG3 AS MARKET

FROM psprsmdefn

WHERE PORTAL_NAME = 'EMPLOYEE'

AND PORTAL_URI_SEG2 = :1;

Page 2: PeopleTools Tables

-- Replace :1 with the component name you are looking for.

2) From the query above - copy the value in the CONTENT_REFERENCE field and replace the ":1" variable and you will have the path to your component.

WITH portal_registry AS

(SELECT RTRIM(REVERSE(sys_connect_by_path(REVERSE(portal_label), ' >> ')), ' >> ') path,

LEVEL lvl

FROM psprsmdefn

WHERE portal_name = 'EMPLOYEE' START WITH PORTAL_OBJNAME = :1 CONNECT BY PRIOR portal_prntobjname = portal_objname)

SELECT path

FROM portal_registry

WHERE lvl =

(SELECT MAX(lvl)

FROM portal_registry);

So, the 1st query is to get the content reference for a component name that you know and then using Jim's query to find the path!

PSPRSMPERM: Shows the permission lists that are assigned to a portal registry structure (content reference). The permission list name is under field PORTAL_PERMNAME.

XLAT Tables

XLATTABLE: Stores translate values (PeopleSoft version prior to 8.4).

PSXLATDEFN: Stores all fields that have Xlat values. This table does not store any Xlat values.

PSXLATITEM: Stores fields with their actual translate values (PeopleSoft version 8.4 and above).

Record & Field Tables

PSRECDEFN: Stores informations about tables. One row for each table. Field count and record type are two fields that are stored on this table.

Page 3: PeopleTools Tables

CASE RECTYPE

WHEN 0 THEN 'Table'

WHEN 1 THEN 'View'

WHEN 2 THEN 'Derived'

WHEN 3 THEN 'Sub Record'

WHEN 5 THEN 'Dynamic View'

WHEN 6 THEN 'Query View'

WHEN 7 THEN 'Temporary Table'

ELSE TO_CHAR(RECTYPE)

END CASE

PSRECFIELD: Stores records with all their fields (sub-records are not expanded)

PSRECFIELDALL: Stores records with all their fields (sub-records are expanded)

PSINDEXDEFN: Contains 1 row per index defined for a table.

PSKEYDEFN: Containes 1 row per key field defined for an index.

PSDBFIELD: You got it, stores information about fields.

CASE FIELDTYPE

WHEN 0 THEN 'Character'

WHEN 1 THEN 'Long Character'

WHEN 2 THEN 'Number'

WHEN 3 THEN 'Signed Number'

WHEN 4 THEN 'Date'

WHEN 5 THEN 'Time'

WHEN 6 THEN 'DateTime'

WHEN 8 THEN 'Image'

WHEN 9 THEN 'Image Reference'

Page 4: PeopleTools Tables

ELSE TO_CHAR(FIELDTYPE)

END CASE

PSDBFLDLABL: Stores field label information.

Process Definition Table(s)

PS_PRCSDEFNPNL: Stores the process definition name, process type(sqr report, application engine...), and the component name associated with the process definition.

PS_PRCSDEFN: Process definitions table. The record stores processes that can run within the Process Scheduler. Security information such as components and process groups are also stored on this table.

Message Catalog Tables

PSMSGCATDEFN: Stores information about PeopleSoft message catalogs such as message set number, message number and the actual message text.

PSMSGCATLANG: language table.

-- Example

SELECT * FROM PSMSGCATDEFN

WHERE LAST_UPDATE_DTTM > TO_DATE('03-DEC-07', 'DD-MON-YY')

AND LAST_UPDATE_DTTM < TO_DATE('05-DEC-07', 'DD-MON-YY')

ORDER BY MESSAGE_SET_NBR, MESSAGE_NBR;

-- This will return messages that has been last update/added between 2 specific dates.

Previous PeopleSoft message catalog tables:

PS_MESSAGE_CATALOG: Stores information about PeopleSoft message catalogs such as message set number, message number and the actual message text.

MESSAGE_SET_TBL: Message set description table.

-- Example

SELECT * FROM PS_MESSAGE_CATALOG

WHERE LAST_UPDATE_DTTM > TO_DATE('03-DEC-07', 'DD-MON-YY')

AND LAST_UPDATE_DTTM < TO_DATE('05-DEC-07', 'DD-MON-YY')

ORDER BY MESSAGE_SET_NBR, MESSAGE_NBR;

Page 5: PeopleTools Tables

-- This will return messages that has been last update/added between 2 specific dates.

Menu Tables

PSMENUDEFN: Store Menu related information. No related component info on this table.

PSMENUITEM: List the menu with all components attached to it.

Component Tables

PSPNLGRPDEFN: Stores component related information only.

PSPNLGROUP: This table will give you information regarding a specific component along with the names of pages attached to it.

Pages

PSPNLDEFN: Stores pages definitions.

PSPNLFIELD: Stores all items used by each page definition.

Security

PSPRSMPERM: Portal Structure Permissions.

PSAUTHITEM: Page Permissions. This table stores the information about the page level access for a permission list.

PSROLECLASS: Role Classes table. A many to many relationship table between Roles and Permission Lists.

PSROLEDEFN: This table stores information about Peoplesoft Role definitions. Users get permissions to PeopleSoft objects through Roles, which are assigned Permission Lists.

PSROLEUSER: This table stores information about the Users in Peoplesoft and the roles assigned to them.

PSCLASSDEFN: Permissions List definitions table. Permission list name can be found under Field Name CLASSID.

PSOPRDEFN: Users/Operator definition table. This table stores information about PeopleSoft users. This is the core table for User Profile Manager.

PSOPRCLS: Users/Operator and Perm list mapping Table. This table stores information about PeopleSoft users and the permission lists attached to those users.

A User gets these permission lists indirectly through the roles which are attached to the user

Here is an example query post that uses all of the above security tables!

Page 6: PeopleTools Tables

Roles, Permissions, and Users Assigned to Portal Content Reference or Component

Roles attached to a component (portal_uri_seg2) or content reference (portal_objname)

SELECT DISTINCT c.portal_name, c.portal_objname, b.rolename, e.descr

FROM psroleclass b, psprsmperm c, psprsmdefn d, psroledefn e

WHERE c.portal_objname = d.portal_objname

AND b.classid = c.portal_permname

AND b.rolename = e.rolename

AND (d.portal_uri_seg2 = :1 OR d.portal_objname = :2);

Permissions attached to a component (portal_uri_seg2) or content reference (portal_objname)

SELECT DISTINCT d.portal_name, d.portal_objname, c.portal_permname, e.classdefndesc

FROM psprsmperm c, psprsmdefn d, psclassdefn e

WHERE d.portal_objname = c.portal_objname

AND d.portal_name = c.portal_name

AND c.portal_permname = e.classid

AND (d.portal_uri_seg2 = :1 OR d.portal_objname = :2);

Users that can access a component (portal_uri_seg2) or content reference (portal_objname)

SELECT DISTINCT c.portal_name, c.portal_objname, a.roleuser, e.oprdefndesc

FROM psroleuser a,

psroleclass b,

psprsmperm c,

psprsmdefn d,

psoprdefn e

WHERE c.portal_objname = d.portal_objname

Page 7: PeopleTools Tables

AND a.rolename = b.rolename

AND b.classid = c.portal_permname

AND a.roleuser = e.oprid

AND (d.portal_uri_seg2 = :1 OR d.portal_objname = :2);

URL Definitions

PSURLDEFN: Stores URL definitions. Here is the path to create URL definitions in PeopleSoft Root >> PeopleTools >> Utilities >> Administration >> URLs

Application Classes

PSAPPCLASSDEFN: Application Class Definitions table. You can use field PACKAGEROOT to search for a specific Application Package.

PeopleSoft Query Tables

PSQRYDEFN: Stores query related info.

PSQRYFIELD: Stores all fields used in a query (both the fields in the Select and Where clause).

PSQRYCRITERIA: Stores criteria query fields. You can get the name of the fields by joining the PSQRYFIELD table.

PSQRYEXPR: Stores query expressions.

PSQRYBIND: Stores query bind variables.

PSQRYRECORD: Stores all records used in all aspects of query creation

PSQRYSELECT: Stores all SELECT requirements by select type. Example would be sub select, join, ect.

PSQRYLINK: Stores the relationships to child queries.

PSQRYEXECLOG: Query run time log table that stores (only 8.4x and higher)

PSQRYSTATS: Query run time statistics table such as count of query execution, and date time of last execution (only in 8.4x and higher).

SQL Objects

PSSQLDEFN: Stores SQL object definitions.

PSSQLDESCR: Stores SQL objects descriptions, and description long.

Page 8: PeopleTools Tables

PSSQLTEXTDEFN: Stores actual SQL text. You can filter by SQLTYPE field to get SQL objects of interest such as Views SQLs and Application Engine SQLs.

-- When SQL type is:

0 = Stand alone SQL objects

1 = Application engine SQL

2 = Views SQLs

Application Engines

PSAEAPPLDEFN: Table that stores Application Engine program definitions.

PSAEAPPLSTATE: Stores application engine STATE records and a flag to indicate if the record is the default STATE record.

PSAESECTDEFN: Application engine section information and also stores last user id to update a specific section.

PSAESECTDTLDEFN: AE section along with descriptions and wither the section is active or not.

PSAEAPPLTEMPTBL: If your application engine uses Temp tables it will show on this record.

PSAESTEPDEFN: Steps in application engines are stored in this table.

PSAESTMTDEFN: Stores your application engine actions and along with their types, such as "Do Select" and so on.

PSAESTEPMSGDEFN: Application engine message action definition table.

AEREQUESTTBL: Application Engine request table behind the AE run control page.

AEREQUESTPARM: Application Engine request parameters table behind the AE run control page.

PeopleCode Tables

PSPCMNAME: PeopleCode Reference table.

PSPCMPROG: Store actual PeopleCode programs (actual code behind PeopleCode events).

Process Request Tables

PSPRCSQUE: This record contains the process request information to run a process request.

PSPRCSRQST: This record contains the process request information to run a process request.

Page 9: PeopleTools Tables

PS_PMN_PRCSLIST: A view to list all process requests in the Process Monitor except for "Delete" (runstatus = 2) process requests.

Other Useful Tables

PSSTATUS: Stores PeopleSoft information such as PS Tools release version and the UNICODE_ENABLED boolean flag where a value of 1 indicates the DB is to be treated by Tools as a UNICODE DB.

PSCHGCTLLOCK: Description as explained by PeopleSoft "This table contains a a row for every object that is currently locked by any user. When the user requests to lock an object in the Application Designer, first this table is searched to see if the object is locked by another user. If it is not found, a row is inserted into the table. When the user requests to unlock an object, the row in this table is deleted."

Visit this post to see how could you make use of this table.

Unlock PeopleSoft Objects All at Once (Change Control Locking):

Change control is used in Application Designer to lock definitions and track history changes for each object. Change control can be activated through Application Designer using Tools > Change Control > Administrator.

After few good size projects, you can easily have hundreds if not thousands of locked objects. Attempting to unlock the objects one by one is very time consuming, so here is a way to speed up the process.

Locked objects are stored on PSCHGCTLLOCK table. Here is how PeopleSoft describes the table:

This table contains a a row for every object that is currently locked by any user. When the user requests to lock an object in the Application Designer, first this table is searched to see if the object is locked by another user. If it is not found, a row is inserted into the table. When the user requests to unlock an object, the row in this table is deleted.

From the description above, I would feel safe enough to assume that if you want to unlock objects, just delete them from this table! Here is an example to delete by operator ID, you can also delete by object name or object type.

-- deletes locked objects by user id.

DELETE FROM pschgctllock

WHERE oprid = :userid;

Is this the only way we can "batch" unlock objects? No, it was brought to my attention by a college of mine that Application Designer has a feature to accomplish the same result as deleting from pschgctllock table.

Select an object to unlock it (Ctrl+click) to select more than one. Right click and chose unlock object.

Page 10: PeopleTools Tables

PSMAPFIELD: Stores Field mapping of Activity

PS_PRCSRUNCNTL: Run Control record stores Run Control IDs created online.

Get Records on a Component

An SQL that goes against a specific component and bring back ALL related records.

SELECT recname

FROM pspnlgroup a, pspnlfield b

WHERE (a.pnlname = b.pnlname OR a.pnlname = b.subpnlname)

AND a.pnlgrpname = :component_name

GROUP BY recname

Get all Components Under a Certain Portal Folder

Use this SQL snippet to return all components plus sub-folders (if any) under a specific portal folder.

For example, lets say you have a folder called "Workforce Admin". Under Job Information, you have a sub-folder called "Job Information" and few components.

Run the SQL against the Workforce Admin folder and you should get a row for the sub-folder, and a row for each of the components.

-- Get all sub-folders and components under a certain folder name --

SELECT PORTAL_NAME,

PORTAL_PRNTOBJNAME AS FOLDER,

PORTAL_OBJNAME AS CONTENT_REFRENCE,

Page 11: PeopleTools Tables

PORTAL_LABEL,

PORTAL_URI_SEG1 AS MENU,

PORTAL_URI_SEG2 AS COMPONENT,

PORTAL_URI_SEG3 AS MARKET,

portal_reftype

FROM psprsmdefn

WHERE portal_name = 'EMPLOYEE'

START WITH PORTAL_LABEL = ':1' CONNECT BY PRIOR portal_objname = portal_prntobjname

GROUP BY PORTAL_NAME,

portal_reftype,

PORTAL_PRNTOBJNAME,

PORTAL_OBJNAME,

PORTAL_LABEL,

PORTAL_URI_SEG1,

PORTAL_URI_SEG2,

PORTAL_URI_SEG3

ORDER BY portal_reftype DESC;

-- PORTAL_NAME is your folder name

-- You might get better results if you know the portal object name. Replace "START WITH PORTAL_LABEL = ':1'" with "START WITH PORTAL_OBJNAME = ':1'"

Identify Records Behind a Page and Subpage

Use the following query to get records behind not only the page but sub-pages on a page.

WITH my_data AS

(SELECT subpnlname

FROM pspnlfield

Page 12: PeopleTools Tables

WHERE pnlname = :1 AND subpnlname <> ' '

GROUP BY subpnlname)

SELECT recname

FROM pspnlfield, my_data

WHERE pnlname = :1 OR pnlname = my_data.subpnlname

GROUP BY recname;

Same query as above but written differently (suggested by a colleague of mine):

SELECT recname

FROM pspnlfield a

WHERE pnlname = :1

OR EXISTS (

SELECT 'x'

FROM pspnlfield b

WHERE pnlname = :1

AND subpnlname <> ' '

AND a.pnlname = b.subpnlname)

GROUP BY recname;

Identify Records with a Specific Subrecord

A subrecord in PeopleSoft is a way to group fields together and place them on a record, view, or a temp table. Here is a query you can use to identify records that have a specific subrecord.

SELECT a.recname, a.fieldname, b.rectype, b.objectownerid

FROM psrecfield a, psrecdefn b

WHERE a.recname = b.recname

AND a.fieldname = 'SUB-RECORD-NAME';

Page 13: PeopleTools Tables

When you modify a subrecord in Peopltools as for example adding a field to it. Make sure you modify (re-build, or alter) all the tables that the subrecord touches. You can use the SQL above to track down all the affected record but you really only want actual physical tables, views and temp tables. So, we will add rectype criteria to filter our results.

SELECT a.recname, a.fieldname, b.rectype, b.objectownerid

FROM psrecfield a, psrecdefn b

WHERE a.recname = b.recname

AND a.fieldname = 'SUB-RECORD-NAME'

-- 0 table, 1 view, 7 temp table

AND b.rectype IN (0, 1, 7)

ORDER BY a.recname;

Is Component Attached to a Menu?

This SQL will help you find the menus a specific component is attached to.

-- Is component attached to a menu?

-- List all the Menus that have a specific component

SELECT * FROM PSMENUITEM menu

WHERE pnlgrpname = :component_name

AND ITEMTYPE <> 8;

List of Active Accounts with no activity for a Fiscal Year

SQL to find active accounts that have no activity in a specific fiscal year. Notice the accounting_period <> 0 in the where clause. This is needed as accounts that had activities in 2007, for example, will have a row on the ledger table under year 2008 and accounting period of 0.

SELECT a.ACCOUNT, a.descr

FROM ps_gl_account_tbl a

WHERE a.eff_status = 'A'

Page 14: PeopleTools Tables

AND NOT EXISTS (SELECT 'x'

FROM ps_ledger b

WHERE a.ACCOUNT = b.ACCOUNT

AND b.fiscal_year = :year

AND accounting_period <> 0)

GROUP BY a.ACCOUNT, a.descr;

Pages with Secondary Pages That Use a Field

Here is a question that was asked on the forum and thought it will be of a value to add it to the PeopleSoft handbook to keep for future references. The question was:

Is there a way to determine all the pages with a secondary page with a specific field ?

For e.g. if I am looking for emplid field and determine that the emplid field is used on say 5 secondary pages. I now need to tie those secondary pages to the pages .

Is there a sql that can be run to identify such pages ?

Here is how you accomplish the above:

The 1st select will get all pages that have secondary pages on them (thus the fieldtype <> '11' - fieldtyp 11 means it is a subpage and you want secondary pages) and the 2nd select will look for a specific field on secondary pages found.

Please test it and let us know if it works!

WITH my_data AS

(SELECT pnlname, fieldtype, subpnlname

FROM pspnlfield

WHERE (subpnlname <> '' OR subpnlname <> ' ') AND fieldtype <> '11'

GROUP BY pnlname, fieldtype, subpnlname)

SELECT my_data.pnlname, my_data.subpnlname

Page 15: PeopleTools Tables

FROM my_data, pspnlfield FIELD

WHERE my_data.subpnlname = FIELD.pnlname AND FIELD.fieldname = 'Your-field'

GROUP BY my_data.pnlname, my_data.subpnlname

ORDER BY my_data.pnlname, my_data.subpnlname;

Page 16: PeopleTools Tables

Peoplesoft Security

Component Permission List Query

An SQL that will identify permission lists along with permission lists description assigned to a specific component.

SELECT menu.menuname, compdfn.pnlgrpname, auth.classid permission_list,

CLASS.classdefndesc permission_desc

FROM psauthitem auth,

psmenudefn menu,

psmenuitem menuitm,

pspnlgroup comp,

pspnlgrpdefn compdfn,

psclassdefn CLASS

WHERE menu.menuname = menuitm.menuname

AND menuitm.pnlgrpname = comp.pnlgrpname

AND compdfn.pnlgrpname = comp.pnlgrpname

AND compdfn.pnlgrpname LIKE UPPER (:component_name)

AND auth.menuname = menu.menuname

AND auth.barname = menuitm.barname

AND auth.baritemname = menuitm.itemname

AND auth.pnlitemname = comp.itemname

AND auth.classid = CLASS.classid

GROUP BY menu.menuname, compdfn.pnlgrpname, auth.classid, CLASS.classdefndesc

ORDER BY menu.menuname, compdfn.pnlgrpname, permission_list;

Content References Accessed by a Permission List

Another permission list query to list Content References accessed by a specific Permission List.

SELECT a.portal_label AS PORTAL_LINK_NAME, a.portal_objname, a.portal_name, a.portal_reftype

Page 17: PeopleTools Tables

FROM psprsmdefn a, psprsmperm b, psclassdefn c

WHERE a.portal_reftype = 'C'

AND a.portal_cref_usgt = 'TARG'

AND a.portal_name = b.portal_name

AND a.portal_reftype = b.portal_reftype

AND a.portal_objname = b.portal_objname

AND c.classid = b.portal_permname

AND a.portal_uri_seg1 <> ' '

AND a.portal_uri_seg2 <> ' '

AND a.portal_uri_seg3 <> ' '

AND c.classid = :permissionlist

AND a.portal_name = :portalname

ORDER BY portal_label;

We are only interested in translate value of 'TARG' (target) from field portal_cref_usgt on table psprsmdefn. Other available translates on that field are:

FRMT = Frame template

HPGC = Pagelet

HPGT = Homepage tab

HTMT = HTML template

LINK = Content Reference Link

It is important to note that knowing the content reference will make it easy to find the path (PIA navigation) for that content ref. Here is a post to help you with that.

Pages Accessed by a Permission List

A query to identify pages that could be accessed by a specific permission list.

SELECT b.menuname, b.barname, b.baritemname, b.pnlitemname AS pagename,

Page 18: PeopleTools Tables

c.pageaccessdescr,

DECODE (b.displayonly, 0, 'No', 1, 'Yes') AS displayonly

FROM psclassdefn a, psauthitem b, pspgeaccessdesc c

WHERE a.classid = b.classid

AND a.classid = :1

AND b.baritemname > ' '

AND b.authorizedactions = c.authorizedactions;

PeopleTools Objects Accessed by a Permission List

A query that will list all peopletools objects (Query, Application Designer, Data Mover) that a specific permission list could access.

SELECT DISTINCT b.menuname

FROM psclassdefn a, psauthitem b

WHERE a.classid = b.classid

AND ( b.menuname = 'CLIENTPROCESS'

OR b.menuname = 'DATA_MOVER'

OR b.menuname = 'IMPORT_MANAGER'

OR b.menuname = 'APPLICATION_DESIGNER'

OR b.menuname = 'OBJECT_SECURITY'

OR b.menuname = 'QUERY'

)

AND a.classid = :PermissionList;

Roles Assigned to a Permission List

A query to help you identify Roles that are assigned to a specific permission list.

SELECT b.rolename, b.classid AS permission_list

FROM psclassdefn a, psroleclass b

WHERE a.classid = b.classid AND a.classid = :permissionlist;

Page 19: PeopleTools Tables

User IDs assigned to a Permission List

A query to list all user IDs that are assigned to a specific permission list.

SELECT c.roleuser AS USER_IDs

FROM psclassdefn a, psroleclass b, psroleuser c

WHERE a.classid = b.classid

AND b.rolename = c.rolename

AND a.classid = :permissionlist

GROUP BY c.roleuser;

A List of Pages a Peoplesoft Role Name can Access

A query that will take a PeopleSoft role name as an input and returns all pages that could be access by that role. The query will also indicate what kind of operations a user can perform on that page. Example, Add Update/Display and so forth.

SELECT b.menuname, b.barname, b.baritemname, d.pnlname, c.pageaccessdescr

FROM psroleclass a,

psauthitem b,

pspgeaccessdesc c,

pspnlgroup d,

psmenuitem e

WHERE a.classid = b.classid

AND d.pnlgrpname = e.pnlgrpname

AND b.menuname = e.menuname

AND b.barname = e.barname

AND b.baritemname = e.itemname

AND a.rolename = :rolename

AND b.authorizedactions = c.authorizedactions

GROUP BY b.menuname, b.barname, b.baritemname, d.pnlname, c.pageaccessdescr

Page 20: PeopleTools Tables

ORDER BY d.pnlname;

Show Users Assigned to a Specific Role

here is how you find out what Users are assigned to a specific Role.

SELECT C.OPRID ,

C.OPRDEFNDESC ,

A.ROLENAME ,

A.DESCR

FROM PSROLEDEFN A,

PSROLEUSER B ,

PSOPRDEFN C

WHERE B.ROLENAME = A.ROLENAME

AND C.OPRID = B.ROLEUSER

AND B.ROLENAME LIKE UPPER(:1)

GROUP BY C.OPRID,

C.OPRDEFNDESC ,

A.ROLENAME ,

A.DESCR

ORDER BY C.OPRID;

Show Roles Assigned to a Specific User

Here is a query that I often use to lookup Roles assigned to a specific PeopleSoft user.

At run time, replace :1 with OPRID your are looking for OR user name (partial search also works).

SELECT C.OPRID,

C.OPRDEFNDESC ,

A.ROLENAME ,

A.DESCR

Page 21: PeopleTools Tables

FROM PSROLEDEFN A,

PSROLEUSER B ,

PSOPRDEFN C

WHERE B.ROLENAME = A.ROLENAME

AND C.OPRID = B.ROLEUSER

AND (C.OPRID =:1

OR C.OPRDEFNDESC LIKE upper(:2))

GROUP BY C.OPRID,

C.OPRDEFNDESC ,

A.ROLENAME ,

A.DESCR;

-- Make sure when passing the :2 value to pass % with it for the 'Like' search to work. example :2 = %John%

What Permission Lists does this Role Have?

A query that takes a PeopleSoft role name as a value and returns Permission List(s) associated to that role.

SELECT a.rolename, a.classid AS permission_list

FROM psroleclass a

WHERE a.rolename = :rolename;

Permission Lists Assigned to a User

SQL that I find useful in many occasions. It will return a list of permissions that are assigned to a specific user.

SELECT d.oprid, d.oprdefndesc, c.roleuser, a.rolename, a.classid,

b.classdefndesc

FROM psroleclass a, psclassdefn b, psroleuser c, psoprdefn d

WHERE a.classid = b.classid

AND c.rolename = a.rolename

Page 22: PeopleTools Tables

AND d.oprid = c.roleuser

AND d.oprid = :userid

GROUP BY d.oprid,

d.oprdefndesc,

c.roleuser,

a.rolename,

a.classid,

b.classdefndesc;

-- at run time, substitute :userid with the user id you want the SQL to run against.

Roles Assigned to a Component

The SQL will pull Roles assigned to a specific component.

SELECT B.MENUNAME,

B.BARITEMNAME ,

A.ROLENAME

FROM PSROLECLASS A ,

PSAUTHITEM B

WHERE A.CLASSID = B.CLASSID

AND B.BARITEMNAME = :1 -- COMPONENT NAME

GROUP BY B.MENUNAME,

B.BARITEMNAME ,

A.ROLENAME

ORDER BY B.MENUNAME,

A.ROLENAME;

Users and Emails Under a Certain Role

The query will help you find users with their email addresses for a certain Role Name.

Page 23: PeopleTools Tables

SELECT emailid

,oprid

FROM psoprdefn

, psrolemember

WHERE rolename = :role_name

AND oprid = roleuser

AND emailid <> ' '

For example, you could run the query to get email addresses for users who have a role name of "Developer".

PeopleSoft Account Payables

PeopleSoft Validate AP Business Unit

The select statement below is preformed by AP Voucher Build (AP_VCHRBLD) Application Engine to validate an AP Business Unit:

INSERT INTO %TABLE(VCHR_HDR_QV_ER) (PROCESS_INSTANCE

, BUSINESS_UNIT

, VOUCHER_ID

, MESSAGE_SET_NBR

, MESSAGE_NBR

, FIELDNAME

, MESSAGE_PARM1

, MESSAGE_PARM2

, MESSAGE_PARM3)

SELECT %Bind(PROCESS_INSTANCE)

, HDR.BUSINESS_UNIT

, HDR.VOUCHER_ID

Page 24: PeopleTools Tables

, 7220

, 1

, 'BUSINESS_UNIT'

, HDR.BUSINESS_UNIT

, ' '

, ' '

FROM %TABLE(VCHR_HDR_TMP) HDR

WHERE PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)

AND BUSINESS_UNIT NOT IN (

SELECT BUSINESS_UNIT

FROM %TABLE(BUS_UNIT_TBL_AP) BUS

WHERE HDR.BUSINESS_UNIT = BUS.BUSINESS_UNIT)

PeopleSoft Validate Vendor ID

The select statement below is performed by AP Voucher Build (AP_VCHRBLD) Application Engine to validate a Vendor ID:

INSERT INTO %TABLE(VCHR_HDR_QV_ER) (PROCESS_INSTANCE

, BUSINESS_UNIT

, VOUCHER_ID

, MESSAGE_SET_NBR

, MESSAGE_NBR

, FIELDNAME

, MESSAGE_PARM1

, MESSAGE_PARM2

, MESSAGE_PARM3)

SELECT %Bind(PROCESS_INSTANCE)

, HDR.BUSINESS_UNIT

Page 25: PeopleTools Tables

, HDR.VOUCHER_ID

, 7220

, 2

, 'VENDOR_ID'

, HDR.VENDOR_SETID

, HDR.VENDOR_ID

, ' '

FROM %TABLE(VCHR_HDR_TMP) HDR

WHERE HDR.PROCESS_INSTANCE = %Bind(PROCESS_INSTANCE)

AND VENDOR_ID NOT IN (

SELECT VENDOR_ID

FROM %TABLE(VENDOR) VND

WHERE HDR.VENDOR_ID = VND.VENDOR_ID

AND HDR.VENDOR_SETID = VND.SETID

AND VND.VENDOR_STATUS = 'A' )

SQL to Check PeopleSoft Process Name Status

Run this SQL on a particulare process name to get it's process status form PeopleSoft process request.

SELECT a.prcsname, a.oprid, a.servernamerun, b.xlatlongname AS STATUS,

a.rundttm,

TRUNC (MOD ((a.enddttm - a.rundttm) * 24, 24)) "Hr",

TRUNC (MOD ((a.enddttm - a.rundttm) * 24 * 60, 60)) mi,

TRUNC (MOD ((a.enddttm - a.rundttm) * 24 * 60 * 60, 60)) sec,

a.prcsinstance, c.outputdir

FROM psprcsrqst a, xlattable b, ps_cdm_list c

WHERE b.fieldname = 'RUNSTATUS'

Page 26: PeopleTools Tables

AND b.fieldvalue = a.runstatus

AND a.prcsinstance = c.prcsinstance

AND a.prcsname = 'YourProcessName'

ORDER BY 5 DESC

Update: 01/10/08

I noticed the above SQL doesn't work in PT 8.49 due to table name change. You would need to change table xlattable to PSXLATITEM for the SQL to work. Here is an update version:

SELECT a.prcsname, a.oprid, a.servernamerun, b.xlatlongname AS STATUS,

a.rundttm,

TRUNC (MOD ((a.enddttm - a.rundttm) * 24, 24)) "Hr",

TRUNC (MOD ((a.enddttm - a.rundttm) * 24 * 60, 60)) mi,

TRUNC (MOD ((a.enddttm - a.rundttm) * 24 * 60 * 60, 60)) sec,

a.prcsinstance, c.outputdir

FROM psprcsrqst a, PSXLATITEM b, ps_cdm_list c

WHERE b.fieldname = 'RUNSTATUS'

AND b.fieldvalue = a.runstatus

AND a.prcsinstance = c.prcsinstance

AND a.prcsname = 'your_process_name'

ORDER BY 5 DESC;

Traversing the Dept Security tree

We can use the connect by prior function provided by Oracle to traverse the Dept security Tree . Suppose an Organization has 7 levels in Dept tree i.e. 1 to 7 .

We want to traverse the dept tree from level 3 to level 6.

Also we know the deptid at the level 3 say 'LVL3-DPT' .

Page 27: PeopleTools Tables

We can use the following SQL to traverse the whole tree (3-6) starting from 'LVL3-DPT'. Only child of 'LVL3-DPT' will be seen in sql output. The starting deptid has to be used with "START WITH " clause.

SELECT TR.TREE_NODE , TR.TREE_LEVEL_NUM

FROM PSTREENODE TR

WHERE TR.TREE_NAME = 'DEPT_SECURITY'

AND TR.SETID = $SETID

AND TR.EFFDT = (SELECT MAX(TR_ED.EFFDT) FROM PSTREENODE TR_ED

WHERE TR.SETID = TR_ED.SETID AND TR.TREE_NAME = TR_ED.TREE_NAME

AND TR_ED.EFFDT <= TO_DATE (SYSDATE, 'DD/MM/YY'))

AND LEVEL <= (6 - 3 + 1)

CONNECT BY PRIOR TR.TREE_NODE = TR.PARENT_NODE_NAME

START WITH TR.TREE_NODE = 'LVL3-DPT'

Who Modified this PeopleCode?

Nothing frustrates me more than developers modifying delivered PeopleSoft code without adding comments. It is easy to figure out who was the last person to touch a record by clicking on the Record Properties button in application designer. BUT it is not that easy when it comes to PeopleCode.

I have written the following SQL to help me identify the last person to modify a Record Field PeopleCode Event.

SELECT objectvalue1 record_name, objectvalue2 field_name,

objectvalue3 peoplecode_event, lastupddttm, lastupdoprid

FROM pspcmprog

WHERE objectvalue1 = :record_name

AND objectvalue2 = :field_name

AND UPPER (objectvalue3) = UPPER (:peoplecode_event);

Page 28: PeopleTools Tables

The SQL could be easily modified to work on any PeopleCode event level (component, page, or Record level). My need was to write it against Record Field PeopleCode.

PeopleSoft XML Publisher - Report Development

PeopleSoft XML Publisher

This article explains how to create XML Publisher also called BI Publisher reports in PeopleSoft. XML Publisher is the only Reporting platform in the Fusion Application. Before we talk about how to create an XML Publisher report in PeopleSoft, I would like to give a brief overview.

Overview:

XML Publisher consists of the following components:

• Data Source

• Template

• XML Publisher Engine

• Report

Data source can be defined using in the following forms:

1. PS Query

2. Rowset

3. XML File

4. XMLDoc Object

Report template can be created using MS Word. A plug-in for MS Word can be downloaded from Oracle’s website or PeopleSoft application.

XML Publisher Engine takes data source and template and creates a report.

Steps to create XML Publisher Report:

Step 1 – Data Source:

Go to Reporting Tools XML Publisher Setup Data Source. Add a new Data Source. Select either PS Query or Rowset.

Page 29: PeopleTools Tables

If you selected PS Query, first create a Query that you wish to use in your report. Youc can click on ‘Generate’ button to create Sample XML file to be used in report template. Save XML file on your PC.

If you wish to use Rowset then write an Application Engine program that writes Rowset in the form of XML data and XSD schema. Use functions GetXMLData and GetXSDSchema to generate XML file and XSD file for rowset.

Step 2 – Report Template

Let’s create an RTF template using XML file that you created in step 1.

Open MS Word after you have installed the plug-in. You will notice that there are five new buttons. Click on the first button i.e. Data and Load XML file that you created in step 1. Now your sample data is loaded in the template. You can format your report and test it using the loaded data. Save the template.

Step 3 – Report Definition

You are ready to create report definition.

Go to Reporting Tools XML Publisher Setup Report Definition and add a value. Specify the report name, data source type and data source name. There are five tabs in Report Definition.

1. Definition – Specify description and category of report.

2. Template – Upload the template file created in Step 2.

3. Output – Specify the output report format and set a default format.

4. Security – Specify the Role or User who should have access to the report.

5. Bursting – Specify the criteria if you need to burst the report. Leave it blank if bursting is not needed.

Save the report definition.

Step 4 – Process Definition

Write a small Application Engine program that runs the above report definition. Now create a new process definition that runs this Application Engine process.

Your first XML Publisher report is ready. Remember the output of XML Publisher report does not go to Process Monitor. In order to see the report, you need to go to Report Manager.

Go to http://www.gravitonconsulting.com/ for more help.

Try it out and email me if you have any questions

[email protected]

Page 30: PeopleTools Tables

Peoplesoft Administration

Process Scheduler Run Status (RUNSTATUS) Values

Process scheduler status is stored as numeric values behind the RUNSTATUS field. So, here are the values corresponding to each value.

FIELDVALUE XLATSHORTNAME

---------- -------------

1 Cancel

2 Delete

3 Error

4 Hold

5 Queued

6 Initiated

7 Processing

8 Cancelled

9 Success

10 No Success

11 Posted

12 Not Posted

13 Resend

14 Posting

15 Generated

16 Pending

Ren Server -- Over View

The REN Server is a seperate Web Server designed to publish Real-time Event Notifications to users, saving them the effort of repeatedly clicking on the Refresh button in Process Monitor. The Popup window you see when running a process ‘to window’ is originally an HTML area populated/called from an iScript, but then some HTML/JavaScript is loaded from the REN Server itself.

Page 31: PeopleTools Tables

To assign permission to run a report ‘to window’ there are 2 steps to follow:

1) Look on the PeopleTools tab of the Permission List and click on Realtime Event Notification Permissions and check ‘Reporting Window’ has ‘Full Access’.

If you wish to use SQL, this will show which Permission List is giving you access to the Report to Window functionality. By default, it is PTPT1200.

SELECT RU.ROLEUSER , RU.ROLENAME , RC.CLASSID , AI.AUTHORIZEDACTIONS FROM PSROLECLASS RC , PSROLEUSER RU , PSAUTHITEM AI WHERE RC.ROLENAME = RU.ROLENAME AND RU.ROLEUSER = 'PTDMO' AND AI.CLASSID = RC.CLASSID AND AI.BARNAME = 'REPORTING'

2) You’ll also need access to the iScript. Stay with the Permission List, and look on the Web Libraries tab. You need to give WEBLIB_RPT Full Access to the iScript.

Again, if you wish to use SQL, this will show you the Permission list that is giving you access:

SELECT RU.ROLEUSER , RU.ROLENAME , RC.CLASSID , AI.AUTHORIZEDACTIONS FROM PSROLECLASS RC , PSROLEUSER RU , PSAUTHITEM AI WHERE RC.ROLENAME = RU.ROLENAME AND RU.ROLEUSER = 'PTDMO' AND AI.CLASSID = RC.CLASSID AND AI.MENUNAME = 'WEBLIB_RPT' AND AI.BARNAME = 'ISCRIPT1' AND AI.PNLITEMNAME = 'IScript_GetReport'

Now that security is covered you might think that there’s not a huge amount to talk about with the REN Server as in some ways it’s a bit of a ‘black box’. Unless you need Clustering/Failover or a Reverse Proxy Server there isn’t much to configure.

There are some settings in the psappsrv.cfg (logging levels, ports and authentication token domain),

Page 32: PeopleTools Tables

and some settings under PeopleTools in the PIA (client authentication, SSL and host machine), and of course the option to boot the PSRENSRV process or not is set using PSAdmin there is also a psrenconfig.txt under the App Server directory, but I’ve never needed to mess

with these settings Yes, yes, you say. I know all that already. Tell me something I don’t know. Ok, I’ll wager you didn’t know this …

The neatest trick that drew my attention to the ‘NotifyToWindow’ method of the PrcsApi class. It’s one of those little gems that’s tucked away in PeopleBooks that I’d never noticed before.

It’s a method that lets you inject HTML into the REN Server window and it sounded like an ideal method of giving users feedback on the progress of their process/report. To give it a quick try I added some code to the PORTAL_CSS App Engine (in a play environment obviously, not anywhere important) and gave it a whirl.

The code I added all went into PORTAL_CSS.CREFPERM.Step1 and was as follows:

At the top:import PT_PRCS:API:*;

After the functions (about half way down):Local PT_PRCS:API:PrcsApi &api = create PT_PRCS:API:PrcsApi();

Then, wherever I wanted to update the user of the status, I added the following:&strl_WindowMsg = &strl_WindowMsg | "<br />Step 1/5: Portal Security Sync starting. (" | DateTimeToLocalizedString(%Datetime, "HH:mm:ss") | ")";&nret = &api.notifyToWindow(AEPORTALCSS_AET.PROCESS_INSTANCE, &strl_WindowMsg);

placed my messages at reasonable points in the process and ran it. The resulting REN Window looked as follows:

Page 33: PeopleTools Tables

I’ve only output static text to the window, but there are further possibilities. I’d be interested to hear from anyone with good ideas on how to use this.

Set Number of Links within the Portal Navigation

The picture below shows a Security folder and 2 sub-folders (User Profiles and Permissions & Roles). You can also notice that each sub-folder has 4 more links listed below it (in addition to the More... link). If you are wondering why 4 links and not 6 or 10 links, well, it is 4 links because this is what I want it to be.

How can you set the number of links available under a Portal folder?

Navigate to PeopleTools > Portal > Portal Utilities > System Options and update "Maximum Child Links" to 4.

Very easy to setup and it could make a big visual difference for your users.

Setup Web Services in PeopleSoft

PeopleSoft Web Services – Consume Web Service

Web services is a collection of programming techniques including SOAP, WSDL and XML. They are platform indepent. Web services in PeopleSoft gives you the ability to expose PeopleSoft functions and methods to the outside world over HTTP. It also allows PeopleSoft to use Web services made available by different systems. These are easily accessible via standard HTTP and HTTPS protocols.

How to setup Web Services in PeopleSoft With the basic understanding of Integration Broker, it’s very easy to setup Web Services in PeopleSoft.

In this article I am going to explain how to consume web services in PeopleSoft:

Consume Web Service

PeopleSoft provides a Wizard to consume Web services. It’s an easy-to-use eight step process. Use the following steps:

1. Go to PeopleTools , Integration Broker , Web Services , Consume a Web Service.

Page 34: PeopleTools Tables

2. You’ll see five options: UDDI, WSDL URL, WSIL URL, File, Legacy WSDL (Prior to 8.48).

3. We are going to use WSDL URL assuming that you have the URL of the Web service that you are trying to use.

4. Check WSDL URL radio button and enter Web Service URL. Click ‘Next’ button.

5. This next screen will show you the name of WSDL service. Select the serviceby checking the box. If you would like to see the service WSDL, click View WSDL hyperlink.

6. Hit the ‘Next’ button which will take you to step 3. In this screen you may see more than one port of the Web service. You just need to select one port. After selecting the port, hit ‘Next’ button.

7. It takes you step number four. In this step, you will be able to select all functions/methods that are provided by Web service. This screen gives a lot of details about the methods such as method type, port type, etc. Chose all methods that you need for PeopleSoft and hit Next button.

8. If the method that you selected above is a Synchronous Operation that it will take you directly to Step 6. If the method is Asynchronous then it will take you to Step 5 where you will be able to convert two Asynchronous messages to one Synchronous message. Hit the ‘Next’ button after you are done with step 5.

9. Now you are in Step 6 which allows you to convert Web service methods to PeopleSoft Service Operations messages. When you go to step 6, PeopleSoft automically assigns messsage names but you can change them to more meaningful names.

10. From step 6 you can be directed to either step 7 or step 8. If your web service has an asynchronous message then it takes you to Step 7. In this step you assign a Queue to your Service Operation. You can create a new queue or assign an existing one.

11. Step 8 allows you to assign an existing or a new node to your Service Operation. Click the Finish button to proceed to the next step in the Wizard.

12. The final page is the Consume Web Service Confirm page. There you see WSDL Import log which provides the summary. You can also view the consumed web service.

View web service in Integration Broker

Now you are done with ‘Consume a Web Service’. In order to view the components of the consumed web service you can go to Integration Setup under PeopleTools. If you are not familiar with Integration Setup, follow the steps below to find how to view Service Operation that you just created.

1. Go to PeopleTools ,Integration Setup ,Services

2. Type in the service name that you had created in Step 6.

Page 35: PeopleTools Tables

3. It will open the Service details. You can also view the Service Operation associated with it. There is ‘View WSDL’ hyperlink that you can use to view the consumed WSDL document.

Go to http://www..gravitonconsulting.com/ for more information.

If you need more assistance, email me : [email protected]

Upload Files in PeopleSoft (File Attachment)

I will not be giving any sample code in this post BUT I will show you the way to find the code. Code that is delivered by PeopleSoft and does a little bit more that just uploading a file! The code will show you how to View and Delete uploaded files as well.

Just navigate to PeopleTools > Utilities > Debug > PeopleTools Test Utilities to get the component and page name (Ctrl+J). Open Application Designer and start looking at the code. That same code could be used on your own custom page to allow users to upload, view and delete attachments!

The PeopleTools Test Utilities page is also used to test for Java calls. This is outside the topic of this post, the only section that matters for us on the page is the "File Attachment Test".

Common Terminology Used in Web Services

Before start using PeopleSoft Integration Broker for sending and receiving services, you need to be familiar with the terminology used for Web services. In this post, I will try to list and describe common terms used for Web services.

Extensible Markup Language (XML): XML is a text-based format that provides a mechanism to describe document structures using markup tags. It allows developers to create their own customized tags, enabling the definition, transmission, validation, and interpretation of data between applications and between organizations.

Page 36: PeopleTools Tables

XML Schema Definition (XSD): XSD is a way to describe and validate data in an XML environment. You can think of a schema as a model for describing the structure of information. XSD makes it easier to validate documents based on namespaces. Namespaces prevent identically custom-named tags that may be used in different XML documents from being read the same way.

Simple Object Access Protocol (SOAP): SOAP is a way for programs running in different or same operating systems to communicate with one another buy using the World Wide Web’s Hypertext Transfer Protocol (HTTP) and XML.

Web Services Definition Language (WSDL): WSDL is an XML-based language used to describe services provided by a business and defines how other businesses can access those services electronically. WSDL not only describe the message content but also defines where the service is available and what communicates protocol to use to communicate with that service. In short, the WSDL file defines every thing needed so that developers can write a program to work with an XML Web Service.

Web Services Inspection Language (WSIL) specification provides an XML format for assisting in the inspection of a site for available services and a collection of rules for how inspection related information should be made available for consumption.

Universal Description, Discovery, and Integration (UDDI): UDDI as described by PeopleSoft "is an XML-based registry for businesses worldwide to list services on the Internet. Its ultimate goal is to streamline online transactions by enabling companies to find one another on the Web and make their systems interoperable for e-commerce. UDDI is often compared to a telephone book's white, yellow, and green pages. UDDI allows businesses to list themselves by name, product, location, or the Web services they offer."

Debugging Functionality in Peoplesoft

Open Configuration Manager -> Profile ->Create.

• Select Connection Type as Application Server.

• Enter Application Server Name

• Machine Name or IP Address should be your machine IP address on which application server domain resides.

• Port Number should be WSL port number.

Turn on Debugger Service. Bring the following changes in your PSAPPSRV.CFG file

Location: \\PS_HOME\appserv\DomainName\

Psappsrv.cfg:

..[People Code Debugger]

Page 37: PeopleTools Tables

;————————————————————————-

PSDBGSRV Listener Port=15000

...

[PSAPPSRV]

;=========================================================================

; Settings for PSAPPSRV

;=========================================================================

;————————————————————————-

; UBBGEN settings

Min Instances=2 Give >= 2

Max Instances=2

Service Timeout=0 Give >= 2

Go to PSADMIN -> Quick Configuration. Check whether the PC Debugger feature is enabled or not. Make it yes, and start the application server domain.

PC Debugger should be set to yes.

• Login into Application Designer and PIA with same User ID

Go To Application DesignerDebugSelect PeopleCode Debugger Mode

Press ctrl+F9 to set the Break Points

Press F5 to run the execution of program

FTP Files in PeopleSoft

PeopleSoft Integration Broker – FTP Files

This article explains how you can download files from FTP servers using Integration Broker. It is usually helpful because it becomes it's quite easy and you don’t have to hard code user id and passwords in SQR, Application Engine or PeopleCode.

We are going to use Integration Broker technology to FTP files. PeopleTools comes with FTPTARGET connector that can be used to GET and PUT the files. You can follow the steps below to play around with the files.

Page 38: PeopleTools Tables

Download file from FTP server:

1. Create FTP GET node: This node will be used to download the file from FTP server. Setup the node using these instructions:

Go to PeopleTools , Integration Broker , Integration Setup, Nodes.

Add a new node called FILE_FTP_GET_NODE. Make sure that node type is ‘External’ and it’s an Active node.

Go to Connectors tab and enter Gateway Id ‘Local’. In Connector Id field, select ‘FTPTARGET’ by clicking magnifying glass. Connector properties will be populated automatically.

Enter all the required fields such as hostname, userid, password (encrypted), etc. Enter ‘GET’ for method property. This is to tell the node that we are downloading the file.

You may add other properties for example ‘DIRECTORY’ to mention the folder where file resides. You may also specify name of the file using ‘FILENAME’ property.

Save the node.

2. Create Service Operation: Now create a Synchronous Service Operation. It will use two Services. Let’s create two non-rowset services called: FTP_RQST_SVC and FTP_RESP_SVC. Now add a new synchronous Service Operation called: FILE_FTP_GET_OPR. Use the above services as Request and Response in your service operation. Save it.

3. Create Routing: Go to Routing tab of FILE_FTP_GET_OPR service operation and add a new routing called: FILE_FTP_GET_RTG. In the routing definition, specify ‘PSFT_EP’ or your local node as ‘Sender Node’ and ‘FILE_FTP_GET_NODE’ as your 'Receiver Node'. Make sure that the routing is activated.

Now your integration broker setup for FTP the file is ready. Write PeopleCode to use the above setup. You may write code in Application Engine or behind a push button. You can even write Request and Response handlers.

If you need more assistance, email me:

[email protected]

Go to http://www.gravitonconsulting.com/ for more help.

Move or Hide Portal Search Box

Part of our upgrade requirement is to hide the search box on the navigation menu as we are not using it. It must be easy to do, right? Well yes and no. Yes, if you know where to go, and No, if you don't. It will just take some time to dig around to find the right place to turn it off (Hide it).

To hide the search box navigate to:

Page 39: PeopleTools Tables

Root >> PeopleTools >> Portal >> General Settings. Locate the second box on the page and there you should see a check box that says "Display search in navigation". Uncheck it, clear cache and sign back in. Voila, search box is gone.

Notice the adjacent check box "Display search in header", if you check this one, then the search box would be moved from the left menu (default location) to the Header. Give it a try to see how would that look. Using the search box on the header instead of the left navigation menu might save you some space!

Page 40: PeopleTools Tables

Peoplecode

Dynamic Drop Down(Translate Values)

This code i have got Ittool box.com.

It is very useful. we usually have requirement when we want to hide some translate values from translate field on page for some business reason.

In this case we can use AddDropDownItem(),ClearDropDownItem().

The fact is that we need to use ClearDropDownItem() function first. so whatever values it had will be cleared out and then we will have to manually add values using AddDropDownItem().

Here is an example on the page activate PeopleCode.

Local Field &fField;

&fField = Record.EX_APR_WRK.APPROVAL_STATUS;

&fField.ClearDropDownList();

&fField.AddDropDownItem(" ", "All");

&fField.AddDropDownItem("A", "Approved");

&fField.AddDropDownItem("D", "Denied");

&fField.AddDropDownItem("H", "Hold");

I hope this will help everybody if needed.

Check for User Role

A very handy PeopleCode function to check for a user role(s) and perform specific actions depending on the value returned.

Function RoleToMatch(&RoleToMatch) Returns boolean;

&bFound = False;

/*Returns an array containing all roles associated to the current user*/

&aRoles = %Roles;

/*Loop through the array*/

For &I = 1 To &aRoles.Len

Page 41: PeopleTools Tables

&RoleName = &aRoles.Shift();

If Upper(LTrim(RTrim(&RoleName))) = Upper(LTrim(RTrim(&RoleToMatch))) Then

&bFound = True;

Break;

End-If;

End-For;

Return &bFound;

End-Function;

...and here is how to call the function

/*Note: Don't forget to declare your function before you call it*/

/* Declare variables

&aRoles is an array of string that will store roles from %roles */

Local array of string &aRoles;

Local number &I;

Local string &RoleName;

Local boolean &bFound;

/*Function Call*/

/*The role that I would like to validate if a user has is "Administrator"*/

If RoleToMatch("Administrator") Then

/*What you want to do goes here*/

End-If;

Delete Multiple Files Using PeopleCode

Deleting files sitting on a server using PeopleCode is one thing I'm sure you will be doing sometime during your PeopleSoft career. The code below should help you out and get you started!

/*The path to the files you need to delete*/

&oldFilesPath = "/my_directory/my_folder";

Page 42: PeopleTools Tables

/*Notice the "*" at the end of the file name. This means any file that starts with "file_name" will be deleted*/

&oldFiles = "file_name" | "*";

&PathAndName = &oldFilesPath | &oldFiles;

/*Display file path and name to be deleted */

MessageBox(0, "", 0, 0, "Delete file: " | &PathAndName);

&oldFileNames = FindFiles(&PathAndName, %FilePath_Absolute);

/*Loop through files found and delete one by one */

While &oldFileNames.Len > 0/* Delete files one at a time */

&deleteFile = "../../../.." | &oldFileNames.Shift();

/*Display file path and name deleted */

&retcode = DeleteAttachment(URL, &deleteFile);

MessageBox(0, "", 0, 0, "Deleted file: " | &deleteFile);

/*Check delete status*/

If (&retcode = %Attachment_Success) Then

MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment succeeded");

End-If;

If (&retcode = %Attachment_Failed) Then

MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed");

End-If;

If (&retcode = %Attachment_Cancelled) Then

MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment cancelled");

End-If;

If (&retcode = %Attachment_FileTransferFailed) Then

MessageBox(0, "File Attachment Status", 0, 0, "DeleteAttachment failed: File Transfer did not succeed");

End-If;

Page 43: PeopleTools Tables

End-While;

Delete PeopleSoft Query From the Database

There could be different reasons why a PeopleSoft developer would like to delete a query from the database. Upgrade clean up would probably be the most common one. Here is a function you can use to get you started.

Function DeleteQuery(&sQueryName As string)

SQLExec("DELETE FROM PSQRYDEFN WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYSELECT WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYRECORD WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYFIELD WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYFIELDLANG WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYCRITERIA WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYEXPR WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYBIND WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYBINDLANG WHERE QRYNAME=:1", &sQueryName);

/*Below tables are not availabe in older PS versions*/

SQLExec("DELETE FROM PSQRYSTATS WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYEXECLOG WHERE QRYNAME=:1", &sQueryName);

SQLExec("DELETE FROM PSQRYFAVORITES WHERE QRYNAME=:1", &sQueryName);

End-Function;

Of course, deleting by Query Name is not the only available option. So, feel free to modify the function to fit your needs.

Delete a File Using PeopleCode

It is always a good idea to check for a file if exists before trying to delete it. So the code below will check for that and then will attempt to delete the file if found. The delete is performed using the build-in peoplecode function DeleteAttachment.

The code below also checks for the returned code by the function to verify whether the file has been deleted or not.

Page 44: PeopleTools Tables

&retcode = DeleteAttachment(URL.BKFTP, ATTACHSYSFILENAME);

If (&retcode = %Attachment_Success) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment succeeded”);

UnHide(ATTACHADD);

Hide(ATTACHVIEW);

Hide(ATTACHDELETE);

ATTACHUSERFILE = “”;

ATTACHSYSFILENAME = “”;

End-If;

If (&retcode = %Attachment_Failed) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed”);

End-If;

If (&retcode = %Attachment_Cancelled) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment cancelled”);

End-If;

If (&retcode = %Attachment_FileTransferFailed) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed: File Transfer did not succeed”);

End-If;

/* following error message only in PeopleSoft Pure Internet Architecture */

If (&retcode = %Attachment_NoDiskSpaceAppServ) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed: No disk space on the app server”);

End-If;

/* following error message only in PeopleSoft Pure Internet Architecture */

If (&retcode = %Attachment_NoDiskSpaceWebServ) Then

Page 45: PeopleTools Tables

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed: No disk space on the web server”);

End-If;

If (&retcode = %Attachment_FileExceedsMaxSize) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed: File exceeds the max size”);

End-If;

If (&retcode = %Attachment_DestSystNotFound) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed: Cannot locate destination system for ftp”);

End-If;

If (&retcode = %Attachment_DestSysFailedLogin) Then

MessageBox(0, “File Attachment Status”, 0, 0, “DeleteAttachment failed: Unable to login into destination system for ftp”);

End-If;

Display Only the Last 4 Digits of a Social Security Number

The PeopleCode below will only display the last 4 digits of a social security number. I have placed the code in a Component PostBuild event and it works perfect.

DERIVED_HR.SOCIAL_SECURITY_NUMBER = Replace(DERIVED_HR.SOCIAL_SECURITY_NUMBER, 1, 7, “XXX-XX-”);

Here, I’m using the replace PeopleCode built-in function. The functions takes the value from a the above field, starts at position 1 and replaces the 1st 7 characters with the string “xxx-xx-”.

The result:

After this code gets executed, SSN on a page should show up as xxx-xx-5623

Dynamic Prompt Table Depending on a Drop Down Value

In this post I will attempt to explain how to dynamically assign a prompt table depending on a drop down value (see image below)

Page 46: PeopleTools Tables

The table behind the grid is PORTAL_SECDYVW and as you can see from the image below, the PORTAL_AUTHNAME field has %EDITTABLE defined as a prompt table. The PORTAL_AUTHNAME is the "Name" column you see on the grid.

Now, we would want to assign table PSCLASSDEFN_SRC as prompt if the drop down value is Permission list and PSROLEDEFN_SRCH if the value is Role.

/*Record PeopleCode: PORTAL_SECDYVW.PORTAL_AUTHNAME.FieldChange*/

Evaluate PORTAL_SECDYVW.PORTAL_PERMTYPE2

When "P"

DERIVED.EDITTABLE = "PSCLASSDEFN_SRC";

PORTAL_SECDYVW.DESCR = PSCLASSDEFN.CLASSDEFNDESC.Value;

Break;

When "R"

DERIVED.EDITTABLE = "PSROLEDEFN_SRCH";

PORTAL_SECDYVW.DESCR = PSROLEDEFN.DESCR.Value;

Break;

When-Other

End-Evaluate;

Page 47: PeopleTools Tables

FTP a File Using PeopleCode

Here is a function to FTP a file on a server using PeopleCode.

Local string &FtpUserID;

Local string &FtpPassword;

Local string &FtpURL;

Function ftp_file;

&FtpUserID = “user_id”;

&FtpPassword = “password”;

&FtpURL = “directory_name/subdirectory_name”;

&targetFile = “File_Name”;

/* Set ftp string */

&Ftp_my_file = “ftp://” | &FtpUserID | “:” | &FtpPassword | “@” | &FtpURL;

/*** It is always a good practice to check to see if local file exists before trying to transfer it ***/

If FileExists(&FILEPATHNAME, %FilePath_Absolute) Then

/*** Sending file… FILEFATHNAME is the path and the name of the file, while targetFile can be used to change the name of the file if need be ***/

&RetCode = PutAttachment(&Ftp_my_file, &targetFile, &FILEPATHNAME);

/* make sure to check the retcode by the built-in PeopleCode function PutAttachment to get the result of your ftp attempt */

Evaluate &RetCode

When %Attachment_Success

MessageBox(0, “File Attachment Status”, 0, 0, “File transfer succeeded”);

Break;

When %Attachment_Failed

MessageBox(0, “File Attachment Status”, 0, 0, “File transfer failed”);

Break;

Page 48: PeopleTools Tables

When-Other

MessageBox(0, “File Attachment Status”, 0, 0, “File transfer failed, Return Code is ” | &RetCode | “. Please refer to PeopleCode Reference for Return Code description. Search for AddAttachment function.”);

End-Evaluate;

Else

MessageBox(0, “File Status”, 0, 0, “File ” | &FILEPATHNAME | ” doesn’t exist. FTP transfer Failed.”);

End-If;

End-Function;

Function to Add Leading Characters to a Value or Field

A function to facilitate the addition of a leading character to a field value. The function takes three parameters:

- &LEADCHAR: The character you want to append to your value.

- &FIELDZISE: The over all size of your value after appending your desired character.

- &FIELDVALUE: The value you want to append the character to.

Function add_leading_char(&LEADCHAR, &FIELDSIZE, &FIELDVALUE, &RESULTFIELD);

/*this function accepts a character value, fieldsize parameter, and a field value parameter and adds a leading character up to the size of the field. The result is passed back in a result field.*/

&LEADCHAR = Left(&LEADCHAR, 1);

&FIELDVALUE = String(&FIELDVALUE);

&FIELDLEN = Len(&FIELDVALUE);

&FIELDFILL = &FIELDSIZE - &FIELDLEN;

&LEFT_HALF = Rept(&LEADCHAR, &FIELDFILL);

&RESULTFIELD = &LEFT_HALF | &FIELDVALUE;

End-Function;

/*Example calling the above function*/

&CHAR = "0";

Page 49: PeopleTools Tables

&FIELDSIZE = 5;

&FIELDVALUE = 7;

add_leading_char(&CHAR, &FIELDSIZE, &FIELDVALUE, &RESULTFIELD);

/*after execution, the &RESULTFIELD value would be equal to 00007*/

Function to Increment a Date Field

The function increments a date field using the AddToDate function and sets a weekday field to the corresponding weekday. You can increment date value by year, month or day.

Function increment_date(&DATE, &WEEKDAY, &YEAR_INCREMENT, &MONTH_INCREMENT, &DAY_INCREMENT);

If All(&DATE) Then

&DATE = AddToDate(&DATE, &YEAR_INC, &MONTH_INC, &DAY_INC);

/*get day value for the incremented date*/

&WEEKDAY = String(Weekday(&DATE));

End-If;

End-Function;

Generic Scroll PeopleCode

We always find it confusing to write code for Scrolls. Following is generic peoplecode which you can use for pages having parent child relationships (scrolls).

Just replace the record and field for respective level.

&rs_level0 = GetLevel0();

&level0fieldvalue = &rs_level0.(1).Level0_Record.Level0_field.Value ;

&row_level0 = &rs_level0.GetRow(1);

&rs_level1 = &row_level0.GetRowset(Scroll.Level1_Record);

For &J = 1 To &rs_level1.RowCount

&level1fieldvalue = &rs_level1.GetRow(&J).Level1_Record.Level1_field.Value

&row_level1 = &rs_level1.GetRow(&J);

&rs_level2 = &row_level1.GetRowset(Scroll.Level2_Record);

Page 50: PeopleTools Tables

For &L = 1 To &rs_level2.RowCount

&level2fieldvalue = &rs_level2.GetRow(&L).Level2_Record.Level2_field.Value

End-For;

End-For;

Get PeopleSoft Home (PS_HOME) Using PeopleCode

PeopleCode to get PS Home from your server:

&PS_HOME = LTrim(RTrim(GetEnv("PS_HOME"), "/"), "/");

Easy and straight to the point

Hide Fields on PeopleSoft Page for Some Users

Sometimes you would like to hide fields from some users and not others. The only way that I know of is by creating a new role and assigns it to users who should not be seeing the fields.

This is how to go about doing that:

Create a role and add the users that should not see the fields to this role. The role doesn't have to have any permission list(s), although it could if you want to, it really doesn't matter for what we are trying to do here.

In the page.activate PeopleCode event, right some code to test if the user opening the page is in that role. If so, then hid the fields.

There is a delivered PeopleSoft function that checks if a user has a specific role.

&role_found = %RolesFind("Your_Role");

rem -- 0 = role not found;

If &role_found <> 0 Then

rem -- hide your fields;

End-If;

How to Add Items to a Drop Down List?

The PeopleCode below will do couple things. First, it will restrict grid on a page to show only rows of address type "HOME". Second, allow users to only be able to add a "Home" mailing address by restricting the values in the drop down list to show only "Home" by using the ClearDropDownList and AddDropDownItem properties.

Page 51: PeopleTools Tables

/* Hide Rows on the grid for any thing that is not of Address Type "HOME" */

FOR &i = 1 TO &Level1.ActiveRowCount

&AddrType = FetchValue(Scroll.PERSON_ADDRESS, &i, PERSON_ADDRESS.ADDRESS_TYPE);

IF &AddrType <> "HOME" Then

&Level1(&i).Visible = False;

Else

&addrHomeFound = "Y";

End-IF;

End-FOR;

/*Users will only be able to add a "Home" mailing address, so restrict the values in the drop down to show only "Home"*/

IF &addrHomeFound = "Y" Then

/* home mailing address already there, no need to show the drop down menu */

DERIVED_CO.ADDR_TYPE_DESCR.Visible = False;

Else

/* Clear drop down list and then show only "Home" */

DERIVED_CO.ADDR_TYPE_DESCR.ClearDropDownList();

DERIVED_CO.ADDR_TYPE_DESCR.AddDropDownItem("HOME", "Home");

End-IF;

%Concat Meta-SQL in PeopleCode

%Concat resolves to the database-specific concatenation operator so you don't have to guess which way it is done.

The following PeopleCode uses the %Concat meta-sql meta-variable:

SELECT INSTRUCTOR, FIRST_NAME %Concat ' ' %Concat LAST_NAME

FROM %Table(PSU_INSTR_TBL)

On SQL Server, this code resolves to:

Page 52: PeopleTools Tables

SELECT INSTRUCTOR, FIRST_NAME + ' ' + LAST_NAME

FROM PS_PSU_INSTR_TBL

On Oracle, this code resolves to:

On SQL Server, this code resolves to:

SELECT INSTRUCTOR, FIRST_NAME || ' ' || LAST_NAME

FROM PS_PSU_INSTR_TBL

%CurrentDateIn Meta-SQL Function

A very useful PeopleCode Meta-SQL function. I will be providing an

example and how %CurrentDateIn function will be resolved at run time.

But first, this is how PeopleSoft explains it:

The %CurrentDateIn meta-SQL variable expands to a platform-specific SQL

substring representing the current date in the Where clause of a SQL

Select or Update statement, or when the current date is passed in an

Insert statement.

And here is an example:

SELECT 'X'

FROM dual

WHERE sysdate > %CurrentDateIn;

At run time, the SQL above will be resolved to look like this:

SELECT 'X'

FROM dual

WHERE sysdate > To_Date(To_Char(SYSDATE, 'YYYY-MM-DD'), 'YYYY-MM-DD');

%EffDtCheck PeopleCode Built-in Function

Effective dated quires are used often in PeopleSoft and a great build-in function that will save you time is the %EffDtCheck. Lets take a closer look!

Syntax

Page 53: PeopleTools Tables

%EffDtCheck(recordname [correlation_id1], correlation_id2, as_of_date)

The %EffDtCheck construct expands into an effective date subquery suitable for a Where clause.

recordname: Specify the record name to use as the record in the effective-date checking. This can be bind variable, a record object, or a record name in the form recname.

correlation_id1: (Optional) Specify the letter used inside the effective-dating subselect. If this parameter isn’t specified, recordname is used.

correlation_id2: Specify the letter already assigned to the main record in the From clause of the SQL statement.

as_of_date: Specify the date to use in the effective date. This can be a bind variable, a variable, or a hard-coded date. The value for as_of_date is automatically wrapped in%DateIn unless as_of_date is already wrapped in %DateIn or refers to other database columns.

Here are some examples from PeopleSoft books:

The following is a generic code sample:

SELECT. . .

FROM. . .

WHERE %EffDtCheck(recordname correlation_id, as_of_date)

The example code resolves into the following:

SELECT . . .

FROM. . .

WHERE correlation_id.EFFDT = (SELECT MAX(EFFDT) FROM recordname

WHERE recordname.KEYFIELD1 = correlation_id.KEYFIELD1

AND recordname.KEYFIELD2 = correlation_id.KEYFIELD2

AND. . .

AND recordname.EFFDT <= %DATEIN(as_of_date))

In the following example, &Date has the value of 01/02/1998. The example &Rec object has an EFFDT key field.

SQLExec("SELECT FNUM FROM PS_REC A WHERE %EffDtCheck(:1, A, :2)", &Rec, &Date);

This example code resolves into the following:

Page 54: PeopleTools Tables

"Select FNUM from PS_REC A where EFFDT = (select MAX(EFFDT)

from PS_REC

where PS_REC.FNUM = A.FNUM

and PS_REC.EFFDT <= %DateIn(’1998-01-02’) )"

The following example uses correlation IDs:

SELECT A.DEPTID

FROM %Table(DEPT_TBL) A

WHERE

%EffDtCheck(DEPT_TBL B, A, %CurrentDateIn)

AND A.EFF_STATUS = ’A’

This example code resolves into the following:

SELECT A.DEPTID

FROM %Table(DEPT_TBL) A

WHERE

A.EFFDT =

(SELECT MAX(B.EFFDT)

FROM DEPT_TBL B

WHERE

A.SETID = B.SETID

AND A.DEPTID = B.DEPTID

AND B.EFFDT <=%CurrentDateIn)

AND A.EFF_STATUS = ’A’

To know list of Peoplesoft System catalog tables:

SELECT table_name

FROM all_tables

Page 55: PeopleTools Tables

WHERE owner = 'SYSTEM' – Schama_name

AND NOT REGEXP_LIKE (table_name, '^PS(_)')

AND REGEXP_LIKE (table_name, '^PS');

=+

My Top 6 Tables in Peoplesoft Time and Labor - Presentation Transcript

Top 6 tables in Peoplesoft Time and Labor Jiju Cherian Vengal TESCO

TL_EMPL_DATA

Maps data between EMPLID and T&L parameters like Workgroup, Taskgroup and Time Reporter Status.

The PS_JOB of Time and Labor.

Keys: EMPLID, EMPL_RCD, EFFDT.

Used to find the Workgroup, Taskgroup, Active status, Time Reporter Type, Timezone etc. of an employee.

Found under the Enroll Time Reporters component.

Needs to be in sync with PS_JOB data.

TL_RPTD_TIME

The single most important transaction table in Time and Labor.

Holds all data regarding the time reported by employees.

Key: EMPLID, EMPL_RCD, DUR and SEQ_NBR.

Both Punch and Elapsed data reside in this table – distinguished by the PUNCH_TYPE field.

Other important fields – TRC, TL_QUANTITY, RT_SOURCE.

Has an audit table – AUDIT_TLRPTTIME.

Final target table of the timesheet component.

TL_PAYABLE_TIME

Contains final processed time ready to be sent to a Payroll System.

Output of the Time Administration process and has the TL_RPTD_TIME as the source.

Page 56: PeopleTools Tables

Keys: EMPLID, EMPL_RCD, DUR, SEQ_NBR.

Other important fields – TRC, TL_QUANTITY, PAYABLE_STATUS, PAYROLL_REQ_NUM.

To be used for custom reports and interfaces requiring to take the final output in Time and Labor.

TL_TR_STATUS

Table used by the Time Administration process to determine the employees to be processed.

Not externalised through any component – updated by the Time Administration process and Peoplecode in various components including timesheet.

Keys – EMPLID, EMPL_RCD.

Other important fields – EARLIEST_CHGDT, TA_STATUS.

TL_IPT

Intermediary Payable Time tables – IPT tables are the most important temporary tables in Time Administration processing.

Data from reported time and scheduling tables are populated in TL_IPT1.

Extensively used by almost all T&L rules where data is transferred from one IPT table to another for rule processing.

TL_PAYABLE_TIME data is populated from TL_IPT1 table at the end of rule processing.

TL_EXCEPTION

Transaction table containing the details of all exceptions that are generated.

Exception_Status field tells whether the exception is resolved (R), unresolved (U) , allowed (A) or changed (A).

All exceptions with an ‘Archive’ flag on will remain in the TL_EXCEPTION table after the exception is resolved.

All High Severity exceptions will have to be resolved for payable time to be generated.

=+