Professional Documents
Culture Documents
Overview File Ref: Document1 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......................................................................................................................... 14 Accounting Definition Rules ............................................................................................... 15 Logical Intercompany Event Class ..................................................................................... 16 Logical Intercompany Event Class Journal Line Definitions ....................................... 17 Sales Order Issue Event Class ............................................................................................. 19 Sales Order Issue Deferred COGS Journal Line Types ................................................. 20 Sales Order Issue COGS Journal Line Types ................................................................. 23 Sales Order Issue Inventory Valuation Journal Line Types ......................................... 25 PL/SQL Function - XYZ_SALE_INTERCO_FLAG .......................................................... 27 PL/SQL Function - XYZ_COGS_RECOG_INTERCO_FLAG......................................... 30 PL/SQL Function - XYZ_INTERNAL_DROP_RECEIPT ................................................ 33
Overview File Ref: Document1 Company Confidential - For internal use only 2
PL/SQL Function - XYZ_INTRNL_DROP_RCPT_MRKP .............................................. 37 PL/SQL Function - XYZ_INTERCO_SEGMENT ............................................................. 40 PL/SQL Function - XYZ_INTRNL_DROP_COGS_AMT ............................................... 43 PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT ................................................... 47
Overview File Ref: Document1 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.
Overview File Ref: Document1 Company Confidential - For internal use only
DR 973.58 1246.21
CR 973.58
Logical Intercompany Shipment Receipt Logical Sales Order Issue Logical Sales Order Issue COGS Recognition COGS Recognition
Inventory - Finished Goods Inventory Accrual - Intercompany Inventory - Finished Goods Inventory - Deferred COGS Inventory - Deferred COGS Cost of Goods Sold third party
Internal Drop Ship without modified SLA File Ref: Document1 Company Confidential - For internal use only
Transaction Type Logical Intercompany Sales Issue Logical Intercompany Sales Issue Logical Intercompany Shipment Receipt Logical Intercompany Shipment Receipt
Description Shipper at shipper standard cost Shipper at shipper standard cost Receiver 973.58 X currency onversion rate of 1.0079 = 981.27 Receiver at shipper standard cost plus 973.58 X .27% markup = 262.86 X currency conversion rate of 1.0079 = 264.94
DR 973.58 981.27
CR 973.58
Inventory - Finished Goods 264.94 Intercompany Markup - capitalized Inventory Accrual - Interco Inventory - Finished Goods Inventory - Deferred COGS Inventory - Deferred COGS Cost of Goods Sold third party
Logical Intercompany Shipment Receipt Logical Sales Order Issue Logical Sales Order Issue COGS Recognition COGS Recognition Receiver when sell to 3 party customer rd Receiver when sell to 3 party customer COGS recognized when revenue is earned COGS recognized when revenue is earned
rd
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.
Internal Drop Ship with modified SLA File Ref: Document1 Company Confidential - For internal use only
Definition Definition Code XYZ Cost Manager XYZ Cost Manager XYZ custom Cost Management Name Description
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 File Ref: Document1 Company Confidential - For internal use only 7
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.
The actual code for these functions is listed at the end of the paper.
PL/SQL Functions File Ref: Document1 Company Confidential - For internal use only
Sub-Ledger Accounting Setups File Ref: Document1 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 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
USED IN SALES ISSUE EVENT XYZ_SALE _INTERCO _FLAG XYZ INTERCO SEGMENT XYZ_COGS _RECOG_I NTERCO_F LAG XYZ INTRNL DROP COGS AMT XYZ INTRNL DROP INV AMT
XYZ_SALE _INTERCO _FLAG XYZ INTERCO SEGMENT XYZ_COGS _RECOG_I NTERCO_F LAG XYZ INTRNL DROP COGS AMT XYZ INTRNL DROP INV AMT
XYZ_SALE _INTERCO _FLAG XYZ_INTE RCO_SEG MENT XYZ_COGS _RECOG_I NTERCO_F LAG XYZ_INTR NL_DROP_ COGS_AM T XYZ_INTR NL_DROP_ INV_AMT
No
Intercompany Segment
Yes
No
No
TRANSACTION_ID in Costing
Nume ric
No
TRANSACTION_ID in Costing
Custom Sources File Ref: Document1 Company Confidential - For internal use only
10
Description
Custom Source Code USED IN INTERCO MPANY EVENT XYZ_INTE RNAL_DR OP_RECEI PT XYZ_INTR NL_DROP_ RCPT_MR KP
Data Type
Segment
Accounting Flexfield
Parameter
Parameter
Nume ric
No
TRANSACTION_ID in Costing
Nume ric
No
TRANSACTION_ID in Costing
Custom Sources File Ref: Document1 Company Confidential - For internal use only
11
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 Accounted Amount Accounted Amount XYZ INTRNL DROP COGS AMT XYZ INTRNL DROP INV AMT Source
Assign Custom Sources to Event Class File Ref: Document1 Company Confidential - For internal use only
12
Assign Custom Sources to Event Class File Ref: Document1 Company Confidential - For internal use only
13
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 IC_Markup Meaning Inter-company Markup Description Inter-company Markup
XLA Lookups File Ref: Document1 Company Confidential - For internal use only
14
Segment
Intercompany
10
Source
Accounting Definition Rules File Ref: Document1 Company Confidential - For internal use only
15
Logical Intercompany Event Class File Ref: Document1 Company Confidential - For internal use only
16
Accounting Class
Rounding Class
Condition
Logical Intercompany
( WHEN YOU COPY THE LINE TYPE, MAKE SURE IT DOES NOT CHANGE THE EVENT CLASS. )
Inv receipt markup executes with the XYZ INTRNL Logical Intercompany
Inventory Valuation
Inventory Valuation
XYZ_INTRNL_DROP _MRKP
XYZ_INTRNL_ DROP_MRKP
Inventory Valuation
Inventory Valuation
Logical Intercompany Event Class Journal Line Definitions File Ref: Document1 Company Confidential - For internal use only
17
Accounting Class
Rounding Class
Condition
Inventory Valuation
Inventory Valuation
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
Logical Intercompany Event Class Journal Line Definitions File Ref: Document1 Company Confidential - For internal use only
18
Sales Order Issue Event Class File Ref: Document1 Company Confidential - For internal use only
19
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:
Accounting Class
Rounding Class
Debit / Credit
Condition
Debit
Accounting Line Type =36 AND Accounting Event Type Name = 'COGS Recognition' AND XYZ COGS RECOG INTERCO FLAG = 'N'
Sales Order Issue Deferred COGS Journal Line Types File Ref: Document1 Company Confidential - For internal use only
20
Accounting Class
Rounding Class
Debit / Credit
Condition
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
Accounting Line Type =36 AND Accounting Event Type Name = 'COGS Recognition' AND XYZ COGS RECOG INTERCO FLAG = 'Y'
Debit
Debit
Accounting Line Type =36 AND Accounting Event Type Name = 'RMA Receipt' AND XYZ COGS RECOG INTERCO FLAG = 'N' Accounting Line Type =36 AND Accounting Event Type Name = 'Sales Order Issue' AND XYZ_SALE_INTERCO _FLAG = 'N' Accounting Line Type =36 AND Accounting Event Type Name = 'Logical Sales Order Issue' AND XYZ SALE INTERCO FLAG = 'Y'
Accounted Amount
Sales Order Issue Deferred COGS Journal Line Types File Ref: Document1 Company Confidential - For internal use only
21
Accounting Class
Rounding Class
Debit / Credit
Condition
On new line types, always turn on debit and switch debit/credit. This means positive will be debit and negative will be credit.
Sales Order Issue Deferred COGS Journal Line Types File Ref: Document1 Company Confidential - For internal use only
22
Accounting Class
Rounding Class
Debit / Credit
Condition
Debit
Accounting Line Type =35 AND Accounting Event Type Name = 'COGS Recognition' AND XYZ COGS RECOG INTERCO FLAG = 'Y' Accounting Line Type =35 AND Accounting Event Type Name = 'COGS Recognition' AND XYZ COGS RECOG INTERCO FLAG = 'N'
Debit
Sales Order Issue COGS Journal Line Types File Ref: Document1 Company Confidential - For internal use only
23
Accounting Class
Rounding Class
Debit / Credit
Condition
Debit
Accounting Line Type =35 AND Accounting Event Type Name = 'RMA Receipt' AND 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.
Sales Order Issue COGS Journal Line Types File Ref: Document1 Company Confidential - For internal use only
24
Accounting Class
Rounding Class
Debit / Credit
Condition
internal drop ship customer facing logical sales issue inv valuation
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 Debit
Accounting Line Type =1 AND Accounting Event Type Name = 'Logical Sales Order Issue' AND XYZ SALE INTERCO FLAG = 'Y'
RMA
Inventory Valuation
Inventory Valuation
Accounting Line Type =1 AND Accounting Event Type Name = 'RMA Receipt' AND XYZ SALE INTERCO FLAG = 'N'
Sales Order Issue Inventory Valuation Journal Line Types File Ref: Document1 Company Confidential - For internal use only
25
Accounting Class
Rounding Class
Debit / Credit
Condition
Inventory Valuation
Inventory Valuation
Debit
Accounting Line Type =1 AND Accounting Event Type Name = 'Sales Order Issue' AND 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.
Sales Order Issue Inventory Valuation Journal Line Types File Ref: Document1 Company Confidential - For internal use only
26
-- ************************************ 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 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 );
PL/SQL Function - XYZ_SALE_INTERCO_FLAG File Ref: Document1 Company Confidential - For internal use only 28
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 );
PL/SQL Function - XYZ_SALE_INTERCO_FLAG File Ref: Document1 Company Confidential - For internal use only
29
, 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 ' ); 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 xyz_cogs_recog_interco_flag:='N';
PL/SQL Function - XYZ_COGS_RECOG_INTERCO_FLAG File Ref: Document1 Company Confidential - For internal use only 31
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;
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 );
, 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' -- *************************************************** 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??? ; -- ************************************
PL/SQL Function - XYZ_INTERNAL_DROP_RECEIPT File Ref: Document1 Company Confidential - For internal use only 34
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; -- ************************************ 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 );
END;
PL/SQL Function - XYZ_INTERNAL_DROP_RECEIPT File Ref: Document1 Company Confidential - For internal use only
36
, 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' ; -- ************************************ 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; -- ************************************
PL/SQL Function - XYZ_INTRNL_DROP_RCPT_MRKP File Ref: Document1 Company Confidential - For internal use only 38
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 );
PL/SQL Function - XYZ_INTRNL_DROP_RCPT_MRKP File Ref: Document1 Company Confidential - For internal use only
39
VARCHAR2(3);
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 ); 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 ' ); FND_FILE.PUT_LINE( FND_FILE.LOG,
PL/SQL Function - XYZ_INTERCO_SEGMENT File Ref: Document1 Company Confidential - For internal use only 41
' ERROR TRANSACTION ID: ' || p_transaction_id ); FND_FILE.PUT_LINE( FND_FILE.LOG, ' ERROR ITEM ID: ' || p_inventory_Item );
PL/SQL Function - XYZ_INTERCO_SEGMENT File Ref: Document1 Company Confidential - For internal use only
42
, 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' -- ********************************************* 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 rates.to_currency = mmt3.currency_code AND
PL/SQL Function - XYZ_INTRNL_DROP_COGS_AMT File Ref: Document1 Company Confidential - For internal use only 44
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 ); 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 ' ); FND_FILE.PUT_LINE( FND_FILE.LOG, ' ERROR TRANSACTION ID: ' || p_transaction_id ); FND_FILE.PUT_LINE( FND_FILE.LOG,
PL/SQL Function - XYZ_INTRNL_DROP_COGS_AMT File Ref: Document1 Company Confidential - For internal use only 45
PL/SQL Function - XYZ_INTRNL_DROP_COGS_AMT File Ref: Document1 Company Confidential - For internal use only
46
CREATE OR REPLACE FUNCTION XYZ_INTRNL_DROP_INV_AMT -- **** INV RCPT NO MARKUP ON INTERNAL DROP SHIP ( p_inventory_Item , p_transaction_id ) 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 */ ROUND ( ( ( mmt3.intercompany_cost
PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT File Ref: Document1 Company Confidential - For internal use only 47
IN NUMBER IN NUMBER
( mmt3.intercompany_cost - ( rates.conversion_rate * mmt1.actual_cost ) ) ) * mmt3.transaction_quantity ) ,2 ) INTO xyz_no_markup_inv_cost FROM mtl_material_transactions , mtl_material_transactions , mtl_transaction_types , mtl_material_transactions , mtl_transaction_types , mtl_material_transactions , mtl_transaction_types , gl_daily_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
PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT File Ref: Document1 Company Confidential - For internal use only 48
extend_inv
rates
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' -- ********************************************* -- **** 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??? ;
PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT File Ref: Document1 Company Confidential - For internal use only 49
-- ************************************ 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 ); 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)
PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT File Ref: Document1 Company Confidential - For internal use only 50
); 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, ' ERROR ITEM ID: ' || p_inventory_item );
END;
PL/SQL Function - XYZ_INTRNL_DROP_INV_AMT File Ref: Document1 Company Confidential - For internal use only
51