Search Results create_version




Overview

OKC_TERMS_VERSION_PVT is the private implementation package for version management of Oracle Contracts terms and template documents in Oracle E-Business Suite. It belongs to the Oracle Knowledge and Contracts (OKC) module, which provides the contracts authoring and terms repository infrastructure used by Oracle Order Management, Oracle Quoting, and Oracle Service Contracts. The package manages the lifecycle of document versions — template-derived terms documents, amendments, sections, and articles — including version creation, restoration, deletion, and amendment cleanup.

The package declares the standard Oracle EBS API constants in its specification header, including G_RET_STS_SUCCESS, G_RET_STS_ERROR, and G_RET_STS_UNEXP_ERROR, drawn from FND_API. The specific identifier g_ret_sts_error referenced by callers corresponds to the FND_API.G_RET_STS_ERROR constant (a VARCHAR2(1) status flag) used throughout the package to distinguish an expected business error from an unexpected system error. Procedures within OKC_TERMS_VERSION_PVT set the return status to this value when a business rule validation fails, so that calling APIs and forms can present a controlled error rather than an unhandled exception.

Key Procedures and Functions

  • CLEAR_AMENDMENT — Removes or resets amendment-related data associated with a terms document version. It supports the amendment workflow by clearing the amendment marker (the package defines G_AMEND_CODE_DELETED as 'DELETED') so that a document no longer carries an active amendment designation.
  • VERSION_DOC — Creates a new version of an existing terms document. This is the core versioning routine: it copies the current document structure (sections and articles) into a new version record, typically before an amendment is applied, preserving the prior state for audit and rollback.
  • RESTORE_DOC_VERSION — Restores a document to a previously saved version. It replaces the current active content with the snapshot held in the specified prior version, enabling users to revert changes made through amendment processing.
  • DELETE_DOC_VERSION — Deletes a specified document version and its dependent section and article rows, maintaining referential integrity of the version history.

The package also defines internal (private) procedures bracketed by the INTERNAL/EXTERNAL PROCEDURES comment markers, which are not exposed to external callers.

Tables Accessed

  • OKC_ARTICLES_ALL — Stores the article-level (lowest granularity) content of terms documents. Read and written during version creation, restoration, and deletion.
  • OKC_K_ARTICLES_B — The base table holding contract article definitions linked to knowledge/terms structures; accessed to resolve article content when versioning.
  • OKC_SECTIONS_B — Holds section-level metadata that groups articles within a terms document; read to reconstruct the document hierarchy for a version.
  • OKC_TEMPLATE_USAGES — Records where and how a template has been used. Consulted to determine whether a document is template-derived (the package references G_TMPL_DOC_TYPE from OKC_TERMS_UTIL_GRP).
  • DUAL — Used for single-row PL/SQL evaluations and constant assignments.

Usage Notes

OKC_TERMS_VERSION_PVT is a private (PVT) package and is not intended for direct invocation by end users or custom code; it is called by two other APPS packages, which serve as its public API layer. It is invoked during contract authoring sessions in the Oracle Contracts/Order Management forms, when an amendment is entered or when a user reverts a document to a prior version, and by concurrent processes that manage terms document history. Debug output is governed by the AFLOG_ENABLED profile option and the FND_LOG runtime level (G_DBG_LEVEL, G_PROC_LEVEL, G_EXCP_LEVEL).

Because the package returns status through FND_API constants, custom integrations should not call it directly. Instead, they should invoke the documented public wrapper packages and check the return status against G_RET_STS_SUCCESS, G_RET_STS_ERROR, and G_RET_STS_UNEXP_ERROR, handling the error status by retrieving the associated message from the standard FND_MSG_PUB message stack.