Drilling up to top level demand for planned orders in MRP
I have done a lot of searching and haven't found anything that has helped me create a query to find the top level demand for planned orders being generated in the MRP workbench. Our company does not use pegging for it's items or Bills of materials. What I am trying to do is find both the supply records (i.e. planned orders with either a given planner code), and then find the demand records associated to those planned orders. Problem is the planner for the discrete job demand is not the same as the planned orders.
The query I have so far gives me the first assembly demand record if one exists. It then gives me the supply records for the raw items and the order types. What I want to do from here is for order types of Forecast MDS find the forecast designator and outstanding forecast quantity associated to that demand/item. I also want to find "top level" item demand comming from Discrete jobs. We only forecast the "sales orderable item, which might be a make or buy item and let MRP drill down to the raw (buy item) to then suggest planned orders if material is short.
I can't figure out how to grab both the supply records and demand records in the same query using planned order items as the basis of the query.
All of the information is in the apps.mrp_orders_v table or I could even use apps.mrp_orders_sc_v table, as both have mostly the same information, except for the forecast records which I would have to go to a differnt table for those records, but I wanted to figure out getting to the top level demand for discrete jobs first before I worry about the forecasts.
This is the query:
SELECT DISTINCT mov.using_assembly_item_name AS "ASSEMBLY 1"
,u1.item_segments AS "RAW ITEM"
,u1.order_type_text AS "ORDER TYPE"
FROM apps.mrp_orders_v mov,
(SELECT DISTINCT mov1.*
FROM apps.mrp_orders_v mov1
WHERE mov1.planner_code = 'GA EOCT'
) u1
WHERE u1.row_id = mov.row_id(+) AND u1.using_assembly_item_id != mov.inventory_item_id(+)
GROUP BY mov.using_assembly_item_name,
u1.item_segments,
u1.order_type_text
ORDER BY u1.item_segments, mov.using_assembly_item_name
Sample Output:
Row# ASSEMBLY 1 RAW ITEM ORDER TYPE
130 GE00002793 Planned order
131 GE00002794 Forecast MDS
132 GE00002794 Planned order
133 GE00003145 GE00002804 Planned order demand
134 GE00003317 GE00002903 Discrete job demand
135 GE00002903 Planned order
136 GE00003318 GE00002904 Discrete job demand
137 GE00002904 Planned order
138 GE00003319 GE00002905 Discrete job demand
139 GE00002905 Planned order