How to access Oracle Fusion GL Account Hierarchies with REST API

Accessing Oracle Fusion GL Account Hierarchies with REST API

Overview

In Oracle Fusion Cloud Financials, General Ledger (GL) account hierarchies are implemented using the Trees framework. An account hierarchy is a Tree defined under a Tree Structure and can have multiple date-effective versions. The most practical REST approach for reading hierarchy membership is to query tree nodes using the fndTreeNodes resource.

Why “Trees” matters

Key concepts to keep in mind:

  • Tree Structure: Defines the rules and shape for creating, versioning, and accessing trees.
  • Tree: A specific hierarchy instance (for example, your GL account hierarchy).
  • Tree Version: Tracks changes over time; a tree can have one or more versions, typically requiring publish/active status.
  • Tree Nodes: The parent/child relationships (and value ranges) that make up the hierarchy.

Example REST call and what it returns

Example call (branch lookup under parent value REVAL):

GET https://<host>/fscmRestApi/resources/11.13.18.05/fndTreeNodes/?limit=499&q=TreeStructureCode=GL_ACCT_FLEX;TreeCode=XXX_GL_Account_Setup_Tree;ParentPk1Value=XX_Parent

In the response, each item represents a node in the hierarchy.

How to interpret key fields in the payload

  • TreeStructureCode / TreeCode: Identifies the tree structure and the specific tree (hierarchy) being queried.
  • TreeVersionId: The hierarchy version returned. If results look “stale”, ensure you’re reading the intended active/published version.
  • TreeNodeId / ParentTreeNodeId: Stable identifiers to traverse parent-child relationships.
  • Pk1StartValue / Pk1EndValue: The value (or start/end of a range) represented by this node.
  • ParentPk1Value: Convenient filter to fetch children under a known parent value (value-based traversal).
  • Depth: Hierarchy level (root/near-root levels vary by structure).
  • ChildCount: How many immediate children exist for this node.

Two traversal strategies

There are two robust ways to traverse and reconstruct an account hierarchy:

Strategy A (recommended): Traverse using ParentTreeNodeId

This is the most stable approach because it relies on node identifiers rather than value semantics.

High-level steps:

  1. Fetch starting node(s) (root or a known parent).
  2. Query children using ParentTreeNodeId = <TreeNodeId>.
  3. Repeat until ChildCount = 0.
  4. Store edges (parent -> child) and build the tree in memory.

Strategy B: Traverse using ParentPk1Value (value-based)

This is fast and convenient when PK1 corresponds to the segment value you want to traverse (as in your REVAL example).

High-level steps:

  1. Start with a known parent value (e.g., XX_Parent).
  2. Query children using ParentPk1Value=<parentValue>.
  3. For each child, repeat using ParentPk1Value=<child Pk1StartValue>.
  4. Stop when no items are returned.

Sample:

Troubleshooting and operational notes

  • If REST results don’t reflect recent hierarchy changes, validate that the correct tree version is active/published and consider running the “Process Account Hierarchies (SyncAccountHierarchies)” job as used in many implementations.
  • Prefer node-ID traversal for maximum stability. Use ParentPk1Value traversal for quick branch reads when you already know the parent segment value.
  • For large trees, always page with limit/offset and persist intermediate results to avoid timeouts.

References (public documentation)

  1. Oracle Financials: Account Hierarchy Trees (concept: account hierarchies implemented using trees).
  2. Oracle Financials: Tree Structures (concept: tree structure defines rules for creating/versioning/access).
  3. Oracle Financials: Guidelines for Managing Trees and Tree Versions (concept: versions, draft/active, publish behavior).
  4. Oracle Financials REST API: About the REST APIs and endpoint catalog (concept: REST base, endpoint listing).
  5. Oracle Financials REST API: Chart of Accounts LOV endpoints (context for COA structure lookup).
  6. Oracle Community: fndTreeNodes query pattern for account hierarchy retrieval and operational discussions.

Leave a Reply

Your email address will not be published. Required fields are marked *