Oracle Assets Retirements and Reinstatements 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. The Retirement/Reinstatement APIs uses the FA_RETIREMENT_PUB.DO_RETIREMENT (), FA_RETIREMENT_PUB.UNDO_RETIREMENT (), FA_RETIREMENT_PUB.DO_REINSTATEMENT (), and FA_RETIREMENT_PUB.UNDO_REINSTATEMENT () modules. You can use this API if you have a custom interface that makes it difficult to use with the existing asset retirement interfaces in Oracle Assets.

Oracle Assets also allows you to retire and reinstate assets using any of the following methods:

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.

CIP Assets

If you have checked the Allow CIP Assets check box on the Book Controls window of a tax book, when you add CIP assets using the Additions API, the API automatically adds those CIP assets to that tax book at the same time that they are added to the corporate book.

Module: FA_RETIREMENT_PUB.DO_RETIREMENT ()

You call this API to perform retirement transactions, using the parameters for the API listed below.

Related Topics

Retirement API Description

Sample Script: Full Retirement

Retirement API Description

The Retirement API procedure is called: FA_RETIREMENT_PUB.DO_RETIREMENT ().

The following table provides the arguments, types, value, and descriptions of the elements of the FA_RETIREMENT_PUB.DO_RETIREMENT 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.
P_CALLING_FN VARCHAR2(30)   Function calling 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.
PX_TRANS_REC FA_API_TYPES. TRANS_REC_TYPE   Describes the transaction taking place.
PX_DIST_TRANS_REC FA_API_TYPES. DIST_TRANS_REC_ TYPE   Unique identifiers of the asset being added.
PX_ASSET_HDR_REC FA_API_TYPES. ASSET_HDR_REC_ TYPE   Unique identifiers for the assets.
PX_ASSET_RETIRE_REC FA_API_TYPES. ASSET_RETIRE_ REC_TYPE    
P_ASSET_DIST_TBL FA_API_TYPES. ASSET_DIST_TBL_ TYPE   Distribution information of the asset. Required only for partial unit retirements.
P_SUBCOMP_TBL FA_API_TYPES. SUBCOMP_TBL_ TYPE    
P_INV_TBL FA_API_TYPES. INV_TBL_TYPE   Invoices for the asset.

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 Defaults to the date placed in service.
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.
CALLING_INTERFACE Optional VARCHAR2(30) Defaults to CUSTOM
WHO_INFO Required STANDARD_ WHO_REC_ TYPE Standard Who column.

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_RETIRE_REC_TYPE Asset Structure

The ASSET_RETIRE_REC_TYPE asset structure contains the public retirement information of a given asset when it is retired. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
RETIREMENT_ID Internal use only NUMBER(15) Retirement identification number. Optional OUT parameter.
RETIREMENT_PRORATE_ CONVENTION Required VARCHAR2(10) Prorate format of the retirement. For example, MID - MONTH.
DATE_RETIRED Optional DATE Date when retirement occurred. Default is current period.
UNITS_RETIRED Conditionally Required NUMBER Number of units retired. Either units_retired or cost_retired must be provided.
COST_RETIRED Conditionally Required NUMBER Cost retired. Either units_retired or cost_retired must be provided.
PROCEEDS_OF_SALE Required NUMBER Proceeds from the sale of the asset.
COST_OF_REMOVAL Required NUMBER Cost of removing the asset.
RETIREMENT_TYPE_CODE Optional VARCHAR2(15) Retirement type.
TRADE_IN_ASSET_ID Optional NUMBER(15) Asset identification number of the new asset for which this asset was traded for.
SOLD_TO Optional VARCHAR2(30) Buyer of the asset.
REFERENCE_NUM Optional VARCHAR2(15) Reference number.
CALCULATE_GAIN_LOSS Optional VARCHAR2(1) Immediate calculation of gain/loss. (Either FND_API.G_TRUE or FND_API.G_FALSE.)
DESC_FLEX Optional DESC_FLEX_ REC_TYPE Retirement descriptive flexfield information.
RESERVE_RETIRED Optional NUMBER Reserve retired amount when retiring the member asset if the group asset does not have the CALCULATE tracking method, does not have Sum Member Asset Depreciation to Group option chosen, and if the Recognize Gain Loss option is set to YES.
EOFY_RESERVE Optional NUMBER Reserve deducted from the end of fiscal year reserve amount. This is used to calculate the new depreciable basis for some of FLAT-NBV method.

ASSET_DIST_REC_TYPE Asset Structure

The ASSET_DIST_REC_TYPE asset structure contains information that represents a single source or destination distribution line. All the ASSET_DIST_REC_TYPE records comprising a single transfer transaction are contained in the ASSET_DIST_TBL table. At least one source line and at least one destination line are required for each transfer transaction. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
DISTRIBUTION_ID Required NUMBER(15) Unique distribution identification number.
TRANSACTION_UNITS Required NUMBER Number of units involved in the transaction.
TRANSACTION_HEADER_ ID Internal use only. NUMBER(15) Optional OUT parameter
TRANSACTION_NAME Optional VARCHAR2(20) Description of the transaction. This field is the Comments field in the Asset Workbench.
DESC_FLEX Optional DESC_FLEX_ REC This structure must be optionally populated for a partial unit retirement

Module: FA_RETIREMENT_PUB.UNDO_RETIREMENT ()

You call this API to undo previous retirement transactions, using the parameters for the API listed below.

Related Topics

Undo Retirement API Description

Sample Script: Undo Retirement

Undo Retirement API Description

The Undo Retirement API procedure is called: FA_RETIREMENT_PUB.UNDO_RETIREMENT ().

The following table provides the arguments, types, value, and descriptions of the elements of the FA_RETIREMENT_PUB.UNDO_RETIREMENT 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.
P_CALLING_FN VARCHAR2(30)   Function calling 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.
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 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
WHO_INFO Required STANDARD_ WHO_REC_ TYPE Standard Who column.

ASSET_RETIRE_REC_TYPE Asset Structure

The ASSET_RETIRE_REC_TYPE asset structure contains the public retirement information of a given asset when it is retired. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
RETIREMENT_ID Required NUMBER(15) Retirement identification number. Required IN parameter.

Module: FA_RETIREMENT_PUB.DO_REINSTATEMENT ()

You call this API to perform reinstatement transactions, using the parameters for the API listed below.

Related Topics

Reinstatement API Description

Sample Script: Reinstatement

Reinstatement API Description

The Reinstatement API procedure is called: FA_RETIREMENT_PUB.DO_REINSTATEMENT ().

The following table provides the arguments, types, value, and descriptions of the elements of the FA_RETIREMENT_PUB.DO_REINSTATEMENT 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.
P_CALLING_FN VARCHAR2(30)   Function calling 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.
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 FA_API_TYPES. ASSET_RETIRE_ REC_TYPE    
P_ASSET_DIST_TBL FA_API_TYPES. ASSET_DIST_TBL_ TYPE   Distribution information of the asset. Required for partial unit retirements.
P_SUBCOMP_TBL FA_API_TYPES. SUBCOMP_TBL_ TYPE    
P_INV_TBL FA_API_TYPES. INV_TBL_TYPE   Invoices for the asset.

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_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.
CALLING_INTERFACE Optional VARCHAR2(30) Defaults to CUSTOM
WHO_INFO Required STANDARD_ WHO_REC_ TYPE Standard Who column.
DESC_FLEX Optional DESC_FLEX_ REC_ TYPE Descriptive flexfield segments.

ASSET_RETIRE_REC_TYPE Asset Structure

The ASSET_RETIRE_REC_TYPE asset structure contains the public retirement information of a given asset when it is retired. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
RETIREMENT_ID Required NUMBER(15) Retirement identification number. Required IN parameter.

Module: FA_RETIREMENT_PUB.UNDO_REINSTATEMENT ()

You call this API to undo previous reinstatement transactions, using the parameters for the API listed below.

Related Topics

Undo Reinstatement API Description

Sample Script: Undo Reinstatement

Undo Reinstatement API Description

The Undo Reinstatement API procedure is called: FA_RETIREMENT_PUB.UNDO_REINSTATEMENT ().

The following table provides the arguments, types, value, and descriptions of the elements of the FA_RETIREMENT_PUB.UNDO_REINSTATEMENT procedure.

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

Argument Type Value Description
P_API_VERSION NUMBER Required 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.
P_CALLING_FN VARCHAR2(30)   Function calling 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.
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 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
WHO_INFO Required STANDARD_ WHO_REC Standard Who column.

ASSET_RETIRE_REC_TYPE Asset Structure

The ASSET_RETIRE_REC_TYPE asset structure contains the public retirement information of a given asset when it is retired. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
RETIREMENT_ID Required NUMBER(15) Retirement identification number. Required IN parameter.

Sample Scripts for Retirement, Reinstatement and Undo Transaction

This section lists sample driver scripts as examples for the following retirement-related transaction types:

Retirement_ID must be provided as a parameter for the following transactions:

Sample Script: Full Retirement

set serveroutput on;

declare

   l_trans_rec                FA_API_TYPES.trans_rec_type;
   l_dist_trans_rec           FA_API_TYPES.trans_rec_type;
   l_asset_hdr_rec            FA_API_TYPES.asset_hdr_rec_type;
   l_asset_retire_rec         FA_API_TYPES.asset_retire_rec_type;
   l_asset_dist_tbl           FA_API_TYPES.asset_dist_tbl_type;
   l_subcomp_tbl              FA_API_TYPES.subcomp_tbl_type;
   l_inv_tbl                  FA_API_TYPES.inv_tbl_type;

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

begin

   dbms_output.enable(1000000);

   FA_SRVR_MSG.Init_Server_Message;

   -- Get standard who info
   l_asset_hdr_rec.asset_id               := &asset_id
   l_asset_hdr_rec.book_type_code         := '&book_type_code';

   l_asset_retire_rec.cost_retired        := &cost 
   l_asset_retire_rec.calculate_gain_loss := FND_API.G_FALSE;

   FA_RETIREMENT_PUB.do_retirement(
           -- 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_dist_trans_rec     => l_dist_trans_rec,
           px_asset_hdr_rec      => l_asset_hdr_rec,
           px_asset_retire_rec   => l_asset_retire_rec,
           p_asset_dist_tbl      => l_asset_dist_tbl,
           p_subcomp_tbl         => l_subcomp_tbl,
           p_inv_tbl             => l_inv_tbl
          );


   --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);
      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, 250);

         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');
      rollback;
   else
      dbms_output.put_line('SUCCESS');
      dbms_output.put_line('RETIREMENT_ID' || to_char(l_asset_retire_rec.retirement_id));
   end if;

end;
/

Sample Script: Partial Unit Retirement

Partial unit retirement transaction requires API users to provide the API with which distributions of the asset to retire.

set serveroutput on;

declare

   l_trans_rec                FA_API_TYPES.trans_rec_type;
   l_dist_trans_rec           FA_API_TYPES.trans_rec_type; 
   l_asset_hdr_rec            FA_API_TYPES.asset_hdr_rec_type;
   l_asset_retire_rec         FA_API_TYPES.asset_retire_rec_type;
   l_asset_dist_tbl           FA_API_TYPES.asset_dist_tbl_type;
   l_subcomp_tbl              FA_API_TYPES.subcomp_tbl_type;
   l_inv_tbl                  FA_API_TYPES.inv_tbl_type;

   l_return_status            varchar2(1);
   l_mesg_count               number; 
   l_mesg                     varchar2(512); 

