22: l_line_type_rec OE_Order_Cache.Line_Type_Rec_Type;
23: l_item_type_code VARCHAR2(30);
24: BEGIN
25:
26: OE_DEBUG_PUB.Add('Entering OE_CNCL_VALIDATE_LINE.Check_Book_Reqd_Attributes',1);
27: -- Check for fields required on a booked order line
28:
29: IF p_line_rec.sold_to_org_id IS NULL THEN
30: x_return_status := FND_API.G_RET_STS_ERROR;
182: -- (i.e. Tax_exempt_flag = 'R'-Required.)
183: -- 2. The calculate tax flag on customer transaction type for this line
184: -- type is set to Yes.
185:
186: oe_debug_pub.add('calc tax flag 2 : ' || l_line_type_rec.calculate_tax_flag );
187:
188: l_line_type_rec := OE_Order_Cache.Load_Line_Type(p_line_rec.line_type_id);
189:
190: -- fix for bug 1701388 - commented the following code
243: OE_MSG_PUB.ADD;
244: END IF;
245: END IF;
246:
247: OE_DEBUG_PUB.Add('Entering OE_CNCL_VALIDATE_LINE.Check_Book_Reqd_Attributes',1);
248:
249: EXCEPTION
250: WHEN OTHERS THEN
251: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
290: l_validated_quantity NUMBER;
291: l_primary_quantity NUMBER;
292: l_qty_return_status VARCHAR2(1);
293: BEGIN
294: OE_DEBUG_PUB.Add('Entering OE_CNCL_VALIDATE_LINE.Validate_Decimal_Quantity',1);
295: -- validate input quantity
296: IF (p_input_quantity is not null AND
297: p_input_quantity <> FND_API.G_MISS_NUM) THEN
298:
296: IF (p_input_quantity is not null AND
297: p_input_quantity <> FND_API.G_MISS_NUM) THEN
298:
299: IF trunc(p_input_quantity) <> p_input_quantity THEN
300: oe_debug_pub.add('input quantity is decimal',2);
301:
302: IF p_item_type_code is not NULL THEN
303:
304: IF p_item_type_code IN ('MODEL', 'OPTION', 'KIT',
302: IF p_item_type_code is not NULL THEN
303:
304: IF p_item_type_code IN ('MODEL', 'OPTION', 'KIT',
305: 'CLASS','INCLUDED', 'CONFIG') THEN
306: oe_debug_pub.add('item is config related with decimal qty',2);
307: FND_MESSAGE.SET_NAME('ONT', 'OE_CONFIG_NO_DECIMALS');
308: OE_MSG_PUB.Add;
309: x_return_status := FND_API.G_RET_STS_ERROR;
310:
309: x_return_status := FND_API.G_RET_STS_ERROR;
310:
311: ELSE
312:
313: oe_debug_pub.add('before calling inv decimals api',2);
314: inv_decimals_pub.validate_quantity(
315: p_item_id => p_item_id,
316: p_organization_id =>
317: OE_Sys_Parameters.VALUE('MASTER_ORGANIZATION_ID'),
321: x_primary_quantity => l_primary_quantity,
322: x_return_status => l_qty_return_status);
323:
324: IF l_qty_return_status = 'W' or l_qty_return_status = 'E' THEN
325: oe_debug_pub.add('inv decimal api return ' || l_qty_return_status,2);
326: oe_debug_pub.add('input_qty ' || p_input_quantity,2);
327: oe_debug_pub.add('l_pri_qty ' || l_primary_quantity,2);
328: oe_debug_pub.add('l_val_qty ' || l_validated_quantity,2);
329: /* bug 2926436 */
322: x_return_status => l_qty_return_status);
323:
324: IF l_qty_return_status = 'W' or l_qty_return_status = 'E' THEN
325: oe_debug_pub.add('inv decimal api return ' || l_qty_return_status,2);
326: oe_debug_pub.add('input_qty ' || p_input_quantity,2);
327: oe_debug_pub.add('l_pri_qty ' || l_primary_quantity,2);
328: oe_debug_pub.add('l_val_qty ' || l_validated_quantity,2);
329: /* bug 2926436 */
330: IF l_qty_return_status = 'W' THEN
323:
324: IF l_qty_return_status = 'W' or l_qty_return_status = 'E' THEN
325: oe_debug_pub.add('inv decimal api return ' || l_qty_return_status,2);
326: oe_debug_pub.add('input_qty ' || p_input_quantity,2);
327: oe_debug_pub.add('l_pri_qty ' || l_primary_quantity,2);
328: oe_debug_pub.add('l_val_qty ' || l_validated_quantity,2);
329: /* bug 2926436 */
330: IF l_qty_return_status = 'W' THEN
331: fnd_message.set_name('ONT', 'OE_DECIMAL_MAX_PRECISION');
324: IF l_qty_return_status = 'W' or l_qty_return_status = 'E' THEN
325: oe_debug_pub.add('inv decimal api return ' || l_qty_return_status,2);
326: oe_debug_pub.add('input_qty ' || p_input_quantity,2);
327: oe_debug_pub.add('l_pri_qty ' || l_primary_quantity,2);
328: oe_debug_pub.add('l_val_qty ' || l_validated_quantity,2);
329: /* bug 2926436 */
330: IF l_qty_return_status = 'W' THEN
331: fnd_message.set_name('ONT', 'OE_DECIMAL_MAX_PRECISION');
332: END IF;
340: END IF; -- item_type_code is null
341: END IF; -- if not decimal qty
342: END IF; -- quantity is null
343:
344: OE_DEBUG_PUB.Add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Decimal_Quantity',1);
345: END Validate_Decimal_Quantity;
346:
347:
348: Procedure Validate_Line_Type(p_line_rec IN oe_order_pub.line_rec_type)
381:
382:
383: BEGIN
384:
385: OE_DEBUG_PUB.Add('Entering OE_CNCL_VALIDATE_LINE.Validate_Line_Type',1);
386:
387: IF p_line_rec.ITEM_TYPE_CODE = OE_GLOBALS.G_ITEM_CONFIG THEN
388:
389: l_new_wf_item_type := OE_Order_WF_Util.get_wf_item_type(p_line_rec);
398: INTO lexists;
399: CLOSE find_config_assign;
400:
401: IF lexists IS NULL THEN
402: oe_debug_pub.add('No explicit assignment exists',2);
403: FND_MESSAGE.SET_NAME('ONT','OE_EXP_ASSIGN_REQ');
404: OE_MSG_PUB.ADD;
405: RAISE FND_API.G_EXC_ERROR;
406: END IF;
406: END IF;
407:
408: END IF;
409:
410: OE_DEBUG_PUB.Add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Line_Type',1);
411: EXCEPTION
412: WHEN NO_DATA_FOUND THEN
413: FND_MESSAGE.SET_NAME('ONT','OE_FLOW_CNT_CHANGE');
414: OE_MSG_PUB.ADD;
437: IS
438: l_validate VARCHAR2(1) := 'Y';
439: l_dummy VARCHAR2(10);
440: BEGIN
441: OE_DEBUG_PUB.Add('Entering OE_CNCL_VALIDATE_LINE.Validate_Receiving_Org',1);
442: SELECT null
443: INTO l_dummy
444: FROM mtl_system_items msi,
445: org_organization_definitions org
449: AND org.set_of_books_id= ( SELECT fsp.set_of_books_id
450: FROM financials_system_parameters fsp)
451: AND ROWNUM=1 ;
452:
453: OE_DEBUG_PUB.Add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Receiving_Org',1);
454: RETURN TRUE;
455: EXCEPTION
456: WHEN NO_DATA_FOUND THEN
457: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ITEM_WHSE');
473: IS
474: l_validate VARCHAR2(1) := 'Y';
475: l_dummy VARCHAR2(10);
476: BEGIN
477: oe_debug_pub.add('Entering Validate_Item_Warehouse',1);
478: -- The customer_order_enabled_flag for config item
479: -- is set to 'N'
480:
481: IF p_item_type_code = OE_GLOBALS.G_ITEM_INCLUDED OR
502: AND org.organization_id= msi.organization_id
503: AND org.organization_id= p_ship_from_org_id
504: AND rownum=1;
505: END IF;
506: oe_debug_pub.add('Exiting Validate_Item_Warehouse',1);
507: RETURN TRUE;
508:
509: EXCEPTION
510: WHEN NO_DATA_FOUND THEN
507: RETURN TRUE;
508:
509: EXCEPTION
510: WHEN NO_DATA_FOUND THEN
511: oe_debug_pub.add('RR: No data found',1);
512:
513: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ITEM_WHSE');
514: OE_MSG_PUB.add;
515: RETURN FALSE;
514: OE_MSG_PUB.add;
515: RETURN FALSE;
516:
517: WHEN OTHERS THEN
518: oe_debug_pub.add('RR: OTHERS',1);
519: FND_MESSAGE.SET_NAME('ONT', 'OE_INVALID_ITEM_WHSE');
520: OE_MSG_PUB.add;
521: RETURN FALSE;
522:
529: IS
530: l_dummy VARCHAR2(10);
531: BEGIN
532:
533: oe_debug_pub.add('Entering Validate_Task',1);
534: SELECT 'VALID'
535: INTO l_dummy
536: FROM mtl_task_v
537: WHERE project_id = p_project_id
536: FROM mtl_task_v
537: WHERE project_id = p_project_id
538: AND task_id = p_task_id;
539:
540: oe_debug_pub.add('Exiting Validate_Task',1);
541: RETURN TRUE;
542:
543: EXCEPTION
544:
553: RETURN BOOLEAN
554: IS
555: l_project_control_level NUMBER;
556: BEGIN
557: oe_debug_pub.add('Entering Validate_task_reqd',1);
558:
559: -- If project control level in MTL_PARAMETERS for the warehouse
560: -- is set to 'Task', then project references on the order must
561: -- consist of both Project and Task.
566: WHERE ORGANIZATION_ID = p_ship_from_org_id;
567:
568: IF l_project_control_level = 2 -- control level is 'Task'
569: THEN
570: oe_debug_pub.add('Exiting Validate_task_reqd',1);
571: RETURN TRUE;
572: ELSE
573: oe_debug_pub.add('Exiting Validate_task_reqd',1);
574: RETURN FALSE;
569: THEN
570: oe_debug_pub.add('Exiting Validate_task_reqd',1);
571: RETURN TRUE;
572: ELSE
573: oe_debug_pub.add('Exiting Validate_task_reqd',1);
574: RETURN FALSE;
575: END IF;
576:
577: EXCEPTION
590: RETURN BOOLEAN
591: IS
592: l_dummy VARCHAR2(10);
593: BEGIN
594: oe_debug_pub.add('Entering Validate_Item_Fields',1);
595: oe_debug_pub.add('p_inventory_item_id: '||p_inventory_item_id);
596: oe_debug_pub.add('p_ordered_item_id: '||p_ordered_item_id);
597: oe_debug_pub.add('p_item_identifier_type: '||p_item_identifier_type);
598: oe_debug_pub.add('p_ordered_item: '||p_ordered_item);
591: IS
592: l_dummy VARCHAR2(10);
593: BEGIN
594: oe_debug_pub.add('Entering Validate_Item_Fields',1);
595: oe_debug_pub.add('p_inventory_item_id: '||p_inventory_item_id);
596: oe_debug_pub.add('p_ordered_item_id: '||p_ordered_item_id);
597: oe_debug_pub.add('p_item_identifier_type: '||p_item_identifier_type);
598: oe_debug_pub.add('p_ordered_item: '||p_ordered_item);
599: oe_debug_pub.add('p_sold_to_org_id: '||p_sold_to_org_id);
592: l_dummy VARCHAR2(10);
593: BEGIN
594: oe_debug_pub.add('Entering Validate_Item_Fields',1);
595: oe_debug_pub.add('p_inventory_item_id: '||p_inventory_item_id);
596: oe_debug_pub.add('p_ordered_item_id: '||p_ordered_item_id);
597: oe_debug_pub.add('p_item_identifier_type: '||p_item_identifier_type);
598: oe_debug_pub.add('p_ordered_item: '||p_ordered_item);
599: oe_debug_pub.add('p_sold_to_org_id: '||p_sold_to_org_id);
600: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
593: BEGIN
594: oe_debug_pub.add('Entering Validate_Item_Fields',1);
595: oe_debug_pub.add('p_inventory_item_id: '||p_inventory_item_id);
596: oe_debug_pub.add('p_ordered_item_id: '||p_ordered_item_id);
597: oe_debug_pub.add('p_item_identifier_type: '||p_item_identifier_type);
598: oe_debug_pub.add('p_ordered_item: '||p_ordered_item);
599: oe_debug_pub.add('p_sold_to_org_id: '||p_sold_to_org_id);
600: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
601: SELECT 'valid'
594: oe_debug_pub.add('Entering Validate_Item_Fields',1);
595: oe_debug_pub.add('p_inventory_item_id: '||p_inventory_item_id);
596: oe_debug_pub.add('p_ordered_item_id: '||p_ordered_item_id);
597: oe_debug_pub.add('p_item_identifier_type: '||p_item_identifier_type);
598: oe_debug_pub.add('p_ordered_item: '||p_ordered_item);
599: oe_debug_pub.add('p_sold_to_org_id: '||p_sold_to_org_id);
600: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
601: SELECT 'valid'
602: INTO l_dummy
595: oe_debug_pub.add('p_inventory_item_id: '||p_inventory_item_id);
596: oe_debug_pub.add('p_ordered_item_id: '||p_ordered_item_id);
597: oe_debug_pub.add('p_item_identifier_type: '||p_item_identifier_type);
598: oe_debug_pub.add('p_ordered_item: '||p_ordered_item);
599: oe_debug_pub.add('p_sold_to_org_id: '||p_sold_to_org_id);
600: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
601: SELECT 'valid'
602: INTO l_dummy
603: FROM mtl_system_items_vl
635: AND items.cross_reference = p_ordered_item;
636: END IF;
637: END IF;
638:
639: oe_debug_pub.add('Exiting Validate_Item_Fields',1);
640: RETURN TRUE;
641:
642: EXCEPTION
643: WHEN NO_DATA_FOUND THEN
640: RETURN TRUE;
641:
642: EXCEPTION
643: WHEN NO_DATA_FOUND THEN
644: oe_debug_pub.add('Validate_Item_Fields: No data found',1);
645: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
646: oe_debug_pub.add('Invalid internal item');
647: ELSIF nvl(p_item_identifier_type, 'INT') = 'CUST' THEN
648: oe_debug_pub.add('Invalid Customer Item');
642: EXCEPTION
643: WHEN NO_DATA_FOUND THEN
644: oe_debug_pub.add('Validate_Item_Fields: No data found',1);
645: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
646: oe_debug_pub.add('Invalid internal item');
647: ELSIF nvl(p_item_identifier_type, 'INT') = 'CUST' THEN
648: oe_debug_pub.add('Invalid Customer Item');
649: ELSE
650: oe_debug_pub.add('Invalid Generic Item');
644: oe_debug_pub.add('Validate_Item_Fields: No data found',1);
645: IF nvl(p_item_identifier_type, 'INT') = 'INT' THEN
646: oe_debug_pub.add('Invalid internal item');
647: ELSIF nvl(p_item_identifier_type, 'INT') = 'CUST' THEN
648: oe_debug_pub.add('Invalid Customer Item');
649: ELSE
650: oe_debug_pub.add('Invalid Generic Item');
651: END IF;
652: RETURN FALSE;
646: oe_debug_pub.add('Invalid internal item');
647: ELSIF nvl(p_item_identifier_type, 'INT') = 'CUST' THEN
648: oe_debug_pub.add('Invalid Customer Item');
649: ELSE
650: oe_debug_pub.add('Invalid Generic Item');
651: END IF;
652: RETURN FALSE;
653: WHEN OTHERS THEN
654: oe_debug_pub.add('Validate_Item_Fields: When Others',1);
650: oe_debug_pub.add('Invalid Generic Item');
651: END IF;
652: RETURN FALSE;
653: WHEN OTHERS THEN
654: oe_debug_pub.add('Validate_Item_Fields: When Others',1);
655: RETURN FALSE;
656: END Validate_Item_Fields;
657:
658: FUNCTION Validate_Return_Item_Mismatch
662: IS
663: l_ref_inventory_item_id NUMBER;
664: l_profile VARCHAR2(1);
665: BEGIN
666: oe_debug_pub.add('Entering Validate_Return_Item_Mismatch',1);
667:
668: IF (p_reference_line_id IS NULL) THEN
669: RETURN TRUE;
670: END IF;
691: END IF;
692:
693: END IF;
694:
695: oe_debug_pub.add('Exiting Validate_Return_Item_Mismatch',1);
696: RETURN TRUE;
697:
698: EXCEPTION
699: WHEN NO_DATA_FOUND THEN
696: RETURN TRUE;
697:
698: EXCEPTION
699: WHEN NO_DATA_FOUND THEN
700: oe_debug_pub.add('Validate_Return_Item_Mismatch: No data found',1);
701: RETURN FALSE;
702: WHEN OTHERS THEN
703: oe_debug_pub.add('Validate_Return_Item_Mismatch: When Others',1);
704: RETURN FALSE;
699: WHEN NO_DATA_FOUND THEN
700: oe_debug_pub.add('Validate_Return_Item_Mismatch: No data found',1);
701: RETURN FALSE;
702: WHEN OTHERS THEN
703: oe_debug_pub.add('Validate_Return_Item_Mismatch: When Others',1);
704: RETURN FALSE;
705: END Validate_Return_Item_Mismatch;
706:
707: FUNCTION Validate_Return_Fulfilled_Line
713: l_ref_shipped_quantity NUMBER;
714: l_ref_inv_iface_status VARCHAR2(30);
715: l_profile VARCHAR2(1);
716: BEGIN
717: oe_debug_pub.add('Entering Validate return fulfilled line',1);
718:
719: IF (p_reference_line_id IS NULL) THEN
720: RETURN TRUE;
721: END IF;
761: END IF;
762:
763: END IF;
764:
765: oe_debug_pub.add('Exiting Validate return fulfilled line',1);
766: RETURN TRUE;
767:
768: EXCEPTION
769: WHEN NO_DATA_FOUND THEN
766: RETURN TRUE;
767:
768: EXCEPTION
769: WHEN NO_DATA_FOUND THEN
770: oe_debug_pub.add('Validate_Return_Fulfilled_Line: No data found',1);
771: RETURN FALSE;
772: WHEN OTHERS THEN
773: oe_debug_pub.add('Validate_Return_Fulfilled_Line: When Others',1);
774: RETURN FALSE;
769: WHEN NO_DATA_FOUND THEN
770: oe_debug_pub.add('Validate_Return_Fulfilled_Line: No data found',1);
771: RETURN FALSE;
772: WHEN OTHERS THEN
773: oe_debug_pub.add('Validate_Return_Fulfilled_Line: When Others',1);
774: RETURN FALSE;
775: END Validate_Return_Fulfilled_Line;
776:
777: FUNCTION Validate_Return_Item
780: RETURN BOOLEAN
781: IS
782: l_returnable_flag Varchar2(1);
783: BEGIN
784: oe_debug_pub.add('Entering Validate_Return_Item',1);
785:
786: SELECT nvl(returnable_flag,'Y')
787: INTO l_returnable_flag
788: FROM mtl_system_items
797: RETURN FALSE;
798:
799: EXCEPTION
800: WHEN NO_DATA_FOUND THEN
801: oe_debug_pub.add('Validate_Return_Item: No data found',1);
802: RETURN FALSE;
803: WHEN OTHERS THEN
804: oe_debug_pub.add('Validate_Return_Item: When Others',1);
805: RETURN FALSE;
800: WHEN NO_DATA_FOUND THEN
801: oe_debug_pub.add('Validate_Return_Item: No data found',1);
802: RETURN FALSE;
803: WHEN OTHERS THEN
804: oe_debug_pub.add('Validate_Return_Item: When Others',1);
805: RETURN FALSE;
806: END Validate_Return_Item;
807:
808: FUNCTION Validate_Return_Reference
810: RETURN BOOLEAN
811: IS
812: l_booked_flag Varchar2(1);
813: BEGIN
814: oe_debug_pub.add('Enter Validate_Return_Reference',1);
815:
816: SELECT nvl(booked_flag,'N')
817: INTO l_booked_flag
818: FROM oe_order_lines
825: fnd_message.set_name('ONT', 'OE_RETURN_UNBOOKED_ORDER');
826: OE_MSG_PUB.Add;
827: END IF;
828:
829: oe_debug_pub.add('Exit Validate_Return_Reference',1);
830: RETURN FALSE;
831:
832: EXCEPTION
833: WHEN NO_DATA_FOUND THEN
830: RETURN FALSE;
831:
832: EXCEPTION
833: WHEN NO_DATA_FOUND THEN
834: oe_debug_pub.add('Validate_Return_Reference: No data found',1);
835: fnd_message.set_name('ONT', 'OE_RETURN_INVALID_SO_LINE');
836: OE_MSG_PUB.Add;
837: RETURN FALSE;
838: WHEN OTHERS THEN
835: fnd_message.set_name('ONT', 'OE_RETURN_INVALID_SO_LINE');
836: OE_MSG_PUB.Add;
837: RETURN FALSE;
838: WHEN OTHERS THEN
839: oe_debug_pub.add('Validate_Return_Reference: When Others',1);
840: fnd_message.set_name('ONT', 'OE_RETURN_INVALID_SO_LINE');
841: OE_MSG_PUB.Add;
842: RETURN FALSE;
843: END Validate_Return_Reference;
877: AND ROWNUM = 1;
878:
879: BEGIN
880:
881: oe_debug_pub.add('Entering Validate_ship_to_org',1);
882: oe_debug_pub.add('ship_to_org_id :'||to_char(p_ship_to_org_id),2);
883:
884: --lcustomer_relations := FND_PROFILE.VALUE('ONT_CUSTOMER_RELATIONSHIPS');
885: lcustomer_relations := OE_Sys_Parameters.VALUE('CUSTOMER_RELATIONSHIPS_FLAG');
878:
879: BEGIN
880:
881: oe_debug_pub.add('Entering Validate_ship_to_org',1);
882: oe_debug_pub.add('ship_to_org_id :'||to_char(p_ship_to_org_id),2);
883:
884: --lcustomer_relations := FND_PROFILE.VALUE('ONT_CUSTOMER_RELATIONSHIPS');
885: lcustomer_relations := OE_Sys_Parameters.VALUE('CUSTOMER_RELATIONSHIPS_FLAG');
886:
892: Where customer_id = p_sold_to_org_id
893: AND site_use_id = p_ship_to_org_id
894: AND status = 'A';
895:
896: oe_debug_pub.add('Exiting Validate_ship_to_org',1);
897: RETURN TRUE;
898: ELSIF lcustomer_relations = 'Y' THEN
899:
900: /*Select /*MOAC_SQL_NO_CHANGE 'VALID'
924:
925: /* added the following ELSIF condition to fix the bug 2002486 */
926:
927: ELSIF nvl(lcustomer_relations,'N') = 'A' THEN
928: oe_debug_pub.add
929: ('Cr: A',2);
930:
931: SELECT 'VALID'
932: INTO l_dummy
954: lcustomer_relations varchar2(1);
955:
956: BEGIN
957:
958: oe_debug_pub.add('Entering OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
959: oe_debug_pub.add('deliver_to_org_id :'||to_char(p_deliver_to_org_id),2);
960: lcustomer_relations := OE_Sys_Parameters.VALUE('CUSTOMER_RELATIONSHIPS_FLAG');
961:
962: IF nvl(lcustomer_relations,'N') = 'N' THEN
955:
956: BEGIN
957:
958: oe_debug_pub.add('Entering OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
959: oe_debug_pub.add('deliver_to_org_id :'||to_char(p_deliver_to_org_id),2);
960: lcustomer_relations := OE_Sys_Parameters.VALUE('CUSTOMER_RELATIONSHIPS_FLAG');
961:
962: IF nvl(lcustomer_relations,'N') = 'N' THEN
963: SELECT 'VALID'
966: WHERE customer_id = p_sold_to_org_id
967: AND site_use_id = p_deliver_to_org_id
968: AND status = 'A';
969:
970: oe_debug_pub.add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
971: RETURN TRUE;
972:
973: ELSIF lcustomer_relations = 'Y' THEN
974: oe_debug_pub.add('Cr: Yes Line Deliver',2);
970: oe_debug_pub.add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
971: RETURN TRUE;
972:
973: ELSIF lcustomer_relations = 'Y' THEN
974: oe_debug_pub.add('Cr: Yes Line Deliver',2);
975:
976: SELECT /* MOAC_SQL_CHANGE */ 'VALID'
977: Into l_dummy
978: FROM HZ_CUST_SITE_USES_ALL SITE,
989: AND R.RELATED_CUST_ACCOUNT_ID = p_sold_to_org_id
990: and R.ship_to_flag = 'Y')
991: AND ROWNUM = 1;
992:
993: oe_debug_pub.add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
994: RETURN TRUE;
995:
996: ELSIF lcustomer_relations = 'A' THEN
997:
999: INTO l_dummy
1000: FROM HZ_CUST_SITE_USES SITE
1001: WHERE SITE.SITE_USE_ID =p_deliver_to_org_id;
1002:
1003: oe_debug_pub.add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
1004: RETURN TRUE;
1005:
1006:
1007: END IF;
1006:
1007: END IF;
1008:
1009:
1010: oe_debug_pub.add('Exiting OE_CNCL_VALIDATE_LINE.Validate_Deliver_To_Org',1);
1011:
1012: EXCEPTION
1013:
1014: WHEN OTHERS THEN
1029: IS
1030: l_purchasing_enabled_flag VARCHAR2(1);
1031: BEGIN
1032:
1033: oe_debug_pub.add('entering validate_source_type', 3);
1034:
1035: IF OE_GLOBALS.Equal(p_line_rec.source_type_code,
1036: OE_GLOBALS.G_SOURCE_EXTERNAL) THEN
1037:
1039: THEN
1040: IF p_line_rec.item_type_code = OE_GLOBALS.G_ITEM_SERVICE OR
1041: p_line_rec.ship_model_complete_flag = 'Y'
1042: THEN
1043: oe_debug_pub.add('servie / part of smc model', 4);
1044: FND_MESSAGE.SET_NAME('ONT', 'OE_DS_NOT_VALID_ITEM');
1045: FND_MESSAGE.SET_TOKEN('ITEM', p_line_rec.ordered_item);
1046: OE_MSG_PUB.Add;
1047: x_return_status := FND_API.G_RET_STS_ERROR;
1046: OE_MSG_PUB.Add;
1047: x_return_status := FND_API.G_RET_STS_ERROR;
1048: RETURN;
1049: ELSE
1050: oe_debug_pub.add('validate line: pack H new logic DS', 1);
1051: END IF;
1052: ELSE
1053: IF (p_line_rec.item_type_code <> OE_GLOBALS.G_ITEM_STANDARD) THEN
1054: oe_debug_pub.add('Cannot dropship non-standard item',2);
1050: oe_debug_pub.add('validate line: pack H new logic DS', 1);
1051: END IF;
1052: ELSE
1053: IF (p_line_rec.item_type_code <> OE_GLOBALS.G_ITEM_STANDARD) THEN
1054: oe_debug_pub.add('Cannot dropship non-standard item',2);
1055: FND_MESSAGE.SET_NAME('ONT', 'OE_DS_NOT_ALLOWED');
1056: OE_MSG_PUB.Add;
1057: x_return_status := FND_API.G_RET_STS_ERROR;
1058: RETURN;
1062:
1063: IF p_line_rec.ship_set_id is not null OR
1064: p_line_rec.arrival_set_id is not null THEN
1065:
1066: oe_debug_pub.add('Cannot insert external line to set',2);
1067: FND_MESSAGE.SET_NAME('ONT', 'OE_DS_SET_INS_FAILED');
1068: OE_MSG_PUB.Add;
1069: x_return_status := FND_API.G_RET_STS_ERROR;
1070: RETURN;
1099: END IF;
1100:
1101: END IF;
1102:
1103: oe_debug_pub.add('leaving validate_source_type', 3);
1104:
1105: EXCEPTION
1106: WHEN OTHERS THEN
1107: oe_debug_pub.add('error in Validate_Source_Type');
1103: oe_debug_pub.add('leaving validate_source_type', 3);
1104:
1105: EXCEPTION
1106: WHEN OTHERS THEN
1107: oe_debug_pub.add('error in Validate_Source_Type');
1108: RAISE;
1109: END Validate_Source_Type;
1110:
1111:
1134: lcustomer_relations varchar2(1) := OE_Sys_Parameters.VALUE('CUSTOMER_RELATIONSHIPS_FLAG');
1135: l_list_type_code VARCHAR2(30);
1136:
1137: l_ret_status BOOLEAN:=TRUE; -- 8993157
1138: l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level; -- INVCONV
1139: l_tracking_quantity_ind VARCHAR2(30); -- INVCONV
1140: l_secondary_default_ind VARCHAR2(30); -- INVCONV
1141: l_secondary_uom_code varchar2(3) := NULL; -- INVCONV
1142: l_buffer VARCHAR2(2000); -- INVCONV
1221: and rownum = 1 ;
1222:
1223: BEGIN
1224:
1225: oe_debug_pub.add('Enter OE_CNCL_VALIDATE_LINE.ENTITY',1);
1226:
1227:
1228: -----------------------------------------------------------
1229: -- Check required attributes.
1228: -----------------------------------------------------------
1229: -- Check required attributes.
1230: -----------------------------------------------------------
1231:
1232: oe_debug_pub.add('1 '||l_return_status, 1);
1233:
1234: oe_debug_pub.add('2 '||l_return_status, 1);
1235: IF p_line_rec.inventory_item_id IS NULL
1236: THEN
1230: -----------------------------------------------------------
1231:
1232: oe_debug_pub.add('1 '||l_return_status, 1);
1233:
1234: oe_debug_pub.add('2 '||l_return_status, 1);
1235: IF p_line_rec.inventory_item_id IS NULL
1236: THEN
1237:
1238: l_return_status := FND_API.G_RET_STS_ERROR;
1243: OE_MSG_PUB.Add;
1244:
1245: END IF;
1246:
1247: oe_debug_pub.add('3 '||l_return_status, 1);
1248: IF p_line_rec.line_type_id IS NULL
1249: THEN
1250:
1251: l_return_status := FND_API.G_RET_STS_ERROR;
1273: -- Check conditionally required attributes here.
1274: --------------------------------------------------------------
1275:
1276: -- For return lines, Return_Reason_Code is required
1277: oe_debug_pub.add('5 '||l_return_status, 1);
1278: IF p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE
1279: and p_line_rec.return_reason_code is NULL
1280: THEN
1281: l_return_status := FND_API.G_RET_STS_ERROR;
1287:
1288: END IF;
1289:
1290:
1291: oe_debug_pub.add('6 '||l_return_status, 1);
1292:
1293: -- subinventory
1294: oe_debug_pub.add('Entity: subinventory - ' || p_line_rec.subinventory);
1295:
1290:
1291: oe_debug_pub.add('6 '||l_return_status, 1);
1292:
1293: -- subinventory
1294: oe_debug_pub.add('Entity: subinventory - ' || p_line_rec.subinventory);
1295:
1296: IF p_line_rec.subinventory is not null THEN
1297: IF p_line_rec.source_type_code = 'INTERNAL' OR
1298: p_line_rec.source_type_code is null THEN
1295:
1296: IF p_line_rec.subinventory is not null THEN
1297: IF p_line_rec.source_type_code = 'INTERNAL' OR
1298: p_line_rec.source_type_code is null THEN
1299: oe_debug_pub.add('Entity Validateion: subinventory', 1);
1300: IF p_line_rec.ship_from_org_id is null THEN
1301: l_return_status := FND_API.G_RET_STS_ERROR;
1302: fnd_message.set_name('ONT', 'OE_ATTRIBUTE_REQUIRED');
1303: fnd_message.set_token('ATTRIBUTE',OE_Order_UTIL.Get_Attribute_Name('SHIP_FROM_ORG_ID'));
1311: END IF;
1312:
1313: -- end subinventory
1314:
1315: oe_debug_pub.add('Entity: done subinv validation', 1);
1316:
1317: -- If line is booked, then check for the attributes required on booked lines
1318: -- Fix bug 1277092: this check not required for fully cancelled lines
1319: IF p_line_rec.booked_flag = 'Y'
1338:
1339: -- OPM 02/JUN/00 START
1340: -- For an item with tracking in Primary and secondary , check qty1/2 both present and sync'd -- INVCONV
1341: -- =====================================================================
1342: oe_debug_pub.add('Primary and Secondary X-VAL start', 1);
1343:
1344: OPEN c_item( p_line_rec.ship_from_org_id,
1345: p_line_rec.inventory_item_id
1346: );
1369: THEN
1370: */
1371: IF l_tracking_quantity_ind = 'PS' then
1372: -- IF l_item_rec.dualum_ind in (1,2,3) THEN INVCONV
1373: oe_debug_pub.add('Primary and Secondary X-VAL - tracking_quantity_ind PS', 2);
1374:
1375: IF (p_line_rec.ordered_quantity <> FND_API.G_MISS_NUM OR
1376: p_line_rec.ordered_quantity IS NOT NULL) AND
1377: (p_line_rec.ordered_quantity2 = FND_API.G_MISS_NUM OR
1376: p_line_rec.ordered_quantity IS NOT NULL) AND
1377: (p_line_rec.ordered_quantity2 = FND_API.G_MISS_NUM OR
1378: p_line_rec.ordered_quantity2 IS NULL) THEN
1379:
1380: oe_debug_pub.add('Primary and Secondary X-VAL qty 1 not empty', 2);
1381:
1382: l_return_status := FND_API.G_RET_STS_ERROR;
1383: fnd_message.set_name('ONT','OE_ATTRIBUTE_REQUIRED');
1384: FND_MESSAGE.SET_TOKEN('ATTRIBUTE','Ordered_Quantity2');
1396: END IF; -- IF l_item_rec.tracking_quantity_ind = 'PS' IF l_item_rec.dualum_ind in (1,2,3) THEN
1397:
1398: /* If qty1/qty2 both populated, check tolerances
1399: ================================================*/
1400: oe_debug_pub.add('Primary and Secondary X-VAL - tolerance check', 2);
1401:
1402: IF l_secondary_default_ind in ('N','D') then -- INVCONV
1403: -- IF l_item_rec.dualum_ind in (2,3) THEN
1404: IF (p_line_rec.ordered_quantity <> FND_API.G_MISS_NUM AND
1420:
1421: IF l_return = 0
1422: then
1423: IF l_debug_level > 0 THEN
1424: oe_debug_pub.add('Primary and Secondary X-VAL - tolerance error 1' ,1);
1425: END IF;
1426:
1427: l_buffer := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST, -- INVCONV
1428: p_encoded => 'F');
1427: l_buffer := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST, -- INVCONV
1428: p_encoded => 'F');
1429: oe_msg_pub.add_text(p_message_text => l_buffer);
1430: IF l_debug_level > 0 THEN
1431: oe_debug_pub.add(l_buffer,1);
1432: END IF;
1433: l_return_status := FND_API.G_RET_STS_ERROR;
1434:
1435: else
1433: l_return_status := FND_API.G_RET_STS_ERROR;
1434:
1435: else
1436: IF l_debug_level > 0 THEN
1437: oe_debug_pub.add('Primary and Secondary X-VAL - No tolerance error ',1);
1438: END IF;
1439: END IF; -- IF l_return = 0
1440:
1441:
1503:
1504: IF p_line_rec.source_type_code = OE_GLOBALS.G_SOURCE_INTERNAL
1505: or p_line_rec.source_type_code is null
1506: THEN
1507: oe_debug_pub.add('Source Type is Internal',1);
1508:
1509: IF p_line_rec.line_category_code = 'RETURN' THEN
1510: l_item_type_code := OE_LINE_UTIL.Get_Return_item_type_code(
1511: p_line_rec);
1523: THEN
1524: l_return_status := FND_API.G_RET_STS_ERROR;
1525: END IF;
1526: ELSE
1527: oe_debug_pub.add('Source Type is External',1);
1528: IF NOT Validate_Receiving_Org
1529: (p_line_rec.inventory_item_id,
1530: p_line_rec.ship_from_org_id)
1531: THEN
1563:
1564: -- start decimal qty validation
1565: IF p_line_rec.inventory_item_id is not null THEN
1566:
1567: oe_debug_pub.add('decimal1',2);
1568: IF p_line_rec.order_quantity_uom is not null THEN
1569:
1570: -- validate ordered quantity
1571: Validate_Decimal_Quantity
1717: p_date := NVL(p_line_rec.schedule_arrival_date,
1718: p_line_rec.request_date);
1719: END IF;
1720:
1721: OE_DEBUG_PUB.Add('Before calling Validate Proj References',1);
1722:
1723: result := PJM_PROJECT.VALIDATE_PROJ_REFERENCES
1724: ( X_inventory_org_id => p_line_rec.ship_from_org_id
1725: , X_operating_unit => p_line_rec.org_id
1729: , X_date2 => NULL
1730: , X_calling_function =>'OEXVCLNB'
1731: , X_error_code => errcode
1732: );
1733: OE_DEBUG_PUB.Add('Validate Proj References Error:'||
1734: errcode,1);
1735: OE_DEBUG_PUB.Add('Validate Proj References Result:'||
1736: result,1);
1737:
1731: , X_error_code => errcode
1732: );
1733: OE_DEBUG_PUB.Add('Validate Proj References Error:'||
1734: errcode,1);
1735: OE_DEBUG_PUB.Add('Validate Proj References Result:'||
1736: result,1);
1737:
1738: IF result <> PJM_PROJECT.G_VALIDATE_SUCCESS THEN
1739: OE_MSG_PUB.Transfer_Msg_Stack;
1739: OE_MSG_PUB.Transfer_Msg_Stack;
1740: l_msg_count:=OE_MSG_PUB.COUNT_MSG;
1741: FOR I in 1..l_msg_count loop
1742: l_msg_data := OE_MSG_PUB.Get(I,'F');
1743: OE_DEBUG_PUB.add(l_msg_data,1);
1744: END LOOP;
1745: END IF;
1746:
1747: IF result = PJM_PROJECT.G_VALIDATE_FAILURE THEN
1745: END IF;
1746:
1747: IF result = PJM_PROJECT.G_VALIDATE_FAILURE THEN
1748: l_return_status := FND_API.G_RET_STS_ERROR;
1749: OE_DEBUG_PUB.Add('PJM Validation API returned with Errors',1);
1750: ELSIF result = PJM_PROJECT.G_VALIDATE_WARNING THEN
1751: OE_DEBUG_PUB.Add('PJM Validation API returned with Warnings',1);
1752: END IF;
1753:
1747: IF result = PJM_PROJECT.G_VALIDATE_FAILURE THEN
1748: l_return_status := FND_API.G_RET_STS_ERROR;
1749: OE_DEBUG_PUB.Add('PJM Validation API returned with Errors',1);
1750: ELSIF result = PJM_PROJECT.G_VALIDATE_WARNING THEN
1751: OE_DEBUG_PUB.Add('PJM Validation API returned with Warnings',1);
1752: END IF;
1753:
1754:
1755:
1811: */
1812:
1813: -- End Item Unit number logic.
1814:
1815: oe_debug_pub.add('10 '||l_return_status, 1);
1816: IF (p_line_rec.inventory_item_id IS NOT NULL) AND
1817: (p_line_rec.ship_from_org_id IS NOT NULL) AND
1818: (p_line_rec.end_item_unit_number IS NULL) THEN
1819:
1843:
1844: -- Donot allow to update project and task when a option/class is under ATO
1845: -- Model.
1846:
1847: oe_debug_pub.add('11 '||l_return_status, 1);
1848:
1849: /*IF p_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
1850:
1851: IF (p_line_rec.item_type_code = OE_GLOBALS.G_ITEM_OPTION OR
1863: -- End of PJM validation.
1864: */
1865:
1866: -- Validate if item, item_identifier_type, inventory_item combination is valid
1867: oe_debug_pub.add('12-1 '||l_return_status, 1);
1868: IF p_line_rec.inventory_item_id IS NOT NULL THEN
1869:
1870: IF NOT Validate_Item_Fields
1871: ( p_line_rec.inventory_item_id
1880: END IF;
1881:
1882: END IF;
1883:
1884: oe_debug_pub.add('12 '||l_return_status, 1);
1885: -- Validate if return item and item on referenced sales order line mismatch
1886: IF (p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE and
1887: p_line_rec.reference_line_id is not null and
1888: p_line_rec.inventory_item_id IS NOT NULL)
1897: OE_MSG_PUB.add;
1898: END IF;
1899: END IF;
1900:
1901: oe_debug_pub.add('13 '||l_return_status, 1);
1902:
1903: -- Validate if returning a fulfilled sales order line
1904: IF (p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE and
1905: p_line_rec.reference_line_id is not null)
1914: END IF;
1915:
1916: END IF;
1917:
1918: oe_debug_pub.add('14 '||l_return_status, 1);
1919:
1920: -- Validate if item on the Return is Returnable
1921: IF (p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE and
1922: p_line_rec.inventory_item_id IS NOT NULL)
1930: END IF;
1931: END IF;
1932:
1933:
1934: oe_debug_pub.add('14_1 '||l_return_status, 1);
1935:
1936: -- Validate if Reference SO Line is Valid
1937: IF (p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE and
1938: p_line_rec.reference_line_id is not null)
1943: l_return_status := FND_API.G_RET_STS_ERROR;
1944: END IF;
1945: END IF;
1946:
1947: oe_debug_pub.add('14_2 '||l_return_status, 1);
1948:
1949: -- Validate the quantity = 1 on RMA for Serial Number reference
1950: IF (p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE and
1951: p_line_rec.reference_line_id is not null and
1957: OE_MSG_PUB.Add;
1958: END IF;
1959:
1960:
1961: oe_debug_pub.add('14_3 '||l_return_status, 1);
1962:
1963: -- Validation of Ship To Org Id.
1964: IF p_line_rec.ship_to_org_id IS NOT NULL
1965:
1983:
1984: THEN
1985:
1986: BEGIN
1987: oe_debug_pub.add('ship_to_contact_id :'||to_char(p_line_rec.ship_to_contact_id),2);
1988:
1989: SELECT /* MOAC_SQL_CHANGE */ 'VALID'
1990: INTO l_dummy
1991: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE
2044:
2045: THEN
2046:
2047: BEGIN
2048: oe_debug_pub.add('deliver_to_contact_id :'||to_char(p_line_rec.deliver_to_contact_id),2);
2049:
2050: SELECT /* MOAC_SQL_CHANGE */ 'VALID'
2051: INTO l_dummy
2052: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE
2087:
2088: THEN
2089:
2090: BEGIN
2091: oe_debug_pub.add('invoice_to_org_id :'||to_char(p_line_rec.invoice_to_org_id),2);
2092: --lcustomer_relations := FND_PROFILE.VALUE('ONT_CUSTOMER_RELATIONSHIPS');
2093:
2094: IF nvl(lcustomer_relations,'N') = 'N' THEN
2095:
2126:
2127: /* added the following ELSIF condition to fix the bug 2002486 */
2128:
2129: ELSIF nvl(lcustomer_relations,'N') = 'A' THEN
2130: oe_debug_pub.add
2131: ('Cr: A',2);
2132:
2133: SELECT 'VALID'
2134: INTO l_dummy
2163:
2164: THEN
2165:
2166: BEGIN
2167: oe_debug_pub.add('invoice_to_contact_id :'||to_char(p_line_rec.invoice_to_contact_id),2);
2168:
2169: SELECT /* MOAC_SQL_CHANGE */ 'VALID'
2170: INTO l_dummy
2171: FROM HZ_CUST_ACCOUNT_ROLES ACCT_ROLE
2428: AND organization_id = nvl(p_line_rec.ship_from_org_id,
2429: OE_Sys_Parameters.VALUE_WNPS('MASTER_ORGANIZATION_ID'));
2430:
2431:
2432: oe_debug_pub.add('primary uom: '|| l_uom, 1);
2433: oe_debug_pub.add('uom entered: '||p_line_rec.order_quantity_uom , 1);
2434:
2435: IF l_uom <> p_line_rec.order_quantity_uom
2436: THEN
2429: OE_Sys_Parameters.VALUE_WNPS('MASTER_ORGANIZATION_ID'));
2430:
2431:
2432: oe_debug_pub.add('primary uom: '|| l_uom, 1);
2433: oe_debug_pub.add('uom entered: '||p_line_rec.order_quantity_uom , 1);
2434:
2435: IF l_uom <> p_line_rec.order_quantity_uom
2436: THEN
2437: oe_debug_pub.add('uom other than primary uom is entered', 1);
2433: oe_debug_pub.add('uom entered: '||p_line_rec.order_quantity_uom , 1);
2434:
2435: IF l_uom <> p_line_rec.order_quantity_uom
2436: THEN
2437: oe_debug_pub.add('uom other than primary uom is entered', 1);
2438:
2439: fnd_message.set_name('ONT','OE_INVALID_ORDER_QUANTITY_UOM');
2440: fnd_message.set_token('ITEM',p_line_rec.ordered_item );
2441: fnd_message.set_token('UOM', l_uom);
2443: RAISE FND_API.G_EXC_ERROR;
2444: END IF;
2445: EXCEPTION
2446: when no_data_found then
2447: oe_debug_pub.add('OEXLLINB, no_data_found in uom validation', 1);
2448: RAISE FND_API.G_EXC_ERROR;
2449: END;
2450:
2451: ELSE -- not ato related, validate item, uom combination
2459: OE_Sys_Parameters.VALUE_WNPS('MASTER_ORGANIZATION_ID'));
2460:
2461:
2462: IF l_uom_count = 0 THEN
2463: oe_debug_pub.add('uom/item combination invalid',2);
2464: fnd_message.set_name('ONT', 'OE_INVALID_ITEM_UOM');
2465: OE_MSG_PUB.Add;
2466: RAISE FND_API.G_EXC_ERROR;
2467: END IF;
2473: nvl(p_line_rec.ship_from_org_id,
2474: OE_Sys_Parameters.VALUE_WNPS('MASTER_ORGANIZATION_ID')));
2475: IF NOT l_ret_status THEN
2476: if l_debug_level > 0 then
2477: oe_debug_pub.add('uom/item combination invalid',2);
2478: end if;
2479:
2480: fnd_message.set_name('ONT', 'OE_INVALID_ITEM_UOM');
2481: OE_MSG_PUB.Add;
2542: l_price_list_name := l_price_list_id;
2543: END;
2544: fnd_message.set_Token('PRICE_LIST2', l_price_list_name);
2545: OE_MSG_PUB.Add;
2546: oe_debug_pub.add('Invalid Agreement +price_list_id combination',2);
2547: raise FND_API.G_EXC_ERROR;
2548: END IF;
2549: END IF; -- end of if l_list_type_code <> 'PRL'
2550:
2557: fnd_message.set_Token('AGREEMENT_ID', p_line_rec.agreement_id);
2558: fnd_message.set_Token('AGREEMENT_NAME', l_agreement_name);
2559: fnd_message.set_Token('CUSTOMER_ID', p_line_rec.sold_to_org_id);
2560: OE_MSG_PUB.Add;
2561: oe_debug_pub.add('Invalid Agreement +sold_org_id combination',2);
2562: RAISE FND_API.G_EXC_ERROR;
2563: ELSIF lcustomer_relations = 'Y' THEN
2564:
2565: BEGIN
2573: AND CUST_ACCOUNT_ID = l_sold_to_org
2574:
2575: );
2576:
2577: oe_debug_pub.add('Linda -- l_dummy is: '||l_dummy,2);
2578: /* Replaced ra_customer_relationships with HZ Table to fix the bug 1888440 */
2579:
2580: EXCEPTION
2581: WHEN NO_DATA_FOUND THEN
2583: fnd_message.set_Token('AGREEMENT_ID', p_line_rec.agreement_id);
2584: fnd_message.set_Token('AGREEMENT_NAME', l_agreement_name);
2585: fnd_message.set_Token('CUSTOMER_ID', p_line_rec.sold_to_org_id);
2586: OE_MSG_PUB.Add;
2587: oe_debug_pub.add('Invalid Agreement +sold_org_id combination',2);
2588: RAISE FND_API.G_EXC_ERROR;
2589: END;
2590: END IF;
2591: END IF;
2597: fnd_message.set_Token('AGREEMENT_ID', p_line_rec.agreement_id);
2598: fnd_message.set_Token('AGREEMENT_NAME', l_agreement_name);
2599: fnd_message.set_Token('CUSTOMER_ID', l_sold_to_org);
2600: OE_MSG_PUB.Add;
2601: oe_debug_pub.add('Invalid Agreement +sold_org_id combination',2);
2602: RAISE FND_API.G_EXC_ERROR;
2603: END;
2604: END IF; -- Agreement has changed
2605:
2610:
2611:
2612: -- Allow only the non agreement price_lists
2613: BEGIN
2614: oe_debug_pub.add('Pricing date is '||p_line_rec.pricing_date,2);
2615: -- modified by lkxu: to select from qp_list_headers_vl instead
2616: -- of from qp_price_lists_v to select only PRL type list headers.
2617:
2618: SELECT name
2626: fnd_message.set_name('ONT', 'OE_INVALID_NONAGR_PLIST');
2627: fnd_message.set_Token('PRICE_LIST1', p_line_rec.price_list_id);
2628: fnd_message.set_Token('PRICING_DATE', p_line_rec.pricing_date);
2629: OE_MSG_PUB.Add;
2630: oe_debug_pub.add('Invalid non agreement price list ',2);
2631: RAISE FND_API.G_EXC_ERROR;
2632: END;
2633:
2634: --END IF; -- Price list or pricing date has changed
2633:
2634: --END IF; -- Price list or pricing date has changed
2635: END IF;
2636:
2637: oe_debug_pub.add('15 '||l_return_status ,1);
2638:
2639: -- Line number validation.
2640: -- Allow line number updates only on Model, Standard, Kit,
2641: --and stand alone service line.
2662:
2663: END IF;
2664: */
2665:
2666: oe_debug_pub.add('16 '||l_return_status ,1);
2667:
2668: /*IF p_line_rec.top_model_line_id is not null AND
2669: p_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE AND
2670: p_line_rec.ordered_quantity = 0
2668: /*IF p_line_rec.top_model_line_id is not null AND
2669: p_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE AND
2670: p_line_rec.ordered_quantity = 0
2671: THEN
2672: oe_debug_pub.add
2673: ('qty of a configuration related line 0'|| p_line_rec.item_type_code, 1);
2674: END IF;
2675: */
2676:
2673: ('qty of a configuration related line 0'|| p_line_rec.item_type_code, 1);
2674: END IF;
2675: */
2676:
2677: oe_debug_pub.add('OEXLLINB, RR:T2',1);
2678: oe_debug_pub.add('17 '||l_return_status ,1);
2679:
2680: -- Validate ordered quantity for OTA lines. OTA Lines are
2681: -- identified by item_type_code of training. The ordered
2674: END IF;
2675: */
2676:
2677: oe_debug_pub.add('OEXLLINB, RR:T2',1);
2678: oe_debug_pub.add('17 '||l_return_status ,1);
2679:
2680: -- Validate ordered quantity for OTA lines. OTA Lines are
2681: -- identified by item_type_code of training. The ordered
2682: -- quantity cannot be greater than 1 for OTA lines.
2686:
2687: IF (l_is_ota_line) AND
2688: p_line_rec.ordered_quantity > 1 then
2689:
2690: oe_debug_pub.add('Ordered Qty cannot be greater than 1 for OTA lines',
2691: 1);
2692: l_return_status := FND_API.G_RET_STS_ERROR;
2693: FND_Message.Set_Name('ONT', 'OE_OTA_INVALID_QTY');
2694: oe_msg_pub.add;
2732: END IF;
2733:
2734: END IF;
2735:
2736: oe_debug_pub.add('18 '||l_return_status ,1);
2737: x_return_status := l_return_status;
2738:
2739: -- Done validating entity
2740: oe_debug_pub.add('Exit OE_CNCL_VALIDATE_LINE.ENTITY',1);
2736: oe_debug_pub.add('18 '||l_return_status ,1);
2737: x_return_status := l_return_status;
2738:
2739: -- Done validating entity
2740: oe_debug_pub.add('Exit OE_CNCL_VALIDATE_LINE.ENTITY',1);
2741: EXCEPTION
2742:
2743: WHEN FND_API.G_EXC_ERROR THEN
2744:
2773: l_return_status VARCHAR2(1);
2774: l_line_rec OE_Order_PUB.Line_Rec_Type := OE_Order_PUB.G_MISS_LINE_REC;
2775: l_type_code VARCHAR2(30);
2776: BEGIN
2777: oe_debug_pub.add('Enter procedure OE_CNCL_VALIDATE_line.Attributes',1);
2778:
2779: x_return_status := FND_API.G_RET_STS_SUCCESS;
2780: l_return_status := FND_API.G_RET_STS_SUCCESS;
2781:
3278: END IF;
3279: END IF;
3280: END IF;
3281:
3282: oe_debug_pub.add('before flex: '||x_return_status,2);
3283: IF p_x_line_rec.attribute1 IS NOT NULL
3284: OR p_x_line_rec.attribute10 IS NOT NULL
3285: OR p_x_line_rec.attribute11 IS NOT NULL
3286: OR p_x_line_rec.attribute12 IS NOT NULL
3302: OR p_x_line_rec.attribute9 IS NOT NULL
3303: OR p_x_line_rec.context IS NOT NULL
3304: THEN
3305:
3306: oe_debug_pub.add('Before calling line_desc_flex',2);
3307: IF NOT OE_CNCL_Validate.Line_Desc_Flex
3308: (p_context => p_x_line_rec.context
3309: ,p_attribute1 => p_x_line_rec.attribute1
3310: ,p_attribute2 => p_x_line_rec.attribute2
3379: x_return_status := FND_API.G_RET_STS_ERROR;
3380: END IF;
3381: END IF;
3382:
3383: oe_debug_pub.add('After line_desc_flex ' || x_return_status,2);
3384:
3385:
3386:
3387: END IF;
3411: THEN
3412:
3413:
3414:
3415: OE_DEBUG_PUB.ADD('Before G_line_desc_flex',2);
3416: IF NOT OE_CNCL_Validate.G_Line_Desc_Flex
3417: (p_context => p_x_line_rec.global_attribute_category
3418: ,p_attribute1 => p_x_line_rec.global_attribute1
3419: ,p_attribute2 => p_x_line_rec.global_attribute2
3486: x_return_status := FND_API.G_RET_STS_ERROR;
3487: END IF;
3488: END IF;
3489:
3490: OE_DEBUG_PUB.ADD('After G_Line_desc_flex ' || x_return_status,2);
3491:
3492: END IF;
3493:
3494: IF p_x_line_rec.industry_attribute1 IS NOT NULL
3631: x_return_status := FND_API.G_RET_STS_ERROR;
3632: END IF;
3633: END IF;
3634:
3635: oe_debug_pub.add('After I_line_desc_flex ' || x_return_status,2);
3636:
3637: END IF;
3638:
3639: /* Trading Partner Attributes */
3717: x_return_status := FND_API.G_RET_STS_ERROR;
3718: END IF;
3719: END IF;
3720:
3721: --oe_debug_pub.add('After TP_line_desc_flex ' || x_return_status);
3722:
3723: END IF;
3724: /* Trading Partner */
3725:
3742: OR p_x_line_rec.return_context IS NOT NULL
3743: THEN
3744:
3745:
3746: oe_debug_pub.add('Before calling Return line_desc_flex',2);
3747: IF NOT OE_CNCL_Validate.R_Line_Desc_Flex
3748: (p_context => p_x_line_rec.Return_context
3749: ,p_attribute1 => p_x_line_rec.Return_attribute1
3750: ,p_attribute2 => p_x_line_rec.Return_attribute2
3804: x_return_status := FND_API.G_RET_STS_ERROR;
3805: END IF;
3806: END IF;
3807:
3808: oe_debug_pub.add('After Return line_desc_flex ' || x_return_status,2);
3809:
3810:
3811:
3812: END IF;
3845: IF NOT OE_CNCL_Validate.commitment(p_x_line_rec.commitment_id) THEN
3846: x_return_status := FND_API.G_RET_STS_ERROR;
3847: END IF;
3848: END IF;
3849: oe_debug_pub.add('Exiting procedure OE_CNCL_VALIDATE_line.Attributes',1);
3850:
3851: EXCEPTION
3852:
3853: WHEN FND_API.G_EXC_ERROR THEN
3879: l_item_type_code VARCHAR2(30) := NULL;
3880: l_item_rec OE_ORDER_CACHE.item_rec_type;
3881: BEGIN
3882:
3883: oe_debug_pub.add('In OEXVCLINB: Function Get_Item_Type',1);
3884: oe_debug_pub.add('The INV Item is'||to_char(p_line_rec.inventory_item_id),1);
3885:
3886: IF p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE THEN
3887: RETURN OE_GLOBALS.G_ITEM_STANDARD;
3880: l_item_rec OE_ORDER_CACHE.item_rec_type;
3881: BEGIN
3882:
3883: oe_debug_pub.add('In OEXVCLINB: Function Get_Item_Type',1);
3884: oe_debug_pub.add('The INV Item is'||to_char(p_line_rec.inventory_item_id),1);
3885:
3886: IF p_line_rec.line_category_code = OE_GLOBALS.G_RETURN_CATEGORY_CODE THEN
3887: RETURN OE_GLOBALS.G_ITEM_STANDARD;
3888: ELSIF p_line_rec.item_type_code = OE_GLOBALS.G_ITEM_CONFIG OR
3894: l_item_rec :=
3895: OE_Order_Cache.Load_Item (p_line_rec.inventory_item_id
3896: ,p_line_rec.ship_from_org_id);
3897:
3898: oe_debug_pub.add('Bom Item Type is ' || l_item_rec.bom_item_type);
3899:
3900: IF l_item_rec.bom_item_type = 1
3901: -- MODEL items and ato's under pto have bom_item_type = 1
3902: THEN
3903:
3904: IF nvl(p_line_rec.top_model_line_ref, 0) <>
3905: nvl(p_line_rec.orig_sys_line_ref, 0)
3906: THEN
3907: oe_debug_pub.add
3908: ('Returning CLASS as the Item Type for ato subconfig',1);
3909: --Procedure to check change in item_type_code
3910: RETURN OE_GLOBALS.G_ITEM_CLASS;
3911: END IF;
3909: --Procedure to check change in item_type_code
3910: RETURN OE_GLOBALS.G_ITEM_CLASS;
3911: END IF;
3912:
3913: oe_debug_pub.add('Returning MODEL as the Item Type',1);
3914: --Procedure to check change in item_type_code
3915: RETURN OE_GLOBALS.G_ITEM_MODEL;
3916:
3917: ELSIF l_item_rec.bom_item_type = 2
3915: RETURN OE_GLOBALS.G_ITEM_MODEL;
3916:
3917: ELSIF l_item_rec.bom_item_type = 2
3918: THEN
3919: oe_debug_pub.add('Returning CLASS as the Item Type',1);
3920: -- Only CLASS items have bom_item_type = 2
3921: --Procedure to check change in item_type_code
3922: RETURN OE_GLOBALS.G_ITEM_CLASS;
3923: ELSIF l_item_rec.bom_item_type = 4 and
3923: ELSIF l_item_rec.bom_item_type = 4 and
3924: l_item_rec.service_item_flag = 'N'
3925: THEN
3926:
3927: oe_debug_pub.add('Bom 4 and flag = N');
3928: -- Following 3 items can have bom_item_type = 4 :
3929: -- STANDARD item, OPTION item and a KIT
3930: -- We will distinguish an item to be a kit by seeing if
3931: -- it has a record in bom_bill_of_materials.
3933: -- before they come to defaulting. Thus we use it to distinguish
3934: -- between a standard and an option item.
3935: -- ato_item's item_type_code will be standard
3936:
3937: oe_debug_pub.add
3938: ('item Org ' || OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID'));
3939: oe_debug_pub.add('inventory_item_id ' || p_line_rec.inventory_item_id);
3940: BEGIN
3941: SELECT OE_GLOBALS.G_ITEM_KIT
3935: -- ato_item's item_type_code will be standard
3936:
3937: oe_debug_pub.add
3938: ('item Org ' || OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID'));
3939: oe_debug_pub.add('inventory_item_id ' || p_line_rec.inventory_item_id);
3940: BEGIN
3941: SELECT OE_GLOBALS.G_ITEM_KIT
3942: INTO l_item_type_code
3943: FROM mtl_system_items
3945: = OE_SYS_PARAMETERS.VALUE('MASTER_ORGANIZATION_ID')
3946: AND inventory_item_id = p_line_rec.inventory_item_id
3947: AND pick_components_flag = 'Y';
3948:
3949: oe_debug_pub.add(' Before calling check 1');
3950: --Procedure to check change in item_type_code
3951: RETURN l_item_type_code;
3952: EXCEPTION
3953: WHEN NO_DATA_FOUND THEN
3950: --Procedure to check change in item_type_code
3951: RETURN l_item_type_code;
3952: EXCEPTION
3953: WHEN NO_DATA_FOUND THEN
3954: oe_debug_pub.add('get_item_type no data found, bom_item_type : 4', 1);
3955: IF (p_line_rec.top_model_line_ref is not null AND
3956: p_line_rec.top_model_line_ref <> FND_API.G_MISS_CHAR)
3957: OR
3958: (p_line_rec.top_model_line_index is not null AND
3958: (p_line_rec.top_model_line_index is not null AND
3959: p_line_rec.top_model_line_index <> FND_API.G_MISS_NUM)
3960:
3961: THEN
3962: oe_debug_pub.add(' Before calling check 2');
3963: RETURN OE_GLOBALS.G_ITEM_OPTION;
3964: ELSE
3965: oe_debug_pub.add(' Before calling check 3');
3966: RETURN OE_GLOBALS.G_ITEM_STANDARD;
3961: THEN
3962: oe_debug_pub.add(' Before calling check 2');
3963: RETURN OE_GLOBALS.G_ITEM_OPTION;
3964: ELSE
3965: oe_debug_pub.add(' Before calling check 3');
3966: RETURN OE_GLOBALS.G_ITEM_STANDARD;
3967: END IF;
3968: END;
3969:
3969:
3970: ELSIF l_item_rec.service_item_flag = 'Y' and
3971: l_item_rec.bom_item_type = 4
3972: THEN
3973: oe_debug_pub.add('Service item flag is: ' || l_item_rec.service_item_flag);
3974: RETURN OE_GLOBALS.G_ITEM_SERVICE;
3975:
3976: END IF;
3977:
3976: END IF;
3977:
3978: RETURN null;
3979:
3980: oe_debug_pub.add('Exiting OEXVCLNB: Function Get_Item_Type');
3981:
3982: EXCEPTION
3983:
3984: WHEN NO_DATA_FOUND THEN
3981:
3982: EXCEPTION
3983:
3984: WHEN NO_DATA_FOUND THEN
3985: oe_debug_pub.add(' Before calling check 4');
3986: l_item_type_code := OE_GLOBALS.G_ITEM_STANDARD;
3987: RETURN l_item_type_code;
3988:
3989: WHEN OTHERS THEN