Showing posts with label HCM. Show all posts
Showing posts with label HCM. Show all posts

Sunday, December 23, 2018

JSON Parser

PeopleSoft has undocumented JSON related API and this post covers some of the routines that I have tried to dynamically parse a json response. I think this API calls were made available in PT 8.56.x as part of PeopleSoft's inbuilt integration with ElasticSearch. 

I am making a RESTful web service call to a service hosted by a 3rd party vendor from PeopleSoft; so PeopleSoft is a consumer of the service. Focus here is to parse the response from the service so I am not covering how the service is setup and the request part of the service. 

So I have two types of responses. Response 1 as shown below 


{

    "error": {
        "message": "Some message text",
        "detail": "detail text about the error"
    },
    "status": "failure"
}

and Response 2 as follows.

{
   "import_set":"Import set value",
   "staging_table":"tablename",
   "result":[
      {
         "status":"updated",
         "error_message":"Unable to format 01-01-2019 using format string yyyyMMdd  for field hire_dt"
      }
   ]
}

In Response 1, I has 2 children, viz "error" and "status", whereas Response 2 has 3 children, import_set, staging_table and result.

In Response 1, "error" is a JSonObject which has 2 more children, message and detail. In Response 2, "result" is a JSonArray which has 2 children status and error_message.


Local string &content, &propName, &propValue;
Local JsonParser &parser;
Local JsonObject &jsonRoot, &jsonDetails;
Local JsonArray &jArray;
Local boolean &ret; 
Local number &i, &j, &k, &l;


&parser = CreateJsonParser(); /* this is the undocumented API */
&ret = &parser.Parse(&content); /* &content is the json response as a string */
&jsonRoot = &parser.GetRootObject();

For &i = 1 To &jsonRoot.GetChildCount()
/* for Response 1, following will get status tag and its value */
/* for Response 2, following will get import_set, staging_table and its values */
   &propName = &jsonRoot.GetPropertyNameAt(&i);
   &propValue = &jsonRoot.GetProperty(&propName);
   /* if there is a nested value then its either JsonArray or JsonObject */
   Evaluate &propValue
   When = "JsonArray"
/* this will return status and error_message which are in Response 2 */
      &jArray = &jsonRoot.GetJsonArray(&propName);
      For &j = 1 To &jArray.Length()
         &jsonDetails = &jArray.GetJsonObject(&j);
         For &k = 1 To &jsonDetails.GetChildCount()
            &propName = &jsonDetails.GetPropertyNameAt(&k);
            &propValue = &jsonDetails.GetProperty(&propName);
         End-For;
      End-For;
      Break;
   When = "JsonObject"
/* this will return message and detail which are in Response 1 */
      &jsonDetails = &jsonRoot.GetJsonObject(&propName);
      &numCnt = &jsonDetails.GetChildCount();
      For &l = 1 To &jsonDetails.GetChildCount()
         &propName = &jsonDetails.GetPropertyNameAt(&l);
         &propValue = &jsonDetails.GetProperty(&propName);
      End-For;
      Break;
   When-Other;
      /* when not JsonArray or JsonObject, get prop name and value which is at root level */
      Break;
   End-Evaluate;
End-For;

Hope this helps.

Saturday, April 21, 2018

PSCA Install and Configuration - Upgrade to 9.2

In this POC I am upgrading HCM 9.1 PT 8.53.x to HCM 9.2 PT 8.56.x

VM setup 

  1. I have done native OS installs on Windows 2016 VM of PUM Image 25 (VM name: PUM25) and Upgrade Source 03 (VM Name: UPG03) and those systems are up and running. 
  2. Next I have copy of production up on SQL Server 2014 on a Windows 2016 VM. (VM Name: DB).
  3. I have two other Windows 2016 VMs one for App/Prcs VM and the other for PIA. Native OS - DPK method install of middleware like tuxedo, weblogic and tools, app homes using the command line
  4.           psft-dpk-setup.bat --env_type midtier --deploy_only --deploy_type all

             No domains have been deployed yet
  5. Software is installed on E:/psft (E:\ is local drive on the VM)

