84: , p_token_tbl => l_token_tbl
85: );
86: l_mesg_token_tbl := l_out_mesg_token_tbl;
87:
88: l_return_status := FND_API.G_RET_STS_ERROR;
89:
90: ELSIF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_NOT_FOUND AND
91: p_eam_res_rec.transaction_type IN
92: (EAM_PROCESS_WO_PVT.G_OPR_UPDATE, EAM_PROCESS_WO_PVT.G_OPR_DELETE)
102: , p_token_tbl => l_token_tbl
103: );
104: l_mesg_token_tbl := l_out_mesg_token_tbl;
105:
106: l_return_status := FND_API.G_RET_STS_ERROR;
107:
108: ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
109: THEN
110: l_out_mesg_token_tbl := l_mesg_token_tbl;
104: l_mesg_token_tbl := l_out_mesg_token_tbl;
105:
106: l_return_status := FND_API.G_RET_STS_ERROR;
107:
108: ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
109: THEN
110: l_out_mesg_token_tbl := l_mesg_token_tbl;
111: EAM_ERROR_MESSAGE_PVT.Add_Error_Token
112: ( x_Mesg_token_tbl => l_out_Mesg_Token_Tbl
114: , p_message_name => NULL
115: , p_message_text => 'Unexpected error while existence verification of ' || 'Resource '|| p_eam_res_rec.resource_seq_num , p_token_tbl => l_token_tbl
116: );
117: l_mesg_token_tbl := l_out_mesg_token_tbl;
118: l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
119:
120: ELSE /* Assign the relevant transaction type for SYNC operations */
121: IF p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_SYNC THEN
122: IF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_FOUND THEN
124: ELSE
125: x_old_eam_res_rec.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_CREATE;
126: END IF;
127: END IF;
128: l_return_status := FND_API.G_RET_STS_SUCCESS;
129:
130: END IF;
131:
132: x_return_status := l_return_status;
179: and wo.operation_seq_num = p_eam_res_rec.operation_seq_num;
180:
181: end if;
182:
183: x_return_status := FND_API.G_RET_STS_SUCCESS;
184:
185: exception
186: when others then
187:
196: , x_mesg_token_tbl => l_out_mesg_token_tbl
197: );
198: l_mesg_token_tbl := l_out_mesg_token_tbl;
199:
200: x_return_status := FND_API.G_RET_STS_ERROR;
201: x_mesg_token_tbl := l_mesg_token_tbl ;
202: return;
203:
204: end;
211:
212: if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
213:
214: if p_eam_res_rec.start_date > p_eam_res_rec.completion_date then
215: raise fnd_api.g_exc_unexpected_error;
216: end if;
217:
218: end if;
219:
216: end if;
217:
218: end if;
219:
220: x_return_status := FND_API.G_RET_STS_SUCCESS;
221:
222: exception
223: when others then
224:
233: , x_mesg_token_tbl => l_out_mesg_token_tbl
234: );
235: l_mesg_token_tbl := l_out_mesg_token_tbl;
236:
237: x_return_status := FND_API.G_RET_STS_ERROR;
238: x_mesg_token_tbl := l_mesg_token_tbl ;
239: return;
240:
241: end;
248:
249: if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
250:
251: if (p_eam_res_rec.assigned_units is null or p_eam_res_rec.assigned_units < 0 ) then
252: raise fnd_api.g_exc_unexpected_error;
253: end if;
254:
255: end if;
256:
253: end if;
254:
255: end if;
256:
257: x_return_status := FND_API.G_RET_STS_SUCCESS;
258:
259: exception
260: when others then
261:
270: , x_mesg_token_tbl => l_out_mesg_token_tbl
271: );
272: l_mesg_token_tbl := l_out_mesg_token_tbl;
273:
274: x_return_status := FND_API.G_RET_STS_ERROR;
275: x_mesg_token_tbl := l_mesg_token_tbl ;
276: return;
277:
278: end;
294: and wor.operation_seq_num = p_eam_res_rec.operation_seq_num
295: and wor.resource_id = p_eam_res_rec.resource_id;
296:
297: if g_dummy >=1 then
298: raise fnd_api.g_exc_unexpected_error;
299: end if;
300: exception when NO_DATA_FOUND then
301: null;
302: end ;
302: end ;
303:
304: end if;
305:
306: x_return_status := FND_API.G_RET_STS_SUCCESS;
307:
308: exception
309: when others then
310:
319: , x_mesg_token_tbl => l_out_mesg_token_tbl
320: );
321: l_mesg_token_tbl := l_out_mesg_token_tbl;
322:
323: x_return_status := FND_API.G_RET_STS_ERROR;
324: x_mesg_token_tbl := l_mesg_token_tbl ;
325: return;
326:
327: end;
356: and bdr.resource_id = p_eam_res_rec.resource_id;
357:
358: end if;
359:
360: x_return_status := FND_API.G_RET_STS_SUCCESS;
361:
362: exception
363: when others then
364:
373: , x_mesg_token_tbl => l_out_mesg_token_tbl
374: );
375: l_mesg_token_tbl := l_out_mesg_token_tbl;
376:
377: x_return_status := FND_API.G_RET_STS_ERROR;
378: x_mesg_token_tbl := l_mesg_token_tbl ;
379: return;
380:
381: end;
400: and unit_of_measure = p_eam_res_rec.uom_code;
401:
402: end if;
403:
404: x_return_status := FND_API.G_RET_STS_SUCCESS;
405:
406: exception
407: when others then
408:
417: , x_mesg_token_tbl => l_out_mesg_token_tbl
418: );
419: l_mesg_token_tbl := l_out_mesg_token_tbl;
420:
421: x_return_status := FND_API.G_RET_STS_ERROR;
422: x_mesg_token_tbl := l_mesg_token_tbl ;
423: return;
424:
425: end;
440: and lookup_code = p_eam_res_rec.basis_type;
441:
442: end if;
443:
444: x_return_status := FND_API.G_RET_STS_SUCCESS;
445:
446: exception
447: when others then
448:
457: , x_mesg_token_tbl => l_out_mesg_token_tbl
458: );
459: l_mesg_token_tbl := l_out_mesg_token_tbl;
460:
461: x_return_status := FND_API.G_RET_STS_ERROR;
462: x_mesg_token_tbl := l_mesg_token_tbl ;
463: return;
464:
465: end;
485: END IF;
486:
487: end if;
488:
489: x_return_status := FND_API.G_RET_STS_SUCCESS;
490:
491: exception
492: when others then
493:
503: , x_mesg_token_tbl => l_out_mesg_token_tbl
504: );
505: l_mesg_token_tbl := l_out_mesg_token_tbl;
506:
507: x_return_status := FND_API.G_RET_STS_ERROR;
508: x_mesg_token_tbl := l_mesg_token_tbl ;
509: return;
510:
511: end;
526: and lookup_code = p_eam_res_rec.autocharge_type;
527:
528: end if;
529:
530: x_return_status := FND_API.G_RET_STS_SUCCESS;
531:
532: exception
533: when others then
534:
543: , x_mesg_token_tbl => l_out_mesg_token_tbl
544: );
545: l_mesg_token_tbl := l_out_mesg_token_tbl;
546:
547: x_return_status := FND_API.G_RET_STS_ERROR;
548: x_mesg_token_tbl := l_mesg_token_tbl ;
549: return;
550:
551: end;
558:
559: if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
560:
561: if p_eam_res_rec.scheduled_flag not in (1,2) then
562: raise fnd_api.g_exc_error;
563: end if;
564:
565: end if;
566:
563: end if;
564:
565: end if;
566:
567: x_return_status := FND_API.G_RET_STS_SUCCESS;
568:
569: exception
570: when others then
571:
580: , x_mesg_token_tbl => l_out_mesg_token_tbl
581: );
582: l_mesg_token_tbl := l_out_mesg_token_tbl;
583:
584: x_return_status := FND_API.G_RET_STS_ERROR;
585: x_mesg_token_tbl := l_mesg_token_tbl ;
586: return;
587:
588: end;
597:
598: IF (p_eam_res_rec.standard_rate_flag is not NULL) and (p_eam_res_rec.standard_rate_flag not in (1, 2))
599: THEN
600:
601: raise fnd_api.g_exc_unexpected_error;
602:
603: END IF;
604:
605: end if;
603: END IF;
604:
605: end if;
606:
607: x_return_status := FND_API.G_RET_STS_SUCCESS;
608:
609: exception
610: when others then
611:
620: , x_mesg_token_tbl => l_out_mesg_token_tbl
621: );
622: l_mesg_token_tbl := l_out_mesg_token_tbl;
623:
624: x_return_status := FND_API.G_RET_STS_ERROR;
625: x_mesg_token_tbl := l_mesg_token_tbl ;
626: return;
627:
628: end;
659: AND wo.operation_seq_num = p_eam_res_rec.operation_seq_num
660: AND wo.department_id = p_eam_res_rec.department_id;
661: END IF;
662:
663: x_return_status := FND_API.G_RET_STS_SUCCESS;
664:
665: exception
666: when others then
667:
673: , x_mesg_token_tbl => l_out_mesg_token_tbl
674: );
675: l_mesg_token_tbl := l_out_mesg_token_tbl;
676:
677: x_return_status := FND_API.G_RET_STS_ERROR;
678: x_mesg_token_tbl := l_mesg_token_tbl ;
679: return;
680:
681: end;
709:
710: IF (p_eam_res_rec.usage_rate_or_amount < 0 and (p_eam_res_rec.autocharge_type = 3 or l_uom_time_class_flag = 'Y'))
711: THEN
712:
713: raise fnd_api.g_exc_unexpected_error;
714:
715: END IF;
716:
717: end if;
715: END IF;
716:
717: end if;
718:
719: x_return_status := FND_API.G_RET_STS_SUCCESS;
720:
721: exception
722: when others then
723:
732: , x_mesg_token_tbl => l_out_mesg_token_tbl
733: );
734: l_mesg_token_tbl := l_out_mesg_token_tbl;
735:
736: x_return_status := FND_API.G_RET_STS_ERROR;
737: x_mesg_token_tbl := l_mesg_token_tbl ;
738: return;
739:
740: end;
784: , x_mesg_token_tbl => l_out_mesg_token_tbl
785: );
786: l_mesg_token_tbl := l_out_mesg_token_tbl;
787:
788: x_return_status := FND_API.G_RET_STS_ERROR;
789: x_mesg_token_tbl := l_mesg_token_tbl ;
790: return;
791: end if;
792: end if;
789: x_mesg_token_tbl := l_mesg_token_tbl ;
790: return;
791: end if;
792: end if;
793: x_return_status := FND_API.G_RET_STS_SUCCESS;
794: end if;
795: exception
796: when others then
797: l_token_tbl(1).token_name := 'RES_SEQ_NUM';
805: , x_mesg_token_tbl => l_out_mesg_token_tbl
806: );
807: l_mesg_token_tbl := l_out_mesg_token_tbl;
808:
809: x_return_status := FND_API.G_RET_STS_ERROR;
810: x_mesg_token_tbl := l_mesg_token_tbl ;
811: return;
812: end;
813:
834: and resource_seq_num = p_eam_res_rec.resource_seq_num
835: and resource_id = p_eam_res_rec.resource_id);
836:
837: if(l_count_wt > 0) then
838: raise fnd_api.g_exc_unexpected_error;
839: end if;
840:
841: select count(*)
842: into l_count_wcti
849: and resource_seq_num = p_eam_res_rec.resource_seq_num
850: and resource_id = p_eam_res_rec.resource_id);
851:
852: if(l_count_wcti > 0) then
853: raise fnd_api.g_exc_unexpected_error;
854: end if;
855:
856: select nvl(applied_resource_units,0)
857: into l_applied_res_units
862: and resource_seq_num = p_eam_res_rec.resource_seq_num
863: and resource_id = p_eam_res_rec.resource_id;
864:
865: if(l_applied_res_units <> 0) then
866: raise fnd_api.g_exc_unexpected_error;
867: end if;
868:
869: end if;
870:
867: end if;
868:
869: end if;
870:
871: x_return_status := FND_API.G_RET_STS_SUCCESS;
872:
873: exception
874: when others then
875:
884: , x_mesg_token_tbl => l_out_mesg_token_tbl
885: );
886: l_mesg_token_tbl := l_out_mesg_token_tbl;
887:
888: x_return_status := FND_API.G_RET_STS_ERROR;
889: x_mesg_token_tbl := l_mesg_token_tbl ;
890: return;
891:
892: end;
905: and resource_seq_num = p_eam_res_rec.resource_seq_num
906: and rownum <=1;
907:
908: if(l_count_inst <> 0) then
909: raise fnd_api.g_exc_unexpected_error;
910: end if;
911: end if;
912: exception
913: when others then
920: , x_mesg_token_tbl => l_out_mesg_token_tbl
921: );
922: l_mesg_token_tbl := l_out_mesg_token_tbl;
923:
924: x_return_status := FND_API.G_RET_STS_ERROR;
925: x_mesg_token_tbl := l_mesg_token_tbl ;
926: return;
927: end;
928:
949: and wip_resource_seq_num = p_eam_res_rec.resource_seq_num
950: and bom_resource_id = p_eam_res_rec.resource_id);
951:
952: if(l_count_po <> 0) then
953: raise fnd_api.g_exc_unexpected_error;
954: end if;
955:
956:
957: select count(*)
974: or prl.modified_by_agent_flag is null));
975:
976:
977: if(l_count_req <> 0) then
978: raise fnd_api.g_exc_unexpected_error;
979: end if;
980:
981:
982: select count(*)
995: or poll.closed_code is null));
996:
997:
998: if(l_count_dist <> 0) then
999: raise fnd_api.g_exc_unexpected_error;
1000: end if;
1001:
1002: end if;
1003:
1000: end if;
1001:
1002: end if;
1003:
1004: x_return_status := FND_API.G_RET_STS_SUCCESS;
1005:
1006: exception
1007: when others then
1008:
1017: , x_mesg_token_tbl => l_out_mesg_token_tbl
1018: );
1019: l_mesg_token_tbl := l_out_mesg_token_tbl;
1020:
1021: x_return_status := FND_API.G_RET_STS_ERROR;
1022: x_mesg_token_tbl := l_mesg_token_tbl ;
1023: return;
1024:
1025: end;
1025: end;
1026:
1027:
1028:
1029: x_return_status := FND_API.G_RET_STS_SUCCESS;
1030:
1031: IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Within Resource Check Attributes . . . '); END IF;
1032:
1033:
1052: l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
1053: l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
1054: BEGIN
1055:
1056: x_return_status := FND_API.G_RET_STS_SUCCESS;
1057:
1058: IF p_eam_res_rec.wip_entity_id IS NULL
1059: THEN
1060: l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1068: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1069: );
1070: l_mesg_token_tbl := l_out_mesg_token_tbl;
1071:
1072: x_return_status := FND_API.G_RET_STS_ERROR;
1073:
1074: END IF;
1075:
1076:
1087: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1088: );
1089: l_mesg_token_tbl := l_out_mesg_token_tbl;
1090:
1091: x_return_status := FND_API.G_RET_STS_ERROR;
1092:
1093: END IF;
1094:
1095:
1106: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1107: );
1108: l_mesg_token_tbl := l_out_mesg_token_tbl;
1109:
1110: x_return_status := FND_API.G_RET_STS_ERROR;
1111:
1112: END IF;
1113:
1114:
1125: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1126: );
1127: l_mesg_token_tbl := l_out_mesg_token_tbl;
1128:
1129: x_return_status := FND_API.G_RET_STS_ERROR;
1130:
1131: END IF;
1132:
1133:
1144: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1145: );
1146: l_mesg_token_tbl := l_out_mesg_token_tbl;
1147:
1148: x_return_status := FND_API.G_RET_STS_ERROR;
1149:
1150: END IF;
1151:
1152:
1163: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1164: );
1165: l_mesg_token_tbl := l_out_mesg_token_tbl;
1166:
1167: x_return_status := FND_API.G_RET_STS_ERROR;
1168:
1169: END IF;
1170:
1171:
1182: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1183: );
1184: l_mesg_token_tbl := l_out_mesg_token_tbl;
1185:
1186: x_return_status := FND_API.G_RET_STS_ERROR;
1187:
1188: END IF;
1189:
1190:
1201: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1202: );
1203: l_mesg_token_tbl := l_out_mesg_token_tbl;
1204:
1205: x_return_status := FND_API.G_RET_STS_ERROR;
1206:
1207: END IF;
1208:
1209:
1220: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1221: );
1222: l_mesg_token_tbl := l_out_mesg_token_tbl;
1223:
1224: x_return_status := FND_API.G_RET_STS_ERROR;
1225:
1226: END IF;
1227:
1228:
1239: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1240: );
1241: l_mesg_token_tbl := l_out_mesg_token_tbl;
1242:
1243: x_return_status := FND_API.G_RET_STS_ERROR;
1244:
1245: END IF;
1246:
1247:
1258: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1259: );
1260: l_mesg_token_tbl := l_out_mesg_token_tbl;
1261:
1262: x_return_status := FND_API.G_RET_STS_ERROR;
1263:
1264: END IF;
1265:
1266:
1277: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1278: );
1279: l_mesg_token_tbl := l_out_mesg_token_tbl;
1280:
1281: x_return_status := FND_API.G_RET_STS_ERROR;
1282:
1283: END IF;
1284:
1285:
1296: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1297: );
1298: l_mesg_token_tbl := l_out_mesg_token_tbl;
1299:
1300: x_return_status := FND_API.G_RET_STS_ERROR;
1301:
1302: END IF;
1303:
1304:
1315: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1316: );
1317: l_mesg_token_tbl := l_out_mesg_token_tbl;
1318:
1319: x_return_status := FND_API.G_RET_STS_ERROR;
1320:
1321: END IF;
1322:
1323:
1334: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1335: );
1336: l_mesg_token_tbl := l_out_mesg_token_tbl;
1337:
1338: x_return_status := FND_API.G_RET_STS_ERROR;
1339:
1340: END IF;
1341:
1342: IF p_eam_res_rec.uom_code IS NULL
1352: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1353: );
1354: l_mesg_token_tbl := l_out_mesg_token_tbl;
1355:
1356: x_return_status := FND_API.G_RET_STS_ERROR;
1357:
1358: END IF;
1359:
1360: