people soft component interface - a complete guide

73
PeopleSoft Component Interface A Complete Guide for the New CI Developer

Upload: himanshu-shekhar

Post on 22-Oct-2014

241 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: People Soft Component Interface - A Complete Guide

PeopleSoft Component Interface – A Complete Guide for the

New CI Developer

Page 2: People Soft Component Interface - A Complete Guide

2

Agenda

Introduction to Component Interface

Component Interface Architecture

Elements of Component Interfaces

Developing and Implementing CI‘s

Understanding the Component Interface API

Validate and set the Component Interface Security

Using the CI Tester

Using the Excel to Component Interface Utility

Programming CI in JAVA, C/C++, COM

Page 3: People Soft Component Interface - A Complete Guide

3

Component Interface

What is Component Interface?

Component = Group of PeopleSoft Pages i.e.., Personal Data pages or Job Data pages

―A means to access the PeopleSoft application without using the PeopleSoft pages‖

A component interface is a PeopleTools object that you create in Application Designer. A set of application programming interfaces (APIs) that you can use to access and modify PeopleSoft database information programmatically.

Real-time access to the PeopleSoft data and business rules.

It exposes a PeopleSoft component for synchronous access from another application.

External applications need not be concerned with the details of page structures and component definitions in order to access the underlying data and business logic through component interfaces.

Evolution of the Message Agent from version 7.5

Page 4: People Soft Component Interface - A Complete Guide

4

Component Interface

What is Component Interface?

In most cases, component interfaces behave exactly the same as

their online counterparts (their associated components).

This means that PeopleCode events typically fire in the same order

as the online case, and so on.

However, there are several exceptions to this behavior that relate

both to PeopleCode processing and search dialog processing.

Page 5: People Soft Component Interface - A Complete Guide

5

Component Interface

Open Integration Framework

Page 6: People Soft Component Interface - A Complete Guide

6

Access to all business logic

Delivered PeopleSoft logic

Your customizations Insulated from complexities of application

Data relationships

Data Integrity

Upgradeable PeopleTools object

Result: Saves Time & Money

Component Interface

Benefits

Page 7: People Soft Component Interface - A Complete Guide

7

Component Interface

Architecture

Component Interface

COM (VB)Methods

Component

PeopleCodeFunctions

Fields and ScrollsProperties andCollections

KeysComponentSearch Keys

C/C++

APIExternal Application

PeopleSoft Application

PeopleCode

Page 8: People Soft Component Interface - A Complete Guide

8

Component Interface

Architecture(contd.)

There are three fundamental elements to the overall component interface architecture. Components, component interfaces, and the component interface API.

Components One or more pages performing a business transaction that a component

interface is associated with.

Component Interface Exposed aspect of a component. However, unlike components,

component interfaces are readily accessible by internal and external applications and multiple component interfaces can reference the same component.

Component Interface API Application programming interface for a Microsoft COM (Visual Basic)

application and PeopleCode

Page 9: People Soft Component Interface - A Complete Guide

9

Component Interface

Elements of CI

Every component interface has the following four main attributes

Component Interface Name

One Component can have many Component Interfaces

Keys

Properties and collections (fields and records)

Methods

Page 10: People Soft Component Interface - A Complete Guide

10

Component Interface

Elements of CI (contd.)

NameEach component interface requires a unique name.

The calling programs use the name of the component interface to access

properties and methods.

KeysKeys are special properties containing values that retrieve an instance (get

keys) or a list of instances (find keys) of the component interface. you can

add, remove, or change keys in PeopleSoft Application Designer.

PropertiesProvide access to both component data and component interface settings.

Two types of properties: Standard and User-defined.

Standard properties are assigned automatically when a component

interface is created.

Standard properties can be set to true or false.

Examples : InteractiveMode, GetHistoryItems, and EditHistoryItems.

User-defined properties map to record fields on the PeopleSoft component

and are displayed in the PeopleSoft Application Designer.

A property can correspond to a field or a scroll (collection).

Page 11: People Soft Component Interface - A Complete Guide

11

Component Interface

Elements of CI (contd.)

Collections A component interface collection is a special type of property that

corresponds to a scroll.

It contains fields and subordinate scrolls as defined in its underlying

component.

Methods A method is a function that performs a specific task on a component

interface at runtime.

There are two main types of methods: standard and user-defined.

Standard methods are those that are available for all component

interfaces.

Example : Find, Get, Save and Cancel methods.

User-defined methods are created in PeopleSoft Application Designer to

provide added functionality to the component interface.

Page 12: People Soft Component Interface - A Complete Guide

12

Component Interface

Definition

Page 13: People Soft Component Interface - A Complete Guide

13

Component Interface

Keys

Used to define the values that uniquely identify an Instance of the

Component Interface

Three Types of CI Keys

GetKeysMaps to fields marked as search keys in the Components Search

record

CreateKeysGenerated in CI when the Use tab on the Component Properties

dialog allows the Add action

FindkeysMaps to fields marked as both Alternate Search keys and Search Key

in the Component Search Record

Page 14: People Soft Component Interface - A Complete Guide

14

Component Interface

Keys (contd.)

Keys are created automatically when you create a component interface.

Component interface keys are based only on the search key fields and alternate search key fields that are designated as list box items in the search record of the underlying component.

Each search key field produces a Get key and a Find key.

Each search key field also produces a Create key if the underlying component allows Add mode.

Each alternate search key field produces a Find key.

Valid Conditions for Modifying Keys You can add or delete a Find key if it‘s based on an alternate search key

field.

You can add any type of key based on a qualifying search key field in the component, if it isn‘t already the basis of an existing key of the same type.

You can delete any type of key if its underlying search key field meets one of these criteria:

It is no longer defined as a search key field.

It is no longer designated as a list box item.

It has been deleted from the component.

Page 15: People Soft Component Interface - A Complete Guide

15

Component Interface

Keys (contd.)

Page 16: People Soft Component Interface - A Complete Guide

16

Component Interface

Keys (contd.)

Page 17: People Soft Component Interface - A Complete Guide

17

Component Interface

Properties & Collections

Properties

Properties are the individual data items (fields) that describe a component

interface. Each property maps to a single field in the component

interface‘s underlying component. It provides access to component data

and component interface settings and status.

Two Types of Component Interface

Standard Properties

User-Defined properties

Collections

It is a group of properties that corresponds to a scroll, its fields and its

subordinate scrolls in the underlying component. A collection is a type of

property—which points to a scroll, instead of mapping to an individual

field, it points to a scroll.

A collection groups multiple fields in a scroll.

All the fields in the scroll are mapped to a property.

These properties are part of the collection.

Page 18: People Soft Component Interface - A Complete Guide

18

Component Interface

Properties & Collections (contd.)

User-Defined Properties

User-defined properties come from a component interface‘s associated

component, and must be added manually.

They are the specific record fields that you choose to expose to an

external system with the component interface.

Standard Properties

Standard properties are common across all component interfaces and

are assigned automatically when a component interface is created.

Standard properties also exist for each collection within a component

interface.

Page 19: People Soft Component Interface - A Complete Guide

19

Component Interface

Properties & Collections (contd.)

Page 20: People Soft Component Interface - A Complete Guide

20

Component Interface

Properties & Collections (contd.)

Page 21: People Soft Component Interface - A Complete Guide

21

Component Interface

Methods

A method is a function that performs a specific task on a

component interface at runtime.

Two Types Methods

Standard Methods

User-Defines methods

Available on all component interfaces as well as each collection

within a CI

Automatically generated upon the creation of CI

Page 22: People Soft Component Interface - A Complete Guide

22

Component Interface

Methods (contd.)

Standard Methods – Standard methods are those that are available on all component interfaces created as default with CI. Create - Creates a new instance of a component interface ( add data in

the component). Equivalent to opening a new record in Add mode online. Returns ―True‖ on success, and ―False‖ on failure.

Find - Performs a partial key search for a particular instance of a component interface. Returns ―True‖ on success, and ―False‖ on failure.

Get - Retrieves a particular instance of a component interface. Equivalent to opening a record in Update/Display or Correction mode when online with a PeopleSoft application. Returns ―True‖ on success, and ―False‖ on failure.

User-Defines methods – User-defined methods are those that you can create to meet the requirements of an individual component interface. A method is simply a PeopleCode function that you wish to make

accessible through the component interface. Each method maps to a single PeopleCode function. Application developer can write their own methods. These methods are

written as Functions using Component Interface PeopleCode. For example, suppose you wanted to be able to copy an instance of Component Interface data.

Page 23: People Soft Component Interface - A Complete Guide

23

Component Interface

Standard Methods

Page 24: People Soft Component Interface - A Complete Guide

24

Component Interface

Standard Methods (contd.)

Standard Methods that can be called only from PeopleCode

CopyRowSet (from PeopleCode only)

Enables you to copy rowsets created from the message data in your component interface.

CopyRowsetDelta (from PeopleCode only)

Enables you to copy only the changes created from the message data in your component interface.

Standard Methods available for use with any collection

InsertItem

DeleteItem

Item

ItemByKeys

CurrentItem

CurrentItemNum

Page 25: People Soft Component Interface - A Complete Guide

25

Component Interface

User Defined Methods

Those that you can create to meet the requirements of an individual

component interface.

A method is simply a PeopleCode function that you wish to make accessible

through the component interface

Each method maps to a single PeopleCode function

The Component Interface object, instantiated from a session object, is

created at runtime as a way to access the data specified by the Component

Interface.

Application Engine programs, application message subscription programs, or

any other PeopleCode programs will be able to use Component Interfaces.

When you populate a Component Interface with data, the first thing you fill

out are its keys, as you would in a component. These can be keys for getting

an existing instance of the data or for creating a new instance of the data.

In addition to keys, a Component Interface is composed of properties and

methods.

Component Interface properties provide access to the data in a component

buffer.

Component Interface methods are functions that can be called to perform

operations on a Component Interface.

Page 26: People Soft Component Interface - A Complete Guide

26

Component Interface

Developing & Implementing CI – Nine Steps

Design

Define Fields

Record Definition

Build Record

Defines Pages

Define Components

Define the Component Interface

Link the Component to the Menu

Authorize User Access (Security)

Test your Component Interface

Add individual objects, or groups of objects, to the component interface by

dragging objects from the component view into the component interface view.

All objects in the component view are part of the underlying component

interface, and they are accessible through user-defined methods or through

PeopleCode events on the component.

However, only the objects in the component interface view will be exposed to

the calling program at runtime.

Page 27: People Soft Component Interface - A Complete Guide

27

Component Interface

Working with CI Properties

Properties that affect how the Component Interface is executed

GetHistoryItems

InteractiveMode

These properties must be set before the Component Interface is populated with data (that is, before you use the Get or Create method.)

GetHistoryItems lets you access the data in the Component Interface in a similar manner as if you were accessing a component in correction mode. If you don‘t set this property as True, it‘s as if you were accessing a component in update/display mode.

