PeopleTools 8.5x Training Guide

Embed Size (px)

DESCRIPTION

PeopleSoft's People Tools training. It's helpful for the beginners.

Citation preview

PeopleSoft v9.1 Accounts Receivable

PeopleSoft v9.1

People Tool 8.52

Training Guide

May 2015

Copyright 2009,CedarCrestone,Inc. All rights reserved, including the right to reproduce this manual or any part of it.

Restricted RightsThe information contained in this document is proprietary and confidential to CedarCrestone, Inc.

This document may be reproduced only for the use of training for users of the PeopleSoft system. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose other than internal training without the express written permission of CedarCrestone, Inc.

CedarCrestone, Inc. has made every effort to ensure that the information in this guide is complete, concise, and current. CedarCrestone, Inc. assumes no responsibility for the consequences of any errors beyond its control. The examples, sample screens, and reports used throughout this guide are for illustrative purposes only and may not conform to your system requirements. CedarCrestone, Inc. makes no implied warranties or merchantability or fitness for a particular purpose, and such implied warranties are hereby specifically disclaimed.

PeopleSoft, PeopleTools, PeopleCode, and PS/n Vision are registered trademarks of PeopleSoft, Inc.Windows is a registered trademark of Microsoft Corp.

All other product and company names are trademarks of their respective owners.

General InformationTo obtain documentation and/or additional copies of this manual, write to:CedarCrestone, Inc.1255 Alderman DriveAlpharetta, GA30005Attention: Dana NicholPhone: 877.364.081

Double Click Here to Change TextTable of Contents

Before you beginivIntended AudienceivHow This Guide Is OrganizedivChapter StructurevCourse ContentsviCourse ObjectivesviChapter 1: PeopleTools 11Chapter 2: PeopleTools 212Chapter 3: People Code27Chapter 4: Application Engine51Chapter 5: Peoplesoft query65Chapter 6: SQR89Chapter 7: XML Publisher110Chapter 8: Integration Tools122

Before you beginUse this guide during class to follow the topics as presented. The instructor may also provide additional materials to support the training outlined in this guide. After class, use this guide as a reference document for completing tasks within the PeopleSoft system.Intended AudienceThis guide is intended for personnel who are technically sound and responsible for maintaining and managing the PeopleSoft application. We assume that you are familiar with: Basic database knowledge. Should be familiar with select clause and other DDL and DML commands used in SQL. Should be familiar with key structure that are commonly used in SQL like Primary, Secondary, Composite, Foreign key etc. Should be familiar with Normalization.If you are new to the Internet, you should complete a tutorial or class prior to working in the PeopleSoft environment.How This Guide Is OrganizedThis guide is organized into chapters that contain the topics your instructor will cover in class. Some chapters may have corresponding practices that follow the instructors presentation and individual exercises for you to complete on your own. There are review questions at the end of the course to recap the major points. Symbols and ConventionsThe following conventions are used in this guide to help you distinguish between various types of information:Symbols and Conventions

SymbolHow It Is Used

bold textCommand and toolbar buttons that you click.Menus, text and radio buttons that you select.Check boxes you turn on or off.

bold italic textText you type.

Function keys on your keyboard that you press.

Italics textIdentifies a Page name.Identifies a Field name.

HyperlinkIndicates a link to another page.

Procedural information.

Warnings and cautions that require careful attention. Appears in the main body of the document.

PeopleSoft information definitions, helpful hints. Appears in the page margin.

Note Noteworthy comments or important additional informationgenerally about the item immediately precedes the note. Appears in the main body of the document.

Noteworthy comments or important additional informationgenerally used to call out specific client-related information about a series of steps or the topic being discussed. Appears in the page margin.

Chapter StructureMost chapters are structured the same way and generally consist of the following:Objectives are found at the beginning of the chapter and list the topics that will be covered in the chapter.Topics explain the various concepts. Some lessons contain practices and exercises.Procedures are step-by-step instructions for completing a procedure that the instructor and class participants walk-through together.Exercises are scenarios for individual work during class time. These will be provided by the instructor.

Course ContentsThe PeopleTools v8.52Training Guide includes eight chapters and one appendix:Chapter 1, PeopleTools 1,gives the overview about the PeopleTools.Chapter 2, PeopleTools 2,is the continuity of chapter 1.Chapter 3, PeopleCode Programming,explain about PeopleCode, events and how a write some basic PeopleCode.Chapter 4, Application Engine,defines what Application Engine is. How to invoke it and how it worksChapter 5, PS Query,gives an overview of the PeopleSoft reporting query.Chapter 6, SQR - Reporting,introduces the most efficient reporting tool of PeopleSoft. It also explains about various aspects of SQR .Chapter 7, XML Publisher,introduces the XML publisher. The setup required to invoke an XML publisher with step by step approach of creating an basic XML Publisher reportChapter 8, Integration Tools,gives over about various integrating tools used in PeopleSoft.

Course ObjectivesAfter completing this course, you will be able to effectively use the PeopleTools to do the following:Create or customize a module or application.Maintain the day today activities or bug fixing.Upgrade the Application.

Notes

PeopleSoft v9.1 Accounts ReceivableTraining GuideMay 15

Proprietary and Confidential to CedarCrestone, Inc.Page viiChapter 1: PeopleTools 1The purpose of this class is to provide you with the skills you need to effectively use the PeopleTools.In this chapter we will cover the following topics:Lesson 1: PIA.Lesson 2: Introduction to PeopleTools.Lesson 3: Field Definitions.Lesson 4:Record DefinitionsLesson 5:Page DefinitionsLesson 6:Component DefinitionsLesson 7:Menu DefinitionsLesson 8:Security OverviewLesson 9:Portal Structure and ContentLesson 10:Working with Projects

Lesson 1: PIAChapter StructureMost chapters are structured the same way and generally consist of the following: Objectives. The objectives are found at the beginning of the chapter and define what you will learn in the chapter. Lessons. Each chapter has several lessons that explain the various concepts. Some lessons contain practices and exercises. Practices are step-by-step instructions for completing a procedure that the instructor and class participants walk-through together. Review Questions. You will find review questions at the end of the document that recap material covered in the chapter. The answers to the questions will be discussed among class participants and the instructor.

PIA-PeopleSoft Internet Architecture

PeopleSoft started off with the traditional 2 tier architecture and proceeded to the 3 tier in the later versions. It was in the Version 8.0 that it adopted what is called the PeopleSoft Internet Architecture or PIA that is its current day architecture. The PIA is a server-centric component architecture that enables secure end user access to PS applications. Its components include the following: Internet Access Device Web Server Application Server Database Server

The key features of the PIA include: Minimizes Training Effort Reduced Application Deployment Costs Lowered Client Hardware Requirements Extensive Portability Single Sign On

You are encouraged to ask your instructor questions throughout the entire course.

Lesson 2:Introduction To PeopleTools

PS Application Designer Snapshot

This diagram shows the snapshot of Application designer. This is the place where all the technical activities on entire PeopleSoft object are done.

Attributes of Application Designer

A. Project Workspace View projects and their associated definitions in the Project Workspace. A project organizes and presents the definitions of a business application in logical groups for easier development, adaptation, maintenance, and upgrade.B. Object WorkspaceTo create and modify definitions, which can be maximized, minimized, cascaded or tiled in the workspace.C. Output Window The Output Window displays status messages of various PeopleSoft Application Designer operations. The output is organized into different categories using tabs at the bottom of the window. The text displayed in the output window is context-sensitive, enabling you to select it to perform related operations. For example, if you have a Field Definition open, select Edit, Find Definition References to list the definitions that reference the active field definition. The list appears in the Output Window. .Objects in PeopleTools

Field

Record

Page/Panel

Component

Menu

FieldsFields are the basic building blocks in the PS system; in database terms represent columns in a table or view.

Number Field Type

Types of field

Types of Field

Field TypesDescription

Character (Char)Alphanumeric field of fixed length.

Long Character (Long)Alphanumeric field of variable length used for textual entries, such as comments or descriptions.

Number (Nbr)Positive numeric field of fixed length for which decimals are allowed.

Signed Number (Sign)Positive or negative numeric field of fixed length for which decimals are allowed.

Date (Date)Date field of constant length. The system edits dates and prohibits incorrect ones, such as day 42 or month 20. Date fields always store a four-digit year.

Time (Time)Time field of a constant length. Built-in edits prohibit impossible times, such as hour 26, minute 70, or second 94.

DateTime (DtTm)Date and time field of constant length. Built-in edits prohibit impossible dates and times, as defined in the individual Date and Time fields. DateTime fields always store a four-digit year.

Image (Img)Image field to store images in a user-defined format, such as JPEG or GIF.

