DBA Data[Home] [Help]

APPS.MSC_ATP_DB_UTILS dependencies on MSC_DEMANDS

Line 67: /* In time phased atp scenarios add demand in msc_demands for member item*/

63:
64: -- time_phased_atp changes begin
65: IF (p_atp_rec.inventory_item_id <> p_atp_rec.request_item_id) and p_atp_rec.atf_date is not null THEN
66: l_time_phased_atp := 'Y';
67: /* In time phased atp scenarios add demand in msc_demands for member item*/
68: l_insert_item_id := p_atp_rec.request_item_id;
69: IF PG_DEBUG in ('Y', 'C') THEN
70: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'Time Phased ATP = ' || l_time_phased_atp);
71: END IF;

Line 76: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'Insert demand in msc_demands for ' || l_insert_item_id);

72: ELSE
73: l_insert_item_id := p_atp_rec.inventory_item_id;
74: END IF;
75: IF PG_DEBUG in ('Y', 'C') THEN
76: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'Insert demand in msc_demands for ' || l_insert_item_id);
77: END IF;
78: -- time_phased_atp changes end
79:
80: IF (p_plan_id = -1) THEN -- ods, put into ods tables

Line 160: VALUES( msc_demands_s.nextval,

156: --which now holds the value of Intransit Lead Time
157: INTRANSIT_LEAD_TIME,
158: SHIP_SET_NAME, --bug3263368
159: ARRIVAL_SET_NAME) --bug3263368
160: VALUES( msc_demands_s.nextval,
161: p_atp_rec.instance_id,
162: p_atp_rec.inventory_item_id,
163: p_atp_rec.organization_id,
164: p_atp_rec.demand_source_type,

Line 228: ||' VALUES( msc_demands_s.nextval,'

224: ||' ARRIVAL_SET_NAME,' --bug3263368
225: ||' SR_DEMAND_ID,' --bug6647536
226: ||' ROW_TYPE,' --bug6647536
227: ||' SR_SO_LINEID)' --bug6647536
228: ||' VALUES( msc_demands_s.nextval,'
229: ||' :instance_id,'
230: ||' :inventory_item_id,'
231: ||' :organization_id,'
232: ||' :demand_source_type,'

Line 384: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'inside update of msc_demands');

380: --as this code is redundent commenting it out avjain
381: /*IF (p_atp_rec.origination_type IN (6, 30)) AND NVL(p_atp_rec.old_demand_id, 0) > 0 THEN
382:
383: IF PG_DEBUG in ('Y', 'C') THEN
384: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'inside update of msc_demands');
385: END IF;
386:
387: -- For bug 2259824, move the demand to the end of day
388: UPDATE msc_demands

Line 388: UPDATE msc_demands

384: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'inside update of msc_demands');
385: END IF;
386:
387: -- For bug 2259824, move the demand to the end of day
388: UPDATE msc_demands
389: SET using_requirement_quantity = p_atp_rec.quantity_ordered,
390: USING_ASSEMBLY_DEMAND_DATE=
391: decode(MSC_ATP_PVT.G_PLAN_INFO_REC.schedule_by_date_type,
392: MSC_ATP_PVT.G_SCHEDULE_DATE_LEGEND,

Line 421: -- bug 2795053-reopen (ssurendr) update the demand_satisfied_date in msc_demands

417: ship_to_site_id = MSC_ATP_PVT.G_PARTNER_SITE_ID,
418: inventory_item_id = p_atp_rec.inventory_item_id,
419: -- 24x7
420: atp_synchronization_flag = 0,
421: -- bug 2795053-reopen (ssurendr) update the demand_satisfied_date in msc_demands
422: dmd_satisfied_date = TRUNC(p_atp_rec.requested_ship_date) + MSC_ATP_PVT.G_END_OF_DAY
423: WHERE sr_instance_id = p_atp_rec.instance_id
424: AND plan_id = p_plan_id
425: AND sales_order_line_id = p_atp_rec.demand_source_line

Line 484: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'before insert into msc_demands');

480: IF (SQL%NOTFOUND OR (p_atp_rec.origination_type NOT IN (6, 30)) OR
481: NVL(p_atp_rec.old_demand_id,0 ) = 0) THEN
482:
483: IF PG_DEBUG in ('Y', 'C') THEN
484: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'before insert into msc_demands');
485: END IF;
486:
487: INSERT INTO MSC_DEMANDS(
488: DEMAND_ID,

Line 487: INSERT INTO MSC_DEMANDS(

483: IF PG_DEBUG in ('Y', 'C') THEN
484: msc_sch_wb.atp_debug('Add_Mat_Demand: ' || 'before insert into msc_demands');
485: END IF;
486:
487: INSERT INTO MSC_DEMANDS(
488: DEMAND_ID,
489: USING_REQUIREMENT_QUANTITY,
490: SCHEDULE_SHIP_DATE, --plan by request date
491: USING_ASSEMBLY_DEMAND_DATE,

Line 517: -- bug 2795053-reopen (ssurendr) insert the demand_satisfied_date in msc_demands

513: SHIP_TO_SITE_ID,
514: RECORD_SOURCE, -- For plan order pegging
515: -- 24x7
516: ATP_SYNCHRONIZATION_FLAG,
517: -- bug 2795053-reopen (ssurendr) insert the demand_satisfied_date in msc_demands
518: DMD_SATISFIED_DATE,
519: -- rajjain bug 2771075 04/25/2003 Populate disposition_id column with the demand_id
520: DISPOSITION_ID,
521: --s_cto_rearch

Line 539: msc_demands_s.nextval,

535: SHIP_SET_NAME, --bug3263368
536: ARRIVAL_SET_NAME --bug3263368
537: )
538: VALUES(
539: msc_demands_s.nextval,
540: MSC_ATP_UTILS.Truncate_Demand(p_atp_rec.quantity_ordered), -- 5598066
541: -- start changes for plan by request date
542: decode(p_atp_rec.origination_type,
543: 6, TRUNC(p_atp_rec.requested_ship_date) + MSC_ATP_PVT.G_END_OF_DAY,

Line 621: -- bug 2795053-reopen (ssurendr) insert the demand_satisfied_date in msc_demands

617: MSC_ATP_PVT.G_PARTNER_SITE_ID,
618: l_record_source, -- For plan order pegging
619: -- 24x7
620: 0,
621: -- bug 2795053-reopen (ssurendr) insert the demand_satisfied_date in msc_demands
622: TRUNC(p_atp_rec.requested_ship_date) + MSC_ATP_PVT.G_END_OF_DAY,
623: msc_demands_s.nextval,
624: --s_cto_rearch
625: p_atp_rec.parent_line_id,

Line 623: msc_demands_s.nextval,

619: -- 24x7
620: 0,
621: -- bug 2795053-reopen (ssurendr) insert the demand_satisfied_date in msc_demands
622: TRUNC(p_atp_rec.requested_ship_date) + MSC_ATP_PVT.G_END_OF_DAY,
623: msc_demands_s.nextval,
624: --s_cto_rearch
625: p_atp_rec.parent_line_id,
626: p_atp_rec.ato_model_line_id,
627: p_atp_rec.top_model_line_id,

Line 1586: msc_sch_wb.atp_debug('Delete_Row: ' || 'Deleting msc_demands with identifier = '||

1582:
1583: END IF;
1584: ELSE
1585: IF PG_DEBUG in ('Y', 'C') THEN
1586: msc_sch_wb.atp_debug('Delete_Row: ' || 'Deleting msc_demands with identifier = '||
1587: p_identifier ||' : plan id = '||p_plan_id);
1588: END IF;
1589:
1590: IF MSC_ATP_PVT.G_SUMMARY_FLAG = 'Y' THEN

Line 1620: UPDATE msc_demands

1616:
1617: -- Bug # 1868383, do not delete old demand records, rather just update qty = 0
1618: -- Bug 2738280. Club the 2 update SQL's into one.
1619: -- Collect all the entities required for updating summary tables here.
1620: UPDATE msc_demands
1621: SET old_demand_quantity = using_requirement_quantity,
1622: -- bug 2863322 : change the column used to store date
1623: old_using_assembly_demand_date = using_assembly_demand_date,
1624: applied = 2,

Line 1697: FROM MSC_DEMANDS

1693: l_organization_id,
1694: l_refresh_number_tab,
1695: l_qty_tab,
1696: l_old_demand_date
1697: FROM MSC_DEMANDS
1698: WHERE sr_instance_id = p_instance_id
1699: AND plan_id = p_plan_id
1700: AND using_requirement_quantity > 0
1701: -- CTO ODR and Simplified Pegging

Line 1733: UPDATE msc_demands

1729: -- msc_sch_wb.atp_debug('Delete_Row: ' || 'x_demand_id.COUNT:' || x_demand_id.COUNT);
1730: --END IF;
1731:
1732: --FORALL i in 1..x_demand_id.COUNT --cmro
1733: UPDATE msc_demands
1734: SET old_demand_quantity = using_requirement_quantity,
1735: old_using_assembly_demand_date = using_assembly_demand_date,
1736: applied = 2,
1737: status = 0,

Line 1783: SELECT msc_demands_s.nextval

1779: l_ins_refresh_number_tab(l_ins_refresh_number_tab.COUNT) := l_refresh_number_tab(i);
1780: l_ins_qty_tab(l_ins_qty_tab.COUNT) := l_qty_tab(i);
1781: l_ins_date_tab(l_ins_date_tab.COUNT) := l_old_demand_date(i);
1782:
1783: SELECT msc_demands_s.nextval
1784: INTO l_copy_demand_id(l_copy_demand_id.COUNT)
1785: FROM dual;
1786: END IF;
1787: END LOOP;

Line 1796: INSERT INTO MSC_DEMANDS(

1792: msc_sch_wb.atp_debug('Delete_Row: ' || 'i_ins_item_id_tab.COUNT:' || i_ins_item_id_tab.COUNT);
1793: END IF;
1794:
1795: FORALL i IN 1..i_ins_item_id_tab.COUNT
1796: INSERT INTO MSC_DEMANDS(
1797: DEMAND_ID,
1798: USING_REQUIREMENT_QUANTITY,
1799: USING_ASSEMBLY_DEMAND_DATE,
1800: DEMAND_TYPE,

Line 2020: SELECT msc_demands_s.nextval

2016: l_ins_qty_tab(l_ins_qty_tab.COUNT) := l_qty_tab(i);
2017: l_ins_date_tab(l_ins_date_tab.COUNT) := l_old_demand_date(i);
2018: l_ins_demand_class_tab(l_ins_demand_class_tab.COUNT) := l_demand_class_tab(i);
2019:
2020: SELECT msc_demands_s.nextval
2021: INTO l_copy_demand_id(l_copy_demand_id.COUNT)
2022: FROM dual;
2023:
2024: END IF;

Line 2033: -1 * allocated_quantity, -- multiply by -1 since the copy record will be stored in msc_demands

2029: SELECT sales_order_line_id,
2030: inventory_item_id,
2031: organization_id,
2032: refresh_number,
2033: -1 * allocated_quantity, -- multiply by -1 since the copy record will be stored in msc_demands
2034: supply_date,
2035: demand_class
2036: BULK COLLECT INTO
2037: l_identifier_tab,

Line 2124: SELECT msc_demands_s.nextval

2120: l_ins_qty_tab(l_ins_qty_tab.COUNT) := l_qty_tab(i);
2121: l_ins_date_tab(l_ins_date_tab.COUNT) := l_old_demand_date(i);
2122: l_ins_demand_class_tab(l_ins_demand_class_tab.COUNT) := l_demand_class_tab(i);
2123:
2124: SELECT msc_demands_s.nextval
2125: INTO l_copy_demand_id(l_copy_demand_id.COUNT)
2126: FROM dual;
2127: END IF;
2128: END LOOP;

Line 2432: msc_sch_wb.atp_debug('Remove_Invalid_SD_Rec: ' || 'delete stealing demand from msc_demands, demand_id = '||

2428:
2429: IF NVL(c1.char1, '@@@') <> '@@@' THEN
2430:
2431: IF PG_DEBUG in ('Y', 'C') THEN
2432: msc_sch_wb.atp_debug('Remove_Invalid_SD_Rec: ' || 'delete stealing demand from msc_demands, demand_id = '||
2433: c1.identifier3);
2434: END IF;
2435:
2436: DELETE FROM MSC_DEMANDS

Line 2436: DELETE FROM MSC_DEMANDS

2432: msc_sch_wb.atp_debug('Remove_Invalid_SD_Rec: ' || 'delete stealing demand from msc_demands, demand_id = '||
2433: c1.identifier3);
2434: END IF;
2435:
2436: DELETE FROM MSC_DEMANDS
2437: WHERE demand_id = c1.identifier3
2438: AND plan_id = c1.identifier2;
2439: END IF;
2440: END IF; -- IF NVL(c1.inventory_item_id, -1) > 0 THEN

Line 2457: DELETE FROM MSC_DEMANDS

2453:
2454: -- Bug 1661545, if scheduling was unsuccessful, old demand record needs to be
2455: -- preserved back, as it was updated to 0 in the begining in case of reschedule in PDS.
2456:
2457: DELETE FROM MSC_DEMANDS
2458: WHERE demand_id = c1.identifier3
2459: AND plan_id = c1.identifier2
2460: AND old_demand_quantity IS NULL
2461: -- for bug 2120698, need to get the date and quantity from here

Line 3204: UPDATE msc_demands

3200: IF MSC_ATP_PVT.G_DIAGNOSTIC_ATP <> 1 THEN
3201:
3202: l_prim_uom_dmd_qty := p_quantity * nvl(p_uom_conv_rate, 1);
3203:
3204: UPDATE msc_demands
3205: SET USING_REQUIREMENT_QUANTITY = MSC_ATP_UTILS.Truncate_Demand(l_prim_uom_dmd_qty),
3206: -- 24x7 -- 5598066
3207: atp_synchronization_flag = 0
3208: WHERE demand_id = l_demand_id

Line 3588: UPDATE MSC_DEMANDS

3584: IF PG_DEBUG in ('Y', 'C') THEN
3585: msc_sch_wb.atp_debug('Inside If of else p_plan_id = -1'); --bug3397904
3586: END IF;
3587:
3588: UPDATE MSC_DEMANDS
3589: SET
3590: --start changes for plan by request date
3591: SCHEDULE_SHIP_DATE = TRUNC(NVL(p_supply_demand_date,SCHEDULE_SHIP_DATE)) + MSC_ATP_PVT.G_END_OF_DAY,
3592: USING_ASSEMBLY_DEMAND_DATE =

Line 3633: -- bug 2795053-reopen (ssurendr) update the demand_satisfied_date in msc_demands

3629: --end changes for plan by request date
3630: USING_REQUIREMENT_QUANTITY = MSC_ATP_UTILS.Truncate_Demand(NVL(p_supply_demand_qty,USING_REQUIREMENT_QUANTITY)), -- Bug 1501787
3631: -- 24x7 -- 5598066
3632: ATP_SYNCHRONIZATION_FLAG = 0,
3633: -- bug 2795053-reopen (ssurendr) update the demand_satisfied_date in msc_demands
3634: DMD_SATISFIED_DATE = TRUNC(GREATEST(p_dmd_satisfied_date,DMD_SATISFIED_DATE)) + MSC_ATP_PVT.G_END_OF_DAY,
3635: -- ship_rec_cal changes begin
3636: SCHEDULE_ARRIVAL_DATE = NVL(p_sch_arrival_date, SCHEDULE_ARRIVAL_DATE),
3637: ORDER_DATE_TYPE_CODE = NVL(p_order_date_type, ORDER_DATE_TYPE_CODE),

Line 3952: UPDATE msc_demands

3948: END LOOP;
3949: END IF;
3950:
3951: FORALL m IN 1..p_del_demand_ids.COUNT
3952: UPDATE msc_demands
3953: SET using_requirement_quantity = MSC_ATP_UTILS.Truncate_Demand(old_demand_quantity), -- 5598066
3954: -- bug 2863322 : change the column used to store date
3955: using_assembly_demand_date = old_using_assembly_demand_date,
3956: inventory_item_id = p_inv_item_ids(m),

Line 4025: DELETE FROM MSC_DEMANDS

4021: ELSE
4022:
4023: -- Delete from MSC_ALLOC_DEMANDS
4024: FORALL i IN 1..p_copy_demand_ids.COUNT
4025: DELETE FROM MSC_DEMANDS
4026: WHERE demand_id = p_copy_demand_ids(i)
4027: AND plan_id = p_copy_plan_ids(i);
4028:
4029: END IF;

Line 4054: from msc_demands but for time phased ATP inventory item id in msc_demands

4050: END IF;
4051:
4052: /*bug 6642564 we do no want inventory item id to be updated
4053: in case of time phased ATP as,the inventory item id we are picking up
4054: from msc_demands but for time phased ATP inventory item id in msc_demands
4055: is of member item and msc_alloc_demands could me member item of product
4056: family item */
4057:
4058: IF p_time_phased_set = 'Y' THEN