InteractiveMode causes the Component Interface to emulate an online component. For example, if you set a value for a field in a Component Interface and you have set InteractiveMode to True, then any FieldChange PeopleCode programs associated with that field will fire as soon as you set that value. It is suggested that, this mode be used only in testing and debugging the CI.

Page 28: People Soft Component Interface - A Complete Guide

28

Component Interface

Working with CI Properties (contd.)

Properties that return information about the structure of the

Component Interface

FindKeyInfoCollectioCreateKeyInfoCollection

FindKeyInfoCollection

GetKeyInfoCollection

PropertyInfoCollection

Every user defined property in a Component Interface definition can

be used like a property on the object instantiated from that

Component Interface at runtime.

At runtime, you can use PeopleCode to assign a value to that

property (field), or to access the value of that field.

&TESTCI.START_DT = "01/08/2008";

/* OR */

&STARTDATE = &TESTCI.START_DT;

Page 29: People Soft Component Interface - A Complete Guide

29

Component Interface

Creating & Working with a CI

To create a new component interface

Select File, New from the Application Designer menu.

Select the Component Interface object type from the New dialog.

Select the component on which this component interface will be

based.

Save the component interface.

Add properties, collections, or methods to the component interface.

Set the security.

Test the component interface.

The following are the usual actions that you perform with a Component

Interface:

Create a new instance of data

Get an existing instance of data

Retrieve a list of instances of data

Page 30: People Soft Component Interface - A Complete Guide

30

Component Interface

Creating & Working with a CI (contd.)

GetCompIntfc (name )

Session Object

Get() or Create()

Find()

Pick acomponent from

the collection

Read PropertiesWrite PropertiesInvoke Methods

Set Keys

Save()

Cancel()

1.

2.

3.

4.

5.

6.

7.

Page 31: People Soft Component Interface - A Complete Guide

31

Component Interface

Working with a CI – Understanding the Delivered Code

Declaring a Component Interface Object

Component Interfaces are declared as type ApiObject. For

example,

Local ApiObject &TESTCI;

Scope of a Component Interface Object

A Component Interface can be instantiated from PeopleCode, from

a Visual Basic program, from COM and C/C++.

This object can be used anywhere you have PeopleCode, that is,

in message subscription PeopleCode, Application Engine

PeopleCode, record field PeopleCode, and so on.

Variables defined at Component and Global are only for

Component Interface.

Page 32: People Soft Component Interface - A Complete Guide

32

Component Interface

Working with a CI – Understanding the Delivered Code (contd.)

In this example, we are creating a new instance of data for the ORDER Component Interface, which is based on the ORDER_ISSUE_INV component. This is having an Add mode with three keys.

Local ApiObject &TESTSESSION;

Local ApiObject &TESTCI;

&TESTSESSION = GetSession();

