Search This Blog

Thursday, March 7, 2013

AP to GL Transfer


Accounts Payable Module in Oracle is concerned with the creation of Payables Invoices, Making payments, bill payments, and expenses and performing other financial activities related to all the expenditures and liabilities of an organization. This is a sub-ledger module in Oracle and all the data recorded in this module need to be transferred into General Ledger so that these are reflected in the financial statements of the organization. Any data which is not transferred to General Ledger will not be reflected in the financial statements. Oracle has provided a standard Program: Payables Transfer to General Ledger to Transfer the Data from AP to GL.
This Program when run in Oracle will transfer all the eligible records from AP to General Ledger. On the Invoices front once the invoices have been created in the system, Validated and Accounted for we run the Payables transfer to General Ledger Program to transfer the invoice details to General Ledger.
When the payable accounting entries are created, then run the program called 'Payables Transfer to GL' Program. Which sends the invoice entries and payable entries to GL  interface .Then submit a request called Journal import to import journal entries to GL
After transferring the data to General Ledger Payables retains the accounting entries, so you can continue to review them in Payables. Also, after you post journal entries in Oracle General Ledger, you can drill down to the related accounting entries or transactions in Payables.
Before Submitting the Payables transfer to General Ledger Program the user needs to ensure that certain prerequisites are met:
1.       The Period of which data is being transferred to general ledger must be open
2.       The Invoices which are to be transferred to General Ledger must be validated and accounted.
Payables Transfer to General Ledger Program takes a number of parameters as input. The values of these parameters determine what activities will be performed by the program.
The Parameters taken in by the Program are discussed below:
1.       Set of Books Name: Specifies the set of books for which the user wishes to transfer the data to general ledger. If you do not define a secondary set of books in the Payables Options window, Payables automatically enters the name of your primary set of books and you cannot change the default. If we have defined a primary and reporting set of books then payables will display Both as the default meaning that an entry will be created for both the set of books , In case the user wishes to perform transfer for a given set of books he needs to change the value manually.
2.       Transfer Reporting books : When transferring the data should the data be posted in the reporting set of books also
3.       Batch Name: When the data is transferred to General Ledger Oracle will create a journal batch for these records. The Batch name specified here will be used when creating a batch in general ledger so that the user can easily identify their payables batch in general ledger. If no batch name is specified General Ledger uses the journal source, request id , the Actual Flag (A, B, or E for actual, budget, or encumbrance), and Group ID to automatically create a name for your journal entry batch . In case the user supplies a batch name this batch name will be appended to the oracle generated batch name.
4.       From Date: Payables will transfer all the eligible records having GL date on or after this date.
5.       To Date: Payables will transfer all the eligible records having GL date on or before this date.
6.       Journal Entry Category: We can select from the LOV
a.       Invoices: This will transfer only the eligible invoices to general ledger
b.      Payments: Payables transfers journal entry information for the payments.
c.       All: Payables will transfer the journal information of both , Invoices and Payments .
7.       Validate Accounts: When transferring the records from Payables to General Ledger if the parameter value is ‘YES’ Oracle will check for the validity of the accounts in general ledger and ensure that these accounts are active in GL , If the user selects a value ‘NO’ , the data will be simply transferred to General Ledger and the account validation will be done In the General Ledger Module later
8.       Transfer to GL Interface: This parameter is used to specify whether we wish to transfer summarized or detailed accounting entry lines. Even if the user chooses summary he still has the option to drill down from General Ledger to individual transactions in Payables.
a.       In Detail: Do not summarize the entries. Transfer one accounting entry for each accounting entry.
b.      Summarize by Accounting Date: Summarize the accounting lines by account and date.
c.       Summarize by Accounting Period: Summarize the accounting lines by account and accounting              period.
9.       Submit Journal Import: This parameter specifies if Oracle should run Journal Import after Transferring data into the GL Interface.
a.       YES : Once the data has been transferred to GL Interface , Oracle will also run the Journal Import to create Journals for the transferred records
b.      NO  : Do not submit the Journal Import , the data will be available in the GL Interface for user reference.
Even After transferring the data to General Ledger the AR module will still retain all the entries that have been transferred and can be used by for future reference.

How to Identify the Invoices that are transferred to GL Interface ?
 Oracle has provided us with 2 columns : GL_SL_LINK_ID and GL_SL_LINK_TABLE

