Sei sulla pagina 1di 28

C H A P T E R

APPLICATION ENGINE
DESIGNER

Overview
In this chapter you will be introduced to developing Application Engine programs using
the Application Engine Designer. You will be introduced to the basic structure of an
Application Engine program, and examine the structure of the program you executed in
the last chapter. Lastly, you will write a small Application Engine program to become
familiar working with this new tool.

Objectives
By the end of this chapter, you will be able to:

List the basic hierarchical structure of an Application Engine program.

Read an Application Engine program by navigating through its structural parts in the
Application Designer.

Write a simple Application Engine program using the Application Designer.

Execute your Application Engine program.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-1

APPLICATION ENGINE

JUNE 2002

Application Engine Designer


Application Engine programs are created and modified in the Application Designer.

File

Open

Definition Type =
Project

PSU_AECLASS

Open

Log on to the PeopleSoft development environment. Start, Programs, PeopleSoft 8,


PeopleTools. The UserId is PTTRA and the password is PTTRA.

In the Application Designer, open the project PSU_AECLASS.

Expand the Application Engine Programs folder.

Select the program PSU_INACT_1 by double clicking on the program name.

Expand all the nodes, by either using the


nodes toolbar button

2-2

APPLICATION ENGINE DESIGNER

icon next to the MAIN folder, the expand all

, or selecting View, Expand All (Ctrl+Shift+X).

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Graphical User Interface


With PeopleSoft 8, Application Engine is fully integrated with PeopleTools. This means
that you use the Application Designer, an intuitive graphical interface, to create your
Application Engine program. The Application Designer offers Application Engine
developers the following benefits:

Ability to open multiple Application Engine programs concurrently.

Ability to work on the entire Application Engine program at once. Users of previous
versions will know that this is a change from only being allowed to work on a
Section at a time.

Easy access to PeopleCode and SQL editors.

Two views of your program.


The Definition view is where you create and modify your programs.
The Program Flow view shows a graphical representation of your program
execution.

Program Flow tab

Click on the SQL or PeopleCode


icon and the content of the action
is displayed.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-3

APPLICATION ENGINE

JUNE 2002

Application Engine Program Structure


An Application Engine program is made up of several key components. It is important to
understand the relationship between the components and the hierarchy in which they
exist.

Application Components
Program
An Application Engine program identifies the set of processes to execute a given task. A
program must contain at least one Section. The execution of the program always starts
with the Section defined as MAIN.
Sections
An Application Engine Section is comprised of one or more Steps and is equivalent to a
COBOL paragraph or an SQR procedure. All Application Engine programs must contain
at least one section entitled MAIN".
A Section is a set of Steps that get executed as part of a program. You can call Sections
(and other programs) from Steps within other Sections.
Steps
A Step is the smallest unit of work that can be committed within a program. Although,
you can use a Step to execute a PeopleCode command or log a message, typically, youll
use a Step to execute a SQL statement or to call another Section. The SQL or
PeopleCode that a Step executes are the Actions within the Step.
When a Section gets called, its Steps execute sequentially. Every program begins by
executing the first Step of the required Section called MAIN and ends after the last Step
in the last Section completes.
Actions
There are multiple types of Actions that you can specify to include within a Step. Keep
in mind, that it is common to have multiple actions associated within a single step. The
following sections briefly describe each type of action. These actions will be explained
in more detail when we approach more advanced topics related to building Application
Engine programs.

2-4

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Program Flow
Application

Section

Steps

Actions

Application program

Callable block of logic

Logical groupings of
actions

Line of Code

Composed of 1 or
more sections

Composed of one or
more steps

Composed of one or
more actions

Can execute:

First section is always


MAIN

Smallest unit of work


COMMITED

Can be specified by:


Market

Starts with MAIN


12 character limit for
application name

Do When

Do While

Do Select

PeopleCode

Effective Date

Call Section

Effective Status

SQL

Platform generic
or specific

Log Message

Do Until

XSLT

Executed only when


"Called" except MAIN

Executed from top to


bottom within the
Section

Must be Unique within


step
Executed in specific
order

Program Flow for PSU_INACT_1


When the program executes it will execute the first step in the section MAIN. Step01
uses a default commit and will abort if there is an error.

By double clicking on the gray area of the SQL action, the SQL editor will be displayed
containing the SQL statement to be executed.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-5

APPLICATION ENGINE

JUNE 2002

If there are no errors the program proceeds to Step02. Step02 is used to log a message.

The message to be displayed is message 30000,1.

Throughout your Application Engine programs, you may want to display messages. The
message catalog is where you will store your messages. For the Application Engine
course, you will store your messages in Message Set 30000.
Navigation

PeopleTools

Utilities

Administration

Message Catalog

2-6

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Building an Application Engine Application


In this walkthru, we will go through the mechanics of creating a new program shell. This
will not be a working program, as we are not going to add any SQL statements.
Walk Thru

Before we start building Application Engine programs and related definitions, we want to
make sure that our new definitions are automatically added to the PSU_AECLASS
project.

Navigation

Tools

Options

Change the Insert Definition into Project group box to use When definition is
modified and saved.

Click OK to save the setting.

You create an Application Engine program using File, New, App Engine Program.

Initially you get the MAIN section and Step01 (with no Actions yet).

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-7

APPLICATION ENGINE

JUNE 2002

Inserting Sections and Steps


An Application Engine toolbar will be associated with your new program to allow you to
insert Sections, Steps, and Actions. You also have icons to refresh, expand and collapse
the program's tree for better visibility.
I n s er t S t ep an d A c t io n
I n s er t A c t i on

R u n Pr o gr a m

Inser t Section

R e fre s h V ie w
Expand all Nodes

Collapse all Nodes

You can also add sections, steps and actions using the Insert menu option or by using the
right mouse to invoke the popup menu.

Notice that the Insert is dependent on where the cursor is placed. If you have your cursor
on a section, the Insert Action will be grayed.

2-8

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Practice adding Sections, Steps and Actions


Add sections, steps, and actions to make your program look like the program below.
Activity

Save your program as TEST1.

As you added sections, and steps, you probably noticed that the names were
automatically generated using the current name and appending the next consecutive
number (i.e. Section1, Section2). When you create your own programs, you will want to
use names for your sections and steps that provide a more descriptive name.
Y o u m u s t s av e y o ur pr o gr a m be f or e y ou c a n c h an g e t h e n am e o f a s e c t io n . T h e on l y
s e c t i o n y o u ca n n ot r e na me i s MAIN .

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-9

APPLICATION ENGINE

JUNE 2002

Sections
For each section, you can set parameters for the section.

Control

Description

Section Name

Be as descriptive as you can, keeping in mind that you only have an 8character limit. Develop a naming convention and be consistent throughout
your projects.

Description

Enter a descriptive name for the section.

Market

Select the Market for which the Section is intended. If a particular Market is
irrelevant to your batch program, you can leave the Market value as GBL.

Platform

In some cases, you may be developing an application to run on a particular


platform or RDBMS. This enables you to take advantage of any RDBMSspecific optimizations or to change your section logic because of RDBMS
limitations.

Effective Date

The default effective date will be 01/01/1900. To make a particular section


effective-dated, enter the effective date.

Effective Status

You can indicate whether or not this section is active.

Section Type

In the case of an abnormal termination of the program, the value of this


system field specifies whether or not you will need to Restart the Section.

Auto Commit

Here you specify the Commit level for the Section. You can opt to have no
Commit or you can have Application Engine Commit after each Step
successfully completes.

Access

This property controls the Call Section Action. You can specify that a Section
can or cant be called from another program.

Comments

Use the comments section to document the section.

To view comments, you can select View, Show all Comments (F2) from the menu or right
mouse on the section and select Show Comment.

2-10

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Adding Sections for Markets

Walk Thru

One of the advantages of Application Engine is that you can code a program to execute
differently based on the market code. In this walkthru we will look at how you can insert
sections that are market code specific (the same logic is used for effective-dated or
platform-specific sections).

You should still have your Test1 program open.

Highlight the section Section1.

Copy the section (CTRL C or Edit, Copy). Paste the section (CNTL V or Edit,
Paste).

A new section will be added just below Section1.

Change the market to GBR.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-11

APPLICATION ENGINE

JUNE 2002

Change the Section name to Section1 and save.

You now have two Section1s. When you execute the program, you will select the Market
on the run control. Based on the market selected, the program will execute the
appropriate Section1.

2-12

Add another Section1 for the market FRA.

Save the program.

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Hiding Details
When you view your program, you have a choice of what is displayed.

Select View, Collapse All.

Select View, Hide All Details.

Section Filter
Typically, youll want the Section Filter settings to only allow unique Sections to appear
in the view at a given time.

