In the next article we are going to explain several examples of how to manage files in PeopleSoft.  We will show the code and steps that we will need to follow:

  •          Create a file in a directory.
  •          Post a file in the log/trace of the app Engine.
  •          Move files between directories.

Create a file in a directory:

/*Declare variables*/

Local File &fileLog;

We have to specify the path where we are going to create and add %FilePath_Absolute*,  also we have to specify what we want to do with that  file and we do putting a state, for example:

  • “R” (Read mode): opens the file for reading, starting at the beginning.
  • “W” (Write mode): opens the file for writing.
  • “A” (Append mode): opens the file for writing, starting at the end. Any existing content is retained.
  • “U” (Update mode): opens the file for reading or writing, starting at the beginning of the file. Any existing content is retained. Use this mode and the GetPosition and SetPosition methods to maintain checkpoints of the current read/write position in the file.
&fileLog = GetFile(“C:\Interfaz\” | APP_ENG_AET.PROCESS_INSTANCE.Value | “_” | &Arch | “.log”, “a”, %FilePath_Absolute);

&fileLog.WriteLine(“Begin”); /*write into the file*/

&fileLog.Close(); /*Close the file*/

Send the file to the log/trace of the application engine.

We will use the next query to get the path where we have to put the log file in the server, also we can use GetEnv(“PS_SERVDIR”) to extrar the path:


This query return the type of server where the process was run.

/* Assume that the NT server’s name is “PSNT”. */If &serverrun = “PSNT” Then /*If it is windows*/  

 &DirSep = “\”;


Else  /*If it is UNIX*/


 &DirSep = “/”;


&fileLog1 = GetFile(&path | &DirSep | “Z_PO_CI_” | APP_ENG_AET.PROCESS_INSTANCE.Value | “_” | &Arch | “.log”, “a”, %FilePath_Absolute);


Move files between directories

Local string &file1, &file2, &FileName, &newpath;

Local JavaObject &f, ⌖

First we Declare the URL objects in PeopleSoft application with the path where we are going to get the files and where we are going to move it.

&oldpath = GetURL(URL.RUTA_A);

&newpath = GetURL(URL.RUTA_B);

We define the parameters of the files, of the source and the objective

&file1 = &oldpath | APP_ENG_AET.DESCR254_MIXED.Value | “.csv”;

&file2 = &newpath | APP_ENG_AET.DESCR254_MIXED.Value | “_” | APP_ENG_AET.PROCESS_INSTANCE.Value | “.csv”;

Move the file to the target directory

&f = CreateJavaObject(“”, &file1);

&target = CreateJavaObject(“”, &file2);

Rename the target

Alejandro Alexiades Estarriol