ImageReference (Iref)Field in which to change an image dynamically at runtime using PeopleCode.

Attachment (Att)Field that maps to a BLOB database type to hold the contents of a file attachment. However, you should use the existing field, FILE_DATA, if you need a BLOB column. For attachments, use the subrecord ATTACH_DETAIL, which contains FILE_DATA.

RecordFields that are grouped together as a unit are record definitions. A record definition represents what the underlying Structured Query Language (SQL) database tables look like and how they process data.Two tabs exist in record definitions.

Record Field Tab

Record Type TabRecord Types

Types of Field

Field TypesDescription

SQL TableThis is a physical SQL table in the database. Create this table when you run the Build Operation from the Build menu. This value is the default setting.

SQL ViewNormal SQl Views

Dynamic ViewSelect to define a record definition that can be used like a view in pages and PeopleCode, but is not actually stored as a SQL view in the database. Instead, the system uses the view text as a base for the SQL Select that is performed at runtime. Dynamic views can provide superior performance in some situations, such as search records and in PeopleCode Selects, because they are optimized more efficiently than normal SQL views.

Derived/WorkSelect to define the record definition as a temporary workspace to use during online page processing. A derived or work record is not stored in the database, so you do not build it.

SubRecordSelect to define the record definition as a subrecord: a group of fields that is commonly used in multiple record definitions and that you can add to other record definitions. This way, you can change a group of fields in one place, as opposed to changing each record definition in which the group of fields is used.

Query ViewSelect to define the record definition as a view that is constructed using the PeopleSoft Query tool.

Temporary TableSelect to define the record definition as a temporary table. You can specify temporary images of the table on the PeopleTools Options page. Use temporary tables for running PeopleSoft Application Engine batch processes. Temporary tables can store specific data to update without risking the main application table.

PagePages are the graphical interface between your users and your application database.

Page TypesThere are 4 categories of pages available in PeopleSoft. They are Standard Page Subpage Secondary Page Popup Page

Standard Page - This is the default page type used in PeopleSoft.

Sub Page -Instead of duplicating the same set of page fields on two or multiple pages, you can create a single subpage that contains those page fields and then add it to any page. Subpages provide an easy way to maintain the functionality that the page fields represent.

Secondary Page-Secondary pages are accessed through another page, usually by clicking a link or push button. This is normally used for entering and updating data that is supplemental to the data on the primary page or data that is common to and can be accessed from multiple pages.

Popup Page -Pop-up pages are a type of PeopleSoft page that displays information that supplements, expands, or enhances the transaction page data. Pop-up pages are ideal for displaying additional, more detailed information that is pertinent to a subset of users

ComponentA component represents a complete business transaction. It comprises either a single page or set of pages that are meant to be processed as one.

MenuA menu is a logical grouping for assigning security to your system. You create a menu as a placeholder for components.

Security BasicsLike other ERP security is an essential part for core business essentials like PeopleSoft. We really dont want people from every department have access to you data and applications. Now here comes the security with prevents the data access for the normal users and grant access only to some special super user access your applications.The three main PeopleSoft Security definition types are: User profiles. Roles. Permission lists.

User ProfilesEach PeopleSoft user has an individual user profile, which in turn is linked to one or more roles. One or multiple permission lists, which decides what a user can and cannot access, to each role. A few permission types are assigned directly to the user profile.A user profile must have at least one role in order to be a valid profile. The majority of values that make up a user profile are inherited from the linked roles.RolesRoles are intermediate objects that link user profiles to permission lists. You can assign multiple roles to a user profile, and you can assign multiple permission lists to a role.Permission ListsPermission lists are groups of authorizations that you assign to roles. Permission lists store sign in times, page access, PeopleTools access, and so on.A permission list may contain one or more types of permissions. The fewer types of permissions in a permission list, the more modular and scalable your implementation.A user profile inherits most of its permissions through roles, but you apply some permission lists, such as process profile or row-level security (data permissions), directly to a user profile.Portal Structure and ContentsNA

Working WITH PROJECTSPeopleSoft projects can have all or any of the above defined objects. We put everything that is required for an application into a single object that is known as Project. Projects help to maintain and manage all the objects pertaining to a single application.Chapter 2: PeopleTools 2In this chapter we will cover the following topics:Lesson 1: Views.Lesson 2: Search Record.Lesson 3: Prompt Table Edits.Lesson 4:Sub records and SubpagesLesson 5:Interactive & Deferred processing modesLesson 6:Advanced Page DesignLesson 7:ImagesLesson 8:Introduction to PeopleCodeLesson 9:ImagesLesson 10:Customization and Ramification

Lesson 1: ViewsThere are 2 types of views that is used by PeopleSoft SQL View Dynamic View

SQL View - It is the normal database view.To create the SQL view, click the Click to open SQL Editor Button, enter a SQL Select statement, and then run the Build processDynamic View - Select to define a record definition that can be used like a view in pages and PeopleCode, but is not actually stored as a SQL view in the database. Instead, the system uses the view text as a base for the SQL Select that is performed at runtime. Dynamic views can provide superior performance in some situations, such as search records and in PeopleCode Selects, because they are optimized more efficiently than normal SQL views.

Lesson 2: Using Search RecordsSearch Record is a record attached to aPeopleSoft Component. The Component Processor performs a search against the search record to retrieve relevant data from the database and populate it into the Component buffer during the Component build.Every Component in PeopleSoft should have a search record associated with it. On the search page for the component, a user can input values against each search key to retrieve the data. She may also chose the alternate search keys from a drop down on the search page.Search records are used for the following purposes: The search record builds the search page for the component. The search record builds the search query, which fetches the component data and populates level 0 for every page in the component.When you click a content reference to access a component, the system examines the search record and dynamically builds the search page based on the search key, alternate search key, and list box item properties of the search record. If you designate fields as search keys or alternate search keys, then those fields appear on the search page. When the user enters values in the search fields and clicks theSearchbutton, the system incorporates those values into the WHERE clause of the search query. If the values provided by the user uniquely identify one row of data, then the system proceeds directly to the main page with the available information. Otherwise, the query retrieves the rows that match the criteria and displays the rows in a list box at the bottom of the search page. If you define fields as list box items on the search record, the system displays those fields as columns grid in the result set.

Image: Search page with search keys, alternate search keys, and list box itemsThis example illustrates the fields and controls on the Search page with search keys, alternate search keys, and list box items. You can find definitions for the fields and controls later on this page.

Search Page

Lesson 3: Prompt Table Edit

In PeopleSoft , we have different ways to edit (Dictionary meaning ,To modify or adapt so as to make data we enter suitable or acceptable).

Edits helps user to select valid data from a list of values. Below are the types of Edit available in PeopleSoft

1. Prompt Table With NoEdit2. Prompt Table With Edit3. Yes/No Table Edit4. Translate Table Edit

1. Prompt Table WithNoEdit-Displays list of values for the user to select. If user enters some other value which is not present in the listthen the new value is accepted by the system.

2. Prompt Table With Edit-Displays the list of values for the user to select. User had to select only those values. If some other value isentered the system throws an error saying, "Invalid Value".

3. Yes/No Table Edit - This Edit can be used for checkbox. By Default it will be checked (Y). For Example, In any of theapplication pages, if there is an Address details which needs to be provided we can use this option. Address same as Permenant Address?

4. Translate Table Edit-This will list the users to select data from dropdown. The length of the field should not exceed 4 char. The translate values for this type of field are stored in Peopletools table PSXLATITEM. Example: This is used to display Marital Status of an employee etc.

Lesson 4: Sub recordA subrecord definition is created much the same way as any record definition. You define the group of fields that have a common functionality and save them as a Subrecord type to be used in other record definitions. This allows the group of fields to easily be changed in one place, instead of needing to change all record definitions this group of fields resides.Practice Creating a SubRecord DefinitionAccess the application designer.To create a new subrecord definition:1. Click File2. Click New3. Click Record

4. Click The object workspace appears so that you can build a list of fields in a record definition.

Select tab and choose Record Type SubRecord

5. Insert Fields into the Record Definition

Insert field definition by Insert/FieldOr drag and drop field in projectOr drag and drop field from record definition in project

6. Click File7. Record definition names should be preceded with ASU_ to make them easily identified during an upgrade processSubrecords are given a _SBR suffix to further identify them as a subrecord.Click SaveType Record Definition Name

8. Click

There is no need to do the build process on a subrecord definition since it will have no underlying database table but only participate in other record definitions.Using a SubrecordOnce the Subrecord has been established, it can be utilized in other record definitions. It is fully supported to have any number of nested subrecords. Practice Inserting a SubRecord DefinitionAccess the application designer.To insert a subrecord definition:1. Click File2. Click New3. Click Record

