You are on page 1of 11

Inventory Intercompany

Brown Bag

Presented by
Toni Davidson, Mike McMillan, Rod Emenaker
Steps to reproduce
----------------------------
Switch to Order Management Responsibility
1. Create Sales Order
2. Release Sales Order
3. Ship confirm Sales Order
4. Processed through Inventory Transactions Interface
5. Cost manager runs to cost the transactions in MMT
6. SQL Developer script to find eligible INV transactions for IC invoicing
See Appendix A - How to find the eligible INV transactions for IC invoicing

Common errors:
APP-INV-05706: Warning: Cannot retrieve transfer price for the item
APP-INV-05700: Warning: Mandatory Intercompany Relation or Transaction Flow not defined
between these two operating units

Switch to Inventory Responsibility


7. Run INCIAR - Create Intercompany AR Invoices
See Appendix B - Interface columns in Ra_interface_lines_all popluated by INCIAR

Switch to Receivables Responsibility


8. Run Autoinvoice Master Program

Switch to Inventory Responsibility


9. Run INCIAP - Create Intercompany AP Invoices

Switch to Payables Responsibility


10. Open Interfaces Invoices
11. Payables Open Interface Import

Reference Notes
784679.1 - Create a Intercompany invoice AR and AP overviews
458731.1 - Intercompany Invoices SR Template
Profile Options used by Intercompany
INV: Always suffix inter-Company AP Invoice number
INV: Intercompany Currency Conversion
INV: Intercompany Transfer Price Date
INV: Use Intercompany AR Tax for inter-Company AP
INV:Advanced Pricing for Intercompany Invoice
INV:Intercompany Invoice for Internal Orders
INV: Use Model & Options for Configuration Pricing
TAX: Inventory Item for Freight
TAX: Invoice Freight as Revenue
TAX: Allow Override of Tax Code
QP: Item Validation Organization
QP: Pricing Transaction Entity
QP: Source System Code
CST: Transfer Pricing Option
Questions

1. Must the Intercompany Sales Order be External?


No

2. On the Shipping Tab - can the Shipping organization be from the same Operating Unit as
the Sale Order?
No

3. Can the item be on more than the one Price List at the same precedence?
No

4. If there are no eligible INV transactions for IC invoicing, can be caused by


a. Cost manager has not ran
b. Cost manager completed with errors
c. No transactions are eligible
d. All the above

5. What interface table gets populated by INCIAR - Create Intercompany AR Invoices?


a. RA_INTERFACE_LINES_ALL table
b. RA_ CUSTOMER_TRX_LINES_ALL

6. Can Intercompany AP create an Accounts Payable invoice with Purchase Order Receipt?
Yes

7. In the Accounts Payable Invoice interface screen can you see the Transaction_ID
from MTL_MATERIAL_TRANSACTIONS ?
Yes

8. In the Accounts Payable invoice can you see the Transaction_ID


from MTL_MATERIAL_TRANSACTIONS ?
Yes
Appendix A - How to find the eligible INV transactions for IC invoicing
You can use the following script to find the eligible INV transactions for IC invoicing :

Provide &orgId

SELECT /*+ LEADING(MMT) INDEX(MMT MTL_MATERIAL_TRANSACTIONS_N24) USE_NL(OEL) USE_NL(HOI) */


/** sales order issue and rma receipt **/
mmt.transaction_id
, mmt.organization_id
, NVL(mmt.movement_id, 0)
, NVL(mmt.picking_line_id, 0)
, mmt.inventory_item_id
, mmt.transaction_uom
, TO_NUMBER(hoi.org_information3) /* ship org id */
, oel.org_id org_id /* sell org id */
, oel.org_id org_id /* order org id */
, 0 rae_flag /* Bug : 4391117 Indication that the record comes from RAE */
/* 'N' rae_flag Indication that the record comes from RAE */
, 0 /* Internal Order Flag */
FROM hr_organization_information hoi
, oe_order_lines_all oel
, mtl_material_transactions mmt
WHERE mmt.invoiced_flag = 'N'
AND mmt.costed_flag IS NULL
AND mmt.transaction_source_type_id IN(2, 12)
AND mmt.transaction_action_id IN(1, 27)
AND oel.line_id = mmt.trx_source_line_id
AND hoi.org_information3 = NVL(TO_CHAR(&orgId), hoi.org_information3)
AND hoi.organization_id = mmt.organization_id
AND hoi.org_information_context = 'Accounting Information'
AND NOT(mmt.movement_id IS NOT NULL
AND NOT EXISTS(SELECT NULL
FROM mtl_movement_statistics
WHERE movement_id = mmt.movement_id
AND customer_trx_line_id IS NOT NULL))
UNION ALL /** internal order **/
SELECT /*+ LEADING(MMT) INDEX(MMT MTL_MATERIAL_TRANSACTIONS_N24) USE_NL(HOIE) USE_NL(HOI) */
mmt.transaction_id
, mmt.organization_id
, NVL(mmt.movement_id, 0)
, NVL(mmt.picking_line_id, 0)
, mmt.inventory_item_id
, mmt.transaction_uom
, TO_NUMBER(hoi.org_information3) /* ship org id */
, TO_NUMBER(hoie.org_information3) org_id /* sell org id */
, TO_NUMBER(hoi.org_information3) /* order org id */
, 0 rae_flag /* Bug : 4391117 Indicator that the record comes from RAE */
/*, 'N' rae_flag Indicator that the record comes from RAE */
, 1 /* Internal Order flag */
FROM hr_organization_information hoi
, hr_organization_information hoie
, mtl_material_transactions mmt
WHERE fnd_profile.VALUE('INV_INTERCOMPANY_INVOICE_INTERNAL_ORDER') = 1 /* Yes */
AND mmt.invoiced_flag = 'N'
AND mmt.costed_flag IS NULL
AND mmt.transaction_source_type_id IN(8)
AND mmt.transaction_action_id IN(21)
AND hoi.org_information3 = NVL(TO_CHAR(&orgId), hoi.org_information3)
AND hoi.organization_id = mmt.organization_id
AND hoi.org_information_context = 'Accounting Information'
AND hoie.organization_id = mmt.transfer_organization_id
AND hoie.org_information_context = 'Accounting Information'
AND NOT(mmt.movement_id IS NOT NULL
AND NOT EXISTS(SELECT NULL
FROM mtl_movement_statistics
WHERE movement_id = mmt.movement_id
AND customer_trx_line_id IS NOT NULL))
UNION ALL /** Logical Intercompany Sales Issue for Shipping Flow **/
SELECT /*+ LEADING(MMT) INDEX(MMT MTL_MATERIAL_TRANSACTIONS_N24) USE_NL(HOI2) USE_NL(HOI) */
mmt.transaction_id
, mmt.organization_id
, NVL(mmt.movement_id, 0)
, NVL(mmt.picking_line_id, 0)
, mmt.inventory_item_id
, mmt.transaction_uom
, TO_NUMBER(hoi.org_information3) /* ship org id */
, TO_NUMBER(hoi2.org_information3) /* sell org id */
, oel.org_id org_id /* order org id */
, 0 rae_flag /* Bug : 4391117 Indicator that the record comes from RAE */
/*, 'N' rae_flag Indicator that the record comes from RAE */
, 0 /* Internal Order Flag */
FROM hr_organization_information hoi
, hr_organization_information hoi2
, oe_order_lines_all oel
, mtl_material_transactions mmt
, mtl_transaction_flow_headers mtfh
WHERE mmt.invoiced_flag = 'N'
AND mmt.costed_flag IS NULL
AND mmt.transaction_source_type_id = 13
AND mmt.transaction_action_id IN(9, 14) /* Logical Intercompany Sales Issue and Logical Intercompany Sales Return */
AND mmt.logical_trx_type_code IN(2, 5) /* Drop Ship Deliver and RMA SO Issue */
AND mmt.trx_flow_header_id = mtfh.header_id
AND mtfh.flow_type = 1
AND mtfh.new_accounting_flag = 'Y'
AND oel.line_id = mmt.trx_source_line_id
AND hoi.org_information3 = NVL(TO_CHAR(&orgId), hoi.org_information3)
AND hoi.organization_id = mmt.organization_id
AND hoi.org_information_context = 'Accounting Information'
AND hoi2.organization_id = mmt.transfer_organization_id
AND hoi2.org_information_context = 'Accounting Information'
AND NOT(mmt.movement_id IS NOT NULL
AND NOT EXISTS(SELECT NULL
FROM mtl_movement_statistics
WHERE movement_id = mmt.movement_id
AND customer_trx_line_id IS NOT NULL))
UNION ALL /** Logical Intercompany Sales Issue for Procuring Flow **/
SELECT /*+ LEADING(MMT) INDEX(MMT MTL_MATERIAL_TRANSACTIONS_N24) USE_NL(HOI2) USE_NL(HOI) */
mmt.transaction_id
, mmt.organization_id
, NVL(mmt.movement_id, 0)
, NVL(mmt.picking_line_id, 0)
, mmt.inventory_item_id
, mmt.transaction_uom
, TO_NUMBER(hoi.org_information3) /* procuring org id */
, TO_NUMBER(hoi2.org_information3) /* receiving org id */
, poh.org_id org_id /* purchase order org id */
, 0 rae_flag /* Bug : 4391117 Indicator that the record comes from RAE */
/*, 'N' rae_flag Indicator that the record comes from RAE */
, 0 /* Internal Order flag */
FROM hr_organization_information hoi
, hr_organization_information hoi2
, po_headers_all poh
, mtl_material_transactions mmt
, mtl_transaction_flow_headers mtfh
WHERE mmt.invoiced_flag = 'N'
AND mmt.costed_flag IS NULL
AND mmt.transaction_source_type_id = 13
AND mmt.transaction_action_id IN(9, 14) /* Logical Intercompany Sales Issue and Logical Intercompany Sales Return */
AND mmt.logical_trx_type_code IN(1, 3) /* Drop Ship Receipt and Global Procurement */
AND mmt.trx_flow_header_id = mtfh.header_id
AND mtfh.flow_type = 2
AND poh.po_header_id = mmt.transaction_source_id
AND hoi.org_information3 = NVL(TO_CHAR(&orgId), hoi.org_information3)
AND hoi.organization_id = mmt.organization_id
AND hoi.org_information_context = 'Accounting Information'
AND hoi2.organization_id = mmt.transfer_organization_id
AND hoi2.org_information_context = 'Accounting Information'
UNION ALL /** Global Procurement in RAE table **/
SELECT rae.accounting_event_id transaction_id
, rae.organization_id
, 0 /* movement id */
, rae.po_distribution_id /* picking line id */
, NVL(rae.inventory_item_id, 0)
, uom.uom_code
, rae.org_id /* procuring org id */
, rae.transfer_org_id /* receiving org id */
, pol.org_id /* purchase order org id */
, 1 rae_flag /* Bug : 4391117 Indicator that the record comes from RAE */
/*, 'Y' rae_flag Indicator that the record comes from RAE */
, 0 /* Internal Order flag */
FROM rcv_accounting_events rae
, mtl_units_of_measure uom
, po_lines_all pol
, mtl_transaction_flow_headers mtfh
WHERE rae.event_type_id IN(11, 12) /* Intercompany */
AND rae.po_line_id = pol.po_line_id
AND rae.transaction_unit_of_measure = uom.unit_of_measure
AND rae.trx_flow_header_id = mtfh.header_id
AND rae.invoiced_flag = 'N'
AND rae.org_id = &orgId
ORDER BY 7, 8, 1;

