file attachment functionality.pdf

19
SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360 File Attachment Functionality Table of Contents 1 INTRODUCTION .................................................................................................................................................................. 2 2 AN OVERVIEW OF THE PROJECT CREATED: ....................................................................................................................... 3 2.1 RECORDS: ...................................................................................................................................................................... 3 2.2 PAGE: ........................................................................................................................................................................... 4 2.3 COMPONENT: ................................................................................................................................................................. 5 2.4 PEOPLECODE:................................................................................................................................................................. 6 2.5 URL: ............................................................................................................................................................................ 7 3 FILE ATTACHMENT: TEXT FILE (TEST_FILE.TXT) ................................................................................................................. 9 4 FILE ATTACHMENT: EXCEL FILE (TEST_FILE2.XLSX) .......................................................................................................... 13 5 FUNCTIONS FOR ATTACHING AND RETRIEVING THE FILE IN PEOPLECODE .................................................................... 16 6 APPENDIX ......................................................................................................................................................................... 18

Upload: ricarmill

Post on 18-Jul-2016

227 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

File Attachment Functionality

Table of Contents

1 INTRODUCTION .................................................................................................................................................................. 2

2 AN OVERVIEW OF THE PROJECT CREATED: ....................................................................................................................... 3

2.1 RECORDS: ...................................................................................................................................................................... 3 2.2 PAGE: ........................................................................................................................................................................... 4 2.3 COMPONENT: ................................................................................................................................................................. 5 2.4 PEOPLECODE: ................................................................................................................................................................. 6 2.5 URL: ............................................................................................................................................................................ 7

3 FILE ATTACHMENT: TEXT FILE (TEST_FILE.TXT) ................................................................................................................. 9

4 FILE ATTACHMENT: EXCEL FILE (TEST_FILE2.XLSX) .......................................................................................................... 13

5 FUNCTIONS FOR ATTACHING AND RETRIEVING THE FILE IN PEOPLECODE .................................................................... 16

6 APPENDIX ......................................................................................................................................................................... 18

Page 2: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

1 INTRODUCTION

This document emphasizes file attachment functionality in PeopleSoft. It describes attaching a file to a specific

location and also contains a sample file attachment application which can ‘Add’, ‘View’, ‘Delete’ and

‘Detach’(Download) a file.

The file attachment functionality in PeopleSoft is basically dependent on the user requirements i.e. to and

from where a user wants the file to be uploaded and downloaded respectively. Generally, a file gets uploaded

into FTP Server wherein an application server acts as a middle tier.

We can upload files of any type and any size. Also, the file type and size can be restricted by this functionality,

which gives more flexibility to the user. Generally the file type needs to be windows supported, for example

".doc", ".txt",".jpg",".html", “.xls” or ".exe" etc.

By clicking the ‘Attach’ button the file is uploaded to the storage location. After attaching, View, Delete and

Detach buttons appear automatically and from there it can be viewed, deleted or detached again.

The page allows the database path can be directly specified or storing the storage location for the file as a URL

identifier.

Page 3: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

2 AN OVERVIEW OF THE PROJECT CREATED:

2.1 Records:

1. ATT_FILE_TEST

Create new record with the only sub-record FILE_ATTDET_SBR in it. No other fields should be added

to this record. It will hold the attached file.

2. TEST_ATTACH_WRK

TEST_ATTACH_WRK table is cloned from the delivered derived/work record definition

FILE_ATTACH_WRK. The delivered record FILE_ATTACH_WRK is not directly used as any modifications

to it may affect other delivered programs using this record. This cloning will be helpful for future

Page 4: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

modifications as the delivered record FILE_ATTACH_WRK will not be affected. All the record People

Code associated with FILE_ATTACH_WRK also needs to be moved to the new record.

2.2 Page:

Below is the screenshot for the sample page ATT_TEST_PAGE.

Structure of the page:

Page 5: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

The page should contain the fields ATTACHSYSFILENAME and ATTACHUSERFILE mandatorily. This can also be

stored in a separate record and can be used in the page. In the current scenario it has been directly taken from

the record FUNCLIB_UTIL.

When the application is uploading, downloading or deleting files:

ATTACHSYSFILENAME – It stores the system file name which is the name present in the storage

location. This can be either ATTACHUSERFILE name itself or can be programmatically given a

unique name so that no file is over-written due to same file name. After uploading, all other

operation can be done using this file name as it is passed as a parameter to the delivered People

Code to retrieve the correct file.

ATTACHUSERFILE – It stores the User File Name. It stores the exact name of the file given by

the end user. In the below examples, ATTACHUSERFILE and ATTACHSYSFILENAME stores the

same value.

2.3 Component:

This can be implemented in an existing component. But in the current application a new component has been

created which contains the page ATT_TEST_PAGE.

Page 6: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

Structure of the Component:

2.4 PeopleCode:

The below PeopleCode needs to be added in the Component PeopleCode of:

1. TEST_ATTACH_WRK.RowInit

2. ATTACHADD.FieldChange

3. ATTACHDET.FieldChange

Page 7: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

4. ATTACHDELETE.FieldChange

5. ATTACHVIEW.FieldChange

A new menu ATT_TEST_MENU has been created for this application. It can also be implemented in an already

existing menu.

2.5 URL:

Add a new URL which specifies the record name that stores the attached file.

Page 8: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

Note: This is not necessary if the file is stored directly into the Database as the ftp path to the server can be

directly given in the file attachment page.

Page 9: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

3 FILE ATTACHMENT: TEXT FILE (TEST_FILE.TXT)

Add Attachment:

Step1: Provide the URL which contains the location to store the File.

Step2: Attach the file

Page 10: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

Note: When the file is attached; View, Delete and Detach buttons are populated automatically.

Below is the screenshot from database of the record storing the file attchment.

View Attachment:

The attachment is viewed by clicking the ‘View’ Button.

Page 11: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

Detach Attachment:

It is used to download a file from the storage location and save it locally on the end user machine.

Delete Attachment:

It deletes the file from the specified storage location.

Page 12: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

Below screenshot shows that, the attachment has been deleted from the database.

Page 13: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

4 FILE ATTACHMENT: EXCEL FILE (TEST_FILE2.XLSX)

Add Attachment:

Page 14: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

View Attachment:

Page 15: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

Delete attachment:

Below screenshot shows that the attachment has been deleted from the database.

Page 16: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

5 FUNCTIONS FOR ATTACHING AND RETRIEVING THE FILE IN PEOPLECODE

Syntax for AddAttachment Function

