19: l_api_name CONSTANT VARCHAR2(30) := 'Create_EAM_Work_Order';
20: l_api_version CONSTANT NUMBER := 1.0;
21: l_full_name CONSTANT VARCHAR2(60) := g_pkg_name || '.' || l_api_name;
22: l_module CONSTANT VARCHAR2(60) := 'wip.plsql.'||l_full_name;
23: l_log boolean := FND_LOG.TEST(FND_LOG.LEVEL_UNEXPECTED, l_module);
24: l_request_id NUMBER := 0;
25: l_debug VARCHAR2(1);
26: l_scheduled_start_date DATE;
27: l_scheduled_completion_date DATE;
63: l_out_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
64: l_out_eam_di_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
65:
66: BEGIN
67: if (l_log and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
68: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'Start of ' || l_module);
69: end if;
70: l_maint_obj_fnd :='N';
71: l_eam_wo_rec.asset_activity_id := p_work_order_rec.primary_item_id;
64: l_out_eam_di_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
65:
66: BEGIN
67: if (l_log and (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
68: FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, l_module, 'Start of ' || l_module);
69: end if;
70: l_maint_obj_fnd :='N';
71: l_eam_wo_rec.asset_activity_id := p_work_order_rec.primary_item_id;
72:
168: NULL;
169: END;
170: END IF;
171:
172: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
173: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
174: 'l_gen_object_id: ' || l_gen_object_id);
175: end if;
176: l_eam_wo_rec.status_type := p_work_order_rec.status_type;
169: END;
170: END IF;
171:
172: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
173: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
174: 'l_gen_object_id: ' || l_gen_object_id);
175: end if;
176: l_eam_wo_rec.status_type := p_work_order_rec.status_type;
177:
197: l_eam_wo_rec.activity_cause :=p_work_order_rec.activity_cause;
198: l_eam_wo_rec.activity_source := p_work_order_rec.activity_source;
199: l_eam_wo_rec.work_order_type := p_work_order_rec.work_order_type;
200:
201: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
202: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, 'Fetching default owning dept');
203: end if;
204: IF p_work_order_rec.owning_department is not null THEN
205: l_dept_id := p_work_order_rec.owning_department;
198: l_eam_wo_rec.activity_source := p_work_order_rec.activity_source;
199: l_eam_wo_rec.work_order_type := p_work_order_rec.work_order_type;
200:
201: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
202: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, 'Fetching default owning dept');
203: end if;
204: IF p_work_order_rec.owning_department is not null THEN
205: l_dept_id := p_work_order_rec.owning_department;
206: ELSE if p_work_order_rec.owning_department_code is not null THEN
229: /* If the Department of Work Order cannot be set then change the status of Work Order to Unrelease */
230: IF l_dept_id is null and p_work_order_rec.status_type not in (1,6,17) THEN
231: l_eam_wo_rec.status_type:=1;
232: END IF ;
233: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
234: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, 'default owning dept id:'
235: || l_dept_id);
236: end if;
237:
230: IF l_dept_id is null and p_work_order_rec.status_type not in (1,6,17) THEN
231: l_eam_wo_rec.status_type:=1;
232: END IF ;
233: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
234: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, 'default owning dept id:'
235: || l_dept_id);
236: end if;
237:
238: l_eam_wo_rec.job_quantity := null;
304: l_eam_wo_rec.source_code := p_work_order_rec.source_code;
305: -- l_eam_wo_rec.return_status :=
306: l_eam_wo_rec.transaction_type := EAM_PROCESS_WO_PUB.G_OPR_CREATE;
307:
308: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
309: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, 'Calling work order API');
310: end if;
311: EAM_PROCESS_WO_PUB.Process_WO
312: ( p_bo_identifier => 'EAM'
305: -- l_eam_wo_rec.return_status :=
306: l_eam_wo_rec.transaction_type := EAM_PROCESS_WO_PUB.G_OPR_CREATE;
307:
308: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
309: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module, 'Calling work order API');
310: end if;
311: EAM_PROCESS_WO_PUB.Process_WO
312: ( p_bo_identifier => 'EAM'
313: , p_init_msg_list => TRUE
337: , p_debug_filename => 'wipvewob.log'
338: , p_output_dir => l_output_dir
339: , p_debug_file_mode => 'W'
340: );
341: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
342: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
343: 'work order API returned status: '|| l_return_status);
344: end if;
345:
338: , p_output_dir => l_output_dir
339: , p_debug_file_mode => 'W'
340: );
341: if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
342: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
343: 'work order API returned status: '|| l_return_status);
344: end if;
345:
346: if(l_return_status <> FND_API.G_RET_STS_SUCCESS) then