Sie sind auf Seite 1von 8

Use of a custom source to derive an account based in the first segment of an Items inventory class flexfield

A worked example using a PO Receiving Transaction


Introduction This is a preliminary document issued by Oracle Process Manufacturing Support in an attempt to answer the question : "When I am setting up an Account Derivation Rule (ADR) in Subledger Accounting (SLA, XLA), how can I map an Account or Accounting Flexfield Segment to an Item Attribute which is not directly available from the transaction being processed?" A common requirement is to map the Inventory Valuation (INV) Account by Item Category, which is not a parameter that is available in the seeded 'Source' List of Values. Please note that in addition to the Subledger Accounting setup screens, in order to make use of the information in this document you will require the necessary privileges to create a PL/SQL Procedure as the 'APPS' SQL*Plus username, and will also need a working knowledge of how the Item and Transaction database tables link together.

1) Write the function needed to join to the Custom Source column CREATE OR REPLACE FUNCTION JGC_DELIVER_TRANS (p_transaction_id IN NUMBER) RETURN VARCHAR2 is l_inventory_item_id number; l_organization_id number; l_segment varchar2(30); BEGIN select inventory_item_id,organization_id into l_inventory_item_id, l_organization_id from mtl_material_transactions where transaction_id=p_transaction_id ; select segment1 into l_segment from mtl_item_categories_v where inventory_item_id= l_inventory_item_id and organization_id= l_organization_id and category_set_name='Inv.Items'; RETURN l_segment; END JGC_DELIVER_TRANS; N.B in this case, you could also the value source_line_id_column to go to rcv_transactions table i.e. to the transaction_id column on that table. 2) Test the function in SQL*Plus using a known value of Transaction Id Set serveroutput on declare l_segment VARCHAR2(30); begin l_segment:=JGC_DELIVER_TRANS(22390328); DBMS_OUTPUT.PUT_LINE('SEGMENT '||l_segment); end; Example output : 'SEGMENT NEW'

3 Custom Source Form

4 Example Item Category setup

5 The Receiving Transaction

Transaction id = 22390328 for receipt of JGC_RECEIPT 27-APR-2009

6 Account Derivation Rule (ADR)

Notice that the source for the ADR is the function name (i.e. custom source) created previously and the test is for the functions returned value i.e. NEW in this case.

7 Journal Line Definition (JLD)

8 Application Accounting Definition (AAD)

9 Subledger Accounting Method (SLAM)

10 Detailed Subledger Report

Miscellaneous Tips 1. Make your test cases as simple as possible. Get the ADR to return the whole of flexfield in order that you can check the output easily. 2. Test the function 3. Know the data model. I know of no documentation that will help you. The best information available is in the source of the view gmf_subledger_rep_v (the equivalent of the Release 11i view gl_subr_led_vw). For example, the part of view gmf_subledger_rep_v for a Receiving Transaction is: FROM gmf_xla_extract_headers eh, rcv_transactions rt, mtl_material_transactions mmt, mtl_transaction_lot_numbers mtln, rcv_shipment_headers rsh, rcv_shipment_lines rsl, po_headers_all poh, po_vendors pv WHERE eh.transaction_id = mmt.transaction_id AND eh.source_document_id = rt.shipment_header_id AND eh.source_line_id = rt.transaction_id AND rt.transaction_id = mmt.rcv_transaction_id AND eh.transaction_source_type_id IN (1, 7)

Scripts which you may find useful as models Select distinct TXN_SOURCE, transaction_source_type_id, ENTITY_CODE, EVENT_CLASS_CODE, EVENT_TYPE_CODE from gmf_xla_extract_headers order by entity_code, event_class_code; Select distinct TXN_SOURCE,entity_code,EVENT_CLASS_CODE, EVENT_TYPE_CODE from gmf_xla_extract_headers where creation_date>='27-APR-09' order by TXN_SOURCE,entity_code, event_class_code; Select distinct TXN_SOURCE, transaction_source_type_id, ENTITY_CODE , source_document_id,source_line_id, transaction_id, TRANSACTION_TYPE_ID,EVENT_CLASS_CODE, EVENT_TYPE_CODE from gmf_xla_extract_headers where txn_source ='PUR' and creation_date>='02-APR-08' and event_class_code='DELIVER' order by entity_code, event_class_code; N.B the basic table here is gmf_xla_extract_headers, which is populated by the OPM SLA Pre-Processor.

Das könnte Ihnen auch gefallen