You are on page 1of 2

SELECT

'OE Line Errors' error_type,


Activity_Name ,
A.Display_Name ,
pa.process_name,
Decode(S.Activity_Status, 'ERROR', 'Error', 'Waiting') activity_Status,
oh.order_number,
oh.creation_date order_date,
ol.line_number || '.' || ol.shipment_number || '.' || option_number line,
i.item_key,
Ol.Flow_Status_Code,
Ol.Ship_From_Org_Id,
ol.org_id,
ol.ordered_item,
I.Begin_Date B1,
I.End_Date e1,
S.Error_Message Message1,
S.Error_Stack Stack1,
A.Function A
FROM wf_items i,
wf_item_activity_statuses s,
wf_process_activities pa,
oe_order_lines_all ol,
(select name, item_type, max(version) version from WF_activities
where item_type in ('OEOL','WFSTD')
group by name, item_type ) a1,
wf_activities_vl a,
oe_order_headers_all oh,
mtl_parameters mtp
WHERE s.process_activity = pa.instance_id
AND i.item_key = s.item_key
AND i.item_type = s.item_type
AND s.item_type IN ('OEOL')
AND s.ACTIVITY_STATUS = 'ERROR'
and a.name = activity_name
and a1.name = a.name
and a1.item_type = a.item_type
and a1.version = a.version
and i.item_key = ol.line_id
And Ol.Header_Id = Oh.Header_Id
and ol.ship_from_org_id = mtp.organization_id
and mtp.attribute6 = 'SCO'
and ol.flow_status_code != 'CLOSED'
union
SELECT distinct
'OE Header Errors',
Activity_Name ,
A.Display_Name ,
pa.process_name,
Decode(S.Activity_Status, 'ERROR', 'Error', 'Waiting') Status1,
oh.order_number,
oh.creation_date,
null, --ol.line_number || '.' || ol.shipment_number || '.' || option_numb
er line,
i.item_key,
Oh.Flow_Status_Code,
null, --Ol.Ship_From_Org_Id,
oh.org_id,
null,-- ol.ordered_item,
I.Begin_Date B1,
I.End_Date e1,
S.Error_Message Message1,
S.Error_Stack Stack1,
A.Function A
FROM wf_items i,
wf_item_activity_statuses s,
wf_process_activities pa,
(select name, item_type, max(version) version from WF_activities
where item_type in ('OEOH','WFSTD')
group by name, item_type ) a1,
wf_activities_vl a,
oe_order_headers_all oh,
oe_order_lines_all ol,
mtl_parameters mtp
WHERE s.process_activity = pa.instance_id
AND i.item_key = s.item_key
AND i.item_type = s.item_type
AND s.item_type IN ('OEOH')
AND s.ACTIVITY_STATUS = 'ERROR'
and a.name = activity_name
and a1.name = a.name
and a1.item_type = a.item_type
and a1.version = a.version
and i.item_key = oh.header_id
And Ol.Header_Id = Oh.Header_Id
and ol.ship_from_org_id = mtp.organization_id
and mtp.attribute6 = 'SCO'
and oh.flow_status_code != 'CLOSED'

You might also like