Skip Headers

Oracle Assets User Guide
Release 12.1
Part Number E13586-04
Go to Table of Contents
Go to previous page
Go to next page

Oracle Assets Unplanned Depreciation API

This appendix covers the following topics:


You can use this API if you have a custom interface that makes it difficult to use with the existing interfaces in Oracle Assets. The Unplanned Depreciation API uses the FA_UNPLANNED_PUB.DO_UNPLANNED () procedure. You can use this API if you have a custom interface that makes it difficult to use with the existing Oracle Assets interfaces for adjusting assets.

Alternate Ledger Currency

If you have set up alternate ledger currency , when you add or modify assets using an Oracle Assets API, the API copies the transactions to the reporting currencies automatically. Invoice rounding issues are avoided by using the API to drive the alternate ledger currency accounting for both the ledger and reporting currencies.

Related Topics

Unplanned Depreciation API Description

Sample Script: Using the Unplanned Depreciation API

Unplanned Depreciation API Description

The Unplanned Depreciation API procedure is called: FA_UNPLANNED_PUB.DO_UNPLANNED ().

The following table provides the arguments, types, value, and descriptions of the elements of the FA_UNPLANNED_PUB.DO_UNPLANNED () procedure.

Each argument has a prefix of P, X, or PX. These prefixes mean the following:

Argument Type Value Description
P_API_VERSION NUMBER Internal use only Basic information about the API.
P_INIT_MSG_LIST VARCHAR2 FND_API.G_TRUE - Initialize the message stack.
FND_API.G_FALSE - Do not initialize the message stack (Default).
Determines whether the messages stack should be initialized and cleared.
P_COMMIT VARCHAR2 FND_API.G_TRUE - Commit automatically.
FND_API.G_FALSE - Do not commit automatically (Default)
Commits the transaction.
P_VALIDATION_LEVEL NUMBER FND_API.G_VALID_ LEVEL_NONE - Low level validation for a transaction.
FND_API.G_VALID_ LEVEL_FULL - High level validation for a transaction (Default).
Asset validation by the API.
P_CALLING_FN VARCHAR2   Function calling the API
X_RETURN_STATUS VARCHAR2 FND_API.G_RET_STS_ SUCCESS - Indicates a successful transaction.
FND_API.G_RET_STS_ ERROR - Indicates a failed transaction.
FND_API.G_RET_STS_ UNEXP_ERROR - Indicates an unexpected error.
Determines if the API is successful.
X_MSG_DATA FA_API_ TYPES.MSG_REC_ TYPE   The part of the API that stores messages to be passed to the user.
PX_TRANS_REC FA_API_ TYPES.TRANS_REC_TYPE   Describes the transaction taking place.
PX_ASSET_HDR_REC FA_API_ TYPES.ASSET_HDR_REC_TYPE   Unique identifiers for the assets.
P_UNPLANNED_DEPRN_REC FA_API_ TYPES. UNPLANNED_ DEPRN_REC_TYPE   Unplanned information for the transaction

TRANS_REC_TYPE Transaction Structure

The TRANS_REC_TYPE transaction structure contains information about the transaction, such as the transaction header ID and the transaction type code. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
SOURCE_TRANSACTION_ HEADER_ID Optional NUMBER(15) Defaults to source THID when using autocopy or CIP-IN-TAX
TRANSACTION_NAME Optional VARCHAR2(20) Description of the transaction. This field is the Comments field in the Asset Workbench.
CALLING_INTERFACE Optional VARCHAR2(30) Interface that calls the API. This field defaults to CUSTOM.
DESC_FLEX Optional DESC_FLEX_ REC_TYPE Descriptive flexfield segments.
WHO_INFO Optional STANDARD_ WHO_REC_ TYPE Standard Who columns.

ASSET_HDR_REC_TYPE Asset Structure

The ASSET_HDR_REC_TYPE asset structure contains unique identification information for a given asset, such as the asset ID and book type code. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
ASSET_ID Required NUMBER(15) Asset identification number.
BOOK_TYPE_CODE Required VARCHAR2(15) Book name.


The UNPLANNED_DEPRN_REC_TYPE structure contains unplanned depreciation information when this type of transaction is performed on a given asset. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
CODE_COMBINATION_ID Optional NUMBER(15) Account allocated for unplanned depreciation.
UNPLANNED_AMOUNT Required NUMBER Amount of unplanned depreciation.
UNPLANNED_TYPE Optional VARCHAR2(9) Type of unplanned depreciation.

Sample Script: Using the Unplanned Deprecation API

The following example demonstrates the unplanned depreciation of an asset. In this particular example, we are inserting an unplanned amount of $600,000, regardless of what the current reserve may be. It populates the needed structures and then calls the Unplanned Depreciation API.

set serveroutput on


   l_trans_rec                FA_API_TYPES.trans_rec_type;
   l_asset_hdr_rec            FA_API_TYPES.asset_hdr_rec_type;
   l_unplanned_deprn_rec      FA_API_TYPES.unplanned_deprn_rec_type;

   l_return_status            VARCHAR2(1);
   l_mesg_count               number;
   l_mesg                     varchar2(4000);




   l_asset_hdr_rec.asset_id                  := &asset_id
   l_asset_hdr_rec.book_type_code            := '&book';

   l_unplanned_deprn_rec.code_combination_id := &ccid
   l_unplanned_deprn_rec.unplanned_amount    := &amt

   l_trans_rec.transaction_subtype           := '&trx_subtype';
   l_unplanned_deprn_rec.unplanned_type      := '&unplanned_type';

           -- std parameters
           p_api_version             => 1.0,
           p_init_msg_list           => FND_API.G_FALSE,
           p_commit                  => FND_API.G_FALSE,
           p_validation_level        => FND_API.G_VALID_LEVEL_FULL,
           p_calling_fn              => null,
           x_return_status           => l_return_status,
           x_msg_count               => l_mesg_count,
           x_msg_data                => l_mesg,
           -- api parameters
           px_trans_rec              => l_trans_rec,
           px_asset_hdr_rec          => l_asset_hdr_rec,
           p_unplanned_deprn_rec     => l_unplanned_deprn_rec);

   --dump messages
   l_mesg_count := fnd_msg_pub.count_msg;

   if l_mesg_count > 0 then

      l_mesg := chr(10) || substr(fnd_msg_pub.get
                                    (fnd_msg_pub.G_FIRST, fnd_api.G_FALSE),
                                     1, 250);

      for i in 1..(l_mesg_count - 1) loop
         l_mesg :=
                             fnd_api.G_FALSE), 1, 250);

      end loop;


   end if;

   if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
     dbms_output.put_line('THID' || to_char(l_trans_rec.transaction_header_id));
     dbms_output.put_line('ASSET_ID' || to_char(l_asset_hdr_rec.asset_id));
   end if;