Search Results copy_document




Overview

PO_COPY_DOCUMENTS_S is a server-side PL/SQL package in the Oracle E-Business Suite Purchasing (PO) module, owned by the APPS schema and declared with AUTHID CURRENT_USER. Its purpose is to replicate an existing purchasing document — a standard purchase order, blanket, contract, quotation, or similar header-and-line construct — into a new document with a different document type, subtype, supplier, supplier site, or supplier contact, while optionally carrying forward attachments. This supports common procurement business scenarios such as converting a quotation into a standard purchase order, cloning a blanket agreement to a new supplier, or duplicating an existing order as a template for a fresh transaction. Because it encapsulates the complex insert logic across the header, line, and line-location tables, it is exposed as a formal API rather than a one-off internal routine, allowing other Oracle forms, concurrent programs, and customer extensions to invoke document duplication in a controlled and consistent manner.

Key Procedures and Functions

The package exposes a single documented procedure:

  • COPY_DOCUMENT — Performs the actual duplication of a source purchasing document into a new target document. It accepts the source header identifier, the new document type and subtype, the new supplier, supplier site, and supplier contact, a copy mode indicator, an attachments flag, and a desired new document number. It returns the newly created PO header identifier along with the actual document number assigned. The x_copy_mode parameter governs how much of the source structure is reproduced, and x_copy_attachments determines whether associated attachments are carried to the new document. The OUT and IN OUT NOCOPY parameters (x_new_po_header_id and x_actual_document_num) allow the caller to capture the generated keys immediately after the copy completes.

Tables Accessed

The package reads and writes the core Purchasing document tables, which are the foundation of its copy behavior: PO_HEADERS and PO_HEADERS_S for the document header (and its DFF/security segment storage), PO_LINES and PO_LINES_S for document lines, and PO_LINE_LOCATIONS and PO_LINE_LOCATIONS_S for shipment or price-break schedules. It consults PO_SYSTEM_PARAMETERS for Purchasing setup values such as document numbering and defaults, and PO_UNIQUE_IDENTIFIER_CONT_ALL for unique identifier control. Supplier and item validation draws on MTL_SYSTEM_ITEMS for item references. Tax-related processing references AP_TAX_CODES, GL_TAX_OPTION_ACCOUNTS, GL_PERIOD_STATUSES, and FINANCIALS_SYSTEM_PARAMETERS. DUAL is used for single-row lookups and default derivations.

Usage Notes

Because the ETRM metadata records zero referencing packages, PO_COPY_DOCUMENTS_S should be treated as a lower-level building block rather than a widely shared integration point. It is typically invoked from the Purchasing forms (for example, the Copy Document action launched from the Purchase Orders or Agreements windows) where a user selects a source document and specifies target attributes, and it may also be wrapped by concurrent programs or custom PL/SQL that require programmatic duplication. Callers should invoke the procedure within a properly initialized EBS session, since the API depends on session context for org-dependent tables such as MTL_SYSTEM_ITEMS and PO setup. Custom code should not bypass validation by writing directly to the PO tables; using COPY_DOCUMENT preserves the intended document-numbering, tax, and identifier logic. As with all Oracle proprietary APIs, behavior is version-sensitive and should be regression-tested after patching in 12.1.1 or 12.2.2.