4. Click The object workspace appears so that you can build a list of fields in a record definition.

5. Click Insert6. Click SubrecordChoose a subrecord from the list.

7. Click

The subrecord is inserted into the record definition.8. Click File9. Record definition names should be preceded with ASU_ to make them easily identified during an upgrade processClick SaveType Record Definition Name

10. Click

Viewing a SubrecordOnce the subrecord has been inserted into another record definition, it will not be fully displayed when the record definition is brought into the workspace window. You will need to click on the Expand button to see all the fields of the subrecord.

Click To expand the view of the subrecord.The Field Type of SREC signals a subrecord that has not been expanded.

Lesson 5: Sub PageCreating SubpagesA subpage definition is created much the same way as any record definition. You define a page definition that has a common functionality in the page controls and save it as a Subpage type to be used in other page definitions. During design time, you add only the subpage control to represent all of the controls in the subpage. You maintain those controls in only one placethe subpage definition. At runtime, you see all of the controls that are defined in the subpage on the page.Practice Creating a SubPage DefinitionAccess the application designer.To create a new subrecord definition:1. Click File2. Click New3. Click Page

4. Click The object workspace appears with a new page layout to build a subpage definition.

5. Click File, Definition Properties, Use Tab

Change the Page Type to Subpage.Since it is a subpage, you may need to change the Page Size to be a Custom Size. This will allow it to fit on other pages.

Once youve added the page controls.

6. Click File, Save

Page definition names should be preceded with ASU_ to make them easily identified during an upgrade processGenerally, subpages are given a _SBP suffix to further identify them as a subpage.

7. Click Using a SubpageOnce the Subpage has been established, it can be utilized in other page definitions. Practice Inserting a SubPage DefinitionAccess the application designer.To insert a subpage definition:1. Click File2. Click New3. Click Page

4. Click Insert5. Click Subpage

Subpage Record Name SubstitutionThe subpage is built with a primary record but when it is added to a page, another record can be used, depending on the context of the page that the subpage is involved.Normally, a subpage is defined with a sub record combination so that it all can be re-used depending on the functionality of the pages it will be involved.6. Chose the subpage to insert from the dropdown.7. Choose a record definition to substitute for the primary record of the subpage.8. Click 9. Continue to build page controls10. Click File, Save

11. Type in Page Name12. Click

Lesson 6: Processing ModePeopleSoft application can run in 2 different modes

Interactive Mode In interactive mode, when the user exits a field that has a field-level event1. A transmission to the application server occurs immediately so that it runs the field-level event.2. The system refreshes the data & information.

Deferred Mode

In deferred mode, the application enables you to temporarily delay many of the conditions that need server processing an event or condition is encountered thatrequiresimmediate processing or until you request processing manually. For example, when a user exits a field that has a field-level event (like FieldChange or FieldEdit PeopleCode, prompt validation, related display, and so on), that event is not processed until the next transmission to the application server. When the next transmission to the server occurs, PeopleTools determines which fields have changed since the last transmission. Then, logic on the application server runs the appropriate system edits and PeopleCode events (in field layout order).

Chapter 3: People CodeIn this chapter we will cover the following topics:Lesson 1: PeopleCode language.Lesson 2: PeopleCode Location.Lesson 3: PeopleCode Data Types.Lesson 4:EventsLesson 5:Built in FunctionLesson 6:Custom FunctionsLesson 7:Component BufferLesson 8:Debugging and TracingLesson 9:OO PeopleCodeLesson 10:App PackageLesson 11:Traversing through Component BufferLesson 12:Push Button and HyperlinkLesson 13:Data Buffer MethodsLesson 14:Executing SQL in PeopleCodeLesson 15:Add ModeLesson 16:Final ActivityLesson 1: PeopleCode Language & Syntax

PeopleCodeis an (OOL)object-orientedproprietary (case-insensitive) language used to expressbusiness logicforPeopleSoftapplications. In its fundamentals, PeopleCode syntax resembles other programming languages. Some aspects of the PeopleCode language, however, are specifically related to thePeopleToolsenvironment. However, the fundamentals of objects and classes are the same as in Java language

PeopleCode Example

Lesson 2: PeopleCode LocationsPeopleCode can be written in lot of places. Usually it is written across Various events in field level, record level, component level Page, Menu Application Engine App Package Application Message

Lesson 3: PeopleCode Data TypesPeopleCode includes these conventional data types: Any Boolean Date DateTime Float Integer Number Object String Time

Any - When variables and function return values are declared as Any, the data type is indeterminate, enabling PeopleTools to determine the appropriate type of value based on context. Undeclared local variables are Any by default.

Lesson 4: PeopleCode Events

Every PeopleCode program is associated with Application Designer definition and Event.Events are predefined points either in the Component Processor flow or Program flow (for application messages.)As each point is encountered, the event fires on each definition, triggering any PeopleCode program associated with that definition and that event.Each class of definitions in Application Designer can have an event seta group of events appropriate to that definition. A definition can have zero or one PeopleCode programs for each event in its event set.You can have PeopleCode attached to various levels within the program flow.

PeopleCode Events at various level

Page EventsActivateComponent EventsPostBuild eventPreBuild eventSavePostChange eventSavePreChange eventWorkflow eventMenu EventsItem SelectedComponent Record Field Events:FieldChange eventFieldDefault eventFieldEdit eventPrePopup eventComponent Record EventsRowDelete eventRowInit eventRowInsert eventRowSelect eventSaveEdit eventSavePostChange eventSavePreChange eventSearchInit eventSearchSave eventRecord Field Events:FieldChange eventFieldDefault eventFieldEdit eventFieldFormula eventPrePopup eventRowDelete eventRowInit eventRowInsert eventRowSelect eventSaveEdit eventSavePostChange eventSavePreChange eventSearchInit eventSearchSave eventWorkflow event

Lesson 5: DERIVED/ Work RecordsA derived or work record is not stored in the database, so you do not build it.Translate values are associated with the Field Definition, not the record definition.Derived fields are often used for online processing to display calculated data that you would not want to store in a normalized database, but they can also be used to give the user options for the behavior of the system. For example, push buttons are often (usually?) fields on derived records which execute peoplecode. You can think of a field on a derived record as a component-level variable that can be accessed by any peoplecode event within the scope of the component, but because it is on a record definition, it can also have peoplecode attached to it that will execute at appropriate times during component processing (depending on what events the code is written in).

Lesson 6: PEOPLECODE built in functionsLike any other Object Oriented Language PeopleSoft also have functions.PeopleCode supports the following types of functions: Built-in: The standard set of PeopleCode functions. They dont needs to be declared and can be called or used to just calling by their names. Internal: Functions that are defined (using the Function statement) within the PeopleCode program in which they are called. External PeopleCode: PeopleCode functions defined outside the calling program. These are generally contained in record definitions that serve as function libraries. External non-PeopleCode: Functions stored in external (C-callable) libraries.PeopleCode Built in functionsThere is a whole lot of essential built in functions that can be used while writing Peoplecode.There are functions to handle very common requirement across area like Date Time,Email,Files,Images,Integration Broker,Math,Logical etc.

Lesson 7: WRITING on your own FunctionsSteps to write your functions

Step 1: Declare the Function

Declare the function on the top of the programme.We as an convention generally write the peoplecode for the function in the records whose name begin in FUNCLIB_ and the code are always attached to FieldFormula events.

The following is an example of a function declaration of a function that is in another FUNCLIB record definition:Declare Function Sum PeopleCode FUNCLIB_MATH.OPERATIONFieldFormula;Step 2:Define the FunctionPeopleCode functions can be defined in any PeopleCode program. Function definitions must be placed at the top of the program after function declaration, along with any variable and external function declarations. The syntax for a PeopleCode function definition is as follows:FunctionSum(&x as number,&y as number)Returnsnumber&z=&x+&y; Returns &z;End-functionStep 3:Function CallsFunctions are called with this syntax:function_name([param_list])Example:&result=Sum(10,12);Winmessage(Summation result= |&result);

Function Naming Conflicts:If you declare any function with name similar to that of any built in function you will get a error saying User-defined function IsNumber is overriding the built-in function of the same name. (2,98)

Lesson 8: COMPONENT BufferComponent Buffer is the area in the memory that stores data associated with the presently active component. When a page in any component is opened, the system retrieves all of the data records for the entire component and stores them in one set of record buffers, organized by scroll level and then by page level. It consists of rows of buffer fields that hold data for the records associated with page controls, including primary scroll records, related display records, derived/work records, and Translate table records. PeopleCode can reference buffer fields associated with page controls and other buffer fields from the primary scroll record and related display records.PeopleSoft provides easy access to data in the component buffer from within PeopleCode for the developers to perform business logic.Data buffer is a storage space in memory. It can refer to component buffers, buffers loaded by an Application Engine program or a Component Interface.Lesson 9: DEBUGGING& TracingThe two most commonly used method for Peoplecode tracing are: Setting the trace at Login Screen:

1.Select Trace at the login screen or add &trace=Y to thelogin URL Or To set trace flags, click here (use this link)2.Choose the options in the tracing screen and login.3.Perform the actions you wish to record.4.Once complete logout and retrieve the file from the/appserv//LOGS directory.Thetrace file name will include your login name.

Setting the trace from PeopleTools:

1. Login to PeopleSoft and navigate to PeopleTools > Debug.2. Choose the options and save.3. Perform the actions you wish to record.4. Once complete logout and retrieve the file from the/appserv//LOGS directory. The tracefile name will include your login name.

Lesson 10: APPLICATION Package and OOP ConceptsApplication package is a container for application sub packages and application classes, which will provide a hierarchical structure to your People Code programs and help you extend the common functionality of existing People Code classes(Rowset, Array, and so on) from one application to another.Application Class: App Class is a People Code Program at baselevel Application classes are mainly used for reusability. Application classes people code supports object oriented programming , i.e. it supports : Classes and Objects. Encapsulation. Abstraction. Polymorphism. Inheritance.

OOP ConceptsCLASS:Class is a blueprint of the object .It consists of variable and methods. Class doesnt occupy any memory.Example: Class is a map for building the house.OBJECT:Object is a real entity any thing physically exists in the world is called an object.But in programming languages object is instance of a class .It occupies some memory. Example: Object is house.ENCAPSULATION:Its came from the word capsule. It is a property to bind the variable and methods and also it hides the internal structure. Itprevents clients from seeing the inside view. We can achieve abstraction through encapsulation. Example: car driver doesnt know what the functionality is when gear is changed one level to another level. But he change the gear against to the speed.

Abstraction :Abstraction is process it allows to show the essential object information to the user i.e hide the non essential object information. We can achieve this through encapsulation.Inheritance:It is one of the most important feature of Object Oriented Programming. It is the concept that is used for reusability purpose. Inheritance is the mechanism through which we can derived classes from other classes. The derived class is called as child class or subclass. The class from which the subclass is derived is called asuperclass(also abase classor aparent class).Polymorphism :A method having different forms is called polymorphism i.e method having the same name but we can perform different tasks by using this polymorphism.We have to concepts here1.method overloading.2.method overriding.

Process for creating package and classes:application designer new definition application package insert application class

Application Classes General Structure Import class Class name Class extensions Declaration of public external interface Declaration variables and methods Definition of methods

Data TypesConventional data types include number, date, string. Use them for basic computing. Object data types instantiate objects from PeopleTools class. Conventional data types. Object data types.

Class ExtensionIt is nothing but inheritance. We can extend the properties and methods of one class into another class using extends key word Example:class FruitmethodDoFruit(); property number FruitNum instance; end-class; class Banana extends Fruit methodDoBanana();property number BananaNum instance; end-class;A subclass inherits all of the public methods and properties of the class it extends. These members can be overridden by declarations of methods and properties in the subclass.Note.Application classes have no multiple inheritance

Access ControlsWe can control the access by public , private, protected access specifiers. Public Protected Privateexample: class Aproperty number a1; method number a1;protected:property number a2;method number a2;private:property number a3;method number a3;Definition of Methods The systemneverskips to the next top-level statement. Pass parameters by value. Parameter passing with object data types is by reference. Application programs use the out specifier to pass a parameter by reference.Note:Application class properties are always passed by value. Passing Parameters with Object Data Types value and reference: Parameters with object data types are always passed by referenceExample:methodmyMethod(&arg as MyObjectClass);/*method myMethod(&arg as MyObjectClass out);Local MyObjectClass&o1 = create MyObjectClass("A");Local MyOtherObjectClass&o2 = create MyOtherObjectClass();&o2.myMethod(&o1); Method myMethod&arg = create MyObjectClass("B");end-method;note : Since the method argument is reassigned within the body of myMethod, &o1 does not point at the new instance of MyObjectClassPassing variable by value and reference/* argument passed by reference */method increment(&value as number out); /* argument passed by value */:method increment(&value as number);classAddStuff methodDoAdd(&P1 as number, &P2 as number out); end-class; methodDoAdd&X = &P1 + &P2;&P1 = 1;&P2 = 2;end-method;localAddStuff&Aref = Create AddStuff();local number &I = 10;local number &J = 20;&Aref.DoAdd(&I, &J); /* changes &J but not &I */&Aref.DoAdd(10, 20); /* error - second argument not variable */

Declaration of Abstract Methods and PropertiesSample code:classMyInterfacemethod MyMethod1() abstract;method MyMethod2() Returns string abstract;method MyMethod3();property string myproperty1 abstract readonly;property number myproperty2 abstract;property number myproperty3 abstract;end-class;method MyMethod3 /*bodyend-method;

Considerations using abstract methods: You cannot have private abstract methods. You will receive an error if you try to provide a method body for an abstract method. The method signatures must be identical between the abstract method definition and the method implementation in the derived.

InterfacesDefining an application class which is totally composed of abstract methods and properties is called interface it avoids the problem in multiple inheritance.Interface MyInterfacemethod MyMethod1();method MyMethod2() Returns string;property string myproperty1 readonly;property number myproperty2;property number myproperty3;end-class;When you provide an implementation for an Interface you can also use the keywordImplementsinstead ofExtends

Constructors The constructor for a class is the public method with the same name as the (short name of the) class. The statements contained in this method (if any) provide the initialization of the class. This constructor isalwaysexecuted when an object of the class is instantiated

class amethod a();end-class;

Import Declarations Import Fruit:*; Import Fruit:Banana; Import Fruit:Drinks:*;

Here any import classes having same short name we must use full name of the class for creating or initiating object to that class.

Member Referencing

1. %THIS - Self-Reference A method can refer to the current object using the %This. system variable. %This is an object of either the method's class or a subclass of the method's class.Ex:1classFactorialClassmethod factorial(&I as number) returns number;end-class;method factorialif&I Row -> Record -> Field

Now lets have a detail overview of these classes one by one.

1.Rowset Class: A rowset object, instantiated from a Rowset class, is a collection of rows associated with buffer data. A component scroll is a rowset. You can also have a level 0 rowset.If a rowset object is instantiated using the CreateRowset function, the rowset object thats instantiated is a standalone rowset. Any records and field references created by this function are initialized to null values, that is, they do not contain any data. You can populate this rowset object using the CopyTo, Fill, or FillAppend methods.

Built-in Functions for Rowset Class:

CreateRowset GetLevel0 GetRowset

a. The CreateRowset function creates an unpopulated, standalone rowset.

Syntax:

CreateRowset ({RECORD.recname | &Rowset} [, {FIELD.fieldname, RECORD.recname |&Rowset}] . . .)

Example :

Local Rowset &RS;&RS = CreateRowset (RECORD.QA_INVEST_DTL);

b. GetLevel0 creates a rowset object that corresponds to level 0 of the component buffer. This function returns a rowset object that references the base rowset. For a component, this is the level 0 of the page. For a PeopleSoft Application Engine program, this is the state record rowset. For a message, this is the base rowset.

Example :

The following code sample returns the level one rowset.

Local Rowset &ROWSET&ROWSET = GetLevel0()(1).GetRowset(SCROLL.LEVEL1_REC);

c. The GetRowset function to get a rowset object based on the current context. That is, the rowset is determined from the row containing the program that is running.

Syntax :

GetRowset ([SCROLL.scrollname])

Example: In the following example, RS1 is a level 1 rowset, and RS2 is a child rowset of RS1.

Local Rowset &RS1, &RS2;

&RS1 = GetRowset();

&RS2 = GetRowset(SCROLL.EMPL_CHKLST_ITM);

With no parameters, GetRowset returns a rowset object for the rowset containing the currently running program. If a parameter is specified, it returns a rowset for that child scroll. Scrollname must be the name of the primary record for the scroll.

2.Row Class: A row object, instantiated from the Row class, is a single row of data that consists of one to n records of data. A single row in a component scroll is a row.

A row may have one to n child Rowsets. For example, a row in a level two scroll may have n level three child rowset. CopyTo and GetRecord are two commonly use methods for this class.

Visible and IsChanged are two commonly used properties for this class.

Built-in Functions :

GetRow

Methods :

CopyTo GetRecord

The GetRecord method creates a record object that references the specified record within the current row object.

Example:

&REC = &ROW.GetRecord(RECORD.QEPC_LEVEL1_REC);

Properties:

Visible Ischanged ChildcountIschanged property returns True if any field value on the primary database record of the row has been changed.

Example :

&tmp = &ROW.IsChanged;

if&tmp = True then

Warning("A Field on this row has been changed");

End-If;

Childcount property returns the number of child rowsets of the row. It is defined by the "structure" of the scroll, so it is the same for all rows of the rowset.

It might be used, in conjunction with the GetRowset method, to write code that examines all child rowsets.

Example

For &I = 1 to &ROW.ChildCount

&ROWSET = &ROW.GetRowset(&I);

/* do processing */