PSCA/Oracle Client/PT Client Setup
I am running my PSCA on the App/Prcs VM mentioned above. 
Map drives to E$ on PUM25, UPG03 and \\PUM25\E$\psft\pt\hcm_pi_home

Installed SQL Server Management Studio and related drivers for SQL Server 2014. 

Opened CMD as admin and navigated to \\PUM25\E$\psft\pt\tools_client and ran SetupPTClient.bat -t

This will install Oracle client and Oracle based PT Client on the C:\ drive. This PT Client will be used to connect to PUM25 and/or UPG03.
Also installed PSCA - default location on C:\ drive.

Created 32-bit and 64-bit ODBC connections for my copy of prod database. PT 8.53 just needs 32-bit but when PSCA makes the connectivity test it uses 64-bit version.

Verified that I can connect to PUM24, UPG03 and Copy of Prod via application designer as well as the appropriate SQL tool.

PSCA Configuration
Launch PSCA as admin
Select Update Manager

General Option 
    - PS_HOME - point it to the local install ps_home
    - Create local directories to store download, output and staging and point them appropriately
    - point to SQLCMD.EXE file for SQL Query Tool
PUM Source - point to the Oracle db, SQL Client Tool would be path to sqlplus.exe, PS_HOME, PS_APP_HOME and PS_CUST_HOME would be the Oracle PT client installed in the prior step. 
Don't have to enable any check-boxes
PI_HOME - will be the mapped drive to hcm_pi_home mapped earlier
PIA URL to PUM signon page
Did not enable EM Hub

Upload Upg Source db to PUM
Launch the "Upload Target Database Information to Image" option and select the Upgrade Source database and upload that to the PUM Image.
Once done login to PUM PIA, navigate to PeopleTools > Lifecycle Tools > Update Manager > Update Manager Dashboard and Click on Define Upgrade Package.
Named my package HR91TO92.
Follow prompts select required for upgrade fixes too.
So it should create HR91TO92UPG and HR91TO92RFU. 
Now back in PSCA, Select HR91TO92UPG from the drop-down and it should prompt for downloading HR91TO92RFU too. So download both packages to the download directory.
As we will doing a tools upgrade too at the same time, copy PS_HOME\PTU\updPTU856.zip to the download folder manually.

Selected "Upgrade to New Application Release"
Initial Pass is selected by default
Setup target database - copy of prod
SQL Client tool - will be path to SQLCMD.EXE
Current home - will be the copied hr91 directory, I have one directory which has both tools and app so provided the same path for PS_HOME, PS_APP_HOME and PS_CUST_HOME
Enabled Configure New Homes for Upgrade
Provided paths for new homes the ones created by the DPK install on this VM.

Setup Upgrade Source database - this is similar to the PUM Source database configuration done earlier.

Select Upgrade page - should show Upgrade Source and target information correctly. Application and Tools upgrade sections will be selected and grayed out. Each one should have a package listed under the appropriate section. 
Select the Required for Upgrade Package section.
then continue to compatibility check screen. Verify that all are return green. If anything is not then step through previous screens to verify the inputs and selections. A total of 11 checks are performed.

Click on Finish and the upgrade job will be created and PSCA will start running the steps. The first step is a manual stop.

It creates 3 jobs, RFU, UPG and PT Upgrade.

Monday, January 19, 2015

Using PUM to apply PRP (PeopleSoft Release Patchset)

PeopleSoft (Oracle) with the advent of 9.2 release introduced the PUM tool to apply and migrate patches/bundles/fixes. Going forward an individual patch or fix is now called as PRP (PeopleSoft Release Patchset).
So in a nutshell the process is to download the PRP, apply it to the current Image (which means you might have to first download and get the latest version of the PUM Image up and running) and then apply it to your Demo (this might be optional) continued with applying the PRP to your DEV, TST/QA and finally Production.
I have covered some basic steps on how PUM works in the post here.

