Sunteți pe pagina 1din 88

White Paper

Sub-Ledger Accounting Setups for


Intercompany Transaction Flows

Author: Wayne Greene


Creation Date: Feb 5, 2011
Last Update: July 13, 2012
Contributors
And
Reviewers: Shixin (Jason) Zhang
Rixin Zhu

Application Accounting Definition 118861

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 128862

File Ref: 386589801.docx

Company Confidential - For internal use only


Contents Define

Overview...................................................................................................................................4
Internal Drop Ship – without modified SLA........................................................................5
Internal Drop Ship – with modified SLA..............................................................................6
Application Accounting Definition.......................................................................................7
PL/SQL Functions...................................................................................................................8
Sub-Ledger Accounting Setups..............................................................................................9
Custom Sources......................................................................................................................10
Assign Custom Sources to Event Class...............................................................................12
XLA Lookups..........................................................................................................................13
Accounting Definition Rules................................................................................................14
Logical Intercompany Event Class......................................................................................15
Logical Intercompany Event Class – Journal Line Definitions........................................16
Sales Order Issue Event Class..............................................................................................18
Sales Order Issue – Deferred COGS Journal Line Types..................................................19
Sales Order Issue – COGS Journal Line Types..................................................................22
Sales Order Issue – Inventory Valuation Journal Line Types..........................................24
Application Accounting Definition 138863

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_SALE_INTERCO_FLAG...........................................................26
PL/SQL Function - XYZ_COGS_RECOG_INTERCO_FLAG.........................................29
PL/SQL Function - XYZ_INTERNAL_DROP_RECEIPT.................................................32
PL/SQL Function - XYZ_INTRNL_DROP_RCPT_MRKP...............................................36
PL/SQL Function - XYZ_INTERCO_SEGMENT..............................................................39
PL/SQL Function - XYZ_INTRNL_DROP_COGS_AMT................................................42
PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT....................................................46

Application Accounting Definition 148864

File Ref: 386589801.docx

Company Confidential - For internal use only


Overview

This white paper describes how to modify sub-ledger accounting (SLA) for intercompany transactions when tracking of a separate intercompany markup
dollar amount is required for internal drop ships across international boundaries. This is often a requirement for tax purposes. The current costing system does not
provide for a separation of this markup. Having the markup as a separate accounting entry, instead of added into inventory, allows for accurate end of month
intercompany eliminations.

An internal drop ship is where an internal legal entity in one country takes a sales order from a customer, but then sources the shipment from an internal
warehouse in a different country. This internal warehouse belongs to a different internal legal entity. The warehouse then ships directly to the customer across
international boundaries. The country where the shipment comes from must collect taxes on that transaction based on the profit margin. The profit margin must
be an unbiased arms-length amount. The markup percent is stored in advanced pricing. The markup amount will appear in the receiving legal entity as part of the
Logical Intercompany Shipment Receipt transaction type.

This paper does not address the advanced pricing setup or intercompany transactions flows. These setups are also required. It only addresses the SLA setup.
Each setup below has a description column to further explain the usage and outcome of each setting. These settings have been successfully used in a standard
costing production environment. They are currently being tested in an average costing environment with production go live scheduled for next year. The SLA
settings do not address internal intercompany drop ship RMA. That is an ongoing development.

Sub-ledger Accounting allows customers to modify the accounting entries just before they are transferred to the general ledger.

Application Accounting Definition 158865

File Ref: 386589801.docx

Company Confidential - For internal use only


Internal Drop Ship – without modified SLA

The accounting depicted below is the seeded accounting output for an internal drop ship without any SLA changes.

Transaction Type Description Account DR CR

Logical Intercompany Sales Issue Shipper – at shipper standard cost Inventory - Finished Goods 973.58

Logical Intercompany Sales Issue Shipper – at shipper standard cost Cost of sales - Intercompany 973.58

Logical Intercompany Shipment Receiver – at shipper standard cost plus 1246.21


Receipt
973.58 X .27% markup = 262.86 X currency

conversion rate of 1.0079 = 1246.21 Inventory - Finished Goods

Logical Intercompany Shipment Receiver 1246.2


Receipt Inventory Accrual - Intercompany 1

Logical Sales Order Issue Receiver – when sell to 3rd party customer 1246.2
Inventory - Finished Goods 1

Logical Sales Order Issue Receiver – when sell to 3rd party customer Inventory - Deferred COGS 1246.21

Application Accounting Definition 168866

File Ref: 386589801.docx

Company Confidential - For internal use only


COGS Recognition COGS recognized when revenue is 1246.2
earned Inventory - Deferred COGS 1

COGS Recognition COGS recognized when revenue is 1246.21


earned Cost of Goods Sold – third party

Application Accounting Definition 178867

File Ref: 386589801.docx

Company Confidential - For internal use only


Internal Drop Ship – with modified SLA

The accounting depicted below is the accounting output for an internal drop ship after these SLA changes have been made.

Transaction Type Description Account DR CR

Logical Intercompany Sales Issue Shipper – at shipper standard cost Inventory - Finished Goods 973.58

Logical Intercompany Sales Issue Shipper – at shipper standard cost 973.5


Cost of sales - Intercompany 8

Logical Intercompany Shipment Receiver – 973.58 X currency 981.2


Receipt 7
onversion rate of 1.0079 = 981.27 Inventory - Finished Goods

Logical Intercompany Shipment Receiver – at shipper standard cost plus 264.9


Receipt 4
973.58 X .27% markup = 262.86 X currency
Intercompany Markup -
conversion rate of 1.0079 = 264.94 capitalized

Logical Intercompany Shipment 1246.2


Receipt Inventory Accrual - Interco 1

Logical Sales Order Issue Receiver – when sell to 3rd party customer Inventory - Finished Goods 981.27

Application Accounting Definition 188868

File Ref: 386589801.docx

Company Confidential - For internal use only


Logical Sales Order Issue Receiver – when sell to 3rd party customer 981.2
Inventory - Deferred COGS 7

COGS Recognition COGS recognized when revenue is 981.27


earned Inventory - Deferred COGS

COGS Recognition COGS recognized when revenue is 981.2


earned Cost of Goods Sold – third party 7

As can be seen from the example above, the shipping cost is multiplied by a markup of 27%. 973.58 X .27 = 262.86

Then a currency conversion rate of 1.0079 from shipping to receiving company is used to calculate the receiving markup entry. 262.86 X 1.0079 = 264.94

The inventory entry uses the shipping cost multiplied by the currency conversion rate. 973.58 X 1.0079 = 981.27

