104: --
105: -- Determine whether Order Entry or Order Management is installed.
106: L_Order_System := OE_INSTALL.Get_Active_Product;
107: --
108: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
109: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
105: -- Determine whether Order Entry or Order Management is installed.
106: L_Order_System := OE_INSTALL.Get_Active_Product;
107: --
108: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
109: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
106: L_Order_System := OE_INSTALL.Get_Active_Product;
107: --
108: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
109: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
114: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
107: --
108: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
109: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
114: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
115: ' L_Seq_num := :seq_num; '||FND_GLOBAL.Newline;
108: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
109: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
114: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
115: ' L_Seq_num := :seq_num; '||FND_GLOBAL.Newline;
116: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep = 1 ) THEN
109: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
114: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
115: ' L_Seq_num := :seq_num; '||FND_GLOBAL.Newline;
116: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep = 1 ) THEN
117: -- build statement
110: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
114: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
115: ' L_Seq_num := :seq_num; '||FND_GLOBAL.Newline;
116: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep = 1 ) THEN
117: -- build statement
118: -- select clause and general from clause
111: ' L_Seq_num NUMBER; '||FND_GLOBAL.Newline||
112: 'BEGIN '||FND_GLOBAL.Newline||
113: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
114: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
115: ' L_Seq_num := :seq_num; '||FND_GLOBAL.Newline;
116: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep = 1 ) THEN
117: -- build statement
118: -- select clause and general from clause
119: L_Statement := L_Statement||
116: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep = 1 ) THEN
117: -- build statement
118: -- select clause and general from clause
119: L_Statement := L_Statement||
120: 'BEGIN '||FND_GLOBAL.Newline||
121: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
117: -- build statement
118: -- select clause and general from clause
119: L_Statement := L_Statement||
120: 'BEGIN '||FND_GLOBAL.Newline||
121: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
118: -- select clause and general from clause
119: L_Statement := L_Statement||
120: 'BEGIN '||FND_GLOBAL.Newline||
121: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
119: L_Statement := L_Statement||
120: 'BEGIN '||FND_GLOBAL.Newline||
121: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
120: 'BEGIN '||FND_GLOBAL.Newline||
121: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
121: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
122: '( seq_num '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
123: ' ,organization_id '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
124: ' ,inventory_item_id '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
125: ' ,quantity_open '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
126: ' ,uom_code '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
134: ' ,creation_date '||FND_GLOBAL.Newline||
127: ' ,object_type '||FND_GLOBAL.Newline||
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
134: ' ,creation_date '||FND_GLOBAL.Newline||
135: ') '||FND_GLOBAL.Newline;
128: ' ,object_id '||FND_GLOBAL.Newline||
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
134: ' ,creation_date '||FND_GLOBAL.Newline||
135: ') '||FND_GLOBAL.Newline;
136: --
129: ' ,object_detail_id '||FND_GLOBAL.Newline||
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
134: ' ,creation_date '||FND_GLOBAL.Newline||
135: ') '||FND_GLOBAL.Newline;
136: --
137: -- Jobs with p_inventory_item_id not null
130: ' ,last_updated_by '||FND_GLOBAL.Newline||
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
134: ' ,creation_date '||FND_GLOBAL.Newline||
135: ') '||FND_GLOBAL.Newline;
136: --
137: -- Jobs with p_inventory_item_id not null
138: --
131: ' ,last_update_login '||FND_GLOBAL.Newline||
132: ' ,last_update_date '||FND_GLOBAL.Newline||
133: ' ,created_by '||FND_GLOBAL.Newline||
134: ' ,creation_date '||FND_GLOBAL.Newline||
135: ') '||FND_GLOBAL.Newline;
136: --
137: -- Jobs with p_inventory_item_id not null
138: --
139: IF L_Check_jobs = 1 THEN
137: -- Jobs with p_inventory_item_id not null
138: --
139: IF L_Check_jobs = 1 THEN
140: L_Statement := L_Statement||
141: 'SELECT '||FND_GLOBAL.Newline||
142: ' L_Seq_num '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
138: --
139: IF L_Check_jobs = 1 THEN
140: L_Statement := L_Statement||
141: 'SELECT '||FND_GLOBAL.Newline||
142: ' L_Seq_num '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
139: IF L_Check_jobs = 1 THEN
140: L_Statement := L_Statement||
141: 'SELECT '||FND_GLOBAL.Newline||
142: ' L_Seq_num '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
140: L_Statement := L_Statement||
141: 'SELECT '||FND_GLOBAL.Newline||
142: ' L_Seq_num '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
141: 'SELECT '||FND_GLOBAL.Newline||
142: ' L_Seq_num '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
142: ' L_Seq_num '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
143: ',WRO.organization_id '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
144: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
145: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
146: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
147: ',1 '||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
148: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
149: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
150: ',0 '||FND_GLOBAL.Newline||
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
158: -- general where clause
151: ',-1 '||FND_GLOBAL.Newline||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
158: -- general where clause
159: L_Statement := L_Statement||
152: ',sysdate '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
158: -- general where clause
159: L_Statement := L_Statement||
160: 'WHERE '||FND_GLOBAL.Newline||
153: ',0 '||FND_GLOBAL.Newline||
154: ',sysdate '||FND_GLOBAL.Newline||
155: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
158: -- general where clause
159: L_Statement := L_Statement||
160: 'WHERE '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
156: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
158: -- general where clause
159: L_Statement := L_Statement||
160: 'WHERE '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
157: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
158: -- general where clause
159: L_Statement := L_Statement||
160: 'WHERE '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
158: -- general where clause
159: L_Statement := L_Statement||
160: 'WHERE '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
159: L_Statement := L_Statement||
160: 'WHERE '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
160: 'WHERE '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
161: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
162: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
163: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
171: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
164: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
171: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
172: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
165: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
171: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
172: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
173: -- where clause: hold jobs
166: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
171: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
172: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
173: -- where clause: hold jobs
174: IF p_wip_hold_jobs_flag = 1 THEN
167: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
171: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
172: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
173: -- where clause: hold jobs
174: IF p_wip_hold_jobs_flag = 1 THEN
175: IF L_First THEN
168: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
169: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
170: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
171: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
172: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
173: -- where clause: hold jobs
174: IF p_wip_hold_jobs_flag = 1 THEN
175: IF L_First THEN
176: L_First := FALSE;
177: L_Operator := 'AND ( ';
178: ELSE L_Operator := 'OR ';
179: END IF;
180: L_Statement := L_Statement||L_Operator||
181: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
182: ' AND EXISTS'||FND_GLOBAL.Newline||
183: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
184: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
185: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
178: ELSE L_Operator := 'OR ';
179: END IF;
180: L_Statement := L_Statement||L_Operator||
181: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
182: ' AND EXISTS'||FND_GLOBAL.Newline||
183: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
184: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
185: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
186: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
179: END IF;
180: L_Statement := L_Statement||L_Operator||
181: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
182: ' AND EXISTS'||FND_GLOBAL.Newline||
183: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
184: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
185: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
186: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
187: END IF;
180: L_Statement := L_Statement||L_Operator||
181: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
182: ' AND EXISTS'||FND_GLOBAL.Newline||
183: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
184: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
185: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
186: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
187: END IF;
188: -- where clause: released jobs (for days overdue)
181: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
182: ' AND EXISTS'||FND_GLOBAL.Newline||
183: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
184: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
185: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
186: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
187: END IF;
188: -- where clause: released jobs (for days overdue)
189: IF p_wip_rel_jobs_flag = 1 THEN
182: ' AND EXISTS'||FND_GLOBAL.Newline||
183: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
184: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
185: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
186: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
187: END IF;
188: -- where clause: released jobs (for days overdue)
189: IF p_wip_rel_jobs_flag = 1 THEN
190: IF L_First THEN
192: L_Operator := 'AND ( ';
193: ELSE L_Operator := 'OR ';
194: END IF;
195: L_Statement := L_Statement||L_Operator||
196: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
197: ' AND EXISTS'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
193: ELSE L_Operator := 'OR ';
194: END IF;
195: L_Statement := L_Statement||L_Operator||
196: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
197: ' AND EXISTS'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
194: END IF;
195: L_Statement := L_Statement||L_Operator||
196: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
197: ' AND EXISTS'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
195: L_Statement := L_Statement||L_Operator||
196: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
197: ' AND EXISTS'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
196: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
197: ' AND EXISTS'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
197: ' AND EXISTS'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
198: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
199: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
200: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
201: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
209: ' AND BCD1.calendar_date+NVL('||
202: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
209: ' AND BCD1.calendar_date+NVL('||
210: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
203: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
209: ' AND BCD1.calendar_date+NVL('||
210: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
211: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
204: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
205: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
209: ' AND BCD1.calendar_date+NVL('||
210: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
211: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
212: END IF;
206: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
209: ' AND BCD1.calendar_date+NVL('||
210: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
211: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
212: END IF;
213: -- where clause: unreleased jobs (for days overdue)
214: IF p_wip_unrel_jobs_flag = 1 THEN
207: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
208: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
209: ' AND BCD1.calendar_date+NVL('||
210: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
211: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
212: END IF;
213: -- where clause: unreleased jobs (for days overdue)
214: IF p_wip_unrel_jobs_flag = 1 THEN
215: IF L_First THEN
217: L_Operator := 'AND ( ';
218: ELSE L_Operator := 'OR ';
219: END IF;
220: L_Statement := L_Statement||L_Operator||
221: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
222: ' AND EXISTS'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
218: ELSE L_Operator := 'OR ';
219: END IF;
220: L_Statement := L_Statement||L_Operator||
221: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
222: ' AND EXISTS'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
219: END IF;
220: L_Statement := L_Statement||L_Operator||
221: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
222: ' AND EXISTS'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
220: L_Statement := L_Statement||L_Operator||
221: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
222: ' AND EXISTS'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
221: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
222: ' AND EXISTS'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
222: ' AND EXISTS'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
223: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
224: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
225: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
226: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
234: ' AND BCD1.calendar_date+NVL('||
227: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
234: ' AND BCD1.calendar_date+NVL('||
235: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
228: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
234: ' AND BCD1.calendar_date+NVL('||
235: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
236: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
229: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
230: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
234: ' AND BCD1.calendar_date+NVL('||
235: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
236: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
237: END IF;
231: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
234: ' AND BCD1.calendar_date+NVL('||
235: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
236: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
237: END IF;
238: IF NOT L_First THEN
239: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
232: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
233: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
234: ' AND BCD1.calendar_date+NVL('||
235: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
236: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
237: END IF;
238: IF NOT L_First THEN
239: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
240: L_First := TRUE;
235: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
236: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
237: END IF;
238: IF NOT L_First THEN
239: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
240: L_First := TRUE;
241: END IF;
242: -- where clause: parameter required date
243: IF p_wip_req_date_jobs_flag = 1 THEN
246: L_Operator := 'AND ( ';
247: ELSE L_Operator := 'OR ';
248: END IF;
249: L_Statement := L_Statement||L_Operator||
250: ' WRO.date_required
252: -- where clause: parameter current operation
253: IF p_wip_curr_op_jobs_flag = 1 THEN
254: IF L_First THEN
256: L_Operator := 'AND ( ';
257: ELSE L_Operator := 'OR ';
258: END IF;
259: L_Statement := L_Statement||L_Operator||
260: ' EXISTS'||FND_GLOBAL.Newline||
261: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
257: ELSE L_Operator := 'OR ';
258: END IF;
259: L_Statement := L_Statement||L_Operator||
260: ' EXISTS'||FND_GLOBAL.Newline||
261: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
258: END IF;
259: L_Statement := L_Statement||L_Operator||
260: ' EXISTS'||FND_GLOBAL.Newline||
261: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
259: L_Statement := L_Statement||L_Operator||
260: ' EXISTS'||FND_GLOBAL.Newline||
261: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
260: ' EXISTS'||FND_GLOBAL.Newline||
261: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
261: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
262: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
270: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
263: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
270: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
271: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
264: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
270: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
271: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
272: END IF;
265: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
270: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
271: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
272: END IF;
273: -- where clause: parameter previous operation
266: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
270: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
271: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
272: END IF;
273: -- where clause: parameter previous operation
274: IF p_wip_prev_op_jobs_flag = 1 THEN
267: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
268: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
269: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
270: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
271: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
272: END IF;
273: -- where clause: parameter previous operation
274: IF p_wip_prev_op_jobs_flag = 1 THEN
275: IF L_First THEN
277: L_Operator := 'AND ( ';
278: ELSE L_Operator := 'OR ';
279: END IF;
280: L_Statement := L_Statement||L_Operator||
281: ' EXISTS'||FND_GLOBAL.Newline||
282: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
278: ELSE L_Operator := 'OR ';
279: END IF;
280: L_Statement := L_Statement||L_Operator||
281: ' EXISTS'||FND_GLOBAL.Newline||
282: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
279: END IF;
280: L_Statement := L_Statement||L_Operator||
281: ' EXISTS'||FND_GLOBAL.Newline||
282: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
280: L_Statement := L_Statement||L_Operator||
281: ' EXISTS'||FND_GLOBAL.Newline||
282: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
281: ' EXISTS'||FND_GLOBAL.Newline||
282: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
282: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
283: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
284: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
292: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
285: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
292: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
293: END IF;
286: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
292: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
293: END IF;
294: IF NOT L_First THEN
287: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
292: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
293: END IF;
294: IF NOT L_First THEN
295: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
288: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
289: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
290: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
292: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
293: END IF;
294: IF NOT L_First THEN
295: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
296: L_First := TRUE;
291: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
292: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
293: END IF;
294: IF NOT L_First THEN
295: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
296: L_First := TRUE;
297: END IF;
298: -- where clause: parameter bulk components
299: IF p_wip_excl_bulk_comp_flag = 1 THEN
297: END IF;
298: -- where clause: parameter bulk components
299: IF p_wip_excl_bulk_comp_flag = 1 THEN
300: L_Statement := L_Statement||
301: ' AND WRO.wip_supply_type<>4 '||FND_GLOBAL.Newline;
302: END IF;
303: -- where clause: parameter supplier components
304: IF p_wip_excl_supplier_comp_flag = 1 THEN
305: L_Statement := L_Statement||
302: END IF;
303: -- where clause: parameter supplier components
304: IF p_wip_excl_supplier_comp_flag = 1 THEN
305: L_Statement := L_Statement||
306: ' AND WRO.wip_supply_type<>5 '||FND_GLOBAL.Newline;
307: END IF;
308: -- where clause: parameter pull components
309: IF p_wip_excl_pull_comp_flag = 1 THEN
310: L_Statement := L_Statement||
307: END IF;
308: -- where clause: parameter pull components
309: IF p_wip_excl_pull_comp_flag = 1 THEN
310: L_Statement := L_Statement||
311: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
312: END IF;
313: END IF;
314: --
315: -- Jobs with p_inventory_item_id null
315: -- Jobs with p_inventory_item_id null
316: --
317: IF L_Check_jobs = 1 THEN
318: L_Statement := L_Statement||
319: 'UNION ALL'||FND_GLOBAL.Newline||
320: 'SELECT '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
316: --
317: IF L_Check_jobs = 1 THEN
318: L_Statement := L_Statement||
319: 'UNION ALL'||FND_GLOBAL.Newline||
320: 'SELECT '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
317: IF L_Check_jobs = 1 THEN
318: L_Statement := L_Statement||
319: 'UNION ALL'||FND_GLOBAL.Newline||
320: 'SELECT '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
318: L_Statement := L_Statement||
319: 'UNION ALL'||FND_GLOBAL.Newline||
320: 'SELECT '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
319: 'UNION ALL'||FND_GLOBAL.Newline||
320: 'SELECT '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
320: 'SELECT '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
321: ' L_Seq_num '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
322: ',WRO.organization_id '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
323: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
324: ',WRO.required_quantity-WRO.quantity_issued '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
325: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
326: ',1 '||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
327: ',WRO.wip_entity_id '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
328: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
329: ',0 '||FND_GLOBAL.Newline||
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
337: -- general where clause
330: ',-1 '||FND_GLOBAL.Newline||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
337: -- general where clause
338: L_Statement := L_Statement||
331: ',sysdate '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
337: -- general where clause
338: L_Statement := L_Statement||
339: 'WHERE '||FND_GLOBAL.Newline||
332: ',0 '||FND_GLOBAL.Newline||
333: ',sysdate '||FND_GLOBAL.Newline||
334: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
337: -- general where clause
338: L_Statement := L_Statement||
339: 'WHERE '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
335: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
337: -- general where clause
338: L_Statement := L_Statement||
339: 'WHERE '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
336: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
337: -- general where clause
338: L_Statement := L_Statement||
339: 'WHERE '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
337: -- general where clause
338: L_Statement := L_Statement||
339: 'WHERE '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
338: L_Statement := L_Statement||
339: 'WHERE '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
339: 'WHERE '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
340: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
341: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
349: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
342: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
349: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
350: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
343: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
349: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
350: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
351: -- where clause: hold jobs
344: 'AND WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
349: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
350: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
351: -- where clause: hold jobs
352: IF p_wip_hold_jobs_flag = 1 THEN
345: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
349: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
350: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
351: -- where clause: hold jobs
352: IF p_wip_hold_jobs_flag = 1 THEN
353: IF L_First THEN
346: 'AND WRO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
347: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
348: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
349: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
350: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
351: -- where clause: hold jobs
352: IF p_wip_hold_jobs_flag = 1 THEN
353: IF L_First THEN
354: L_First := FALSE;
355: L_Operator := 'AND ( ';
356: ELSE L_Operator := 'OR ';
357: END IF;
358: L_Statement := L_Statement||L_Operator||
359: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
360: ' AND EXISTS'||FND_GLOBAL.Newline||
361: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
362: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
363: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
356: ELSE L_Operator := 'OR ';
357: END IF;
358: L_Statement := L_Statement||L_Operator||
359: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
360: ' AND EXISTS'||FND_GLOBAL.Newline||
361: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
362: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
363: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
364: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
357: END IF;
358: L_Statement := L_Statement||L_Operator||
359: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
360: ' AND EXISTS'||FND_GLOBAL.Newline||
361: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
362: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
363: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
364: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
365: END IF;
358: L_Statement := L_Statement||L_Operator||
359: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
360: ' AND EXISTS'||FND_GLOBAL.Newline||
361: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
362: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
363: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
364: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
365: END IF;
366: -- where clause: released jobs (for days overdue)
359: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
360: ' AND EXISTS'||FND_GLOBAL.Newline||
361: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
362: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
363: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
364: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
365: END IF;
366: -- where clause: released jobs (for days overdue)
367: IF p_wip_rel_jobs_flag = 1 THEN
360: ' AND EXISTS'||FND_GLOBAL.Newline||
361: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
362: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
363: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
364: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
365: END IF;
366: -- where clause: released jobs (for days overdue)
367: IF p_wip_rel_jobs_flag = 1 THEN
368: IF L_First THEN
370: L_Operator := 'AND ( ';
371: ELSE L_Operator := 'OR ';
372: END IF;
373: L_Statement := L_Statement||L_Operator||
374: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
375: ' AND EXISTS'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
371: ELSE L_Operator := 'OR ';
372: END IF;
373: L_Statement := L_Statement||L_Operator||
374: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
375: ' AND EXISTS'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
372: END IF;
373: L_Statement := L_Statement||L_Operator||
374: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
375: ' AND EXISTS'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
373: L_Statement := L_Statement||L_Operator||
374: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
375: ' AND EXISTS'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
374: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
375: ' AND EXISTS'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
375: ' AND EXISTS'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
376: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
377: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
378: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
379: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
387: ' AND BCD1.calendar_date+NVL('||
380: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
387: ' AND BCD1.calendar_date+NVL('||
388: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
381: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
387: ' AND BCD1.calendar_date+NVL('||
388: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
389: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
382: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
383: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
387: ' AND BCD1.calendar_date+NVL('||
388: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
389: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
390: END IF;
384: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
387: ' AND BCD1.calendar_date+NVL('||
388: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
389: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
390: END IF;
391: -- where clause: unreleased jobs (for days overdue)
392: IF p_wip_unrel_jobs_flag = 1 THEN
385: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
386: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
387: ' AND BCD1.calendar_date+NVL('||
388: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
389: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
390: END IF;
391: -- where clause: unreleased jobs (for days overdue)
392: IF p_wip_unrel_jobs_flag = 1 THEN
393: IF L_First THEN
395: L_Operator := 'AND ( ';
396: ELSE L_Operator := 'OR ';
397: END IF;
398: L_Statement := L_Statement||L_Operator||
399: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
400: ' AND EXISTS'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
396: ELSE L_Operator := 'OR ';
397: END IF;
398: L_Statement := L_Statement||L_Operator||
399: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
400: ' AND EXISTS'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
397: END IF;
398: L_Statement := L_Statement||L_Operator||
399: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
400: ' AND EXISTS'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
398: L_Statement := L_Statement||L_Operator||
399: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
400: ' AND EXISTS'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
399: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
400: ' AND EXISTS'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
400: ' AND EXISTS'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
401: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
402: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
403: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
404: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
412: ' AND BCD1.calendar_date+NVL('||
405: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
412: ' AND BCD1.calendar_date+NVL('||
413: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
406: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
412: ' AND BCD1.calendar_date+NVL('||
413: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
414: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
407: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
408: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
412: ' AND BCD1.calendar_date+NVL('||
413: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
414: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
415: END IF;
409: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
412: ' AND BCD1.calendar_date+NVL('||
413: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
414: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
415: END IF;
416: IF NOT L_First THEN
417: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
410: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
411: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
412: ' AND BCD1.calendar_date+NVL('||
413: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
414: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
415: END IF;
416: IF NOT L_First THEN
417: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
418: L_First := TRUE;
413: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
414: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
415: END IF;
416: IF NOT L_First THEN
417: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
418: L_First := TRUE;
419: END IF;
420: -- where clause: parameter required date
421: IF p_wip_req_date_jobs_flag = 1 THEN
424: L_Operator := 'AND ( ';
425: ELSE L_Operator := 'OR ';
426: END IF;
427: L_Statement := L_Statement||L_Operator||
428: ' WRO.date_required
430: -- where clause: parameter current operation
431: IF p_wip_curr_op_jobs_flag = 1 THEN
432: IF L_First THEN
434: L_Operator := 'AND ( ';
435: ELSE L_Operator := 'OR ';
436: END IF;
437: L_Statement := L_Statement||L_Operator||
438: ' EXISTS'||FND_GLOBAL.Newline||
439: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
435: ELSE L_Operator := 'OR ';
436: END IF;
437: L_Statement := L_Statement||L_Operator||
438: ' EXISTS'||FND_GLOBAL.Newline||
439: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
436: END IF;
437: L_Statement := L_Statement||L_Operator||
438: ' EXISTS'||FND_GLOBAL.Newline||
439: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
437: L_Statement := L_Statement||L_Operator||
438: ' EXISTS'||FND_GLOBAL.Newline||
439: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
438: ' EXISTS'||FND_GLOBAL.Newline||
439: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
439: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
440: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
448: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
441: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
448: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
449: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
442: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
448: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
449: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
450: END IF;
443: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
448: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
449: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
450: END IF;
451: -- where clause: parameter previous operation
444: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
448: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
449: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
450: END IF;
451: -- where clause: parameter previous operation
452: IF p_wip_prev_op_jobs_flag = 1 THEN
445: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
446: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
447: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
448: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
449: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
450: END IF;
451: -- where clause: parameter previous operation
452: IF p_wip_prev_op_jobs_flag = 1 THEN
453: IF L_First THEN
455: L_Operator := 'AND ( ';
456: ELSE L_Operator := 'OR ';
457: END IF;
458: L_Statement := L_Statement||L_Operator||
459: ' EXISTS'||FND_GLOBAL.Newline||
460: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
456: ELSE L_Operator := 'OR ';
457: END IF;
458: L_Statement := L_Statement||L_Operator||
459: ' EXISTS'||FND_GLOBAL.Newline||
460: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
457: END IF;
458: L_Statement := L_Statement||L_Operator||
459: ' EXISTS'||FND_GLOBAL.Newline||
460: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
458: L_Statement := L_Statement||L_Operator||
459: ' EXISTS'||FND_GLOBAL.Newline||
460: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
459: ' EXISTS'||FND_GLOBAL.Newline||
460: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
460: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
461: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
462: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
470: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
463: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
470: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
471: END IF;
464: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
470: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
471: END IF;
472: IF NOT L_First THEN
465: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
470: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
471: END IF;
472: IF NOT L_First THEN
473: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
466: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
467: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
468: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
470: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
471: END IF;
472: IF NOT L_First THEN
473: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
474: L_First := TRUE;
469: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
470: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
471: END IF;
472: IF NOT L_First THEN
473: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
474: L_First := TRUE;
475: END IF;
476: -- where clause: parameter bulk components
477: IF p_wip_excl_bulk_comp_flag = 1 THEN
475: END IF;
476: -- where clause: parameter bulk components
477: IF p_wip_excl_bulk_comp_flag = 1 THEN
478: L_Statement := L_Statement||
479: ' AND WRO.wip_supply_type<>4 '||FND_GLOBAL.Newline;
480: END IF;
481: -- where clause: parameter supplier components
482: IF p_wip_excl_supplier_comp_flag = 1 THEN
483: L_Statement := L_Statement||
480: END IF;
481: -- where clause: parameter supplier components
482: IF p_wip_excl_supplier_comp_flag = 1 THEN
483: L_Statement := L_Statement||
484: ' AND WRO.wip_supply_type<>5 '||FND_GLOBAL.Newline;
485: END IF;
486: -- where clause: parameter pull components
487: IF p_wip_excl_pull_comp_flag = 1 THEN
488: L_Statement := L_Statement||
485: END IF;
486: -- where clause: parameter pull components
487: IF p_wip_excl_pull_comp_flag = 1 THEN
488: L_Statement := L_Statement||
489: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
490: END IF;
491: END IF;
492: --
493: -- Schedules with p_inventory_item_id not null
493: -- Schedules with p_inventory_item_id not null
494: --
495: IF L_Check_rep = 1 AND L_Check_jobs = 1 THEN
496: L_Statement := L_Statement||
497: 'UNION ALL '||FND_GLOBAL.Newline;
498: END IF;
499: IF L_Check_rep = 1 THEN
500: L_Statement := L_Statement||
501: 'SELECT '||FND_GLOBAL.Newline||
497: 'UNION ALL '||FND_GLOBAL.Newline;
498: END IF;
499: IF L_Check_rep = 1 THEN
500: L_Statement := L_Statement||
501: 'SELECT '||FND_GLOBAL.Newline||
502: ' L_Seq_num '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
498: END IF;
499: IF L_Check_rep = 1 THEN
500: L_Statement := L_Statement||
501: 'SELECT '||FND_GLOBAL.Newline||
502: ' L_Seq_num '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
499: IF L_Check_rep = 1 THEN
500: L_Statement := L_Statement||
501: 'SELECT '||FND_GLOBAL.Newline||
502: ' L_Seq_num '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
500: L_Statement := L_Statement||
501: 'SELECT '||FND_GLOBAL.Newline||
502: ' L_Seq_num '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
501: 'SELECT '||FND_GLOBAL.Newline||
502: ' L_Seq_num '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
502: ' L_Seq_num '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
503: ',WRO.organization_id '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
504: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
505: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
506: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
507: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
508: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
509: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
510: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
511: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
512: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
513: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
514: ' ) '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
515: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
516: ',2 '||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
517: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
518: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
519: ',0 '||FND_GLOBAL.Newline||
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
527: -- general where clause
520: ',-1 '||FND_GLOBAL.Newline||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
527: -- general where clause
528: L_Statement := L_Statement||
521: ',sysdate '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
527: -- general where clause
528: L_Statement := L_Statement||
529: 'WHERE '||FND_GLOBAL.Newline||
522: ',0 '||FND_GLOBAL.Newline||
523: ',sysdate '||FND_GLOBAL.Newline||
524: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
527: -- general where clause
528: L_Statement := L_Statement||
529: 'WHERE '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
525: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
527: -- general where clause
528: L_Statement := L_Statement||
529: 'WHERE '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
526: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
527: -- general where clause
528: L_Statement := L_Statement||
529: 'WHERE '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
527: -- general where clause
528: L_Statement := L_Statement||
529: 'WHERE '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
528: L_Statement := L_Statement||
529: 'WHERE '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
529: 'WHERE '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
530: ' L_Inventory_item_id IS NOT NULL '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
531: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
539: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
532: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
539: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
540: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
533: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
539: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
540: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
541: -- where clause: hold schedules
534: 'AND WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
539: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
540: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
541: -- where clause: hold schedules
542: IF p_wip_hold_rep_flag = 1 THEN
535: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
539: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
540: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
541: -- where clause: hold schedules
542: IF p_wip_hold_rep_flag = 1 THEN
543: IF L_First THEN
536: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
537: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
538: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
539: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
540: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
541: -- where clause: hold schedules
542: IF p_wip_hold_rep_flag = 1 THEN
543: IF L_First THEN
544: L_First := FALSE;
545: L_Operator := 'AND ( ';
546: ELSE L_Operator := 'OR ';
547: END IF;
548: L_Statement := L_Statement||L_Operator||
549: ' WRS.status_type=6 '||FND_GLOBAL.Newline;
550: END IF;
551: -- where clause: released schedules (for days overdue)
552: IF p_wip_rel_rep_flag = 1 THEN
553: IF L_First THEN
555: L_Operator := 'AND ( ';
556: ELSE L_Operator := 'OR ';
557: END IF;
558: L_Statement := L_Statement||L_Operator||
559: ' EXISTS'||FND_GLOBAL.Newline||
560: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
556: ELSE L_Operator := 'OR ';
557: END IF;
558: L_Statement := L_Statement||L_Operator||
559: ' EXISTS'||FND_GLOBAL.Newline||
560: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
557: END IF;
558: L_Statement := L_Statement||L_Operator||
559: ' EXISTS'||FND_GLOBAL.Newline||
560: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
558: L_Statement := L_Statement||L_Operator||
559: ' EXISTS'||FND_GLOBAL.Newline||
560: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
559: ' EXISTS'||FND_GLOBAL.Newline||
560: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
560: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
561: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
562: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
563: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
571: ' AND BCD1.calendar_date+NVL('||
564: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
571: ' AND BCD1.calendar_date+NVL('||
572: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
565: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
571: ' AND BCD1.calendar_date+NVL('||
572: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
573: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
566: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
567: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
571: ' AND BCD1.calendar_date+NVL('||
572: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
573: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
574: END IF;
568: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
571: ' AND BCD1.calendar_date+NVL('||
572: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
573: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
574: END IF;
575: -- where clause: unreleased schedules (for days overdue)
576: IF p_wip_unrel_rep_flag = 1 THEN
569: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
570: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
571: ' AND BCD1.calendar_date+NVL('||
572: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
573: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
574: END IF;
575: -- where clause: unreleased schedules (for days overdue)
576: IF p_wip_unrel_rep_flag = 1 THEN
577: IF L_First THEN
579: L_Operator := 'AND ( ';
580: ELSE L_Operator := 'OR ';
581: END IF;
582: L_Statement := L_Statement||L_Operator||
583: ' EXISTS'||FND_GLOBAL.Newline||
584: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
580: ELSE L_Operator := 'OR ';
581: END IF;
582: L_Statement := L_Statement||L_Operator||
583: ' EXISTS'||FND_GLOBAL.Newline||
584: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
581: END IF;
582: L_Statement := L_Statement||L_Operator||
583: ' EXISTS'||FND_GLOBAL.Newline||
584: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
582: L_Statement := L_Statement||L_Operator||
583: ' EXISTS'||FND_GLOBAL.Newline||
584: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
583: ' EXISTS'||FND_GLOBAL.Newline||
584: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
584: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
585: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
586: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
587: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
595: ' AND BCD1.calendar_date+NVL('||
588: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
595: ' AND BCD1.calendar_date+NVL('||
596: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
589: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
595: ' AND BCD1.calendar_date+NVL('||
596: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
597: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
590: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
591: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
595: ' AND BCD1.calendar_date+NVL('||
596: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
597: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
598: END IF;
592: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
595: ' AND BCD1.calendar_date+NVL('||
596: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
597: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
598: END IF;
599: IF NOT L_First THEN
600: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
593: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
594: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
595: ' AND BCD1.calendar_date+NVL('||
596: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
597: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
598: END IF;
599: IF NOT L_First THEN
600: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
601: L_First := TRUE;
596: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
597: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
598: END IF;
599: IF NOT L_First THEN
600: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
601: L_First := TRUE;
602: END IF;
603: -- where clause: parameter required date
604: IF p_wip_req_date_rep_flag = 1 THEN
607: L_Operator := 'AND ( ';
608: ELSE L_Operator := 'OR ';
609: END IF;
610: L_Statement := L_Statement||L_Operator||
611: ' WRO.date_required
613: -- where clause: parameter current operation
614: IF p_wip_curr_op_rep_flag = 1 THEN
615: IF L_First THEN
617: L_Operator := 'AND ( ';
618: ELSE L_Operator := 'OR ';
619: END IF;
620: L_Statement := L_Statement||L_Operator||
621: ' EXISTS'||FND_GLOBAL.Newline||
622: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
618: ELSE L_Operator := 'OR ';
619: END IF;
620: L_Statement := L_Statement||L_Operator||
621: ' EXISTS'||FND_GLOBAL.Newline||
622: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
619: END IF;
620: L_Statement := L_Statement||L_Operator||
621: ' EXISTS'||FND_GLOBAL.Newline||
622: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
620: L_Statement := L_Statement||L_Operator||
621: ' EXISTS'||FND_GLOBAL.Newline||
622: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
621: ' EXISTS'||FND_GLOBAL.Newline||
622: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
622: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
623: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
631: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
624: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
631: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
632: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
625: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
631: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
632: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
633: END IF;
626: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
631: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
632: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
633: END IF;
634: -- where clause: parameter previous operation
627: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
631: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
632: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
633: END IF;
634: -- where clause: parameter previous operation
635: IF p_wip_prev_op_rep_flag = 1 THEN
628: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
629: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
630: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
631: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
632: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
633: END IF;
634: -- where clause: parameter previous operation
635: IF p_wip_prev_op_rep_flag = 1 THEN
636: IF L_First THEN
638: L_Operator := 'AND ( ';
639: ELSE L_Operator := 'OR ';
640: END IF;
641: L_Statement := L_Statement||L_Operator||
642: ' EXISTS'||FND_GLOBAL.Newline||
643: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
639: ELSE L_Operator := 'OR ';
640: END IF;
641: L_Statement := L_Statement||L_Operator||
642: ' EXISTS'||FND_GLOBAL.Newline||
643: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
640: END IF;
641: L_Statement := L_Statement||L_Operator||
642: ' EXISTS'||FND_GLOBAL.Newline||
643: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
641: L_Statement := L_Statement||L_Operator||
642: ' EXISTS'||FND_GLOBAL.Newline||
643: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
642: ' EXISTS'||FND_GLOBAL.Newline||
643: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
643: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
644: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
645: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
653: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
646: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
653: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
654: END IF;
647: ' AND WO.repetitive_schedule_id IS NULL '||FND_GLOBAL.Newline||
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
653: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
654: END IF;
655: IF NOT L_First THEN
648: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
653: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
654: END IF;
655: IF NOT L_First THEN
656: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
649: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
650: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
651: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
653: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
654: END IF;
655: IF NOT L_First THEN
656: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
657: L_First := TRUE;
652: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
653: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
654: END IF;
655: IF NOT L_First THEN
656: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
657: L_First := TRUE;
658: END IF;
659: -- where clause: parameter bulk components
660: IF p_wip_excl_bulk_comp_flag = 1 THEN
658: END IF;
659: -- where clause: parameter bulk components
660: IF p_wip_excl_bulk_comp_flag = 1 THEN
661: L_Statement := L_Statement||
662: ' AND WRO.wip_supply_type<>4 '||FND_GLOBAL.Newline;
663: END IF;
664: -- where clause: parameter supplier components
665: IF p_wip_excl_supplier_comp_flag = 1 THEN
666: L_Statement := L_Statement||
663: END IF;
664: -- where clause: parameter supplier components
665: IF p_wip_excl_supplier_comp_flag = 1 THEN
666: L_Statement := L_Statement||
667: ' AND WRO.wip_supply_type<>5 '||FND_GLOBAL.Newline;
668: END IF;
669: -- where clause: parameter pull components
670: IF p_wip_excl_pull_comp_flag = 1 THEN
671: L_Statement := L_Statement||
668: END IF;
669: -- where clause: parameter pull components
670: IF p_wip_excl_pull_comp_flag = 1 THEN
671: L_Statement := L_Statement||
672: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
673: END IF;
674: END IF;
675: --
676: -- Schedules with p_inventory_item_id null
676: -- Schedules with p_inventory_item_id null
677: --
678: IF L_Check_rep = 1 THEN
679: L_Statement := L_Statement||
680: 'UNION ALL'||FND_GLOBAL.Newline||
681: 'SELECT '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
677: --
678: IF L_Check_rep = 1 THEN
679: L_Statement := L_Statement||
680: 'UNION ALL'||FND_GLOBAL.Newline||
681: 'SELECT '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
678: IF L_Check_rep = 1 THEN
679: L_Statement := L_Statement||
680: 'UNION ALL'||FND_GLOBAL.Newline||
681: 'SELECT '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
679: L_Statement := L_Statement||
680: 'UNION ALL'||FND_GLOBAL.Newline||
681: 'SELECT '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
680: 'UNION ALL'||FND_GLOBAL.Newline||
681: 'SELECT '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
681: 'SELECT '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
682: ' L_Seq_num '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
683: ',WRO.organization_id '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
684: ',WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
685: ',INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
686: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
687: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
688: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
689: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
690: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
691: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
692: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
693: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
694: ' ) '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
695: ',MSI.primary_uom_code '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
696: ',2 '||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
697: ',WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
698: ',WRO.operation_seq_num '||FND_GLOBAL.Newline||
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
699: ',0 '||FND_GLOBAL.Newline||
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
707: -- general where clause
700: ',-1 '||FND_GLOBAL.Newline||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
707: -- general where clause
708: L_Statement := L_Statement||
701: ',sysdate '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
707: -- general where clause
708: L_Statement := L_Statement||
709: 'WHERE '||FND_GLOBAL.Newline||
702: ',0 '||FND_GLOBAL.Newline||
703: ',sysdate '||FND_GLOBAL.Newline||
704: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
707: -- general where clause
708: L_Statement := L_Statement||
709: 'WHERE '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
705: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
707: -- general where clause
708: L_Statement := L_Statement||
709: 'WHERE '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
706: ',mtl_system_items MSI '||FND_GLOBAL.Newline;
707: -- general where clause
708: L_Statement := L_Statement||
709: 'WHERE '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
707: -- general where clause
708: L_Statement := L_Statement||
709: 'WHERE '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
708: L_Statement := L_Statement||
709: 'WHERE '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
709: 'WHERE '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
710: ' L_Inventory_item_id IS NULL '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
718: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
711: 'AND WRO.inventory_item_id=MSI.inventory_item_id '||FND_GLOBAL.Newline||
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
718: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
719: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
712: 'AND WRO.organization_id=MSI.organization_id '||FND_GLOBAL.Newline||
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
718: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
719: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
720: -- where clause: hold schedules
713: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||')='||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
718: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
719: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
720: -- where clause: hold schedules
721: IF p_wip_hold_rep_flag = 1 THEN
714: 'AND WRS.repetitive_schedule_id=WRO.repetitive_schedule_id '||FND_GLOBAL.Newline||
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
718: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
719: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
720: -- where clause: hold schedules
721: IF p_wip_hold_rep_flag = 1 THEN
722: IF L_First THEN
715: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
716: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
717: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
718: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
719: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
720: -- where clause: hold schedules
721: IF p_wip_hold_rep_flag = 1 THEN
722: IF L_First THEN
723: L_First := FALSE;
724: L_Operator := 'AND ( ';
725: ELSE L_Operator := 'OR ';
726: END IF;
727: L_Statement := L_Statement||L_Operator||
728: ' WRS.status_type=6 '||FND_GLOBAL.Newline;
729: END IF;
730: -- where clause: released schedules (for days overdue)
731: IF p_wip_rel_rep_flag = 1 THEN
732: IF L_First THEN
734: L_Operator := 'AND ( ';
735: ELSE L_Operator := 'OR ';
736: END IF;
737: L_Statement := L_Statement||L_Operator||
738: ' EXISTS'||FND_GLOBAL.Newline||
739: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
735: ELSE L_Operator := 'OR ';
736: END IF;
737: L_Statement := L_Statement||L_Operator||
738: ' EXISTS'||FND_GLOBAL.Newline||
739: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
736: END IF;
737: L_Statement := L_Statement||L_Operator||
738: ' EXISTS'||FND_GLOBAL.Newline||
739: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
737: L_Statement := L_Statement||L_Operator||
738: ' EXISTS'||FND_GLOBAL.Newline||
739: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
738: ' EXISTS'||FND_GLOBAL.Newline||
739: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
739: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
740: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
741: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
742: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
750: ' AND BCD1.calendar_date+NVL('||
743: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
750: ' AND BCD1.calendar_date+NVL('||
751: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
744: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
750: ' AND BCD1.calendar_date+NVL('||
751: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
752: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
745: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
746: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
750: ' AND BCD1.calendar_date+NVL('||
751: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
752: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
753: END IF;
747: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
750: ' AND BCD1.calendar_date+NVL('||
751: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
752: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
753: END IF;
754: -- where clause: unreleased schedules (for days overdue)
755: IF p_wip_unrel_rep_flag = 1 THEN
748: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
749: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
750: ' AND BCD1.calendar_date+NVL('||
751: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
752: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
753: END IF;
754: -- where clause: unreleased schedules (for days overdue)
755: IF p_wip_unrel_rep_flag = 1 THEN
756: IF L_First THEN
758: L_Operator := 'AND ( ';
759: ELSE L_Operator := 'OR ';
760: END IF;
761: L_Statement := L_Statement||L_Operator||
762: ' EXISTS'||FND_GLOBAL.Newline||
763: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
759: ELSE L_Operator := 'OR ';
760: END IF;
761: L_Statement := L_Statement||L_Operator||
762: ' EXISTS'||FND_GLOBAL.Newline||
763: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
760: END IF;
761: L_Statement := L_Statement||L_Operator||
762: ' EXISTS'||FND_GLOBAL.Newline||
763: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
761: L_Statement := L_Statement||L_Operator||
762: ' EXISTS'||FND_GLOBAL.Newline||
763: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
762: ' EXISTS'||FND_GLOBAL.Newline||
763: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
763: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
764: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
765: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
766: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
774: ' AND BCD1.calendar_date+NVL('||
767: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
774: ' AND BCD1.calendar_date+NVL('||
775: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
768: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
774: ' AND BCD1.calendar_date+NVL('||
775: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
776: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
769: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
770: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
774: ' AND BCD1.calendar_date+NVL('||
775: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
776: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
777: END IF;
771: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
774: ' AND BCD1.calendar_date+NVL('||
775: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
776: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
777: END IF;
778: IF NOT L_First THEN
779: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
772: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
773: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
774: ' AND BCD1.calendar_date+NVL('||
775: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
776: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
777: END IF;
778: IF NOT L_First THEN
779: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
780: L_First := TRUE;
775: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
776: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
777: END IF;
778: IF NOT L_First THEN
779: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
780: L_First := TRUE;
781: END IF;
782: -- where clause: parameter required date
783: IF p_wip_req_date_rep_flag = 1 THEN
786: L_Operator := 'AND ( ';
787: ELSE L_Operator := 'OR ';
788: END IF;
789: L_Statement := L_Statement||L_Operator||
790: ' WRO.date_required
792: -- where clause: parameter current operation
793: IF p_wip_curr_op_rep_flag = 1 THEN
794: IF L_First THEN
796: L_Operator := 'AND ( ';
797: ELSE L_Operator := 'OR ';
798: END IF;
799: L_Statement := L_Statement||L_Operator||
800: ' EXISTS'||FND_GLOBAL.Newline||
801: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
797: ELSE L_Operator := 'OR ';
798: END IF;
799: L_Statement := L_Statement||L_Operator||
800: ' EXISTS'||FND_GLOBAL.Newline||
801: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
798: END IF;
799: L_Statement := L_Statement||L_Operator||
800: ' EXISTS'||FND_GLOBAL.Newline||
801: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
799: L_Statement := L_Statement||L_Operator||
800: ' EXISTS'||FND_GLOBAL.Newline||
801: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
800: ' EXISTS'||FND_GLOBAL.Newline||
801: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
801: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
802: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
810: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
803: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
810: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
811: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
804: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
810: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
811: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
812: END IF;
805: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
810: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
811: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
812: END IF;
813: -- where clause: parameter previous operation
806: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
810: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
811: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
812: END IF;
813: -- where clause: parameter previous operation
814: IF p_wip_prev_op_rep_flag = 1 THEN
807: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
808: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
809: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
810: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
811: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
812: END IF;
813: -- where clause: parameter previous operation
814: IF p_wip_prev_op_rep_flag = 1 THEN
815: IF L_First THEN
817: L_Operator := 'AND ( ';
818: ELSE L_Operator := 'OR ';
819: END IF;
820: L_Statement := L_Statement||L_Operator||
821: ' EXISTS'||FND_GLOBAL.Newline||
822: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
818: ELSE L_Operator := 'OR ';
819: END IF;
820: L_Statement := L_Statement||L_Operator||
821: ' EXISTS'||FND_GLOBAL.Newline||
822: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
819: END IF;
820: L_Statement := L_Statement||L_Operator||
821: ' EXISTS'||FND_GLOBAL.Newline||
822: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
820: L_Statement := L_Statement||L_Operator||
821: ' EXISTS'||FND_GLOBAL.Newline||
822: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
821: ' EXISTS'||FND_GLOBAL.Newline||
822: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
822: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
823: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
824: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
832: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
825: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
832: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
833: END IF;
826: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
832: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
833: END IF;
834: IF NOT L_First THEN
827: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
832: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
833: END IF;
834: IF NOT L_First THEN
835: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
828: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
829: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
830: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
832: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
833: END IF;
834: IF NOT L_First THEN
835: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
836: END IF;
831: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
832: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
833: END IF;
834: IF NOT L_First THEN
835: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
836: END IF;
837: -- where clause: parameter bulk components
838: IF p_wip_excl_bulk_comp_flag = 1 THEN
839: L_Statement := L_Statement||
836: END IF;
837: -- where clause: parameter bulk components
838: IF p_wip_excl_bulk_comp_flag = 1 THEN
839: L_Statement := L_Statement||
840: ' AND WRO.wip_supply_type<>4 '||FND_GLOBAL.Newline;
841: END IF;
842: -- where clause: parameter supplier components
843: IF p_wip_excl_supplier_comp_flag = 1 THEN
844: L_Statement := L_Statement||
841: END IF;
842: -- where clause: parameter supplier components
843: IF p_wip_excl_supplier_comp_flag = 1 THEN
844: L_Statement := L_Statement||
845: ' AND WRO.wip_supply_type<>5 '||FND_GLOBAL.Newline;
846: END IF;
847: -- where clause: parameter pull components
848: IF p_wip_excl_pull_comp_flag = 1 THEN
849: L_Statement := L_Statement||
846: END IF;
847: -- where clause: parameter pull components
848: IF p_wip_excl_pull_comp_flag = 1 THEN
849: L_Statement := L_Statement||
850: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
851: END IF;
852: END IF;
853: L_Statement := L_Statement||
854: '; '||FND_GLOBAL.Newline||
850: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
851: END IF;
852: END IF;
853: L_Statement := L_Statement||
854: '; '||FND_GLOBAL.Newline||
855: 'EXCEPTION '||FND_GLOBAL.Newline||
856: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
857: 'END; '||FND_GLOBAL.Newline;
858: END IF;
851: END IF;
852: END IF;
853: L_Statement := L_Statement||
854: '; '||FND_GLOBAL.Newline||
855: 'EXCEPTION '||FND_GLOBAL.Newline||
856: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
857: 'END; '||FND_GLOBAL.Newline;
858: END IF;
859: IF p_check_oe_flag = 1 THEN
852: END IF;
853: L_Statement := L_Statement||
854: '; '||FND_GLOBAL.Newline||
855: 'EXCEPTION '||FND_GLOBAL.Newline||
856: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
857: 'END; '||FND_GLOBAL.Newline;
858: END IF;
859: IF p_check_oe_flag = 1 THEN
860: -- build statement
853: L_Statement := L_Statement||
854: '; '||FND_GLOBAL.Newline||
855: 'EXCEPTION '||FND_GLOBAL.Newline||
856: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
857: 'END; '||FND_GLOBAL.Newline;
858: END IF;
859: IF p_check_oe_flag = 1 THEN
860: -- build statement
861: -- Since there exist no shortage parameter for order entry
861: -- Since there exist no shortage parameter for order entry
862: -- we do not have to build a parameter dependent statement
863: IF L_Order_System = 'OE' OR L_Order_System = 'ONT' THEN
864: L_Statement := L_Statement ||
865: 'BEGIN '||FND_GLOBAL.Newline||
866: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
862: -- we do not have to build a parameter dependent statement
863: IF L_Order_System = 'OE' OR L_Order_System = 'ONT' THEN
864: L_Statement := L_Statement ||
865: 'BEGIN '||FND_GLOBAL.Newline||
866: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
863: IF L_Order_System = 'OE' OR L_Order_System = 'ONT' THEN
864: L_Statement := L_Statement ||
865: 'BEGIN '||FND_GLOBAL.Newline||
866: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
864: L_Statement := L_Statement ||
865: 'BEGIN '||FND_GLOBAL.Newline||
866: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
865: 'BEGIN '||FND_GLOBAL.Newline||
866: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
866: 'INSERT INTO mtl_short_chk_temp '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
867: '( seq_num '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
868: ' ,organization_id '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
869: ' ,inventory_item_id '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
870: ' ,quantity_open '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
871: ' ,uom_code '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
879: ' ,creation_date '||FND_GLOBAL.Newline||
872: ' ,object_type '||FND_GLOBAL.Newline||
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
879: ' ,creation_date '||FND_GLOBAL.Newline||
880: ') '||FND_GLOBAL.Newline;
873: ' ,object_id '||FND_GLOBAL.Newline||
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
879: ' ,creation_date '||FND_GLOBAL.Newline||
880: ') '||FND_GLOBAL.Newline;
881: END IF;
874: ' ,object_detail_id '||FND_GLOBAL.Newline||
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
879: ' ,creation_date '||FND_GLOBAL.Newline||
880: ') '||FND_GLOBAL.Newline;
881: END IF;
882: IF L_Order_System = 'OE' THEN
875: ' ,last_updated_by '||FND_GLOBAL.Newline||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
879: ' ,creation_date '||FND_GLOBAL.Newline||
880: ') '||FND_GLOBAL.Newline;
881: END IF;
882: IF L_Order_System = 'OE' THEN
883: L_Statement := L_Statement ||
876: ' ,last_update_login '||FND_GLOBAL.Newline||
877: ' ,last_update_date '||FND_GLOBAL.Newline||
878: ' ,created_by '||FND_GLOBAL.Newline||
879: ' ,creation_date '||FND_GLOBAL.Newline||
880: ') '||FND_GLOBAL.Newline;
881: END IF;
882: IF L_Order_System = 'OE' THEN
883: L_Statement := L_Statement ||
884: 'SELECT '||FND_GLOBAL.Newline||
880: ') '||FND_GLOBAL.Newline;
881: END IF;
882: IF L_Order_System = 'OE' THEN
883: L_Statement := L_Statement ||
884: 'SELECT '||FND_GLOBAL.Newline||
885: ' L_Seq_num '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
881: END IF;
882: IF L_Order_System = 'OE' THEN
883: L_Statement := L_Statement ||
884: 'SELECT '||FND_GLOBAL.Newline||
885: ' L_Seq_num '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
882: IF L_Order_System = 'OE' THEN
883: L_Statement := L_Statement ||
884: 'SELECT '||FND_GLOBAL.Newline||
885: ' L_Seq_num '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
883: L_Statement := L_Statement ||
884: 'SELECT '||FND_GLOBAL.Newline||
885: ' L_Seq_num '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
884: 'SELECT '||FND_GLOBAL.Newline||
885: ' L_Seq_num '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
885: ' L_Seq_num '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
886: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
887: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
888: ' ,SUM(SPLD.requested_quantity-NVL(SPLD.shipped_quantity,0)) '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
889: ' ,SL.unit_code '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
890: ' ,4 '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
891: ' ,SH.header_id '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
892: ' ,SL.line_id '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
893: ' ,0 '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
894: ' ,-1 '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
895: ' ,sysdate '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
896: ' ,0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
897: ' ,sysdate '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
898: 'FROM so_headers SH '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
899: ' ,so_lines SL '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
900: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
901: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
902: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
903: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
904: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
905: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
906: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
907: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
908: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
909: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
910: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
911: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
912: 'AND (SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
913: ' OR L_Inventory_item_id IS NULL) '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
914: 'AND SPL.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
915: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
916: 'AND SPL.warehouse_id = MSI.organization_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
917: 'AND NVL(MSI.check_shortages_flag,'||''''||'N'||''''||') = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
918: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
919: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
920: 'AND SLD.released_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
921: 'GROUP BY '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
922: ' L_Seq_num '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
923: ' ,SPL.warehouse_id '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
924: ' ,SPL.inventory_item_id '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
925: ' ,SL.unit_code '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
926: ' ,4 '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
927: ' ,SH.header_id '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
928: ' ,SL.line_id '||FND_GLOBAL.Newline||
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
929: ' ,0 '||FND_GLOBAL.Newline||
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
937: ELSE -- Order Management is installed
930: ' ,-1 '||FND_GLOBAL.Newline||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
937: ELSE -- Order Management is installed
938: L_Statement := L_Statement ||
931: ' ,sysdate '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
937: ELSE -- Order Management is installed
938: L_Statement := L_Statement ||
939: 'SELECT '||FND_GLOBAL.Newline||
932: ' ,0 '||FND_GLOBAL.Newline||
933: ' ,sysdate; '||FND_GLOBAL.Newline||
934: 'EXCEPTION '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
937: ELSE -- Order Management is installed
938: L_Statement := L_Statement ||
939: 'SELECT '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
935: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
937: ELSE -- Order Management is installed
938: L_Statement := L_Statement ||
939: 'SELECT '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
936: 'END; '||FND_GLOBAL.Newline;
937: ELSE -- Order Management is installed
938: L_Statement := L_Statement ||
939: 'SELECT '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
937: ELSE -- Order Management is installed
938: L_Statement := L_Statement ||
939: 'SELECT '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
938: L_Statement := L_Statement ||
939: 'SELECT '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
939: 'SELECT '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
940: ' L_Seq_num '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
941: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
942: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
943: ' ,sum(wdd.requested_quantity) '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
944: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
945: ' ,4 '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
953: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
946: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
953: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
954: 'WHERE wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
947: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
953: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
954: 'WHERE wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
955: -- Fix bug 2115784, Notifications are sent to all planners
948: ' ,0 '||FND_GLOBAL.Newline||
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
953: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
954: 'WHERE wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
955: -- Fix bug 2115784, Notifications are sent to all planners
956: -- Added the following two line to make sure the shortage_temp records
949: ' ,-1 '||FND_GLOBAL.Newline||
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
953: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
954: 'WHERE wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
955: -- Fix bug 2115784, Notifications are sent to all planners
956: -- Added the following two line to make sure the shortage_temp records
957: -- are inserted only for specified org and item. Therefore, only the buyers
950: ' ,sysdate '||FND_GLOBAL.Newline||
951: ' ,0 '||FND_GLOBAL.Newline||
952: ' ,sysdate '||FND_GLOBAL.Newline||
953: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
954: 'WHERE wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
955: -- Fix bug 2115784, Notifications are sent to all planners
956: -- Added the following two line to make sure the shortage_temp records
957: -- are inserted only for specified org and item. Therefore, only the buyers
958: -- for the specified item will be notified.
957: -- are inserted only for specified org and item. Therefore, only the buyers
958: -- for the specified item will be notified.
959: -- Bug 2640828. Added nvl around inventory_item_id and
960: -- organization_id
961: ' AND wdd.inventory_item_id = nvl(L_Inventory_item_id ,wdd.inventory_item_id)'||FND_GLOBAL.Newline||
962: ' AND wdd.organization_id = nvl(L_Organization_id ,wdd.organization_id)'||FND_GLOBAL.Newline||
963: ' GROUP BY ' ||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
958: -- for the specified item will be notified.
959: -- Bug 2640828. Added nvl around inventory_item_id and
960: -- organization_id
961: ' AND wdd.inventory_item_id = nvl(L_Inventory_item_id ,wdd.inventory_item_id)'||FND_GLOBAL.Newline||
962: ' AND wdd.organization_id = nvl(L_Organization_id ,wdd.organization_id)'||FND_GLOBAL.Newline||
963: ' GROUP BY ' ||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
960: -- organization_id
961: ' AND wdd.inventory_item_id = nvl(L_Inventory_item_id ,wdd.inventory_item_id)'||FND_GLOBAL.Newline||
962: ' AND wdd.organization_id = nvl(L_Organization_id ,wdd.organization_id)'||FND_GLOBAL.Newline||
963: ' GROUP BY ' ||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
961: ' AND wdd.inventory_item_id = nvl(L_Inventory_item_id ,wdd.inventory_item_id)'||FND_GLOBAL.Newline||
962: ' AND wdd.organization_id = nvl(L_Organization_id ,wdd.organization_id)'||FND_GLOBAL.Newline||
963: ' GROUP BY ' ||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
962: ' AND wdd.organization_id = nvl(L_Organization_id ,wdd.organization_id)'||FND_GLOBAL.Newline||
963: ' GROUP BY ' ||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
963: ' GROUP BY ' ||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
964: ' L_Seq_num '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
965: ' ,wdd.organization_id '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
966: ' ,wdd.inventory_item_id '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
967: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
968: ' ,4 '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
969: ' ,wdd.source_header_id '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
970: ' ,wdd.source_line_id '||FND_GLOBAL.Newline||
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
978: 'END; '||FND_GLOBAL.Newline;
971: ' ,0 '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
978: 'END; '||FND_GLOBAL.Newline;
979: --MR ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
972: ' ,-1 '||FND_GLOBAL.Newline||
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
978: 'END; '||FND_GLOBAL.Newline;
979: --MR ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
980: END IF;
973: ' ,sysdate '||FND_GLOBAL.Newline||
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
978: 'END; '||FND_GLOBAL.Newline;
979: --MR ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
980: END IF;
981: END IF;
974: ' ,0 '||FND_GLOBAL.Newline||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
978: 'END; '||FND_GLOBAL.Newline;
979: --MR ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
980: END IF;
981: END IF;
982: L_Statement := L_Statement||
975: ' ,sysdate; ' || FND_GLOBAL.Newline||
976: 'EXCEPTION '||FND_GLOBAL.Newline||
977: ' WHEN OTHERS THEN NULL; '||FND_GLOBAL.Newline||
978: 'END; '||FND_GLOBAL.Newline;
979: --MR ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
980: END IF;
981: END IF;
982: L_Statement := L_Statement||
983: 'COMMIT; '||FND_GLOBAL.Newline||
979: --MR ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
980: END IF;
981: END IF;
982: L_Statement := L_Statement||
983: 'COMMIT; '||FND_GLOBAL.Newline||
984: 'END; '||FND_GLOBAL.Newline;
985: x_short_stat_detail := L_Statement;
986: --
987: -- Standard call to get message count and if count is 1, get message info
980: END IF;
981: END IF;
982: L_Statement := L_Statement||
983: 'COMMIT; '||FND_GLOBAL.Newline||
984: 'END; '||FND_GLOBAL.Newline;
985: x_short_stat_detail := L_Statement;
986: --
987: -- Standard call to get message count and if count is 1, get message info
988: FND_MSG_PUB.Count_And_Get
1117: --
1118: -- Determine whether Order Entry or Order Management is installed.
1119: L_Order_System := OE_INSTALL.Get_Active_Product;
1120: --
1121: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
1122: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1118: -- Determine whether Order Entry or Order Management is installed.
1119: L_Order_System := OE_INSTALL.Get_Active_Product;
1120: --
1121: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
1122: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1119: L_Order_System := OE_INSTALL.Get_Active_Product;
1120: --
1121: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
1122: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1120: --
1121: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
1122: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1121: L_Statement := 'DECLARE '||FND_GLOBAL.Newline||
1122: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1122: ' L_Organization_id NUMBER; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1123: ' L_Inventory_item_id NUMBER; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1131: ' L_WIP_short_quantity := :wip_short_quantity; '||FND_GLOBAL.Newline||
1124: ' L_WIP_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1131: ' L_WIP_short_quantity := :wip_short_quantity; '||FND_GLOBAL.Newline||
1132: ' L_OE_short_quantity := :oe_short_quantity; '||FND_GLOBAL.Newline;
1125: ' L_OE_short_quantity NUMBER; '||FND_GLOBAL.Newline||
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1131: ' L_WIP_short_quantity := :wip_short_quantity; '||FND_GLOBAL.Newline||
1132: ' L_OE_short_quantity := :oe_short_quantity; '||FND_GLOBAL.Newline;
1133: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep =1 ) THEN
1126: ' L_WIP_jobs_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1131: ' L_WIP_short_quantity := :wip_short_quantity; '||FND_GLOBAL.Newline||
1132: ' L_OE_short_quantity := :oe_short_quantity; '||FND_GLOBAL.Newline;
1133: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep =1 ) THEN
1134: --
1127: ' L_WIP_rep_short_quantity NUMBER := 0; '||FND_GLOBAL.Newline||
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1131: ' L_WIP_short_quantity := :wip_short_quantity; '||FND_GLOBAL.Newline||
1132: ' L_OE_short_quantity := :oe_short_quantity; '||FND_GLOBAL.Newline;
1133: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep =1 ) THEN
1134: --
1135: -- Jobs
1128: 'BEGIN '||FND_GLOBAL.Newline||
1129: ' L_Organization_id := :organization_id; '||FND_GLOBAL.Newline||
1130: ' L_Inventory_item_id := :inventory_item_id; '||FND_GLOBAL.Newline||
1131: ' L_WIP_short_quantity := :wip_short_quantity; '||FND_GLOBAL.Newline||
1132: ' L_OE_short_quantity := :oe_short_quantity; '||FND_GLOBAL.Newline;
1133: IF p_check_wip_flag = 1 AND ( L_Check_jobs = 1 OR L_Check_rep =1 ) THEN
1134: --
1135: -- Jobs
1136: --
1138: -- build statement
1139: -- select clause and general from clause
1140: L_Statement := L_Statement||
1141: 'SELECT '||
1142: 'NVL(SUM(WRO.required_quantity-WRO.quantity_issued),0) '||FND_GLOBAL.Newline||
1143: 'INTO '||FND_GLOBAL.Newline||
1144: ' L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1145: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1139: -- select clause and general from clause
1140: L_Statement := L_Statement||
1141: 'SELECT '||
1142: 'NVL(SUM(WRO.required_quantity-WRO.quantity_issued),0) '||FND_GLOBAL.Newline||
1143: 'INTO '||FND_GLOBAL.Newline||
1144: ' L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1145: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1147: -- general where clause
1140: L_Statement := L_Statement||
1141: 'SELECT '||
1142: 'NVL(SUM(WRO.required_quantity-WRO.quantity_issued),0) '||FND_GLOBAL.Newline||
1143: 'INTO '||FND_GLOBAL.Newline||
1144: ' L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1145: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1147: -- general where clause
1148: L_Statement := L_Statement||
1141: 'SELECT '||
1142: 'NVL(SUM(WRO.required_quantity-WRO.quantity_issued),0) '||FND_GLOBAL.Newline||
1143: 'INTO '||FND_GLOBAL.Newline||
1144: ' L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1145: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1147: -- general where clause
1148: L_Statement := L_Statement||
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1142: 'NVL(SUM(WRO.required_quantity-WRO.quantity_issued),0) '||FND_GLOBAL.Newline||
1143: 'INTO '||FND_GLOBAL.Newline||
1144: ' L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1145: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1147: -- general where clause
1148: L_Statement := L_Statement||
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1145: 'FROM wip_entities WE'||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1147: -- general where clause
1148: L_Statement := L_Statement||
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1146: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1147: -- general where clause
1148: L_Statement := L_Statement||
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1154: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1147: -- general where clause
1148: L_Statement := L_Statement||
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1154: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1155: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1148: L_Statement := L_Statement||
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1154: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1155: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1156: -- where clause: hold jobs
1149: 'WHERE WRO.wip_entity_id=WE.wip_entity_id '||FND_GLOBAL.Newline||
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1154: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1155: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1156: -- where clause: hold jobs
1157: IF p_wip_hold_jobs_flag = 1 THEN
1150: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1154: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1155: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1156: -- where clause: hold jobs
1157: IF p_wip_hold_jobs_flag = 1 THEN
1158: IF L_First THEN
1151: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1152: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1153: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1154: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1155: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1156: -- where clause: hold jobs
1157: IF p_wip_hold_jobs_flag = 1 THEN
1158: IF L_First THEN
1159: L_First := FALSE;
1160: L_Operator := 'AND ( ';
1161: ELSE L_Operator := 'OR ';
1162: END IF;
1163: L_Statement := L_Statement||L_Operator||
1164: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1165: ' AND EXISTS'||FND_GLOBAL.Newline||
1166: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1167: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1168: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1161: ELSE L_Operator := 'OR ';
1162: END IF;
1163: L_Statement := L_Statement||L_Operator||
1164: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1165: ' AND EXISTS'||FND_GLOBAL.Newline||
1166: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1167: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1168: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1169: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
1162: END IF;
1163: L_Statement := L_Statement||L_Operator||
1164: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1165: ' AND EXISTS'||FND_GLOBAL.Newline||
1166: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1167: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1168: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1169: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
1170: END IF;
1163: L_Statement := L_Statement||L_Operator||
1164: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1165: ' AND EXISTS'||FND_GLOBAL.Newline||
1166: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1167: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1168: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1169: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
1170: END IF;
1171: -- where clause: released jobs (for days overdue)
1164: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1165: ' AND EXISTS'||FND_GLOBAL.Newline||
1166: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1167: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1168: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1169: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
1170: END IF;
1171: -- where clause: released jobs (for days overdue)
1172: IF p_wip_rel_jobs_flag = 1 THEN
1165: ' AND EXISTS'||FND_GLOBAL.Newline||
1166: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1167: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1168: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1169: ' AND WDJ.status_type=6))'||FND_GLOBAL.Newline;
1170: END IF;
1171: -- where clause: released jobs (for days overdue)
1172: IF p_wip_rel_jobs_flag = 1 THEN
1173: IF L_First THEN
1175: L_Operator := 'AND ( ';
1176: ELSE L_Operator := 'OR ';
1177: END IF;
1178: L_Statement := L_Statement||L_Operator||
1179: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1180: ' AND EXISTS'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1176: ELSE L_Operator := 'OR ';
1177: END IF;
1178: L_Statement := L_Statement||L_Operator||
1179: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1180: ' AND EXISTS'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1177: END IF;
1178: L_Statement := L_Statement||L_Operator||
1179: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1180: ' AND EXISTS'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1178: L_Statement := L_Statement||L_Operator||
1179: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1180: ' AND EXISTS'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1179: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1180: ' AND EXISTS'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1180: ' AND EXISTS'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1181: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1182: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1183: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1184: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1192: ' AND BCD1.calendar_date+NVL('||
1185: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1192: ' AND BCD1.calendar_date+NVL('||
1193: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1186: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1192: ' AND BCD1.calendar_date+NVL('||
1193: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1194: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1187: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1188: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1192: ' AND BCD1.calendar_date+NVL('||
1193: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1194: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1195: END IF;
1189: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1192: ' AND BCD1.calendar_date+NVL('||
1193: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1194: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1195: END IF;
1196: -- where clause: unreleased jobs (for days overdue)
1197: IF p_wip_unrel_jobs_flag = 1 THEN
1190: ' AND WDJ.status_type=3'||FND_GLOBAL.Newline||
1191: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1192: ' AND BCD1.calendar_date+NVL('||
1193: TO_CHAR(p_wip_days_overdue_rel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1194: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1195: END IF;
1196: -- where clause: unreleased jobs (for days overdue)
1197: IF p_wip_unrel_jobs_flag = 1 THEN
1198: IF L_First THEN
1200: L_Operator := 'AND ( ';
1201: ELSE L_Operator := 'OR ';
1202: END IF;
1203: L_Statement := L_Statement||L_Operator||
1204: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1205: ' AND EXISTS'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1201: ELSE L_Operator := 'OR ';
1202: END IF;
1203: L_Statement := L_Statement||L_Operator||
1204: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1205: ' AND EXISTS'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1202: END IF;
1203: L_Statement := L_Statement||L_Operator||
1204: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1205: ' AND EXISTS'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1203: L_Statement := L_Statement||L_Operator||
1204: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1205: ' AND EXISTS'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1204: ' (WRO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1205: ' AND EXISTS'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1205: ' AND EXISTS'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1206: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1207: ' FROM wip_discrete_jobs WDJ'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1208: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1209: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1217: ' AND BCD1.calendar_date+NVL('||
1210: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1217: ' AND BCD1.calendar_date+NVL('||
1218: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1211: ' WHERE WDJ.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1217: ' AND BCD1.calendar_date+NVL('||
1218: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1219: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1212: ' AND WDJ.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1213: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1217: ' AND BCD1.calendar_date+NVL('||
1218: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1219: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1220: END IF;
1214: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1217: ' AND BCD1.calendar_date+NVL('||
1218: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1219: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1220: END IF;
1221: IF NOT L_First THEN
1222: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1215: ' AND WDJ.status_type=1'||FND_GLOBAL.Newline||
1216: ' AND TRUNC(WDJ.scheduled_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1217: ' AND BCD1.calendar_date+NVL('||
1218: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1219: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1220: END IF;
1221: IF NOT L_First THEN
1222: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1223: L_First := TRUE;
1218: TO_CHAR(p_wip_days_overdue_unrel_jobs)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1219: ' AND BCD2.calendar_date<=sysdate)) '||FND_GLOBAL.Newline;
1220: END IF;
1221: IF NOT L_First THEN
1222: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1223: L_First := TRUE;
1224: END IF;
1225: -- where clause: parameter required date
1226: IF p_wip_req_date_jobs_flag = 1 THEN
1229: L_Operator := 'AND ( ';
1230: ELSE L_Operator := 'OR ';
1231: END IF;
1232: L_Statement := L_Statement||L_Operator||
1233: ' WRO.date_required
1235: -- where clause: parameter current operation
1236: IF p_wip_curr_op_jobs_flag = 1 THEN
1237: IF L_First THEN
1239: L_Operator := 'AND ( ';
1240: ELSE L_Operator := 'OR ';
1241: END IF;
1242: L_Statement := L_Statement||L_Operator||
1243: ' EXISTS'||FND_GLOBAL.Newline||
1244: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1240: ELSE L_Operator := 'OR ';
1241: END IF;
1242: L_Statement := L_Statement||L_Operator||
1243: ' EXISTS'||FND_GLOBAL.Newline||
1244: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1241: END IF;
1242: L_Statement := L_Statement||L_Operator||
1243: ' EXISTS'||FND_GLOBAL.Newline||
1244: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1242: L_Statement := L_Statement||L_Operator||
1243: ' EXISTS'||FND_GLOBAL.Newline||
1244: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1243: ' EXISTS'||FND_GLOBAL.Newline||
1244: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1244: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1245: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1253: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1246: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1253: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1254: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1247: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1253: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1254: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1255: END IF;
1248: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1253: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1254: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1255: END IF;
1256: -- where clause: parameter previous operation
1249: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1253: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1254: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1255: END IF;
1256: -- where clause: parameter previous operation
1257: IF p_wip_prev_op_jobs_flag = 1 THEN
1250: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1251: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1252: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1253: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1254: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1255: END IF;
1256: -- where clause: parameter previous operation
1257: IF p_wip_prev_op_jobs_flag = 1 THEN
1258: IF L_First THEN
1260: L_Operator := 'AND ( ';
1261: ELSE L_Operator := 'OR ';
1262: END IF;
1263: L_Statement := L_Statement||L_Operator||
1264: ' EXISTS'||FND_GLOBAL.Newline||
1265: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1261: ELSE L_Operator := 'OR ';
1262: END IF;
1263: L_Statement := L_Statement||L_Operator||
1264: ' EXISTS'||FND_GLOBAL.Newline||
1265: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1262: END IF;
1263: L_Statement := L_Statement||L_Operator||
1264: ' EXISTS'||FND_GLOBAL.Newline||
1265: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1263: L_Statement := L_Statement||L_Operator||
1264: ' EXISTS'||FND_GLOBAL.Newline||
1265: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1264: ' EXISTS'||FND_GLOBAL.Newline||
1265: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1265: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1266: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1267: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1275: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1268: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1275: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1276: END IF;
1269: ' AND WO.repetitive_schedule_id IS NULL'||FND_GLOBAL.Newline||
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1275: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1276: END IF;
1277: IF NOT L_First THEN
1270: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1275: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1276: END IF;
1277: IF NOT L_First THEN
1278: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1271: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1272: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1273: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1275: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1276: END IF;
1277: IF NOT L_First THEN
1278: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1279: L_First := TRUE;
1274: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1275: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1276: END IF;
1277: IF NOT L_First THEN
1278: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1279: L_First := TRUE;
1280: END IF;
1281: -- where clause: parameter bulk components
1282: IF p_wip_excl_bulk_comp_flag = 1 THEN
1280: END IF;
1281: -- where clause: parameter bulk components
1282: IF p_wip_excl_bulk_comp_flag = 1 THEN
1283: L_Statement := L_Statement||
1284: ' AND WRO.wip_supply_type<>4 '||FND_GLOBAL.Newline;
1285: END IF;
1286: -- where clause: parameter supplier components
1287: IF p_wip_excl_supplier_comp_flag = 1 THEN
1288: L_Statement := L_Statement||
1285: END IF;
1286: -- where clause: parameter supplier components
1287: IF p_wip_excl_supplier_comp_flag = 1 THEN
1288: L_Statement := L_Statement||
1289: ' AND WRO.wip_supply_type<>5 '||FND_GLOBAL.Newline;
1290: END IF;
1291: -- where clause: parameter pull components
1292: IF p_wip_excl_pull_comp_flag = 1 THEN
1293: L_Statement := L_Statement||
1290: END IF;
1291: -- where clause: parameter pull components
1292: IF p_wip_excl_pull_comp_flag = 1 THEN
1293: L_Statement := L_Statement||
1294: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
1295: END IF;
1296: L_Statement := L_Statement||
1297: '; '||FND_GLOBAL.Newline;
1298: END IF;
1293: L_Statement := L_Statement||
1294: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
1295: END IF;
1296: L_Statement := L_Statement||
1297: '; '||FND_GLOBAL.Newline;
1298: END IF;
1299: --
1300: -- Schedules
1301: --
1302: IF L_Check_rep = 1 THEN
1303: -- build statement
1304: -- select clause and general from clause
1305: L_Statement := L_Statement||
1306: 'SELECT'||FND_GLOBAL.Newline||
1307: 'NVL(SUM(INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1303: -- build statement
1304: -- select clause and general from clause
1305: L_Statement := L_Statement||
1306: 'SELECT'||FND_GLOBAL.Newline||
1307: 'NVL(SUM(INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1304: -- select clause and general from clause
1305: L_Statement := L_Statement||
1306: 'SELECT'||FND_GLOBAL.Newline||
1307: 'NVL(SUM(INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1305: L_Statement := L_Statement||
1306: 'SELECT'||FND_GLOBAL.Newline||
1307: 'NVL(SUM(INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1306: 'SELECT'||FND_GLOBAL.Newline||
1307: 'NVL(SUM(INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1307: 'NVL(SUM(INV_ShortCheckExec_PVT.get_rep_curr_open_qty '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1308: ' ( WRO.organization_id '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1309: ' , WRS.wip_entity_id '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1310: ' , WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1311: ' , WRS.first_unit_start_date '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1312: ' , WRS.processing_work_days '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1313: ' , WRO.operation_seq_num '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1314: ' , WRO.inventory_item_id '||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1315: ' , WRO.quantity_issued '||FND_GLOBAL.Newline||
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1316: ' ) '||FND_GLOBAL.Newline||
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1324: -- general where clause
1317: ' ) '||FND_GLOBAL.Newline||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1324: -- general where clause
1325: L_Statement := L_Statement||
1318: ' , 0 '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1324: -- general where clause
1325: L_Statement := L_Statement||
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1319: ' ) '||FND_GLOBAL.Newline||
1320: 'INTO '||FND_GLOBAL.Newline||
1321: ' L_WIP_rep_short_quantity '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1324: -- general where clause
1325: L_Statement := L_Statement||
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1322: 'FROM wip_repetitive_schedules WRS'||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1324: -- general where clause
1325: L_Statement := L_Statement||
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1323: ',wip_requirement_operations WRO '||FND_GLOBAL.Newline;
1324: -- general where clause
1325: L_Statement := L_Statement||
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1324: -- general where clause
1325: L_Statement := L_Statement||
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1332: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1325: L_Statement := L_Statement||
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1332: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1333: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1326: 'WHERE WRO.repetitive_schedule_id=WRS.repetitive_schedule_id '||FND_GLOBAL.Newline||
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1332: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1333: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1334: -- where clause: hold schedules
1327: 'AND WRO.wip_entity_id=WRS.wip_entity_id '||FND_GLOBAL.Newline||
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1332: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1333: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1334: -- where clause: hold schedules
1335: IF p_wip_hold_rep_flag = 1 THEN
1328: 'AND WRO.organization_id=L_Organization_id '||FND_GLOBAL.Newline||
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1332: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1333: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1334: -- where clause: hold schedules
1335: IF p_wip_hold_rep_flag = 1 THEN
1336: IF L_First THEN
1329: 'AND WRO.inventory_item_id=L_Inventory_item_id '||FND_GLOBAL.Newline||
1330: 'AND WRO.operation_seq_num>0 '||FND_GLOBAL.Newline||
1331: 'AND WRO.required_quantity>0 '||FND_GLOBAL.Newline||
1332: 'AND WRO.quantity_issued>=0 '||FND_GLOBAL.Newline||
1333: 'AND WRO.required_quantity>WRO.quantity_issued '||FND_GLOBAL.Newline;
1334: -- where clause: hold schedules
1335: IF p_wip_hold_rep_flag = 1 THEN
1336: IF L_First THEN
1337: L_First := FALSE;
1338: L_Operator := 'AND ( ';
1339: ELSE L_Operator := 'OR ';
1340: END IF;
1341: L_Statement := L_Statement||L_Operator||
1342: ' WRS.status_type=6 '||FND_GLOBAL.Newline;
1343: END IF;
1344: -- where clause: released schedules (for days overdue)
1345: IF p_wip_rel_rep_flag = 1 THEN
1346: IF L_First THEN
1348: L_Operator := 'AND ( ';
1349: ELSE L_Operator := 'OR ';
1350: END IF;
1351: L_Statement := L_Statement||L_Operator||
1352: ' EXISTS'||FND_GLOBAL.Newline||
1353: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1349: ELSE L_Operator := 'OR ';
1350: END IF;
1351: L_Statement := L_Statement||L_Operator||
1352: ' EXISTS'||FND_GLOBAL.Newline||
1353: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1350: END IF;
1351: L_Statement := L_Statement||L_Operator||
1352: ' EXISTS'||FND_GLOBAL.Newline||
1353: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1351: L_Statement := L_Statement||L_Operator||
1352: ' EXISTS'||FND_GLOBAL.Newline||
1353: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1352: ' EXISTS'||FND_GLOBAL.Newline||
1353: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1353: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1354: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1355: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1356: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1364: ' AND BCD1.calendar_date+NVL('||
1357: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1364: ' AND BCD1.calendar_date+NVL('||
1365: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1358: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1364: ' AND BCD1.calendar_date+NVL('||
1365: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1366: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1359: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1360: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1364: ' AND BCD1.calendar_date+NVL('||
1365: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1366: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1367: END IF;
1361: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1364: ' AND BCD1.calendar_date+NVL('||
1365: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1366: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1367: END IF;
1368: -- where clause: unreleased schedules (for days overdue)
1369: IF p_wip_unrel_rep_flag = 1 THEN
1362: ' AND WRS2.status_type=3'||FND_GLOBAL.Newline||
1363: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1364: ' AND BCD1.calendar_date+NVL('||
1365: TO_CHAR(p_wip_days_overdue_rel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1366: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1367: END IF;
1368: -- where clause: unreleased schedules (for days overdue)
1369: IF p_wip_unrel_rep_flag = 1 THEN
1370: IF L_First THEN
1372: L_Operator := 'AND ( ';
1373: ELSE L_Operator := 'OR ';
1374: END IF;
1375: L_Statement := L_Statement||L_Operator||
1376: ' EXISTS'||FND_GLOBAL.Newline||
1377: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1373: ELSE L_Operator := 'OR ';
1374: END IF;
1375: L_Statement := L_Statement||L_Operator||
1376: ' EXISTS'||FND_GLOBAL.Newline||
1377: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1374: END IF;
1375: L_Statement := L_Statement||L_Operator||
1376: ' EXISTS'||FND_GLOBAL.Newline||
1377: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1375: L_Statement := L_Statement||L_Operator||
1376: ' EXISTS'||FND_GLOBAL.Newline||
1377: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1376: ' EXISTS'||FND_GLOBAL.Newline||
1377: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1377: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1378: ' FROM wip_repetitive_schedules WRS2'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1379: ' ,mtl_parameters MP'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1380: ' ,bom_calendar_dates BCD1'||FND_GLOBAL.Newline||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1388: ' AND BCD1.calendar_date+NVL('||
1381: ' ,bom_calendar_dates BCD2'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1388: ' AND BCD1.calendar_date+NVL('||
1389: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1382: ' WHERE WRS2.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1388: ' AND BCD1.calendar_date+NVL('||
1389: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1390: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1383: ' AND WRS2.organization_id=MP.organization_id'||FND_GLOBAL.Newline||
1384: ' AND MP.calendar_code=BCD1.calendar_code'||FND_GLOBAL.Newline||
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1388: ' AND BCD1.calendar_date+NVL('||
1389: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1390: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1391: END IF;
1385: ' AND MP.calendar_code=BCD2.calendar_code'||FND_GLOBAL.Newline||
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1388: ' AND BCD1.calendar_date+NVL('||
1389: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1390: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1391: END IF;
1392: IF NOT L_First THEN
1393: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1386: ' AND WRS2.status_type=1'||FND_GLOBAL.Newline||
1387: ' AND TRUNC(WRS2.first_unit_start_date)=BCD1.calendar_date'||FND_GLOBAL.Newline||
1388: ' AND BCD1.calendar_date+NVL('||
1389: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1390: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1391: END IF;
1392: IF NOT L_First THEN
1393: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1394: L_First := TRUE;
1389: TO_CHAR(p_wip_days_overdue_unrel_rep)||',0)=BCD2.calendar_date'||FND_GLOBAL.Newline||
1390: ' AND BCD2.calendar_date<=sysdate) '||FND_GLOBAL.Newline;
1391: END IF;
1392: IF NOT L_First THEN
1393: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1394: L_First := TRUE;
1395: END IF;
1396: -- where clause: parameter required date
1397: IF p_wip_req_date_rep_flag = 1 THEN
1400: L_Operator := 'AND ( ';
1401: ELSE L_Operator := 'OR ';
1402: END IF;
1403: L_Statement := L_Statement||L_Operator||
1404: ' WRO.date_required
1406: -- where clause: parameter current operation
1407: IF p_wip_curr_op_rep_flag = 1 THEN
1408: IF L_First THEN
1410: L_Operator := 'AND ( ';
1411: ELSE L_Operator := 'OR ';
1412: END IF;
1413: L_Statement := L_Statement||L_Operator||
1414: ' EXISTS'||FND_GLOBAL.Newline||
1415: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1411: ELSE L_Operator := 'OR ';
1412: END IF;
1413: L_Statement := L_Statement||L_Operator||
1414: ' EXISTS'||FND_GLOBAL.Newline||
1415: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1412: END IF;
1413: L_Statement := L_Statement||L_Operator||
1414: ' EXISTS'||FND_GLOBAL.Newline||
1415: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1413: L_Statement := L_Statement||L_Operator||
1414: ' EXISTS'||FND_GLOBAL.Newline||
1415: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1414: ' EXISTS'||FND_GLOBAL.Newline||
1415: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1415: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1416: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1424: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1417: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1424: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1425: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1418: ' AND WO.operation_seq_num>=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1424: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1425: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1426: END IF;
1419: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1424: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1425: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1426: END IF;
1427: -- where clause: parameter previous operation
1420: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1424: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1425: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1426: END IF;
1427: -- where clause: parameter previous operation
1428: IF p_wip_prev_op_rep_flag = 1 THEN
1421: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1422: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1423: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1424: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1425: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1426: END IF;
1427: -- where clause: parameter previous operation
1428: IF p_wip_prev_op_rep_flag = 1 THEN
1429: IF L_First THEN
1431: L_Operator := 'AND ( ';
1432: ELSE L_Operator := 'OR ';
1433: END IF;
1434: L_Statement := L_Statement||L_Operator||
1435: ' EXISTS'||FND_GLOBAL.Newline||
1436: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1432: ELSE L_Operator := 'OR ';
1433: END IF;
1434: L_Statement := L_Statement||L_Operator||
1435: ' EXISTS'||FND_GLOBAL.Newline||
1436: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1433: END IF;
1434: L_Statement := L_Statement||L_Operator||
1435: ' EXISTS'||FND_GLOBAL.Newline||
1436: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1434: L_Statement := L_Statement||L_Operator||
1435: ' EXISTS'||FND_GLOBAL.Newline||
1436: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1435: ' EXISTS'||FND_GLOBAL.Newline||
1436: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1436: ' (SELECT '||''''||'X'||''''||' '||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1437: ' FROM wip_operations WO'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1438: ' WHERE WO.wip_entity_id=WRO.wip_entity_id'||FND_GLOBAL.Newline||
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1446: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1439: ' AND WO.next_operation_seq_num=WRO.operation_seq_num'||FND_GLOBAL.Newline||
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1446: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1447: END IF;
1440: ' AND WO.repetitive_schedule_id=WRO.repetitive_schedule_id'||FND_GLOBAL.Newline||
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1446: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1447: END IF;
1448: IF NOT L_First THEN
1441: ' AND (WO.quantity_in_queue>0'||FND_GLOBAL.Newline||
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1446: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1447: END IF;
1448: IF NOT L_First THEN
1449: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1442: ' OR WO.quantity_running>0'||FND_GLOBAL.Newline||
1443: ' OR WO.quantity_waiting_to_move>0'||FND_GLOBAL.Newline||
1444: ' OR WO.quantity_rejected>0'||FND_GLOBAL.Newline||
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1446: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1447: END IF;
1448: IF NOT L_First THEN
1449: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1450: END IF;
1445: ' OR WO.quantity_scrapped>0'||FND_GLOBAL.Newline||
1446: ' OR WO.quantity_completed>0))'||FND_GLOBAL.Newline;
1447: END IF;
1448: IF NOT L_First THEN
1449: L_Statement := L_Statement||')'||FND_GLOBAL.Newline;
1450: END IF;
1451: -- where clause: parameter bulk components
1452: IF p_wip_excl_bulk_comp_flag = 1 THEN
1453: L_Statement := L_Statement||
1450: END IF;
1451: -- where clause: parameter bulk components
1452: IF p_wip_excl_bulk_comp_flag = 1 THEN
1453: L_Statement := L_Statement||
1454: ' AND WRO.wip_supply_type<>4 '||FND_GLOBAL.Newline;
1455: END IF;
1456: -- where clause: parameter supplier components
1457: IF p_wip_excl_supplier_comp_flag = 1 THEN
1458: L_Statement := L_Statement||
1455: END IF;
1456: -- where clause: parameter supplier components
1457: IF p_wip_excl_supplier_comp_flag = 1 THEN
1458: L_Statement := L_Statement||
1459: ' AND WRO.wip_supply_type<>5 '||FND_GLOBAL.Newline;
1460: END IF;
1461: -- where clause: parameter pull components
1462: IF p_wip_excl_pull_comp_flag = 1 THEN
1463: L_Statement := L_Statement||
1460: END IF;
1461: -- where clause: parameter pull components
1462: IF p_wip_excl_pull_comp_flag = 1 THEN
1463: L_Statement := L_Statement||
1464: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
1465: END IF;
1466: L_Statement := L_Statement||
1467: '; '||FND_GLOBAL.Newline;
1468: END IF;
1463: L_Statement := L_Statement||
1464: ' AND WRO.wip_supply_type NOT IN (2,3) '||FND_GLOBAL.Newline;
1465: END IF;
1466: L_Statement := L_Statement||
1467: '; '||FND_GLOBAL.Newline;
1468: END IF;
1469: L_Statement := L_Statement||
1470: ':wip_short_quantity := L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1471: ' + L_WIP_rep_short_quantity; '||FND_GLOBAL.Newline;
1466: L_Statement := L_Statement||
1467: '; '||FND_GLOBAL.Newline;
1468: END IF;
1469: L_Statement := L_Statement||
1470: ':wip_short_quantity := L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1471: ' + L_WIP_rep_short_quantity; '||FND_GLOBAL.Newline;
1472: END IF;
1473: IF p_check_oe_flag = 1 THEN
1474: -- build statement
1467: '; '||FND_GLOBAL.Newline;
1468: END IF;
1469: L_Statement := L_Statement||
1470: ':wip_short_quantity := L_WIP_jobs_short_quantity '||FND_GLOBAL.Newline||
1471: ' + L_WIP_rep_short_quantity; '||FND_GLOBAL.Newline;
1472: END IF;
1473: IF p_check_oe_flag = 1 THEN
1474: -- build statement
1475: -- Since there exist no shortage parameters for order entry
1476: -- we do not have to build a parameter dependent statement
1477: IF L_Order_System = 'OE' OR L_Order_System = 'ONT' THEN
1478: IF L_Order_System = 'OE' THEN
1479: L_Statement := L_Statement ||
1480: 'SELECT '||FND_GLOBAL.Newline||
1481: ' NVL(SUM(DECODE(SL.unit_code, '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1477: IF L_Order_System = 'OE' OR L_Order_System = 'ONT' THEN
1478: IF L_Order_System = 'OE' THEN
1479: L_Statement := L_Statement ||
1480: 'SELECT '||FND_GLOBAL.Newline||
1481: ' NVL(SUM(DECODE(SL.unit_code, '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1478: IF L_Order_System = 'OE' THEN
1479: L_Statement := L_Statement ||
1480: 'SELECT '||FND_GLOBAL.Newline||
1481: ' NVL(SUM(DECODE(SL.unit_code, '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1479: L_Statement := L_Statement ||
1480: 'SELECT '||FND_GLOBAL.Newline||
1481: ' NVL(SUM(DECODE(SL.unit_code, '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1480: 'SELECT '||FND_GLOBAL.Newline||
1481: ' NVL(SUM(DECODE(SL.unit_code, '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1481: ' NVL(SUM(DECODE(SL.unit_code, '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1482: ' MSI.primary_uom_code, (SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0)), '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1483: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1484: ' SPL.inventory_item_id '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1485: ' ,NULL '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1486: ' ,(SPLD.requested_quantity - NVL(SPLD.shipped_quantity,0))'||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1487: ' ,SL.unit_code '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1488: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1489: ' ,NULL '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1490: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1491: 'INTO '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1492: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1493: 'FROM so_headers SH '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1494: ' ,so_lines SL '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1495: ' ,so_line_details SLD '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1496: ' ,so_picking_lines SPL '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1497: ' ,so_picking_line_details SPLD '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1498: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1499: 'WHERE SPL.picking_header_id = 0 '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1500: 'AND SPL.picking_line_id = SPLD.picking_line_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1501: 'AND NVL(SPLD.released_flag,'||''''||'N'||''''||') = '||''''||'N'||''''||' '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1502: 'AND SPLD.requested_quantity > NVL(SPLD.shipped_quantity,0) '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1503: 'AND SL.line_id = SPL.order_line_id '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1504: 'AND SH.header_id = SL.header_id '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1505: 'AND SLD.line_id = SL.line_id '||FND_GLOBAL.Newline||
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1506: 'AND SL.ordered_quantity > NVL(SL.cancelled_quantity,0) '||FND_GLOBAL.Newline||
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1514: ELSE -- Order management system is installed
1507: 'AND SPL.inventory_item_id = MSI.inventory_item_id '||FND_GLOBAL.Newline||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1514: ELSE -- Order management system is installed
1515: L_Statement := L_Statement ||
1508: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1514: ELSE -- Order management system is installed
1515: L_Statement := L_Statement ||
1516: 'SELECT '||FND_GLOBAL.Newline||
1509: 'AND SPL.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1510: 'AND SPLD.warehouse_id = L_Organization_id '||FND_GLOBAL.Newline||
1511: 'AND SL.service_parent_line_id IS NULL '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1514: ELSE -- Order management system is installed
1515: L_Statement := L_Statement ||
1516: 'SELECT '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1512: 'AND SL.open_flag = '||''''||'Y'||''''||' '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1514: ELSE -- Order management system is installed
1515: L_Statement := L_Statement ||
1516: 'SELECT '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1513: 'AND SLD.released_flag = '||''''||'Y'||''''||'; '||FND_GLOBAL.Newline;
1514: ELSE -- Order management system is installed
1515: L_Statement := L_Statement ||
1516: 'SELECT '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1514: ELSE -- Order management system is installed
1515: L_Statement := L_Statement ||
1516: 'SELECT '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1515: L_Statement := L_Statement ||
1516: 'SELECT '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1516: 'SELECT '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1517: ' NVL(sum(DECODE(wdd.requested_quantity_uom, '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1518: ' MSI.primary_uom_code, wdd.requested_quantity, '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1519: ' INV_CONVERT.INV_UM_CONVERT ( '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1520: ' wdd.inventory_item_id '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1521: ' ,NULL '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1522: ' ,wdd.requested_quantity '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1523: ' ,wdd.requested_quantity_uom '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1524: ' ,MSI.primary_uom_code '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1525: ' ,NULL '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1533: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1526: ' ,NULL ) ) ),0) '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1533: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1534: 'AND wdd.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1527: 'INTO '||FND_GLOBAL.Newline||
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1533: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1534: 'AND wdd.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1535: -- Fix bug 2101710, short alert appears even for not backordered sales order
1528: ' :oe_short_quantity '||FND_GLOBAL.Newline||
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1533: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1534: 'AND wdd.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1535: -- Fix bug 2101710, short alert appears even for not backordered sales order
1536: -- added the following line to query only the backordered lines.
1529: 'FROM wsh_delivery_details_ob_grp_v wdd '||FND_GLOBAL.Newline||
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1533: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1534: 'AND wdd.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1535: -- Fix bug 2101710, short alert appears even for not backordered sales order
1536: -- added the following line to query only the backordered lines.
1537: -- this is to make the where clauses consistent with the detail statements
1530: ' ,mtl_system_items MSI '||FND_GLOBAL.Newline||
1531: 'WHERE wdd.inventory_item_id = L_Inventory_item_id '||FND_GLOBAL.Newline||
1532: 'AND MSI.inventory_item_id = wdd.inventory_item_id '||FND_GLOBAL.Newline||
1533: 'AND MSI.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1534: 'AND wdd.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1535: -- Fix bug 2101710, short alert appears even for not backordered sales order
1536: -- added the following line to query only the backordered lines.
1537: -- this is to make the where clauses consistent with the detail statements
1538: 'AND wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
1534: 'AND wdd.organization_id = L_Organization_id '||FND_GLOBAL.Newline||
1535: -- Fix bug 2101710, short alert appears even for not backordered sales order
1536: -- added the following line to query only the backordered lines.
1537: -- this is to make the where clauses consistent with the detail statements
1538: 'AND wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
1539: 'AND (wdd.requested_quantity IS NOT NULL ' ||FND_GLOBAL.Newline||
1540: 'AND wdd.requested_quantity > 0); '||FND_GLOBAL.Newline;
1541: --'AND MOL.quantity - NVL(MOL.quantity_detailed,0) > 0; '||FND_GLOBAL.Newline;
1542: END IF;
1535: -- Fix bug 2101710, short alert appears even for not backordered sales order
1536: -- added the following line to query only the backordered lines.
1537: -- this is to make the where clauses consistent with the detail statements
1538: 'AND wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
1539: 'AND (wdd.requested_quantity IS NOT NULL ' ||FND_GLOBAL.Newline||
1540: 'AND wdd.requested_quantity > 0); '||FND_GLOBAL.Newline;
1541: --'AND MOL.quantity - NVL(MOL.quantity_detailed,0) > 0; '||FND_GLOBAL.Newline;
1542: END IF;
1543: END IF;
1536: -- added the following line to query only the backordered lines.
1537: -- this is to make the where clauses consistent with the detail statements
1538: 'AND wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
1539: 'AND (wdd.requested_quantity IS NOT NULL ' ||FND_GLOBAL.Newline||
1540: 'AND wdd.requested_quantity > 0); '||FND_GLOBAL.Newline;
1541: --'AND MOL.quantity - NVL(MOL.quantity_detailed,0) > 0; '||FND_GLOBAL.Newline;
1542: END IF;
1543: END IF;
1544: END IF;
1537: -- this is to make the where clauses consistent with the detail statements
1538: 'AND wdd.released_status = '|| '''' ||'B' || '''' || FND_GLOBAL.Newline||
1539: 'AND (wdd.requested_quantity IS NOT NULL ' ||FND_GLOBAL.Newline||
1540: 'AND wdd.requested_quantity > 0); '||FND_GLOBAL.Newline;
1541: --'AND MOL.quantity - NVL(MOL.quantity_detailed,0) > 0; '||FND_GLOBAL.Newline;
1542: END IF;
1543: END IF;
1544: END IF;
1545: L_Statement := L_Statement||
1542: END IF;
1543: END IF;
1544: END IF;
1545: L_Statement := L_Statement||
1546: 'END; '||FND_GLOBAL.Newline;
1547: x_short_stat_sum := L_Statement;
1548: --
1549: -- Standard call to get message count and if count is 1, get message info
1550: FND_MSG_PUB.Count_And_Get
1660: VALUES (
1661: p_organization_id,
1662: 1,
1663: p_short_stat_detail,
1664: FND_GLOBAL.USER_ID,
1665: FND_GLOBAL.LOGIN_ID,
1666: sysdate,
1667: FND_GLOBAL.USER_ID,
1668: sysdate
1661: p_organization_id,
1662: 1,
1663: p_short_stat_detail,
1664: FND_GLOBAL.USER_ID,
1665: FND_GLOBAL.LOGIN_ID,
1666: sysdate,
1667: FND_GLOBAL.USER_ID,
1668: sysdate
1669: );
1663: p_short_stat_detail,
1664: FND_GLOBAL.USER_ID,
1665: FND_GLOBAL.LOGIN_ID,
1666: sysdate,
1667: FND_GLOBAL.USER_ID,
1668: sysdate
1669: );
1670: ELSE
1671: UPDATE mtl_short_chk_statements
1670: ELSE
1671: UPDATE mtl_short_chk_statements
1672: SET short_statement = p_short_stat_detail,
1673: last_update_date = sysdate,
1674: last_updated_by = FND_GLOBAL.USER_ID,
1675: last_update_login = FND_GLOBAL.LOGIN_ID
1676: WHERE organization_id = p_organization_id
1677: AND detail_sum_flag = 1;
1678: END IF;
1671: UPDATE mtl_short_chk_statements
1672: SET short_statement = p_short_stat_detail,
1673: last_update_date = sysdate,
1674: last_updated_by = FND_GLOBAL.USER_ID,
1675: last_update_login = FND_GLOBAL.LOGIN_ID
1676: WHERE organization_id = p_organization_id
1677: AND detail_sum_flag = 1;
1678: END IF;
1679: CLOSE crsStatement;
1695: VALUES (
1696: p_organization_id,
1697: 2,
1698: p_short_stat_sum,
1699: FND_GLOBAL.USER_ID,
1700: FND_GLOBAL.LOGIN_ID,
1701: sysdate,
1702: FND_GLOBAL.USER_ID,
1703: sysdate
1696: p_organization_id,
1697: 2,
1698: p_short_stat_sum,
1699: FND_GLOBAL.USER_ID,
1700: FND_GLOBAL.LOGIN_ID,
1701: sysdate,
1702: FND_GLOBAL.USER_ID,
1703: sysdate
1704: );
1698: p_short_stat_sum,
1699: FND_GLOBAL.USER_ID,
1700: FND_GLOBAL.LOGIN_ID,
1701: sysdate,
1702: FND_GLOBAL.USER_ID,
1703: sysdate
1704: );
1705: ELSE
1706: UPDATE mtl_short_chk_statements
1705: ELSE
1706: UPDATE mtl_short_chk_statements
1707: SET short_statement = p_short_stat_sum,
1708: last_update_date = sysdate,
1709: last_updated_by = FND_GLOBAL.USER_ID,
1710: last_update_login = FND_GLOBAL.LOGIN_ID
1711: WHERE organization_id = p_organization_id
1712: AND detail_sum_flag = 2;
1713: END IF;
1706: UPDATE mtl_short_chk_statements
1707: SET short_statement = p_short_stat_sum,
1708: last_update_date = sysdate,
1709: last_updated_by = FND_GLOBAL.USER_ID,
1710: last_update_login = FND_GLOBAL.LOGIN_ID
1711: WHERE organization_id = p_organization_id
1712: AND detail_sum_flag = 2;
1713: END IF;
1714: CLOSE crsStatement;