For values
Select TRANSACTION_TYPE_ID,TRANSACTION_ACTION_ID,TRANSACTION_SOURCE_TYPE_ID, DESCRIPTION from
mtL_transaction_types
where TRANSACTION_SOURCE_TYPE_ID in (2,8, 12, 13)
AND TRANSACTION_ACTION_ID in (1,9, 13,14, 21,27)
order by 3,2,1,4;
Appendix B - RA_INTERFACE_LINES_ALL
TABLE:
RA_INTERFACE_LINES_ALL

Progam: INCIAR Flow Type - Shipping


Column Name Meaning /Value
interface_line_context INTERCOMPANY
interface_line_attribute1 Sales Order Number
interface_line_attribute2 Sales Order Line Number
interface_line_attribute3 MMT Organization_id
interface_line_attribute4 Selling Organization ID
interface_line_attribute5 Shipping Organization ID
interface_line_attribute6 Sales Order line_id
interface_line_attribute7 MMT Transaction_id
interface_line_attribute8 orderOrgId
interface_line_attribute9 Oe_order_headers_all.header_id
interface_line_attribute10 '1' internal sales order or '0' sales order
interface_line_attribute11 NA
interface_line_attribute12 NA
interface_line_attribute13 NA
interface_line_attribute14 NA
interface_line_attribute15 “Y”
Appendix C - RA_ CUSTOMER_TRX_LINES_ALL
Program: INCIAP Flow Type - Shipping
Column Name Meaning /Value
interface_line_context INTERCOMPANY
interface_line_attribute1 Sales Order Number
interface_line_attribute2 Sales Order Line Number
interface_line_attribute3 MMT Organization_id
interface_line_attribute4 Selling Organization ID
interface_line_attribute5 Shipping Organization ID
interface_line_attribute6 Sales Order line_id
interface_line_attribute7 MMT Transaction_id
interface_line_attribute8 orderOrgId
interface_line_attribute9 Oe_order_headers_all.header_id
interface_line_attribute10 '1' internal sales order or '0' sales order

