157: IS
158: l_c_index NUMBER;
159: BEGIN
160:
161: l_c_index := OE_Bulk_Cache.Load_Price_List(p_price_list_id);
162:
163: RETURN OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).list_type_code;
164:
165: END Get_Price_List_Type;
159: BEGIN
160:
161: l_c_index := OE_Bulk_Cache.Load_Price_List(p_price_list_id);
162:
163: RETURN OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).list_type_code;
164:
165: END Get_Price_List_Type;
166:
167:
403: and site_use.cust_acct_site_id=acct_site.cust_acct_site_id
404: and acct_site.cust_account_id=p_end_customer_id;
405:
406: RETURN TRUE; */
407: l_c_index := OE_Bulk_Cache.Load_End_customer_site
408: (p_key => p_end_customer_site_use_id);
409:
410: IF OE_Bulk_Cache.G_END_CUSTOMER_SITE_TBL(l_c_index).customer_id
411: = p_end_customer_id
406: RETURN TRUE; */
407: l_c_index := OE_Bulk_Cache.Load_End_customer_site
408: (p_key => p_end_customer_site_use_id);
409:
410: IF OE_Bulk_Cache.G_END_CUSTOMER_SITE_TBL(l_c_index).customer_id
411: = p_end_customer_id
412: THEN
413: RETURN TRUE;
414: ELSE
702:
703: -- Check for additional required fields based on flags set
704: -- at the order type: agreement, customer po number
705:
706: l_c_index := OE_Bulk_Cache.Load_Order_Type(p_header_rec.order_type_id(p_index));
707:
708: IF ( OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).agreement_required_flag = 'Y' AND
709: p_header_rec.agreement_id(p_index) IS NULL)
710: THEN
704: -- at the order type: agreement, customer po number
705:
706: l_c_index := OE_Bulk_Cache.Load_Order_Type(p_header_rec.order_type_id(p_index));
707:
708: IF ( OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).agreement_required_flag = 'Y' AND
709: p_header_rec.agreement_id(p_index) IS NULL)
710: THEN
711: x_return_status := FND_API.G_RET_STS_ERROR;
712: FND_MESSAGE.SET_NAME('ONT','OE_BOOK_REQUIRED_ATTRIBUTE');
714: OE_Order_UTIL.Get_Attribute_Name('AGREEMENT_ID'));
715: oe_bulk_msg_pub.ADD;
716: END IF;
717:
718: IF ( OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).require_po_flag = 'Y' AND
719: p_header_rec.cust_po_number(p_index) IS NULL)
720: THEN
721: x_return_status := FND_API.G_RET_STS_ERROR;
722: FND_MESSAGE.SET_NAME('ONT','OE_BOOK_REQUIRED_ATTRIBUTE');
843: IF p_header_rec.order_type_id(p_index) IS NULL THEN
844:
845: BEGIN
846:
847: l_c_index := OE_Bulk_Cache.Load_Invoice_To
848: (p_key => p_header_rec.invoice_to_org_id(p_index)
849: ,p_default_attributes => 'Y');
850: p_header_rec.order_type_id(p_index)
851: := OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).order_type_id;
847: l_c_index := OE_Bulk_Cache.Load_Invoice_To
848: (p_key => p_header_rec.invoice_to_org_id(p_index)
849: ,p_default_attributes => 'Y');
850: p_header_rec.order_type_id(p_index)
851: := OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).order_type_id;
852: -- Invalid invoice to - error message populated during validation
853: EXCEPTION
854: WHEN NO_DATA_FOUND THEN
855: oe_debug_pub.add('Invoice To cache returns no data found');
861: IF p_header_rec.order_type_id(p_index) IS NULL THEN
862:
863: BEGIN
864:
865: l_c_index := OE_Bulk_Cache.Load_Ship_To
866: (p_key => p_header_rec.ship_to_org_id(p_index)
867: ,p_default_attributes => 'Y');
868: p_header_rec.order_type_id(p_index)
869: := OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).order_type_id;
865: l_c_index := OE_Bulk_Cache.Load_Ship_To
866: (p_key => p_header_rec.ship_to_org_id(p_index)
867: ,p_default_attributes => 'Y');
868: p_header_rec.order_type_id(p_index)
869: := OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).order_type_id;
870:
871: -- Invalid ship to - error message populated during validation
872: EXCEPTION
873: WHEN NO_DATA_FOUND THEN
890: THEN
891:
892: BEGIN
893:
894: l_c_index := OE_Bulk_Cache.Load_Agreement
895: (p_key => p_header_rec.agreement_id(p_index)
896: ,p_default_attributes => 'Y');
897:
898: p_header_rec.price_list_id(p_index) := nvl(p_header_rec.price_list_id(p_index)
895: (p_key => p_header_rec.agreement_id(p_index)
896: ,p_default_attributes => 'Y');
897:
898: p_header_rec.price_list_id(p_index) := nvl(p_header_rec.price_list_id(p_index)
899: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id);
900: p_header_rec.payment_term_id(p_index) := nvl(p_header_rec.payment_term_id(p_index)
901: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).payment_term_id);
902: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
903: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).accounting_rule_id);
897:
898: p_header_rec.price_list_id(p_index) := nvl(p_header_rec.price_list_id(p_index)
899: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id);
900: p_header_rec.payment_term_id(p_index) := nvl(p_header_rec.payment_term_id(p_index)
901: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).payment_term_id);
902: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
903: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).accounting_rule_id);
904: p_header_rec.invoicing_rule_id(p_index) := nvl(p_header_rec.invoicing_rule_id(p_index)
905: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).invoicing_rule_id);
899: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id);
900: p_header_rec.payment_term_id(p_index) := nvl(p_header_rec.payment_term_id(p_index)
901: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).payment_term_id);
902: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
903: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).accounting_rule_id);
904: p_header_rec.invoicing_rule_id(p_index) := nvl(p_header_rec.invoicing_rule_id(p_index)
905: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).invoicing_rule_id);
906:
907: -- Invalid agreement - error message populated during validation
901: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).payment_term_id);
902: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
903: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).accounting_rule_id);
904: p_header_rec.invoicing_rule_id(p_index) := nvl(p_header_rec.invoicing_rule_id(p_index)
905: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).invoicing_rule_id);
906:
907: -- Invalid agreement - error message populated during validation
908: EXCEPTION
909: WHEN NO_DATA_FOUND THEN
929: THEN
930:
931: BEGIN
932:
933: l_c_index := OE_Bulk_Cache.Load_Ship_To
934: (p_key => p_header_rec.ship_to_org_id(p_index)
935: ,p_default_attributes => 'Y');
936:
937: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
934: (p_key => p_header_rec.ship_to_org_id(p_index)
935: ,p_default_attributes => 'Y');
936:
937: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
938: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).fob_point_code);
939: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
940: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).freight_terms_code);
941: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
942: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).demand_class_code);
936:
937: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
938: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).fob_point_code);
939: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
940: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).freight_terms_code);
941: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
942: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).demand_class_code);
943: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
944: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).shipping_method_code);
938: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).fob_point_code);
939: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
940: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).freight_terms_code);
941: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
942: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).demand_class_code);
943: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
944: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).shipping_method_code);
945: p_header_rec.ship_tolerance_above(p_index) := nvl(p_header_rec.ship_tolerance_above(p_index)
946: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_above);
940: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).freight_terms_code);
941: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
942: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).demand_class_code);
943: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
944: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).shipping_method_code);
945: p_header_rec.ship_tolerance_above(p_index) := nvl(p_header_rec.ship_tolerance_above(p_index)
946: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_above);
947: p_header_rec.ship_tolerance_below(p_index) := nvl(p_header_rec.ship_tolerance_below(p_index)
948: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_below);
942: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).demand_class_code);
943: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
944: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).shipping_method_code);
945: p_header_rec.ship_tolerance_above(p_index) := nvl(p_header_rec.ship_tolerance_above(p_index)
946: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_above);
947: p_header_rec.ship_tolerance_below(p_index) := nvl(p_header_rec.ship_tolerance_below(p_index)
948: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_below);
949: p_header_rec.latest_schedule_limit(p_index) := nvl(p_header_rec.latest_schedule_limit(p_index)
950: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).latest_schedule_limit);
944: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).shipping_method_code);
945: p_header_rec.ship_tolerance_above(p_index) := nvl(p_header_rec.ship_tolerance_above(p_index)
946: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_above);
947: p_header_rec.ship_tolerance_below(p_index) := nvl(p_header_rec.ship_tolerance_below(p_index)
948: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_below);
949: p_header_rec.latest_schedule_limit(p_index) := nvl(p_header_rec.latest_schedule_limit(p_index)
950: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).latest_schedule_limit);
951: p_header_rec.order_date_type_code(p_index) := nvl(p_header_rec.order_date_type_code(p_index)
952: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).order_date_type_code);
946: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_above);
947: p_header_rec.ship_tolerance_below(p_index) := nvl(p_header_rec.ship_tolerance_below(p_index)
948: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_below);
949: p_header_rec.latest_schedule_limit(p_index) := nvl(p_header_rec.latest_schedule_limit(p_index)
950: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).latest_schedule_limit);
951: p_header_rec.order_date_type_code(p_index) := nvl(p_header_rec.order_date_type_code(p_index)
952: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).order_date_type_code);
953:
954: -- Invalid ship to - error message populated during validation
948: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).ship_tolerance_below);
949: p_header_rec.latest_schedule_limit(p_index) := nvl(p_header_rec.latest_schedule_limit(p_index)
950: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).latest_schedule_limit);
951: p_header_rec.order_date_type_code(p_index) := nvl(p_header_rec.order_date_type_code(p_index)
952: ,OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).order_date_type_code);
953:
954: -- Invalid ship to - error message populated during validation
955: EXCEPTION
956: WHEN NO_DATA_FOUND THEN
970: THEN
971:
972: BEGIN
973:
974: l_c_index := OE_Bulk_Cache.Load_Invoice_To
975: (p_key => p_header_rec.invoice_to_org_id(p_index)
976: ,p_default_attributes => 'Y');
977:
978: p_header_rec.price_list_id(p_index) := nvl(p_header_rec.price_list_id(p_index)
975: (p_key => p_header_rec.invoice_to_org_id(p_index)
976: ,p_default_attributes => 'Y');
977:
978: p_header_rec.price_list_id(p_index) := nvl(p_header_rec.price_list_id(p_index)
979: ,OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).price_list_id);
980: p_header_rec.payment_term_id(p_index) := nvl(p_header_rec.payment_term_id(p_index)
981: ,OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).payment_term_id);
982:
983: -- Invalid invoice to - error message populated during validation
977:
978: p_header_rec.price_list_id(p_index) := nvl(p_header_rec.price_list_id(p_index)
979: ,OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).price_list_id);
980: p_header_rec.payment_term_id(p_index) := nvl(p_header_rec.payment_term_id(p_index)
981: ,OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).payment_term_id);
982:
983: -- Invalid invoice to - error message populated during validation
984: EXCEPTION
985: WHEN NO_DATA_FOUND THEN
1003: THEN
1004:
1005: BEGIN
1006:
1007: l_c_index := OE_Bulk_Cache.Load_Order_Type
1008: (p_key => p_header_rec.order_type_id(p_index)
1009: ,p_default_attributes => 'Y');
1010:
1011: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
1008: (p_key => p_header_rec.order_type_id(p_index)
1009: ,p_default_attributes => 'Y');
1010:
1011: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
1012: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).accounting_rule_id);
1013: p_header_rec.invoicing_rule_id(p_index) := nvl(p_header_rec.invoicing_rule_id(p_index)
1014: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).invoicing_rule_id);
1015: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
1016: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).fob_point_code);
1010:
1011: p_header_rec.accounting_rule_id(p_index) := nvl(p_header_rec.accounting_rule_id(p_index)
1012: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).accounting_rule_id);
1013: p_header_rec.invoicing_rule_id(p_index) := nvl(p_header_rec.invoicing_rule_id(p_index)
1014: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).invoicing_rule_id);
1015: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
1016: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).fob_point_code);
1017: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
1018: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).freight_terms_code);
1012: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).accounting_rule_id);
1013: p_header_rec.invoicing_rule_id(p_index) := nvl(p_header_rec.invoicing_rule_id(p_index)
1014: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).invoicing_rule_id);
1015: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
1016: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).fob_point_code);
1017: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
1018: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).freight_terms_code);
1019: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
1020: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).demand_class_code);
1014: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).invoicing_rule_id);
1015: p_header_rec.fob_point_code(p_index) := nvl(p_header_rec.fob_point_code(p_index)
1016: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).fob_point_code);
1017: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
1018: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).freight_terms_code);
1019: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
1020: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).demand_class_code);
1021: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
1022: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipping_method_code);
1016: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).fob_point_code);
1017: p_header_rec.freight_terms_code(p_index) := nvl(p_header_rec.freight_terms_code(p_index)
1018: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).freight_terms_code);
1019: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
1020: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).demand_class_code);
1021: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
1022: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipping_method_code);
1023: p_header_rec.shipment_priority_code(p_index) := nvl(p_header_rec.shipment_priority_code(p_index)
1024: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipment_priority_code);
1018: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).freight_terms_code);
1019: p_header_rec.demand_class_code(p_index) := nvl(p_header_rec.demand_class_code(p_index)
1020: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).demand_class_code);
1021: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
1022: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipping_method_code);
1023: p_header_rec.shipment_priority_code(p_index) := nvl(p_header_rec.shipment_priority_code(p_index)
1024: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipment_priority_code);
1025: p_header_rec.conversion_type_code(p_index) := nvl(p_header_rec.conversion_type_code(p_index)
1026: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).conversion_type_code);
1020: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).demand_class_code);
1021: p_header_rec.shipping_method_code(p_index) := nvl(p_header_rec.shipping_method_code(p_index)
1022: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipping_method_code);
1023: p_header_rec.shipment_priority_code(p_index) := nvl(p_header_rec.shipment_priority_code(p_index)
1024: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipment_priority_code);
1025: p_header_rec.conversion_type_code(p_index) := nvl(p_header_rec.conversion_type_code(p_index)
1026: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).conversion_type_code);
1027:
1028: -- Invalid order type - error message populated during validation
1022: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipping_method_code);
1023: p_header_rec.shipment_priority_code(p_index) := nvl(p_header_rec.shipment_priority_code(p_index)
1024: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).shipment_priority_code);
1025: p_header_rec.conversion_type_code(p_index) := nvl(p_header_rec.conversion_type_code(p_index)
1026: ,OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).conversion_type_code);
1027:
1028: -- Invalid order type - error message populated during validation
1029: EXCEPTION
1030: WHEN NO_DATA_FOUND THEN
1081: -- (Refer OEBVIMNB.pls)
1082:
1083: BEGIN
1084:
1085: l_c_index := OE_Bulk_Cache.Load_Order_Type
1086: (p_key => p_header_rec.order_type_id(p_index));
1087:
1088: IF OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).order_category_code
1089: = 'RETURN'
1084:
1085: l_c_index := OE_Bulk_Cache.Load_Order_Type
1086: (p_key => p_header_rec.order_type_id(p_index));
1087:
1088: IF OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).order_category_code
1089: = 'RETURN'
1090: THEN
1091: FND_MESSAGE.SET_NAME('ONT','OE_BULK_NOT_SUPP_RETURN');
1092: oe_bulk_msg_pub.Add('Y', 'ERROR');
1091: FND_MESSAGE.SET_NAME('ONT','OE_BULK_NOT_SUPP_RETURN');
1092: oe_bulk_msg_pub.Add('Y', 'ERROR');
1093: x_return_status := FND_API.G_RET_STS_ERROR;
1094: ELSE
1095: p_header_rec.order_category_code(p_index) := OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).order_category_code;
1096: END IF;
1097:
1098: -- Invalid order type - error message populated during validation
1099: EXCEPTION
1222: l_c_index NUMBER;
1223: BEGIN
1224:
1225: -- Load agreement in the cache
1226: l_c_index := OE_Bulk_Cache.Load_Agreement(p_agreement_id);
1227:
1228: -- Verify that agreement is effective for the valid dates
1229: IF NOT trunc(nvl(p_pricing_date,sysdate))
1230: BETWEEN trunc(nvl(OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).start_date_active
1226: l_c_index := OE_Bulk_Cache.Load_Agreement(p_agreement_id);
1227:
1228: -- Verify that agreement is effective for the valid dates
1229: IF NOT trunc(nvl(p_pricing_date,sysdate))
1230: BETWEEN trunc(nvl(OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).start_date_active
1231: ,add_months(sysdate,-10000)))
1232: AND trunc(nvl(OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).end_date_active
1233: ,add_months(sysdate,+10000)))
1234: THEN
1228: -- Verify that agreement is effective for the valid dates
1229: IF NOT trunc(nvl(p_pricing_date,sysdate))
1230: BETWEEN trunc(nvl(OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).start_date_active
1231: ,add_months(sysdate,-10000)))
1232: AND trunc(nvl(OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).end_date_active
1233: ,add_months(sysdate,+10000)))
1234: THEN
1235:
1236: fnd_message.set_name('ONT', 'ONT_INVALID_AGREEMENT');
1234: THEN
1235:
1236: fnd_message.set_name('ONT', 'ONT_INVALID_AGREEMENT');
1237: fnd_message.set_Token('AGREEMENT_NAME',
1238: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1239: fnd_message.set_Token('REVISION',
1240: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).revision);
1241: oe_bulk_msg_pub.Add('Y', 'ERROR');
1242:
1236: fnd_message.set_name('ONT', 'ONT_INVALID_AGREEMENT');
1237: fnd_message.set_Token('AGREEMENT_NAME',
1238: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1239: fnd_message.set_Token('REVISION',
1240: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).revision);
1241: oe_bulk_msg_pub.Add('Y', 'ERROR');
1242:
1243: RETURN FALSE;
1244:
1248: IF p_price_list_id IS NOT NULL
1249: AND Get_Price_List_Type(p_price_list_id) <> 'PRL'
1250: THEN
1251:
1252: IF (OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id
1253: <> p_price_list_id) THEN
1254:
1255: fnd_message.set_name('ONT', 'OE_INVALID_AGREEMENT_PLIST');
1256: fnd_message.set_Token('AGREEMENT_NAME',
1253: <> p_price_list_id) THEN
1254:
1255: fnd_message.set_name('ONT', 'OE_INVALID_AGREEMENT_PLIST');
1256: fnd_message.set_Token('AGREEMENT_NAME',
1257: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1258: fnd_message.set_Token('PRICE_LIST1',
1259: OE_Bulk_Cache.G_PRICE_LIST_TBL(p_price_list_id).name);
1260: fnd_message.set_Token('PRICE_LIST2',
1261: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id);
1255: fnd_message.set_name('ONT', 'OE_INVALID_AGREEMENT_PLIST');
1256: fnd_message.set_Token('AGREEMENT_NAME',
1257: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1258: fnd_message.set_Token('PRICE_LIST1',
1259: OE_Bulk_Cache.G_PRICE_LIST_TBL(p_price_list_id).name);
1260: fnd_message.set_Token('PRICE_LIST2',
1261: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id);
1262: oe_bulk_msg_pub.Add('Y', 'ERROR');
1263:
1257: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1258: fnd_message.set_Token('PRICE_LIST1',
1259: OE_Bulk_Cache.G_PRICE_LIST_TBL(p_price_list_id).name);
1260: fnd_message.set_Token('PRICE_LIST2',
1261: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).price_list_id);
1262: oe_bulk_msg_pub.Add('Y', 'ERROR');
1263:
1264: RETURN FALSE;
1265:
1269:
1270: -- Verify that customer on agreement matches the customer on order or
1271: -- is a related customer if customer relationships is ON.
1272: --Bug 9496609
1273: IF OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id is not null
1274: and OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id <> -1 then
1275: IF NOT OE_GLOBALS.EQUAL
1276: (OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id
1277: ,p_sold_to_org_id)
1270: -- Verify that customer on agreement matches the customer on order or
1271: -- is a related customer if customer relationships is ON.
1272: --Bug 9496609
1273: IF OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id is not null
1274: and OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id <> -1 then
1275: IF NOT OE_GLOBALS.EQUAL
1276: (OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id
1277: ,p_sold_to_org_id)
1278: THEN
1272: --Bug 9496609
1273: IF OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id is not null
1274: and OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id <> -1 then
1275: IF NOT OE_GLOBALS.EQUAL
1276: (OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id
1277: ,p_sold_to_org_id)
1278: THEN
1279:
1280: IF OE_Bulk_Order_Pvt.G_CUST_RELATIONS = 'N'
1279:
1280: IF OE_Bulk_Order_Pvt.G_CUST_RELATIONS = 'N'
1281: OR (OE_Bulk_Order_Pvt.G_CUST_RELATIONS = 'Y'
1282: AND NOT Is_Related_Customer(p_sold_to_org_id
1283: ,OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id))
1284: THEN
1285:
1286: fnd_message.set_name('ONT', 'OE_INVALID_AGREEMENT');
1287: fnd_message.set_Token('AGREEMENT_ID',p_agreement_id);
1285:
1286: fnd_message.set_name('ONT', 'OE_INVALID_AGREEMENT');
1287: fnd_message.set_Token('AGREEMENT_ID',p_agreement_id);
1288: fnd_message.set_Token('AGREEMENT_NAME',
1289: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1290: fnd_message.set_Token('CUSTOMER_ID',
1291: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id);
1292: oe_bulk_msg_pub.Add('Y', 'ERROR');
1293:
1287: fnd_message.set_Token('AGREEMENT_ID',p_agreement_id);
1288: fnd_message.set_Token('AGREEMENT_NAME',
1289: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).name);
1290: fnd_message.set_Token('CUSTOMER_ID',
1291: OE_Bulk_Cache.G_AGREEMENT_TBL(l_c_index).sold_to_org_id);
1292: oe_bulk_msg_pub.Add('Y', 'ERROR');
1293:
1294: RETURN FALSE;
1295:
1335: END IF;
1336:
1337: -- Cache price list
1338:
1339: l_c_index := OE_Bulk_Cache.Load_Price_List(p_price_list_id);
1340:
1341: -- Verify that price list is effective for the valid dates
1342:
1343: IF NOT trunc(nvl(p_pricing_date,sysdate))
1340:
1341: -- Verify that price list is effective for the valid dates
1342:
1343: IF NOT trunc(nvl(p_pricing_date,sysdate))
1344: BETWEEN trunc(nvl(OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).start_date_active
1345: ,add_months(sysdate,-10000)))
1346: AND trunc(nvl(OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).end_date_active
1347: ,add_months(sysdate,+10000)))
1348: THEN
1342:
1343: IF NOT trunc(nvl(p_pricing_date,sysdate))
1344: BETWEEN trunc(nvl(OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).start_date_active
1345: ,add_months(sysdate,-10000)))
1346: AND trunc(nvl(OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).end_date_active
1347: ,add_months(sysdate,+10000)))
1348: THEN
1349:
1350: fnd_message.set_name('ONT', 'OE_INVALID_NONAGR_PLIST');
1366: IF l_validate_result = 'N' THEN
1367:
1368: FND_MESSAGE.SET_NAME('ONT','OE_CURRENCY_MISMATCH');
1369: FND_MESSAGE.SET_TOKEN('LINE_CURR_CODE',
1370: OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).currency_code);
1371: FND_MESSAGE.SET_TOKEN('PRICE_LIST_NAME',
1372: OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).name);
1373: FND_MESSAGE.SET_TOKEN('HEADER_CURR_CODE',p_curr_code);
1374: oe_bulk_msg_pub.Add('Y', 'ERROR');
1368: FND_MESSAGE.SET_NAME('ONT','OE_CURRENCY_MISMATCH');
1369: FND_MESSAGE.SET_TOKEN('LINE_CURR_CODE',
1370: OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).currency_code);
1371: FND_MESSAGE.SET_TOKEN('PRICE_LIST_NAME',
1372: OE_Bulk_Cache.G_PRICE_LIST_TBL(l_c_index).name);
1373: FND_MESSAGE.SET_TOKEN('HEADER_CURR_CODE',p_curr_code);
1374: oe_bulk_msg_pub.Add('Y', 'ERROR');
1375:
1376: RETURN FALSE;
1408: -- If customer relationships = 'Y', it will also check if ship
1409: -- to customer is a related customer and if not, return FALSE.
1410: --
1411:
1412: l_c_index := OE_Bulk_Cache.Load_Ship_To
1413: (p_key => p_ship_to);
1414:
1415: IF OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).customer_id
1416: = p_sold_to
1411:
1412: l_c_index := OE_Bulk_Cache.Load_Ship_To
1413: (p_key => p_ship_to);
1414:
1415: IF OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).customer_id
1416: = p_sold_to
1417: THEN
1418: RETURN TRUE;
1419: END IF;
1427: SELECT 'VALID'
1428: INTO l_dummy
1429: FROM HZ_CUST_ACCT_RELATE
1430: WHERE RELATED_CUST_ACCOUNT_ID = p_sold_to
1431: AND CUST_ACCOUNT_ID = OE_Bulk_Cache.G_SHIP_TO_TBL(l_c_index).customer_id
1432: AND ship_to_flag = 'Y' AND STATUS='A';
1433:
1434: END IF;
1435:
1458: --
1459: --
1460: --
1461:
1462: l_c_index := OE_Bulk_Cache.Load_Sold_to_site
1463: (p_key => p_sold_to_site_use_id);
1464:
1465: IF OE_Bulk_Cache.G_SOLD_TO_SITE_TBL(l_c_index).customer_id
1466: = p_sold_to
1461:
1462: l_c_index := OE_Bulk_Cache.Load_Sold_to_site
1463: (p_key => p_sold_to_site_use_id);
1464:
1465: IF OE_Bulk_Cache.G_SOLD_TO_SITE_TBL(l_c_index).customer_id
1466: = p_sold_to
1467: THEN
1468: RETURN TRUE;
1469: ELSE
1499: -- If customer relationships = 'Y', it will also check if invoice
1500: -- to customer is a related customer and if not, return FALSE.
1501: --
1502:
1503: l_c_index := OE_Bulk_Cache.Load_Invoice_To
1504: (p_key => p_bill_to);
1505:
1506: IF OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).customer_id
1507: = p_sold_to
1502:
1503: l_c_index := OE_Bulk_Cache.Load_Invoice_To
1504: (p_key => p_bill_to);
1505:
1506: IF OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).customer_id
1507: = p_sold_to
1508: THEN
1509: RETURN TRUE;
1510: END IF;
1518: SELECT 'VALID'
1519: INTO l_dummy
1520: FROM HZ_CUST_ACCT_RELATE
1521: WHERE RELATED_CUST_ACCOUNT_ID = p_sold_to
1522: AND CUST_ACCOUNT_ID = OE_Bulk_Cache.G_INVOICE_TO_TBL(l_c_index).customer_id
1523: AND bill_to_flag = 'Y' AND STATUS='A';
1524:
1525: END IF;
1526:
1793: -- Do other order type related validations
1794:
1795: -- Cache order type, if order type is not valid caching will fail
1796: -- with no data found error.
1797: l_c_index := OE_Bulk_Cache.Load_Order_Type
1798: (p_key => l_order_type_id);
1799:
1800: -- Check if Order Type is valid for ordered date
1801:
1800: -- Check if Order Type is valid for ordered date
1801:
1802: IF p_header_rec.ordered_date(i) IS NOT NULL
1803: AND NOT (p_header_rec.ordered_date(i) BETWEEN
1804: nvl(OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_id).start_date_active,sysdate)
1805: AND nvl(OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_id).end_date_active,sysdate))
1806: THEN
1807: p_header_rec.lock_control(i) := -99;
1808: FND_MESSAGE.SET_NAME('ONT','OE_INVALID_ATTRIBUTE');
1801:
1802: IF p_header_rec.ordered_date(i) IS NOT NULL
1803: AND NOT (p_header_rec.ordered_date(i) BETWEEN
1804: nvl(OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_id).start_date_active,sysdate)
1805: AND nvl(OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_order_type_id).end_date_active,sysdate))
1806: THEN
1807: p_header_rec.lock_control(i) := -99;
1808: FND_MESSAGE.SET_NAME('ONT','OE_INVALID_ATTRIBUTE');
1809: FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
1824: -- Populate order type name, this is denormalized onto header
1825: -- record as it will be used in insert into mtl_sales_orders
1826:
1827: p_header_rec.order_type_name(i) :=
1828: OE_Bulk_Cache.G_ORDER_TYPE_TBL(l_c_index).NAME;
1829:
1830: ELSE
1831: p_header_rec.lock_control(i) := -99;
1832: FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
2631: x_header_scredit_rec.header_id.extend(1);
2632: x_header_scredit_rec.salesrep_id.extend(1);
2633: x_header_scredit_rec.sales_credit_type_id.extend(1);
2634:
2635: l_c_index := OE_Bulk_Cache.Load_Salesrep
2636: (p_key => p_header_rec.salesrep_id(i));
2637:
2638: x_header_scredit_rec.header_id(l_scredit_index)
2639: := p_header_rec.header_id(i);
2639: := p_header_rec.header_id(i);
2640: x_header_scredit_rec.salesrep_id(l_scredit_index)
2641: := p_header_rec.salesrep_id(i);
2642: x_header_scredit_rec.sales_credit_type_id(l_scredit_index)
2643: := OE_Bulk_Cache.G_SALESREP_TBL(l_c_index).sales_credit_type_id;
2644:
2645: l_scredit_index := l_scredit_index + 1;
2646:
2647: END IF;
2654: AND p_header_rec.booked_flag(i) = 'Y'
2655: AND nvl(p_header_rec.lock_control(i),0) <> -99
2656: THEN
2657:
2658: l_c_index := OE_Bulk_Cache.Load_Sold_To
2659: (p_key => p_header_rec.sold_to_org_id(i)
2660: ,p_edi_attributes => 'Y'
2661: );
2662:
2659: (p_key => p_header_rec.sold_to_org_id(i)
2660: ,p_edi_attributes => 'Y'
2661: );
2662:
2663: IF OE_Bulk_Cache.G_SOLD_TO_TBL(l_c_index).tp_setup THEN
2664:
2665: OE_Bulk_Order_Pvt.G_ACK_NEEDED := 'Y';
2666: p_header_rec.first_ack_code(i) := 'X';
2667:
2668: -- Cache EDI attributes as these will be used in creating
2669: -- the acknowledgment records later.
2670:
2671: IF p_header_rec.invoice_to_org_id(i) IS NOT NULL THEN
2672: l_c_index := OE_Bulk_Cache.Load_Invoice_To
2673: (p_key => p_header_rec.invoice_to_org_id(i)
2674: ,p_edi_attributes => 'Y'
2675: );
2676: END IF;
2675: );
2676: END IF;
2677:
2678: IF p_header_rec.ship_to_org_id(i) IS NOT NULL THEN
2679: l_c_index := OE_Bulk_Cache.Load_Ship_To
2680: (p_key => p_header_rec.ship_to_org_id(i)
2681: ,p_edi_attributes => 'Y'
2682: );
2683: END IF;
2682: );
2683: END IF;
2684:
2685: IF p_header_rec.ship_from_org_id(i) IS NOT NULL THEN
2686: l_c_index := OE_Bulk_Cache.Load_Ship_From
2687: (p_key => p_header_rec.ship_from_org_id(i)
2688: );
2689: END IF;
2690:
2690:
2691: -- added for end customer changes(bug 5054618)
2692:
2693: IF p_header_rec.end_customer_id(i) IS NOT NULL THEN
2694: l_c_index := OE_Bulk_Cache.Load_End_customer
2695: (p_key => p_header_rec.end_customer_id(i)
2696: ,p_edi_attributes => 'Y'
2697: );
2698: END IF;
2697: );
2698: END IF;
2699:
2700: IF p_header_rec.End_customer_site_use_id(i) IS NOT NULL THEN
2701: l_c_index := OE_Bulk_Cache.Load_end_customer_site
2702: (p_key => p_header_rec.end_customer_site_use_id(i)
2703: ,p_edi_attributes => 'Y'
2704: );
2705: END IF;