The receiving standard cost is not used because inventory does not physically enter the receiving warehouse.

The receipt is virtual and used only to calculate third party COGS to be used to calculate profit from revenue on the customer facing transaction.

Application Accounting Definition 198869

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 11088610

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition

Use this next form to create a new Application Accounting Definition.

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Methods and Definitions -> Application Accounting Definitions

First find the old “COST MANAGEMENT” definition. Then use the copy button and modify as listed below.

Definition Chart of Chart of


Definition Description Accounts Accounts
Name
Transaction Accounting
Code
XYZ Cost Manager XYZ Cost Manager XYZ custom Cost XYZ Corp XYZ Corp
Management Accounting Accounting
Flexfield Flexfield

Application Accounting Definition 11188611

File Ref: 386589801.docx

Company Confidential - For internal use only


This step may have already been done by another track up until the last step:
Use this next form to tie the newly created Application Accounting Definition to Cost Management.

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Methods and Definitions -> Subledger Accounting Methods

First find the old Oracle “STANDARD_ACCRUAL” definition.

Then use the copy button and modify as listed below.

Method Code = XYZ_STANDARD_ACCRUAL

Method Name = XYZ STANDARD ACCRUAL

Description = XYZ STANDARD ACCRUAL

Chart of Accounts Transaction = XYZ_CORP_ACCOUNTING_FLEXFIELD

Chart of Accounts Accounting = XYZ_CORP_ACCOUNTING_FLEXFIELD

Now modify a single row:

Application = Cost Management

Name = XYZ Cost Management

Application Accounting Definition 11288612

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Functions
PL/SQl functions defined for internal drop ship transactions.

Compile the following PL/SQL functions:

XYZ_SALE_INTERCO_FLAG_V1.txt

XYZ_COGS_RECOG_INTERCO_FLAG_V1.txt

XYZ_INTERNAL_DROP_RECEIPT_V1.txt

XYZ_INTRNL_DROP_RCPT_MRKP_V1.txt

XYZ_INTERCO_SEGMENT_V1.txt

XYZ_INTRNL_DROP_COGS_AMT

XYZ_INTRNL_DROP_INV_AMT

Also, be sure to run the grant and synonym scripts.

Also, be sure to run the create index script for queries.

Application Accounting Definition 11388613

File Ref: 386589801.docx

Company Confidential - For internal use only


The actual code for these functions is listed at the end of the paper.

Application Accounting Definition 11488614

File Ref: 386589801.docx

Company Confidential - For internal use only


Sub-Ledger Accounting Setups

The SLA seeded definitions may need to be loaded using the concurrent program “Import Application Accounting Definition”.

Context=default

Source File=/pbtlyi/applmgr/1200/bom/12.0.0/patch/115/import/US /cstxlaaad.ldt

Merge Analysis=No

Import Option = Merge

Validate=Yes

To verify the load:

1. Event Model Form


2. Entity = “Material Account Events”
3. Event Class Code = “LOG_INTERCOMPANY”
4. Event Type Codes should be listed

Application Accounting Definition 11588615

File Ref: 386589801.docx

Company Confidential - For internal use only


Custom Sources

Now create custom sources using the following form:

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Sources -> Custom Sources

Description Custom Custom PL/SQL Data Segment Accounti Parameter Parameter


ng
Source Source Function Type
Flexfield
Code Name Name

USED IN
SALES
ISSUE
EVENT

Returns “Y” if transaction is internal drop ship XYZ_SALE XYZ_SALE XYZ_SALE Alpha No Inventory Item in TRANSACTION_ID
_INTERCO _INTERCO _INTERCO numer Costing in Costing
_FLAG _FLAG _FLAG ic

For internal drop ship returns the intercompany segment XYZ XYZ XYZ_INTE Alpha Intercompany Yes Inventory Item in TRANSACTION_ID
INTERCO INTERCO RCO_SEG numer Segment Costing in Costing
SEGMENT SEGMENT MENT ic

Application Accounting Definition 11688616

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Custom Custom PL/SQL Data Segment Accounti Parameter Parameter
ng
Source Source Function Type
Flexfield
Code Name Name
Only called by COGS recognition. Returns “Y” if transaction XYZ_COG XYZ_COG XYZ_COG Alpha No Inventory Item in TRANSACTION_ID
is a COGS recognition on an internal drop ship S_RECOG_ S_RECOG_ S_RECOG_ numer Costing in Costing
INTERCO_ INTERCO_ INTERCO_ ic
FLAG FLAG FLAG

Internal drop COGS amt downstream after markup removed XYZ XYZ XYZ_INTR Nume No Inventory Item in TRANSACTION_ID
INTRNL INTRNL NL_DROP ric Costing in Costing
DROP DROP _
COGS COGS COGS_AM
AMT AMT T

Internal drop INV amt downstream after markup removed XYZ XYZ XYZ_INTR Nume No Inventory Item in TRANSACTION_ID
INTRNL INTRNL NL_DROP ric Costing in Costing
DROP INV DROP INV _
AMT AMT INV_AMT

USED IN
INTERCO
MPANY
EVENT

Internal drop inventory receipt amount XYZ_INTE XYZ_INTE XYZ_INTE Nume No Inventory Item in TRANSACTION_ID
RNAL_DR RNAL_DR RNAL_DR ric Costing in Costing
OP_RECEI OP_RECEI OP_RECEI
PT PT PT

Application Accounting Definition 11788617

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Custom Custom PL/SQL Data Segment Accounti Parameter Parameter
ng
Source Source Function Type
Flexfield
Code Name Name
Internal drop receipt markup XYZ_INTR XYZ_INTR XYZ_INTR Nume No Inventory Item in TRANSACTION_ID
NL_DROP NL_DROP NL_DROP ric Costing in Costing
_RCPT_MR _RCPT_MR _RCPT_MR
KP KP KP

Application Accounting Definition 11888618

File Ref: 386589801.docx

Company Confidential - For internal use only


Assign Custom Sources to Event Class

Use this next form to assign the custom sources to the “Logical Intercompany” event class.

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Sources -> Accounting Attribute Assignments

Query the event class “Logical Intercompany”.

Create a new row for each entry in the table below.

This will allow the source to be chosen while inside the line type form.

Accounti Source
ng
Attribute
Accounted XYZ_INTERNAL_DROP_RECEIPT
Amount

Entered XYZ_INTRNL_DROP_RCPT_MRK
P
Amount

Accounted XYZ_INTRNL_DROP_RCPT_MRK
P
Amount

Application Accounting Definition 11988619