Line 4877: DELETE FROM msc_demands

4873:
4874: msc_sch_wb.atp_debug('Delete_Copy_Demand : ' || 'unallocated ATP');
4875:
4876: FORALL i IN 1..p_copy_demand_ids.COUNT
4877: DELETE FROM msc_demands
4878: WHERE demand_id = p_copy_demand_ids(i)
4879: AND plan_id = p_copy_plan_ids(i)
4880: AND refresh_number <= (SELECT nvl(latest_refresh_number,-1)
4881: FROM MSC_PLANS

Line 4920: UPDATE MSC_DEMANDS

4916: msc_sch_wb.atp_debug('Flush_Data_In_Pds : ' || 'override_flag : ' || p_ship_arrival_date_rec.atp_override_flag);
4917: END IF;
4918:
4919: -- Update PDS
4920: UPDATE MSC_DEMANDS
4921: SET SCHEDULE_ARRIVAL_DATE = p_ship_arrival_date_rec.scheduled_arrival_date,
4922: LATEST_ACCEPTABLE_DATE = p_ship_arrival_date_rec.latest_acceptable_date,
4923: ORDER_DATE_TYPE_CODE = p_ship_arrival_date_rec.order_date_type,
4924: SHIP_SET_NAME = p_ship_arrival_date_rec.ship_set_name,--plan by request date

Line 6026: UPDATE MSC_DEMANDS

6022: END IF;
6023: END IF;
6024: IF NVL(c1.char1, '@@@') <> '@@@' THEN
6025:
6026: UPDATE MSC_DEMANDS
6027: SET inventory_item_id = -1*inventory_item_id
6028: WHERE demand_id = c1.identifier3
6029: AND plan_id = c1.identifier2
6030: AND inventory_item_id > 0;

Line 6041: UPDATE MSC_DEMANDS

6037: ELSE -- IF c1.supply_demand_type = 2 THEN
6038: -- update the demand records we may have entrered.
6039: IF NVL(c1.inventory_item_id, -1) > 0 and c1.identifier2 <> -1 THEN
6040:
6041: UPDATE MSC_DEMANDS
6042: SET inventory_item_id = -1*inventory_item_id
6043: WHERE demand_id = c1.identifier3
6044: AND plan_id = c1.identifier2
6045: AND old_demand_quantity IS NULL

Line 6201: DELETE FROM MSC_DEMANDS

6197: END IF;
6198: END IF;
6199: IF NVL(c1.char1, '@@@') <> '@@@' THEN
6200:
6201: DELETE FROM MSC_DEMANDS
6202: WHERE demand_id = c1.identifier3
6203: AND plan_id = c1.identifier2;
6204:
6205: IF PG_DEBUG in ('Y', 'C') THEN

Line 6215: DELETE FROM MSC_DEMANDS

6211: ELSE -- IF c1.supply_demand_type = 2 THEN
6212: -- delete the demand records we may have entrered.
6213: IF NVL(c1.inventory_item_id, -1) > 0 and c1.identifier2 <> -1 THEN
6214:
6215: DELETE FROM MSC_DEMANDS
6216: WHERE demand_id = c1.identifier3
6217: AND plan_id = c1.identifier2
6218: AND old_demand_quantity IS NULL;
6219:

Line 6372: UPDATE MSC_DEMANDS

6368: END IF;
6369: END IF;
6370: IF NVL(c1.char1, '@@@') <> '@@@' THEN
6371:
6372: UPDATE MSC_DEMANDS
6373: SET inventory_item_id = -1*inventory_item_id
6374: WHERE demand_id = c1.identifier3
6375: AND plan_id = c1.identifier2
6376: AND inventory_item_id < 0;

Line 6388: UPDATE MSC_DEMANDS

6384: ELSE -- IF c1.supply_demand_type = 2 THEN
6385: -- update the demand records we may have entrered.
6386: IF NVL(c1.inventory_item_id, -1) > 0 and c1.identifier2 <> -1 THEN
6387:
6388: UPDATE MSC_DEMANDS
6389: SET inventory_item_id = -1*inventory_item_id
6390: WHERE demand_id = c1.identifier3
6391: AND plan_id = c1.identifier2
6392: AND old_demand_quantity IS NULL