End-For;

3.Record Class : Record object, instantiated from the Record class, is a single instance of a data With in a row and is based on a record definition. A record object consists of one to n fields.

CopyFieldsTo is a commonly used method for the record class. Name, IsChanged, and FieldCount are commonly used properties.

Built-in Functions:

GetRecord CreateRecord

CreateRecord creates a standalone record definition and its component set of field objects. The specified record must have been defined previously, that is, it must have a record definition.

Example:

Local Record &REC2;&REC2 = CreateRecord(RECORD.OPC_METH);

Methods:

CopyFieldsTo CompareFields

The CopyFieldsTo method copies all like-named field values from the record object executing the method to the specified record object. This copies all field values. To copy only changed field values, use the CopyChangedFieldsTo method.

Example:

Local Record &REC, &REC2;&REC = GetRecord(RECORD.OPC_METH);&REC2 = CreateRecord(RECORD.OPC_METH_WORK);&REC.CopyFieldsTo(&REC2);

The CompareFields method compares all like-named fields of the record object executing the method with the specified record object.

Example:

&REC = GetRecord(RECORD.OP_METH_VW);&REC2 = GetRecord(RECORD.OPC_METH);If &REC2.CompareFields(&REC) ThenWinMessage("All liked named fields have the same value");End-If;

4.Field Class : A field object, instantiated from the Field class, is a single instance of data within a record object, and is based on a field definition.

SetDefault is a frequently used method. Name, Enabled, and Type are several commonly used field properties.

Built-in Functions:

GetField

GetField creates a reference to a field object for the current context; that is, from the row containing the currently executing program.

Example:

&FIELD = GetRow().recname.fieldname;

Methods:

SetDefault

SetDefault sets the value of the field to a null value, or to a default, depending on the type of field.

Example:

&CHARACTER.SetDefault();

Properties:

Name Enabled Type

Lesson 14: Executing SQL in PeopleCodeWe can execute the SQLs in PeopleCode by the following ways Where aSQLExec(built-in function) only delivers a single row, using theSQLclass you can retrieve and process multiple rows.

Instantiate a SQL object with theCreateSQLbuilt-in function. UseCreateSQL("SQLString") when you pass a text string to your SQL object. UseGetSQL(SQL.sqlname) when you get the SQL from a SQL definition.Example&SQL = CreateSQL("SQL Statement",[bind values]);(You can also choose to omit the values for the bind variables and supply those values later. For Insert, Update, or Delete commands these values would be supplied usingExecutemethod.If you supply all the necessary input values, the SQL is executed immediately.)&SQL = CreateSQL("SQL Statement");&SQL.Execute([bind_values]); For a SQL object containing a Select statement, theFetchmethod is used to retrieve the next row from the cursor.

Lesson 15: Action Modes in PeopleSoftPeopleSoft allows you to access most records of information in the following 4 action modes. Add Update/Display Update/Display All Correction

AddMode - Allows you to add a new person or other item to the database.

Update/Display Mode -Allows you to view and update information in existing records by inserting new rows of data. It displays all current and future information.

Update/Display AllMode - Allows you to update information in existing records by inserting new rows of data. It displays all current, future, and historical information.

CorrectionMode - It is very powerful. As such, very few users will have access to Correction mode. It allows you to view and make changes to data currently in the database.

Application EngineApplication Engine is a People Tool designed to help you develop background SQL processing, Interfacing and Reporting. Advantages of Application Engine Program include Restart Facility, Platform Independent, Meta SQL Support, Performance, Effective Date and Parallel Processing.

In this chapter we will cover the following topics:

Lesson 1: Running Application Engine Program.Lesson 2: Types of Application Engine Program.Lesson 3: Sections, Steps and Actions.Lesson 4: Constructing Application Engine Programs.Lesson 5: Working with State Records.Lesson 6: Tracing and Debugging.Lesson 7: Actions in Application Engine Program.Lesson 8: Inserting and Updating data into tables using AE.Lesson 9: People Code techniques for AE Program.Lesson 10: Dynamic calls to program Sections.Lesson 11: Writing efficient SQL in Application Engine Program.Lesson 12: Meta SQL.Lesson 1: Running Application Engine Program.We can run Application Engine Program in following ways.

Creating Process Definition.Navigate to People Tools >> Process Scheduler >> Processes to access Process Definition Page.

AE Process Request Page.Navigate to People Tools >> Application Engine >> Request AE to access Application Engine Request Page.

Using People Code.To call a specific Application Engine program from a page using People Code, use the CallAppEngine function in SavePreChange or SavePostChange People Code. The basic syntax for CallAppEngine is:CallAppEngine (applid[, statereclist, processinstance])

Command Line.To start application engine program from command line, you must specify the AE executable (PSAE.exe) file followed by the required parameters.Ex: psae -CTdbtype -CSserver -CDdatabase_name -COoprid -CPoprpswd? -Rrun_control_id -AIprogram_id -Iprocess_instance -DEBUG (Y|N)? -DR (Y|N) -TRACEtracevalue -DBFLAGSflagsvalue -TOOLSTRACESQLvalue? -TOOLSTRACEPCvalue -OTouttype -OFoutformat -FPfilepathLesson 2: Types of Application Engine Programs.There are 5 types of Application Engine Programs. We can specify program type in the Application Engine properties. Standard- This is normal standard Application Engine Program Upgrade Only- This is used in PeopleSoft import utilities. Import Only- This is used in PeopleSoft import utilities Daemon Only- This is used in Daemon process Transform Only This is used to support XSLT (Extensible Stylesheet Language Transformations)

Lesson 3: Sections, Steps and ActionsApplication Engine is made up of below key elements: Sections.Sections include one or more steps and are 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 ordered steps that is executed as part of a program. You can call sections (and other programs) from steps within other sections. Steps.Steps are 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 you 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 is called, its steps execute sequentially. Every program begins by running the first step of the required section called MAIN and ends after the last step in the last section completes successfully. Actions.We can use multiple Actions within the Steps. Application Engine is having below Actions. Do Select: Used to write SQL statements. It works like FOR loop. Subsequent Actions will be executed based on the no. of rows return by the query. Do While: Used to write SQL statements. It works like WHILE condition. Subsequent Steps will be executed until the select not return any row. Do When: Used to write SQL statements. It works like a IF condition, if the select statement returns rows or a row it will execute the subsequent Steps once. Do Until: Used to write SQL statements. Preceding Actions of a DO UNTIL executes atleast once. If DO UNTIL returns rows preceding actions will be executed. SQL: This Action is used to write update, insert and delete sqls. Peoplecode: This Action is used to write people code. Log Message: This Action is used to write data in to log file. We need to mention MsgSet and MsgNbr to write message from message catalog. Call Section: This Action is used to call another Section within the program or we can call Section from other program.Lesson 4: Constructing AE Programs.Application Engine program includes a logically ordered set of Sections, Steps and Actions. MAIN Section is the starting point of the program. Section should contain atleast one Step and Action.To create a new Application Engine program, select NEW from FILE menu of Application Designer and select App Engine Program.

You can see two different views in the Application Engine Program. Definition view and Program Flow view.Definition view to create definitions within a defined hierarchical structure, in which nodes represent the definitions. A node is the visual representation of a section, step, or action that you can select, collapse, modify, and so on.

The sections that appear in Definition view do not necessarily appear in the order that they execute. To see the actual order in which the sections execute, switch to Program Flow view.

Lesson 5: Working with state record.State Record is used to pass values between Section, Steps and Actions. State record name must be suffix with _AET. Process_Instance should be one and only key field. It can be SQL Table or Derived Work Record. We can have up to 200 State Records associated with a particular AE program, in that only one can be default state record.

Application Engine program automatically updates State record with Process_Instance value while starting. %SELECT is used to insert values in State record and %BIND is used to pull value from State record.

