DBA Data[Home] [Help]

APPS.CSTPLENG dependencies on CST_INV_LAYERS

Line 1198: from cst_inv_layers cil, cst_inv_layer_cost_details cilcd

1194: i_req_id,
1195: i_prg_appl_id,
1196: i_prg_id,
1197: sysdate
1198: from cst_inv_layers cil, cst_inv_layer_cost_details cilcd
1199: where cil.inv_layer_id = cilcd.inv_layer_id
1200: and cil.layer_id = cilcd.layer_id
1201: and cil.inv_layer_id = i_actual_layer_id;
1202:

Line 1273: from cst_inv_layers cil, cst_inv_layer_cost_details cilcd

1269: i_req_id,
1270: i_prg_appl_id,
1271: i_prg_id,
1272: sysdate
1273: from cst_inv_layers cil, cst_inv_layer_cost_details cilcd
1274: where cil.inv_layer_id = cilcd.inv_layer_id
1275: and cil.layer_id = cilcd.layer_id
1276: and cil.inv_layer_id = i_actual_layer_id;
1277:

Line 1315: -- create inventory layers using the sequence cst_inv_layers_s --

1311: -- * If layer created has positive quantity, then replenish all --
1312: -- negative inventory layers --
1313: -- --
1314: -- PURPOSE: --
1315: -- create inventory layers using the sequence cst_inv_layers_s --
1316: -- --
1317: -- PARAMETERS: --
1318: -- i_txn_qty : primary quantity --
1319: -- i_interorg_rec : interorg shimpment (= 0), --

Line 1573: FROM cst_inv_layers

1569: /* Find the inventory layer last created */
1570: l_stmt_num := 30;
1571: SELECT nvl(MAX(inv_layer_id),-1)
1572: INTO l_inv_layer_id
1573: FROM cst_inv_layers
1574: WHERE layer_id = i_layer_id;
1575:
1576: IF (l_debug = 'Y') THEN
1577: FND_FILE.PUT_LINE(FND_FILE.LOG,'Last Inventory Layer : ' || l_inv_layer_id);

Line 1716: FROM cst_inv_layers cil,

1712: /* Check that there is no negative layer other than the last inventory layer that is negative */
1713: l_stmt_num := 55;
1714: SELECT COUNT(*)
1715: INTO l_count
1716: FROM cst_inv_layers cil,
1717: cst_quantity_layers cql
1718: WHERE cql.layer_id = i_layer_id
1719: AND cil.inv_layer_id = l_inv_layer_id
1720: AND cil.layer_quantity < 0

Line 1733: FROM cst_inv_layers

1729: created the last inventory layer */
1730: l_stmt_num := 60;
1731: SELECT create_transaction_id
1732: INTO l_last_txn_id
1733: FROM cst_inv_layers
1734: WHERE inv_layer_id = l_inv_layer_id;
1735:
1736: IF (l_debug = 'Y') THEN
1737: FND_FILE.PUT_LINE(FND_FILE.LOG,'l_last_txn_id '||l_last_txn_id);

Line 1841: FROM cst_inv_layers

1837:
1838:
1839: SELECT nvl(SUM(layer_cost),0)
1840: INTO l_last_layer_cost
1841: FROM cst_inv_layers
1842: WHERE organization_id = i_org_id
1843: AND layer_id = i_layer_id
1844: AND inv_layer_id = l_inv_layer_id;
1845:

Line 1913: UPDATE cst_inv_layers

1909: l_src_number := get_source_number(i_txn_id,i_txn_src_type,l_src_id);
1910:
1911: /* Update last created inventory layer */
1912: l_stmt_num := 90;
1913: UPDATE cst_inv_layers
1914: SET creation_quantity = creation_quantity + i_txn_qty,
1915: layer_quantity = layer_quantity + i_txn_qty,
1916: transaction_source_id = decode(transaction_source_id, l_src_id, l_src_id, null),
1917: transaction_source = decode(transaction_source, l_src_number, l_src_number, null),

