141: AND organization_id = p_organization_id
142: AND operation_seq_num = p_operation_seq_num
143: AND resource_seq_num = p_resource_seq_num;
144:
145: x_return_status := EAM_PROCESS_WO_PVT.G_RECORD_FOUND;
146: x_eam_sub_res_rec := l_eam_sub_res_rec;
147:
148: EXCEPTION
149: WHEN NO_DATA_FOUND THEN
146: x_eam_sub_res_rec := l_eam_sub_res_rec;
147:
148: EXCEPTION
149: WHEN NO_DATA_FOUND THEN
150: x_return_status := EAM_PROCESS_WO_PVT.G_RECORD_NOT_FOUND;
151: x_eam_sub_res_rec := l_eam_sub_res_rec;
152:
153: WHEN OTHERS THEN
154: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
173: )
174: IS
175: BEGIN
176:
177: IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Writing Sub Resource rec for ' || p_eam_sub_res_rec.resource_seq_num); END IF;
178:
179: -- bug no 3444091
180: if p_eam_sub_res_rec.start_date > p_eam_sub_res_rec.completion_date then
181: x_return_status := fnd_api.g_ret_sts_error;
280: , SYSDATE);
281:
282:
283:
284: IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug ('Creating new Sub Resource') ; END IF;
285:
286: x_return_status := FND_API.G_RET_STS_SUCCESS;
287:
288: EXCEPTION
313: )
314: IS
315: BEGIN
316:
317: IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Updating Sub Resource: '|| p_eam_sub_res_rec.resource_seq_num); END IF;
318:
319: -- bug no 3444091
320: if p_eam_sub_res_rec.start_date > p_eam_sub_res_rec.completion_date then
321: x_return_status := fnd_api.g_ret_sts_error;
390: l_Mesg_Token_tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
391: l_return_status VARCHAR2(1):= FND_API.G_RET_STS_SUCCESS;
392: BEGIN
393:
394: IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug ('Deleting Sub Resource Usage') ; END IF;
395:
396: EAM_RES_USAGE_UTILITY_PVT.Delete_Usage
397: ( p_wip_entity_id => p_eam_sub_res_rec.wip_entity_id
398: , p_organization_id => p_eam_sub_res_rec.organization_id
401: , x_mesg_token_Tbl => l_mesg_token_Tbl
402: , x_return_Status => l_return_Status
403: );
404:
405: IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug ('Deleting Sub resources') ; END IF;
406:
407: DELETE FROM WIP_SUB_OPERATION_RESOURCES
408: WHERE wip_entity_id = p_eam_sub_res_rec.wip_entity_id
409: AND organization_id = p_eam_sub_res_rec.organization_id
436: l_Mesg_Token_tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
437: l_return_status VARCHAR2(1):= FND_API.G_RET_STS_SUCCESS;
438: BEGIN
439:
440: IF p_eam_sub_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_CREATE
441: THEN
442: Insert_Row
443: ( p_eam_sub_res_rec => p_eam_sub_res_rec
444: , x_mesg_token_Tbl => l_mesg_token_tbl
443: ( p_eam_sub_res_rec => p_eam_sub_res_rec
444: , x_mesg_token_Tbl => l_mesg_token_tbl
445: , x_return_Status => l_return_status
446: );
447: ELSIF p_eam_sub_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_UPDATE
448: THEN
449: Update_Row
450: ( p_eam_sub_res_rec => p_eam_sub_res_rec
451: , x_mesg_token_Tbl => l_mesg_token_tbl
450: ( p_eam_sub_res_rec => p_eam_sub_res_rec
451: , x_mesg_token_Tbl => l_mesg_token_tbl
452: , x_return_Status => l_return_status
453: );
454: ELSIF p_eam_sub_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_DELETE
455: THEN
456: Delete_Row
457: ( p_eam_sub_res_rec => p_eam_sub_res_rec
458: , x_mesg_token_Tbl => l_mesg_token_tbl