CREATE OR REPLACE VIEW adempiere.JP_StorageOnHand_Locator_RV AS
SELECT 
 s.AD_Client_ID AS AD_Client_ID
 ,0 AS AD_Org_ID
 ,s.AD_Org_ID	AS JP_Org_ID
 ,s.M_Locator_ID AS M_Locator_ID 
 ,s.M_Product_ID AS M_Product_ID 
 ,s.QtyOnHand AS QtyOnHand
 ,s.IsActive
 ,l.IsCommonLocatorJP AS IsCommonLocatorJP
 ,l.JP_PhysicalWarehouse_ID AS JP_PhysicalWarehouse_ID
 ,l.M_Warehouse_ID AS M_Warehouse_ID
 ,l.M_LocatorType_ID AS M_LocatorType_ID
 ,l.X AS X
 ,l.Y AS Y
 ,l.Z AS Z
 ,p.C_UOM_ID AS C_UOM_ID
 ,p.Discontinued AS Discontinued
 ,p.ProductType AS ProductType
 ,p.IsStocked AS IsStocked
 ,p.IsBOM AS IsBOM
 ,p.IsDropShip AS IsDropShip
 ,p.M_Product_Category_ID AS M_Product_Category_ID
 ,pc.JP_ProductCategoryL1_ID AS JP_ProductCategoryL1_ID
 ,pl1.JP_ProductCategoryL2_ID AS JP_ProductCategoryL2_ID
 ,org.JP_Corporation_ID

FROM adempiere.JP_StorageOnHand_Locator s 
	INNER JOIN adempiere.M_Locator l ON (s.M_Locator_ID = l.M_Locator_ID)
	INNER JOIN adempiere.M_Product p ON (s.M_Product_ID = p.M_Product_ID)
        INNER JOIN adempiere.M_Product_Category pc ON (p.M_Product_Category_ID=pc.M_Product_Category_ID)
		LEFT OUTER JOIN adempiere.JP_ProductCategoryL1 pl1 ON (pc.JP_ProductCategoryL1_ID=pl1.JP_ProductCategoryL1_ID)
	LEFT OUTER JOIN adempiere.AD_OrgInfo org ON (s.AD_Org_ID = org.AD_Org_ID)