Beruflich Dokumente
Kultur Dokumente
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'
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.
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.