Author: digitaleagle

HowTo: Creating IScripts

Step 1: WEBLIB_ record

You must put your PeopleCode on a record that begins with “WEBLIB_”. You can either create one or add onto an existing record that meets that naming convention.

Step 2: Create the PeopleCode Function

The function name should start with “IScript_”.

%Response

You can use the %Response to create the output HTML, XML, or other format. The Write function is the main function that you will use:

%Response.Write("<b>Hello, World</b>");

%Request

You can use the %Request object to read parameters that were sent to the script. For example, if the URL had “?EMPLID=00001” at the end of it, you could use the following PeopleCode to read it:

&emplid = %Request.GetParameter("EMPLID");

Step 3: Security

You must grant security to your IScript before you can view it. This is done on the Permission List just like the security for a regular page.

Nagivation to the Permission Online:

PeopleTools > Security > Permissions & Roles > Permission Lists

Go to the WebLibraries page/tab.

On that page, you will need to enter the record name of the script. Then, click on the Edit link to choose the specific IScript that you wish to grant access.

Step 4: Determine the URL

The URL for a component looks something like this:

… /c/MenuName.ComponentName.Market

The URL for an IScript looks something like this:

… /s/RecordName.FieldName.Event.FunctionName

See PeopleBooks for more information.

Step 5: Register Your IScript

If an end-user should access the IScript, you need to put a content reference in the menu for easy access. You can do so, by registering your script through the registration wizard. If you just intend to access the script via code, you don’t need to do this step.

When you open a record that begins with “WEBLIB_”, you will notice a new button on the toolbar for the registration wizard. Just click that button and follow the steps.

See PeopleBooks for more information.

Resources

These resources may not be as relevant:

Question: Single JVM for Web Server

I am having trouble with memory on my VMWare instance of PeopleSoft.  I think a lot of the memory is going to the java virtual machine.  If I look in task manager, I find multiple javaw.exe listings.  Each one takes up at least 50M of memory.  When I use the process explorer, I find that they are all launched by the oracle application server, which is the web server for PeopleSoft.  I can understand having that many instances for production use, but this is just for development and testing.

Does anyone know how I can get the system to consolidate and use only one JVM instance?

Making All Tablespaces Autoextend

During an install of Financials 8.9, I had trouble with some of my tablespaces not autoextending. When I went to load the PPLTLS84CUR project, Application Designer failed saying the PTTBL tablespace was full.

Here is some SQL that I used:

This showed me all of the data files that were not auto-extending:

SELECT * FROM DBA_DATA_FILES

WHERE AUTOEXTENSIBLE = 'NO';

This generated the SQL required to make all of the tablespaces auto-extending

