A Simple Application Engine Program

Looping Through Employees and Sending Emails

By Derek Tomei - DMT Solutions, Inc.


About the Author

Derek Tomei is a PeopleSoft Consultant and President of DMT Solutions, Inc. Derek has been involved with PeopleSoft software since version 5 through the most recent versions of HCM and Financials . He has seen and worked through the progression from PeopleSoft client-server 2-tier, 3-tier, and n-tier. He has worked on small private companies to large fortune 500 corporations implementing, upgrading, installing, enhancing, and maintaining PeopleSoft Financial and HRMS software.


Derek is considered one of the PeopleSoft industry's top technical consultants with the ability to perform in all areas of technical expertise including but not limited to development, architecture, database administration, system administration, web development, employee and manager self-service, and project management.


Since the inception of PeopleTools version 8, many new features and tools related enhancements have been introduced. One of the best enhancements we have found is inside the Application Engine. PeopleSoft has made the application engine very powerful toolset with a wide range of capabilities.

Prior to version eight Many powerful application were written using COBOL and SQR. However, PeopleSoft is beginning to convert most of the COBOL and SQR programs into application engine programs.

Prior to version eight Peoplesoft’s application engine was not built into the application designer toolset. It was very cumbersome and difficult to use. Since adding the application engine into the application designer, there are many more options and capabilities. For example, you can now use PeopleCode objects and SQL objects within your application engine program.

Designing Application Engine programs has become easier than ever, and is a definite candidate to replace SQR programs. Our favorite feature is the ability to include PeopleCode within your App engine programs. With that said, I
want to show you a quick and easy way to send emails from within an Application Engine

Example of Sending Batch Emails from Application Engine
If you want to efficiently write useful application engine code, then you will find this code example, extremely useful. Did you know you could easily send email messages from within your app engine programs?

Well you can with just a few lines of code. You may find it useful to send an email message to your PS administrator when a certain process is completed. Or perhaps you want to send an email to all employees indicating that their paychecks are available to be viewed via the Employee Self Service ePay application.

Either way, you can easily create a simple application engine program that will send your email message with these few lines of code that I am about to show you. And, once you complete your application, you can easily add the AE program to a PS job stream so that it will execute after your Pay Confirm process.

You will first need to create a New Application Engine program. Here is how to do this..

From the Application Designer choose

1) File – New and select Application Engine.

2) You will see new definition created for you containing the MAIN section with a step entitled STEP01.

3) Simply right click your mouse on the step (STEP01) and choose Insert Action.

4) A new action will be inserted and will default to SQL.

5) Change this action to PeopleCode.

6) Save your program

7) Then double click on the PeopleCode action. Now you are ready to insert the code below. I will fully explain this code.

REM **********************************************;

REM ** Instantiate the record and SQL objects to obtain data *;

REM **********************************************;

&MY_DATA_REC = CreateRecord(Record.EMPLOYEES);

&MY_DATA_SQL = CreateSQL("%selectall(:1) WHERE PAYGROUP = :2");


REM **********************************************;

REM ** Loop through all of the data one row at a time for *;

REM ** all rows *;

REM **********************************************;


REM **********************************************;

REM ** Set all necessary email parameters REM **********************************************;



&MAIL_CC = "";

&MAIL_BCC = "";

&MAIL_SUBJECT = "Pay check is Available Online for Viewing";


&MAIL_TEXT_BODY = "Dear " | &NAME | ", Your paycheck is now available for viewing online.";



REM **********************************************;

REM ** Send the email message for the current employee;

REM **********************************************;



REM ********************************************************;

REM ** Check the status code to ensure the mail was sent successfully;

REM ********************************************************;

If Not (&RET_CODE = 0) Then

WinMessage("Return status from mail = " | &RET_CODE);



REM ** Don’t forget to close the SQL stream **;


As you can see from the above code, it is extremely simple to loop through data with your set criteria and send email messages from within your application Engine program.

Basically, I have used PeopleCode to create a record MY_DATA_REC from the EMPLOYEES table. After this, I created a SQL statement that basically selects from the record PS_EMPLOYEES where the PAYGROUP is some value.

Next, I use a while loop to fetch each row from the record, one by one. As I grab the employee’s data I build my email message and use the SendMail PeopleCode function.

Notice the Parameters that get passed to the SendMail command. You can send file attachments by simply giving a file path/name to the &MAIL_FILES variable.

This is a very basic example of how to send emails. Once, you determine what you need to do, you can always, add more functionality and get more creative with your code.

If you want to find out more about PeopleCode or the Application Engine in PeopleSoft version 8 and beyond, including the Syntax, structure, and features, I highly recommend the following:



USE COUPON CODE:  FALL-40  When You Checkout.

The Component Processor and the Component Buffer