&TESTSESSION.Connect(1, "EXISTING", "", "", 0");

&TESTCI = &TESTSESSION.GetCompIntfc(COMPINTFC.ORDER);

&TESTCI.BUSINESS_UNIT = "H01B";/* Key 1 */

&TESTCI.INTERNAL_FLG = "Y"; /* Key 2 */

&TESTCI.ORDER_NO = "NEXT‘; /* Key 3 */

&TESTCI.Create();

&TESTCI.CUSTOMER = "John‘s Chicken Shack";/* Other Properties*/

&TESTCI.LOCATION = "H10B6987"; /* other Properties */

Page 33: People Soft Component Interface - A Complete Guide

33

If NOT(&TESTCI.Save()) Then

/* save didn‘t complete */

&COLL = &TESTSESSION.PSMessages;

For &I = 1 to &COLL.Count

&ERROR = &COLL.Item(&I);

&TEXT = &ERROR.Text;

/* do error processing */

End-For;

&COLL.DeleteAll();

End-if;

If there are multiple errors, all errors will be logged to the PSMessages collection, not just the first occurrence of an error. As you correct each error, you will want to delete it from the PSMessages collection.

For example, if you specified the incorrect format for a date field of the Component Interface named ABS_HIST, the Text property would contain the following string: Invalid Date {ABS_HIST.BEGIN_DT} (90), (1)

Component Interface

Working with a CI – Understanding the Delivered Code (contd.)

Page 34: People Soft Component Interface - A Complete Guide

34

In this example, you are getting an existing instance of data for the EMPL_CHECK_CI Component Interface, which is based on the EMPL_CHECKLIST component, for the Update/Display mode.

Local ApiObject &TESTSESSION;

Local ApiObject &TESTCI;

&TESTSESSION = GetSession();

&TESTSESSION.Connect(1, "EXISTING", "", "", 0);

&TESTCI = &TESTSESSION.GetCompIntfc(COMPINTFC.EMPL_CHECK_CI);

&TESTCI.EMPLID= "8001";

&TESTCI.Get();

/* Get checklist Code */

&CHECKLIST_CD = &TESTCI.CHECKLIST_CD;

/* Set Effective date */

&TESTCI.EFFDT = "01-01-1990";

Component Interface

Working with a CI – Understanding the Delivered Code (contd.)

Page 35: People Soft Component Interface - A Complete Guide

35

If NOT(&TESTCI.Save()) Then

/* save didn‘t complete */

&COLL = &TESTSESSION.PSMessages;

For &I = 1 to &COLL.Count

&ERROR = &COLL.Item(&I);

&TEXT = &ERROR.Text;

/* do error processing */

End-For;

&COLL.DeleteAll();

End-if;

If there are multiple errors, all errors will be logged to the PSMessages collection, not just the first occurrence of an error. As you correct each error, you will want to delete it from the PSMessages collection.

For example, if you specified the incorrect format for a date field of the Component Interface named ABS_HIST, the Text property would contain the following string: Invalid Date {ABS_HIST.BEGIN_DT} (90), (1)

Component Interface

Working with a CI – Understanding the Delivered Code (contd.)

Page 36: People Soft Component Interface - A Complete Guide

36

Component Interface

Validating a CI

Open the component interface in PeopleSoft Application Designer.

Validation occurs automatically whenever you open a component interface in PeopleSoft Application Designer.

Select Tools, Validate for Consistency from the PeopleSoft Application Designer menu to validate an open component interface.

As you change components or other related definitions, you should validate a component interface that is already open in PeopleSoft Application Designer.

Page 37: People Soft Component Interface - A Complete Guide

37

Component Interface

Working with a CI – Setting Security

Two ways to Secure Component Interfaces

Maintain Security

• Can be used to restrict access to individual methods or entire

Component Interface

Application Designer

• To make individual property ‗Read Only‘

• To delete property from CI

Page 38: People Soft Component Interface - A Complete Guide

38

Component Interface

Working with a CI – Setting Security (contd.)

After creating a component interface, you must set security for it. Each individual method also needs to be provided security. Security for the component interface is provided through the PeopleSoft Internet Architecture pages.

Page 39: People Soft Component Interface - A Complete Guide

39

Component Interface

Working with a CI – Setting Security (contd.)

Through the browser login to PIA. Select PeopleTools, Security, Permissions & Roles, Permission Lists.

Select the permission list for which you want to set security.

The Permission List component appears.

Access the Component Interfaces page.

Select the component interface for which you want to set security.

To add another component interface to the list, click the Add button.

Click Edit.

The Component Interface Permissions page appears, showing all of the methods (both standard and user-defined) in the component interface and their method access.

Set the access permission for each method.

Select Full Access or No Access. You must grant full access to at least one method to make the component interface available for testing and other online use.

Click OK when you're done.

Press the Save button to save these settings.

Page 40: People Soft Component Interface - A Complete Guide

40

Component Interface

Working with a CI – Using the CI Tester

Open the component interface in PeopleSoft Application Designer.

Select Tools, Test Component Interface from the PeopleSoft Application Designer menu.

The Component Interface Tester search dialog box appears. This dialog box displays the keys (in the left-hand columns) for getting, creating, or finding an instance of the component interface. The right-hand columns provide a place for you to enter sample key values for testing.

Enter key values.

Double-click the column to the right of any displayed keys.

Enter the value in the right-hand column.

The data that is used for the test corresponds to the key values that you enter here.

Page 41: People Soft Component Interface - A Complete Guide

41

Component Interface

Working with a CI – Using the CI Tester (contd.)

Specify whether to run in Interactive mode.

When in Interactive Mode, any action request occurs immediately. Each

property being set causes an immediate trip to the application server (or

database server in two-tier mode). This differs from non-interactive mode, in

which actions are often held and later sent in batches. For example, in non-

interactive mode, if you set a property, the property is not validated until you

perform the save. However, in interactive mode the property is validated

immediately. This means that edit processing (and other processing, such

as FieldChange PeopleCode) occurs for each set property.

Whether you select this option depends on how you expect a particular

component interface to be used and what you are currently testing. In a real

production system, this parameter can significantly affect performance, but it

makes little difference in the test component. In non-interactive mode, errors

and properties are not updated until a method is run. By default, Interactive

Mode is selected in the component interface tester.

Page 42: People Soft Component Interface - A Complete Guide

42

Component Interface

Working with a CI – Using the CI Tester (contd.)

Specify whether to get or edit history items.

Selecting Get History Items retrieves history data. Selecting Edit History Items enables editing and saving of history data. These options apply to effective-dated fields only and are equivalent to running in either Update/Display or Correction mode online. These options are initially cleared.

Getting existing records for the test.

Clicking Get Existing is equivalent to opening a record in Update/Display or Correction mode online. It retrieves one row from the database. After you click the Get Existing button, the Component Interface Tester dialog box appears.

Page 43: People Soft Component Interface - A Complete Guide

43

Component Interface

Working with a CI – Using the CI Tester (contd.)

Getting existing records using partial keys.

If you want to retrieve a partial key, click the Find button. The Find Results dialog box appears. You then can choose the specific instance by selecting and clicking the Get Selected button. If you do not enter a partial key before clicking Find, all key values in the database are returned (subject to the maximum count of 300, just as when online). This is the same as calling the Find method through the Component Interface API, followed by selecting a value from the Find results, setting the Get key, and calling the Get method. After you click the Get Selected button, the Component Interface Tester dialog box appears.

Creating new records for the test.

Clicking Create New is equivalent to creating a new row in Add mode online. If your component does not support the Create method, this button is disabled. After you click the Create New button, the Component Interface Tester dialog box appears.

Page 44: People Soft Component Interface - A Complete Guide

44

Component Interface

Testing the CI

Tester can be used to test CI.

With the component interface tester, you can:

Test the component interface in interactive mode.

Retrieve history items.

Test the standard, custom, and collection methods.

To test the component interface, you first search for the component

interface to test, then you test it.

Page 45: People Soft Component Interface - A Complete Guide

45

Component Interface

Testing the CI (contd.)

Page 46: People Soft Component Interface - A Complete Guide

46

Component Interface

Excel the CI

How to upload data from Excel into PeopleSoft using the Component Interface to execute business logic for each transaction ?

Use the Excel to Component Interface utility to upload data from Microsoft Excel into your PeopleSoft database, using component interfaces.

Microsoft Excel workbooks can be used as a template to create worksheets that are specific to the business logic that you need to use when you are uploading data to your PeopleSoft system.

The code formats spreadsheet data into a PeopleSoft readable Document Object Model (DOM) structure, and submits it to the PeopleSoft database.

Next a PeopleCode program parses the DOM structure and uses the component interface to create entries in the PeopleSoft database, validating the data submitted against the business logic built into the PeopleSoft component.

The component interface executes all the necessary PeopleCode events and the field-level edits. Based upon results from saving the component interface, another DOM is created in the PeopleCode that returns success, warnings, and/or errors to the Microsoft Excel document.

Page 47: People Soft Component Interface - A Complete Guide

47

Component Interface

Building a CI from the “Excel to CI” Utility

Fields that are not relevant for data input should not be exposed on the

component interface.

Reduces processing time when loading data

Saves time when building the template

Components that have no keys at level 0, but rely on logic at level 0 to load the

level 1 collection, cannot be loaded by using the Excel to Component Interface

utility.

Component interfaces that rely on CommitWork to save the data cannot be

used in the Excel to Component Interface utility.

Prompt and translate table values are validated when data is saved and

submitted to the database through the Excel to Component Interface utility.

This different from the behavior on the page when prompts and translates are

validated interactively.

Page 48: People Soft Component Interface - A Complete Guide

48

Component Interface

Building a CI from the “Excel to CI” Utility (contd.)

Testing the Component Interface

First Test the component interface using the tester as it enables you to

troubleshoot any problems before running the component interface through

the utility.

Performance Expectations

If the component has a complex user interface with many pages and scrolls,

the component interface generally will have a slower processing time.

PeopleCode Behavior and Limitations

PeopleCode events and functions that relate exclusively to the page

interface and online processing cannot be used by component interfaces.

Search dialog processing.

Menu PeopleCode and pop-up menus.

Transfers between components, including modal transfers.

Dynamic tree controls.

ActiveX controls.

DoSave and DoSaveNow.

Functions that are ignored in a component interface call.

Page 49: People Soft Component Interface - A Complete Guide

49

Component Interface

Getting Started with the “Excel to CI” Utility

1. To launch the Excel to Component Interface utility, you will need to locate

the ExcelToCI.xls executable file in the PS_HOME\excel folder.

2. Grant Access to WEBLIB_SOAPTOCI

3. Enable Macros in Excel

4. The coversheet of the Excel to Component Interface utility workbook gives a

brief overview of the process flow and functionality of the tool.

5. Enter Connection Information

6. Connect to the Database to Create a Template and Submit Data

7. Create a Template. Template page is a graphical representation of the

component interface structure that you would be using to upload the data.

8. Access the Data Input tab to enter data

9. Access the Staging and Submission tab to submit data.

Page 50: People Soft Component Interface - A Complete Guide

50

Component Interface

Getting Started with the “Excel to CI” Utility (contd.)

Page 51: People Soft Component Interface - A Complete Guide

51

Component Interface

Getting Started with the “Excel to CI” Utility (contd.)

Page 52: People Soft Component Interface - A Complete Guide

52

Component Interface

Getting Started with the “Excel to CI” Utility (contd.)

Page 53: People Soft Component Interface - A Complete Guide

53

Component Interface

Getting Started with the “Excel to CI” Utility (contd.)

Data Input sheet enables you to enter data into the Excel to Component

Interface utility so that it can be loaded to the database by using the

component interface that you've selected.

Field labels that appear on the Data Input sheet are those properties that

you selected as input cells on the template

Data Input sheet is also used to correct data that failed to submit to the

database.

Page 54: People Soft Component Interface - A Complete Guide

54

Component Interface

Getting Started with the “Excel to CI” Utility (contd.)

Page 55: People Soft Component Interface - A Complete Guide

55

Component Interface

Programming Component Interfaces in Java

To access your component interface from a Java external application, create

a component interface API.

APIs are in the form of *.java source code files, which should be compiled

into Java classes.

When deploying component interfaces on a local client machine or web

server with Java bindings, you must have:

The third party Java application.

The PeopleSoft application server and database.

The Java Virtual Machine (JVM) supplied with Sun Microsystems‘ Java

Development Kit (JDK) found in the %PS_HOME%\JRE directory.

To access a component interface through PeopleSoft APIs using Java,

PeopleSoft Application Designer generates a template in the form of

boilerplate Java code that you can adapt to your purposes.

Page 56: People Soft Component Interface - A Complete Guide

56

Component Interface

Programming Component Interfaces in Java (contd.)

Generating Java Template

Page 57: People Soft Component Interface - A Complete Guide

57

Component Interface

Runtime Considerations

In many ways, accessing a component interface is functionally equivalent to working with an online component. However, there are some important differences between component interfaces and components.

WinMessage Unavailable

You cannot use WinMessage in a component that will be used to build a component interface. Use MsgGet() instead.

Email from a Component Interface

To use a component interface to send email, use TriggerBusinessEvent PeopleCode event, not SendMail.

Related Display

Related display fields are not available for use in a component interface as they are not held in the buffer context that the component interface uses.

Row Inserts

If RowInserts have been disabled for a page, you must take care when calling inserts against the corresponding component interface. Any PeopleCode associated with push buttons used on the page to add rows will not be invoked by the component interface when an insert is done.

Page 58: People Soft Component Interface - A Complete Guide

58

Component Interface

Runtime Considerations (contd.)

Infinite Processing Loops

A component interface should not call itself in any of the PeopleCode included within its component definition, as this may result in an infinite loop of the CI. A component interface also should not call itself from a user-defined method.

Multiple Instances of a Component Interface

Because of potential memory conflicts, COM or C++ applications should not create multiple, simultaneous instances of the same component interface, either within a single procedure, or in both a ―parent‖ and a ―child‖ procedure.

UNIX Server Performance

If you‘re using a component interface as part of a batch process in which thousands of rows are being inserted, running in interactive mode may reduce performance enough on some UNIX servers to produce a connection failure. Prevent this by setting the InteractiveMode property to False.

Hidden Edit Validation Errors

If the InteractiveMode property is set to True, and if a transaction sets a property to a value that isn't allowed in a prompt edit field, the edit field value is reset back to its original value. The error is logged in the PSMessages collection; however, the Save method runs without errors. Check the value of both Save method and collection ErrorPending property to discover all errors.

Page 59: People Soft Component Interface - A Complete Guide

59

Component Interface

Runtime Considerations (contd.)

Some PeopleCode functions are ignored if they are called through a CI. They are:

WinMessage

CheckMenuItem/ UncheckMenuItem

EnableMenuItem/ DisableMenuItem

HideMenuItem

SetCursorPos

TransferPage

IsModalComponent

DoModalComponent

GetSelectedTreeNode

GetTreeNodeParent

RefreshTree

TreeDetailInNode

GetControl

DoSave

DoSaveNow

Gray/ Ungray

Page 60: People Soft Component Interface - A Complete Guide

60

Component Interface

Examples

User need to upload multiple jobcode into jobcode_tbl which are newly created and it will take lot of time to manually insert each and every job code.

Solution : Create a CI for jobcode table . Create a process which will read file where all the newly jobcode data will be present and load the data using CI which is newly created.

CI will take care all the validation while inserting rows for newly created jobcodes in jobcode table.

Page 61: People Soft Component Interface - A Complete Guide

61

Component Interface

Examples (contd.)

Steps to follow:

Create a CI for Jobcode table

Name:CI_JOB_CODE_TBL

Open the application designer.

Click on the File->New>Component Interface. Following Screen is shown on

clicking the OK button.

Enter Job_Code_TBL Component. Click on the Select

Page 62: People Soft Component Interface - A Complete Guide

62

Component Interface

Examples (contd.)

Choose a Component of whose interface you want to develop and click on

"Select". Following message box is shown after clicking "Select" which

essentially asks whether all the default properties of component should

ported to the interface or not

Click on Yes or No per your discretion, though 'Yes' will be better moving

ahead.

Page 63: People Soft Component Interface - A Complete Guide

63

Component Interface

Examples (contd.)

New Component Definition will be created with all the keys.

Page 64: People Soft Component Interface - A Complete Guide

64

Component Interface

Examples (contd.)

Create a file layout to read the file.

Create a application Engine to read the file and load the data into Jobcode

table using CI.

Page 65: People Soft Component Interface - A Complete Guide

65

Component Interface

Code to read the file through file layoutFunction EditRecord(&REC As Record) Returns boolean;

Local integer &E;

REM &REC.ExecuteEdits(%Edit_Required + %Edit_DateRange + %Edit_YesNo + %Edit_TranslateTable + %Edit_PromptTable + %Edit_OneZero);

&REC.ExecuteEdits(%Edit_Required + %Edit_DateRange + %Edit_YesNo + %Edit_OneZero);

If &REC.IsEditError Then

For &E = 1 To &REC.FieldCount

&MYFIELD = &REC.GetField(&E);

If &MYFIELD.EditError Then

&MSGNUM = &MYFIELD.MessageNumber;

&MSGSET = &MYFIELD.MessageSetNumber;

&LOGFILE.WriteLine("****Record:" | &REC.Name | ", Field:" | &MYFIELD.Name);

&LOGFILE.WriteLine("****" | MsgGet(&MSGSET, &MSGNUM, ""));

End-If;

End-For;

Return False;

Else

Return True;

End-If;

End-Function;

Function ImportSegment(&RS2 As Rowset, &RSParent As Rowset)

Local Rowset &RS1, &RSP;

Local string &RecordName;

Local Record &REC2, &RECP;

Local SQL &SQL1;

Local integer &I, &L;

&SQL1 = CreateSQL("%Insert(:1)");

&RecordName = "RECORD." | &RS2.DBRecordName;

&REC2 = CreateRecord(@(&RecordName));

&RECP = &RSParent(1).GetRecord(@(&RecordName));

For &I = 1 To &RS2.ActiveRowCount

&RS2(&I).GetRecord(1).CopyFieldsTo(&REC2);

If (EditRecord(&REC2)) Then

&SQL1.Execute(&REC2);

&RS2(&I).GetRecord(1).CopyFieldsTo(&RECP);

For &L = 1 To &RS2.GetRow(&I).ChildCount

&RS1 = &RS2.GetRow(&I).GetRowset(&L);

If (&RS1 <> Null) Then

&RSP = &RSParent.GetRow(1).GetRowset(&L);

ImportSegment(&RS1, &RSP);

End-If;

End-For;

Page 66: People Soft Component Interface - A Complete Guide

66

Component Interface

Code to read the file through file layout (contd.)

If &RSParent.ActiveRowCount > 0 Then

&RSParent.DeleteRow(1);

End-If;

Else

&LOGFILE.WriteRowset(&RS);

&LOGFILE.WriteLine("****Correct error in this record and delete all error messages");

&LOGFILE.WriteRecord(&REC2);

For &L = 1 To &RS2.GetRow(&I).ChildCount

&RS1 = &RS2.GetRow(&I).GetRowset(&L);

If (&RS1 <> Null) Then

&LOGFILE.WriteRowset(&RS1);

End-If;

End-For;

End-If;

End-For;

End-Function;

rem *****************************************************************;

rem * PeopleCode to Import Data *;

rem *****************************************************************;

Local File &FILE1;

Local Record &REC1;

Local SQL &SQL1;

Local Rowset &RS1, &RS2;

Local integer &M;

&FILE1 = GetFile("C:\Documents and Settings\user1\Desktop\jobcode.csv", "r", "a", %FilePath_Absolute);

&LOGFILE = GetFile("C:\Documents and Settings\user1\Desktop\jobcode_err.txt", "W",

%FilePath_Absolute);

&FILE1.SetFileLayout(FileLayout.CI_TEST);

&LOGFILE.SetFileLayout(FileLayout.CI_TEST);

&RS1 = &FILE1.CreateRowset();

&RS = CreateRowset(Record.TEST);

&SQL1 = CreateSQL("%Insert(:1)");

&RS1 = &FILE1.ReadRowset();

While &RS1 <> Null;

ImportSegment(&RS1, &RS);

&RS1 = &FILE1.ReadRowset();

End-While;

&FILE1.Close();

&LOGFILE.Close();

Page 67: People Soft Component Interface - A Complete Guide

67

Component Interface

Code To load data through CI

/* ===>

This is a dynamically generated PeopleCode template to be used only as a helper

to the application developer.

You need to replace all references to '[*]' OR default values with references to

PeopleCode variables and/or a Rec.Fields. */

Local File &fileLog;

Local ApiObject &oSession, &oCiJobCodeTbl;

Local ApiObject &oSetJobBuVwCollection, &oSetJobBuVw;

Local ApiObject &oCollJobcodeTblCollection, &oCollJobcodeTbl;

Local ApiObject &oJobcodeTblBraCollection, &oJobcodeTblBra;

Local ApiObject &oJobcdTrnProgCollection, &oJobcdTrnProg;

Local ApiObject &oJbcdCmpRt2VwCollection, &oJbcdCmpRt2Vw;

Local ApiObject &oJbcdCmpRt3VwCollection, &oJbcdCmpRt3Vw;

Function errorHandler()

Local ApiObject &oPSMessageCollection, &oPSMessage;

Local number &i;

Local string &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;

&oPSMessageCollection = &oSession.PSMessages;

For &i = 1 To &oPSMessageCollection.Count

&oPSMessage = &oPSMessageCollection.Item(&i);

&sErrMsgSetNum = &oPSMessage.MessageSetNumber;

&sErrMsgNum = &oPSMessage.MessageNumber;

&sErrMsgText = &oPSMessage.Text;

&fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " |

&sErrMsgText);

