Third-party integration in PeopleSoft

Third-party integration in PeopleSoft refers to the process of connecting PeopleSoft applications (like HR, Finance, or Supply Chain) with external systems or services, such as payroll vendors, banks, tax authorities, or custom web applications. PeopleSoft offers several built-in tools and technologies to facilitate this kind of integration, depending on the use case, data format, and real-time vs batch requirements. Here’s a breakdown of how third-party integration typically works in PeopleSoft: 🔧 Common Integration Methods 1. Integration Broker (IB) Purpose: Real-time or near real-time integrations using messages and services. Technologies Used: SOAP, REST, HTTP, XML, JSON. Components: Service operations (define messages and routing) Nodes (represent external systems) Queues (manage message delivery) Example: Sending employee data to a benefits provider in real time. 2. Component Interfaces (CI) Purpose: Provide programmatic access to PeopleSoft...

Peoplesoft : PeopleCode File Layout - Read and Write a file using File Layout

If your data is hierarchical in nature, or based on existing PeopleSoft records or pages, you want to use a File Layout definition for reading and writing your data, rather than doing it line by line (or field by field.)

For example, suppose you wanted to write all the information from a record to a file. You can use the WriteRecord method to write all the data from the record, instead of having to loop through every field, find the value, and write it to the file.

In addition, you could write all the information from a transaction (or several transactions) from a page to a file. Each transaction can be considered a rowset. A rowset can contain more than one record and is generally composed in a hierarchical structure. You could create a File Layout definition that has the same structure as the page (or component), and use the WriteRowset method. If you have a file that contains data in the correct format, you can use the ReadRowset method to read the data from the file to the page.

Each file layout is associated with a format. This format specifies the type of data in the files. You specify the format as part of the File Layout Properties. You can only specify one format for a file layout. Available formats are:

  • FIXED (default)

  • CSV

  • XML



Write Record Example
Local Record &RecLine;
Local File &MYFILE;
Local SQL &SQL2;

&MYFILE = GetFile("record.txt", "A");

If &MYFILE.IsOpen Then
   If &MYFILE.SetFileLayout(FileLayout.ABS_HIST) Then
      &RecLine = CreateRecord(RECORD.ABSENCE_HIST);
      &SQL2 = CreateSQL("%Selectall(:1)", &RecLine);
      While &SQL2.Fetch(&RecLine)
         &MYFILE.WriteRecord(&RecLine);
      End-While;
   Else
      /* do error processing -; filelayout not correct */
   End-If;
Else
   /* do error processing -; file not open */
End-If;

&MYFILE.Close();

If you wanted to write only changed records to the file, you could add the following code that is set in bold font:

While &SQL2.Fetch(&RecLine)
   If &RecLine.IsChanged Then
         &MYFILE.WriteRecord(&RecLine);End-If;
End-While;

The following is the first part of a sample data file created by the previous code. The field format is FIXED:

8001       VAC 09/12/1981 09/26/1981 14  0                                  P Y 
8001       VAC 03/02/1983 03/07/1983 5   0                                  P Y

ReadRecord Example

This following example uses the same File Layout definition as the previous example. The file format is CSV. The fields are separated by commas and delimited by double-quotes.

"8001","VAC","09/12/1981","09/26/1981","14","0","","P","Y",""                     
"8001","VAC","03/02/1983","03/07/1983","5","0","","P","Y","" 

To read in the previous CSV file we use the following PeopleCode. It reads the file into a temporary record. First each line of the file is read into a string. The string is split into an array, with the value of each field in the array becoming an element in the array. The value of each field in the record is assigned a value from the array. After additional processing (for example, converting strings into dates or numbers, verifying data, and so on) the record can be inserted into the database. To insert the final data into the database, this code must be associated with a PeopleCode event that allows database updates, that is, SavePreChange, WorkFlow, SavePostChange, and so on. This code could also be used as part of an Application Engine program.

Local File &MYFILE;
Local Record &REC;
Local array of string &ARRAY;

&MYFILE = GetFile("c:\temp\vendor.txt", "R", %FilePath_Absolute);
&REC = CreateRecord(RECORD.ABS_HIST_TEST);
&ARRAY = CreateArrayRept("", 0);

If &MYFILE.IsOpen Then
   If &MYFILE.SetFileLayout(FILELAYOUT.ABS_HIST) Then
      While &MYFILE.ReadLine(&STRING);
         &ARRAY = Split(&STRING, ",");
         For &I = 1 To &REC.FieldCount
            &REC.GetField(&I).Value = &ARRAY[&I];
         End-For;
      /* do additional processing here for converting values */
         &REC.Insert();
      End-While;
   Else
      /* do error processing - filelayout not correct */
   End-If;
Else
   /* do error processing - file not open */
End-If;

&MYFILE.Close();

Write Rowset Examples

The following is the PeopleCode for this example.

Local File &MYFILE;
Local Rowset &FILEROWSET;

&MYFILE = GetFile("c:\temp\EMP_CKLS.txt", "A", %FilePath_Absolute);
If &MYFILE.IsOpen Then
   If &MYFILE.SetFileLayout(FILELAYOUT.EMPL_CHECKLIST) Then
      &FILEROWSET = &MYFILE.CreateRowset();
      &FILEROWSET = GetLevel0();
      &MYFILE.WriteRowset(&FILEROWSET, True);
   Else
      /* file layout not found, do error processing */
   End-If;
Else
   /* file not opened, do error processing */
End-if;

&MYFILE.Close();

The following is a sample data file created by the previous code:

8113       Frumman,Wolfgang 
           08/06/1999 000001           8219        Going to London office
                     100     000015 I 08/06/1999
                     200     000030 I 08/06/1999 
                     300     000009 I 08/06/1999 

You can refer to below link to access more information on File Layouts - https://docs.oracle.com/cd/E92519_02/pt856pbr3/eng/pt/tpcr/task_FileLayoutExamples-071429.html#u3ef54ca0-b748-4dac-b85d-6407b33d5e46

Thanks for your visit, keep supporting.

Comments

Popular posts from this blog

PeopleSoft Meta Tables

Peoplesoft Application Package, Application Class and Application Method Implementation

Peoplesoft Application Package - Application Class/Application Package peoplecode and Calling them anywhere