Line 1931: SELECT cst_inv_layers_s.nextval

1927: WHERE inv_layer_id = l_inv_layer_id;
1928: ELSE
1929: /* Generate Inv Layer ID */
1930: l_stmt_num := 95;
1931: SELECT cst_inv_layers_s.nextval
1932: INTO l_inv_layer_id
1933: FROM dual;
1934:
1935: IF (l_debug = 'Y') THEN

Line 1962: /* Create inventory layer with 0 cost in CST_INV_LAYERS */

1958: /* Get transaction source name */
1959: l_stmt_num := 110;
1960: l_src_number := get_source_number(i_txn_id,i_txn_src_type,l_src_id);
1961:
1962: /* Create inventory layer with 0 cost in CST_INV_LAYERS */
1963: l_stmt_num := 115;
1964: INSERT
1965: INTO cst_inv_layers (
1966: layer_id,

Line 1965: INTO cst_inv_layers (

1961:
1962: /* Create inventory layer with 0 cost in CST_INV_LAYERS */
1963: l_stmt_num := 115;
1964: INSERT
1965: INTO cst_inv_layers (
1966: layer_id,
1967: inv_layer_id,
1968: organization_id,
1969: inventory_item_id,

Line 2070: UPDATE cst_inv_layers

2066: FND_FILE.PUT_LINE(FND_FILE.LOG, sql%rowcount || ' records copied from mclacd for ' || l_inv_layer_id);
2067: /* Update layer cost in CIL */
2068: l_stmt_num := 130;
2069: IF (nvl(i_interorg_rec,-1) <> 3) THEN
2070: UPDATE cst_inv_layers
2071: SET layer_cost = (
2072: SELECT SUM(layer_cost)
2073: FROM cst_inv_layer_cost_details
2074: WHERE inv_layer_id = l_inv_layer_id

Line 2099: sql_stmt := 'select inv_layer_id, layer_quantity from cst_inv_layers ' ||

2095: END IF; /* l_create = 0 */
2096:
2097: /* Create cursor to find any negative layers, order in FIFO/LIFO method */
2098: IF (i_txn_qty > 0) THEN
2099: sql_stmt := 'select inv_layer_id, layer_quantity from cst_inv_layers ' ||
2100: 'where layer_id = :i and layer_quantity < 0 order by creation_date';
2101:
2102: IF (i_cost_method = 6) THEN
2103: sql_stmt := sql_stmt || ' desc,inv_layer_id desc';

Line 2173: UPDATE cst_inv_layers

2169: /* Update quantity for the negative layer and the quantity available
2170: for replenishment */
2171: IF (nvl(i_interorg_rec,-1) <> 3) THEN
2172: l_stmt_num := 140;
2173: UPDATE cst_inv_layers
2174: SET layer_quantity = l_neg_layer_qty + l_qty
2175: WHERE inv_layer_id = l_neg_layer_id;
2176: END IF;
2177:

Line 2224: UPDATE cst_inv_layers

2220: IF (l_neg_layer_iD=l_inv_layer_id) THEN
2221:
2222: IF (nvl(i_interorg_rec,-1) <> 3) THEN
2223:
2224: UPDATE cst_inv_layers
2225: SET layer_quantity=layer_quantity-l_qty
2226: WHERE inv_layer_id = l_inv_layer_id;
2227: END IF;
2228:

Line 2232: UPDATE cst_inv_layers

2228:
2229: ELSE
2230:
2231: IF (nvl(i_interorg_rec,-1) <> 3) THEN
2232: UPDATE cst_inv_layers
2233: SET layer_quantity = l_qty_available
2234: WHERE inv_layer_id = l_inv_layer_id;
2235: END IF;
2236: END IF;/* END OF #BUG6722228 */

Line 2332: from cst_inv_layers

2328: FND_FILE.PUT_LINE(FND_FILE.LOG,'Consuming inventory layers from CG layer : ' || to_char(i_layer_id));
2329: end if;
2330: select count(*)
2331: into l_layers_exist
2332: from cst_inv_layers
2333: where layer_id = i_layer_id;
2334:
2335: if (l_layers_exist = 0) then
2336: if (l_debug = 'Y') then

Line 2840: update cst_inv_layers

2836: end if;
2837: end if; /* l_err_num = 999 */
2838: l_stmt_num := 70;
2839: if ((nvl(i_interorg_rec,-1) <> 3) and (i_exp_flag <> 1)) then
2840: update cst_inv_layers
2841: set layer_quantity = nvl(layer_quantity,0)-l_inv_layer_table(i).layer_quantity
2842: where inv_layer_id = l_inv_layer_table(i).inv_layer_id;
2843: if (l_debug = 'Y') then
2844: FND_FILE.PUT_LINE(FND_FILE.LOG,'CIL.layer_qty changed by ' || to_char(l_inv_layer_table(i).layer_quantity));

Line 2954: FROM cst_inv_layers

2950: IF i_cost_method = 5 THEN
2951: l_stmt_num := 10;
2952: SELECT MIN(inv_layer_id)
2953: INTO l_inv_layer_id
2954: FROM cst_inv_layers
2955: WHERE layer_id = i_layer_id
2956: AND layer_quantity > 0;
2957: ELSE
2958: l_stmt_num := 15;

Line 2961: FROM cst_inv_layers

2957: ELSE
2958: l_stmt_num := 15;
2959: SELECT MAX(inv_layer_id)
2960: INTO l_inv_layer_id
2961: FROM cst_inv_layers
2962: WHERE layer_id = i_layer_id
2963: AND layer_quantity > 0;
2964: END IF;
2965: /* If no positive layers exist, pick the latest layer */

Line 2970: FROM cst_inv_layers

2966: IF l_inv_layer_id IS NULL THEN
2967: l_stmt_num := 20;
2968: SELECT MAX(inv_layer_id)
2969: INTO l_inv_layer_id
2970: FROM cst_inv_layers
2971: WHERE layer_id = i_layer_id;
2972: END IF;
2973: l_inv_layer_rec.inv_layer_id := l_inv_layer_id;
2974: l_inv_layer_rec.layer_quantity := l_required_qty;

Line 3011: FROM cst_inv_layers

3007: END IF;
3008: l_stmt_num := 30;
3009: SELECT inv_layer_id, layer_quantity
3010: INTO l_inv_layer_rec.inv_layer_id,l_inv_layer_rec.layer_quantity
3011: FROM cst_inv_layers
3012: WHERE inv_layer_id = l_custom_layer -- inventory layer id exists
3013: AND layer_id = i_layer_id; -- correct organization, item, cost group
3014: IF l_inv_layer_rec.layer_quantity > 0 THEN
3015: IF l_required_qty < l_inv_layer_rec.layer_quantity THEN

Line 3040: FROM cst_inv_layers

3036: END IF;
3037: l_stmt_num := 40;
3038: SELECT count(*)
3039: INTO l_pos_layer_exist
3040: FROM cst_inv_layers
3041: WHERE layer_id = i_layer_id
3042: AND inv_layer_id <> l_custom_layer
3043: AND layer_quantity > 0;
3044: IF l_pos_layer_exist = 0 THEN

Line 3095: FROM cst_inv_layers

3091: l_stmt_num := 55;
3092: BEGIN
3093: SELECT inv_layer_id, l_custom_layers(i).layer_quantity
3094: INTO l_inv_layer_rec.inv_layer_id, l_inv_layer_rec.layer_quantity
3095: FROM cst_inv_layers
3096: WHERE inv_layer_id = l_custom_layers(i).inv_layer_id -- valid inventory layer id
3097: AND layer_id = i_layer_id -- valid org, item, cost group
3098: AND layer_quantity >=
3099: l_custom_layers(i).layer_quantity -- enough quantity

Line 3174: ||' FROM cst_inv_layers'

3170: END IF;
3171: END;
3172: l_stmt_num := 75;
3173: sql_stmt := 'SELECT inv_layer_id, layer_quantity'
3174: ||' FROM cst_inv_layers'
3175: ||' WHERE create_transaction_id = :i'
3176: ||' AND layer_quantity > 0'
3177: ||' AND inv_layer_id <> :j';
3178: IF l_layers_hook > 0 THEN

Line 3210: sql_stmt := 'SELECT inv_layer_id,layer_quantity FROM cst_inv_layers'

3206: IF l_debug = 'Y' THEN
3207: fnd_file.put_line(fnd_file.log,'Trying other layers with the same source');
3208: END IF;
3209: l_stmt_num := 90;
3210: sql_stmt := 'SELECT inv_layer_id,layer_quantity FROM cst_inv_layers'
3211: ||' WHERE layer_id = :i AND transaction_source_id = :j AND layer_quantity > 0 '
3212: ||' AND create_transaction_id <> :k AND inv_layer_id <> :l';
3213: IF l_layers_hook > 0 THEN
3214: l_stmt_num := 95;

Line 3256: sql_stmt := 'SELECT inv_layer_id, layer_quantity FROM cst_inv_layers'

3252: 'Driving earliest/latest layer with the same source negative?'
3253: );
3254: END IF;
3255: l_stmt_num := 115;
3256: sql_stmt := 'SELECT inv_layer_id, layer_quantity FROM cst_inv_layers'
3257: ||' WHERE layer_id = :i AND inv_layer_id <> :j'
3258: ||' AND NVL(transaction_source_id,-2) <> :k'
3259: ||' AND layer_quantity > 0';
3260: IF l_layers_hook > 0 THEN

Line 3278: FROM cst_inv_layers

3274: IF i_cost_method = 5 THEN
3275: l_stmt_num := 125;
3276: SELECT MAX(inv_layer_id)
3277: INTO l_inv_layer_rec.inv_layer_id
3278: FROM cst_inv_layers
3279: WHERE layer_id = i_layer_id
3280: AND transaction_source_id = l_source_id;
3281: ELSE
3282: l_stmt_num := 130;

Line 3285: FROM cst_inv_layers

3281: ELSE
3282: l_stmt_num := 130;
3283: SELECT MIN(inv_layer_id)
3284: INTO l_inv_layer_rec.inv_layer_id
3285: FROM cst_inv_layers
3286: WHERE layer_id = i_layer_id
3287: AND transaction_source_id = l_source_id;
3288: END IF;
3289: IF l_inv_layer_rec.inv_layer_id IS NOT NULL THEN

Line 3312: sql_stmt := 'SELECT inv_layer_id,layer_quantity FROM cst_inv_layers WHERE layer_id = :i'

3308: IF l_debug = 'Y' THEN
3309: fnd_file.put_line(fnd_file.log,'General consumption');
3310: END IF;
3311: l_stmt_num := 140;
3312: sql_stmt := 'SELECT inv_layer_id,layer_quantity FROM cst_inv_layers WHERE layer_id = :i'
3313: ||' AND inv_layer_id <> :j AND NVL(transaction_source_id,-2) <> :k'
3314: ||' AND layer_quantity > 0';
3315: l_stmt_num := 145;
3316: IF l_layers_hook > 0 THEN

Line 3356: sql_stmt := 'SELECT inv_layer_id,layer_quantity FROM cst_inv_layers WHERE layer_id = :i';

3352: IF l_debug = 'Y' THEN
3353: FND_FILE.PUT_LINE(FND_FILE.LOG,'l_neg_qty ' || to_char(l_required_qty));
3354: END IF;
3355: l_stmt_num := 165;
3356: sql_stmt := 'SELECT inv_layer_id,layer_quantity FROM cst_inv_layers WHERE layer_id = :i';
3357: IF i_cost_method = 5 THEN
3358: sql_stmt := sql_stmt || ' ORDER BY creation_date DESC,inv_layer_id DESC';
3359: ELSE
3360: sql_stmt := sql_stmt || ' ORDER BY creation_date,inv_layer_id';

Line 4419: from cst_inv_layers cil

4415: ********************************************************************/
4416: -- get the total layer quantity from cil
4417: select sum(cil.layer_quantity)
4418: into l_total_layer_qty
4419: from cst_inv_layers cil
4420: where cil.layer_id = i_layer_id;
4421:
4422: /* Update clcd only if i_no_update_qty flag is not set and the total layer quantity is not zero */
4423:

Line 4430: from cst_inv_layers cil

4426: l_stmt_num := 20;
4427: -- get the total layer quantity from cil
4428: select sum(cil.layer_quantity)
4429: into l_total_layer_qty
4430: from cst_inv_layers cil
4431: where cil.layer_id = i_layer_id;
4432:
4433: l_stmt_num := 25;
4434:

Line 4468: cst_inv_layers cil

4464: i_prg_id,
4465: sysdate,
4466: (sum((cilcd.layer_cost*cil.layer_quantity)/l_total_layer_qty)) -- modified for bug#3835412
4467: from cst_inv_layer_cost_details cilcd,
4468: cst_inv_layers cil
4469: where cil.layer_id = i_layer_id
4470: and cil.organization_id = i_org_id
4471: and cil.inventory_item_id = i_item_id
4472: and cil.inv_layer_id = cilcd.inv_layer_id

Line 4867: cst_inv_layers cil,

4863: 0
4864: )
4865: )
4866: FROM mtl_cst_txn_cost_details ctcd,
4867: cst_inv_layers cil,
4868: cst_inv_layer_cost_details cilcd
4869: WHERE ctcd.transaction_id = i_txn_id
4870: AND ctcd.organization_id = i_org_id
4871: AND cil.layer_id = i_layer_id

Line 4942: ** Update cst_inv_layers **

4938: and mclacd.layer_id = i_layer_id
4939: and mclacd.inv_layer_id = l_inv_layer_id;
4940:
4941: /********************************************************************
4942: ** Update cst_inv_layers **
4943: ********************************************************************/
4944: l_stmt_num := 50;
4945:
4946: update cst_inv_layers cil

Line 4946: update cst_inv_layers cil

4942: ** Update cst_inv_layers **
4943: ********************************************************************/
4944: l_stmt_num := 50;
4945:
4946: update cst_inv_layers cil
4947: set (last_updated_by,
4948: last_update_date,
4949: last_update_login,
4950: request_id,

Line 4985: from cst_inv_layers cil

4981:
4982: -- Get transaction quantity
4983: select cil.layer_quantity
4984: into l_layer_qty
4985: from cst_inv_layers cil
4986: where cil.layer_id = i_layer_id
4987: and cil.inv_layer_id = l_inv_layer_id;
4988:
4989: FND_FILE.PUT_LINE(FND_FILE.LOG, 'layer qty = ' || to_char(l_layer_qty));

Line 5110: from cst_inv_layers

5106: if (l_cost_method = 5) then
5107: /* Try to return the first positive layer */
5108: select nvl(min(inv_layer_id),0)
5109: into l_inv_layer_id
5110: from cst_inv_layers
5111: where layer_id = i_layer_id
5112: and layer_quantity > 0;
5113: /* If there is no positive layer, return the last layer */
5114: if l_inv_layer_id = 0 then

Line 5117: from cst_inv_layers

5113: /* If there is no positive layer, return the last layer */
5114: if l_inv_layer_id = 0 then
5115: select nvl(max(inv_layer_id),0)
5116: into l_inv_layer_id
5117: from cst_inv_layers
5118: where layer_id = i_layer_id;
5119: end if;
5120: elsif (l_cost_method = 6) then
5121: /* Try to return the last positive layer */

Line 5124: from cst_inv_layers

5120: elsif (l_cost_method = 6) then
5121: /* Try to return the last positive layer */
5122: select nvl(max(inv_layer_id), 0)
5123: into l_inv_layer_id
5124: from cst_inv_layers
5125: where layer_id = i_layer_id
5126: and layer_quantity > 0;
5127: /* If there is no positive layer, return the first layer */
5128: if l_inv_layer_id = 0 then

Line 5131: from cst_inv_layers

5127: /* If there is no positive layer, return the first layer */
5128: if l_inv_layer_id = 0 then
5129: select nvl(min(inv_layer_id),0)
5130: into l_inv_layer_id
5131: from cst_inv_layers
5132: where layer_id = i_layer_id;
5133: end if;
5134: end if;
5135:

Line 5139: select cst_inv_layers_s.nextval

5135:
5136: if (l_inv_layer_id = 0) then
5137: /* No inv layers exist: Hence create one with 0 qty,cost */
5138:
5139: select cst_inv_layers_s.nextval
5140: into l_inv_layer_id
5141: from dual;
5142:
5143: insert into cst_inv_layers (

Line 5143: insert into cst_inv_layers (

5139: select cst_inv_layers_s.nextval
5140: into l_inv_layer_id
5141: from dual;
5142:
5143: insert into cst_inv_layers (
5144: create_transaction_id,
5145: layer_id,
5146: inv_layer_id,
5147: organization_id,

Line 5493: FROM CST_INV_LAYERS CIL,

5489:
5490:
5491: cursor cost_elmt_ids is
5492: SELECT CILCD.COST_ELEMENT_ID
5493: FROM CST_INV_LAYERS CIL,
5494: CST_INV_LAYER_COST_DETAILS CILCD
5495: WHERE CIL.LAYER_ID = l_layer_id
5496: AND CIL.INV_LAYER_ID = i_inv_layer_id
5497: AND CILCD.LAYER_ID = l_layer_id

Line 5551: FROM CST_INV_LAYERS

5547: end if;
5548:
5549: SELECT LAYER_COST
5550: INTO cil_layer_cost
5551: FROM CST_INV_LAYERS
5552: WHERE LAYER_ID = l_layer_id
5553: AND INV_LAYER_ID = i_inv_layer_id;
5554:
5555: /* for the case of layer cost equal zero */

Line 5608: FROM CST_INV_LAYERS CIL, CST_INV_LAYER_COST_DETAILS CILCD

5604: i_request_id,
5605: i_prog_appl_id,
5606: i_prog_id,
5607: sysdate
5608: FROM CST_INV_LAYERS CIL, CST_INV_LAYER_COST_DETAILS CILCD
5609: WHERE CIL.LAYER_ID = l_layer_id
5610: AND CIL.INV_LAYER_ID = i_inv_layer_id
5611: AND CILCD.LAYER_ID = l_layer_id
5612: AND CILCD.INV_LAYER_ID = i_inv_layer_id;

Line 6173: update cst_inv_layers

6169: i_login_id IN NUMBER)
6170: IS
6171:
6172: Begin
6173: update cst_inv_layers
6174: set last_updated_by = i_userid,
6175: last_update_date = sysdate,
6176: last_update_login = i_login_id,
6177: layer_cost = 0,

Line 6185: from cst_inv_layers

6181: and inventory_item_id = i_item_id;
6182:
6183: delete from cst_inv_layer_cost_details
6184: where inv_layer_id IN (select inv_layer_id
6185: from cst_inv_layers
6186: where organization_id = i_org_id
6187: and inventory_item_id = i_item_id);
6188: EXCEPTION
6189: when NO_DATA_FOUND then null;