Upload
madhu-devarasetti
View
195
Download
5
Tags:
Embed Size (px)
DESCRIPTION
White Paper Subledger Accounting
Citation preview
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 119561
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 129562
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 139563
Sales Order Issue – Inventory Valuation Journal Line Types......................24
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 149564
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.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 159565
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 169566
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 Receipt Receiver – at shipper standard cost plus
973.58 X .27% markup = 262.86 X currency
conversion rate of 1.0079 = 1246.21 Inventory - Finished Goods
1246.21
Logical Intercompany Shipment Receipt Receiver Inventory Accrual - Intercompany 1246.21
Logical Sales Order Issue Receiver – when sell to 3rd party customer Inventory - Finished Goods 1246.21
Logical Sales Order Issue Receiver – when sell to 3rd party customer Inventory - Deferred COGS 1246.21
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 179567
COGS Recognition COGS recognized when revenue is earned Inventory - Deferred COGS
1246.21
COGS Recognition COGS recognized when revenue is earned Cost of Goods Sold – third party
1246.21
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 189568
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 Cost of sales - Intercompany 973.58
Logical Intercompany Shipment Receipt Receiver – 973.58 X currency
onversion rate of 1.0079 = 981.27 Inventory - Finished Goods
981.27
Logical Intercompany Shipment Receipt Receiver – at shipper standard cost plus
973.58 X .27% markup = 262.86 X currency
conversion rate of 1.0079 = 264.94 Intercompany Markup - capitalized
264.94
Logical Intercompany Shipment Receipt Inventory Accrual - Interco 1246.21
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 199569
Logical Sales Order Issue Receiver – when sell to 3rd party customer Inventory - Finished Goods 981.27
Logical Sales Order Issue Receiver – when sell to 3rd party customer Inventory - Deferred COGS 981.27
COGS Recognition COGS recognized when revenue is earned Inventory - Deferred COGS
981.27
COGS Recognition COGS recognized when revenue is earned Cost of Goods Sold – third party
981.27
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.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11095610
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11195611
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
Code
Definition
NameDescription
Chart of Accounts Transaction
Chart of Accounts Accounting
XYZ Cost Manager
XYZ Cost Manager
XYZ custom Cost Management
XYZ Corp Accounting Flexfield
XYZ Corp Accounting Flexfield
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11295612
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11395613
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.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11495614
The actual code for these functions is listed at the end of the paper.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11595615
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 Form2. Entity = “Material Account Events”3. Event Class Code = “LOG_INTERCOMPANY”4. Event Type Codes should be listed
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11695616
Custom Sources
Now create custom sources using the following form:
Cost Manager – SLA -> SLA -> Accounting Setup > Accounting Methods Builder -> Sources -> Custom Sources
Description Custom
Source
Code
Custom
Source
Name
PL/SQL
Function
Name
Data
Type
Segment Accounting
Flexfield
Parameter Parameter
USED IN SALES ISSUE EVENT
Returns “Y” if transaction is internal drop ship XYZ_SALE_INTERCO_FLAG
XYZ_SALE_INTERCO_FLAG
XYZ_SALE_INTERCO_FLAG
Alphanumeric
No Inventory Item in Costing
TRANSACTION_ID in Costing
For internal drop ship returns the intercompany segment
XYZ INTERCO SEGMENT
XYZ INTERCO SEGMENT
XYZ_INTERCO_SEGMENT
Alphanumeric
Intercompany Segment
Yes Inventory Item in Costing
TRANSACTION_ID in Costing
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11795617
Description Custom
Source
Code
Custom
Source
Name
PL/SQL
Function
Name
Data
Type
Segment Accounting
Flexfield
Parameter Parameter
Only called by COGS recognition. Returns “Y” if transaction is a COGS recognition on an internal drop ship
XYZ_COGS_RECOG_INTERCO_FLAG
XYZ_COGS_RECOG_INTERCO_FLAG
XYZ_COGS_RECOG_INTERCO_FLAG
Alphanumeric
No Inventory Item in Costing
TRANSACTION_ID in Costing
Internal drop COGS amt downstream after markup removed
XYZ INTRNL DROP COGS AMT
XYZ INTRNL DROP COGS AMT
XYZ_INTRNL_DROP_ COGS_AMT
Numeric
No Inventory Item in Costing
TRANSACTION_ID in Costing
Internal drop INV amt downstream after markup removed
XYZ INTRNL DROP INV AMT
XYZ INTRNL DROP INV AMT
XYZ_INTRNL_DROP_ INV_AMT
Numeric
No Inventory Item in Costing
TRANSACTION_ID in Costing
USED IN INTERCOMPANY EVENT
Internal drop inventory receipt amount XYZ_INTERNAL_DROP_RECEIPT
XYZ_INTERNAL_DROP_RECEIPT
XYZ_INTERNAL_DROP_RECEIPT
Numeric
No Inventory Item in Costing
TRANSACTION_ID in Costing
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11895618
Description Custom
Source
Code
Custom
Source
Name
PL/SQL
Function
Name
Data
Type
Segment Accounting
Flexfield
Parameter Parameter
Internal drop receipt markup XYZ_INTRNL_DROP_RCPT_MRKP
XYZ_INTRNL_DROP_RCPT_MRKP
XYZ_INTRNL_DROP_RCPT_MRKP
Numeric
No Inventory Item in Costing
TRANSACTION_ID in Costing
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 11995619
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.
Accounting
Attribute
Source
Accounted
Amount
XYZ_INTERNAL_DROP_RECEIPT
Entered
Amount
XYZ_INTRNL_DROP_RCPT_MRKP
Accounted
Amount
XYZ_INTRNL_DROP_RCPT_MRKP
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12095620
Accounting
Attribute
Source
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.
Accounting
Attribute
Source
Accounted
Amount
XYZ INTRNL DROP COGS AMT
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12195621
Accounting
Attribute
Source
Accounted
Amount
XYZ INTRNL DROP INV AMT
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12295622
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_Markup
Inter-company Markup
Inter-company Markup
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12395623
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
Code
Rule
Name
Chart of
Accounts
Transaction
Chart of
Accounts
Accounting
Output
Type
Segment
Name
Priority
Value
Type
Value Condition
Inter-company Markup Account. XYZ INTERCO MARKUP
XYZ INTERCO MARKUP
XYZ_CORP_ACCOUNTING_FLEXFIELD
XYZ_CORP_ACCOUNTING_FLEXFIELD
Segment
Account 10 Constant
122500
XYZ INTERCO SEGMENT used for intercompany eliminations.
XYZ INTERCO SEGMENT
XYZ INTERCO SEGMENT
XYZ_CORP_ACCOUNTING_FLEXFIELD
XYZ_CORP_ACCOUNTING_FLEXFIELD
Segment
Intercompany
10 Source XYZ INTERCO SEGMENT
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12495624
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.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12595625
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:
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12695626
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
Sales Issue at std cost.
( WHEN YOU COPY THE LINE TYPE, MAKE SURE IT DOES NOT CHANGE THE EVENT CLASS. )
Logical Intercompany
XYZ INTRNL DROP ISSUE
XYZ INTRNL DROP ISSUE
XYZ_CORP_ACCOUNTING_FLEXFIELD
Inventory Valuation
Inventory Valuation
Accounting Line Type =1 AND
Accounting Event Type Code = 'LOG_IC_SALES_ISSUE'
Accounted Amount
=
Accounted Amount
Inv receipt markup –
executes with the XYZ INTRNL DROP RCPT INV
Logical Intercompany
XYZ_INTRNL_DROP_MRKP
XYZ_INTRNL_DROP_MRKP
XYZ_CORP_ACCOUNTING_FLEXFIELD
Inventory Valuation
Inventory Valuation
Accounting Line Type =1 AND
Accounting Event Type Name =
LOG_IC_SHIPMENT_RCPT
Accounted Amount
=
XYZ_INTRNL_DROP_RCPT_MRKP
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12795627
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Condition Accounting
Attribute
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
This includes the PPV amount
Executes with XYZ_INTRNL_DROP_MRKP
Logical Intercompany
XYZ INTRNL DROP RCPT INV
XYZ INTRNL DROP RCPT INV
XYZ_CORP_ACCOUNTING_FLEXFIELD
Inventory Valuation
Inventory Valuation
Accounting Line Type =1 AND
Accounting Event Type Name = LOG_IC_SHIPMENT_RCPT
Accounted Amount
=
XYZ INTERNAL DROP RECEIPT
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12895628
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 12995629
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.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13095630
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13195631
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:
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13295632
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
THIRD PARTY AND EXTERNAL DROP COGS RECOG FOR DEFERRED
Sales Order Issue
XYZ COGS RECOG 3RD DEFERRED
XYZ COGS RECOG 3RD DEFERRED
XYZ_CORP_ACCOUNTING_FLEXFIELD
Deferred Cost of Goods Sold
Deferred Cost of Goods Sold
Debit Accounting Line Type =36
AND
Accounting Event Type Name = 'COGS Recognition'
AND
XYZ COGS RECOG INTERCO FLAG = 'N'
Accounted Amount
=
Accounted Amount
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13395633
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
CUSTOMER FACING INTERNAL DROP COGS RECOG FOR DEFERRED COGS
CREDIT – THIS IS BECAUSE THE CUSTOM SOURCE ALWAYS RETURNS A POSITIVE AMOUNT AND IS ALSO USED FOR THE COGS ENTRY, BUT THIS ENTRY NEEDS TO BE CREDITED
Sales Order Issue
XYZ COGS RECOG DEFERRED
XYZ COGS RECOG DEFERRED
XYZ_CORP_ACCOUNTING_FLEXFIELD
Deferred Cost of Goods Sold
Deferred Cost of Goods Sold
Accounting Line Type =36
AND
Accounting Event Type Name = 'COGS Recognition'
AND
XYZ COGS RECOG INTERCO FLAG = 'Y'
XYZ INTRNL DROP COGS AMT
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13495634
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
XYZ COGS RMA DEFERRED
Sales Order Issue
XYZ COGS RMA DEFERRED
XYZ COGS RMA DEFERRED
XYZ_CORP_ACCOUNTING_FLEXFIELD
Deferred Cost of Goods Sold
Deferred Cost of Goods Sold
Debit Accounting Line Type =36
AND
Accounting Event Type Name = 'RMA Receipt'
AND
XYZ COGS RECOG INTERCO FLAG = 'N'
Accounted Amount
=
Accounted
Amount
THIRD PARTY SHIP AND EXTERNAL DROP SHIP DCOGS
Sales Order Issue
XYZ DEFERRED COGS
XYZ DEFERRED COGS
XYZ_CORP_ACCOUNTING_FLEXFIELD
Deferred Cost of Goods Sold
Deferred Cost of Goods Sold
Debit Accounting Line Type =36 AND Accounting Event Type Name = 'Sales Order Issue' AND XYZ_SALE_INTERCO_FLAG = 'N'
Accounted Amount
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13595635
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
customer facing logical sales issue deferred COGS
DEBIT
Sales Order Issue
XYZ LOGICAL DEFERRED COGS
XYZ LOGICAL DEFERRED COGS
XYZ_CORP_ACCOUNTING_FLEXFIELD
Deferred Cost of Goods Sold
Deferred Cost of Goods Sold
Accounting Line Type =36
AND
Accounting Event Type Name = 'Logical Sales Order Issue'
AND
XYZ SALE INTERCO FLAG = 'Y'
Accounted Amount
=
XYZ_INTRNL_DROP_INV_AMT
On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13695636
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:
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13795637
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
CUSTOMER FACING INTERNAL DROP COGS RECOG FOR DEFERRED COGS
Sales Order Issue
XYZ COGS RECOG INTERCO
XYZ COGS RECOG INTERCO
XYZ_CORP_ACCOUNTING_FLEXFIELD
Cost of Goods Sold
Cost of Goods Sold
Debit Accounting Line Type =35
AND
Accounting Event Type Name = 'COGS Recognition'
AND
XYZ COGS RECOG INTERCO FLAG = 'Y'
XYZ INTRNL DROP COGS AMT
THIRD PARTY AND EXTERNAL DROP COG RECOG COGS AMT
Sales Order Issue
XYZ COGS RECOG SO
XYZ COGS RECOG SO
XYZ_CORP_ACCOUNTING_FLEXFIELD
Cost of Goods Sold
Cost of Goods Sold
Debit Accounting Line Type =35
AND
Accounting Event Type Name = 'COGS Recognition'
AND
XYZ COGS RECOG INTERCO FLAG = 'N'
Accounted Amount
=
Accounted
Amount
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13895638
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
XYZ COGS RMA Sales Order Issue
XYZ COGS RMA
XYZ COGS RMA
XYZ_CORP_ACCOUNTING_FLEXFIELD
Cost of Goods Sold
Cost of Goods Sold
Debit Accounting Line Type =35
AND
Accounting Event Type Name = 'RMA Receipt'
AND
XYZ COGS RECOG INTERCO FLAG = 'N'
Accounted Amount
=
Accounted
Amount
On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 13995639
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:
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14095640
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
internal drop ship
customer facing logical sales issue inv valuation
Sales Order Issue
XYZ INT DROP INV VALUATION
XYZ INT DROP INV VALUATION
XYZ_CORP_ACCOUNTING_FLEXFIELD
Inventory Valuation
Inventory Valuation
CREDIT – BECAUSE THE CUSTOM SOURCE RETURNS A POSITIVE AND IS ALSO USED FOR THE DEFERRED COGS SIDE OF THE LOGICAL SALES ISSUE BUT HERE WE NEED A CREDIT SINCE SHIPPING OUT INVENTORY
Accounting Line Type =1 AND
Accounting Event Type Name = 'Logical Sales Order Issue'
AND
XYZ SALE INTERCO FLAG = 'Y'
Accounted Amount
=
XYZ_INTRNL_DROP_INV_AMT
RMA Sales Order Issue
XYZ RMA INV VALUATION
XYZ RMA INV VALUATION
XYZ_CORP_ACCOUNTING_FLEXFIELD
Inventory Valuation
Inventory Valuation
Debit Accounting Line Type =1 AND
Accounting Event Type Name = 'RMA Receipt' AND
XYZ SALE INTERCO FLAG = 'N'
Accounted Amount
=
Accounted Amount
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14195641
DescriptionEvent Class
Line
Type
Code
NameTransaction
Chart of
Accounts
Accounting
Class
Rounding
Class
Debit
/
Credit
Condition Accounting
Attribute
Assignments:
Source for Accounted Amount
3rd party and external drop so inv valuation
Sales Order Issue
XYZ SO INV VALUATION
XYZ SO INV VALUATION
XYZ_CORP_ACCOUNTING_FLEXFIELD
Inventory Valuation
Inventory Valuation
Debit Accounting Line Type =1 AND
Accounting Event Type Name = 'Sales Order Issue'
AND
XYZ SALE INTERCO FLAG = 'N'
Accounted Amount
=
Accounted Amount
On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14295642
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14395643
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14495644
/*+ 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'
;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14595645
-- ************************************
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;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14695646
-- ************************************
EXCEPTION
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14795647
);
RETURN xyz_sale_interco_flag;
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14895648
);
xyz_sale_interco_flag:='N';
RETURN xyz_sale_interco_flag;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 14995649
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15095650
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';
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15195651
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15295652
, inv.mtl_transaction_types ttype
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 '
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15395653
);
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;
-- ************************************
EXCEPTION
WHEN NO_DATA_FOUND THEN
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15495654
xyz_cogs_recog_interco_flag:='N';
FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
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;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15595655
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,
' 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';
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15695656
RETURN xyz_cogs_recog_interco_flag;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15795657
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 */
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15895658
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 15995659
, mtl_transaction_types ttype3
, 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'
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16095660
-- ***************************************************
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'
-- *********************************************
-- **** 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???
;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16195661
-- ************************************
FND_FILE.NEW_LINE( FND_FILE.LOG, 1 );
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;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16295662
-- ************************************
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_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
);
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16395663
xyz_no_markup_inv_cost := 0;
RETURN xyz_no_markup_inv_cost;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16495664
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16595665
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16695666
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 */
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16795667
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16895668
, mtl_material_transactions mmt2
, 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'
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 16995669
;
-- ************************************
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;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17095670
-- ************************************
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_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
);
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17195671
xyz_markup_inv_cost := 0;
RETURN xyz_markup_inv_cost;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17295672
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17395673
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17495674
/*+ 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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17595675
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
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17695676
);
FND_FILE.PUT_LINE( FND_FILE.LOG,
' 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 '
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17795677
);
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_interco_segment:='000';
RETURN xyz_interco_segment;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17895678
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 17995679
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18095680
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18195681
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18295682
, 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 */
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'
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18395683
-- *********************************************
AND
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18495684
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_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
);
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18595685
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_COGS_AMT '
);
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18695686
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;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18795687
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18895688
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 18995689
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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 19095690
/*+ 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
, mtl_material_transactions mmt2
, mtl_transaction_types ttype2
, mtl_material_transactions mmt3
, mtl_transaction_types ttype3
, gl_daily_rates rates
WHERE
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 19195691
/*+ 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
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'
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 19295692
-- *********************************************
-- **** 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
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 19395693
);
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
);
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 19495694
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;
END;
File Ref: document.docx
Company Confidential - For internal use only
Application Accounting Definition 19595695