File Ref: 386589801.docx

Company Confidential - For internal use only


Accounti Source
ng
Attribute

Use this next form to assign the custom sources to the “Sales Order Issue” event class.

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Sources -> Accounting Attribute Assignments

Query the event class “Sales Order Issue”.

Create a new row for each entry in the table below.

This will allow the source to be chosen while inside the line type form.

Accounti Source
ng
Attribute
Accounted XYZ INTRNL DROP COGS
AMT
Amount

Accounted XYZ INTRNL DROP INV AMT

Amount

Application Accounting Definition 12088620

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 12188621

File Ref: 386589801.docx

Company Confidential - For internal use only


XLA Lookups

Use this next form to create a new XLA Lookup.

Application Developer -> Application -> Lookups -> XLA Lookups

Query type of “XLA_ACCOUNTING_CLASS”

This lookup will appear on the SLA accounting form for each IC markup accounting line..

Code Meaning Description


IC_Marku Inter-company Inter-company
p Markup Markup

Application Accounting Definition 12288622

File Ref: 386589801.docx

Company Confidential - For internal use only


Accounting Definition Rules

Use this next form to create an accounting derivation rule for markup account.

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Journal Entry Setups -> Account Derivation Rules

Choose to create new rules as listed below:

Description Rule Rule Chart of Chart of Output Segment Prio Value Value Conditio
rity n
Code Name Accounts Accounts Type Name Type
Transaction Accounti
ng
Inter-company Markup Account. XYZ XYZ INTERCO XYZ_CORP_ACCO XYZ_CORP Segment Account 10 Constant 122500
INTERCO MARKUP UNTING_FLEXFIEL _ACCOUN
MARKUP D TING_FLE
XFIELD

XYZ INTERCO SEGMENT used for XYZ INTERCO XYZ INTERCO XYZ_CORP_ACCO XYZ_CORP Segment Intercompany 10 Source XYZ
intercompany eliminations. SEGMENT SEGMENT UNTING_FLEXFIEL _ACCOUN INTERCO
D TING_FLE SEGMENT
XFIELD

Application Accounting Definition 12388623

File Ref: 386589801.docx

Company Confidential - For internal use only


Logical Intercompany Event Class

Go back to the Application Accounting Definition form.

Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Methods and Definitions -> Application Accounting Definitions

Query the event class of “Logical Intercompany”.

Then, click on the “Journal Line Definition” button.

Click the “Copy Definition” button.

Definition Code = XYZ_LOGIC_INTERCO

Definition Name = XYZ Logical Intercompany

Description = XYZ Logical Intercompany

Chart of Accounts Transaction = XYZ_CORP_ACCOUNTING_FLEXFIELD

Chart of Accounts Accounting = XYZ_CORP_ACCOUNTING_FLEXFIELD

After the new Journal Line Definition has been created, go back to the Application Accounting Definition form.

Query the event class of “Logical Intercompany”.

Delete the old journal line definition that is attached at the bottom of the form and add the new one that was just created.

Application Accounting Definition 12488624

File Ref: 386589801.docx

Company Confidential - For internal use only


Logical Intercompany Event Class – Journal Line Definitions

Once you have defined the new Journal Line Definition, then execute the following steps:

Select the journal line type of “Inventory Valuation”.

Disable this type.

Click the line type button.

Click the “Copy” button.

Create new line types as described above by using the data below.

Repeat once for each row in the table below:

Application Accounting Definition 12588625

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Condition Accounting
Event Class Name
Type Chart of Class Class Attribute
Code Accounts Assignments
:
Source for
Accounted
Amount
Sales Issue at std cost. Logical XYZ INTRNL XYZ XYZ_CORP_A Inventory Inventory Accounting Line Type =1 Accounted
Intercompany CCOUNTING_ Valuation Valuation AND
DROP ISSUE INTRNL Amount
FLEXFIELD
DROP Accounting Event Type
ISSUE =
( WHEN YOU COPY Code =
'LOG_IC_SALES_ISSUE'
THE LINE TYPE, Accounted
MAKE SURE IT Amount
DOES NOT
CHANGE THE
EVENT CLASS. )
Inv receipt markup – executes Logical XYZ_INTRNL_DROP XYZ_INTRNL_ XYZ_CORP_A Inventory Inventory Accounting Line Type =1 Accounted
with the XYZ
INTRNL Intercompany _MRKP DROP_MRKP CCOUNTING_ Valuation Valuation AND
Amount
FLEXFIELD
DROP RCPT INV Accounting Event Type
Name = =

LOG_IC_SHIPMENT_RC XYZ_INTR
PT NL_DROP_
RCPT_MRK
P

Application Accounting Definition 12688626

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Condition Accounting
Event Class Name
Type Chart of Class Class Attribute
Code Accounts Assignments
:
Source for
Accounted
Amount

Be sure to enter
ADR of XYZ
INTERCO SEGMENT
for the above type on
the intercompany
segment

And

XYZ INTERCO
MARKUP on the
account segment

Inv receipt without markup Logical XYZ INTRNL XYZ XYZ_CORP_A Inventory Inventory Accounting Line Type =1 Accounted
Intercompany CCOUNTING_ Valuation Valuation AND
DROP RCPT INV INTRNL Amount
FLEXFIELD
DROP Accounting Event Type
This includes the PPV amount RCPT INV Name = =
LOG_IC_SHIPMENT_RC
PT XYZ
INTERNAL
Executes with
XYZ_INTRNL_DROP_MRKP
DROP
RECEIPT

Application Accounting Definition 12788627

File Ref: 386589801.docx

Company Confidential - For internal use only


On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.

In the Logical Intercompany event class, on the journal line types of XYZ_INTERCO_MARKUP and Intercompany Accrual enter the following:
1. Segment = Intercompany, Rule Name = XYZ INTERCO SEGMENT

Application Accounting Definition 12888628

File Ref: 386589801.docx

Company Confidential - For internal use only


Sales Order Issue Event Class

Go back to the Application Accounting Definitions form.

Query the event class of “Sales Order Issue”.

Then, click on the “Journal Line Definition” button.

Click the “Copy Definition” button.

Definition Code = XYZ SALES ORDER ISSUE

Definition Name = XYZ Sales Order Issue

Description = XYZ Sales Order Issue

Chart of Accounts Transaction = XYZ_CORP_ACCOUNTING_FLEXFIELD

Chart of Accounts Accounting = XYZ_CORP_ACCOUNTING_FLEXFIELD

After the new Journal Line Definition has been created, go back to the Application Accounting Definition form.