interface_line_attribute11 NA
interface_line_attribute12 NA
interface_line_attribute13 NA
interface_line_attribute14 NA
Null => Intercompany AP invoice inserted in AP interface tables,
interface_line_attribute15 “Y” => Create Intercompany AP invoice program yet to be run

As observed, Other than Interface_line_attribute15 and interface_line_attribute8, all other attributes


are carried forward as it is by 'Auto Invoice' program from ra_interface_lines_all to
ra_customer_trx_lines_all table.
Common errors:
APP-INV-05706: Warning: Cannot retrieve transfer price for the item

To find the Price list being used and if the Item is on the price list
.
a) select transaction_id,organization_id,inventory_item_id,
nvl(picking_line_id,0),nvl(movement_id,0),transaction_uom,
invoiced_flag,costed_flag,transaction_source_type_id,
transaction_action_id,trx_source_line_id
from mtl_material_transactions
where transaction_id = &txn_id
.
When prompted provide the transaction id from the INCIAR Log file which will be as follows
............
Processing shipment transaction, ID = <txn_id>
.
b) SELECT nvl(base_item_id,0)
FROM mtl_system_items
WHERE organization_id = &org_id
AND inventory_item_id = &item_id
.
Provide the organization_id and inventory_item_id obtained from Sql (a)
.
c) SELECT nvl(RSU.payment_term_id, nvl(RC.payment_term_id, -1))
, nvl(RSU.price_list_id, nvl(RC.price_list_id, -1))
FROM mtl_intercompany_parameters MIP
, ra_site_uses_all RSU
, ra_customers RC
WHERE MIP.sell_organization_id = &sell_org_id
AND MIP.ship_organization_id = &ship_org_id
AND RSU.site_use_id = MIP.customer_site_id
AND RSU.org_id = MIP.ship_organization_id
AND RC.customer_id = MIP.customer_id;
.
Provide the Selling Organization ID and Shipping Organization Id from the request Log file
.
d) select to_char(SPLL.operand) ,SPL.currency_code, qpa.product_uom_code,
SPLL.start_date_active,SPLL.end_date_active
from qp_pricing_attributes qpa, qp_list_lines spll,qp_list_headers_b spl
where qpa.list_header_id=&priceListId
and qpa.product_attribute_context= 'ITEM'
and qpa.product_attribute='PRICING_ATTRIBUTE1'
and qpa.product_attr_value= to_char(&itemId)
and qpa.qualification_ind = 4
and qpa.excluder_flag = 'N'
and qpa.pricing_phase_id=1
and spll.list_line_id=qpa.list_line_id
and spl.list_header_id = qpa.list_header_id
and sysdate between nvl(SPLL.start_date_active,(sysdate -1))
and nvl(SPLL.end_date_active+0.99999,(sysdate +1))
and rownum=1
.
Provide the Pricelist Id from Sql (c) and Provide Item Id from Sql (b).
APP-INV-05700: Warning: Mandatory Intercompany Relation or Transaction Flow not defined
between these two operating units

To find if the Transaction flow is setup and that its setup before the transaction is created
1) SELECT *
FROM mtl_parameters
WHERE organization_id IN (&shiporg, &sellorg); -- &shiporg, &sellorg
.
2) SELECT *
FROM mtl_transaction_flow_headers mfh
WHERE mfh.start_org_id = &shiporg -- &shiporg
AND mfh.end_org_id = &sellorg; -- &sellorg
.
3) SELECT mip.*
FROM mtl_intercompany_parameters mip
WHERE mip.ship_organization_id = &shiporg -- &shiporg
AND mip.sell_organization_id = &sellorg; -- &sellorg
.
4) SELECT *
FROM ic_tran_pnd pnd
WHERE pnd.trans_id IN (&trans_id); -- &trans_id from concurrent request log

5) SELECT mmt.CREATION_DATE
FROM mtl_material_transactions mmt
WHERE mmt.TRANSACTION_ID = &tran_id -- &trans_id from concurrent request log

6) SELECT *
FROM mtl_material_transactions mmt
WHERE mmt.TRANSACTION_ID = &tran_id -- &trans_id from concurrent request log

This creation date should be earlier than the Transaction Flow start date.

You might also like