Lesson 6: tracing and debugging.tracing:This lesson we can see how to enable tracing for AE program and locate a trace file: We can set People Tools trace, People Code trace, SQL trace and Timing trace for Application Engine program. At the top of each trace file, we can see People Tools version, database name and database platform type. The first section of the trace file is the SQL section. It records the performance of each SQL in the program. Peoplecode is the second section of the trace file and records the performance associated with all the PeopleCode actions in AE program. Below is the list of parameters used to trace Application Engine program. 0 Disable 1 Step trace 2 SQL trace 4 Temp table trace 128 Timing trace 256 People Code trace 1024 Statement timing trace 2048 Database optimizer trace 4096 Explain plan table of the current database 8192 Integration Broker trace 16384 SQL timing traceBy default, Application Engine traces are turned OFF. To see a trace combination of traces, set trace options before you run a program. We can set trace via Command Line: To enable tracing from the command line, specify TRACE option within the command line with PSAE.exe parameter. Ex: psae.exe TRACE 2Server Configuration Files: You can also enable traces in the configuration files for both the application server and the PeopleSoft Process Scheduler server. For programs invoked by PeopleCode and run on the application server, set the TraceAE parameter in the Trace section of the Application Server configuration file (PSAPPSRV.CFG). You can use PSADMIN to set this parameter. In the PeopleSoft Process Scheduler configuration file, set the TraceAE parameter in the Trace section to indicate a level of tracing. You can use PSADMIN to set this parameter.This option is available on Microsoft Windows NT and UNIX, and it applies only to Application Engine programs invoked in batch mode.Configuration Manager: For processes running on a Microsoft Windows workstation, you can set trace options using PeopleSoft Configuration Manager. This procedure is valid only if you are running Application Engine programs on a Microsoft Windows workstation in a development environment.Image: Application Engine Trace check boxesThis example illustrates the check boxes on the Application Engine Trace check boxes.

To set Application Engine traces: Start Configuration Manager, and select the Trace tab. Select the appropriate trace options. You can select any combination of options. Click either the Apply or OK button to set trace options.debugging:To run a program in debug mode, Set the debug option.You can set the debug option in the following locations:Start PeopleSoft Configuration Manager and select the Process Scheduler tab. In the Application Engine group, enable debug by selecting the Debug check box. This method applies to all methods of invocation.If you used the command line option to invoke your Application Engine program, then you can include the DEBUG Y parameter in the command line you submit to PSAE.EXE. If the Debug check box is already selected in PeopleSoft Configuration Manager, then you do not need to include the DEBUG parameter in your command line.If you have PeopleCode in your Application Engine program, enable the PeopleCode debugger.When you launch your program and the PeopleCode action runs, enter the PeopleCode debugger.Run the Application Engine program to debug.At the Application Engine Debugger prompt, enter a command to enable a debugging option.Each command is represented by a single letter, such as X,L, orM. Enter the letter that corresponds to the option you want to engage. To see a list of the available debugging options, enter? at the prompt.To enable the PeopleCode debugger for Application Engine:Sign on to PeopleTools using the same user ID that you will use to invoke the Application Engine program.Open Application Designer.Select Debug, PeopleCode Debugger Mode.Your Application Engine program can be open on the desktop, but you do not need to open the Application Engine program or the PeopleCode action that you want to debug.Select Debug, Break at Start.This command will cause the Application Engine program to break before executing any PeopleCode programs within it.

Lesson 7: The Actions in AE Program.You can include 8 types of ACTIONS within a STEP, and you can add multiple ACTIONS to a STEP. The actions you define for a STEP depend on the results that your program requires at each stage of execution. The only mutually exclusive actions within a single step are Call Section and SQL Statement; you cannot add a Call Section action to a step that already contains a SQL Statement action, and vice versa. At runtime, the system evaluates actions by type and runs them within a strict hierarchy. For example, if both a Do When and PeopleCode action exist within a given step, then Application Engine always executes the Do When action first.

Do When:This action is similar to IF statement. A Do When statement runs before any other actions in a step. If the Do When statement returns any rows, the next action is executed. If the Do When conditions are not met, the remaining actions within that step are not executed. Your program runs a Do When action only once when the owning step executes.The only property that you can specify for a Do When action is the ReUse Statement property, which applies to all SQL-based actions.Do While:The Do While action is a Select statement that, if present, runs before subsequent actions of the step. If the Do While statement does not return any rows of data, the action terminates. The Do While statement is identical to the COBOL While statement. Subsequent actions within the step are executed in a loop as long as at least one row is returned by the Select statement for the Do While action. If the Do While statement does not return any rows, the step is complete.The only property that you can specify for a Do While action is the ReUse Statement property, which applies to all SQL-based actions.Do Until:A Do Until action is a Select statement that runs after each action when a step completes. If the Select statement returns any rows of data, the step terminates. When using a Do Until action, note that:You use a Do Until action if you want the processing actions to execute at least once and to execute repeatedly until a certain condition is true, such as a Select statement returns some rows.You can use a Do Until action to stop a Do Select action prematurely. For example, if a Select statement for a Do Until action does not return any rows, then the actions in the step are repeated (except if a Do When action appears in the step). Normally, a Do Select action continues until no rows are returned. If any rows of data are returned, the Do Select action stops and the step is not repeated.The only property that you can specify for a Do Until action is the ReUse Statement property, which applies to all SQL-based actions.Do Select:The Do Select action is a Select statement that executes subsequent actions once for every row of data that the Do Select statement returns. For instance, a Do Select statement can run a SQL statement for each row returned from the Select statement. The subsequent actions within the step are executed in a loop based on the results of the Select statement. The type of the Do Select determines the specific looping rules.Like the other Do actions, you can specify the ReUse Statement property for the Do Select action; this property applies to all SQL-based actions.In addition to the ReUse Statement property, you must also specify this Do Select property: Do Select Type.SQL:This action is used to write SQLs in the Application Engine program, we can write Insert, Update and Delete SQLs. People Code:We can write Peoplecode with in Application Engine using this PeopleCode action. We can specify only one property On Return with peoplecode action.Call Section:Use the Call Section action to call another section defined in an Application Engine program. You can call a local section defined within your current program, and you can make external calls to a section defined in another Application Engine program. The external section you intend to call must have its access property set to Public. If the access property of a section is set to Private, that section can be called only from within the same program. By default, the access property of a section is Private. If you attempt to make a call to a section that does not allow external calls, you receive an error message at runtime.We can also call the section dynamically at runtime, we need to specify program name and section name as per requirement.Message Log:Use this action to write a message to the message log. We need to provide Message Set Number and Message Number in order to write message.Lesson 8: Inserting and Updating data into tables using AE.The main objective of Application Engine program is background SQL processing. We can do mass insert, update and delete with the Application Engine. We can directly write insert, update and delete sqls in SQL action of Application Engine. By buffering rows to be inserted, some databases can get a considerable performance boost. Application Engine offers this nonstandard SQL enhancement for the following databases: Oracle, Microsoft SQLServer, and DB2. This feature is named Bulk Insert. For those database platforms that do not support the Bulk Insert feature, this flag is ignored.

Lesson 9: People Code techniques for AE Program.Inserting PeopleCode into Application Engine programs enables you to reuse common function libraries and improve performance. In many cases, a small PeopleCode program used instead of Application Engine PeopleCode is an excellent way to build dynamic SQL, perform simple If/Else edits, set defaults, and perform other tasks that do not require a trip to the database.When to use PeopleCode:Application Engine is not intended to run programs that include only PeopleCode actions. The primary purpose of Application Engine is to run SQL against your data.Use PeopleCode primarily for setting If, Then, Else logic constructs, performing data preparation tasks, and building dynamic portions of SQL statements; rely on SQL to complete the bulk of actual program processing. Also use PeopleCode to reuse previously developed online logic. PeopleCode is the tool to use to take advantage of new technologies such as component interfaces and application classes.Most programs must verify that a certain condition is true before they run a particular section. For example, if the hourly wage is less than or equal to X, do Step A; if not, fetch the next row. In certain instances, you must modify variables that exist in a state record. PeopleCode enables you to set state record variables dynamically.When writing or referencing PeopleCode in a PeopleCode action, you must consider the environment in which the Application Engine program runs. Environment indicates the differences between online and batch modes. Application Engine programs usually run in batch mode; consequently, your PeopleCode cannot access pages or controls as it can while running in online mode. Any PeopleCode operations that manipulate pages will not run successfully. Even if you invoke your Application Engine program online from a record or a page using the CallAppEnginePeopleCode function, the Application Engine PeopleCode still does not have direct access to component buffers.Any record field references that appear in a PeopleCode action can refer only to fields that exist on an Application Engine state record. Component buffers, controls, and so on are still inaccessible even if you define the page records as state records in the Program Properties dialog box. An Application Engine program can access only state records or other objects you create in PeopleCode.Lesson 10: Dynamic calls to program Sections.As you know we can call the Sections using Call Section Action, we can call a local section defined within our current program, and we can make external calls to a sections defined in another Application Engine programs.