Select View, Section Filtering, Custom.

Change the market to FRA and click OK.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-13

APPLICATION ENGINE

JUNE 2002

Collapse the view again.

When the Section Filter is set, you will only see the sections that will execute when the
Market is set to FRA.

Turn Filtering off. View, Section Filtering, No Filtering.

Execution Precedence
A Section is unique based on the program, section names, RDBMS platform, effective
date and market. When you execute an Application Engine program, it executes Sections
based on the following order of precedence:

If a Section for the current Market exists, execute it.

If a Section for the current Platform or RDBMS exists, execute it.

If a Section for the current Effective Date exists, execute it.

If a unique Section does not exist, Application Engine just executes the default
Section.
For example, suppose you have two versions of a particular Section: SECT01 for Public
Sector and SECT01 for Global use. If you request to run the Public Sector version of the
program, Application Engine executes the Public Sector version of SECT01. If the
program is running on Oracle, Application Engine then looks for an Oracle version of the
SECT01 for Public Sector.
The default Market value is GBL for Global, which is similar to the Platform value of
default.

2-14

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Steps
Each section contains one or more steps. The steps are executed in the order that they are
displayed in the application designer. The steps contain the logical groupings of actions
to be performed.

Control

Description

Step Name

Consecutively numbered based on last step name.

Step Description

Enter a descriptive name for the step.

Commit After

Determines when commit will be executed:


Default - uses value supplied for the section

Later - do not commit now

After step - commit when step completes

Frequency

Only available in loops

On Error

Determines the action to take when an error occurs:

Abort - program will write message to message log and terminate

Ignore - program will write message to message log and continue

Suppress - no message will be written, but program will continue

Active

Determines if the step is active (ticked) or inactive (blank).

Comment

Add any additional comments to document your program.

Actions
Actions are the reason for your program. They contain the code you wish to execute.
The primary type is a SQL statement. But you also have the ability to log messages,
execute PeopleCode, call other Sections and perform transformations. The following
action types are available:
Do When
Do While
Do Select

PeopleCode

SQL

Call Section

Log Message

Do Until

XSLT

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-15

APPLICATION ENGINE

JUNE 2002

Action Execution Order


In a given Step you can have multiple actions but only one instance of each action.
Moreover, the actions execute in a given sequence.
With you cursor on Section1, Step01 - click the Add action 8 more times.

On the eighth insert, you will receive the following message.

Click OK.

2-16

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

You will also notice that there are 8 actions out of the available 9.
Which action is missing? ____________________
When you refresh, the actions will be reordered into the order of execution.
To refresh, either select the Refresh Icon

or View, Refresh or F5.

S Q L a nd C a l l S e c t i on are m u t ua l l y e x c lu s i v e .

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-17

APPLICATION ENGINE

JUNE 2002

Program Properties
When you create a new program, you will want give your program a name. If you
modify existing programs, you will want to document your changes. Descriptions and
documentation are updated via the general tab in program properties.

2-18

Open the Application Engine program PSU_INACT_1.

Open the Program Properties. File, Definition Properties or

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Program Properties Advanced Tab

Item

Description

Disable Restart

Select this to disable the Application Engine built-in restart capabilities


for this program.

Application Library

In some cases, you may want a program to contain only a collection, or


library, of common routines (in the form of "callable" sections) that you
do not want to run as a standalone program. When sections are defined
as "Public," other programs can call the sections, or routines, that exist
in the library at runtime. Because this type of program is not designed
to run as a standalone program, it does not require the MAIN Section, or
initial entry point. Setting this option renames or removes any existing
MAIN section.

Batch Only

Select this check box for batch only programs. Batch only programs are
not executed from the CallAppEngine() PeopleCode function. Any
dedicated temporary table used for Batch Only programs do not have
online instances created.

Message Set

Specify the message set value that you want assigned as the default
message set number for this Application Engine program. The system
uses this Message Set value for all Log Message actions where the
message set isnt specified.

Program Type

Select the appropriate program type from the list: Standard, Upgrade
Only, Import Only, Daemon Only or Transform Only. During the course
of this class we will only be dealing with Standard or Daemon Programs.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-19

APPLICATION ENGINE

JUNE 2002

Price Increase

Activity

You are notified that all stock items will have a price increase of 10 percent. Write an
Application Engine program that will accomplish this task.
In Query Analyzer examine the current values in PS_PSU_STOCK_TBL.

