Upload
hmza6
View
218
Download
0
Embed Size (px)
Citation preview
8/13/2019 Custom Source
1/9
Use of a custom source to derive an account based in
the first segment of an items inventory class
flexfield.
Worked example using a PO Receipt
1. Write the function
CREATE OR REPLACE !"CT#O" $%C&'EL#(ER&TRA") *p&transaction&id
#" "!+,ER- RET!R" (ARCAR/ is
l&in0entor&item&id num2er3
l&organi4ation&id num2er3
l&segment 0archar/*56-3
,E%#"
select in0entor&item&id7organi4ation&id into l&in0entor&item&id7
l&organi4ation&id
from mtl&material&transactions
8here transaction&id9p&transaction&id
3
select segment1 into l&segment from mtl&item&categories&0
8here
in0entor&item&id9 l&in0entor&item&id
and organi4ation&id9 l&organi4ation&idand categor&set&name9:#n0.#tems:3
RET!R" l&segment3
E"' $%C&'EL#(ER&TRA")3
"., in this case7 ou could also the 0alue source&line&id&column to go to
rc0&transactions ta2le i.e. to the transaction&id column on that ta2le.
/. Test the function in s;lplus using a real transaction id
)et ser0eroutput on
declare
l&segment (ARCAR/*56-3
2egin
l&segment
8/13/2019 Custom Source
2/9
Output :)E%+E"T "EW:
Custom )ource
#tem
8/13/2019 Custom Source
3/9
Receipt
Transaction id 9 //5=65/> for receipt of $%C&RECE#PT /@APR/66=
8/13/2019 Custom Source
4/9
"ote the transaction id is the one used to test the function
Account 'eri0ation Rule *A'R-
8/13/2019 Custom Source
5/9
"otice that the source for the A'R is the function name *i.e. custom source- created
pre0iousl and the test is for the functionBs returned 0alue i.e. "EWB in this case.
8/13/2019 Custom Source
6/9
$ournal Line 'efinition *$L'-
Application Accounting 'efinition *AA'-
8/13/2019 Custom Source
7/9
)u2ledger Accounting +ethod *)LA+-
'etailed )u2ledger Report
8/13/2019 Custom Source
8/9
Tips
1. +ake our test cases as simple as possi2le. %et the A'R to return the 8hole
of flexfield in order that ou can check the output easil.
/. Test the function and make sure the customer tests theirs.
5. Dno8 the data model. # kno8 of no documentation that 8ill help ou. The 2estthing # can suggest is the re0ie8 the source the 0ie8 gmf&su2ledger&rep&07
this is the e;ui0alent of the 11i 0ie8 gl&su2r&led&08.
Extract from the 0ie8 gmf&su2ledger&rep&0 for a recei0ing transactions
RO+ gmf&xla&extract&headers eh7
rc0&transactions rt7
mtl&material&transactions mmt7
mtl&transaction&lot&num2ers mtln7
rc0&shipment&headers rsh7
rc0&shipment&lines rsl7 po&headers&all poh7
po&0endors p0
WERE eh.transaction&id 9 mmt.transaction&id
A"' eh.source&document&id 9 rt.shipment&header&id
A"' eh.source&line&id 9 rt.transaction&id
A"' rt.transaction&id 9 mmt.rc0&transaction&id
A"' eh.transaction&source&tpe&id #" *17 @-
,oth of these 0ie8s are used to generate the 'etailed )u2ledger Report.
!seful scripts
)elect distinct T"&)O!RCE7 transaction&source&tpe&id7 E"T#TF&CO'E
7E(E"T&CLA))&CO'E
7 E(E"T&TFPE&CO'E
from gmf&xla&extract&headers
order 2 entit&code7 e0ent&class&code
)elect distinct
T"&)O!RCE7entit&code
7E(E"T&CLA))&CO'E
7 E(E"T&TFPE&CO'E
from gmf&xla&extract&headers
8here creation&dateG9:/@APR6=:
order 2 T"&)O!RCE7entit&code7 e0ent&class&code
)elect distinct T"&)O!RCE7 transaction&source&tpe&id
7 E"T#TF&CO'E 7 source&document&id7source&line&id
7 transaction&id
7TRA")ACT#O"&TFPE'7E(E"T&CLA))&CO'E
8/13/2019 Custom Source
9/9
7 E(E"T&TFPE&CO'E
from gmf&xla&extract&headers
8here txn&source 9:P!R:
and creation&dateG9:6/APR6>:
and e0ent&class&code9:'EL#(ER:
order 2 entit&code7 e0ent&class&code
"., the 2asic ta2le here is gmf&xla&extract&headers7 this is populated 2 the OP+
PreProcessor.