GL_SL_LINK_TABLE: value is APECL for Payables actuals, and APENCL for Payables encumbrances.
GL_SL_LINK_ID: value is a unique, sequential number
User can use this combination to fetch the details of the transaction which has been transferred to GL
Below is list of the reference columns from Oracle site which get populated when the Payables data is transferred to GL Interface.
When you do a transfer in details , these information get populated in GL_Interface.
Purchase Invoices: Records for the Purchase Invoices journal category debit the Expense account (including exchange rate variance and invoice price variance accounting entries), and credit the Liability account.
·         Reference21: supplier name
·         Reference22: invoice ID
·         Reference23: distribution line number
·         Reference25: invoice number
·         Reference26: AP Invoices
·         Reference27: set of books ID
·         Reference30: type of account charged: Liability or Expense
Payments: Records for the Payments journal category debit the Liability account, credit the Cash account, and are charged to the Discount, Realized Gain/Loss, Future Payment, and Rounding accounts.
USER_JE_CATEGORY_NAME: Payments
USER_JE_SOURCE_NAME : Payables
·         Reference21: supplier name
·         Reference22: invoice ID
·         Reference23: check ID
·         Reference24: check number
·         Reference25: Paid invoice number
·         Reference26: AP Payments
·         Reference27: set of books ID
·         Reference28: invoice distribution line number
·         Reference29: invoice payment ID
·         Reference30: account charged: Liability, Cash, Discount, Exchange Gain, Exchange Loss, Future Pay, or Rounding
Reconciled Payments: Records for the Reconciled Payments journal category are charged to the Cash Clearing and Reconciliation Accounting accounts. The Payables Transfer to General Ledger program populates GL Interface reference columns with reconciled payment information as follows:
·         Reference21: supplier name
·         Reference23: check ID
·         Reference24: check number
·         Reference26: AP Reconciled Payments
·         Reference27: set of books ID
·         Reference30: account charged: Cash, Cash Clearing, Charges, Errors, Exchange Gain, Exchange Loss, or Rounding

AP to GL transfer process is required for transferring all the AP data to GL so that financial reports can be prepared for all the expected revenue, receivables for the business.

Inventory Transfer to GL


As a part of reconciliation with GL the inventory details are transferred to General Ledger. Oracle has provided the users with a standard program: Transfer Transactions to GL which can be used to transfer the inventory information to general ledger.
On running this program all the accounting information in the INV module is transferred to General Ledger. The Program picks up all the records from the table mtl_transaction_accounts having gl_batch_id = -1 for the entered program parameters and transfers them to gl interface.
The Program is generally run as a part of period end process when account reconciliations need to be done.
Like the other modules when the request is run all the accounting information is transferred to GL Interface. Users can subsequently run the Journal Import and Journal Posting Programs to create journals and post them into Ledger.
When submitting the Inventory Transfer to GL Program the user has an option of transferring the information at a summary level or detailed level
Summary: The accounting information of the relevant transactions are summarized and                summary information is transferred, as summary information is being transferred the process is faster and takes less time.
Detail: In case of detail a detailed information is transferred. Detailed accounting records are created for each transaction of Inventory. As the mode since , since detailed transactions are created for individual Inventory transactions the process is more time consuming and thus processing times are higher.
If none is selected, no transfer of accounting information to GL is done for this organization.

The Program is generally run as a part of period closing , however we can perform the general ledger transfer at any time during an open period--not just at period close. The transfer loads summary or detail accounting activity for any open period into the general ledger interface, including both inventory and work in process entries. When more than one period is open, the transfer selects transactions from the first open period up to the entered transfer date, and passes the correct accounting date and financial information into the general ledger interface. 
As we have mentioned the Program picks up the relevant records from the table mtl_transaction accounts having a gl_batch_id = -1, When the transactions are passed to the gl_interface it is at this time that the batch is given it’s proper batch number. This is used to overwrite the gl_batch_id and update it.

Overview of Oracle General Ledger




Oracle General ledger is the core module concerned with the financial reporting of information .All the financial information will mostly end up in General Ledger from where final reporting will be done. General ledger module willRecord , Analyze , Manipulate and Report the information.

General Ledger will receive information from all the oracle modules

  1. Order Management
  2. Purchasing
  3. Receivables
  4. Payables
  5. HRMS
  6. Projects
  7. CRM etc.
All the information is recorded , analyzed and then reported by General Ledger

The Basic Accounting cycle of General Ledger is 
  1. Open the period
  2. Receive data
  3. Create Journals/Reverse Journals
  4. Post Journals
  5. Review
  6. Revalue
  7. Consolidate
  8. Reconcile
  9. Run Reports
  10. Close Accounting Period
General Ledger Module will record all the financial information in the form of journal entries

It will create journal entries for all the information coming in an then post it to the final set of books.

General Ledger System can receive information from Oracle Systems and Non-Oracle Systems.

Form Oracle Systems:


Data Processing Cycle

From Non Oracle Systems


  1. Data Will Be uploaded via Spreadsheets
  2. Journals Will be created
  3. Journals will be posted to General Ledger

API to Update External Payee



Whenever a supplier/supplier site is created oracle system will automatically create a payee for the supplier and supplier site. Once the Payee is created the user may want to update the payee details.
The API to update the payee is :

