If
you’ve been working with Oracle EPM Cloud, particularly Profitability
and Cost Management (PCM), you might need to copy data between different
POVs (Point of View) in your application.
In Oracle's Enterprise Profitability and Cost Management (EPCM), efficiently managing data across different Points of View (POVs) is crucial for accurate financial analysis and reporting. A POV typically represents a specific combination of dimensions such as year, period, scenario, and version. Copying data from one POV to another allows organizations to replicate datasets across different scenarios or time periods, facilitating comparative analysis and forecasting. Oracle provides a REST API endpoint specifically designed for this purpose: the "Copy Data by Point of View" operation.
Understanding the REST API for Copying Data by POV
The "Copy Data by Point of
View" API enables users to duplicate data from a source POV to a
destination POV within a selected cube. This operation is asynchronous, meaning
it initiates the copy process and returns a job ID, allowing users to monitor
the job's status independently. The API is accessed via a POST request to the
following endpoint
POST /HyperionPlanning/rest/v3/applications/{AppName}/jobs/
Parameters for this job.
Lets see how to achieve this via a Groovy Rule.
In
this blog, we’ll break down this script step by step so you can fully
understand what’s happening behind the scenes.
This
Groovy script automates that process by:
# Extracting user-selected POV values (Year and Period)
# Triggering a Copy Data Job in Oracle PCM Cloud
# Monitoring the job execution until it completes
The
Rule have implemented functions to monitor the Job Status.
Monitoring the Job Status:
The status field in the response
indicates the current state of the job:
- -1: Job is still in progress.
- 0: Job completed successfully.
- 1: Job failed with an error.
- 2 or 3: Job was cancelled.
- 4: Invalid parameter in job
request.
You should implement logic to
periodically check the job status until completion or failure, handling each
status code appropriately.
The script starts with an RTPS comment, which tells Oracle EPM that this script expects runtime prompt values and the connection details that will be used & read from the rtps.
Send
the Copy Data API Request
Establishing
a connection
→ operation.application.getConnection(connectionName)
Making a POST request to the Oracle EPM REST API (endpoint: /rest/v3/applications/ICPCM/jobs)
Passing JSON parameters to define the Copy POV job
Sending the request and storing the response in copyResponse
Prints
out the API response
to help with debugging.
- copyResponse.status
→ HTTP Status Code (e.g., 200 for success)
- copyResponse.body
→ Detailed API response message
If the status is not between 200 and 299, the script throws an error:
Extract
Job ID and Validate
Every EPM job gets assigned a jobId, which is used to track progress.
If
the response does not contain a valid jobId, the script fails
immediately.
Monitor
Job Completion
Calls
the monitorJob function to track the job execution.
If
the job fails or times out, the script throws an error.
Monitor
Job Status (Function)
Sends a GET request every 5 seconds to check the job status.
If the job is in progress (-1) → Wait and retry.
If the job is completed (0) → Return success.
If the job fails or is canceled, return false.
If the job does not complete within 20 attempts, timeout and fail.
This
Groovy script automates Copy Data Jobs in Oracle PCM Cloud.
It ensures the job completes
successfully before proceeding.
It monitors for failures and
provides debugging logs for troubleshooting.
The Complete rule is here
Hope this is useful, Happy days on the Cloud!!!
No comments:
Post a Comment