1: package body BOMPVALB as
2: /* $Header: BOMVALBB.pls 115.4 99/07/16 05:16:42 porting sh $ */
3: /*==========================================================================+
4: | Copyright (c) 1993 Oracle Corporation Belmont, California, USA |
5: | All rights reserved. |
4: | Copyright (c) 1993 Oracle Corporation Belmont, California, USA |
5: | All rights reserved. |
6: +===========================================================================+
7: | |
8: | File Name : BOMPVALB.plb |
9: | DESCRIPTION : This package contains functions used to validate bill |
10: | data in the interface tables |
11: | Parameters: org_id organization_id |
12: | all_org process all orgs or just current org |
363: return(0);
364:
365: EXCEPTION
366: when others then
367: err_text := 'BOMPVALB(bmvbomh-' || stmt_num || ') ' || substrb(SQLERRM,1,60);
368: return(SQLCODE);
369: END bmvbomh_validate_bom_header;
370:
371:
402: and inventory_item_id = assy_id;
403: return(0);
404: EXCEPTION
405: when NO_DATA_FOUND then
406: err_text := 'BOMPVALB(bmvassyid): Assembly item does not exist';
407: return(9999);
408: when others then
409: err_text := 'BOMPVALB(bmvassyid) ' || substrb(SQLERRM,1,60);
410: return(SQLCODE);
405: when NO_DATA_FOUND then
406: err_text := 'BOMPVALB(bmvassyid): Assembly item does not exist';
407: return(9999);
408: when others then
409: err_text := 'BOMPVALB(bmvassyid) ' || substrb(SQLERRM,1,60);
410: return(SQLCODE);
411:
412: END bmvassyid_verify_assembly_id;
413:
459: NULL;
460: when NOT_UNIQUE then
461: raise NOT_UNIQUE;
462: when others then
463: err_text := 'BOMPVALB(bmvrbom) ' || substrb(SQLERRM,1,60);
464: return(SQLCODE);
465: END;
466:
467: /*
490: end if;
491:
492: EXCEPTION
493: when NO_DATA_FOUND then
494: err_text := substrb('BOMPVALB(bmvrbom): Bill does not exist ' || SQLERRM,1,70);
495: return(9999);
496: when NOT_UNIQUE then
497: err_text := 'BOMPVALB(bmvrbom) ' || 'Duplicate bill sequence id';
498: return(9999);
493: when NO_DATA_FOUND then
494: err_text := substrb('BOMPVALB(bmvrbom): Bill does not exist ' || SQLERRM,1,70);
495: return(9999);
496: when NOT_UNIQUE then
497: err_text := 'BOMPVALB(bmvrbom) ' || 'Duplicate bill sequence id';
498: return(9999);
499: when others then
500: err_text := 'BOMPVALB(bmvrbom) ' || substrb(SQLERRM,1,60);
501: return(SQLCODE);
496: when NOT_UNIQUE then
497: err_text := 'BOMPVALB(bmvrbom) ' || 'Duplicate bill sequence id';
498: return(9999);
499: when others then
500: err_text := 'BOMPVALB(bmvrbom) ' || substrb(SQLERRM,1,60);
501: return(SQLCODE);
502: END bmvrbom_verify_bom;
503:
504: /*--------------------- bmvdupbom_verify_duplicate_bom ----------------------*/
545: nvl(alt_desg, 'NONE');
546: raise ALREADY_EXISTS;
547: exception
548: when ALREADY_EXISTS then
549: err_text := 'BOMPVALB(bmvdupbom): Bill already exists in production';
550: return(cnt);
551: when NO_DATA_FOUND then
552: NULL;
553: when others then
550: return(cnt);
551: when NO_DATA_FOUND then
552: NULL;
553: when others then
554: err_text := 'BOMPVALB(bmvdupbom) ' || substrb(SQLERRM,1,60);
555: return(SQLCODE);
556: end;
557:
558: begin
568:
569: raise ALREADY_EXISTS;
570: exception
571: when ALREADY_EXISTS then
572: err_text := 'BOMPVALB(bmvdupbom): Bill already exists in interface';
573: return(cnt);
574: when NO_DATA_FOUND then
575: NULL;
576: when others then
573: return(cnt);
574: when NO_DATA_FOUND then
575: NULL;
576: when others then
577: err_text := 'BOMPVALB(bmvdupbom) ' || substrb(SQLERRM,1,60);
578: return(SQLCODE);
579: end;
580:
581: /*
598: exception
599: when NO_DATA_FOUND then
600: NULL;
601: when others then
602: err_text := 'BOMPVALB(bmvdupbom) ' || substrb(SQLERRM,1,60);
603: return(SQLCODE);
604: end;
605:
606: begin
617: and process_flag = 4
618: and rownum = 1;
619: exception
620: when NO_DATA_FOUND then
621: err_text := 'BOMPVALB(bmvdupbom): Valid primary does not exist';
622: return(9999);
623: when others then
624: err_text := 'BOMPVALB(bmvdupbom) ' || substrb(SQLERRM,1,60);
625: return(SQLCODE);
620: when NO_DATA_FOUND then
621: err_text := 'BOMPVALB(bmvdupbom): Valid primary does not exist';
622: return(9999);
623: when others then
624: err_text := 'BOMPVALB(bmvdupbom) ' || substrb(SQLERRM,1,60);
625: return(SQLCODE);
626: end;
627: end if;
628:
629: return(0);
630:
631: EXCEPTION
632: when others then
633: err_text := 'BOMPVALB(bmvdupbom) ' || substrb(SQLERRM,1,60);
634: return(SQLCODE);
635: END bmvdupbom_verify_duplicate_bom;
636:
637:
678: return(0);
679:
680: EXCEPTION
681: when NO_DATA_FOUND then
682: err_text := 'BOMPVALB(bmvbitm): Assembly type invalid or item not BOM enabled';
683: return(9999);
684: when others then
685: err_text := 'BOMPVALB(bmvbitm) ' || substrb(SQLERRM,1,60);
686: return(SQLCODE);
681: when NO_DATA_FOUND then
682: err_text := 'BOMPVALB(bmvbitm): Assembly type invalid or item not BOM enabled';
683: return(9999);
684: when others then
685: err_text := 'BOMPVALB(bmvbitm) ' || substrb(SQLERRM,1,60);
686: return(SQLCODE);
687:
688: END bmvbitm_verify_assembly_type;
689:
748: and mp2.organization_id = cmn_org_id
749: and mp1.master_organization_id = mp2.master_organization_id;
750: exception
751: when NO_DATA_FOUND then
752: err_text := 'BOMPVALB(bmvcmbom): Invalid common master org id';
753: return(9999);
754: when others then
755: err_text := 'BOMPVALB(bmvcmbom) ' || substrb(SQLERRM,1,60);
756: return(SQLCODE);
751: when NO_DATA_FOUND then
752: err_text := 'BOMPVALB(bmvcmbom): Invalid common master org id';
753: return(9999);
754: when others then
755: err_text := 'BOMPVALB(bmvcmbom) ' || substrb(SQLERRM,1,60);
756: return(SQLCODE);
757: end;
758: /*
759: ** Common bill's alt must be same as current bill's alt
788: exception
789: when NO_DATA_FOUND then
790: NULL;
791: when others then
792: err_text := 'BOMPVALB(bmvmbom) ' || substrb(SQLERRM,1,60);
793: return(SQLCODE);
794: end;
795:
796: select bill_sequence_id
1011: and msi1.pick_components_flag = msi2.pick_components_flag
1012: and msi1.replenish_to_order_flag = msi2.replenish_to_order_flag;
1013: exception
1014: when NO_DATA_FOUND then
1015: err_text := 'BOMPVALB(bmvcmbom): Invalid item attributes';
1016: return(9999);
1017: when others then
1018: err_text := 'BOMPVALB(bmvcmbom) ' || substrb(SQLERRM,1,60);
1019: return(SQLCODE);
1014: when NO_DATA_FOUND then
1015: err_text := 'BOMPVALB(bmvcmbom): Invalid item attributes';
1016: return(9999);
1017: when others then
1018: err_text := 'BOMPVALB(bmvcmbom) ' || substrb(SQLERRM,1,60);
1019: return(SQLCODE);
1020: end;
1021:
1022: return(0);
1021:
1022: return(0);
1023: EXCEPTION
1024: when NO_DATA_FOUND then
1025: err_text := 'BOMPVALB(bmvcmbom):Invalid common bill';
1026: return(9999);
1027: when MISSING_ITEMS then
1028: err_text := 'BOMPVALB(bmvcmbom): Component items not in both orgs or invalid';
1029: return(9999);
1024: when NO_DATA_FOUND then
1025: err_text := 'BOMPVALB(bmvcmbom):Invalid common bill';
1026: return(9999);
1027: when MISSING_ITEMS then
1028: err_text := 'BOMPVALB(bmvcmbom): Component items not in both orgs or invalid';
1029: return(9999);
1030: when MISSING_SUB_ITEMS then
1031: err_text := 'BOMPVALB(bmvcmbom): Substitute items not in both orgs';
1032: return(9999);
1027: when MISSING_ITEMS then
1028: err_text := 'BOMPVALB(bmvcmbom): Component items not in both orgs or invalid';
1029: return(9999);
1030: when MISSING_SUB_ITEMS then
1031: err_text := 'BOMPVALB(bmvcmbom): Substitute items not in both orgs';
1032: return(9999);
1033: when others then
1034: err_text := 'BOMPVALB(bmvcmbom) ' || substrb(SQLERRM,1,60);
1035: return(SQLCODE);
1030: when MISSING_SUB_ITEMS then
1031: err_text := 'BOMPVALB(bmvcmbom): Substitute items not in both orgs';
1032: return(9999);
1033: when others then
1034: err_text := 'BOMPVALB(bmvcmbom) ' || substrb(SQLERRM,1,60);
1035: return(SQLCODE);
1036: END bmvcmbom_verify_common_bom;
1037:
1038: /*---------------------- bmvcomp_validate_components -----------------------*/
1121: /*
1122: ** verify for uniqueness of component seq ID
1123: */
1124: stmt_num := 1;
1125: ret_code := BOMPVALB.bmvuncmp_verify_unique_comp (
1126: cmp_seq_id => c1rec.CSI,
1127: exist_flag => 2,
1128: err_text => err_text);
1129: if (ret_code <> 0) then
1151: /*
1152: ** verify uniqueness of bill seq id,effective date,op seq, and component item
1153: */
1154: stmt_num := 2;
1155: ret_code := BOMPVALB.bmvdupcmp_verify_duplicate_cmp (
1156: bill_seq_id => c1rec.BSI,
1157: eff_date => c1rec.ED,
1158: cmp_item_id => c1rec.CII,
1159: op_seq => c1rec.OSN,
1341: End if;
1342: end;
1343:
1344: stmt_num := 7;
1345: ret_code := BOMPVALB.bmvitmatt_verify_item_attr (
1346: org_id => c1rec.OI,
1347: cmp_id => c1rec.CII,
1348: eng_bill => eng_bill,
1349: assy_id => c1rec.AII,
1374: /*
1375: ** check for validity of operation sequences
1376: */
1377: stmt_num := 8;
1378: ret_code := BOMPVALB.bmvopseqs_valid_op_seqs (
1379: org_id => c1rec.OI,
1380: assy_id => c1rec.AII,
1381: alt_desg => c1rec.ABD,
1382: op_seq => c1rec.OSN,
2015: EXCEPTION
2016: when ret_code_error then
2017: return(ret_code);
2018: when others then
2019: err_text := 'BOMPVALB(bmvcomp-' || stmt_num || ') ' || substrb(SQLERRM,1,60);
2020: return(SQLCODE);
2021: END bmvcomp_validate_components;
2022:
2023: /*------------------------ bmvitmatt_verify_item_attr -----------------------*/
2349: null;
2350: when NOT_UNIQUE then
2351: raise NOT_UNIQUE;
2352: when others then
2353: err_text := 'BOMPVALB(bmvuncmp) ' || substrb(SQLERRM,1,60);
2354: return(SQLCODE);
2355: end;
2356:
2357: /*
2380: end if;
2381:
2382: EXCEPTION
2383: when NO_DATA_FOUND then
2384: err_text := substrb('BOMPVALB(bmvuncmp): Component does not exist ' || SQLERRM,1,70);
2385: return(9999);
2386: when NOT_UNIQUE then
2387: err_text := 'BOMPVALB(bmvuncmp) ' ||'Duplicate component sequence ids';
2388: return(9999);
2383: when NO_DATA_FOUND then
2384: err_text := substrb('BOMPVALB(bmvuncmp): Component does not exist ' || SQLERRM,1,70);
2385: return(9999);
2386: when NOT_UNIQUE then
2387: err_text := 'BOMPVALB(bmvuncmp) ' ||'Duplicate component sequence ids';
2388: return(9999);
2389: when others then
2390: err_text := 'BOMPVALB(bmvuncmp) ' || substrb(SQLERRM,1,60);
2391: return(SQLCODE);
2386: when NOT_UNIQUE then
2387: err_text := 'BOMPVALB(bmvuncmp) ' ||'Duplicate component sequence ids';
2388: return(9999);
2389: when others then
2390: err_text := 'BOMPVALB(bmvuncmp) ' || substrb(SQLERRM,1,60);
2391: return(SQLCODE);
2392: END bmvuncmp_verify_unique_comp;
2393:
2394: /*--------------------- bmvdupcmp_verify_duplicate_cmp ----------------------*/
2434: and operation_seq_num = op_seq;
2435: raise ALREADY_EXISTS;
2436: exception
2437: when ALREADY_EXISTS then
2438: err_text := 'BOMPVALB(bmvdupcmp): Component already exists in production';
2439: return(cnt);
2440: when NO_DATA_FOUND then
2441: NULL;
2442: when others then
2439: return(cnt);
2440: when NO_DATA_FOUND then
2441: NULL;
2442: when others then
2443: err_text := 'BOMPVALB(bmvdupcmp) ' || substrb(SQLERRM,1,60);
2444: return(SQLCODE);
2445: end;
2446:
2447: begin
2457:
2458: raise ALREADY_EXISTS;
2459: exception
2460: when ALREADY_EXISTS then
2461: err_text := 'BOMPVALB(bmvdupcmp): Component already exists in interface';
2462: return(cnt);
2463: when NO_DATA_FOUND then
2464: NULL;
2465: when others then
2462: return(cnt);
2463: when NO_DATA_FOUND then
2464: NULL;
2465: when others then
2466: err_text := 'BOMPVALB(bmvdupcmp) ' || substrb(SQLERRM,1,60);
2467: return(SQLCODE);
2468: end;
2469: return(0);
2470:
2469: return(0);
2470:
2471: EXCEPTION
2472: when others then
2473: err_text := 'BOMPVALB(bmvdupcmp) ' || substrb(SQLERRM,1,60);
2474: return(SQLCODE);
2475: END bmvdupcmp_verify_duplicate_cmp;
2476:
2477:
2570:
2571: /*
2572: ** verify for existence of component seq id
2573: */
2574: ret_code := BOMPVALB.bmvuncmp_verify_unique_comp (
2575: cmp_seq_id => c1rec.CSI,
2576: exist_flag => 1,
2577: err_text => err_text);
2578: if (ret_code <> 0) then
2600:
2601: /*
2602: ** check for duplicate component seq id/ref desg combinations
2603: */
2604: ret_code := BOMPVALB.bmvundesg_verify_unique_desg (
2605: trans_id => c1rec.TI,
2606: err_text => err_text);
2607: if (ret_code <> 0) then
2608: ret_code := INVPUOPI.mtl_log_interface_err(
2629:
2630: /*
2631: ** count reference designators if quantity related is Yes
2632: */
2633: ret_code := BOMPVALB.bmvcdesg_cnt_ref_desgs (
2634: trans_id => c1rec.TI,
2635: cmp_seq_id => c1rec.CSI,
2636: err_text => err_text);
2637: if (ret_code <> 0) then
2833: null;
2834: when NOT_UNIQUE then
2835: raise NOT_UNIQUE;
2836: when others then
2837: err_text := 'BOMPVALB(bmvundesg) ' || substrb(SQLERRM,1,60);
2838: return(SQLCODE);
2839: end;
2840:
2841: /*
2862: return(0);
2863: end if;
2864: exception
2865: when NOT_UNIQUE then
2866: err_text := 'BOMPVALB(bmvundesg) ' ||'Duplicate ref desgs';
2867: return(9999);
2868: when others then
2869: err_text := 'BOMPVALB(bmvundesg) ' || substrb(SQLERRM,1,60);
2870: return(SQLCODE);
2865: when NOT_UNIQUE then
2866: err_text := 'BOMPVALB(bmvundesg) ' ||'Duplicate ref desgs';
2867: return(9999);
2868: when others then
2869: err_text := 'BOMPVALB(bmvundesg) ' || substrb(SQLERRM,1,60);
2870: return(SQLCODE);
2871: end bmvundesg_verify_unique_desg;
2872:
2873: /*------------------------ bmvcdesg_cnt_ref_desgs ------------------------*/
2907: exception
2908: when NO_DATA_FOUND then
2909: null;
2910: when others then
2911: err_text := 'BOMPVALB(bmvcdesg) ' || substrb(SQLERRM,1,60);
2912: return(SQLCODE);
2913: end;
2914:
2915: /*
2942: where transaction_id = trans_id
2943: and process_flag <> 3
2944: and process_flag <> 7;
2945: if (ref_qty + int_ref_qty <> cmp_qty) then
2946: err_text := 'BOMPVALB(bmvcdesg) ' || 'Number of ref desg
2947: not equal to component qty';
2948: return (9999);
2949: end if;
2950: end if;
2952: return(0);
2953:
2954: exception
2955: when others then
2956: err_text := 'BOMPVALB(bmvcdesg) ' || substrb(SQLERRM,1,60);
2957: return(SQLCODE);
2958: END bmvcdesg_cnt_ref_desgs;
2959:
2960:
3022: /*
3023: ** verify for existence of component seq id
3024: */
3025: commit_cnt := commit_cnt + 1;
3026: ret_code := BOMPVALB.bmvuncmp_verify_unique_comp (
3027: cmp_seq_id => c1rec.CSI,
3028: exist_flag => 1,
3029: err_text => err_text);
3030: if (ret_code <> 0) then
3199:
3200: /*
3201: ** Verify substitute component is unique for a component
3202: */
3203: ret_code := BOMPVALB.bmvunsub_verify_unique_sub (
3204: trans_id => c1rec.TI,
3205: err_text => err_text);
3206: if (ret_code <> 0) then
3207: ret_code := INVPUOPI.mtl_log_interface_err(
3405: null;
3406: when NOT_UNIQUE then
3407: raise NOT_UNIQUE;
3408: when others then
3409: err_text := 'BOMPVALB(bmvunsub) ' || substrb(SQLERRM,1,60);
3410: return(SQLCODE);
3411: end;
3412:
3413: /*
3434: return(0);
3435: end if;
3436: exception
3437: when NOT_UNIQUE then
3438: err_text := 'BOMPVALB(bmvunsub) ' ||'Duplicate substitute components';
3439: return(9999);
3440: when others then
3441: err_text := 'BOMPVALB(bmvunsub) ' || substrb(SQLERRM,1,60);
3442: return(SQLCODE);
3437: when NOT_UNIQUE then
3438: err_text := 'BOMPVALB(bmvunsub) ' ||'Duplicate substitute components';
3439: return(9999);
3440: when others then
3441: err_text := 'BOMPVALB(bmvunsub) ' || substrb(SQLERRM,1,60);
3442: return(SQLCODE);
3443: end bmvunsub_verify_unique_sub;
3444:
3445:
3570: END;
3571:
3572: /* Check if assembly item exists */
3573: stmt_num := 3;
3574: ret_code := BOMPVALB.bmvassyid_verify_assembly_id(
3575: org_id => c0rec.OI,
3576: assy_id => c0rec.AII,
3577: err_text => err_text);
3578: if (ret_code <> 0) then
3667: while continue_loop loop
3668: for c1rec in c1 loop
3669: commit_cnt := commit_cnt + 1;
3670: stmt_num := 4;
3671: ret_code := BOMPVALB.bmvalrev_validate_rev (
3672: org_id => c1rec.OI,
3673: assy_id => c1rec.AII,
3674: user_id => user_id,
3675: login_id => login_id,
3698: return(0);
3699:
3700: EXCEPTION
3701: when others then
3702: err_text := 'BOMPVALB(bmvitmrev)' || substrb(SQLERRM,1,60);
3703: return(SQLCODE);
3704: END bmvitmrev_validate_itm_rev;
3705:
3706: /*--------------------------- bmvalrev_validate_rev -------------------------*/
3816: end loop;
3817: return(0);
3818: exception
3819: when others then
3820: err_text := 'BOMPVALB(bmvalrev-' || stmt_num || ')' || substrb(SQLERRM,1,60);
3821: return(SQLCODE);
3822: END bmvalrev_validate_rev;
3823:
3824: END BOMPVALB;
3820: err_text := 'BOMPVALB(bmvalrev-' || stmt_num || ')' || substrb(SQLERRM,1,60);
3821: return(SQLCODE);
3822: END bmvalrev_validate_rev;
3823:
3824: END BOMPVALB;