End-For;

rem ***** Delete the Messages from the collection *****;

&oPSMessageCollection.DeleteAll();

End-Function;

Page 68: People Soft Component Interface - A Complete Guide

68

Component Interface

Code To load data through CI (contd.)try

rem ***** Set the Log File *****;

&fileLog = GetFile("C:\Temp\CI_JOB_CODE_TBL.log", "w", "a", %FilePath_Absolute);

&fileLog.WriteLine("Begin");

rem ***** Get current PeopleSoft Session *****;

&oSession = %Session;

rem ***** Set the PeopleSoft Session Error Message Mode *****;

rem ***** 0 - None *****;

rem ***** 1 - PSMessage Collection only (default) *****;

rem ***** 2 - Message Box only *****;

rem ***** 3 - Both collection and message box *****;

&oSession.PSMessagesMode = 1;

&RS = CreateRowset(Record.TEST);

&RS.fill("");

For &i = 1 To &RS.activerowcount

&REC1 = &RS.GetRow(&i).getrecord(Record.TEST);

&setid = &REC1.GetField(Field.SETID).Value;

&jobcode = &REC1.GetField(Field.JOBCODE).Value;

&effdt = &REC1.GetField(Field.EFFDT).Value;

&status = &REC1.GetField(Field.EFF_STATUS).Value;