Query the event class of “Sales Order Issue”.

Delete the old journal line definition that is attached at the bottom of the form and add the new one that was just created.

Application Accounting Definition 12988629

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 13088630

File Ref: 386589801.docx

Company Confidential - For internal use only


Sales Order Issue – Deferred COGS Journal Line Types

Since third party sales and logical sales issue share the same journal line types, if you modify one, you must redefine them all.

Select the journal line type of “Deferred COGS”.

Disable this type.

Click the line type button.

Click the “Copy” button.

Create new line types as described above by using the data below.

Repeat once for each row in the table below:

Application Accounting Definition 13188631

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Debit Condition Accounting
Event Class Name
Type Chart of Class Class / Attribute
Code Accounts Credit Assignments:
Source for
Accounted
Amount
THIRD PARTY AND Sales Order XYZ COGS XYZ COGS XYZ_CORP_A Deferred Cost Deferred Debit Accounting Line Type Accounted
EXTERNAL DROP Issue CCOUNTING_ of Goods Sold Cost of =36
RECOG RECOG Amount
COGS RECOG FOR FLEXFIELD Goods Sold
DEFERRED 3RD 3RD AND
DEFERRED DEFERRED =
Accounting Event
Type Name = 'COGS Accounted
Recognition' Amount
AND

XYZ COGS RECOG


INTERCO FLAG = 'N'

Application Accounting Definition 13288632

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Debit Condition Accounting
Event Class Name
Type Chart of Class Class / Attribute
Code Accounts Credit Assignments:
Source for
Accounted
Amount
CUSTOMER FACING Sales Order XYZ COGS XYZ COGS XYZ_CORP_A Deferred Cost Deferred Accounting Line Type XYZ INTRNL
INTERNAL DROP COGS Issue CCOUNTING_ of Goods Sold Cost of =36
RECOG RECOG DROP COGS
RECOG FOR DEFERRED FLEXFIELD Goods Sold
COGS DEFERRED DEFERRED AND AMT

Accounting Event
Type Name = 'COGS
Recognition'

CREDIT – THIS IS AND


BECAUSE THE
CUSTOM SOURCE XYZ COGS RECOG
ALWAYS RETURNS A INTERCO FLAG = 'Y'
POSITIVE AMOUNT
AND IS ALSO USED
FOR THE COGS ENTRY,
BUT THIS ENTRY
NEEDS TO BE
CREDITED

Application Accounting Definition 13388633

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Debit Condition Accounting
Event Class Name
Type Chart of Class Class / Attribute
Code Accounts Credit Assignments:
Source for
Accounted
Amount

XYZ COGS RMA Sales Order XYZ COGS XYZ COGS XYZ_CORP_A Deferred Cost Deferred Debit Accounting Line Type Accounted
Issue CCOUNTING_ of Goods Sold Cost of =36
DEFERRED RMA RMA Amount
FLEXFIELD Goods Sold
DEFERRED DEFERRED AND
=
Accounting Event
Type Name = 'RMA Accounted
Receipt'
Amount
AND

XYZ COGS RECOG


INTERCO FLAG = 'N'

THIRD PARTY SHIP Sales Order XYZ XYZ XYZ_CORP_A Deferred Cost Deferred Debit Accounting Line Type Accounted
AND EXTERNAL DROP Issue CCOUNTING_ of Goods Sold Cost of =36 AND Accounting
DEFERRED DEFERRED Amount
SHIP DCOGS FLEXFIELD Goods Sold Event Type Name =
COGS COGS 'Sales Order Issue'
AND
XYZ_SALE_INTERCO
_FLAG = 'N'

Application Accounting Definition 13488634

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Debit Condition Accounting
Event Class Name
Type Chart of Class Class / Attribute
Code Accounts Credit Assignments:
Source for
Accounted
Amount
customer facing logical Sales Order XYZ XYZ XYZ_CORP_A Deferred Cost Deferred Accounting Line Type Accounted
sales issue deferred Issue CCOUNTING_ of Goods Sold Cost of =36
LOGICAL LOGICAL Amount
COGS FLEXFIELD Goods Sold
DEFERRED DEFERRED AND
COGS COGS =
Accounting Event
DEBIT Type Name = 'Logical XYZ_INTRNL_D
Sales Order Issue' ROP_INV_AMT
AND

XYZ SALE INTERCO


FLAG = 'Y'

On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.

Application Accounting Definition 13588635

File Ref: 386589801.docx

Company Confidential - For internal use only


Sales Order Issue – COGS Journal Line Types

Select the journal line type of “Cost of Goods Sold”.

Disable this type.

Click the line type button.

Click the “Copy” button.

Create new line types as described above by using the data below.

Repeat once for each row in the table below:

Application Accounting Definition 13688636

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accountin Rounding Debit Condition Accounting
Event Name g
Type Chart of Class / Attribute
Class
Class
Code Accounts Credi Assignments
t :
Source for
Accounted
Amount
CUSTOMER FACING Sales Order XYZ COGS XYZ XYZ_CORP_AC Cost of Cost of Debit Accounting Line Type XYZ
INTERNAL DROP COGS Issue COUNTING_FL Goods Sold Goods Sold =35
RECOG COGS INTRNL
RECOG FOR DEFERRED EXFIELD
COGS INTERCO RECOG AND DROP
INTERC COGS AMT
Accounting Event Type
O
Name = 'COGS
Recognition'

AND

XYZ COGS RECOG


INTERCO FLAG = 'Y'

THIRD PARTY AND Sales Order XYZ COGS XYZ XYZ_CORP_AC Cost of Cost of Debit Accounting Line Type Accounted
EXTERNAL DROP COG Issue COUNTING_FL Goods Sold Goods Sold =35
RECOG SO COGS Amount
RECOG COGS AMT EXFIELD
RECOG AND
SO =
Accounting Event Type
Name = 'COGS Accounted
Recognition'
Amount
AND

XYZ COGS RECOG


INTERCO FLAG = 'N'

Application Accounting Definition 13788637

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accountin Rounding Debit Condition Accounting
Event Name g
Type Chart of Class / Attribute
Class
Class
Code Accounts Credi Assignments
t :
Source for
Accounted
Amount

XYZ COGS RMA Sales Order XYZ COGS XYZ XYZ_CORP_AC Cost of Cost of Debit Accounting Line Type Accounted
Issue COUNTING_FL Goods Sold Goods Sold =35
RMA COGS Amount
EXFIELD
RMA AND
=
Accounting Event Type
Name = 'RMA Receipt' Accounted

AND Amount
XYZ COGS RECOG
INTERCO FLAG = 'N'

On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.

Application Accounting Definition 13888638

File Ref: 386589801.docx

Company Confidential - For internal use only


Sales Order Issue – Inventory Valuation Journal Line Types

Once you have defined the new Journal Line Definition, then execute the following steps:

Select the journal line type of “Inventory Valuation”.

Disable this type.

Click the line type button.

Click the “Copy” button.

Create new line types as described above by using the data below.

Repeat once for each row in the table below:

Application Accounting Definition 13988639

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Debit Condition Accounting
Event Name
Type Chart of Class Class / Attribute
Class
Code Accounts Credit Assignments
:
Source for
Accounted
Amount
internal drop ship Sales XYZ INT XYZ INT XYZ_CORP_AC Inventory Inventory CREDIT – Accounting Line Accounted
Order COUNTING_FL Valuation Valuation BECAUSE THE Type =1 AND
DROP INV DROP INV Amount
Issue EXFIELD CUSTOM SOURCE
VALUATI VALUATI RETURNS A Accounting Event
customer facing logical ON ON POSITIVE AND IS Type Name = =
sales issue inv valuation ALSO USED FOR 'Logical Sales
THE DEFERRED Order Issue' XYZ_INTR
COGS SIDE OF THE NL_DROP_I
LOGICAL SALES AND
NV_AMT
ISSUE BUT HERE
WE NEED A XYZ SALE
CREDIT SINCE INTERCO FLAG
SHIPPING OUT = 'Y'
INVENTORY

RMA Sales XYZ RMA XYZ RMA XYZ_CORP_AC Inventory Inventory Debit Accounting Line Accounted
Order COUNTING_FL Valuation Valuation Type =1 AND
INV INV Amount
Issue EXFIELD
VALUATI VALUATI Accounting Event
ON ON Type Name = =
'RMA Receipt'
AND Accounted
Amount
XYZ SALE
INTERCO FLAG
= 'N'

Application Accounting Definition 14088640

File Ref: 386589801.docx

Company Confidential - For internal use only


Description Line Transaction Accounting Rounding Debit Condition Accounting
Event Name
Type Chart of Class Class / Attribute
Class
Code Accounts Credit Assignments
:
Source for
Accounted
Amount
3rd party and external Sales XYZ SO XYZ SO XYZ_CORP_AC Inventory Inventory Debit Accounting Line Accounted
drop so inv valuation Order COUNTING_FL Valuation Valuation Type =1 AND
INV INV Amount
Issue EXFIELD
VALUATI VALUATI Accounting Event
ON ON Type Name = =
'Sales Order Issue'
Accounted
AND Amount
XYZ SALE
INTERCO FLAG
= 'N'

On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.

Application Accounting Definition 14188641

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 14288642

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_SALE_INTERCO_FLAG

CREATE OR REPLACE

FUNCTION XYZ_SALE_INTERCO_FLAG

p_Inventory_Item IN NUMBER

, p_transaction_id IN NUMBER

RETURN VARCHAR2

IS

-- **** RETURN Y ON SALES ISSUE TRANSACTIONS IF IT IS INTERCOMPANY

xyz_sale_interco_flag VARCHAR2(1);

BEGIN

xyz_sale_interco_flag:='N';

SELECT

Application Accounting Definition 14388643

File Ref: 386589801.docx

Company Confidential - For internal use only


/*+ ORDERED */

'Y'

INTO

xyz_sale_interco_flag

FROM

mtl_material_transactions mmt

, mtl_material_transactions mmt2

, mtl_transaction_types ttype2

WHERE

/*+ ORDERED_PREDICATES */

mmt.transaction_id = p_transaction_id -- **** FROM THE PARENT TRANSACTION OF SALES ISSUE

AND

mmt2.parent_transaction_id = mmt.parent_transaction_id

AND

ttype2.transaction_type_id = mmt2.transaction_type_id

AND

-- **** THIS INSURES WE ARE DEALING WITH ONE OF THE LOGICAL INTERCOMPANY TRANSACTIONS

ttype2.transaction_type_name = 'Logical Intercompany Shipment Receipt'

Application Accounting Definition 14488644

File Ref: 386589801.docx

Company Confidential - For internal use only


-- ************************************

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' SALES ISSUE INTERCO FLAG FUNCTION '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' SALES ISSUE INTERCO FLAG: ' || xyz_sale_interco_flag

);

-- ************************************

RETURN xyz_sale_interco_flag;

-- ************************************

EXCEPTION
Application Accounting Definition 14588645

File Ref: 386589801.docx

Company Confidential - For internal use only


WHEN NO_DATA_FOUND THEN

xyz_sale_interco_flag:='N';

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' SALES ISSUE INTERCO FLAG FUNCTION - NO DATA'

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' SALES ISSUE INTERCO FLAG: ' || xyz_sale_interco_flag

);

RETURN xyz_sale_interco_flag;
Application Accounting Definition 14688646

File Ref: 386589801.docx

Company Confidential - For internal use only


WHEN OTHERS THEN

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR: ' || SUBSTR(SQLERRM,1,80)

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' SALES ISSUE INTERCO FLAG FUNCTION '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR ITEM ID: ' || p_inventory_item

);

xyz_sale_interco_flag:='N';
Application Accounting Definition 14788647

File Ref: 386589801.docx

Company Confidential - For internal use only


RETURN xyz_sale_interco_flag;

END;

Application Accounting Definition 14888648

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_COGS_RECOG_INTERCO_FLAG

CREATE OR REPLACE

FUNCTION XYZ_COGS_RECOG_INTERCO_FLAG

p_Inventory_Item IN NUMBER

, p_transaction_id IN NUMBER

RETURN VARCHAR2

IS

-- **** RETURNS Y IF COGS RECOG IS ON INTERCOMPANY

xyz_cogs_recog_interco_flag VARCHAR2(1);

BEGIN

xyz_cogs_recog_interco_flag:='N';

Application Accounting Definition 14988649

File Ref: 386589801.docx

Company Confidential - For internal use only


SELECT

/*+ ORDERED */

'Y'

INTO

xyz_cogs_recog_interco_flag

FROM

mtl_material_transactions mmt

WHERE

/*+ ORDERED_PREDICATES */

mmt.transaction_id = p_transaction_id -- **** COGS RECOG TRANSACTION

AND

-- **** THIS WILL PULL IN THE SOURCE TRANS OF COGS RECOG

EXISTS

SELECT

/*+ ORDERED */

mmt2.transaction_id

FROM

mtl_material_transactions mmt2

