87: , p_token_tbl => l_token_tbl
88: );
89: l_mesg_token_tbl := l_out_mesg_token_tbl;
90:
91: l_return_status := FND_API.G_RET_STS_ERROR;
92:
93: ELSIF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_NOT_FOUND AND
94: p_eam_mat_req_rec.transaction_type IN
95: (EAM_PROCESS_WO_PVT.G_OPR_UPDATE, EAM_PROCESS_WO_PVT.G_OPR_DELETE)
105: , p_token_tbl => l_token_tbl
106: );
107: l_mesg_token_tbl := l_out_mesg_token_tbl;
108:
109: l_return_status := FND_API.G_RET_STS_ERROR;
110:
111: ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
112: THEN
113: l_out_mesg_token_tbl := l_mesg_token_tbl;
107: l_mesg_token_tbl := l_out_mesg_token_tbl;
108:
109: l_return_status := FND_API.G_RET_STS_ERROR;
110:
111: ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
112: THEN
113: l_out_mesg_token_tbl := l_mesg_token_tbl;
114: EAM_ERROR_MESSAGE_PVT.Add_Error_Token
115: ( x_Mesg_token_tbl => l_out_Mesg_Token_Tbl
117: , p_message_name => NULL
118: , 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
119: );
120: l_mesg_token_tbl := l_out_mesg_token_tbl;
121: l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
122:
123: ELSE /* Assign the relevant transaction type for SYNC operations */
124: IF p_eam_mat_req_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_SYNC THEN
125: IF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_FOUND THEN
127: ELSE
128: x_old_eam_mat_req_rec.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_CREATE;
129: END IF;
130: END IF;
131: l_return_status := FND_API.G_RET_STS_SUCCESS;
132:
133: END IF;
134:
135: x_return_status := l_return_status;
167: l_material_issue_by_mo VARCHAR2(1);
168:
169: BEGIN
170:
171: x_return_status := FND_API.G_RET_STS_SUCCESS;
172:
173: IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Within Material Requirement Check Attributes . . . '); END IF;
174:
175:
190: and wo.operation_seq_num = p_eam_mat_req_rec.operation_seq_num;
191: exception
192: when others then
193: if p_eam_mat_req_rec.operation_seq_num <> 1 then
194: raise fnd_api.g_exc_error;
195: end if;
196: if p_eam_mat_req_rec.operation_seq_num = 1 and
197: p_eam_mat_req_rec.department_id is not null then
198: raise fnd_api.g_exc_error;
194: raise fnd_api.g_exc_error;
195: end if;
196: if p_eam_mat_req_rec.operation_seq_num = 1 and
197: p_eam_mat_req_rec.department_id is not null then
198: raise fnd_api.g_exc_error;
199: end if;
200: end;
201:
202: end if;
200: end;
201:
202: end if;
203:
204: x_return_status := FND_API.G_RET_STS_SUCCESS;
205:
206: exception
207: when others then
208:
217: , x_mesg_token_tbl => l_out_mesg_token_tbl
218: );
219: l_mesg_token_tbl := l_out_mesg_token_tbl;
220:
221: x_return_status := FND_API.G_RET_STS_ERROR;
222: x_mesg_token_tbl := l_mesg_token_tbl ;
223: return;
224:
225: end;
266: end if;
267:
268: end if;
269:
270: x_return_status := FND_API.G_RET_STS_SUCCESS;
271:
272: exception
273:
274: when NOT_PURCHASABLE then
284: , x_mesg_token_tbl => l_out_mesg_token_tbl
285: );
286: l_mesg_token_tbl := l_out_mesg_token_tbl;
287:
288: x_return_status := FND_API.G_RET_STS_ERROR;
289: x_mesg_token_tbl := l_mesg_token_tbl ;
290: return;
291:
292: when others then
302: , x_mesg_token_tbl => l_out_mesg_token_tbl
303: );
304: l_mesg_token_tbl := l_out_mesg_token_tbl;
305:
306: x_return_status := FND_API.G_RET_STS_ERROR;
307: x_mesg_token_tbl := l_mesg_token_tbl ;
308: return;
309:
310: end;
317:
318: if (p_eam_mat_req_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
319:
320: if p_eam_mat_req_rec.quantity_per_assembly < 0 then
321: raise fnd_api.g_exc_unexpected_error;
322: end if;
323:
324: end if;
325:
322: end if;
323:
324: end if;
325:
326: x_return_status := FND_API.G_RET_STS_SUCCESS;
327:
328: exception
329: when others then
330:
339: , x_mesg_token_tbl => l_out_mesg_token_tbl
340: );
341: l_mesg_token_tbl := l_out_mesg_token_tbl;
342:
343: x_return_status := FND_API.G_RET_STS_ERROR;
344: x_mesg_token_tbl := l_mesg_token_tbl ;
345: return;
346:
347: end;
363: end if;
364:
365: end if;
366:
367: x_return_status := FND_API.G_RET_STS_SUCCESS;
368:
369: exception
370: when others then
371:
380: , x_mesg_token_tbl => l_out_mesg_token_tbl
381: );
382: l_mesg_token_tbl := l_out_mesg_token_tbl;
383:
384: x_return_status := FND_API.G_RET_STS_ERROR;
385: x_mesg_token_tbl := l_mesg_token_tbl ;
386: return;
387:
388: end;
406: end if;
407:
408: end if;
409:
410: x_return_status := FND_API.G_RET_STS_SUCCESS;
411:
412: exception
413: when others then
414:
423: , x_mesg_token_tbl => l_out_mesg_token_tbl
424: );
425: l_mesg_token_tbl := l_out_mesg_token_tbl;
426:
427: x_return_status := FND_API.G_RET_STS_ERROR;
428: x_mesg_token_tbl := l_mesg_token_tbl ;
429: return;
430:
431: end;
442:
443: if p_eam_mat_req_rec.department_id is null then
444:
445: if p_eam_mat_req_rec.operation_seq_num <> 1 then
446: raise fnd_api.g_exc_error;
447: end if;
448:
449: else
450:
463: end if;
464:
465: end if;
466:
467: x_return_status := FND_API.G_RET_STS_SUCCESS;
468:
469: exception
470: when others then
471:
487: , x_mesg_token_tbl => l_out_mesg_token_tbl
488: );
489: l_mesg_token_tbl := l_out_mesg_token_tbl;
490:
491: x_return_status := FND_API.G_RET_STS_ERROR;
492: x_mesg_token_tbl := l_mesg_token_tbl ;
493: return;
494:
495: end;
505:
506: 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
507: --not a valid supply type
508:
509: raise fnd_api.g_exc_unexpected_error;
510:
511: end if;
512:
513: end if;
511: end if;
512:
513: end if;
514:
515: x_return_status := FND_API.G_RET_STS_SUCCESS;
516:
517: exception
518: when others then
519:
528: , x_mesg_token_tbl => l_out_mesg_token_tbl
529: );
530: l_mesg_token_tbl := l_out_mesg_token_tbl;
531:
532: x_return_status := FND_API.G_RET_STS_ERROR;
533: x_mesg_token_tbl := l_mesg_token_tbl ;
534: return;
535:
536: end;
543:
544: if (p_eam_mat_req_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
545:
546: if p_eam_mat_req_rec.mrp_net_flag not in (wip_constants.yes, wip_constants.no) then
547: raise fnd_api.g_exc_unexpected_error;
548: end if;
549:
550: end if;
551:
548: end if;
549:
550: end if;
551:
552: x_return_status := FND_API.G_RET_STS_SUCCESS;
553:
554: exception
555: when others then
556:
565: , x_mesg_token_tbl => l_out_mesg_token_tbl
566: );
567: l_mesg_token_tbl := l_out_mesg_token_tbl;
568:
569: x_return_status := FND_API.G_RET_STS_ERROR;
570: x_mesg_token_tbl := l_mesg_token_tbl ;
571: return;
572:
573: end;
606: and operation_seq_num = p_eam_mat_req_rec.operation_seq_num
607: and inventory_item_id = p_eam_mat_req_rec.inventory_item_id;
608:
609: if(l_count_mmtt > 0) then
610: raise fnd_api.g_exc_unexpected_error;
611: end if;
612:
613: select count(*)
614: into l_count_mmt
618: and operation_seq_num = p_eam_mat_req_rec.operation_seq_num
619: and inventory_item_id = p_eam_mat_req_rec.inventory_item_id;
620:
621: if(l_count_mmt > 0) then
622: raise fnd_api.g_exc_unexpected_error;
623: end if;
624:
625: select quantity_issued
626: into l_issued_qty
630: and operation_seq_num = p_eam_mat_req_rec.operation_seq_num
631: and inventory_item_id = p_eam_mat_req_rec.inventory_item_id;
632:
633: if(l_issued_qty <> 0) then
634: raise fnd_api.g_exc_unexpected_error;
635: end if;
636:
637: end if;
638:
635: end if;
636:
637: end if;
638:
639: x_return_status := FND_API.G_RET_STS_SUCCESS;
640:
641: exception
642: when others then
643:
652: , x_mesg_token_tbl => l_out_mesg_token_tbl
653: );
654: l_mesg_token_tbl := l_out_mesg_token_tbl;
655:
656: x_return_status := FND_API.G_RET_STS_ERROR;
657: x_mesg_token_tbl := l_mesg_token_tbl ;
658: return;
659:
660: end;
673: where organization_id=p_eam_mat_req_rec.organization_id
674: and wip_entity_id=p_eam_mat_req_rec.wip_entity_id;
675:
676: 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
677: raise fnd_api.g_exc_unexpected_error;
678: end if;
679:
680: x_return_status := FND_API.G_RET_STS_SUCCESS;
681:
676: 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
677: raise fnd_api.g_exc_unexpected_error;
678: end if;
679:
680: x_return_status := FND_API.G_RET_STS_SUCCESS;
681:
682: exception
683: when others then
684:
690: , x_mesg_token_tbl => l_out_mesg_token_tbl
691: );
692: l_mesg_token_tbl := l_out_mesg_token_tbl;
693:
694: x_return_status := FND_API.G_RET_STS_ERROR;
695: x_mesg_token_tbl := l_mesg_token_tbl ;
696: return;
697:
698: end;
811: ) ;
812: l_mesg_token_tbl := l_out_mesg_token_tbl;
813:
814: -- Return the status and message table.
815: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
816: x_mesg_token_tbl := l_mesg_token_tbl ;
817:
818:
819: END Check_Attributes;
836: l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
837: l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
838: BEGIN
839:
840: x_return_status := FND_API.G_RET_STS_SUCCESS;
841:
842:
843: IF p_eam_mat_req_rec.wip_entity_id IS NULL
844: THEN
853: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
854: );
855: l_mesg_token_tbl := l_out_mesg_token_tbl;
856:
857: x_return_status := FND_API.G_RET_STS_ERROR;
858:
859: END IF;
860:
861:
872: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
873: );
874: l_mesg_token_tbl := l_out_mesg_token_tbl;
875:
876: x_return_status := FND_API.G_RET_STS_ERROR;
877:
878: END IF;
879:
880:
891: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
892: );
893: l_mesg_token_tbl := l_out_mesg_token_tbl;
894:
895: x_return_status := FND_API.G_RET_STS_ERROR;
896:
897: END IF;
898:
899:
910: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
911: );
912: l_mesg_token_tbl := l_out_mesg_token_tbl;
913:
914: x_return_status := FND_API.G_RET_STS_ERROR;
915:
916: END IF;
917:
918:
929: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
930: );
931: l_mesg_token_tbl := l_out_mesg_token_tbl;
932:
933: x_return_status := FND_API.G_RET_STS_ERROR;
934:
935: END IF;
936:
937:
948: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
949: );
950: l_mesg_token_tbl := l_out_mesg_token_tbl;
951:
952: x_return_status := FND_API.G_RET_STS_ERROR;
953:
954: END IF;
955:
956:
967: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
968: );
969: l_mesg_token_tbl := l_out_mesg_token_tbl;
970:
971: x_return_status := FND_API.G_RET_STS_ERROR;
972:
973: END IF;
974:
975:
986: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
987: );
988: l_mesg_token_tbl := l_out_mesg_token_tbl;
989:
990: x_return_status := FND_API.G_RET_STS_ERROR;
991:
992: END IF;
993:
994:
1005: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1006: );
1007: l_mesg_token_tbl := l_out_mesg_token_tbl;
1008:
1009: x_return_status := FND_API.G_RET_STS_ERROR;
1010:
1011: END IF;
1012:
1013:
1024: , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1025: );
1026: l_mesg_token_tbl := l_out_mesg_token_tbl;
1027:
1028: x_return_status := FND_API.G_RET_STS_ERROR;
1029:
1030: END IF;
1031:
1032: