Category: Uncategorized

Step-by-Step: App Engine for Testing PeopleCode

This is a how-to post that I intend to refer back to from time to time.  The goal is to create a simple Application Engine program into which we can drop some PeopleCode and see how it works.  Assuming we don’t need any of the online pieces, this is much easier than going through all of the steps to create a page and register it so we can see it online.

Step 1: Create a new Application Engine Program

In Application Designer, click Ctrl + N or use the File > New menu option.  This will open the “New” dialog, and you can choose Application Engine program from the list.

You new program should look like this:

Step 2: Disable Restart

This step is very important.  If you don’t disable the restart and your program crashes, you will have to go through a few extra steps before you can rerun it.

First, click on the properties button while your program is in focus (you can also use the File > Definition Properties menu):

This should bring up the Properties dialog.  Then, go to the Advanced tab.  Check the “Disable Restart” option.

Step 3: Add an Action

First, click on the “Step 1” step to select it.  I usually click anywhere in the gray, and this should turn it black.

Next, click on the Add Action button, or you can use the Insert > Action menu.

Finally, change the type from SQL to PeopleCode.

Step 4: Save the program

At this point, you need to save before you can add PeopleCode.  You can use Ctrl + S, click on the Save icon on the toolbar, or you can use the File > Save menu.

Step 5: Enter the PeopleCode

First, open the PeopleCode program by double clicking anywhere on the gray of the PeopleCode action.  Or, you can right click on it and choose the “View PeopleCode” option.

Next, you will probably want to open a file to show output from your PeopleCode testing.  You can use this PeopleCode:

Local File &log;
&log = GetFile("c:\temp\log.txt", "W", "A", %Filepath_Absolute);

Then, you can print to that file with the writeline() method.  For now, we will just print Hello, World.

&log.WriteLine("Hello, World!");

Finally, you will probably want to close your file:

&log.Close();

Here is what it all looks like:

Make sure to save once you make these changes.

Step 6: Run the Program

Again, after you have saved, go back to the main program window where you can see the Main section, Step 1, and your new PeopleCode action.  Then, click the run icon.

In the dialog, Check the Output log to file and uncheck Run Minimized.  The output log to file allows you to see what happened.  Otherwise, the window will close before you see what happened.  The run minimized isn’t a big deal, but if the program doesn’t run minimized you see it pop up and go away better.  When the program goes away, you know it is done running.

Finally, when it is done, check the output.  If you used the paths that I did your output should be in the c:\temp directory.  You should have two files.  The first, is the main output from the program.  Check this to make sure the program ran to success:

The second is the log that your PeopleCode created.  For now, it should just say, “Hello, World”.

Good Looking Messages

I have often wanted to display an informational message at the top of the page.  Rather than just slap a Long Edit Box at the top of the screen, I decided to look for a nice looking way to do it.  One of the great things about PeopleSoft, it always has an example somewhere in the huge product for what you are trying to do.

Here are some of the messages that I found:

Information Message:

Example Page: SSS_STDNTCTR_SR_SP

Here are the different pieces:

  • Stylesheet of the page: SSS_STYLESHEET
  • Group Box:
    • Label Stylesheet: PAGROUPBOXLABELINVISIBLE
    • Body Stylesheet: SSSMSGINFOFRAME
  • Static Image:
    • Image: PS_CS_MESSAGE_INFO_ICN
    • Size: 23×23
  • Static Text:
    • Style: SSSMSGINFOTEXT

Alert Message:

Example Page: SSF_SS_ERRORMSG

Here are the different pieces:

  • Page Stylesheet: SSS_STYLESHEET
  • Group Box
    • Label Stylesheet: PAGROUPBOXLABELINVISIBLE
    • Body Stylesheet: SSSMSGALERTFRAME
  • Push Button (for the image, you could use a static icon instead)
    • Image: PS_CS_MESSAGE_ALERT_ICN
    • Size: Large Icon
  • Long Edit Box (works the same as the static textbox, but lets you change it from code)
    • Stylesheet: SSSMSGALERTTEXT
    • No Label

Great Link: Combined Sections Video

Today, I was doing some research on how Combined Sections work.  I found this video from the University of Southern Mississippi:

PeopleSoft Class Schedule Entry: Combined Section

Watching the video helped me figure out what I needed to do.  The version was a little old, but I found the same page at Curriculum Management > Combined Sections > Identify Combined Sections (in version 9.0).

It looks like there are a lot more videos here that might prove helpful in the future, so I am bookmarking this page!

University of Southern Mississippi: PeopleSoft Class Schedule Entry

UPK Publish Preview Problem

I have been learning the Oracle UPK product recently, and I was having trouble with the publish preview.  I was getting this error message: “preview requires intranet settings to be enabled. These settings are located on the security tab in the Internet Settings of Internet Explorer.”.

I found a post that gave some options for fixing this.  Unfortunately, I did not see the “Automatically detect intranet network” option that they were talking about.  I was running Internet Explorer 7, and I think my problem was that my OS was Windows Server 2003.  I think the Enhanced Internet Explorer Security was enabled, but I looked to try to see if I could uninstall it.  I also tried changing my default browser to Firefox, but it still opens IE to launch the preview.

The solution that ended up working was simply upgrading to Internet Explorer 8.  I am curious if anyone else has had the same problem and how they fixed it.

News: SAP Making Tracks

I ran across these two articles today:

If SAP does buy Sybase that will put them in line with Oracle as far as owning both the database platform and the Application part.  I don’t know that much about SAP, but I was thinking they used Java in their framework.  I am curious about their feeling on Oracle owning Java.

Using Vim to Count Patterns

The other day, I posted a trick on using Vim with flat files.  Well, today, I wanted to count the number of times certain data conditions appeared in my file.  I created statistics on my program to show the count, but I wanted to check them to make sure the code was right.  I found this command would do the trick in Vim:

:%s/<pattern>//n

The “s” is the part that does a search and replace, but the “n” tells it to only count the matches rather than replace it with anything.  So, if I wanted to count the number of lines with “0” in the 123rd position, I would use this:

:%/^.\{122}0//n

Here is where I found the trick:

Wiki Technology – Vim: Count number of matches of a pattern

Extracurricular at Oracle

I came across a link to Team Oracle the other day.  I didn’t realize that they have their own Air Show team!  I’ll have to watch the schedule to see if I can catch them in our area.

While we are on the topic, I did already know that Oracle has their own Yacht Racing team.  You can check out BMW Oracle Racing here.

Now, we just need a Basketball team!  We could have Oracle Arena and the mascot could be the CPU Chips.  Maybe that is too much imagination.