Pre-reqs
I had to install the latest PeopleTools client which came with the Image 10. Also had to install Oracle 64 bit client. Mapped the pi_home share to a drive on my workstation. Make sure pi_home is writtable. For making it writtable do the following

Edit the /etc/samba/smb.conf file
Before >> guest account = nobody
After >> guest account = root

Under the [pi_home] section
Before >> writable = no
After >> writable = yes

Restart samba service as below
service smb restart

Map a drive and when prompted for credentials provide
workgroup\root as the username and root’s password as the password


1. Navigate through wizard (Tools > Change Action)
2. Selection Action would be Update Manager
3. On the General tab, select PS_HOME. For this example I am working on FSCM Image 10, running on tools 8.54.05. So I installed the client from the PUM image share to my local drive under C:\PT85405. Designated a download, staging and output directory. Assigned path to Oracle client. Had to install the 64 bit version which was delivered part of the image share.
4.  PUM Source tab - stepped through the wizard and made sure connection successful. Mapped the share to a drive on my workstation. \\image_ip_address\pi_home
5. EM Hub tab - pointed it to my demo db. My Demo db is running FS 9.2, PT 8.53.14 on SQL Server 2012
6. On Select Tab - selected "Apply downloaded PeopleSoft Release Patchset to PeopleSoft Image".

So now the current wizard is complete and the next one pops-up.

1. Select download directory where you downloaded the zip file from Oracle's website
2. PSCA will only show applicable patches if your download directory contains other zip files. Select and move on.
3. Compatibility check should run to success.
4. Apply summary - eye ball and make sure everything looks right.

PSCA will create a job and start applying the project to the Image db. Verify logs once done.

Login to the Image 10 PIA and navigate to PeopleTools > Lifecycle Tools > Update Manager > Define Change Package. I have already uploaded my demo db to this Image 10 db. (definitely another post on that to follow). Provide a package name, select "Specific Updates" radio button, provide bug number and finish creating the package.

So prior to 9.2 this was a simple step, search for patch on Oracle website, download and apply to demo, but now its very very elaborate. Come to terms, no other way out !!











Tuesday, December 13, 2011

XMLP Output Options

Following are the different ways to display a XMLP report, via peoplecode.

/* initialize */
&reportdefn = create PSXP_RTPDEFNMANAGER:ReportDefn(&report);
&template = &reportdefn.GetDefaultTemplateID();

/* this will create the PDF report output under c:\temp\ */
/* useful when generating report via an AE program */
&reportdefn.OutDestination = "c:\temp\";
&reportdefn.ProcessReport(&template,%Language_User,%Date,"PDF");
&reportdefn.Publish("","","",N_RECORD_AET.PROCESS_INSTANCE);

/* without setting &reportdefn.OutDestination as mentioned above the PDF report will be written to the report respository and available via the Report Manager */
&reportdefn.ProcessReport(&template,%Language_User,%Date,"PDF");
&reportdefn.Publish("","","",N_RECORD_AET.PROCESS_INSTANCE);

/* this will open the output in a new browser window. In this case code is executed on the appserver as against process scheduler in the above two scenarios */
&reportdefn.ProcessReport(&template,%Language_User,%Date,"PDF");
CommitWork();
&reportdefn.DisplayOutput();

Based on the above scenarios here is cool trick to show the report under process monitor (view/log trace) instead of the report manager.
SQLExec("SELECT PRCSOUTPUTDIR FROM PSPRCSPARMS WHERE PRCSINSTANCE = :1",N_RECORD_AET.PROCESS_INSTANCE, &dir);
&reportdefn.OutDestination = &dir | "\";
&reportdefn.ProcessReport(&template,%Language_User,%Date,"PDF");
&reportdefn.Publish("","","",N_RECORD_AET.PROCESS_INSTANCE);