, inv.mtl_transaction_types ttype
Application Accounting Definition 15088650

File Ref: 386589801.docx

Company Confidential - For internal use only


WHERE

/*+ ORDERED_PREDICATES */

mmt2.transaction_source_id = mmt.transaction_source_id

AND

-- **** THERE COULD BE MULTIPLE ITEMS WITH DIFFERENT SOURCES

mmt2.inventory_item_id = mmt.inventory_item_id

AND

ttype.transaction_type_id = mmt2.transaction_type_id

AND

-- **** THIS INSURES WE ARE DEALING WITH AN INTERNAL DROP SHIP

ttype.transaction_type_name = 'Logical Intercompany Shipment Receipt'

-- ************************************

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' COGS RECOG INTERCO FLAG FUNCTION '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,
Application Accounting Definition 15188651

File Ref: 386589801.docx

Company Confidential - For internal use only


' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' COGS RECOG INTERCO FLAG: ' || xyz_cogs_recog_interco_flag

);

-- ************************************

RETURN xyz_cogs_recog_interco_flag;

-- ************************************

EXCEPTION

WHEN NO_DATA_FOUND THEN

xyz_cogs_recog_interco_flag:='N';

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
Application Accounting Definition 15288652

File Ref: 386589801.docx

Company Confidential - For internal use only


FND_FILE.PUT_LINE( FND_FILE.LOG,

' COGS RECOG INTERCO FLAG FUNCTION - NO DATA'

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' COGS RECOG INTERCO FLAG: ' || xyz_cogs_recog_interco_flag

);

RETURN xyz_cogs_recog_interco_flag;

WHEN OTHERS THEN

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
Application Accounting Definition 15388653

File Ref: 386589801.docx

Company Confidential - For internal use only


FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR: ' || SUBSTR(SQLERRM,1,80)

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' COGS RECOG INTERCO FLAG FUNCTION '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR ITEM ID: ' || p_inventory_item

);

xyz_cogs_recog_interco_flag:='N';

RETURN xyz_cogs_recog_interco_flag;

END;

Application Accounting Definition 15488654

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_INTERNAL_DROP_RECEIPT

CREATE OR REPLACE

FUNCTION XYZ_INTERNAL_DROP_RECEIPT -- **** INTERNAL DROP SHIP LOGICAL RECEIPT

p_inventory_Item IN NUMBER

, p_transaction_id IN NUMBER

RETURN NUMBER

IS

xyz_no_markup_inv_cost NUMBER;

BEGIN

xyz_no_markup_inv_cost := 0;

SELECT

/*+ ORDERED */

Application Accounting Definition 15588655

File Ref: 386589801.docx

Company Confidential - For internal use only


ROUND (

( mmt3.intercompany_cost

( mmt3.intercompany_cost - ( rates.conversion_rate * mmt1.actual_cost ) )

* mmt3.transaction_quantity

,2

) extend_inv

INTO

xyz_no_markup_inv_cost

FROM

mtl_material_transactions mmt

, mtl_material_transactions mmt1

, mtl_transaction_types ttype1

, mtl_material_transactions mmt2

, mtl_transaction_types ttype2

, mtl_material_transactions mmt3

, mtl_transaction_types ttype3
Application Accounting Definition 15688656

File Ref: 386589801.docx

Company Confidential - For internal use only


, gl_daily_rates rates

WHERE

/*+ ORDERED_PREDICATES */

mmt.transaction_id = p_transaction_id

-- *********************************************

AND

mmt1.parent_transaction_id = mmt.parent_transaction_id

AND

ttype1.transaction_type_id = mmt1.transaction_type_id

AND

ttype1.transaction_type_name = 'Sales order issue'

-- *********************************************

AND

mmt2.parent_transaction_id = mmt.parent_transaction_id

AND

ttype2.transaction_type_id = mmt2.transaction_type_id

AND

ttype2.transaction_type_name = 'Logical Intercompany Sales Issue'

-- ***************************************************

AND
Application Accounting Definition 15788657

File Ref: 386589801.docx

Company Confidential - For internal use only


mmt3.parent_transaction_id = mmt.parent_transaction_id

AND

ttype3.transaction_type_id = mmt3.transaction_type_id

AND

ttype3.transaction_type_name = 'Logical Intercompany Shipment Receipt'

-- *********************************************

-- **** WE NEED TO CONVERT THE SHIP AMT TO THE RECEIPT CURRENCY

AND

rates.from_currency = mmt2.currency_code

AND

rates.to_currency = mmt3.currency_code

AND

rates.conversion_date = TRUNC (mmt.transaction_date)

AND

--rates.conversion_type = '1001' -- **** get from profile???

rates.conversion_type = 'Corporate' -- **** get from profile???

-- ************************************

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
Application Accounting Definition 15888658

File Ref: 386589801.docx

Company Confidential - For internal use only


FND_FILE.PUT_LINE( FND_FILE.LOG,

' XYZ_INTERNAL_DROP_RECEIPT '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' xyz_no_markup_inv_cost: ' || xyz_no_markup_inv_cost

);

-- ************************************

RETURN xyz_no_markup_inv_cost;

-- ************************************

EXCEPTION

WHEN OTHERS THEN


Application Accounting Definition 15988659

File Ref: 386589801.docx

Company Confidential - For internal use only


FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR: ' || SUBSTR(SQLERRM,1,80)

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' XYZ_INTERNAL_DROP_RECEIPT '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR ITEM ID: ' || p_inventory_item

);

xyz_no_markup_inv_cost := 0;

RETURN xyz_no_markup_inv_cost;

Application Accounting Definition 16088660

File Ref: 386589801.docx

Company Confidential - For internal use only


END;

Application Accounting Definition 16188661

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 16288662

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_INTRNL_DROP_RCPT_MRKP

CREATE OR REPLACE

FUNCTION XYZ_INTRNL_DROP_RCPT_MRKP -- **** INTERNAL DROP SHIP LOGICAL RECEIPT MARKUP

p_inventory_Item IN NUMBER

, p_transaction_id IN NUMBER

RETURN NUMBER

IS

xyz_markup_inv_cost NUMBER;

BEGIN

xyz_markup_inv_cost := 0;

SELECT

/*+ ORDERED */

Application Accounting Definition 16388663

File Ref: 386589801.docx

Company Confidential - For internal use only


ROUND (

( mmt2.actual_cost * mmt2.transaction_quantity )

,2

---- **** MUST ROUND SEPERATELY FROM SUBTRACT SO ENTRIES BALANCE WITHOUT ROUNDING ERROR

ROUND (

( mmt3.actual_cost *

( mmt2.actual_cost / mmt2.intercompany_cost )

* mmt2.transaction_quantity

,2

) markup

INTO

xyz_markup_inv_cost

FROM

mtl_material_transactions mmt

, mtl_material_transactions mmt2
Application Accounting Definition 16488664

File Ref: 386589801.docx

Company Confidential - For internal use only


, inv.mtl_transaction_types ttype

, mtl_material_transactions mmt3

, inv.mtl_transaction_types ttype2

WHERE

/*+ ORDERED_PREDICATES */

mmt.transaction_id = p_transaction_id

AND

mmt2.parent_transaction_id = mmt.parent_transaction_id

AND

ttype.transaction_type_id(+) = mmt2.transaction_type_id

AND

ttype.transaction_type_name = 'Logical Intercompany Shipment Receipt'

AND

mmt3.parent_transaction_id = mmt.parent_transaction_id

AND

ttype2.transaction_type_id(+) = mmt3.transaction_type_id

AND

ttype2.transaction_type_name = 'Sales order issue'

Application Accounting Definition 16588665

File Ref: 386589801.docx

Company Confidential - For internal use only


-- ************************************

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' XYZ_INTRNL_DROP_RCPT MARKUP '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' xyz_markup_inv_cost: ' || xyz_markup_inv_cost

);

-- ************************************

RETURN xyz_markup_inv_cost;

-- ************************************

EXCEPTION
Application Accounting Definition 16688666

File Ref: 386589801.docx

Company Confidential - For internal use only


WHEN OTHERS THEN

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR: ' || SUBSTR(SQLERRM,1,80)

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' XYZ_INTRNL_DROP_RCPT MARKUP '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR ITEM ID: ' || p_inventory_item

);

xyz_markup_inv_cost := 0;

Application Accounting Definition 16788667

File Ref: 386589801.docx

Company Confidential - For internal use only


RETURN xyz_markup_inv_cost;

END;

Application Accounting Definition 16888668

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_INTERCO_SEGMENT

CREATE OR REPLACE

FUNCTION XYZ_INTERCO_SEGMENT

p_inventory_Item IN NUMBER

, p_transaction_id IN NUMBER

RETURN VARCHAR2

IS

xyz_interco_segment VARCHAR2(3);

BEGIN

xyz_interco_segment:='000';

SELECT

Application Accounting Definition 16988669

File Ref: 386589801.docx

Company Confidential - For internal use only


/*+ ORDERED */

comb.segment1

INTO

xyz_interco_segment

FROM

mtl_material_transactions mmt

, mtl_transaction_types ttype

, mtl_material_transactions mmt2

, mtl_transaction_types ttype2

, gl_code_combinations comb

WHERE

/*+ ORDERED_PREDICATES */

-- **** INTERNAL DROP SHIP INTERCOMPANY TRANS

mmt.transaction_id = p_transaction_id

AND

ttype.transaction_type_id = mmt.transaction_type_id

AND

ttype.transaction_type_name = 'Logical Intercompany Shipment Receipt'

AND

mmt2.parent_transaction_id = mmt.parent_transaction_id
Application Accounting Definition 17088670

File Ref: 386589801.docx

Company Confidential - For internal use only


AND

ttype2.transaction_type_id = mmt2.transaction_type_id

AND

-- ****

ttype2.transaction_type_name = 'Logical Intercompany Sales Issue'

AND

comb.code_combination_id = mmt2.distribution_account_id;

-- ************************************

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' INTERCO SEGMENT FUNCTION '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_Item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,
Application Accounting Definition 17188671

File Ref: 386589801.docx

Company Confidential - For internal use only


' INTERCO SEGMENT: ' || xyz_interco_segment

);

-- ************************************

RETURN xyz_interco_segment;

-- ************************************

EXCEPTION

WHEN OTHERS THEN

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR: ' || SUBSTR(SQLERRM,1,80)

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' INTERCO SEGMENT FUNCTION '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR TRANSACTION ID: ' || p_transaction_id


Application Accounting Definition 17288672

File Ref: 386589801.docx

Company Confidential - For internal use only


);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR ITEM ID: ' || p_inventory_Item

);

xyz_interco_segment:='000';

RETURN xyz_interco_segment;

END;

Application Accounting Definition 17388673

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 17488674

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_INTRNL_DROP_COGS_AMT

CREATE OR REPLACE

FUNCTION XYZ_INTRNL_DROP_COGS_AMT -- **** INV RCPT NO MARKUP ON INTERNAL DROP SHIP

p_inventory_Item IN NUMBER

, p_transaction_id IN NUMBER

RETURN NUMBER

IS

xyz_no_markup_inv_cost NUMBER;

BEGIN

-- **** THIS IS USED BY INTERNAL DROP SHIPS TO ADJUST THE

-- **** CUSTOMER FACING SIDE OF THE TRANSACTION

Application Accounting Definition 17588675

File Ref: 386589801.docx

Company Confidential - For internal use only


xyz_no_markup_inv_cost := 0;

SELECT

/*+ ORDERED */

ROUND (

( mmt3.intercompany_cost

( mmt3.intercompany_cost - ( rates.conversion_rate * mmt1.actual_cost ) )

* mmt3.transaction_quantity

,2

) extend_inv

INTO

xyz_no_markup_inv_cost

FROM

mtl_material_transactions mmt

, mtl_material_transactions mmt1

, mtl_transaction_types ttype1
Application Accounting Definition 17688676

File Ref: 386589801.docx

Company Confidential - For internal use only


, mtl_material_transactions mmt2

, mtl_transaction_types ttype2

, mtl_material_transactions mmt3

, mtl_transaction_types ttype3

, gl_daily_rates rates

WHERE

/*+ ORDERED_PREDICATES */

mmt.transaction_id = p_transaction_id -- **** COGS RECOG

AND

-- **** THIS WILL PULL IN THE SOURCE TRANS OF COGS RECOG

mmt1.transaction_source_id = mmt.transaction_source_id

AND

-- **** THERE COULD BE MULTIPLE ITEMS PER ORDER

mmt1.inventory_item_id = mmt.inventory_item_id

AND

ttype1.transaction_type_id = mmt1.transaction_type_id

AND

ttype1.transaction_type_name = 'Sales order issue'

-- *********************************************

AND
Application Accounting Definition 17788677

File Ref: 386589801.docx

Company Confidential - For internal use only


mmt2.parent_transaction_id = mmt1.parent_transaction_id

AND

ttype2.transaction_type_id = mmt2.transaction_type_id

AND

ttype2.transaction_type_name = 'Logical Intercompany Sales Issue'

-- ***************************************************

AND

mmt3.parent_transaction_id = mmt1.parent_transaction_id

AND

ttype3.transaction_type_id = mmt3.transaction_type_id

AND

ttype3.transaction_type_name = 'Logical Intercompany Shipment Receipt'

-- *********************************************

-- **** WE NEED TO CONVERT THE SHIP AMT TO THE RECEIPT CURRENCY

AND

rates.from_currency = mmt2.currency_code

AND

rates.to_currency = mmt3.currency_code

AND

rates.conversion_date = TRUNC (mmt.transaction_date)


Application Accounting Definition 17888678

File Ref: 386589801.docx

Company Confidential - For internal use only


AND

--rates.conversion_type = '1001' -- **** get from profile???

rates.conversion_type = 'Corporate' -- **** get from profile???

-- ************************************

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' XYZ_INTRNL_DROP_COGS_AMT '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ITEM ID: ' || p_inventory_item

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' xyz_no_markup_inv_cost: ' || xyz_no_markup_inv_cost

);

Application Accounting Definition 17988679

File Ref: 386589801.docx

Company Confidential - For internal use only


-- ************************************

RETURN xyz_no_markup_inv_cost;

-- ************************************

EXCEPTION

WHEN OTHERS THEN

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR: ' || SUBSTR(SQLERRM,1,80)

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' XYZ_INTRNL_DROP_COGS_AMT '

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR TRANSACTION ID: ' || p_transaction_id

);

FND_FILE.PUT_LINE( FND_FILE.LOG,

' ERROR ITEM ID: ' || p_inventory_item


Application Accounting Definition 18088680

File Ref: 386589801.docx

Company Confidential - For internal use only


);

xyz_no_markup_inv_cost := 0;

RETURN xyz_no_markup_inv_cost;

END;

Application Accounting Definition 18188681

File Ref: 386589801.docx

Company Confidential - For internal use only


Application Accounting Definition 18288682

File Ref: 386589801.docx

Company Confidential - For internal use only


PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT

CREATE OR REPLACE
FUNCTION XYZ_INTRNL_DROP_INV_AMT -- **** INV RCPT NO MARKUP ON INTERNAL DROP SHIP
(
p_inventory_Item IN NUMBER
, p_transaction_id IN NUMBER
)
RETURN NUMBER
IS

xyz_no_markup_inv_cost NUMBER;

BEGIN

-- **** THIS IS USED BY INTERNAL DROP SHIPS TO ADJUST THE


-- **** CUSTOMER FACING SIDE OF THE TRANSACTION

xyz_no_markup_inv_cost := 0;

SELECT
/*+ ORDERED */
Application Accounting Definition 18388683

File Ref: 386589801.docx

Company Confidential - For internal use only


ROUND (
(
( mmt3.intercompany_cost
-
( mmt3.intercompany_cost - ( rates.conversion_rate * mmt1.actual_cost ) )
)
* mmt3.transaction_quantity
)
,2
) extend_inv
INTO
xyz_no_markup_inv_cost
FROM
mtl_material_transactions mmt
, mtl_material_transactions mmt1
, mtl_transaction_types ttype1
, mtl_material_transactions mmt2
, mtl_transaction_types ttype2
, mtl_material_transactions mmt3
, mtl_transaction_types ttype3
, gl_daily_rates rates
WHERE
/*+ ORDERED_PREDICATES */

Application Accounting Definition 18488684

File Ref: 386589801.docx

Company Confidential - For internal use only


mmt.transaction_id = p_transaction_id
-- *********************************************
AND
mmt1.parent_transaction_id = mmt.parent_transaction_id
AND
ttype1.transaction_type_id = mmt1.transaction_type_id
AND
ttype1.transaction_type_name = 'Sales order issue'
-- *********************************************
AND
mmt2.parent_transaction_id = mmt.parent_transaction_id
AND
ttype2.transaction_type_id = mmt2.transaction_type_id
AND
ttype2.transaction_type_name = 'Logical Intercompany Sales Issue'
-- ***************************************************
AND
mmt3.parent_transaction_id = mmt.parent_transaction_id
AND
ttype3.transaction_type_id = mmt3.transaction_type_id
AND
ttype3.transaction_type_name = 'Logical Intercompany Shipment Receipt'
-- *********************************************

Application Accounting Definition 18588685

File Ref: 386589801.docx

Company Confidential - For internal use only


-- **** WE NEED TO CONVERT THE SHIP AMT TO THE RECEIPT CURRENCY
AND
rates.from_currency = mmt2.currency_code
AND
rates.to_currency = mmt3.currency_code
AND
rates.conversion_date = TRUNC (mmt.transaction_date)
AND
--rates.conversion_type = '1001' -- **** get from profile???
rates.conversion_type = 'Corporate' -- **** get from profile???
;

-- ************************************
FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
FND_FILE.PUT_LINE( FND_FILE.LOG,
' XYZ_INTRNL_DROP_INV_AMT '
);
FND_FILE.PUT_LINE( FND_FILE.LOG,
' TRANSACTION ID: ' || p_transaction_id
);
FND_FILE.PUT_LINE( FND_FILE.LOG,
' ITEM ID: ' || p_inventory_item
);

Application Accounting Definition 18688686

File Ref: 386589801.docx

Company Confidential - For internal use only


FND_FILE.PUT_LINE( FND_FILE.LOG,
' xyz_no_markup_inv_cost: ' || xyz_no_markup_inv_cost
);

-- ************************************
RETURN xyz_no_markup_inv_cost;

-- ************************************
EXCEPTION

WHEN OTHERS THEN

FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
FND_FILE.PUT_LINE( FND_FILE.LOG,
' ERROR: ' || SUBSTR(SQLERRM,1,80)
);
FND_FILE.PUT_LINE( FND_FILE.LOG,
' XYZ_INTRNL_DROP_INV_AMT '
);
FND_FILE.PUT_LINE( FND_FILE.LOG,
' ERROR TRANSACTION ID: ' || p_transaction_id
);
FND_FILE.PUT_LINE( FND_FILE.LOG,

Application Accounting Definition 18788687

File Ref: 386589801.docx

Company Confidential - For internal use only


' ERROR ITEM ID: ' || p_inventory_item
);

xyz_no_markup_inv_cost := 0;

RETURN xyz_no_markup_inv_cost;

END;

Application Accounting Definition 18888688

File Ref: 386589801.docx

Company Confidential - For internal use only

S-ar putea să vă placă și