&descr = &REC1.GetField(Field.DESCR).Value;

&descrshort = &REC1.GetField(Field.DESCRSHORT).Value;

&std_hrs = &REC1.GetField(Field.STD_HOURS).Value;

&manager_level = &REC1.GetField(Field.MANAGER_LEVEL).Value;

&comp_frequency = &REC1.GetField(Field.COMP_FREQUENCY).Value;

rem ***** Get the Component Interface *****;

&oCiJobCodeTbl = &oSession.GetCompIntfc(CompIntfc.CI_JOB_CODE_TBL);

If &oCiJobCodeTbl = Null Then

errorHandler();

throw CreateException(0, 0, "GetCompIntfc failed");

End-If;

Page 69: People Soft Component Interface - A Complete Guide

69

Component Interface

Code To load data through CI (contd.)rem ***** Set the Component Interface Mode *****;

&oCiJobCodeTbl.InteractiveMode = False;

&oCiJobCodeTbl.GetHistoryItems = True;

&oCiJobCodeTbl.EditHistoryItems = False;

rem ***** Set Component Interface Get/Create Keys *****;

&oCiJobCodeTbl.KEYPROP_SETID = &setid;

&oCiJobCodeTbl.KEYPROP_JOBCODE = &jobcode;

&fileLog.WriteLine("&oCiJobCodeTbl.KEYPROP_SETID = &setid" | &setid);