We have dynamic calling functionality within Call Section action; we need to specify Application Engine Program name and Section name before calling a section dynamically.

Use AE_APPLID and AE_SECTION fields in the default state record to call different sections as per requirement at runtime. We need to specify Application Engine name and Section name in PeopleCode Action before Call Section Action and we must check Dynamic check box in the Call Section properties. If AE_APPLID (Program name) is blank, then process will consider current program name as AE_APPLID, if AE_SECTION (Section name) is blank then an error occurs.

Lesson 11: Writing efficient SQL in Application Engine Program.Do Actions and SQL Action is used to write SQLs in Application Engine Program. Application Designer invokes a SQL editor to write SQLs. We can do row by row processing and set processing using sqls as per requirement. We must use Do Action for row by row processing and single SQL action is enough for set processing.Lesson 12: Meta SQL.You can write SQL within Application Engine, or you can copy SQL statements into Application Engine from any SQL utility with few, if any, changes. This capability enables you to write and fine tune SQL statements before you try to incorporate them into an Application Engine program. Database platforms can have different syntax rules, especially in regard to date, time, and other numeric calculations. Generally, you can work around syntax differences using PeopleSoft meta-SQL, which Application Engine supports. Meta-SQL is a set of predefined terms (meta-strings) designed to replace relational database management system (RDBMS)-specific SQL syntax with a common syntax.In addition, PeopleSoft meta-SQL enables you to dynamically generate portions of SQL code. For example, to join two tables based on their common keys, use the following meta-string:%Join (COMMON_KEYS, PSAESECTDEFN ABC, PSAESTEPDEFN XYZ )At runtime, the function would be expanded into the following:ABC.AE_APPLID = XYZ.AE_APPLID AND ABC.AE_SECTION = XYZ.AE_SECTIONAND ABC.DBTYPE = XYZ.DBTYPE AND ABC.EFFDT = XYZ.EFFDT

Chapter 5: Peoplesoft queryThe purpose of this class is to provide you with the skills you need to effectively use the PS Query. In this chapter we will cover the following topics:

Lesson 1: Introduction to Query Manager.Lesson 2: Create Private Queries and Share Public Queries.Lesson 3: Output Queries to HTML and Excel.Lesson 4: Filtering Output Data by Adding Criteria to Queries.Lesson 5: Creating and Using Runtime Prompts.Lesson 6: Working with Multiple Tables.Lesson 7: Query Viewer and Query Scheduler.Lesson 8: Writing Expressions for Use as Fields and in CriteriaLesson 9: Creating SubqueriesLesson 10: Outer Joins When and How to Create ThemLesson 11: How and When to Use Unions

Lesson 1: Introduction to PS queryChapter StructureMost chapters are structured the same way and generally consist of the following: Objectives. The objectives are found at the beginning of the chapter and define what you will learn in the chapter. Lessons. Each chapter has several lessons that explain the various concepts. Some lessons contain practices and exercises. Practices are step-by-step instructions for completing a procedure that the instructor and class participants walk-through together. Review Questions. You will find review questions at the end of the document that recap material covered in the chapter. The answers to the questions will be discussed among class participants and the instructor.

Introduction

All business data is stored in a database in order to be used to manipulate that data, answer questions, perform analysis and solve business problems. However, retrieving particular information from the database can be difficult and time-consuming.

With PeopleSoft Query, you can easily create queries to access data in the PeopleSoft database. The queries can be simple or complex based on your requirement. In addition, they can be one-time or can be used repeatedly. Lesson 2:Create Private Queries and Share Public QueriesCreating Basic Query Process The following steps are the basics for creating a simple query. Select records. Add fields to query content. View fields selected for output. Change the column order for multiple fields. Change the sort order for multiple fields. Edit field properties. View and edit query properties. View underlying SQL code.

Navigation to Query manager:

Records Tab:

It will help to search the record names that you will use in the querry.

Recname This is the database record name the Record description Add Record Click this hyperlink to select the record for this query Show Fields Click on the icon to display all fields associated with the record. This is to determine if the record is the correct one required for the query.

Query Tab

Once a record has been selected, the Query tab will be the active page listing the fields associated with the selected record. For each Chosen Record you will see: Folder Icon: Hide or Unhide the list of fields associated with the selected record. This is useful when you are using more than one record for the query and only need to view the fields associated to one record at a time Alias: The database record name the record description. For example, Department is the Alias for DeptIDRecord: The record name in the database and the description of the record Hierarchy Join: This hyperlink allows you to join a child record to its parent Minus Button: Used to delete a hierarchy join

Once you unhide the list of fields for each record, you will find the following information:

Fields Tab

The tab shows all output fields that have been selected from the Query tab as well as from the expression tab. It allows users to delete an output field, change field heading, apply an aggregate, or change the translate value.

View SQL

All design efforts are written and stored in a SQL language format and can be viewed by clicking on the View SQL tab. If you are familiar with the SQL programming language you can confirm you work by going to this tab.

SaveOnce you creation process is completed save the Query.

Complete the following to save the Query: Query Enter a name for the query. Note: The query name may only contain letters, numbers or underscores (NO SPACES), follow naming convention Description Enter a brief description (optional). Entering a description here allows you to search by keywords when trying to find a query. Folder Enter a folder name (you create it by entering it here), if you wish to store this query in a folder. Query Type Select User, Archive, Process, or Role. Standard queries are defined as User, and queries that use workflow are defined as Process or Role. Archive is used to identify queries that may be stored for now and used later. Owner Select Private or Public. A Private query can be accessed and modified by only the user who created the query. However, any user who has access to the query records can run, modify, or delete a Public query. Query Definition Enter a more complete description of what the query Click the OK button.

Lesson 3:Output Queries to HTML and ExcelQuery Viewer

Query Viewer allows users to view existing queries, even if they do not have access to create their own. Query results can be run to HTML, which displays them in the web browser, or they can be exported to Microsoft Excel.

When you open Query Viewer all available queries are displayed. The following information is displayed for each query: Query Name The database name of the query Query Description The description of the query entered upon creation Query Owner: Private Only the logged on User ID can modify or delete this query Public Any user can modify this query Run to HTML The query will be executed and the results will display in a new browser window Run to Excel The query will be executed and the results will display in a new Excel Spreadsheet Schedule Schedule the query to run at a later time Favorites Allows you to save a query to the Favorites menu.

Lesson 4: Filtering Output Data by Adding Criteria to Queries.Criteria

Criteria is used to define our query to retrieve specific records instead of all records in a table or tables. Criteria design is critical to ensure query efficiency and effectiveness.The criteria screen is divided into three main parts. These parts are Expression 1, Condition Type, and Expression 2. This screen simply allows us to write the following statement as one complete criterion:

(Expression 1)(Condition Type)(Expression 2)

Expression 1 Items: Field any table field can be selected from the selected tables within a query Expression functions that can be written in the expression screen to formulate values based on calculations or data manipulations. The Condition Type:Defines the relationship between Expression 1 and Expression 2. The default Condition Type in this example is equal to. Other Conditions can be selected from the drop down list.

Expression 2 Items: Field any table field can be selected from the selected tables within a query Expression functions that can be written in the expression screen to formulate values based on calculations or data manipulations. Constant a value that is entered directly in space provided Prompt allows an interactive query where end users can enter values based on their needs Subquery allows the filtering of a queried records from a nested statement.Lesson 5: Creating and Using Runtime Prompts

Steps Used to Create a Runtime Prompt

Click the Add Criteria button on the Criteria page. The Edit Criteria Properties page appears. Select the record.field in Expression 1 you wish to use. In the Choose Expression 2 Type select the radio button for Prompt. In the Expression 2 group box select the New Prompt link. The Edit Prompt Properties for the record.field you selected appears and all properties are filled in for you. Click the OK button. Click the OK button again to bring you back to the Criteria tab. Click the Run tab to see the prompt and test. Save if you like the results if not you may go back and adjust your prompt or criteria.

Lesson 6: Working with Multiple TablesJoins

PeopleSoft query design environment allows adding multiple tables to be joined up to a maximum of six tables in one level. Joining additional tables allows the inclusion for significant data or the exclusion of certain records. However, query designer must take caution when joining tables. It is best to plan table join order, because Left Outer Join is only possible to the last table. If a required table join has to be Left Outer Join type, it must be joined to the last table in the query. Therefore careful planning is advised. Joining tables can be very tricky, as it may exclude many records or add many more that are not relevant or duplicates.