begin

   dbms_output.enable(1000000);

   fa_srvr_msg.init_server_message;

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

   l_asset_retire_rec.units_retired                 := &total_units_to_retire
   l_asset_retire_rec.calculate_gain_loss           := FND_API.G_FALSE;

   l_asset_dist_tbl.delete;

   l_asset_dist_tbl(1).distribution_id             := &dist_id
   l_asset_dist_tbl(1).transaction_units           := &units_to_retire
   l_asset_dist_tbl(1).units_assigned              := null;
   l_asset_dist_tbl(1).assigned_to                 := null;
   l_asset_dist_tbl(1).expense_ccid                := null;
   l_asset_dist_tbl(1).location_ccid               := null;

   -- optionally load additional rows into dist table (2,3..)

   FA_RETIREMENT_PUB.do_retirement(
           -- 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_dist_trans_rec     => l_dist_trans_rec,
           px_asset_hdr_rec      => l_asset_hdr_rec,
           px_asset_retire_rec   => l_asset_retire_rec,
           p_asset_dist_tbl      => l_asset_dist_tbl,
           p_subcomp_tbl         => l_subcomp_tbl,
           p_inv_tbl             => l_inv_tbl
          );

   --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);
      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, 250);

         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('RETIREMENT_ID' || to_char(l_asset_retire_rec.retirement_id));
   end if;

end;
/

Sample Script: Reinstatement

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_asset_retire_rec         FA_API_TYPES.asset_retire_rec_type;
   l_asset_dist_tbl           FA_API_TYPES.asset_dist_tbl_type;
   l_subcomp_tbl              FA_API_TYPES.subcomp_tbl_type;
   l_inv_tbl                  FA_API_TYPES.inv_tbl_type;

   l_count                    number;

   l_return_status            varchar2(1);
   l_mesg_count               number; 
   l_mesg                     varchar2(512); 

begin

   dbms_output.enable(1000000);

   fa_srvr_msg.init_server_message;

   l_asset_retire_rec.retirement_id       := &retirement_id
   l_asset_retire_rec.calculate_gain_loss := FND_API.G_FALSE;

   FA_RETIREMENT_PUB.do_reinstatement(
           -- 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,
           px_asset_retire_rec   => l_asset_retire_rec,
           p_asset_dist_tbl      => l_asset_dist_tbl,
           p_subcomp_tbl         => l_subcomp_tbl,
           p_inv_tbl             => l_inv_tbl
          );


   --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);
      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, 250);

         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));
   end if;

end;
/

Sample Script: Undo Retirement

set serveroutput on;

declare

   /* define local record types */
   l_trans_rec                FA_API_TYPES.trans_rec_type;
   l_asset_hdr_rec            FA_API_TYPES.asset_hdr_rec_type;
   l_asset_retire_rec         FA_API_TYPES.asset_retire_rec_type;
   l_asset_dist_tbl           FA_API_TYPES.asset_dist_tbl_type;
   l_subcomp_tbl              FA_API_TYPES.subcomp_tbl_type;
   l_inv_tbl                  FA_API_TYPES.inv_tbl_type;

   l_return_status            varchar2(1) := FND_API.G_FALSE;
   l_mesg_count               number := 0; 
   l_mesg                     varchar2(512); 

begin

   dbms_output.enable(1000000);

   fa_srvr_msg.init_server_message;

   l_asset_retire_rec.retirement_id  := &retirement_id
   
   FA_RETIREMENT_PUB.undo_retirement(
           -- 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,
           px_asset_retire_rec       => l_asset_retire_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);
      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, 250);

         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('RETIREMENT_ID' || to_char(l_asset_retire_rec.retirement_id));
   end if;


end;
/

Sample Script: Undo Reinstatement

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_asset_retire_rec         FA_API_TYPES.asset_retire_rec_type;
   l_asset_dist_tbl           FA_API_TYPES.asset_dist_tbl_type;
   l_subcomp_tbl              FA_API_TYPES.subcomp_tbl_type;
   l_inv_tbl                  FA_API_TYPES.inv_tbl_type;

   l_return_status            varchar2(1) := FND_API.G_FALSE;
   l_mesg_count               number := 0; 
   l_mesg                     varchar2(512); 

begin

   dbms_output.enable(1000000);

   fa_srvr_msg.init_server_message;

   l_asset_retire_rec.retirement_id  := &retirement_id
   
   FA_RETIREMENT_PUB.undo_reinstatement(
           -- 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,
           px_asset_retire_rec         => l_asset_retire_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);
      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, 250);

         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('RETIREMENT_ID' || to_char(l_asset_retire_rec.retirement_id));
   end if;


end;
/