83: , p_token_tbl => l_token_tbl
84: );
85: l_mesg_token_tbl := l_out_mesg_token_tbl;
86:
87: l_return_status := FND_API.G_RET_STS_ERROR;
88:
89: ELSIF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_NOT_FOUND AND
90: p_eam_mat_req_rec.transaction_type IN
91: (EAM_PROCESS_WO_PVT.G_OPR_UPDATE, EAM_PROCESS_WO_PVT.G_OPR_DELETE)
101: , p_token_tbl => l_token_tbl
102: );
103: l_mesg_token_tbl := l_out_mesg_token_tbl;
104:
105: l_return_status := FND_API.G_RET_STS_ERROR;
106:
107: ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
108: THEN
109: l_out_mesg_token_tbl := l_mesg_token_tbl;
103: l_mesg_token_tbl := l_out_mesg_token_tbl;
104:
105: l_return_status := FND_API.G_RET_STS_ERROR;
106:
107: ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
108: THEN
109: l_out_mesg_token_tbl := l_mesg_token_tbl;
110: EAM_ERROR_MESSAGE_PVT.Add_Error_Token
111: ( x_Mesg_token_tbl => l_out_Mesg_Token_Tbl
113: , p_message_name => NULL
114: , p_message_text => 'Unexpected error while existence verification of ' || 'Material Requirement '|| p_eam_mat_req_rec.inventory_item_id , p_token_tbl => l_token_tbl
115: );
116: l_mesg_token_tbl := l_out_mesg_token_tbl;
117: l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
118:
119: ELSE /* Assign the relevant transaction type for SYNC operations */
120: IF p_eam_mat_req_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_SYNC THEN
121: IF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_FOUND THEN
123: ELSE
124: x_old_eam_mat_req_rec.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_CREATE;
125: END IF;
126: END IF;
127: l_return_status := FND_API.G_RET_STS_SUCCESS;
128:
129: END IF;
130:
131: x_return_status := l_return_status;
163: l_material_issue_by_mo VARCHAR2(1);
164:
165: BEGIN
166:
167: x_return_status := FND_API.G_RET_STS_SUCCESS;
168:
169: IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Within Material Requirement Check Attributes . . . '); END IF;
170:
171:
186: and wo.operation_seq_num = p_eam_mat_req_rec.operation_seq_num;
187: exception
188: when others then
189: if p_eam_mat_req_rec.operation_seq_num <> 1 then
190: raise fnd_api.g_exc_error;
191: end if;
192: if p_eam_mat_req_rec.operation_seq_num = 1 and
193: p_eam_mat_req_rec.department_id is not null then
194: raise fnd_api.g_exc_error;
190: raise fnd_api.g_exc_error;
191: end if;
192: if p_eam_mat_req_rec.operation_seq_num = 1 and
193: p_eam_mat_req_rec.department_id is not null then
194: raise fnd_api.g_exc_error;
195: end if;
196: end;
197:
198: end if;
196: end;
197:
198: end if;
199:
200: x_return_status := FND_API.G_RET_STS_SUCCESS;
201:
202: exception
203: when others then
204:
213: , x_mesg_token_tbl => l_out_mesg_token_tbl
214: );
215: l_mesg_token_tbl := l_out_mesg_token_tbl;
216:
217: x_return_status := FND_API.G_RET_STS_ERROR;
218: x_mesg_token_tbl := l_mesg_token_tbl ;
219: return;
220:
221: end;
262: end if;
263:
264: end if;
265:
266: x_return_status := FND_API.G_RET_STS_SUCCESS;
267:
268: exception
269:
270: when NOT_PURCHASABLE then
280: , x_mesg_token_tbl => l_out_mesg_token_tbl
281: );
282: l_mesg_token_tbl := l_out_mesg_token_tbl;
283:
284: x_return_status := FND_API.G_RET_STS_ERROR;
285: x_mesg_token_tbl := l_mesg_token_tbl ;
286: return;
287:
288: when others then
298: , x_mesg_token_tbl => l_out_mesg_token_tbl
299: );
300: l_mesg_token_tbl := l_out_mesg_token_tbl;
301:
302: x_return_status := FND_API.G_RET_STS_ERROR;
303: x_mesg_token_tbl := l_mesg_token_tbl ;
304: return;
305:
306: end;
313:
314: if (p_eam_mat_req_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
315:
316: if p_eam_mat_req_rec.quantity_per_assembly < 0 then
317: raise fnd_api.g_exc_unexpected_error;
318: end if;
319:
320: end if;
321:
318: end if;
319:
320: end if;
321:
322: x_return_status := FND_API.G_RET_STS_SUCCESS;
323:
324: exception
325: when others then
326:
335: , x_mesg_token_tbl => l_out_mesg_token_tbl
336: );
337: l_mesg_token_tbl := l_out_mesg_token_tbl;
338:
339: x_return_status := FND_API.G_RET_STS_ERROR;
340: x_mesg_token_tbl := l_mesg_token_tbl ;
341: return;
342:
343: end;
359: end if;
360:
361: end if;
362:
363: x_return_status := FND_API.G_RET_STS_SUCCESS;
364:
365: exception
366: when others then
367:
376: , x_mesg_token_tbl => l_out_mesg_token_tbl
377: );
378: l_mesg_token_tbl := l_out_mesg_token_tbl;
379:
380: x_return_status := FND_API.G_RET_STS_ERROR;
381: x_mesg_token_tbl := l_mesg_token_tbl ;
382: return;
383:
384: end;
402: end if;
403:
404: end if;
405:
406: x_return_status := FND_API.G_RET_STS_SUCCESS;
407:
408: exception
409: when others then
410:
419: , x_mesg_token_tbl => l_out_mesg_token_tbl
420: );
421: l_mesg_token_tbl := l_out_mesg_token_tbl;
422:
423: x_return_status := FND_API.G_RET_STS_ERROR;
424: x_mesg_token_tbl := l_mesg_token_tbl ;
425: return;
426:
427: end;
438:
439: if p_eam_mat_req_rec.department_id is null then
440:
441: if p_eam_mat_req_rec.operation_seq_num <> 1 then
442: raise fnd_api.g_exc_error;
443: end if;
444:
445: else
446:
459: end if;
460:
461: end if;
462:
463: x_return_status := FND_API.G_RET_STS_SUCCESS;
464:
465: exception
466: when others then
467:
483: , x_mesg_token_tbl => l_out_mesg_token_tbl
484: );
485: l_mesg_token_tbl := l_out_mesg_token_tbl;
486:
487: x_return_status := FND_API.G_RET_STS_ERROR;
488: x_mesg_token_tbl := l_mesg_token_tbl ;
489: return;
490:
491: end;
501:
502: if(p_eam_mat_req_rec.wip_supply_type is not null and p_eam_mat_req_rec.wip_supply_type not in (wip_constants.push, wip_constants.bulk, wip_constants.based_on_bom)) then
503: --not a valid supply type
504:
505: raise fnd_api.g_exc_unexpected_error;
506:
507: end if;
508:
509: end if;
507: end if;
508:
509: end if;
510:
511: x_return_status := FND_API.G_RET_STS_SUCCESS;
512:
513: exception
514: when others then
515:
524: , x_mesg_token_tbl => l_out_mesg_token_tbl
525: );
526: l_mesg_token_tbl := l_out_mesg_token_tbl;
527:
528: x_return_status := FND_API.G_RET_STS_ERROR;
529: x_mesg_token_tbl := l_mesg_token_tbl ;
530: return;
531:
532: end;
539:
540: if (p_eam_mat_req_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
541:
542: if p_eam_mat_req_rec.mrp_net_flag not in (wip_constants.yes, wip_constants.no) then
543: raise fnd_api.g_exc_unexpected_error;
544: end if;
545:
546: end if;
547:
544: end if;
545:
546: end if;
547:
548: x_return_status := FND_API.G_RET_STS_SUCCESS;
549:
550: exception
551: when others then
552:
561: , x_mesg_token_tbl => l_out_mesg_token_tbl
562: );
563: l_mesg_token_tbl := l_out_mesg_token_tbl;
564:
565: x_return_status := FND_API.G_RET_STS_ERROR;
566: x_mesg_token_tbl := l_mesg_token_tbl ;
567: return;
568:
569: end;
602: and operation_seq_num = p_eam_mat_req_rec.operation_seq_num
603: and inventory_item_id = p_eam_mat_req_rec.inventory_item_id;
604:
605: if(l_count_mmtt > 0) then
606: raise fnd_api.g_exc_unexpected_error;
607: end if;
608:
609: select count(*)
610: into l_count_mmt
614: and operation_seq_num = p_eam_mat_req_rec.operation_seq_num
615: and inventory_item_id = p_eam_mat_req_rec.inventory_item_id;
616:
617: if(l_count_mmt > 0) then
618: raise fnd_api.g_exc_unexpected_error;
619: end if;
620:
621: select quantity_issued
622: into l_issued_qty
626: and operation_seq_num = p_eam_mat_req_rec.operation_seq_num
627: and inventory_item_id = p_eam_mat_req_rec.inventory_item_id;
628:
629: if(l_issued_qty <> 0) then
630: raise fnd_api.g_exc_unexpected_error;
631: end if;
632:
633: end if;
634:
631: end if;
632:
633: end if;
634:
635: x_return_status := FND_API.G_RET_STS_SUCCESS;
636:
637: exception
638: when others then
639:
648: , x_mesg_token_tbl => l_out_mesg_token_tbl
649: );
650: l_mesg_token_tbl := l_out_mesg_token_tbl;
651:
652: x_return_status := FND_API.G_RET_STS_ERROR;
653: x_mesg_token_tbl := l_mesg_token_tbl ;
654: return;
655:
656: end;
669: where organization_id=p_eam_mat_req_rec.organization_id
670: and wip_entity_id=p_eam_mat_req_rec.wip_entity_id;
671:
672: if l_material_issue_by_mo='Y' and p_eam_mat_req_rec.required_quantity < nvl(p_eam_mat_req_rec.quantity_issued,0)+ nvl(l_allocated,0) then
673: raise fnd_api.g_exc_unexpected_error;
674: end if;
675:
676: x_return_status := FND_API.G_RET_STS_SUCCESS;
677:
672: if l_material_issue_by_mo='Y' and p_eam_mat_req_rec.required_quantity < nvl(p_eam_mat_req_rec.quantity_issued,0)+ nvl(l_allocated,0) then
673: raise fnd_api.g_exc_unexpected_error;
674: end if;
675:
676: x_return_status := FND_API.G_RET_STS_SUCCESS;
677:
678: exception
679: when others then
680:
686: , x_mesg_token_tbl => l_out_mesg_token_tbl
687: );
688: l_mesg_token_tbl := l_out_mesg_token_tbl;
689:
690: x_return_status := FND_API.G_RET_STS_ERROR;
691: x_mesg_token_tbl := l_mesg_token_tbl ;
692: return;
693:
694: end;
805: ) ;
806: l_mesg_token_tbl := l_out_mesg_token_tbl;
807:
808: -- Return the status and message table.
809: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
810: x_mesg_token_tbl := l_mesg_token_tbl ;
811:
812:
813: END Check_Attributes;
830: l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
831: l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
832: BEGIN
833:
834: x_return_status := FND_API.G_RET_STS_SUCCESS;
835:
836:
837: IF p_eam_mat_req_rec.wip_entity_id IS NULL
838: THEN
847: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
848: );
849: l_mesg_token_tbl := l_out_mesg_token_tbl;
850:
851: x_return_status := FND_API.G_RET_STS_ERROR;
852:
853: END IF;
854:
855:
866: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
867: );
868: l_mesg_token_tbl := l_out_mesg_token_tbl;
869:
870: x_return_status := FND_API.G_RET_STS_ERROR;
871:
872: END IF;
873:
874:
885: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
886: );
887: l_mesg_token_tbl := l_out_mesg_token_tbl;
888:
889: x_return_status := FND_API.G_RET_STS_ERROR;
890:
891: END IF;
892:
893:
904: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
905: );
906: l_mesg_token_tbl := l_out_mesg_token_tbl;
907:
908: x_return_status := FND_API.G_RET_STS_ERROR;
909:
910: END IF;
911:
912:
923: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
924: );
925: l_mesg_token_tbl := l_out_mesg_token_tbl;
926:
927: x_return_status := FND_API.G_RET_STS_ERROR;
928:
929: END IF;
930:
931:
942: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
943: );
944: l_mesg_token_tbl := l_out_mesg_token_tbl;
945:
946: x_return_status := FND_API.G_RET_STS_ERROR;
947:
948: END IF;
949:
950:
961: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
962: );
963: l_mesg_token_tbl := l_out_mesg_token_tbl;
964:
965: x_return_status := FND_API.G_RET_STS_ERROR;
966:
967: END IF;
968:
969:
980: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
981: );
982: l_mesg_token_tbl := l_out_mesg_token_tbl;
983:
984: x_return_status := FND_API.G_RET_STS_ERROR;
985:
986: END IF;
987:
988:
999: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1000: );
1001: l_mesg_token_tbl := l_out_mesg_token_tbl;
1002:
1003: x_return_status := FND_API.G_RET_STS_ERROR;
1004:
1005: END IF;
1006:
1007:
1018: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1019: );
1020: l_mesg_token_tbl := l_out_mesg_token_tbl;
1021:
1022: x_return_status := FND_API.G_RET_STS_ERROR;
1023:
1024: END IF;
1025:
1026: