Oracle Assets Revalutions API

This appendix covers the following topics:

Introduction

You can use this API if you have a custom interface that makes it difficult to use with the existing interfaces in Oracle Assets. You can use the Revalutions API to revalue an asset may arise due to various reasons such as fixing or correcting data-entry errors or as part of maintenance of an asset. The Revalutions API allows you to adjust the value of CIP as well as capitalized assets in a highly inflationary economy.

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

Revalutions API Description

Sample Script: Using the Revaluation API

Revalutions API Description

The Revalutions API procedure is called: FA_REVALUATION_PUB.DO_REVAL ().

The following table provides the arguments, types, value, and descriptions of the elements of the FA_REVALUATION_PUB.DO_REVAL () 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 Version of the API in use.
P_INIT_MSG_LIST VARCHAR2(1) 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(1) 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.
X_RETURN_STATUS VARCHAR2(1) 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_COUNT NUMBER   Number of messages on the message stack.
X_MSG_DATA VARCHAR2(1024)   Message stack.
P_CALLING_FN VARCHAR2(30)   Function calling the API
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.
PX_ASSET_RETIRE_REC_NEW FA_API_TYPES.ASSET_RETIRE_REC_TYPE    

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
TRANSACTION_HEADER_ID Internal use only NUMBER(15) Optional OUT parameter
TRANSACTION_DATE_ ENTERED Optional DATE Populate if you are doing a previous period unit adjustment, else do nothing or set it to null. Defaults to the current period.
TRANSACTION_NAME Optional VARCHAR2(20) Description of the transaction. This field is the Comments field in the Asset Workbench.
MASS_REFERENCE_ID Optional NUMBER(15) Identifies the concurrent request that invokes the transaction if it is part of a mass transaction.
AMORTIZATION_START_DATE Optional DATE Amortization start date.
CALLING_INTERFACE Optional VARCHAR2(30) Defaults to CUSTOM
DESC_FLEX Optional DESC_FLEX_REC_TYPE Descriptive flexfield segments.
WHO_INFO Required 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.

ASSET_REVAL_OPTIONS_REC Revaluation Structure

The ASSET_REVAL_OPTIONS_REC revaluation structure contains revaluation information for a given asset. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
REVAL_PERCENT Required    
RUN_MODE Required   Preview or Run
OVERRIDE_DEFAULTS_FLAG Optional   Yes or No
REVAL_FULLY_RSVD_FLAG Optional   Yes or No
LIFE_EXTENSION_FACTOR Optional    
LIFE_EXTENSION_CEILING Optional    
MAX_FULLY_RSVD_REVALS Optional    

Sample Script: Using the Revaluation API

set serveroutput on

declare

    l_trans_rec                 FA_API_TYPES.trans_rec_type;
    l_asset_hdr_rec             FA_API_TYPES.asset_hdr_rec_type;
    l_reval_options_rec         FA_API_TYPES.reval_options_rec_type;

    l_return_status            VARCHAR2(1);
    l_mesg_count               number := 0;
    l_mesg_len                 number;
    l_mesg                     varchar2(4000);

begin

   fnd_profile.put('PRINT_DEBUG', 'Y');
   dbms_output.enable(1000000);

   FA_SRVR_MSG.Init_Server_Message;
   FA_DEBUG_PKG.Initialize;

         -- asset header info
         l_asset_hdr_rec.asset_id       := &asset_id;
         l_asset_hdr_rec.book_type_code := '&book';
              -- l_trans_rec.transaction_date_entered := sysdate;

         -- reval info
         l_reval_options_rec.reval_percent := &reval_percent;
         l_reval_options_rec.run_mode      := '&run_mode';
         -- fully reserved assets
         -- l_reval_options_rec.reval_fully_rsvd_flag       := 'Y';
         
   FA_REVALUATION_PUB.do_reval
      (p_api_version             => 1.0,
       p_init_msg_list           => FND_API.G_FALSE,
       p_commit                  => FND_API.G_TRUE,
       p_validation_level        => FND_API.G_VALID_LEVEL_FULL,
       x_return_status           => l_return_status,
       x_msg_count               => l_mesg_count,
       x_msg_data                => l_mesg,
       p_calling_fn              => null,
       px_trans_rec              => l_trans_rec,
       px_asset_hdr_rec          => l_asset_hdr_rec,
       p_reval_options_rec       => l_reval_options_rec
      );

   dbms_output.put_line(l_return_status);

   if (fa_cache_pkg.fa_print_debug) then
      fa_debug_pkg.dump_debug_messages(max_mesgs => 0);
   end if;

   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, 512);
      dbms_output.put_line(l_mesg);

      for i in 1..(l_mesg_count - 1) loop
         l_mesg :=
                     substr(fnd_msg_pub.get
                            (fnd_msg_pub.G_NEXT,
                             fnd_api.G_FALSE), 1, 512);

         dbms_output.put_line(l_mesg);
      end loop;

      fnd_msg_pub.delete_msg();

   end if;

   if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
     dbms_output.put_line('FAILURE');
   else
     dbms_output.put_line('SUCCESS');
     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;

end;
/