This is a 30 page downloadable eBook/technical guide that discusses the PeopleSoft Internet Architecture, the Component Processor, the Component Buffer, PeopleCode Events, and Buffer Allocation. It also lists specific tips for ensuring your applications are designed appropriately and to help you ensure adequate performance. This information is given to you in an easy to read manner. Whether you are a Developer, Technical Lead, Programmer, or a business analyst, this book will guide you through understanding the Component Processor and the Component Buffer.
Product Code: CPCB01
Our Price: $14.95
Sale Price: $7.95
You Save: $7.00 (47%) Order
Tuning your PeopleSoft� Apps for Maximum Performance

This is a downloadable eBook. his 38 page eBook presents several general methodologies and techniques for performance tuning your PeopleSoft� environment and applications in an easy to read manner. Whether you are a System administrator, DBA, manager, developer, or system architect, this book will assist you in identifying areas where improvements in your PeopleSoft� server hardware, database server, application server, web server, and applications can be obtained.
Product Code: PERF-01
List Price: $29.95
Our Price: $9.95
Sale Price: $9.95
You Save: $20.00 (67%) Order

Application Engine - Component Interface

This is a 16 page downloadable eBook/technical guide that provides a step by step method of teaching you all about Programming the PeopleSoft Component Interface and Application Engine combination. This includes creating a component interface, programming a component interface, adding a component interface to an Application Engine Program. Once you read this guide, you will be amazed at how powerful and easy it is to work with the Component Interface.
Product Code: AECI-01
List Price: $7.95
Our Price: $9.95 Order
Developing PeopleSoft Dynamic Security Applications Inside you will find various Chapters that cover a PeopleSoft Developer's guide to implementing dynamic field level security.
Product Code: FS-01
List Price: $19.95
Our Price: $9.95
Sale Price: $7.95
You Save: $12.00 (60%) Order

Developing with PeopleSofts Application Engine 8 Downloadable eBook to show you how to build Application Engine programs. You will learn to not only read Application Engine programs but also create them as well; including programs with File input and output capabilities. Tips, Hints and Warnings are given throughout the book to make sure your knowledge is complete. You will also learn how to test and debug Application Engine programs using two-tier, as well as the Internet client.
Product Code: AE-01-01
List Price: $19.95
Our Price: $9.95
You Save: $10.00 (50%) Order
How to Create a JOB SET Dynamically This download-able eBook will show you how to setup a job dynamically based on specific criteria either from the user or data? Have you ever needed to launch a series of processes but they must be run in a specific order waiting for the previous process to complete before the next one begins? Maybe you had a need to run the same program over and over but based on a different run control values?
Product Code: JOB-SET
List Price: $19.95
Our Price: $7.95
You Save: $12.00 (60%) Order

The Guide To PeopleSoft� Security

This 60 page eBook covers topics such as Basic Security Design, Roles, User Profiles, Permission Lists, Row Level Security, Portal Structures, LDAP Authentication, Password Controls, Dynamic Roles, and much more. This book covers versions 8.1x through 8.4.
Product Code: SEC-01
List Price: $29.95
Our Price: $9.95
You Save: $20.00 (67%) Order
Developing PeopleSoft Apps with PeopleTools 8.1 Rev 2

This is a downloadable eBook. Essential reading for those who currently use PeopleSoft or are ready to tackle a new PeopleSoft project with the new PeopleTools version 8.1
Product Code: PT81
List Price: $34.95
Our Price: $9.95
You Save: $25.00 (72%) Order

What Is PeopleSoft?

This eBook is targeted for Managers, Vice Presidents, CIO�s and CEO�s that want to learn about PeopleSoft in a minimal amount of time. This can also be used as a general presentation to learn all about PeopleSoft.
Product Code: SS-PS01
List Price: $9.95
Our Price: $5.95
You Save: $4.00 (40%) Order
A Guide To Programming Object Scroll Peoplecode

This 16 page technical guide provides a step by step method of teaching you all about Programming the PeopleSoft Scroll Object. This includes scroll levels 0, 1, 2 and 3. Once you read this guide, you will be amazed at how easy it is to work with scroll area's, grids, and scroll processing.
Product Code: SCROLL-01
List Price: $24.95
Our Price: $7.95
You Save: $17.00 (68%) Order
Understanding PeopleSoft's Inventory Putaway Process

This presentation is designed to deliver information about the PeopleSoft Inventory Putaway process so that you can understand how it works, what the key processes and elements are as well as the detail record and field information. This presentation will also teach you how to set up inventory putaway process and how to run the Putaway processes.
Product Code: SS-PUT-01
List Price: $29.95
Our Price: $24.95
You Save: $5.00 (17%) Order
Advanced Tips and Tricks for PeopleSoft Application Engine Inside you will find various Chapters that cover advanced tip and tricks that have been used by developers with years of experience in PeopleSoft. This information has been compiled by STARR Software so that others may benefit from this information
Product Code: AE-02
List Price: $19.95
Our Price: $14.95
Sale Price: $9.95
You Save: $10.00 (50%) Order