Set Warehouse According to the Value of Some Other Attribute
Set up Order Management so it sets the default value for the Warehouse attribute on the order line according to the value of the Business Unit attribute on the order header.
Assume the Vision Operations business unit sells desktop computers and it uses only the M5 Denver Manufacturing warehouse to build them. You will implement this logic:
If the Business Unit contains Vision Operations on the order header, then set the
Warehouse on the order line to Denver Manufacturing.
Summary of the Setup
-
Get values for your attributes.
-
Create an order management extension.
-
Test your setup.
Get Values for Your Attributes
-
Get the ID for the business unit.
-
Do an SQL.
SELECT haotl.NAME BU_NAME, hao.organization_id FROM fusion.HR_ALL_ORGANIZATION_UNITS_F hao, fusion.HR_ORGANIZATION_UNITS_F_TL haotl, fusion.HR_ORG_UNIT_CLASSIFICATIONS_F houc, fusion.hr_organization_information_f hoi WHERE hao.ORGANIZATION_ID = haotl.ORGANIZATION_ID AND houc.ORGANIZATION_ID = haotl.ORGANIZATION_ID AND houc.CLASSIFICATION_CODE = 'FUN_BUSINESS_UNIT' AND hoi.ORGANIZATION_ID = haotl.ORGANIZATION_ID AND hoi.ORG_INFORMATION_CONTEXT = houc.CLASSIFICATION_CODE AND TRUNC(SYSDATE) BETWEEN haotl.EFFECTIVE_START_DATE AND haotl.EFFECTIVE_END_DATE AND haotl.LANGUAGE = USERENV('LANG') AND haotl.EFFECTIVE_START_DATE = hao.EFFECTIVE_START_DATE AND haotl.EFFECTIVE_END_DATE = hao.EFFECTIVE_END_DATE AND upper(Haotl.name)LIKE '&BUSINESS_UNIT_NAME%' ORDER BY BU_NAME;
For details, see Use SQL to Query Order Management Data.
-
In the query result, locate the row that contains Vision Operations in the BU_NAME column. Assume the query returns these values.
BU_NAME
ORGANIZATION_ID
Vision Operations
300000001616323
Customer
Computer Service and Rentals
-
-
Get the ID for the warehouse.
-
Do an SQL.
SELECT haotl.NAME, iop.ORGANIZATION_CODE, iop.ORGANIZATION_ID FROM fusion.Inv_Org_Parameters iop, fusion.HR_ORGANIZATION_UNITS_F_TL haotl WHERE haotl.organization_id = iop.business_unit_id AND haotl.LANGUAGE = USERENV('LANG') AND upper(iop.ORGANIZATION_CODE) LIKE '&INVENTORY_CODE%' ORDER BY haotl.NAME,
-
In the query result, locate the row that contains M5 Denver Manufacturing in the ORGANIZATION_CODE column. Assume the query returns these values.
ORGANIZATION_CODE
ORGANIZATION_ID
M5 Denver Manufacturing
300000001621783
-
Create an Extension
Create an extension that uses the IDs you identified to set the warehouse attribute according to the If condition described earlier in this topic. For some similar example code, see the Set the Default Value for Ship-To Address According to Business Unit subtopic in Extend Shipping.
Test Your Setup
-
Create a sales order.
Attribute
Value
Business Unit
Vision Operations
-
Verify that Order Management automatically set the value.
Attribute
Value
Warehouse
M5 Denver Manufacturing