AddAttachment (URLDestination, DirAndFilename, FileType, UserFile [, MaxSize] [, PreserveCase,

UploadPageTitle]

URLDestination : It is the reference to the URL or the URL name itself. An URL object can be created and

referred to here or the URL can be directly specified here. E.g.: URL.RECORD_NAME or

“record: //FORM_ATTACH_RCD”

DirAndFilename : The Full URL of the file in the Local system.

File Type : A string suggesting the possible file extensions (“.doc”,”.rtf”). But this doesn’t restrict the

user from attaching files of other types. Passing a NULL will invoke all the files. The File

types can be restricted by adding appropriate People Codes which will delete the files.

User File : The name of the file in source system. When the file is transferred, characters like space, :,

$, # etc. will be replaced by an underscore, in the file name.

MaxSize : Give the size limit in terms of Kilo Bytes. Specify ‘0’ to make size limit as unlimited. The

default value is also ‘0’. It’s an optional parameter.

PreserveCase : A Boolean value to indicate if the case of directory and file name specified in

DirAndFilename should be preserved or not. If true it’s preserved, else all are changed to

small.

UploadPageTitle : Specify a string to be displayed as title in the File Upload page.

Syntax for GetAttachment Function

GetAttachment(URLSource, DirAndSysFileName, DirAndLocalFileName[, LocalDirEnvVar[, PreserveCase]])

URLSource : Specifies the URL from the where file has to be retrieved.

DirAndSysFileName : Specifies the file name and relative path of the source file. This along with the URLSource forms the full path for the source file.

DirAndLocalFileName : This specifies the path and file name of the destination file.

LocalDirEnvVar : This is an optional parameter. If specified it gets prefixed in DirAndLocalFileName and forms the full path name for the destination folder. If not specified it will take only DirAndLocalFileName as the path.

PreserveCase : It specifies whether the case of the file extension of the source file is preserved or not. It is a Boolean value and by default it is false. False value preserves the extension case.

Syntax for PutAttachment Function

PutAttachment(URLDestination, SysFileName, LocalFile [, LocalDirEnvVar [, PreserveCase]])

URLDestination : This is the reference to the URL in the file server wherein the file will be uploaded. This can

Page 17: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

be an URL definition or a string.

SysFileName : The relative path and the file name of the file to be on the server. This is appended with

the URLDestination to make a complete URL.

LocalFile : The full path and the file name of the file in the App Server. This can be the LocalFile which

was specified in the GetAttachment function.

LocalDirEnvVar : The name of the environment variable containing the path information of the App Server.

PreserveCase: A Boolean value to indicate if the case of directory and file name specified in

SysFileName should be preserved or not.

1. If the file is stored directly into the server.

The file to be attached can be placed into the server by providing the ftp path in the file attachment

page. This file can be accessed in a PeopleCode by directly specifying the path and then the using the

GetFile function to retrieve it.

2. If the file is stored into a record.

When a file is stored into the field of a record, (like the examples in the document) it can be accessed

in a PeopleCode with GetAttachment function.

This function downloads the file from the source location (i.e. the record. Field) to the file system of

the server. From there it can be accessed using the GetFile function.

Syntax for GetFile Function

GetFile(filename,mode [, charset] [, pathtype])

Filename : Specifies the name of the file to be opened. It can be specified along with the path.

Mode : Specifies the method of accessing the file. For example: “R” for reading, “W” for writing ,”A”

for appending at the end of the file without removing the existing contents. ”E” mode opens

the file only if it exists.

Charset : Specifies the charset to be used while reading the file. For example: ”A” for ANSI and “U” for

Unicode

Pathtype : Specifies whether the path for the file name is relative or absolute. Values that it can store

are: %FilePath_Relative (default) and %FilePath_Absolute

Page 18: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

6 APPENDIX

The sample files used for Uploading:

1. Text File: Test_File

2. Excel File: Test_File2

Test File2.xlsx

Page 19: File Attachment Functionality.pdf

SkyBridge Global, Inc. 161 Village Parkway NE; Building 7 Marietta, GA 30067 Phone: 770-373-2300 - Fax: 770-953-8360

About the Authors

Prabir Mehta is an Engagement Manager with 12 years of experience leading multi-phase, multi-resource

PeopleSoft HCM and Portal projects. At SkyBridge, Prabir manages the development, testing and deployment of

PayMatch®, and manages the SkyBridge Application Management Services team.

About SkyBridge Global

SkyBridge Global is an Atlanta-based integration and consulting form and an Oracle Platinum Partner. SkyBridge

helps Emerging, Mid-Market and Enterprise companies evaluate, implement and support Oracle Applications

and Technology related solutions with a focus on Oracle’s PeopleSoft Enterprise, Enterprise Business Suite,

Oracle Fusion Applications and Business Intelligence solutions. Founded in 1998, SkyBridge is an industry leader

and has assisted more than 250 clients throughout the US and North America.

Website:

http://www.skybridgeglobal.com/

PayMatch® For Payroll:

http://www.skybridgeglobal.com/solutions/peoplesoft/paymatch-for-payroll.aspx

SkyBridge Application Management Services:

http://www.skybridgeglobal.com/our-services/application-management.aspx