Вы находитесь на странице: 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" (ARC.AR/ is l&in0entor1&item&id num2er3 l&organi4ation&id num2er3 l&segment 0archar/*56-3 ,E%#" select in0entor1&item&id7organi4ation&id into l&in0entor1&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 in0entor1&item&id9 l&in0entor1&item&id and organi4ation&id9 l&organi4ation&id and categor1&set&name9:#n0.#tems:3 RET!R" l&segment3 E"' $%C&'EL#(ER&TRA")3 "., in this case7 1ou 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 (ARC.AR/*56-3 2egin l&segment<9$%C&'EL#(ER&TRA")*//5=65/>-3 ',+)&O!TP!T.P!T&L#"E*:)E%+E"T :??l&segment-3 end3

Output :)E%+E"T "EW: Custom )ource

#tem

Receipt

Transaction id 9 //5=65/> for receipt of $%C&RECE#PT /@AAPRA/66=

"ote the transaction id is the one used to test the function Account 'eri0ation Rule *A'R-

"otice that the source for the A'R is the function name *i.e. custom source- created pre0iousl1 and the test is for the functionBs returned 0alue i.e. C"EWB in this case.

$ournal Line 'efinition *$L'-

Application Accounting 'efinition *AA'-

)u2ledger Accounting +ethod *)LA+-

'etailed )u2ledger Report

Tips 1. +ake 1our test cases as simple as possi2le. %et the A'R to return the 8hole of flexfield in order that 1ou can check the output easil1. /. Test the function and make sure the customer tests theirs. 5. Dno8 the data model. # kno8 of no documentation that 8ill help 1ou. The 2est thing # 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 W.ERE 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&t1pe&id #" *17 @,oth of these 0ie8s are used to generate the 'etailed )u2ledger Report. !seful scripts )elect distinct TE"&)O!RCE7 transaction&source&t1pe&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 21 entit1&code7 e0ent&class&code )elect distinct TE"&)O!RCE 7entit1&code 7E(E"T&CLA))&CO'E 7 E(E"T&TFPE&CO'E from gmf&xla&extract&headers 8here creation&dateG9:/@AAPRA6=: order 21 TE"&)O!RCE7entit1&code7 e0ent&class&code )elect distinct TE"&)O!RCE7 transaction&source&t1pe&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

7 E(E"T&TFPE&CO'E from gmf&xla&extract&headers 8here txn&source 9:P!R: and creation&dateG9:6/AAPRA6>: and e0ent&class&code9:'EL#(ER: order 21 entit1&code7 e0ent&class&code "., the 2asic ta2le here is gmf&xla&extract&headers7 this is populated 21 the OP+ PreAProcessor.

Вам также может понравиться