You are on page 1of 5

SUBLEDGER ACCOUNTING

Custom Sources Release 12


Author: Last Updated: Document Ref: Version: Status: Subledger Accounting October 2, 2009 CustomSources.doc 1.1 Published

Custom Sources
Custom Sources can be used to extend the list of sources available to your Application Accounting Definitions (AAD). Using standard and system source values as parameters, you can write PL/SQL functions that create custom sources. This document describes how you can create and use custom sources. It provides two sample PL/SQL functions that you can modify for your own use.

How To Create and Use Custom Sources in Accounting


1) Create the backend function in APPS schema, which will be used by the custom source. CREATE or replace FUNCTION abc_test_function (xx in number) return number as begin Insert into log_test values(xx); return xx; end; This must be a function, not a procedure. You can add debugging in this function to help you trace/correct any errors. In this example, there is an insert into log_test. The inputs to the function will be the sources listed in the Parameters section below. The output will be the single value you want the custom source to return. You may include any normal programming logic within the function code, such as IF statements, Case statements, loops etc. Do not issue a direct COMMIT or ROLLBACK or any DDL statement (causing implicit commit) with the custom source function. This will cause the rest of Accounting to fail. If it is absolutely necessary to COMMIT, please define a separate xyz function and make a call to the xyz function from the custom source function. The xyz function can be a pragma autonomous transaction with a COMMIT.

2) Create the custom source, as shown below:

3) Create an ADR that uses the custom source, as shown below:

4) On the JLD screen, decide which JLT will use this ADR to derive the account.

NOTE: if the ADR is not visible in the screen above, that means the event class INVOICES has not been assigned the Transaction Distribution GL Account source, which the Custom Source uses. All sources used in the ADR must be assigned to the event class. 4

How to Create a PL/SQL Function for a Custom Source


Custom Sources are used to extend the list of sources available to your Application Accounting Definitions (AAD). First, determine what your primary goal is before defining a custom source. Be sure to explore other alternatives, as a custom source may impact the performance of the Create Accounting program. If you decide to create a custom source, you will need to define a PL/SQL function. In the function, you must determine the input and output parameters. The output parameters will become the 'return data options' that you will also need to provide on the Custom Source page with the name of the PL/SQL function. You must also specify the 'input parameters' that you need in the PL/SQL function on the Parameters section of the Custom Source page. A custom source PL/SQL function may use the seeded sources that are available to the Application Accounting Definition or any constant value. Note: You will have to define the PL/SQL function in the database, meaning that you will also have to create the function successfully in the particular database. Here are two examples of a PL/SQL function: EXAMPLE 1 In this example, the return data type is Numeric, the function name is 'derived_liability', and two parameters are usedwhich come from the seeded source: APHD_INVOICE_BASE_AMT and INV_PMT_BASE_AMT_DIFF CREATE OR REPLACE FUNCTION derived_liability (APHD_INVOICE_BASE_AMT IN NUMBER, INV_PMT_BASE_AMT_DIFF IN NUMBER) RETURN NUMBER IS a := number; BEGIN a = APHD_INVOICE_BASE_AMT - INV_PMT_BASE_AMT_DIFF; RETURN a; END;

EXAMPLE 2 In this example, the return data type is ALPHANUMERIC and there is only one input parameter of NUMBER data type, which comes from the seeded source: AMOUNT CREATE OR REPLACE FUNCTION adj_doc_flex (AMOUNT IN NUMBER) RETURN VARCHAR2 IS BEGIN IF AMOUNT > 0 THEN RETURN '50034206330'; ELSE RETURN '50034206331'; END IF; END;

You might also like