8: -- --------- ------ ------------------------------------------
9: -- pparthas 07/24/03 Created Package
10: --
11:
12: g_asn_debug VARCHAR2(1) := asn_debug.is_debug_on; -- Bug 9152790
13:
14: PROCEDURE insert_rcv_lots_supply(
15: p_api_version IN NUMBER,
16: p_init_msg_list IN VARCHAR2,
92: l_txn_uom VARCHAR2(25);
93: l_primary_uom VARCHAR2(25);
94: l_to_org_id NUMBER;
95: BEGIN
96: IF (g_asn_debug = 'Y') THEN
97: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
98: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
99: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
100: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
93: l_primary_uom VARCHAR2(25);
94: l_to_org_id NUMBER;
95: BEGIN
96: IF (g_asn_debug = 'Y') THEN
97: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
98: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
99: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
100: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
101: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
94: l_to_org_id NUMBER;
95: BEGIN
96: IF (g_asn_debug = 'Y') THEN
97: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
98: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
99: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
100: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
101: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
102: END IF;
95: BEGIN
96: IF (g_asn_debug = 'Y') THEN
97: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
98: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
99: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
100: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
101: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
102: END IF;
103:
96: IF (g_asn_debug = 'Y') THEN
97: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
98: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
99: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
100: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
101: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
102: END IF;
103:
104: x_return_status := fnd_api.g_ret_sts_success;
97: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
98: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
99: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
100: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
101: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
102: END IF;
103:
104: x_return_status := fnd_api.g_ret_sts_success;
105:
117: IF (l_lot_count = 0) THEN
118: RETURN;
119: END IF;
120:
121: IF (g_asn_debug = 'Y') THEN
122: asn_debug.put_line('l_lot_count ' || l_lot_count);
123: END IF;
124:
125: /* We need to insert into rcv_lots_supply and
118: RETURN;
119: END IF;
120:
121: IF (g_asn_debug = 'Y') THEN
122: asn_debug.put_line('l_lot_count ' || l_lot_count);
123: END IF;
124:
125: /* We need to insert into rcv_lots_supply and
126: * rcv_serials_supply table only when we come through ROI
142: AND l_lpn_id = -999) THEN
143: RETURN;
144: END IF;
145:
146: IF (g_asn_debug = 'Y') THEN
147: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
148: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
149: END IF;
150:
143: RETURN;
144: END IF;
145:
146: IF (g_asn_debug = 'Y') THEN
147: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
148: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
149: END IF;
150:
151: SELECT transaction_id,
144: END IF;
145:
146: IF (g_asn_debug = 'Y') THEN
147: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
148: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
149: END IF;
150:
151: SELECT transaction_id,
152: organization_id
154: l_organization_id
155: FROM rcv_transactions rt
156: WHERE rt.interface_transaction_id = p_interface_transaction_id;
157:
158: IF (g_asn_debug = 'Y') THEN
159: asn_debug.put_line('before insert_lot_supply');
160: END IF;
161:
162: insert_lot_supply(p_interface_transaction_id,
155: FROM rcv_transactions rt
156: WHERE rt.interface_transaction_id = p_interface_transaction_id;
157:
158: IF (g_asn_debug = 'Y') THEN
159: asn_debug.put_line('before insert_lot_supply');
160: END IF;
161:
162: insert_lot_supply(p_interface_transaction_id,
163: 'RECEIVING',
164: p_supply_source_id,
165: x_return_status
166: );
167:
168: IF (g_asn_debug = 'Y') THEN
169: asn_debug.put_line('After insert_lot_supply');
170: END IF;
171:
172: /* If this is a receive for an internal shipment or interorg transfer
165: x_return_status
166: );
167:
168: IF (g_asn_debug = 'Y') THEN
169: asn_debug.put_line('After insert_lot_supply');
170: END IF;
171:
172: /* If this is a receive for an internal shipment or interorg transfer
173: * then we need to update the values for the shipment
188: * into multiple shipment_lines (when lpn has 2 lots for eg).
189: * So instead of using shipment_line_id to delete use
190: * shipment_header_id.
191: */
192: IF (g_asn_debug = 'Y') THEN
193: asn_debug.put_line('In insert rcv_lots_supply for source type code INVENTORY or REQ');
194: END IF;
195:
196: OPEN lot_numbers(p_interface_transaction_id);
189: * So instead of using shipment_line_id to delete use
190: * shipment_header_id.
191: */
192: IF (g_asn_debug = 'Y') THEN
193: asn_debug.put_line('In insert rcv_lots_supply for source type code INVENTORY or REQ');
194: END IF;
195:
196: OPEN lot_numbers(p_interface_transaction_id);
197:
194: END IF;
195:
196: OPEN lot_numbers(p_interface_transaction_id);
197:
198: IF (g_asn_debug = 'Y') THEN
199: asn_debug.put_line('Opened lot_numbers cursor');
200: END IF;
201:
202: LOOP --{
195:
196: OPEN lot_numbers(p_interface_transaction_id);
197:
198: IF (g_asn_debug = 'Y') THEN
199: asn_debug.put_line('Opened lot_numbers cursor');
200: END IF;
201:
202: LOOP --{
203: FETCH lot_numbers INTO l_lot_num,
208: l_txn_uom,
209: l_to_org_id;
210: EXIT WHEN lot_numbers%NOTFOUND;
211:
212: IF (g_asn_debug = 'Y') THEN
213: asn_debug.put_line('After fetch');
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
209: l_to_org_id;
210: EXIT WHEN lot_numbers%NOTFOUND;
211:
212: IF (g_asn_debug = 'Y') THEN
213: asn_debug.put_line('After fetch');
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
210: EXIT WHEN lot_numbers%NOTFOUND;
211:
212: IF (g_asn_debug = 'Y') THEN
213: asn_debug.put_line('After fetch');
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
211:
212: IF (g_asn_debug = 'Y') THEN
213: asn_debug.put_line('After fetch');
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
219: asn_debug.put_line('l_txn_uom ' || l_txn_uom);
212: IF (g_asn_debug = 'Y') THEN
213: asn_debug.put_line('After fetch');
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
219: asn_debug.put_line('l_txn_uom ' || l_txn_uom);
220: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
213: asn_debug.put_line('After fetch');
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
219: asn_debug.put_line('l_txn_uom ' || l_txn_uom);
220: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
221: END IF;
214: asn_debug.put_line('l_lot_num ' || l_lot_num);
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
219: asn_debug.put_line('l_txn_uom ' || l_txn_uom);
220: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
221: END IF;
222:
215: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
219: asn_debug.put_line('l_txn_uom ' || l_txn_uom);
220: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
221: END IF;
222:
223: SELECT MAX(primary_unit_of_measure)
216: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
217: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
218: asn_debug.put_line('l_item_id ' || l_item_id);
219: asn_debug.put_line('l_txn_uom ' || l_txn_uom);
220: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
221: END IF;
222:
223: SELECT MAX(primary_unit_of_measure)
224: INTO l_primary_uom
225: FROM mtl_system_items
226: WHERE mtl_system_items.inventory_item_id = l_item_id
227: AND mtl_system_items.organization_id = l_to_org_id;
228:
229: IF (g_asn_debug = 'Y') THEN
230: asn_debug.put_line('l_primary_uom ' || l_primary_uom);
231: END IF;
232:
233: /* l_qty_to_be_updated shd be in
226: WHERE mtl_system_items.inventory_item_id = l_item_id
227: AND mtl_system_items.organization_id = l_to_org_id;
228:
229: IF (g_asn_debug = 'Y') THEN
230: asn_debug.put_line('l_primary_uom ' || l_primary_uom);
231: END IF;
232:
233: /* l_qty_to_be_updated shd be in
234: * terms of the parent's uom. For
238: OPEN supply_quantity(l_lot_num,
239: l_ship_line_id --Bug 7443786
240: );
241:
242: IF (g_asn_debug = 'Y') THEN
243: asn_debug.put_line('Opened supply_quantity cursor');
244: END IF;
245:
246: /* add rowid for bug 9839004 */
239: l_ship_line_id --Bug 7443786
240: );
241:
242: IF (g_asn_debug = 'Y') THEN
243: asn_debug.put_line('Opened supply_quantity cursor');
244: END IF;
245:
246: /* add rowid for bug 9839004 */
247: LOOP --{
249: l_rls_primary_qty;
250: EXIT WHEN supply_quantity%NOTFOUND
251: OR l_primary_qty_to_be_updated = 0;
252:
253: IF (g_asn_debug = 'Y') THEN
254: asn_debug.put_line('l_rowid ' || l_rowid);
255: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
256: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
257: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
250: EXIT WHEN supply_quantity%NOTFOUND
251: OR l_primary_qty_to_be_updated = 0;
252:
253: IF (g_asn_debug = 'Y') THEN
254: asn_debug.put_line('l_rowid ' || l_rowid);
255: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
256: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
257: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
258: END IF;
251: OR l_primary_qty_to_be_updated = 0;
252:
253: IF (g_asn_debug = 'Y') THEN
254: asn_debug.put_line('l_rowid ' || l_rowid);
255: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
256: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
257: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
258: END IF;
259:
252:
253: IF (g_asn_debug = 'Y') THEN
254: asn_debug.put_line('l_rowid ' || l_rowid);
255: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
256: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
257: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
258: END IF;
259:
260: SELECT unit_of_measure
253: IF (g_asn_debug = 'Y') THEN
254: asn_debug.put_line('l_rowid ' || l_rowid);
255: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
256: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
257: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
258: END IF;
259:
260: SELECT unit_of_measure
261: INTO l_parent_uom
261: INTO l_parent_uom
262: FROM rcv_shipment_lines
263: WHERE shipment_line_id = l_ship_line_id;
264:
265: IF (g_asn_debug = 'Y') THEN
266: asn_debug.put_line('l_parent_uom ' || l_parent_uom);
267: END IF;
268:
269: IF (l_txn_uom <> l_parent_uom) THEN
262: FROM rcv_shipment_lines
263: WHERE shipment_line_id = l_ship_line_id;
264:
265: IF (g_asn_debug = 'Y') THEN
266: asn_debug.put_line('l_parent_uom ' || l_parent_uom);
267: END IF;
268:
269: IF (l_txn_uom <> l_parent_uom) THEN
270: l_qty_to_be_updated := rcv_transactions_interface_sv.convert_into_correct_qty(l_primary_qty_to_be_updated,
273: l_parent_uom
274: );
275: END IF;
276:
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
279: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
280: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
281: END IF;
274: );
275: END IF;
276:
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
279: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
280: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
281: END IF;
282:
275: END IF;
276:
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
279: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
280: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
281: END IF;
282:
283: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
276:
277: IF (g_asn_debug = 'Y') THEN
278: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
279: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
280: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
281: END IF;
282:
283: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
284: IF (g_asn_debug = 'Y') THEN
280: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
281: END IF;
282:
283: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('rls primary qty greater');
286: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
287: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
288: asn_debug.put_line('l_lot_num ' || l_lot_num);
281: END IF;
282:
283: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('rls primary qty greater');
286: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
287: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
288: asn_debug.put_line('l_lot_num ' || l_lot_num);
289: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
282:
283: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('rls primary qty greater');
286: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
287: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
288: asn_debug.put_line('l_lot_num ' || l_lot_num);
289: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
290: END IF;
283: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('rls primary qty greater');
286: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
287: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
288: asn_debug.put_line('l_lot_num ' || l_lot_num);
289: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
290: END IF;
291:
284: IF (g_asn_debug = 'Y') THEN
285: asn_debug.put_line('rls primary qty greater');
286: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
287: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
288: asn_debug.put_line('l_lot_num ' || l_lot_num);
289: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
290: END IF;
291:
292: /* add rowid for bug 9839004 */
285: asn_debug.put_line('rls primary qty greater');
286: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
287: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
288: asn_debug.put_line('l_lot_num ' || l_lot_num);
289: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
290: END IF;
291:
292: /* add rowid for bug 9839004 */
293: UPDATE rcv_lots_supply rls
300:
301: l_qty_to_be_updated := 0;
302: l_primary_qty_to_be_updated := 0;
303: ELSE --}{
304: IF (g_asn_debug = 'Y') THEN
305: asn_debug.put_line('rls primary qty lesser');
306: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
307: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
308: asn_debug.put_line('l_lot_num ' || l_lot_num);
301: l_qty_to_be_updated := 0;
302: l_primary_qty_to_be_updated := 0;
303: ELSE --}{
304: IF (g_asn_debug = 'Y') THEN
305: asn_debug.put_line('rls primary qty lesser');
306: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
307: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
308: asn_debug.put_line('l_lot_num ' || l_lot_num);
309: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
302: l_primary_qty_to_be_updated := 0;
303: ELSE --}{
304: IF (g_asn_debug = 'Y') THEN
305: asn_debug.put_line('rls primary qty lesser');
306: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
307: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
308: asn_debug.put_line('l_lot_num ' || l_lot_num);
309: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
310: END IF;
303: ELSE --}{
304: IF (g_asn_debug = 'Y') THEN
305: asn_debug.put_line('rls primary qty lesser');
306: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
307: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
308: asn_debug.put_line('l_lot_num ' || l_lot_num);
309: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
310: END IF;
311:
304: IF (g_asn_debug = 'Y') THEN
305: asn_debug.put_line('rls primary qty lesser');
306: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
307: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
308: asn_debug.put_line('l_lot_num ' || l_lot_num);
309: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
310: END IF;
311:
312: /* add rowid for bug 9839004 */
305: asn_debug.put_line('rls primary qty lesser');
306: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
307: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
308: asn_debug.put_line('l_lot_num ' || l_lot_num);
309: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
310: END IF;
311:
312: /* add rowid for bug 9839004 */
313: UPDATE rcv_lots_supply rls
320:
321: l_qty_to_be_updated := l_qty_to_be_updated - l_rls_qty;
322: l_primary_qty_to_be_updated := l_primary_qty_to_be_updated - l_rls_primary_qty;
323:
324: IF (g_asn_debug = 'Y') THEN
325: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
326: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
327: END IF;
328: END IF; --}
321: l_qty_to_be_updated := l_qty_to_be_updated - l_rls_qty;
322: l_primary_qty_to_be_updated := l_primary_qty_to_be_updated - l_rls_primary_qty;
323:
324: IF (g_asn_debug = 'Y') THEN
325: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
326: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
327: END IF;
328: END IF; --}
329: END LOOP; --}
322: l_primary_qty_to_be_updated := l_primary_qty_to_be_updated - l_rls_primary_qty;
323:
324: IF (g_asn_debug = 'Y') THEN
325: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
326: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
327: END IF;
328: END IF; --}
329: END LOOP; --}
330:
329: END LOOP; --}
330:
331: CLOSE supply_quantity;
332:
333: IF (g_asn_debug = 'Y') THEN
334: asn_debug.put_line('Close supply_quantity ');
335: END IF;
336: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
337: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
330:
331: CLOSE supply_quantity;
332:
333: IF (g_asn_debug = 'Y') THEN
334: asn_debug.put_line('Close supply_quantity ');
335: END IF;
336: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
337: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
338: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
333: IF (g_asn_debug = 'Y') THEN
334: asn_debug.put_line('Close supply_quantity ');
335: END IF;
336: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
337: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
338: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
339: /*Bug 13792458 when ISO or IOT from_organization is not lot controlled, it will not consume rcv_lots_supply quantity */
340: --asn_debug.put_line('SHIPMENT supply for above qty not available to consume..Fail the transaction...');
341: --raise NO_DATA_FOUND;
334: asn_debug.put_line('Close supply_quantity ');
335: END IF;
336: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
337: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
338: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
339: /*Bug 13792458 when ISO or IOT from_organization is not lot controlled, it will not consume rcv_lots_supply quantity */
340: --asn_debug.put_line('SHIPMENT supply for above qty not available to consume..Fail the transaction...');
341: --raise NO_DATA_FOUND;
342: /*End Bug 13792458 */
336: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
337: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
338: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
339: /*Bug 13792458 when ISO or IOT from_organization is not lot controlled, it will not consume rcv_lots_supply quantity */
340: --asn_debug.put_line('SHIPMENT supply for above qty not available to consume..Fail the transaction...');
341: --raise NO_DATA_FOUND;
342: /*End Bug 13792458 */
343: END IF; --Bug 7443786
344: END LOOP; --}
344: END LOOP; --}
345:
346: CLOSE lot_numbers;
347:
348: IF (g_asn_debug = 'Y') THEN
349: asn_debug.put_line('Close lot_numbers cursor for source type code INVENTORY or REQ');
350: END IF;
351: END IF; --}
352: /* END IF; */
345:
346: CLOSE lot_numbers;
347:
348: IF (g_asn_debug = 'Y') THEN
349: asn_debug.put_line('Close lot_numbers cursor for source type code INVENTORY or REQ');
350: END IF;
351: END IF; --}
352: /* END IF; */
353:
350: END IF;
351: END IF; --}
352: /* END IF; */
353:
354: IF (g_asn_debug = 'Y') THEN
355: asn_debug.put_line('Exit insert_rcv_lots_supply');
356: END IF;
357: EXCEPTION
358: WHEN NO_DATA_FOUND THEN
351: END IF; --}
352: /* END IF; */
353:
354: IF (g_asn_debug = 'Y') THEN
355: asn_debug.put_line('Exit insert_rcv_lots_supply');
356: END IF;
357: EXCEPTION
358: WHEN NO_DATA_FOUND THEN
359: IF (g_asn_debug = 'Y') THEN
355: asn_debug.put_line('Exit insert_rcv_lots_supply');
356: END IF;
357: EXCEPTION
358: WHEN NO_DATA_FOUND THEN
359: IF (g_asn_debug = 'Y') THEN
360: asn_debug.put_line('no_data_found insert_rcv_lots_supply');
361: END IF;
362:
363: x_return_status := fnd_api.g_ret_sts_error;
356: END IF;
357: EXCEPTION
358: WHEN NO_DATA_FOUND THEN
359: IF (g_asn_debug = 'Y') THEN
360: asn_debug.put_line('no_data_found insert_rcv_lots_supply');
361: END IF;
362:
363: x_return_status := fnd_api.g_ret_sts_error;
364:
392: rti.program_update_date
393: FROM rcv_transactions_interface rti
394: WHERE rti.interface_transaction_id = p_interface_transaction_id;
395: WHEN OTHERS THEN
396: IF (g_asn_debug = 'Y') THEN
397: asn_debug.put_line('others insert_rcv_lots_supply');
398: END IF;
399:
400: x_return_status := fnd_api.g_ret_sts_unexp_error;
393: FROM rcv_transactions_interface rti
394: WHERE rti.interface_transaction_id = p_interface_transaction_id;
395: WHEN OTHERS THEN
396: IF (g_asn_debug = 'Y') THEN
397: asn_debug.put_line('others insert_rcv_lots_supply');
398: END IF;
399:
400: x_return_status := fnd_api.g_ret_sts_unexp_error;
401:
471: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
472: l_shipment_header_id rcv_shipment_headers.shipment_header_id%TYPE;
473: l_item_id rcv_transactions_interface.item_id%TYPE;
474: BEGIN
475: IF (g_asn_debug = 'Y') THEN
476: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
477: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
478: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
479: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
472: l_shipment_header_id rcv_shipment_headers.shipment_header_id%TYPE;
473: l_item_id rcv_transactions_interface.item_id%TYPE;
474: BEGIN
475: IF (g_asn_debug = 'Y') THEN
476: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
477: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
478: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
479: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
480: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
473: l_item_id rcv_transactions_interface.item_id%TYPE;
474: BEGIN
475: IF (g_asn_debug = 'Y') THEN
476: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
477: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
478: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
479: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
480: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
481: END IF;
474: BEGIN
475: IF (g_asn_debug = 'Y') THEN
476: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
477: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
478: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
479: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
480: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
481: END IF;
482:
475: IF (g_asn_debug = 'Y') THEN
476: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
477: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
478: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
479: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
480: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
481: END IF;
482:
483: x_return_status := fnd_api.g_ret_sts_success;
476: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
477: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
478: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
479: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
480: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
481: END IF;
482:
483: x_return_status := fnd_api.g_ret_sts_success;
484:
496: IF (l_serial_count = 0) THEN
497: RETURN;
498: END IF;
499:
500: IF (g_asn_debug = 'Y') THEN
501: asn_debug.put_line('l_serial_count ' || l_serial_count);
502: END IF;
503:
504: /* We need to insert into rcv_lots_supply and
497: RETURN;
498: END IF;
499:
500: IF (g_asn_debug = 'Y') THEN
501: asn_debug.put_line('l_serial_count ' || l_serial_count);
502: END IF;
503:
504: /* We need to insert into rcv_lots_supply and
505: * rcv_serials_supply table only when we come through ROI
521: AND l_lpn_id = -999) THEN
522: RETURN;
523: END IF;
524:
525: IF (g_asn_debug = 'Y') THEN
526: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
527: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
528: END IF;
529:
522: RETURN;
523: END IF;
524:
525: IF (g_asn_debug = 'Y') THEN
526: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
527: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
528: END IF;
529:
530: OPEN select_serials(p_interface_transaction_id);
523: END IF;
524:
525: IF (g_asn_debug = 'Y') THEN
526: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
527: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
528: END IF;
529:
530: OPEN select_serials(p_interface_transaction_id);
531:
573: INTO l_transaction_id
574: FROM rcv_transactions rt
575: WHERE rt.interface_transaction_id = p_interface_transaction_id;
576:
577: IF (g_asn_debug = 'Y') THEN
578: asn_debug.put_line('l_range_numbers ' || l_range_numbers);
579: asn_debug.put_line('l_serial_num_length ' || l_serial_num_length);
580: asn_debug.put_line('l_prefix_length ' || l_prefix_length);
581: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
574: FROM rcv_transactions rt
575: WHERE rt.interface_transaction_id = p_interface_transaction_id;
576:
577: IF (g_asn_debug = 'Y') THEN
578: asn_debug.put_line('l_range_numbers ' || l_range_numbers);
579: asn_debug.put_line('l_serial_num_length ' || l_serial_num_length);
580: asn_debug.put_line('l_prefix_length ' || l_prefix_length);
581: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
582: END IF;
575: WHERE rt.interface_transaction_id = p_interface_transaction_id;
576:
577: IF (g_asn_debug = 'Y') THEN
578: asn_debug.put_line('l_range_numbers ' || l_range_numbers);
579: asn_debug.put_line('l_serial_num_length ' || l_serial_num_length);
580: asn_debug.put_line('l_prefix_length ' || l_prefix_length);
581: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
582: END IF;
583:
576:
577: IF (g_asn_debug = 'Y') THEN
578: asn_debug.put_line('l_range_numbers ' || l_range_numbers);
579: asn_debug.put_line('l_serial_num_length ' || l_serial_num_length);
580: asn_debug.put_line('l_prefix_length ' || l_prefix_length);
581: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
582: END IF;
583:
584: FOR i IN 1 .. l_range_numbers LOOP --{
577: IF (g_asn_debug = 'Y') THEN
578: asn_debug.put_line('l_range_numbers ' || l_range_numbers);
579: asn_debug.put_line('l_serial_num_length ' || l_serial_num_length);
580: asn_debug.put_line('l_prefix_length ' || l_prefix_length);
581: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
582: END IF;
583:
584: FOR i IN 1 .. l_range_numbers LOOP --{
585: l_cur_serial_numeric := l_from_serial_number + i - 1;
588: l_serial_suffix_length,
589: '0'
590: );
591:
592: IF (g_asn_debug = 'Y') THEN
593: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
594: asn_debug.put_line('l_cur_serial_numeric ' || l_cur_serial_numeric);
595: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
596: asn_debug.put_line('l_cur_serial_number ' || l_serial_suffix_length);
589: '0'
590: );
591:
592: IF (g_asn_debug = 'Y') THEN
593: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
594: asn_debug.put_line('l_cur_serial_numeric ' || l_cur_serial_numeric);
595: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
596: asn_debug.put_line('l_cur_serial_number ' || l_serial_suffix_length);
597: END IF;
590: );
591:
592: IF (g_asn_debug = 'Y') THEN
593: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
594: asn_debug.put_line('l_cur_serial_numeric ' || l_cur_serial_numeric);
595: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
596: asn_debug.put_line('l_cur_serial_number ' || l_serial_suffix_length);
597: END IF;
598:
591:
592: IF (g_asn_debug = 'Y') THEN
593: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
594: asn_debug.put_line('l_cur_serial_numeric ' || l_cur_serial_numeric);
595: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
596: asn_debug.put_line('l_cur_serial_number ' || l_serial_suffix_length);
597: END IF;
598:
599: insert_serial_supply(p_interface_transaction_id,
592: IF (g_asn_debug = 'Y') THEN
593: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
594: asn_debug.put_line('l_cur_serial_numeric ' || l_cur_serial_numeric);
595: asn_debug.put_line('l_serial_suffix_length ' || l_serial_suffix_length);
596: asn_debug.put_line('l_cur_serial_number ' || l_serial_suffix_length);
597: END IF;
598:
599: insert_serial_supply(p_interface_transaction_id,
600: l_select_serials.lot_number,
603: p_supply_source_id,
604: x_return_status
605: );
606:
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('After insert_serial_supply ');
609: END IF;
610: END LOOP; --}
611:
604: x_return_status
605: );
606:
607: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('After insert_serial_supply ');
609: END IF;
610: END LOOP; --}
611:
612: IF (g_asn_debug = 'Y') THEN
608: asn_debug.put_line('After insert_serial_supply ');
609: END IF;
610: END LOOP; --}
611:
612: IF (g_asn_debug = 'Y') THEN
613: asn_debug.put_line('l_delete_shipment_supply ' || l_delete_shipment_supply);
614: END IF;
615:
616: IF (l_delete_shipment_supply = 'Y') THEN
609: END IF;
610: END LOOP; --}
611:
612: IF (g_asn_debug = 'Y') THEN
613: asn_debug.put_line('l_delete_shipment_supply ' || l_delete_shipment_supply);
614: END IF;
615:
616: IF (l_delete_shipment_supply = 'Y') THEN
617: SELECT shipment_header_id,
647: END LOOP; --}
648:
649: CLOSE select_serials;
650:
651: IF (g_asn_debug = 'Y') THEN
652: asn_debug.put_line('Exit insert_rcv_serials_supply ');
653: END IF;
654: EXCEPTION
655: WHEN NO_DATA_FOUND THEN
648:
649: CLOSE select_serials;
650:
651: IF (g_asn_debug = 'Y') THEN
652: asn_debug.put_line('Exit insert_rcv_serials_supply ');
653: END IF;
654: EXCEPTION
655: WHEN NO_DATA_FOUND THEN
656: IF (g_asn_debug = 'Y') THEN
652: asn_debug.put_line('Exit insert_rcv_serials_supply ');
653: END IF;
654: EXCEPTION
655: WHEN NO_DATA_FOUND THEN
656: IF (g_asn_debug = 'Y') THEN
657: asn_debug.put_line('no_data_found insert_rcv_serials_supply ');
658: END IF;
659:
660: x_return_status := fnd_api.g_ret_sts_error;
653: END IF;
654: EXCEPTION
655: WHEN NO_DATA_FOUND THEN
656: IF (g_asn_debug = 'Y') THEN
657: asn_debug.put_line('no_data_found insert_rcv_serials_supply ');
658: END IF;
659:
660: x_return_status := fnd_api.g_ret_sts_error;
661:
689: rti.program_update_date
690: FROM rcv_transactions_interface rti
691: WHERE rti.interface_transaction_id = p_interface_transaction_id;
692: WHEN OTHERS THEN
693: IF (g_asn_debug = 'Y') THEN
694: asn_debug.put_line('others insert_rcv_serials_supply ');
695: END IF;
696:
697: x_return_status := fnd_api.g_ret_sts_unexp_error;
690: FROM rcv_transactions_interface rti
691: WHERE rti.interface_transaction_id = p_interface_transaction_id;
692: WHEN OTHERS THEN
693: IF (g_asn_debug = 'Y') THEN
694: asn_debug.put_line('others insert_rcv_serials_supply ');
695: END IF;
696:
697: x_return_status := fnd_api.g_ret_sts_unexp_error;
698:
880: l_txn_uom VARCHAR2(25);
881: l_primary_uom VARCHAR2(25);
882: l_to_org_id NUMBER;
883: BEGIN
884: IF (g_asn_debug = 'Y') THEN
885: asn_debug.put_line('Enter update_rcv_lots_supply ');
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
881: l_primary_uom VARCHAR2(25);
882: l_to_org_id NUMBER;
883: BEGIN
884: IF (g_asn_debug = 'Y') THEN
885: asn_debug.put_line('Enter update_rcv_lots_supply ');
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
882: l_to_org_id NUMBER;
883: BEGIN
884: IF (g_asn_debug = 'Y') THEN
885: asn_debug.put_line('Enter update_rcv_lots_supply ');
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
890: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
883: BEGIN
884: IF (g_asn_debug = 'Y') THEN
885: asn_debug.put_line('Enter update_rcv_lots_supply ');
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
890: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
891: asn_debug.put_line('p_correction_type ' || p_correction_type);
884: IF (g_asn_debug = 'Y') THEN
885: asn_debug.put_line('Enter update_rcv_lots_supply ');
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
890: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
891: asn_debug.put_line('p_correction_type ' || p_correction_type);
892: END IF;
885: asn_debug.put_line('Enter update_rcv_lots_supply ');
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
890: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
891: asn_debug.put_line('p_correction_type ' || p_correction_type);
892: END IF;
893:
886: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
890: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
891: asn_debug.put_line('p_correction_type ' || p_correction_type);
892: END IF;
893:
894: x_return_status := fnd_api.g_ret_sts_success;
887: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
888: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
889: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
890: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
891: asn_debug.put_line('p_correction_type ' || p_correction_type);
892: END IF;
893:
894: x_return_status := fnd_api.g_ret_sts_success;
895:
907: IF (l_lot_count = 0) THEN
908: RETURN;
909: END IF;
910:
911: IF (g_asn_debug = 'Y') THEN
912: asn_debug.put_line('l_lot_count ' || l_lot_count);
913: END IF;
914:
915: /* We need to insert into rcv_lots_supply and
908: RETURN;
909: END IF;
910:
911: IF (g_asn_debug = 'Y') THEN
912: asn_debug.put_line('l_lot_count ' || l_lot_count);
913: END IF;
914:
915: /* We need to insert into rcv_lots_supply and
916: * rcv_serials_supply table only when we come through ROI
932: AND l_lpn_id = -999) THEN
933: RETURN;
934: END IF;
935:
936: IF (g_asn_debug = 'Y') THEN
937: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
938: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
939: END IF;
940:
933: RETURN;
934: END IF;
935:
936: IF (g_asn_debug = 'Y') THEN
937: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
938: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
939: END IF;
940:
941: /* When we update rcv_supply, we call this procedure and set
934: END IF;
935:
936: IF (g_asn_debug = 'Y') THEN
937: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
938: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
939: END IF;
940:
941: /* When we update rcv_supply, we call this procedure and set
942: * the p_correction_type depending upon whether we need to add
961: IF (l_count = 0) THEN
962: RETURN;
963: END IF;
964:
965: IF (g_asn_debug = 'Y') THEN
966: asn_debug.put_line('l_count ' || l_count);
967: END IF;
968:
969: SELECT transaction_type,
962: RETURN;
963: END IF;
964:
965: IF (g_asn_debug = 'Y') THEN
966: asn_debug.put_line('l_count ' || l_count);
967: END IF;
968:
969: SELECT transaction_type,
970: organization_id,
989: l_update_shipment_supply := 'Y';
990: END IF; --}
991: /* END IF; */
992:
993: IF (g_asn_debug = 'Y') THEN
994: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
995: asn_debug.put_line(' INVCONV , Update shipment supply for OPM transactions also.');
996: END IF;
997:
990: END IF; --}
991: /* END IF; */
992:
993: IF (g_asn_debug = 'Y') THEN
994: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
995: asn_debug.put_line(' INVCONV , Update shipment supply for OPM transactions also.');
996: END IF;
997:
998: OPEN lot_cursor(p_interface_transaction_id);
991: /* END IF; */
992:
993: IF (g_asn_debug = 'Y') THEN
994: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
995: asn_debug.put_line(' INVCONV , Update shipment supply for OPM transactions also.');
996: END IF;
997:
998: OPEN lot_cursor(p_interface_transaction_id);
999:
1010: l_txn_uom,
1011: l_to_org_id;
1012: EXIT WHEN lot_cursor%NOTFOUND;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('Opened lot_cursor ');
1016: asn_debug.put_line('l_lot_num ' || l_lot_num);
1017: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply1 ');
1018: /*INVCONV*/
1011: l_to_org_id;
1012: EXIT WHEN lot_cursor%NOTFOUND;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('Opened lot_cursor ');
1016: asn_debug.put_line('l_lot_num ' || l_lot_num);
1017: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply1 ');
1018: /*INVCONV*/
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1012: EXIT WHEN lot_cursor%NOTFOUND;
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('Opened lot_cursor ');
1016: asn_debug.put_line('l_lot_num ' || l_lot_num);
1017: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply1 ');
1018: /*INVCONV*/
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1020: /*end , INVCONV*/
1013:
1014: IF (g_asn_debug = 'Y') THEN
1015: asn_debug.put_line('Opened lot_cursor ');
1016: asn_debug.put_line('l_lot_num ' || l_lot_num);
1017: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply1 ');
1018: /*INVCONV*/
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1020: /*end , INVCONV*/
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1015: asn_debug.put_line('Opened lot_cursor ');
1016: asn_debug.put_line('l_lot_num ' || l_lot_num);
1017: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply1 ');
1018: /*INVCONV*/
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1020: /*end , INVCONV*/
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1017: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply1 ');
1018: /*INVCONV*/
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1020: /*end , INVCONV*/
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1018: /*INVCONV*/
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1020: /*end , INVCONV*/
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1026: asn_debug.put_line('l_txn_uom, ' || l_txn_uom);
1019: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1020: /*end , INVCONV*/
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1026: asn_debug.put_line('l_txn_uom, ' || l_txn_uom);
1027: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
1020: /*end , INVCONV*/
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1026: asn_debug.put_line('l_txn_uom, ' || l_txn_uom);
1027: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
1028: END IF;
1021: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1026: asn_debug.put_line('l_txn_uom, ' || l_txn_uom);
1027: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
1028: END IF;
1029:
1022: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1026: asn_debug.put_line('l_txn_uom, ' || l_txn_uom);
1027: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
1028: END IF;
1029:
1030: /* If there is already a row existing for this lot_num, update
1023: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1024: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1025: asn_debug.put_line('l_item_id ' || l_item_id);
1026: asn_debug.put_line('l_txn_uom, ' || l_txn_uom);
1027: asn_debug.put_line('l_to_org_id ' || l_to_org_id);
1028: END IF;
1029:
1030: /* If there is already a row existing for this lot_num, update
1031: * the quantity. Else insert a new one since this might be a
1049: */
1050: /*end , INVCONV*/
1051: AND supply_type_code = 'RECEIVING';
1052:
1053: IF (g_asn_debug = 'Y') THEN
1054: asn_debug.put_line('l_count1 ' || l_count1);
1055: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply2 ');
1056: END IF;
1057:
1050: /*end , INVCONV*/
1051: AND supply_type_code = 'RECEIVING';
1052:
1053: IF (g_asn_debug = 'Y') THEN
1054: asn_debug.put_line('l_count1 ' || l_count1);
1055: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply2 ');
1056: END IF;
1057:
1058: IF (l_count1 = 0) THEN --{
1051: AND supply_type_code = 'RECEIVING';
1052:
1053: IF (g_asn_debug = 'Y') THEN
1054: asn_debug.put_line('l_count1 ' || l_count1);
1055: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply2 ');
1056: END IF;
1057:
1058: IF (l_count1 = 0) THEN --{
1059: IF (g_asn_debug = 'Y') THEN
1055: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply2 ');
1056: END IF;
1057:
1058: IF (l_count1 = 0) THEN --{
1059: IF (g_asn_debug = 'Y') THEN
1060: asn_debug.put_line('Before insert_lot_supply ' || l_count1);
1061: END IF;
1062:
1063: insert_lot_supply(p_interface_transaction_id,
1056: END IF;
1057:
1058: IF (l_count1 = 0) THEN --{
1059: IF (g_asn_debug = 'Y') THEN
1060: asn_debug.put_line('Before insert_lot_supply ' || l_count1);
1061: END IF;
1062:
1063: insert_lot_supply(p_interface_transaction_id,
1064: 'RECEIVING',
1065: p_parent_supply_id,
1066: x_return_status
1067: );
1068:
1069: IF (g_asn_debug = 'Y') THEN
1070: asn_debug.put_line('After insert_lot_supply ' || l_count1);
1071: END IF;
1072: ELSE --}{
1073: /** OPM Change Bug# 3061052 add sublot_num check **/
1066: x_return_status
1067: );
1068:
1069: IF (g_asn_debug = 'Y') THEN
1070: asn_debug.put_line('After insert_lot_supply ' || l_count1);
1071: END IF;
1072: ELSE --}{
1073: /** OPM Change Bug# 3061052 add sublot_num check **/
1074: IF (g_asn_debug = 'Y') THEN
1070: asn_debug.put_line('After insert_lot_supply ' || l_count1);
1071: END IF;
1072: ELSE --}{
1073: /** OPM Change Bug# 3061052 add sublot_num check **/
1074: IF (g_asn_debug = 'Y') THEN
1075: asn_debug.put_line('Else update rcv_lots_supply');
1076: END IF;
1077:
1078: SELECT MAX(primary_unit_of_measure)
1071: END IF;
1072: ELSE --}{
1073: /** OPM Change Bug# 3061052 add sublot_num check **/
1074: IF (g_asn_debug = 'Y') THEN
1075: asn_debug.put_line('Else update rcv_lots_supply');
1076: END IF;
1077:
1078: SELECT MAX(primary_unit_of_measure)
1079: INTO l_primary_uom
1080: FROM mtl_system_items
1081: WHERE mtl_system_items.inventory_item_id = l_item_id
1082: AND mtl_system_items.organization_id = l_to_org_id;
1083:
1084: IF (g_asn_debug = 'Y') THEN
1085: asn_debug.put_line('l_primary_uom ' || l_primary_uom);
1086: END IF;
1087:
1088: /* l_qty_to_be_updated shd be in
1081: WHERE mtl_system_items.inventory_item_id = l_item_id
1082: AND mtl_system_items.organization_id = l_to_org_id;
1083:
1084: IF (g_asn_debug = 'Y') THEN
1085: asn_debug.put_line('l_primary_uom ' || l_primary_uom);
1086: END IF;
1087:
1088: /* l_qty_to_be_updated shd be in
1089: * terms of the parent's uom. For
1097: l_parent_uom
1098: );
1099: END IF;
1100:
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1098: );
1099: END IF;
1100:
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1099: END IF;
1100:
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1100:
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1108: /* INVCONV*/
1101: IF (g_asn_debug = 'Y') THEN
1102: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1108: /* INVCONV*/
1109: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1102: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1108: /* INVCONV*/
1109: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1110: /*end , INVCONV*/
1103: asn_debug.put_line('l_factor ' || l_factor);
1104: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1108: /* INVCONV*/
1109: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1110: /*end , INVCONV*/
1111: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply3 ');
1105: asn_debug.put_line('l_secondary_qty_to_be_updated ' || l_secondary_qty_to_be_updated);
1106: asn_debug.put_line('l_lot_num ' || l_lot_num);
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1108: /* INVCONV*/
1109: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1110: /*end , INVCONV*/
1111: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply3 ');
1112: END IF;
1113:
1107: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1108: /* INVCONV*/
1109: /* asn_debug.put_line('l_sublot_num ' || l_sublot_num); */
1110: /*end , INVCONV*/
1111: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply3 ');
1112: END IF;
1113:
1114: /* INVCONV , Remove sublot_num. Punit Kumar */
1115:
1129: /* end , INVCONV */
1130:
1131: END IF; --}
1132:
1133: IF (g_asn_debug = 'Y') THEN
1134: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
1135: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply4 ');
1136: END IF;
1137:
1130:
1131: END IF; --}
1132:
1133: IF (g_asn_debug = 'Y') THEN
1134: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
1135: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply4 ');
1136: END IF;
1137:
1138: IF (l_update_shipment_supply = 'Y') THEN --{
1131: END IF; --}
1132:
1133: IF (g_asn_debug = 'Y') THEN
1134: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
1135: asn_debug.put_line('INVCONV, Subllot_num has been removed in update_lot_supply4 ');
1136: END IF;
1137:
1138: IF (l_update_shipment_supply = 'Y') THEN --{
1139: SELECT COUNT(*)
1142: WHERE shipment_line_id = p_shipment_line_id
1143: AND supply_type_code = 'SHIPMENT'
1144: AND lot_num = l_lot_num;
1145:
1146: IF (g_asn_debug = 'Y') THEN
1147: asn_debug.put_line('l_count2 ' || l_count2);
1148: END IF;
1149:
1150: /* If correction type is positive, then there would
1143: AND supply_type_code = 'SHIPMENT'
1144: AND lot_num = l_lot_num;
1145:
1146: IF (g_asn_debug = 'Y') THEN
1147: asn_debug.put_line('l_count2 ' || l_count2);
1148: END IF;
1149:
1150: /* If correction type is positive, then there would
1151: * definitely be a row for shipment supply else we will
1183: OPEN shipment_supply_quantity(l_lot_num,
1184: l_ship_line_id --Bug 7443786
1185: );
1186:
1187: IF (g_asn_debug = 'Y') THEN
1188: asn_debug.put_line('Opened shipment_supply_quantity ');
1189: END IF;
1190:
1191: LOOP --{
1184: l_ship_line_id --Bug 7443786
1185: );
1186:
1187: IF (g_asn_debug = 'Y') THEN
1188: asn_debug.put_line('Opened shipment_supply_quantity ');
1189: END IF;
1190:
1191: LOOP --{
1192: FETCH shipment_supply_quantity INTO l_rls_qty,
1193: l_rls_primary_qty;
1194: EXIT WHEN shipment_supply_quantity%NOTFOUND
1195: OR l_primary_qty_to_be_updated = 0;
1196:
1197: IF (g_asn_debug = 'Y') THEN
1198: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
1199: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
1200: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1201: END IF;
1194: EXIT WHEN shipment_supply_quantity%NOTFOUND
1195: OR l_primary_qty_to_be_updated = 0;
1196:
1197: IF (g_asn_debug = 'Y') THEN
1198: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
1199: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
1200: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1201: END IF;
1202:
1195: OR l_primary_qty_to_be_updated = 0;
1196:
1197: IF (g_asn_debug = 'Y') THEN
1198: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
1199: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
1200: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1201: END IF;
1202:
1203: SELECT unit_of_measure
1196:
1197: IF (g_asn_debug = 'Y') THEN
1198: asn_debug.put_line('l_rls_qty ' || l_rls_qty);
1199: asn_debug.put_line('l_rls_primary_qty ' || l_rls_primary_qty);
1200: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1201: END IF;
1202:
1203: SELECT unit_of_measure
1204: INTO l_parent_uom
1204: INTO l_parent_uom
1205: FROM rcv_shipment_lines
1206: WHERE shipment_line_id = l_ship_line_id;
1207:
1208: IF (g_asn_debug = 'Y') THEN
1209: asn_debug.put_line('l_parent_uom ' || l_parent_uom);
1210: END IF;
1211:
1212: IF (l_txn_uom <> l_parent_uom) THEN
1205: FROM rcv_shipment_lines
1206: WHERE shipment_line_id = l_ship_line_id;
1207:
1208: IF (g_asn_debug = 'Y') THEN
1209: asn_debug.put_line('l_parent_uom ' || l_parent_uom);
1210: END IF;
1211:
1212: IF (l_txn_uom <> l_parent_uom) THEN
1213: l_qty_to_be_updated := rcv_transactions_interface_sv.convert_into_correct_qty(l_primary_qty_to_be_updated,
1217: );
1218: END IF;
1219:
1220: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
1221: IF (g_asn_debug = 'Y') THEN
1222: asn_debug.put_line('rls_primary_qty is greater ');
1223: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1224: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1225: asn_debug.put_line('l_lot_num ' || l_lot_num);
1218: END IF;
1219:
1220: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
1221: IF (g_asn_debug = 'Y') THEN
1222: asn_debug.put_line('rls_primary_qty is greater ');
1223: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1224: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1225: asn_debug.put_line('l_lot_num ' || l_lot_num);
1226: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1219:
1220: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
1221: IF (g_asn_debug = 'Y') THEN
1222: asn_debug.put_line('rls_primary_qty is greater ');
1223: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1224: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1225: asn_debug.put_line('l_lot_num ' || l_lot_num);
1226: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1227: END IF;
1220: IF (l_rls_primary_qty >= l_primary_qty_to_be_updated) THEN --{
1221: IF (g_asn_debug = 'Y') THEN
1222: asn_debug.put_line('rls_primary_qty is greater ');
1223: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1224: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1225: asn_debug.put_line('l_lot_num ' || l_lot_num);
1226: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1227: END IF;
1228:
1221: IF (g_asn_debug = 'Y') THEN
1222: asn_debug.put_line('rls_primary_qty is greater ');
1223: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1224: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1225: asn_debug.put_line('l_lot_num ' || l_lot_num);
1226: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1227: END IF;
1228:
1229: UPDATE rcv_lots_supply rls
1222: asn_debug.put_line('rls_primary_qty is greater ');
1223: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1224: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1225: asn_debug.put_line('l_lot_num ' || l_lot_num);
1226: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1227: END IF;
1228:
1229: UPDATE rcv_lots_supply rls
1230: SET quantity = quantity -(l_qty_to_be_updated * l_factor),
1235:
1236: l_qty_to_be_updated := 0;
1237: l_primary_qty_to_be_updated := 0;
1238: ELSE --}{
1239: IF (g_asn_debug = 'Y') THEN
1240: asn_debug.put_line('rls_primary_qty is lesser ');
1241: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1242: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1243: asn_debug.put_line('l_lot_num ' || l_lot_num);
1236: l_qty_to_be_updated := 0;
1237: l_primary_qty_to_be_updated := 0;
1238: ELSE --}{
1239: IF (g_asn_debug = 'Y') THEN
1240: asn_debug.put_line('rls_primary_qty is lesser ');
1241: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1242: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1243: asn_debug.put_line('l_lot_num ' || l_lot_num);
1244: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1237: l_primary_qty_to_be_updated := 0;
1238: ELSE --}{
1239: IF (g_asn_debug = 'Y') THEN
1240: asn_debug.put_line('rls_primary_qty is lesser ');
1241: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1242: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1243: asn_debug.put_line('l_lot_num ' || l_lot_num);
1244: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1245: END IF;
1238: ELSE --}{
1239: IF (g_asn_debug = 'Y') THEN
1240: asn_debug.put_line('rls_primary_qty is lesser ');
1241: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1242: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1243: asn_debug.put_line('l_lot_num ' || l_lot_num);
1244: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1245: END IF;
1246:
1239: IF (g_asn_debug = 'Y') THEN
1240: asn_debug.put_line('rls_primary_qty is lesser ');
1241: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1242: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1243: asn_debug.put_line('l_lot_num ' || l_lot_num);
1244: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1245: END IF;
1246:
1247: UPDATE rcv_lots_supply rls
1240: asn_debug.put_line('rls_primary_qty is lesser ');
1241: asn_debug.put_line('l_qty_to_be_updated ' || l_qty_to_be_updated);
1242: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1243: asn_debug.put_line('l_lot_num ' || l_lot_num);
1244: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1245: END IF;
1246:
1247: UPDATE rcv_lots_supply rls
1248: SET quantity = quantity -(quantity * l_factor),
1257: END LOOP; --}
1258:
1259: CLOSE shipment_supply_quantity;
1260:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('Close shipment_supply_quantity ');
1263: END IF;
1264:
1265: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
1258:
1259: CLOSE shipment_supply_quantity;
1260:
1261: IF (g_asn_debug = 'Y') THEN
1262: asn_debug.put_line('Close shipment_supply_quantity ');
1263: END IF;
1264:
1265: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
1266: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1262: asn_debug.put_line('Close shipment_supply_quantity ');
1263: END IF;
1264:
1265: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
1266: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1267: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1268: /*Bug 13792458 when ISO or IOT from_organization is not lot controlled, it will not consume rcv_lots_supply quantity */
1269: --asn_debug.put_line('SHIPMENT supply for above qty not available to consume..Fail the transaction...');
1270: --raise NO_DATA_FOUND;
1263: END IF;
1264:
1265: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
1266: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1267: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1268: /*Bug 13792458 when ISO or IOT from_organization is not lot controlled, it will not consume rcv_lots_supply quantity */
1269: --asn_debug.put_line('SHIPMENT supply for above qty not available to consume..Fail the transaction...');
1270: --raise NO_DATA_FOUND;
1271: /*End Bug 13792458 */
1265: IF l_primary_qty_to_be_updated <> 0 THEN --Bug 7443786
1266: asn_debug.put_line('l_ship_line_id ' || l_ship_line_id);
1267: asn_debug.put_line('l_primary_qty_to_be_updated ' || l_primary_qty_to_be_updated);
1268: /*Bug 13792458 when ISO or IOT from_organization is not lot controlled, it will not consume rcv_lots_supply quantity */
1269: --asn_debug.put_line('SHIPMENT supply for above qty not available to consume..Fail the transaction...');
1270: --raise NO_DATA_FOUND;
1271: /*End Bug 13792458 */
1272: END IF; --Bug 7443786
1273: /*
1305: END LOOP; --}
1306:
1307: CLOSE lot_cursor;
1308:
1309: IF (g_asn_debug = 'Y') THEN
1310: asn_debug.put_line('Close lot_cursor ');
1311: END IF;
1312:
1313: IF (g_asn_debug = 'Y') THEN
1306:
1307: CLOSE lot_cursor;
1308:
1309: IF (g_asn_debug = 'Y') THEN
1310: asn_debug.put_line('Close lot_cursor ');
1311: END IF;
1312:
1313: IF (g_asn_debug = 'Y') THEN
1314: asn_debug.put_line('Exit update_rcv_lots_supply ');
1309: IF (g_asn_debug = 'Y') THEN
1310: asn_debug.put_line('Close lot_cursor ');
1311: END IF;
1312:
1313: IF (g_asn_debug = 'Y') THEN
1314: asn_debug.put_line('Exit update_rcv_lots_supply ');
1315: END IF;
1316: EXCEPTION
1317: WHEN NO_DATA_FOUND THEN
1310: asn_debug.put_line('Close lot_cursor ');
1311: END IF;
1312:
1313: IF (g_asn_debug = 'Y') THEN
1314: asn_debug.put_line('Exit update_rcv_lots_supply ');
1315: END IF;
1316: EXCEPTION
1317: WHEN NO_DATA_FOUND THEN
1318: IF (g_asn_debug = 'Y') THEN
1314: asn_debug.put_line('Exit update_rcv_lots_supply ');
1315: END IF;
1316: EXCEPTION
1317: WHEN NO_DATA_FOUND THEN
1318: IF (g_asn_debug = 'Y') THEN
1319: asn_debug.put_line('no_data_found update_rcv_lots_supply ');
1320: END IF;
1321:
1322: x_return_status := fnd_api.g_ret_sts_error;
1315: END IF;
1316: EXCEPTION
1317: WHEN NO_DATA_FOUND THEN
1318: IF (g_asn_debug = 'Y') THEN
1319: asn_debug.put_line('no_data_found update_rcv_lots_supply ');
1320: END IF;
1321:
1322: x_return_status := fnd_api.g_ret_sts_error;
1323:
1351: rti.program_update_date
1352: FROM rcv_transactions_interface rti
1353: WHERE rti.interface_transaction_id = p_interface_transaction_id;
1354: WHEN OTHERS THEN
1355: IF (g_asn_debug = 'Y') THEN
1356: asn_debug.put_line('others update_rcv_lots_supply ');
1357: END IF;
1358:
1359: x_return_status := fnd_api.g_ret_sts_unexp_error;
1352: FROM rcv_transactions_interface rti
1353: WHERE rti.interface_transaction_id = p_interface_transaction_id;
1354: WHEN OTHERS THEN
1355: IF (g_asn_debug = 'Y') THEN
1356: asn_debug.put_line('others update_rcv_lots_supply ');
1357: END IF;
1358:
1359: x_return_status := fnd_api.g_ret_sts_unexp_error;
1360:
1433: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1434: l_shipment_header_id rcv_shipment_headers.shipment_header_id%TYPE;
1435: l_item_id rcv_transactions_interface.item_id%TYPE;
1436: BEGIN
1437: IF (g_asn_debug = 'Y') THEN
1438: asn_debug.put_line('Enter update_rcv_serials_supply ');
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1434: l_shipment_header_id rcv_shipment_headers.shipment_header_id%TYPE;
1435: l_item_id rcv_transactions_interface.item_id%TYPE;
1436: BEGIN
1437: IF (g_asn_debug = 'Y') THEN
1438: asn_debug.put_line('Enter update_rcv_serials_supply ');
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1435: l_item_id rcv_transactions_interface.item_id%TYPE;
1436: BEGIN
1437: IF (g_asn_debug = 'Y') THEN
1438: asn_debug.put_line('Enter update_rcv_serials_supply ');
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1443: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1436: BEGIN
1437: IF (g_asn_debug = 'Y') THEN
1438: asn_debug.put_line('Enter update_rcv_serials_supply ');
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1443: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1444: asn_debug.put_line('p_correction_type ' || p_correction_type);
1437: IF (g_asn_debug = 'Y') THEN
1438: asn_debug.put_line('Enter update_rcv_serials_supply ');
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1443: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1444: asn_debug.put_line('p_correction_type ' || p_correction_type);
1445: END IF;
1438: asn_debug.put_line('Enter update_rcv_serials_supply ');
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1443: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1444: asn_debug.put_line('p_correction_type ' || p_correction_type);
1445: END IF;
1446:
1439: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1443: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1444: asn_debug.put_line('p_correction_type ' || p_correction_type);
1445: END IF;
1446:
1447: x_return_status := fnd_api.g_ret_sts_success;
1440: asn_debug.put_line('p_transaction_type ' || p_transaction_type);
1441: asn_debug.put_line('p_shipment_line_id ' || p_shipment_line_id);
1442: asn_debug.put_line('p_source_type_code ' || p_source_type_code);
1443: asn_debug.put_line('p_parent_supply_id ' || p_parent_supply_id);
1444: asn_debug.put_line('p_correction_type ' || p_correction_type);
1445: END IF;
1446:
1447: x_return_status := fnd_api.g_ret_sts_success;
1448:
1460: IF (l_serial_count = 0) THEN
1461: RETURN;
1462: END IF;
1463:
1464: IF (g_asn_debug = 'Y') THEN
1465: asn_debug.put_line('l_Serial_count ' || l_serial_count);
1466: END IF;
1467:
1468: /* We need to insert into rcv_lots_supply and
1461: RETURN;
1462: END IF;
1463:
1464: IF (g_asn_debug = 'Y') THEN
1465: asn_debug.put_line('l_Serial_count ' || l_serial_count);
1466: END IF;
1467:
1468: /* We need to insert into rcv_lots_supply and
1469: * rcv_serials_supply table only when we come through ROI
1485: AND l_lpn_id = -999) THEN
1486: RETURN;
1487: END IF;
1488:
1489: IF (g_asn_debug = 'Y') THEN
1490: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
1491: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
1492: END IF;
1493:
1486: RETURN;
1487: END IF;
1488:
1489: IF (g_asn_debug = 'Y') THEN
1490: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
1491: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
1492: END IF;
1493:
1494: OPEN select_serials(p_interface_transaction_id);
1487: END IF;
1488:
1489: IF (g_asn_debug = 'Y') THEN
1490: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
1491: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
1492: END IF;
1493:
1494: OPEN select_serials(p_interface_transaction_id);
1495:
1511: ELSIF(p_correction_type = 'NEGATIVE') THEN --}{
1512: l_delete_serial := 'Y';
1513: END IF; --}
1514:
1515: IF (g_asn_debug = 'Y') THEN
1516: asn_debug.put_line('l_insert_serial ' || l_insert_serial);
1517: asn_debug.put_line('l_delete_serial ' || l_delete_serial);
1518: END IF;
1519:
1512: l_delete_serial := 'Y';
1513: END IF; --}
1514:
1515: IF (g_asn_debug = 'Y') THEN
1516: asn_debug.put_line('l_insert_serial ' || l_insert_serial);
1517: asn_debug.put_line('l_delete_serial ' || l_delete_serial);
1518: END IF;
1519:
1520: SELECT transaction_type
1513: END IF; --}
1514:
1515: IF (g_asn_debug = 'Y') THEN
1516: asn_debug.put_line('l_insert_serial ' || l_insert_serial);
1517: asn_debug.put_line('l_delete_serial ' || l_delete_serial);
1518: END IF;
1519:
1520: SELECT transaction_type
1521: INTO l_parent_trans_type
1527: AND p_source_type_code IN('INVENTORY', 'REQ')) THEN --{
1528: l_update_shipment_supply := 'Y';
1529: END IF; --}
1530:
1531: IF (g_asn_debug = 'Y') THEN
1532: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
1533: END IF;
1534:
1535: LOOP --{
1528: l_update_shipment_supply := 'Y';
1529: END IF; --}
1530:
1531: IF (g_asn_debug = 'Y') THEN
1532: asn_debug.put_line('l_update_shipment_supply ' || l_update_shipment_supply);
1533: END IF;
1534:
1535: LOOP --{
1536: FETCH select_serials INTO l_select_serials;
1560: END IF;
1561:
1562: /* End Bug#3359105 */
1563: IF (l_delete_serial = 'Y') THEN --{
1564: IF (g_asn_debug = 'Y') THEN
1565: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
1566: asn_debug.put_line('l_from_serial_number ' || l_from_serial_number);
1567: asn_debug.put_line('l_to_serial_number ' || l_to_serial_number);
1568: END IF;
1561:
1562: /* End Bug#3359105 */
1563: IF (l_delete_serial = 'Y') THEN --{
1564: IF (g_asn_debug = 'Y') THEN
1565: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
1566: asn_debug.put_line('l_from_serial_number ' || l_from_serial_number);
1567: asn_debug.put_line('l_to_serial_number ' || l_to_serial_number);
1568: END IF;
1569:
1562: /* End Bug#3359105 */
1563: IF (l_delete_serial = 'Y') THEN --{
1564: IF (g_asn_debug = 'Y') THEN
1565: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
1566: asn_debug.put_line('l_from_serial_number ' || l_from_serial_number);
1567: asn_debug.put_line('l_to_serial_number ' || l_to_serial_number);
1568: END IF;
1569:
1570: DELETE FROM rcv_serials_supply
1563: IF (l_delete_serial = 'Y') THEN --{
1564: IF (g_asn_debug = 'Y') THEN
1565: asn_debug.put_line('l_serial_prefix ' || l_serial_prefix);
1566: asn_debug.put_line('l_from_serial_number ' || l_from_serial_number);
1567: asn_debug.put_line('l_to_serial_number ' || l_to_serial_number);
1568: END IF;
1569:
1570: DELETE FROM rcv_serials_supply
1571: WHERE transaction_id = p_parent_supply_id
1589: '0'
1590: );
1591:
1592: IF (l_insert_serial = 'Y') THEN --{
1593: IF (g_asn_debug = 'Y') THEN
1594: asn_debug.put_line('Before insert_serial_supply ');
1595: END IF;
1596:
1597: insert_serial_supply(p_interface_transaction_id,
1590: );
1591:
1592: IF (l_insert_serial = 'Y') THEN --{
1593: IF (g_asn_debug = 'Y') THEN
1594: asn_debug.put_line('Before insert_serial_supply ');
1595: END IF;
1596:
1597: insert_serial_supply(p_interface_transaction_id,
1598: l_select_serials.lot_number,
1601: p_parent_supply_id,
1602: x_return_status
1603: );
1604:
1605: IF (g_asn_debug = 'Y') THEN
1606: asn_debug.put_line('After insert_serial_supply ');
1607: END IF;
1608: END IF; --}
1609:
1602: x_return_status
1603: );
1604:
1605: IF (g_asn_debug = 'Y') THEN
1606: asn_debug.put_line('After insert_serial_supply ');
1607: END IF;
1608: END IF; --}
1609:
1610: IF ( (l_update_shipment_supply = 'Y')
1608: END IF; --}
1609:
1610: IF ( (l_update_shipment_supply = 'Y')
1611: AND (l_delete_serial = 'Y')) THEN --{
1612: IF (g_asn_debug = 'Y') THEN
1613: asn_debug.put_line('Before insert_serial_supply when update and delete serial is Y');
1614: END IF;
1615:
1616: insert_serial_supply(p_interface_transaction_id,
1609:
1610: IF ( (l_update_shipment_supply = 'Y')
1611: AND (l_delete_serial = 'Y')) THEN --{
1612: IF (g_asn_debug = 'Y') THEN
1613: asn_debug.put_line('Before insert_serial_supply when update and delete serial is Y');
1614: END IF;
1615:
1616: insert_serial_supply(p_interface_transaction_id,
1617: l_select_serials.lot_number,
1620: p_parent_supply_id,
1621: x_return_status
1622: );
1623:
1624: IF (g_asn_debug = 'Y') THEN
1625: asn_debug.put_line('After insert_serial_supply when update and delete serial is Y');
1626: END IF;
1627: END IF; --}
1628: END LOOP; --}
1621: x_return_status
1622: );
1623:
1624: IF (g_asn_debug = 'Y') THEN
1625: asn_debug.put_line('After insert_serial_supply when update and delete serial is Y');
1626: END IF;
1627: END IF; --}
1628: END LOOP; --}
1629:
1628: END LOOP; --}
1629:
1630: IF ( (l_update_shipment_supply = 'Y')
1631: AND (l_insert_serial = 'Y')) THEN --{
1632: IF (g_asn_debug = 'Y') THEN
1633: asn_debug.put_line('Before delete when update and insert serial is Y');
1634: END IF;
1635:
1636: SELECT shipment_header_id,
1629:
1630: IF ( (l_update_shipment_supply = 'Y')
1631: AND (l_insert_serial = 'Y')) THEN --{
1632: IF (g_asn_debug = 'Y') THEN
1633: asn_debug.put_line('Before delete when update and insert serial is Y');
1634: END IF;
1635:
1636: SELECT shipment_header_id,
1637: item_id
1662: WHERE rsl.shipment_header_id = l_shipment_header_id
1663: AND rsl.shipment_line_id = rss.shipment_line_id
1664: AND rsl.item_id = l_item_id);
1665:
1666: IF (g_asn_debug = 'Y') THEN
1667: asn_debug.put_line('After delete when update and insert serial is Y');
1668: END IF;
1669: END IF; --}
1670: END LOOP; --}
1663: AND rsl.shipment_line_id = rss.shipment_line_id
1664: AND rsl.item_id = l_item_id);
1665:
1666: IF (g_asn_debug = 'Y') THEN
1667: asn_debug.put_line('After delete when update and insert serial is Y');
1668: END IF;
1669: END IF; --}
1670: END LOOP; --}
1671:
1671:
1672: CLOSE select_serials;
1673: EXCEPTION
1674: WHEN NO_DATA_FOUND THEN
1675: IF (g_asn_debug = 'Y') THEN
1676: asn_debug.put_line('no_data_found update_rcv_serials_supply');
1677: END IF;
1678:
1679: x_return_status := fnd_api.g_ret_sts_error;
1672: CLOSE select_serials;
1673: EXCEPTION
1674: WHEN NO_DATA_FOUND THEN
1675: IF (g_asn_debug = 'Y') THEN
1676: asn_debug.put_line('no_data_found update_rcv_serials_supply');
1677: END IF;
1678:
1679: x_return_status := fnd_api.g_ret_sts_error;
1680:
1708: rti.program_update_date
1709: FROM rcv_transactions_interface rti
1710: WHERE rti.interface_transaction_id = p_interface_transaction_id;
1711: WHEN OTHERS THEN
1712: IF (g_asn_debug = 'Y') THEN
1713: asn_debug.put_line('others update_rcv_serials_supply');
1714: END IF;
1715:
1716: x_return_status := fnd_api.g_ret_sts_unexp_error;
1709: FROM rcv_transactions_interface rti
1710: WHERE rti.interface_transaction_id = p_interface_transaction_id;
1711: WHEN OTHERS THEN
1712: IF (g_asn_debug = 'Y') THEN
1713: asn_debug.put_line('others update_rcv_serials_supply');
1714: END IF;
1715:
1716: x_return_status := fnd_api.g_ret_sts_unexp_error;
1717:
1762: l_lot_count NUMBER;
1763: l_lpn_id rcv_supply.lpn_id%TYPE;
1764: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1765: BEGIN
1766: IF (g_asn_debug = 'Y') THEN
1767: asn_debug.put_line('Enter insert_lots_supply');
1768: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1769: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1770: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1763: l_lpn_id rcv_supply.lpn_id%TYPE;
1764: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1765: BEGIN
1766: IF (g_asn_debug = 'Y') THEN
1767: asn_debug.put_line('Enter insert_lots_supply');
1768: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1769: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1770: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1771: END IF;
1764: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1765: BEGIN
1766: IF (g_asn_debug = 'Y') THEN
1767: asn_debug.put_line('Enter insert_lots_supply');
1768: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1769: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1770: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1771: END IF;
1772:
1765: BEGIN
1766: IF (g_asn_debug = 'Y') THEN
1767: asn_debug.put_line('Enter insert_lots_supply');
1768: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1769: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1770: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1771: END IF;
1772:
1773: x_return_status := fnd_api.g_ret_sts_success;
1766: IF (g_asn_debug = 'Y') THEN
1767: asn_debug.put_line('Enter insert_lots_supply');
1768: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1769: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1770: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1771: END IF;
1772:
1773: x_return_status := fnd_api.g_ret_sts_success;
1774:
1786: IF (l_lot_count = 0) THEN
1787: RETURN;
1788: END IF;
1789:
1790: IF (g_asn_debug = 'Y') THEN
1791: asn_debug.put_line('l_lot_count ' || l_lot_count);
1792: END IF;
1793:
1794: /* We need to insert into rcv_lots_supply and
1787: RETURN;
1788: END IF;
1789:
1790: IF (g_asn_debug = 'Y') THEN
1791: asn_debug.put_line('l_lot_count ' || l_lot_count);
1792: END IF;
1793:
1794: /* We need to insert into rcv_lots_supply and
1795: * rcv_serials_supply table only when we come through ROI
1811: AND l_lpn_id = -999) THEN
1812: RETURN;
1813: END IF;
1814:
1815: IF (g_asn_debug = 'Y') THEN
1816: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
1817: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
1818: END IF;
1819: /* INVCONV, Remove sublot_num . Punit Kumar*/
1812: RETURN;
1813: END IF;
1814:
1815: IF (g_asn_debug = 'Y') THEN
1816: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
1817: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
1818: END IF;
1819: /* INVCONV, Remove sublot_num . Punit Kumar*/
1820:
1813: END IF;
1814:
1815: IF (g_asn_debug = 'Y') THEN
1816: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
1817: asn_debug.put_line('l_lpn_id ' || l_lpn_id);
1818: END IF;
1819: /* INVCONV, Remove sublot_num . Punit Kumar*/
1820:
1821: INSERT INTO rcv_lots_supply
1890: WHERE ( mtltview.product_transaction_id = p_interface_transaction_id
1891: AND mtltview.product_code = 'RCV'
1892: AND rs.supply_source_id = p_supply_source_id);
1893:
1894: IF (g_asn_debug = 'Y') THEN
1895: asn_debug.put_line('After insert into rcv_lots_supply ');
1896: asn_debug.put_line('INVCONV, Subllot_num has been removed in insert_lot_supply1 ');
1897: END IF;
1898:
1891: AND mtltview.product_code = 'RCV'
1892: AND rs.supply_source_id = p_supply_source_id);
1893:
1894: IF (g_asn_debug = 'Y') THEN
1895: asn_debug.put_line('After insert into rcv_lots_supply ');
1896: asn_debug.put_line('INVCONV, Subllot_num has been removed in insert_lot_supply1 ');
1897: END IF;
1898:
1899: OPEN c;
1892: AND rs.supply_source_id = p_supply_source_id);
1893:
1894: IF (g_asn_debug = 'Y') THEN
1895: asn_debug.put_line('After insert into rcv_lots_supply ');
1896: asn_debug.put_line('INVCONV, Subllot_num has been removed in insert_lot_supply1 ');
1897: END IF;
1898:
1899: OPEN c;
1900: FETCH c INTO l_rowid;
1905: END IF;
1906:
1907: CLOSE c;
1908:
1909: IF (g_asn_debug = 'Y') THEN
1910: asn_debug.put_line('Exit insert_lots_supply ');
1911: END IF;
1912: EXCEPTION
1913: WHEN NO_DATA_FOUND THEN
1906:
1907: CLOSE c;
1908:
1909: IF (g_asn_debug = 'Y') THEN
1910: asn_debug.put_line('Exit insert_lots_supply ');
1911: END IF;
1912: EXCEPTION
1913: WHEN NO_DATA_FOUND THEN
1914: IF (g_asn_debug = 'Y') THEN
1910: asn_debug.put_line('Exit insert_lots_supply ');
1911: END IF;
1912: EXCEPTION
1913: WHEN NO_DATA_FOUND THEN
1914: IF (g_asn_debug = 'Y') THEN
1915: asn_debug.put_line('no_data_found insert_lots_supply ');
1916: END IF;
1917:
1918: x_return_status := fnd_api.g_ret_sts_error;
1911: END IF;
1912: EXCEPTION
1913: WHEN NO_DATA_FOUND THEN
1914: IF (g_asn_debug = 'Y') THEN
1915: asn_debug.put_line('no_data_found insert_lots_supply ');
1916: END IF;
1917:
1918: x_return_status := fnd_api.g_ret_sts_error;
1919: RAISE;
1917:
1918: x_return_status := fnd_api.g_ret_sts_error;
1919: RAISE;
1920: WHEN OTHERS THEN
1921: IF (g_asn_debug = 'Y') THEN
1922: asn_debug.put_line('others insert_lots_supply ');
1923: END IF;
1924:
1925: x_return_status := fnd_api.g_ret_sts_unexp_error;
1918: x_return_status := fnd_api.g_ret_sts_error;
1919: RAISE;
1920: WHEN OTHERS THEN
1921: IF (g_asn_debug = 'Y') THEN
1922: asn_debug.put_line('others insert_lots_supply ');
1923: END IF;
1924:
1925: x_return_status := fnd_api.g_ret_sts_unexp_error;
1926: RAISE;
1943: l_serial_count NUMBER;
1944: l_lpn_id rcv_supply.lpn_id%TYPE;
1945: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1946: BEGIN
1947: IF (g_asn_debug = 'Y') THEN
1948: asn_debug.put_line('Enter insert_serial_supply ');
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1944: l_lpn_id rcv_supply.lpn_id%TYPE;
1945: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1946: BEGIN
1947: IF (g_asn_debug = 'Y') THEN
1948: asn_debug.put_line('Enter insert_serial_supply ');
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1952: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1945: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
1946: BEGIN
1947: IF (g_asn_debug = 'Y') THEN
1948: asn_debug.put_line('Enter insert_serial_supply ');
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1952: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1953: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1946: BEGIN
1947: IF (g_asn_debug = 'Y') THEN
1948: asn_debug.put_line('Enter insert_serial_supply ');
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1952: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1953: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1954: END IF;
1947: IF (g_asn_debug = 'Y') THEN
1948: asn_debug.put_line('Enter insert_serial_supply ');
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1952: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1953: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1954: END IF;
1955:
1948: asn_debug.put_line('Enter insert_serial_supply ');
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1952: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1953: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1954: END IF;
1955:
1956: x_return_status := fnd_api.g_ret_sts_success;
1949: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
1950: asn_debug.put_line('p_serial_number ' || p_serial_number);
1951: asn_debug.put_line('p_lot_number ' || p_lot_number);
1952: asn_debug.put_line('p_supply_type_code ' || p_supply_type_code);
1953: asn_debug.put_line('p_supply_source_id ' || p_supply_source_id);
1954: END IF;
1955:
1956: x_return_status := fnd_api.g_ret_sts_success;
1957:
1969: IF (l_serial_count = 0) THEN
1970: RETURN;
1971: END IF;
1972:
1973: IF (g_asn_debug = 'Y') THEN
1974: asn_debug.put_line('l_serial_count ' || l_serial_count);
1975: END IF;
1976:
1977: /* We need to insert into rcv_lots_supply and
1970: RETURN;
1971: END IF;
1972:
1973: IF (g_asn_debug = 'Y') THEN
1974: asn_debug.put_line('l_serial_count ' || l_serial_count);
1975: END IF;
1976:
1977: /* We need to insert into rcv_lots_supply and
1978: * rcv_serials_supply table only when we come through ROI
1994: AND l_lpn_id = -999) THEN
1995: RETURN;
1996: END IF;
1997:
1998: IF (g_asn_debug = 'Y') THEN
1999: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
2000: asn_debug.put_line(' l_lpn_id ' || l_lpn_id);
2001: END IF;
2002:
1995: RETURN;
1996: END IF;
1997:
1998: IF (g_asn_debug = 'Y') THEN
1999: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
2000: asn_debug.put_line(' l_lpn_id ' || l_lpn_id);
2001: END IF;
2002:
2003: /* We can only use rcv_transactions but in cases of direct deliver
1996: END IF;
1997:
1998: IF (g_asn_debug = 'Y') THEN
1999: asn_debug.put_line('l_validation_flag ' || l_validation_flag);
2000: asn_debug.put_line(' l_lpn_id ' || l_lpn_id);
2001: END IF;
2002:
2003: /* We can only use rcv_transactions but in cases of direct deliver
2004: * there will be two rows in rt with same interface_txn_id. Hence
2039: rs.program_update_date
2040: FROM rcv_supply rs
2041: WHERE rs.supply_source_id = p_supply_source_id;
2042:
2043: IF (g_asn_debug = 'Y') THEN
2044: asn_debug.put_line(' After insert into rcv_serials_supply');
2045: END IF;
2046:
2047: OPEN c;
2040: FROM rcv_supply rs
2041: WHERE rs.supply_source_id = p_supply_source_id;
2042:
2043: IF (g_asn_debug = 'Y') THEN
2044: asn_debug.put_line(' After insert into rcv_serials_supply');
2045: END IF;
2046:
2047: OPEN c;
2048: FETCH c INTO l_rowid;
2053: END IF;
2054:
2055: CLOSE c;
2056:
2057: IF (g_asn_debug = 'Y') THEN
2058: asn_debug.put_line(' Exit insert_serial_supply');
2059: END IF;
2060: EXCEPTION
2061: WHEN NO_DATA_FOUND THEN
2054:
2055: CLOSE c;
2056:
2057: IF (g_asn_debug = 'Y') THEN
2058: asn_debug.put_line(' Exit insert_serial_supply');
2059: END IF;
2060: EXCEPTION
2061: WHEN NO_DATA_FOUND THEN
2062: IF (g_asn_debug = 'Y') THEN
2058: asn_debug.put_line(' Exit insert_serial_supply');
2059: END IF;
2060: EXCEPTION
2061: WHEN NO_DATA_FOUND THEN
2062: IF (g_asn_debug = 'Y') THEN
2063: asn_debug.put_line(' no_data_found insert_serial_supply');
2064: END IF;
2065:
2066: x_return_status := fnd_api.g_ret_sts_error;
2059: END IF;
2060: EXCEPTION
2061: WHEN NO_DATA_FOUND THEN
2062: IF (g_asn_debug = 'Y') THEN
2063: asn_debug.put_line(' no_data_found insert_serial_supply');
2064: END IF;
2065:
2066: x_return_status := fnd_api.g_ret_sts_error;
2067: RAISE;
2065:
2066: x_return_status := fnd_api.g_ret_sts_error;
2067: RAISE;
2068: WHEN OTHERS THEN
2069: IF (g_asn_debug = 'Y') THEN
2070: asn_debug.put_line(' others insert_serial_supply');
2071: END IF;
2072:
2073: x_return_status := fnd_api.g_ret_sts_unexp_error;
2066: x_return_status := fnd_api.g_ret_sts_error;
2067: RAISE;
2068: WHEN OTHERS THEN
2069: IF (g_asn_debug = 'Y') THEN
2070: asn_debug.put_line(' others insert_serial_supply');
2071: END IF;
2072:
2073: x_return_status := fnd_api.g_ret_sts_unexp_error;
2074: RAISE;
2086: l_lot_count NUMBER;
2087: l_lpn_id rcv_supply.lpn_id%TYPE;
2088: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
2089: BEGIN
2090: IF (g_asn_debug = 'Y') THEN
2091: asn_debug.put_line(' enter insert_lot_transactions');
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2087: l_lpn_id rcv_supply.lpn_id%TYPE;
2088: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
2089: BEGIN
2090: IF (g_asn_debug = 'Y') THEN
2091: asn_debug.put_line(' enter insert_lot_transactions');
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2088: l_validation_flag rcv_transactions_interface.validation_flag%TYPE;
2089: BEGIN
2090: IF (g_asn_debug = 'Y') THEN
2091: asn_debug.put_line(' enter insert_lot_transactions');
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2096: asn_debug.put_line('p_correction_transaction_id ' || p_correction_transaction_id);
2089: BEGIN
2090: IF (g_asn_debug = 'Y') THEN
2091: asn_debug.put_line(' enter insert_lot_transactions');
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2096: asn_debug.put_line('p_correction_transaction_id ' || p_correction_transaction_id);
2097: asn_debug.put_line('p_negate_qty ' || p_negate_qty);
2090: IF (g_asn_debug = 'Y') THEN
2091: asn_debug.put_line(' enter insert_lot_transactions');
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2096: asn_debug.put_line('p_correction_transaction_id ' || p_correction_transaction_id);
2097: asn_debug.put_line('p_negate_qty ' || p_negate_qty);
2098: END IF;
2091: asn_debug.put_line(' enter insert_lot_transactions');
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2096: asn_debug.put_line('p_correction_transaction_id ' || p_correction_transaction_id);
2097: asn_debug.put_line('p_negate_qty ' || p_negate_qty);
2098: END IF;
2099:
2092: asn_debug.put_line('p_interface_transaction_id ' || p_interface_transaction_id);
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2096: asn_debug.put_line('p_correction_transaction_id ' || p_correction_transaction_id);
2097: asn_debug.put_line('p_negate_qty ' || p_negate_qty);
2098: END IF;
2099:
2100: x_return_status := fnd_api.g_ret_sts_success;
2093: asn_debug.put_line('p_lot_context ' || p_lot_context);
2094: asn_debug.put_line('p_lot_context_id ' || p_lot_context_id);
2095: asn_debug.put_line('p_source_transaction_id ' || p_source_transaction_id);
2096: asn_debug.put_line('p_correction_transaction_id ' || p_correction_transaction_id);
2097: asn_debug.put_line('p_negate_qty ' || p_negate_qty);
2098: END IF;
2099:
2100: x_return_status := fnd_api.g_ret_sts_success;
2101:
2207: WHERE mtltview.product_transaction_id = p_interface_transaction_id
2208: AND mtltview.product_code = 'RCV'
2209: AND rti.interface_transaction_id = mtltview.product_transaction_id;
2210:
2211: IF (g_asn_debug = 'Y') THEN
2212: asn_debug.put_line('Exit insert_lot_transactions ');
2213: asn_debug.put_line('INVCONV , sublot_num has not been inserted in rcv_lot_transactions');
2214: END IF;
2215: EXCEPTION
2208: AND mtltview.product_code = 'RCV'
2209: AND rti.interface_transaction_id = mtltview.product_transaction_id;
2210:
2211: IF (g_asn_debug = 'Y') THEN
2212: asn_debug.put_line('Exit insert_lot_transactions ');
2213: asn_debug.put_line('INVCONV , sublot_num has not been inserted in rcv_lot_transactions');
2214: END IF;
2215: EXCEPTION
2216: WHEN NO_DATA_FOUND THEN
2209: AND rti.interface_transaction_id = mtltview.product_transaction_id;
2210:
2211: IF (g_asn_debug = 'Y') THEN
2212: asn_debug.put_line('Exit insert_lot_transactions ');
2213: asn_debug.put_line('INVCONV , sublot_num has not been inserted in rcv_lot_transactions');
2214: END IF;
2215: EXCEPTION
2216: WHEN NO_DATA_FOUND THEN
2217: IF (g_asn_debug = 'Y') THEN
2213: asn_debug.put_line('INVCONV , sublot_num has not been inserted in rcv_lot_transactions');
2214: END IF;
2215: EXCEPTION
2216: WHEN NO_DATA_FOUND THEN
2217: IF (g_asn_debug = 'Y') THEN
2218: asn_debug.put_line('no_data_found insert_lot_transactions ');
2219: END IF;
2220:
2221: x_return_status := fnd_api.g_ret_sts_error;
2214: END IF;
2215: EXCEPTION
2216: WHEN NO_DATA_FOUND THEN
2217: IF (g_asn_debug = 'Y') THEN
2218: asn_debug.put_line('no_data_found insert_lot_transactions ');
2219: END IF;
2220:
2221: x_return_status := fnd_api.g_ret_sts_error;
2222: RAISE;
2220:
2221: x_return_status := fnd_api.g_ret_sts_error;
2222: RAISE;
2223: WHEN OTHERS THEN
2224: IF (g_asn_debug = 'Y') THEN
2225: asn_debug.put_line('others insert_lot_transactions ');
2226: END IF;
2227:
2228: x_return_status := fnd_api.g_ret_sts_unexp_error;
2221: x_return_status := fnd_api.g_ret_sts_error;
2222: RAISE;
2223: WHEN OTHERS THEN
2224: IF (g_asn_debug = 'Y') THEN
2225: asn_debug.put_line('others insert_lot_transactions ');
2226: END IF;
2227:
2228: x_return_status := fnd_api.g_ret_sts_unexp_error;
2229: RAISE;
2244: x_fail_if_one_line_fails VARCHAR2(1) := 'N';
2245: x_interface_type VARCHAR2(25) := 'RCV-856';
2246: x_dummy_flag VARCHAR2(1) := 'Y';
2247: BEGIN
2248: IF (g_asn_debug = 'Y') THEN
2249: asn_debug.put_line('Enter validate_lpn_groups ');
2250: asn_debug.put_line('group_id ' || p_group_id);
2251: asn_debug.put_line('p_request_id ' || p_request_id);
2252: END IF;
2245: x_interface_type VARCHAR2(25) := 'RCV-856';
2246: x_dummy_flag VARCHAR2(1) := 'Y';
2247: BEGIN
2248: IF (g_asn_debug = 'Y') THEN
2249: asn_debug.put_line('Enter validate_lpn_groups ');
2250: asn_debug.put_line('group_id ' || p_group_id);
2251: asn_debug.put_line('p_request_id ' || p_request_id);
2252: END IF;
2253:
2246: x_dummy_flag VARCHAR2(1) := 'Y';
2247: BEGIN
2248: IF (g_asn_debug = 'Y') THEN
2249: asn_debug.put_line('Enter validate_lpn_groups ');
2250: asn_debug.put_line('group_id ' || p_group_id);
2251: asn_debug.put_line('p_request_id ' || p_request_id);
2252: END IF;
2253:
2254: fnd_profile.get('RCV_FAIL_IF_LINE_FAILS', x_fail_if_one_line_fails);
2247: BEGIN
2248: IF (g_asn_debug = 'Y') THEN
2249: asn_debug.put_line('Enter validate_lpn_groups ');
2250: asn_debug.put_line('group_id ' || p_group_id);
2251: asn_debug.put_line('p_request_id ' || p_request_id);
2252: END IF;
2253:
2254: fnd_profile.get('RCV_FAIL_IF_LINE_FAILS', x_fail_if_one_line_fails);
2255: OPEN rcv_processor_pvt.lpn_grps_cur(p_request_id, p_group_id);
2258: FETCH rcv_processor_pvt.lpn_grps_cur INTO l_lpn_group_id;
2259: EXIT WHEN rcv_processor_pvt.lpn_grps_cur%NOTFOUND;
2260:
2261: IF l_lpn_group_id IS NOT NULL THEN --{
2262: IF (g_asn_debug = 'Y') THEN
2263: asn_debug.put_line('Before calling inv api ');
2264: END IF;
2265:
2266: l_return := inv_rcv_integration_apis.validate_lpn_info(1.0,
2259: EXIT WHEN rcv_processor_pvt.lpn_grps_cur%NOTFOUND;
2260:
2261: IF l_lpn_group_id IS NOT NULL THEN --{
2262: IF (g_asn_debug = 'Y') THEN
2263: asn_debug.put_line('Before calling inv api ');
2264: END IF;
2265:
2266: l_return := inv_rcv_integration_apis.validate_lpn_info(1.0,
2267: fnd_api.g_true,
2271: inv_rcv_integration_apis.g_exists_or_create,
2272: l_lpn_group_id
2273: );
2274:
2275: IF (g_asn_debug = 'Y') THEN
2276: asn_debug.put_line('After calling inv api ');
2277: END IF;
2278:
2279: --If l_ret_status <> fnd_api.g_ret_sts_success then --
2272: l_lpn_group_id
2273: );
2274:
2275: IF (g_asn_debug = 'Y') THEN
2276: asn_debug.put_line('After calling inv api ');
2277: END IF;
2278:
2279: --If l_ret_status <> fnd_api.g_ret_sts_success then --
2280: IF (l_return <> TRUE) THEN --{
2277: END IF;
2278:
2279: --If l_ret_status <> fnd_api.g_ret_sts_success then --
2280: IF (l_return <> TRUE) THEN --{
2281: IF (g_asn_debug = 'Y') THEN
2282: asn_debug.put_line('l_return is false ');
2283: END IF;
2284:
2285: IF (x_fail_if_one_line_fails = 'Y') THEN
2278:
2279: --If l_ret_status <> fnd_api.g_ret_sts_success then --
2280: IF (l_return <> TRUE) THEN --{
2281: IF (g_asn_debug = 'Y') THEN
2282: asn_debug.put_line('l_return is false ');
2283: END IF;
2284:
2285: IF (x_fail_if_one_line_fails = 'Y') THEN
2286: IF (g_asn_debug = 'Y') THEN
2282: asn_debug.put_line('l_return is false ');
2283: END IF;
2284:
2285: IF (x_fail_if_one_line_fails = 'Y') THEN
2286: IF (g_asn_debug = 'Y') THEN
2287: asn_debug.put_line(' fail line is Y');
2288: END IF;
2289:
2290: SELECT NVL(header_interface_id, -999),
2283: END IF;
2284:
2285: IF (x_fail_if_one_line_fails = 'Y') THEN
2286: IF (g_asn_debug = 'Y') THEN
2287: asn_debug.put_line(' fail line is Y');
2288: END IF;
2289:
2290: SELECT NVL(header_interface_id, -999),
2291: auto_transact_code,
2306: we must delete the shipment_header if it exists
2307: update the rhi and rti to error for the shipment_headerid */
2308: IF l_header_id <> -999
2309: AND l_asn_type = 'SHIP' THEN --{
2310: IF (g_asn_debug = 'Y') THEN
2311: asn_debug.put_line(' This is an ASN');
2312: END IF;
2313:
2314: UPDATE rcv_headers_interface
2307: update the rhi and rti to error for the shipment_headerid */
2308: IF l_header_id <> -999
2309: AND l_asn_type = 'SHIP' THEN --{
2310: IF (g_asn_debug = 'Y') THEN
2311: asn_debug.put_line(' This is an ASN');
2312: END IF;
2313:
2314: UPDATE rcv_headers_interface
2315: SET processing_status_code = 'ERROR'
2322: );
2323: ELSE
2324: /* for non-ASN transactions we should update the corresponding lpn group
2325: to error */
2326: IF (g_asn_debug = 'Y') THEN
2327: asn_debug.put_line(' Before updating rti error');
2328: END IF;
2329:
2330: rcv_roi_preprocessor.update_rti_error(p_group_id => p_group_id,
2323: ELSE
2324: /* for non-ASN transactions we should update the corresponding lpn group
2325: to error */
2326: IF (g_asn_debug = 'Y') THEN
2327: asn_debug.put_line(' Before updating rti error');
2328: END IF;
2329:
2330: rcv_roi_preprocessor.update_rti_error(p_group_id => p_group_id,
2331: p_interface_id => NULL,
2344: END LOOP; --}
2345:
2346: CLOSE rcv_processor_pvt.lpn_grps_cur;
2347:
2348: IF (g_asn_debug = 'Y') THEN
2349: asn_debug.put_line(' Exit validate_lpn_groups');
2350: END IF;
2351: END validate_lpn_groups;
2352: END rcv_processor_pvt;
2345:
2346: CLOSE rcv_processor_pvt.lpn_grps_cur;
2347:
2348: IF (g_asn_debug = 'Y') THEN
2349: asn_debug.put_line(' Exit validate_lpn_groups');
2350: END IF;
2351: END validate_lpn_groups;
2352: END rcv_processor_pvt;