IBY_DISBURSEMENT_SETUP_PUB.update_external_vendor

iby_disbursement_setup_pub.update_external_payee 
 (p_api_version => 1.0, 
   p_init_msg_list => fnd_api.g_true, 
p_ext_payee_tab => p_external_payee_tab_type, 
p_ext_payee_id_tab => p_ext_payee_id_tab_type, 
x_return_status => x_return_status, 
x_msg_count => x_msg_count, 
x_msg_data => x_msg_data, 
x_ext_payee_status_tab => l_payee_upd_status 
);

p_external_payee_tab_type is a table type variable of external payees which will take in a number of fields of the table.

p_ext_payee_id_tab_type is a table type variable which will take in only variable : ext_payee_id

When updating an external payee the developer needs to consider the below:
   the api will update all the columns which defined in the record type variable which is passed to the API , thus the developer when assigning values to the record type variable needs to assigne the new values to be updated as well as the old values to the API rec type.

The data updated will be reflected in the table iby_external_payees_all

API TO CREATE CODE COMBINATIONS:

API TO CREATE CODE COMBINATIONS:

It may not always be the case that Account codes will be created by user from the front end. There may be scenarios sometimes where we need to have programs that will be creating the code combinations.

Oracle has provided the API's that can be used to create code combinations , we will be discussing a couple of them here.

Pre-requisits

  1. When trying to create the code combinations via the API is that in the Key Flexfields setup , for the KFF defined for your Accounting segments the check box Allow Dynamic Inserts need to be enabled, then only will the code combination be created else the API will never create the accounting segments.
  2. User needs to do initialization
  3. The Accounting flex-filed Value sets need to be populated with the values being used in the account being created


Now we will discuss the API's:

  1. fnd_flex_ext.get_ccid , this API will take in the input parameters and return the code combination id of the account segment created. In case the API is not able to create the account segmewnts for any reason or in case of an error the API will return 0.
            API syntax:
            fnd_flex_ext.get_ccid
     (application_short_name      => 'SQLGL',
      key_flex_code               => 'GL#',
      structure_number            => p_chart_of_accounts_id,
      validation_date             => SYSDATE
      concatenated_segments       => allsegments
      );

The API takes in all these parameters as input:
   application_short_name : this is the short name of the General Ledger  Application
   key_flex_code : this is to be hardcoded as GL#
   structure_number : this is to be the chart of account id in which the account
   is to be created
   validation_date : Pass SYSDATE
   concatenated_segments : the account code segments in concatenated format

Once the API is run , if the account creation is successful then the CCID of the account is returned else the program will return 0.

    2. FND_FLEX_KEYVAL.VALIDATE_SEG , the API will take in the input parameters based
         on which the account code will be created , the API returns a BOOLEAN message of
         TRUE : signifying success or FALSE : in case API was not successful 
         API syntax:
         FND_FLEX_KEYVAL.VALIDATE_SEGS(
                                        ‘CREATE_COMBINATION’,
                                        ‘SQLGL’,
                                        ‘GL#’,
                                        chart_of_accts_id,
                                         concatenated_segments,
                                         ‘V’,
                                         SYSDATE,
                                         ‘ALL’, NULL, NULL, NULL, NULL,
                                         FALSE,FALSE, NULL, NULL, NULL);


       If the API is successful the the account segment will be created and the API will
       return a status TRUE , in case any error occurs he the account code creation will 
       fail and the API will return a status FALSE, In case of any error the API will
       populate the Error in the fnd_message queue.
  
       The user will have to retrieve the error message from there to see the error
       occurred:
       l_chr_error_msg := fnd_flex_keyval.error_message

Query to Find Requisition Details :

Query to Find Requisition Details :

SELECT prl.line_num                                 Line
,      plt.line_type                                Line_Type
,      prl.item_id                            prl_item_id
,      msi.segment1                           Item
,      prl.item_revision                            Rev
,      prl.need_by_date                             Need_By_Date
,      prl.unit_meas_lookup_code                    Unit
,      round(prl.quantity,2)         Quantity_Amount
,      prl.unit_price                               Unit_Price
,      DECODE (PRL.order_type_lookup_code,                              /* <SERVICES FPJ> */
                       'FIXED PRICE', PRL.amount,
                       'RATE', PRL.amount,
                       NVL(PRL.quantity, 1) * PRL.unit_price) C_AMOUNT