In PeopleSoft Query, a predefined join is one of the following: Record-hierarchy join Related-record join

Record-Hierarchy Joins

Record-hierarchy joins use records that are related through a parent-child relationship.

Steps:

Select the Query page, and then click the Hierarchy join link. Select the record to join from the list of parent-child records. This record appears on the Query page and is assigned an alias letter in the order that you added the records. Select the necessary fields from the joined record.

Adding a Related-Record Join Access the Query page and locate the A.ACAD_ORG_TBL record click the plus sign on the yellow file folder to expand the B record. Click the Join hyperlink that is next to the INSTITUTION field . Click the OK button to accept the default standard join, and select the DESCR field. Save the query, and view the query results.Lesson 7: Query Viewer and Query SchedulerQuery Viewer Query Viewer is the primary place to run and view queries. Upon searching for a query, you can choose to run the query immediately and view the results in a new browser window or to schedule it to be run at a later time (or predefined schedule). Queries Viewer enables you to: Search for a query Preview a query in the active browser window Run a query and display results in a new browser window Print a query Schedule a query

When you open Query Viewer all available queries are displayed. The following information is displayed for each query: Query Name The database name of the query Query Description The description of the query entered upon creation Query Owner: Private Only the logged on User ID can modify or delete this query Public Any user can modify this query Run to HTML The query will be executed and the results will display in a new browser window Run to Excel The query will be executed and the results will display in a new Excel Spreadsheet Schedule Schedule the query to run at a later time Favorites Allows you to save a query to the Favorites menu

Query Scheduler When a query is scheduled, this allows it to be run without user intervention. The user can work in other pages in PeopleSoft then pick up the results when the query has finished running. If the query is scheduled to run under a recurrence, the query will be run at the days and times defined for that recurrence, automatically being rescheduled to run again at the appropriate time.

To schedule a query, search for it in the Query Manager search page, then click the Schedule link.

You will then be asked to select or create a run control to identify the process submitted to the PeopleSoft Process Monitor for running your query on a schedule. If you have no run controls that run the selected query you will automatically be put on the Add a New Value tab for creating a new run control; otherwise you will be taken to the Find an Existing Value tab from which you can select a run control you have already made for scheduling the query.

This example will involve creating a new run control by clicking the Add a New Value tab. The Private Query and Query Name fields are filled in automatically. Enter a Run Control ID to assign to this run control then click the Add button. If the query has any prompts you will be asked to enter values for each prompt.

You will then be asked to enter a description for this scheduled run. Enter this then click the OK button.

The Process Scheduler Request page appears. To pick a specific date and time at which the query should be run, enter the date and time into the Run Date and Run Time fields. To instead have the query run repeatedly at the same time every day or every week, select a predefined recurrence from the Recurrence dropdown.

In the Process List section you will see one process named PSQUERY; this is the internal process that will run the query. In the Format dropdown there are several different formats for the output of the query, including:

HTM: web page, similar to the output of a query when run from Query Manager PDF: a document in the Adobe PDF format TXT: a comma-separated variable (CSV) text file XLS: an Excel workbook

Select the format that you want for the output. When you are ready to submit, click the OK button. You will be returned to the Query Manager search page.

To see the results of the query navigate to Reporting Tools > Report Manager. The List tab is selected and recently generated reports are displayed.

Click the link in the Report column corresponding to the scheduled query for which you want to view results. The details of that report are displayed. In the File List section, find the link with the name of the query (not the run control ID) that you scheduled.

Click the file link to open the file directly or right-click it and choose Save Target As to save it to your computer.

Lesson 8: Writing Expressions for Use as Fields and in CriteriaExpressions Expressions are ways to perform calculations and conversions and to edit or combine text strings. They can be displayed as a column in the result set and can be used in criteria. Expressions are comprised of fields, values, operators, and functions. Operators generally perform a calculation on the fields and values preceding and following them.

To add or edit expressions for queries:Select Reporting Tools, Query, Query Manager, then click the Create New Query link, and then select theExpressions tab to open the Expressions page. The query name appears in the Query Name field. The default for this field is New Unsaved Query until you change it on the Properties page.Click the Add Expression button to open the Edit Expression Properties page, where you can select expression types.

Select an option from the Expression Type drop-down list box.If you select Character, enter the maximum length of the expression result in the Length field.If you select Number or Signed Number, enter the total number of digits in the Length field and the number of digits after the decimal point in the Decimal field.Note. For Number and Signed Number, expression types, the Length field defines the total length of the number (integer portion + decimals portion). For example, if Length = 10 and Decimals = 3, then this means that the integer portion = 7 (Length - Decimals = Integer). In the Expression Text field, enter the expression (for example, A. Total * .1, where A represents the first record.)Query Manager inserts the expression into the SQL for you. You can include Oracle hints in PeopleSoft Query expressions as long as you adhere to the following rules:Expressions containing a hint must begin with /*+ .Expressions can contain only one hint. For example, only one set of /*+ */ is allowed.Expressions must contain a complete hint. For example, an expression can't have only /*+ or */ . Both must be in the same expression.Click the Add Prompt button to add prompt properties for this expression; click the Add Field button to add another field to this expression, if needed.

Expressions in Criteria

Criteria Icon and add criteria to the field(Expression). Click on OK.

Lesson 8: Creating SubqueriesA subquery, sometimes called a sub-SELECT,is a query whose results are used by another query. The main query uses the subquery's result set as a comparison value for a selection criterion.You create a subquery when you need to compare a field value to the results of a second query.Select Reporting Tools, Query, Query Manager.

Click the Use As Criteria link on the Query page, or click the Add Criteria button on the Criteria page.On the Edit Criteria Properties page, select Subquery as the comparison value.PeopleSoft Query displays a special Query

5. Click the Subquery/Union Navigation link to display a hierarchical view of the main query and all subqueries and unions.Use the hierarchy to navigate between the main query, subqueries

Lesson 9: Outer Joins When and How to Create ThemA LEFT OUTER JOIN first is thinking about the two tables laid out from left to right in the order that they are added to the query. A LEFT OUTER JOIN will return ALL the rows from the first table and any matching rows from the second table. If there isnt a match in the second table, a blank or NULL is returned for fields that are pulled from that table.

Create a new query Navigation: Reporting Tools Query Manager Create New Query

Select first table (left) in Records tab The first table will be the Left Table of the query. This is the table that will show all results ased on the criteria.

Select field(s) for query

Select second table in Records tab and join The second table will be the table used to compare values to the first table. Any matching rows will be in the result set. If there isnt a match in the second table a blank or NULL is returned.

Select Left outer join

Confirm or deselect criteria join conditions

Select field(s) on second table

Once you have joined the two records, you can use expressions (discussed later in this guide), prompts, field options, criteria, and HAVING (discussed later in this guide) to fine tune query to desired result set. Use the Distinct check box under the Properties link to exclude duplicates from the result set. Run query.

Lesson 10: How and When to Use Unions

A UNION selects all rows from two tables for the result set , but has some restrictions. Same number of output columns must be specified from each table. Each corresponding column must have the same data type (ex. character to character, or numeric to numeric, or date/time to date/time). Columns must be in the same display order.

Create a new query

Select first table in Records tab Select field(s) for queryCreate UNION joinTo create a union, click New Union at the bottom of any tab except the Run tab. The second table will be designated as Union 1.

Select second table In Records tab, search and select table to be joined by UNION

Select field(s) for query

Additional components of query page: Working on selection displaying which record/table you are working with Subquery/Union Navigation link used for toggling between Top Level of Query and Union1 records Delete Union link used to delete union

Chapter 6: SQRIn this chapter we will cover the following topics:

Lesson 1: SQR OverviewLesson 2: SQR Sections and Paragraph.Lesson 3: Program Flow in SQR.Lesson 4:SQR Data ElementsLesson 5: FunctionsLesson 6:Important CommandsLesson 7:SQCLesson 8: Local and global proceduresLesson 9: Running an SQR program Lesson 10:Debugging strategies for SQRLesson 11: LOAD LOOK UP & ArrayLesson 12: Error handlingLesson 13: Multiple reports

Lesson 1: SQR Overview

Structured Query Report Writer is a programming language that combines the power of SQL queries, the sophistication of procedural logic, and the freedom of the multiple-platform development. It works equally well on client and server, crosses almost seamlessly between different platforms, and covers nearly all-relational databases.

With SQR we can do the following:

Reports Background SQL process Interfaces (file handling)

Note: SQR will be stored on File Server not on the DB

Lesson 2: SQR Sections & ParagraphIn SQR there 5 Sections available:

Setup Section Begin-Setup/End-Setup Heading Section - Begin-Heading /End-Heading Footing Section - Begin-Footin