&fileLog.WriteLine("&oCiJobCodeTbl.KEYPROP_JOBCODE" | &jobcode);

rem ***** Execute Get *****;

If Not &oCiJobCodeTbl.Get() Then

rem ***** No rows exist for the specified keys.*****;

rem errorHandler();

rem throw CreateException(0, 0, "Get failed");

&fileLog.WriteLine("&oCiJobCodeTbl.KEYPROP_SETID = &setid" | &setid);

&fileLog.WriteLine("&oCiJobCodeTbl.KEYPROP_JOBCODE" | &jobcode);

rem ***** Execute Create ******;

If Not &oCiJobCodeTbl.Create() Then

rem ***** Unable to Create Component Interface for the Add keys provided. *****;

errorHandler();

throw CreateException(0, 0, "Create failed");

End-If;

End-If;

rem ***** Begin: Get/Set Component Interface Properties *****;

rem ***** Set/Get SET_JOB_BU_VW Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oSetJobBuVwCollection = &oCiJobCodeTbl.SET_JOB_BU_VW;

Local integer &i111;

For &i111 = 1 To &oSetJobBuVwCollection.Count;

&oSetJobBuVw = &oSetJobBuVwCollection.Item(&i111);

End-For;

rem ***** Set/Get COLL_JOBCODE_TBL Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oCollJobcodeTblCollection = &oCiJobCodeTbl.COLL_JOBCODE_TBL;