,      ppf.full_name                                Requestor
,      plc.displayed_field                         Source_Type
,      decode(prl.source_type_code,'INVENTORY',ood.organization_name||' - '||prl.source_subinventory,'VENDOR',prh.segment1||' - '||prl.suggested_vendor_name||' - '||prl.suggested_vendor_location||' - '||prl.suggested_vendor_contact||' - '||prl.suggested_buyer_id,null)                                  Source
,      prl.item_description                         Item_Description
,      prd.req_line_quantity                        Distributions
,      prl.justification                            Justification
,      prl.requisition_header_id
,      prl.requisition_line_id
FROM   po_requisition_headers         prh
,      po_requisition_lines           prl
,      po_req_distributions           prd
,      po_line_types                  plt
,      per_people_f                   ppf
,      org_organization_definitions   ood
,      po_lookup_codes           plc
,      mtl_system_items               msi
,      mtl_categories                 mca
,      gl_code_combinations           gcc,      financials_system_parameters   fsp
,      po_system_parameters           psp
WHERE  prh.segment1 = '1713'
AND    prl.requisition_line_id      = prd.requisition_line_id
AND    prl.requisition_header_id    = prh.requisition_header_id
AND    prl.line_type_id             = plt.line_type_id
AND    prl.to_person_id             = ppf.person_id (+)
AND    prl.source_organization_id   = ood.organization_id(+)
AND    plc.lookup_type = 'REQUISITION SOURCE TYPE'
AND    plc.lookup_code = prl.source_type_code
AND    nvl(ppf.business_group_id, 0) = (select nvl(max(fsp.business_group_id),0)
                                                                           from financials_system_parameters fsp)
AND    trunc(sysdate)
         BETWEEN nvl(ppf.effective_start_date, trunc(sysdate))
          AND nvl(ppf.effective_end_date, trunc(sysdate))                
AND    prl.item_id                  = msi.inventory_item_id(+)
AND    msi.organization_id = 204
AND    prl.category_id              = mca.category_id
AND    prd.code_combination_id      = gcc.code_combination_id
AND    nvl(prl.modified_by_agent_flag,'N') = 'N'
AND    nvl(prl.cancel_flag,'N') != 'Y'
AND    nvl(prl.closed_code,'OPEN') != 'FINALLY CLOSED'
ORDER BY prl.line_num

Query to Find Requisition Header Info

Query to Find Requisition Header Info


SELECT prh.segment1              Requisition
,      psp.manual_req_num_type        req_num_type
,      ppf.full_name             Preparer
,      prh.creation_date         Creation_Date
,      prh.type_lookup_code
,      ppf1.full_name             Approver
,      t.type_name             Req_type
,      prh.description           Description
,      pah.note                  Note_To_Approver
,      prh.requisition_header_id Req_header
FROM   po_requisition_headers    prh
,      per_people_f              ppf1
,      per_people_f              ppf
,      po_action_history         pah
,      po_system_parameters      psp
, PO_DOCUMENT_TYPES_ALL_TL T
, PO_DOCUMENT_TYPES_ALL_B B
WHERE prh.REQUISITION_HEADER_ID=11675
and  NVL(PRH.contractor_requisition_flag, 'N') <> 'Y'      
AND prh.preparer_id = ppf.person_id
AND nvl(ppf.business_group_id, 0) = (select nvl(max(fsp.business_group_id), 0)
                                                                        from financials_system_parameters fsp)
AND nvl(pah.action_code,'SUBMIT') in ('SUBMIT', 'FORWARD', 'REJECT', 'APPROVE',
                                              'APPROVE AND RESERVE', 'RESERVE', 'ACCEPT','RETURN')   
--AND prh.segment1 = P_req_num_from
AND EXISTS (SELECT null
            FROM   po_requisition_lines        prl
            WHERE  prl.requisition_header_id = prh.requisition_header_id
            AND    nvl(prl.modified_by_agent_flag,'N') = 'N'
            AND    nvl(prl.closed_code,'OPEN') != 'FINALLY CLOSED')
AND pah.object_id              = prh.requisition_header_id
AND pah.employee_id        = ppf1.person_id
AND pah.object_type_code       = 'REQUISITION'
AND pah.object_sub_type_code   = prh.type_lookup_code
AND pah.sequence_num           =
    (SELECT max(sequence_num)
     FROM po_action_history         pah
     WHERE pah.object_id            = prh.requisition_header_id
     AND   pah.object_type_code     = 'REQUISITION'
     AND   pah.object_sub_type_code = prh.type_lookup_code)
and  B.DOCUMENT_TYPE_CODE = T.DOCUMENT_TYPE_CODE
AND B.DOCUMENT_SUBTYPE = T.DOCUMENT_SUBTYPE
AND    b.document_type_code  = 'REQUISITION'
AND    b.document_subtype    = prh.type_lookup_code
AND NVL(B.ORG_ID, -99) = NVL(T.ORG_ID, -99)
AND NVL(B.ORG_ID,NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1 ,1),' ',
NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),-99))
= NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1,1),' ', NULL,
SUBSTRB(USERENV('CLIENT_INFO'),1,10))),-99)
AND T.LANGUAGE = USERENV('LANG')
/