Oracle Assets Invoice Description 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 Invoice Description API uses the FA_ASSET_DESC_PUB.UPDATE_INVOICE_DESC() procedure. 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 also update invoice descriptions using the Asset Workbench.

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.

Updating Values

When populating structures, you only need to populate the values that are changing. Also, you do not need to pass the values that are not changing.

Important: For columns which are being changed from a populated value to NULL. For example, if you are removing the PO_NUMBER, you must pass either FND_API.G_MISS_NUM, G_MISS_DATE, or G_MISS_CHAR depending on the data type. This tells the API to null out the current value. Remember, the API will treat null values as meaning no change.

Related Topics

Invoice Description API Definition

Sample Script: Using the Invoice Description API

Invoice Description API Definition

The Invoice Description API procedure is called: FA_ASSET_DESC_PUB.UPDATE_INVOICE_DESC(). The following table provides the arguments, types, value, and descriptions of the elements of the FA_ASSET_DESC_PUB.UPDATE_INVOICE_DESC() 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 success.
FND_API.G_RET_STS_ ERROR - Indicates a failed transaction.
FND_API.G_RET_STS_ UNEXP_ERROR - Indicates an unexpected error.
Determines the API success.
X_MSG_COUNT NUMBER   Number of messages on the message stack.
X_MSG_DATA VARCHAR2(1024)   Message stack.
P_CALLING_FN VARCHAR2(30)   Function that calls 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_INV_TBL_NEW 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
WHO_INFO Required STANDARD_WHO_REC 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) OUT parameter
BOOK_TYPE_CODE Required VARCHAR2(15) Populate the book type code.

INV_REC_TYPE Invoice Structure

The INV_REC_TYPE invoice structure contains invoice information for a single invoice associated with an asset. The INV_TBL_NEW is a table of INV_REC_TYPE records. These records contain all invoices that have been applied to the asset. The following table shows type and value information for each argument.

Argument Required / Optional Type Value
SOURCE_LINE_ID Required NUMBER(15) Source line identification number.
INVOICE_NUMBER Optional VARCHAR2(50) Invoice number
AP_DISTRIBUTION_LINE_ NUMBER Optional NUMBER(15) Distribution line identification
DESCRIPTION Optional VARCHAR2(80) Invoice line description.
PO_VENDOR_ID Optional NUMBER(15) Supplier identification number.
PO_NUMBER Optional VARCHAR2(20) Purchase order number.
PAYABLES_BATCH_NAME Optional VARCHAR2(50) Payables batch name in the invoice
PROJECT_ASSET_LINE_ID Optional NUMBER(15) Identifier of the summarized asset cost line transferred from Oracle Projects to create this line.
PROJECT_ID Optional NUMBER(15) Identifier of the project from which the costs are collected, summarized, and transferred from Oracle Projects.
TASK_ID Optional NUMBER(15) Identifier of the task from which costs are collected, summarized, and transferred from Oracle Projects. This column is populated only if the costs were summarized by task.
MATERIAL_INDICATOR Optional VARCHAR2(1) CRL Assets only
ATTRIBUTE1-15 Optional VARCHAR2(150) Descriptive flexfield segment.
ATTRIBUTE_CATEGORY_ CODE Optional VARCHAR2(30) Descriptive flexfield structure defining column.
INVOICE_DISTRIBUTION_ID Optional VARCHAR2(1) Invoice distribution identifier
INVOICE_LINE_NUMBER Optional VARCHAR2(30) Invoice line number
PO_DISTRIBUTION_ID Optional VARCHAR2(30) Purchase order distribution identifier.

Sample Script: Using the Invoice Description API

The following sample script shows how you can use the Invoice Description 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_inv_rec                  FA_API_TYPES.inv_rec_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(10000000);

   FA_SRVR_MSG.Init_Server_Message;

   l_asset_hdr_rec.asset_id       := &asset_id

   -- For asset w/ multiple invoices, will need to loop
   l_inv_rec.source_line_id := &source_line_id
   l_inv_rec.description    := '&description';
   l_inv_rec.po_number      := '&po_number';

   l_inv_tbl(1)             := l_inv_rec;

   FA_ASSET_DESC_PUB.update_invoice_desc(
           -- 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_inv_tbl_new            => 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('ASSET_ID' || to_char(l_asset_hdr_rec.asset_id));
   end if;

end;
/