Local integer &i113;

For &i113 = 1 To &oCollJobcodeTblCollection.Count;

&oCollJobcodeTbl = &oCollJobcodeTblCollection.Item(&i113);

&fileLog.WriteLine("&oCollJobcodeTbl.KEYPROP_EFFDT = " | &oCollJobcodeTbl.KEYPROP_EFFDT);

&oCollJobcodeTbl.KEYPROP_EFFDT = &effdt;

Page 70: People Soft Component Interface - A Complete Guide

70

Component Interface

Code To load data through CI (contd.)&fileLog.WriteLine("&oCollJobcodeTbl.PROP_EFF_STATUS = " | &oCollJobcodeTbl.PROP_EFF_STATUS);

&oCollJobcodeTbl.PROP_EFF_STATUS = &status;

&fileLog.WriteLine("&oCollJobcodeTbl.PROP_DESCR = " | &oCollJobcodeTbl.PROP_DESCR);

&oCollJobcodeTbl.PROP_DESCR = &descr;

&fileLog.WriteLine("&oCollJobcodeTbl.PROP_DESCRSHORT = " |

&oCollJobcodeTbl.PROP_DESCRSHORT);

&oCollJobcodeTbl.PROP_DESCRSHORT = &descrshort;

&fileLog.WriteLine("&oCollJobcodeTbl.PROP_MANAGER_LEVEL = " |

&oCollJobcodeTbl.PROP_MANAGER_LEVEL);

&oCollJobcodeTbl.PROP_MANAGER_LEVEL = &manager_level;

&fileLog.WriteLine("&oCollJobcodeTbl.PROP_STD_HOURS = " | &oCollJobcodeTbl.PROP_STD_HOURS);

&oCollJobcodeTbl.PROP_STD_HOURS = &std_hrs;

&fileLog.WriteLine("&oCollJobcodeTbl.PROP_COMP_FREQUENCY = " |

&oCollJobcodeTbl.PROP_COMP_FREQUENCY);

&oCollJobcodeTbl.PROP_COMP_FREQUENCY = &comp_frequency;

End-For;

rem ***** End: Get/Set Component Interface Properties *****;

rem ***** Execute Save *****;

If Not &oCiJobCodeTbl.Save() Then;

errorHandler();

throw CreateException(0, 0, "Save failed");

End-If;

rem ***** Execute Cancel *****;

If Not &oCiJobCodeTbl.Cancel() Then;

errorHandler();

throw CreateException(0, 0, "Cancel failed");

End-If;

End-For;

catch Exception &ex

rem Handle the exception;

&fileLog.WriteLine(&ex.ToString());

end-try;

&fileLog.WriteLine("End");

&fileLog.Close();

Page 71: People Soft Component Interface - A Complete Guide

71

Component Interface

Execution Steps (for the example)

Create a data file csv.

Run the application engine. The application engine willl load the jobcodes

created.

Page 72: People Soft Component Interface - A Complete Guide

72

Component Interface

Assignment

Load the job data for the existing employees through component

interface .

Test file :

Emplid Effdt Empl_rcd Action Action Reason

49588 07/01/2011 0 DTA SUP

49588 07/01/2011 0 PAY APR

Hints : Create a csv file using the format mentioned in the test file to upload the

data.

Create a file layout to read the data.

Create a CI for job data component to upload the data.

Create a process which will read the data from file and upload data through CI.

Page 73: People Soft Component Interface - A Complete Guide

73

About SOAIS

SOAIS is a provider of Enterprise IT and Process outsourcing solutions. Since its inception

SOAIS has expanded at a tremendous pace and has garnered customers from both mid-

market segment and Fortune 100 companies. We have experience in managing ERP

applications as well as in providing high value services around packaged enterprise

applications such as PeopleSoft and Oracle. Our experience in the business process

outsourcing area fully extends our services footprint to provide end to end enterprise wide

solutions. See www.soais.com for information.

You can send queries or provide feedback on this solution at

http://www.soais.com click on “Ask the Expert” link or

send an email to [email protected]