SELECT 'ALTER DATABASE DATAFILE ''' || file_name || ''' AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;' FROM DBA_DATA_FILES

WHERE AUTOEXTENSIBLE = 'NO';

Blog Update

I have updated the PeopleTools Tables page and changed the theme for the site.

Theme:

I chose the Rubric theme because it offers better width for the content.  Especially with programming examples, this width comes in handy.  I am open to suggestions though.  I am a little disappointed with the WordPress tools.  The editor works great and is easy to use, but it does not have many features for formatting code examples.

PeopleTools Tables:

I added some descriptions to the change control tables.  I am finding those tables handy for tracking changes that I am making.  Also, I added the tables for Application Engines.  They can help find App Engines that use a particular state record or actions that call a particular section.  View the page here.

PeopleTools Bug: Job Data Component Interface

If you create a basic component interface on JOB_DATA allowing Application Designer to default all of the properties, Application Designer generates a unique constraint error the first time you try to save the new component interface.

Reproducing the Bug

File > New … Component Interface

Pick a Component: JOB_DATA

Do you want to default the properties on the underlying Component definition: JOB_DATA? Yes

File > Save … Enter any name

Error Message


File: e:\pt849-903-R1-retail\peopletools\SRC\psmgr\mgrgensql.cppSQL error. Stmt #: 1741 Error Position: 0 Return: 805 - ORA-00001: unique constraint (SYSADM.PS_PSBCITEM) violated
Failed SQL stmt:INSERT INTO PSBCITEM ( BCNAME, BCTYPE, BCITEMPARENT, BCITEMNAME, SEQUENCE_NBR_6, BCACCESS, BCSCROLL, BCSCROLLNUM, BCSCROLLNAME, RECNAME, SUBRECNAME, FIELDNAME, COMMENTSHORT, MPDEVICEPERSISTINT, SYNCID) VALUES ( :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15)

Workaround

Just save it a second time.

File > Save … Enter any name

I don’t know why but it just worked the second time.

HCM9.0: Reclaiming Index Space

Analysis

Determining largest indexes by blocks

select index_name, leaf_blocks, num_rows
from dba_indexes
where owner = 'SYSADM'
and leaf_blocks is not null
order by leaf_blocks desc;

Determining indexes with the most free space

I found that the index with the most free space only had 32M free.


select a.owner, a.index_name, a.leaf_blocks, a.num_rows, b.tablespace_name,
b.blocks, b.blocks - a.leaf_blocks free_blocks,
(b.blocks - a.leaf_blocks) * to_number(p.value) / 1024 freespace_k
from dba_indexes a, dba_segments b, v$parameter p
where p.name = 'db_block_size'
and a.owner not in ('SYS', 'SYSTEM')
and a.index_type <> 'BITMAP'
and a.leaf_blocks is not null
and a.owner = b.owner
and a.index_name = b.segment_name
order by free_blocks desc;

Determining index space used by empty tables

One thing I noticed in the previous selection is that a number of indexes were on tables that had no rows, but the index had 128K allocated to them. I found that 21606 indexes matched this scenario totaling about 21G of unused space!

select count(*), sum(b.blocks), sum(b.blocks) * max(to_number(p.value)) / 1024 total_kilobytes
from dba_indexes a, dba_segments b, v$parameter p
where a.index_type <> 'BITMAP"
and a.owner = b.owner
and a.index_name = b.segment_name
and a.leaf_blocks = 0
and a.num_rows = 0
and b.blocks = 128;

Finding the PeopleSoft record name for the Oracle index name

In order to be able to put all of these changes into a PeopleSoft Project, I need to be able to tie the index to a PeopleSoft record. Here is an example join for dba_indexes and PSRECDEFN:

select o.index_name, o.table_name, r.recname
from dba_indexes o, psrecdefn r
where (r.sqltablename = o.table_name or (r.sqltablename = ' ' and o.table_anme = 'PS_' || r.recname))
and rownum < 5;

Creating a Project

I wanted to make PeopleSoft do most of the leg work, and so, my next step was to create a project in Application Designer. This way Application Designer will create all of the project header rows in the database (ex: PSPROJECTDEFN, etc.). I had to add the record for the first index just to be able to save the project. I did all this part manually in Application Designer.

I saved my project as SP_INDEX_REBUILD, but you can choose whatever name you would like. Just make sure that you change the name in the SQL below to the name that you choose.

You can use the first row in the project item table as a template for inserting the rest.

select * from psprojectitem
where projectname = 'SP_INDEX_REBUILD';

So, to insert the rest of the tables into the project, I used the statement in the database:

insert into psprojectitem
select distinct 'SP_INDEX_REBUILD', 0, 1, r.recname, 0, ' ', 0, ' ', 0, ' ', 0, 0, 0, 0, 1, 0
from dba_indexes a, dba_segments b, v$parameter p, psrecdefn r
where (r.sqltablename = a.table_name or (r.sqltablename = ' ' and a.table_name = 'PS_' || r.recname))
and p.name = 'db_block_size'
and a.index_type <> 'BITMAP'
and a.owner = b.owner
and a.index_name = b.segment_name
and a.leaf_blocks = 0
and a.num_rows = 0
and b.blocks = 128
and not exists (select 'x' from psprojectitem where projectname = 'SP_INDEX_REBUILD' and objectvalue1 = r.recname);

Warning: this statement did take some time to run. You may want to see if you can optimize it a little. It took about 20 minutes to complete.

Before I could see the new records attached to the project in Application Designer I had to clear the cache in Configuration Manager.

Inserting Rows for DDL

insert into psidxddlparm
select distinct recname, indexid, 2, 0, 'INIT', 0
from pskeydefn k, psprojectitem p
where k.recname = p.objectvalue1
and p.projectname = 'SP_INDEX_REBUILD'
and not exists (select 'x' from psidxddlparm i
where recname = i.recname
and indexid = i.indexid
and platformid = 2
and parmname = 'INIT');

Updating the rest of the rows

update psidxddlparm
set parmvalue = 0
where recname in (select objectvalue1
from psprojectitem
where objectvalue1 = recname);

Updating the Indexes

I cleared the cache to make sure that Application Designer recognized the new changes that I made in the database.

Then, just changing the indexes is not enough the make Application Designer realize that there is something that needs to be rebuilt. So, you have to change the build properties. On the Alter tab, make sure to “Alter even if no changes”. Then, build the project. I had to use the Alter tables options and not just the Create Indexes option to get it to build.

Added line to init.ora

db_2k_cache_size = 10M

If you don’t add this like, you will get the error message: “ORA-29339: tablespace block size 2048 does not match configure block sizes”.

Creating the new tablespace
create tablespace sp_empty_index
datafile ‘e:\oradata\HCM90\SP_EMPTY_INDEX.DBF’
size 10m
blocksize 2k
extent management local autoallocate
segment space management auto;

ALTER DATABASE DATAFILE ‘e:\oradata\HCM90\SP_EMPTY_INDEX.DBF’
AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;

insert into psidxddlparm
select distinct recname, indexid, 2, 0, ‘INDEXSPC’, ‘sp_empty_index’
from pskeydefn k, psprojectitem p
where k.recname = p.objectvalue1
and p.projectname = ‘SP_INDEX_REBUILD’
and not exists (select ‘x’ from psidxddlparm i
where k.recname = i.recname
and k.indexid = i.indexid
and i.platformid = 2
and i.parmname = ‘INDEXSPC’);

update psidxddlparm
set parmvalue = ‘sp_empty_index’
where recname in (select objectvalue1
from psprojectitem
where objectvalue1 = recname)
and platformid = 2
and parmname = ‘INDEXSPC’;

select ‘alter index sysadm.’ || indexname || ‘ rebuild tablespace sp_empty_index;’
from (select distinct ‘PS’ || indexid || recname as indexname
from pskeydefn
where recname in (select objectvalue1
from psprojectitem
where objectvalue1 = recname)) a;

Reclaiming Space for the File System

I used the notes I made for resizing the database to get the free space to the file system.

PSINDEX was 47.89% free — 13.28G free.

Resources

DBAZine.com: Indexes – Part 2: Is This Index the Right Size?

recycle and keep buffers in other tablespace block sizes

Troubleshooting: Shift Not Found

Problem

Message: “The shift displayed below was not found”

This problem exists in the demo system for the company DC and paygroup LE2. It could exist in other scenarios, too.

Solution

A row must exist where the SETID matches with the Set Control Value is the PAYGROUP
and the Shift matches the “Message Data” (the shift that it is saying that it is missing)

So, select in the PS_SET_CNTRL_REC where the set control value is your paygroup and the record is the SHIFT_TBL to get the appropriate SETID for the shift you should add.

SELECT * FROM PS_SET_CNTRL_REC WHERE SETCNTRLVALUE = 'LE2' AND RECNAME = 'SHIFT_TBL'

Misc Info

When running payroll:

Set Up HRMS > Product Related > Payroll for North America > Compensation and Earnings > Shift Table

Record/Table: SHIFT_TBL

Set Up HRMS > Product Related > Payroll for North America > Compensation and Earnings > Earnings Table

Resources

Understanding Shifts

ITToolbox: QuestionAnswer