The stock table is PS_PSU_STOCK_TBL. What is the SQL statement to accomplish this
task?
______________________________________________________________________
______________________________________________________________________

2-20

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Your completed program will look like the screen shot below.

1. Create the Application Engine Program PSU_STK_INC.


2. Remember to document your program (Program Properties).

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-21

APPLICATION ENGINE

JUNE 2002

Testing Application Engine Programs


There are several methods that developers use to test Application Engine programs:

Execute directly from Application Designer in 2-tier.

Developers Shortcut (Generic Application Engine Test Type) through the Process
Scheduler.

Command Line

We will look at the first two methods in this chapter; the command line is covered in
depth in Chapter 10 Application Engine Execution.
Execute directly from Application Designer
In the application designer, you can select Edit, Run Program or the Run Program push
Walk Thru

Run minimized

Output Log to File

OK

2-22

. This method is fast and simple, but does not allow you to add any run
button
control parameters at execution time. For the program that you just created, there are no
run control parameters.

Run Control ID

Enter the run control ID of the program that you are testing.
If your program requires run control parameters, you will
need to populate the fields on the run control and specify the
run control when executing from Application Designer.

Run Minimized

Select this to have the window of the requested process


minimized when it is submitted to run.

Output Log to File

Select this if you want the output log to be written to a file.

Log File Name

Specify the log file name (enabled only when Output

Process Instance

Process Instance number will default to 0.

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Open the log message in C:\temp.

The program ran successfully.

In Query Analyzer check that the prices were updated.

If you had an error in the program, the log will indicate the problem.

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-23

APPLICATION ENGINE

JUNE 2002

Application Engine - Developer's Shortcut

Walk Thru

Your system will come delivered with a page called Request AE. This page is designed
for developers to test Application Engine programs. The Request AE page allows you to
enter parameters associated with the Application Engine program. In your production
system, you should not be using this page to execute your AE programs. In Chapter 11
Application Engine Process Definition, you will learn how to create process definitions
and run control pages.
An Application Engine Generic Test Process Type has been created that allows you to
run a program from the Request AE page as long as the run control ID is the same as the
Application Engine program name. We will refer to this as the developer's shortcut.
The process FASTTEST uses the Application Engine Generic Test Process Type.
In Chapter 11 Application Engine Process Definition, you will learn how to set up an
application generic test type, as well as process definitions

Navigation

PeopleTools

Application Engine

Request AE

2-24

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Use the Add a New Value tab to create a run control for your new program.

Navigation

PeopleTools

Application Engine

Request AE

Add a New Value


tab

Run Control ID:


PSU_STK_INC

Program Name:
PSU_STK_INC

Add

The Run Control ID must be the same as the Program Name.

Change the Process Frequency to Always.

Click on the

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

push button.

APPLICATION ENGINE DESIGNER

2-25

APPLICATION ENGINE

JUNE 2002

Select AE Fast Test.

Click OK to run the program.

Navigate to the Process Monitor to check the status of your program.

Navigation

New Window

PeopleTools

Process Scheduler

Process Monitor

Your program was again successful.


D ur i ng th i s co u r se y ou w i ll b e v ie w in g th e Pr o ce s s M o n i tor fr eq ue n t l y , y o u ma y w a n t
t o ta k e t h i s op p or t un i t y t o a d d t he Pr oce s s M on i t or t o yo ur F a vor i t e s .

2-26

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

JUNE 2002

APPLICATION ENGINE

Chapter Review
1. What are the layers into which an Application Engine program is structured?

2. What is the function of a Step in an application program?

3. How many actions are available? List 5.

4. What is the maximum number of actions that can be processed in a step?

5. Where does the SQL come from that the Application Engine executes?

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

APPLICATION ENGINE DESIGNER

2-27

APPLICATION ENGINE

JUNE 2002

Chapter Key Points

2-28

Applications are structured in a hierarchy of Sections, Steps, and Actions.

You must determine the data sources and structures for your Application Engine
program.

You must generate the SQL required for your program. You can use the PeopleSoft
Query tool or your relational database SQL tool.

You will use the Application Designer Application Engine designer to build
individual Application Engine programs.

FASTTEST can be used from the Application Engine Request page to test your
Application Engine programs.

APPLICATION ENGINE DESIGNER

PEOPLESOFT PROPRIETARY AND CONFIDENTIAL

Potrebbero piacerti anche