1 PACKAGE BODY inv_pick_slip_report AS
2 /* $Header: INVPKSLB.pls 120.6.12010000.3 2009/11/16 20:46:02 pupakare ship $ */
3
4 g_pkg_name CONSTANT VARCHAR2(30) := 'INV_PICK_SLIP_REPORT';
5
6 PROCEDURE mydebug(p_message VARCHAR2, p_api_name VARCHAR2) IS
7 BEGIN
8 inv_log_util.trace(p_message, g_pkg_name || '.' || p_api_name, 9);
9 END;
10
11 FUNCTION chk_wms_install(p_organization_id IN NUMBER)
12 RETURN VARCHAR2 IS
13 l_msg_count NUMBER;
14 l_msg_data VARCHAR2(2000);
15 l_api_name CONSTANT VARCHAR(30) := 'CHK_WMS_INSTALL';
16 l_return_status VARCHAR2(1);
17 BEGIN
18 IF wms_install.check_install(x_return_status => l_return_status, x_msg_count => l_msg_count, x_msg_data => l_msg_data
19 , p_organization_id => p_organization_id) THEN
20 RETURN 'TRUE';
21 ELSE
22 RETURN 'FALSE';
23 END IF;
24 EXCEPTION
25 WHEN OTHERS THEN
26 IF (fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)) THEN
27 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
28 END IF;
29
30 RETURN 'FALSE';
31 END chk_wms_install;
32
33 PROCEDURE run_detail_engine(
34 x_return_status OUT NOCOPY VARCHAR2
35 , p_org_id NUMBER
36 , p_move_order_type NUMBER
37 , p_move_order_from VARCHAR2
38 , p_move_order_to VARCHAR2
39 , p_source_subinv VARCHAR2
40 , p_source_locator_id NUMBER
41 , p_dest_subinv VARCHAR2
42 , p_dest_locator_id NUMBER
43 , p_sales_order_from VARCHAR2
44 , p_sales_order_to VARCHAR2
45 , p_freight_code VARCHAR2
46 , p_customer_id NUMBER
47 , p_requested_by NUMBER
48 , p_date_reqd_from DATE
49 , p_date_reqd_to DATE
50 , p_plan_tasks BOOLEAN
51 , p_pick_slip_group_rule_id NUMBER
52 , p_request_id NUMBER
53 ) IS
54 /***************************************************************************
55 Created By :
56 Date Created on :
57 Purpose : This procedure will be called from Move Order Pick Slip Report.
58 Change History
59 Who When What
60 ------------------------------------------------------------------------
61 Nalin Kumar 22-Nov-2004 Modified the Procedure and added parameter p_request_id
62 to fix Bug# 4003379.
63 ------------------------------------------------------------------------
64 Reason why the p_request_id parameter has been introduced into this procedure:
65 Assume that
66 o CURSOR c_move_order_lines has 97 records
67 o 'INV: Pick Slip Batch Size' profile value is set to 10
68 - Basically to eliminate already processed records from getting selected again and again into
69 c_move_order_lines CURSOR the request_id has be introduced in this procedure.
70 - Once the number of records processed becomes equal to the value specified in 'INV: Pick Slip Batch Size'
71 profile (10) then a COMMIT is issued and the c_move_order_lines is CLOSED and OPENED once again
72 (to eliminate the 'ORA-01002: fetch out of sequence' Error). When the c_move_order_lines CURSOR
73 is OPENED for the second time then the CURSOR MAY fetch the already processed records. But the
74 idea is to process only unprocessed records and after CLOSING the CURSOR there was no pointer to
75 find out that which all records have been already processed. So to identify the processed records
76 we are updating the request_id column in mtl_txn_request_lines along with quantity_detailed. And
77 the same (request_id) column is now being used to identify unprocessed records.
78 *****************************************************************************/
79 l_api_name VARCHAR2(30);
80
81 l_msg_data VARCHAR2(2000);
82 l_msg_count NUMBER;
83
84 l_max_batch NUMBER;
85 l_batch_size NUMBER;
86
87 l_num_of_rows NUMBER := 0;
88 l_detailed_qty NUMBER := 0;
89 l_secondary_detailed_qty NUMBER := NULL; -- INVCONV
90 l_revision VARCHAR2(3) := NULL;
91 l_from_loc_id NUMBER := 0;
92 l_to_loc_id NUMBER := 0;
93 -- Increased lot size to 80 Char - Mercy Thomas - B4625329
94 l_lot_number VARCHAR2(80);
95 l_expiration_date DATE;
96 l_transaction_temp_id NUMBER;
97 l_txn_header_id NUMBER;
98 l_serial_flag VARCHAR2(1);
99
100 l_pick_slip_no NUMBER;
101 l_prev_header_id NUMBER := 0;
102 l_req_msg VARCHAR2(30) := NULL;
103 l_tracking_quantity_ind VARCHAR2(30) := NULL;
104 /*CURSOR c_move_order_lines IS
105 SELECT mtrh.header_id
106 , mtrh.move_order_type
107 , mtrl.line_id
108 , mtrl.inventory_item_id
109 , mtrl.to_account_id
110 , mtrl.project_id
111 , mtrl.task_id
112 FROM mtl_txn_request_lines mtrl
113 , mtl_txn_request_headers mtrh
114 WHERE mtrl.line_status IN (3, 7)
115 AND mtrh.organization_id = p_org_id
116 AND (p_move_order_from IS NULL OR mtrh.request_number >= p_move_order_from)
117 AND (p_move_order_to IS NULL OR mtrh.request_number <= p_move_order_to)
118 AND ( (p_move_order_type = 99 AND mtrh.move_order_type IN (1,2,3,5))
119 OR (p_move_order_type = 1 AND mtrh.move_order_type = 3)
120 OR (p_move_order_type = 2 AND mtrh.move_order_type = 5)
121 OR (p_move_order_type = 4 AND mtrh.move_order_type IN (1,2))
122 )
123 AND mtrl.header_id = mtrh.header_id
124 AND mtrl.organization_id = p_org_id
125 AND mtrl.quantity > NVL(mtrl.quantity_detailed, 0)
126 AND (p_requested_by IS NULL OR mtrl.created_by = p_requested_by)
127 AND (p_source_subinv IS NULL OR mtrl.from_subinventory_code = p_source_subinv)
128 AND (p_source_locator_id IS NULL OR mtrl.from_locator_id = p_source_locator_id)
129 AND (p_dest_subinv IS NULL OR mtrl.to_subinventory_code = p_dest_subinv)
130 AND (p_dest_locator_id IS NULL OR mtrl.to_locator_id = p_dest_locator_id)
131 AND ((p_sales_order_from IS NULL AND p_sales_order_to IS NULL AND p_customer_id IS NULL AND p_freight_code IS NULL)
132 OR EXISTS (SELECT 1
133 FROM wsh_delivery_details wdd
134 WHERE wdd.organization_id = p_org_id
135 AND wdd.move_order_line_id = mtrl.line_id
136 AND (p_sales_order_from IS NULL OR wdd.source_header_number >= p_sales_order_from)
137 AND (p_sales_order_to IS NULL OR wdd.source_header_number <= p_sales_order_to)
138 AND (p_customer_id IS NULL OR wdd.customer_id = p_customer_id)
139 AND (p_freight_code IS NULL OR wdd.ship_method_code = p_freight_code))
140 )
141 ORDER BY mtrl.header_id; Commented for bug 3772012 */
142
143 CURSOR c_move_order_lines (l_header_id NUMBER, l_move_order_type NUMBER,
144 l_profile_value NUMBER /* Added to fix Bug# 4003379 */) IS
145 SELECT l_header_id header_id
146 , l_move_order_type move_order_type
147 , mtrl.line_id
148 , mtrl.inventory_item_id
149 , mtrl.to_account_id
150 , mtrl.project_id
151 , mtrl.task_id
152 , mtrl.quantity_detailed
153 FROM mtl_txn_request_lines mtrl
154 WHERE mtrl.line_status IN (3, 7)
155 AND mtrl.organization_id = p_org_id
156 AND mtrl.header_id = l_header_id
157 AND mtrl.quantity > NVL(mtrl.quantity_detailed, 0)
158 AND (p_requested_by IS NULL OR mtrl.created_by = p_requested_by)
159 AND (p_source_subinv IS NULL OR mtrl.from_subinventory_code = p_source_subinv)
160 AND (p_source_locator_id IS NULL OR mtrl.from_locator_id = p_source_locator_id)
161 AND (p_dest_subinv IS NULL OR mtrl.to_subinventory_code = p_dest_subinv)
162 AND (p_dest_locator_id IS NULL OR mtrl.to_locator_id = p_dest_locator_id)
163 AND (p_date_reqd_from IS NULL OR mtrl.date_required >= p_date_reqd_from) /* Added to fix Bug# 4078103 */
164 --bug 6850379
165 AND (p_date_reqd_to IS NULL OR (mtrl.date_required <= trunc(p_date_reqd_to+1)-0.00001)) /* Added to fix Bug# 4078103 */
166 --bug 6850379
167 AND ((p_sales_order_from IS NULL AND p_sales_order_to IS NULL AND p_customer_id IS NULL AND p_freight_code IS NULL)
168 OR EXISTS (SELECT 1
169 FROM wsh_delivery_details wdd
170 WHERE wdd.organization_id = p_org_id
171 AND wdd.move_order_line_id = mtrl.line_id
172 AND (p_sales_order_from IS NULL OR wdd.source_header_number >= p_sales_order_from)
173 AND (p_sales_order_to IS NULL OR wdd.source_header_number <= p_sales_order_to)
174 AND (p_customer_id IS NULL OR wdd.customer_id = p_customer_id)
175 AND (p_freight_code IS NULL OR wdd.ship_method_code = p_freight_code))
176 )
177 AND NVL(mtrl.request_id, 0) < p_request_id
178 /* Added to fix Bug# 4003379; If the record does not have any request_id or
179 it is less than current request_id that means- that record has not been
180 processed by this request so select that record for processing. */
181 AND rownum < l_profile_value +1
182 /* Added to fix Bug# 4003379; ROWNUM is introduced to fetch and lock only
183 that many records which has to be processed in a single go based on the
184 value of the 'INV: Pick Slip Batch Size' profile. */
185 FOR UPDATE OF mtrl.quantity_detailed NOWAIT; -- Added 3772012
186
187 CURSOR c_move_order_header IS
188 SELECT mtrh.header_id
189 , mtrh.move_order_type
190 FROM mtl_txn_request_headers mtrh
191 WHERE mtrh.organization_id = p_org_id
192 AND (p_move_order_from IS NULL OR mtrh.request_number >= p_move_order_from)
193 AND (p_move_order_to IS NULL OR mtrh.request_number <= p_move_order_to)
194 AND ( (p_move_order_type = 99 AND mtrh.move_order_type IN (1,2,3,5))
195 OR (p_move_order_type = 1 AND mtrh.move_order_type = 3)
196 OR (p_move_order_type = 2 AND mtrh.move_order_type = 5)
197 OR (p_move_order_type = 3 AND mtrh.move_order_type = 5) --Bug #4700988 MFG Pick
198 OR (p_move_order_type = 4 AND mtrh.move_order_type IN (1,2))
199 );
200
201 CURSOR c_mmtt(p_mo_line_id NUMBER) IS
202 SELECT transaction_temp_id
203 , subinventory_code
204 , locator_id
205 , transfer_subinventory
206 , transfer_to_location
207 , revision
208 FROM mtl_material_transactions_temp
209 WHERE move_order_line_id = p_mo_line_id
210 AND pick_slip_number IS NULL;
211
212 l_debug NUMBER;
213 record_locked EXCEPTION; -- bug 3772012
214 PRAGMA EXCEPTION_INIT(record_locked, -54); -- bug 3772012
215 v_mo_line_rec c_move_order_lines%ROWTYPE;
216 BEGIN
217 /* Initializing the default values */
218 l_api_name := 'RUN_DETAIL_ENGINE';
219 l_serial_flag := 'F';
220 l_debug := NVL(fnd_profile.VALUE('INV_DEBUG_TRACE'), 0);
221
222 IF l_debug = 1 THEN
223 mydebug('Running Detail Engine with Parameters...', l_api_name);
224 mydebug(' Organization ID = ' || p_org_id, l_api_name);
225 mydebug(' Move Order Type = ' || p_move_order_type, l_api_name);
226 mydebug(' Move Order From = ' || p_move_order_from, l_api_name);
227 mydebug(' Move Order To = ' || p_move_order_to, l_api_name);
228 mydebug(' Source Subinventory = ' || p_source_subinv, l_api_name);
229 mydebug(' Source Locator = ' || p_source_locator_id, l_api_name);
230 mydebug(' Dest Subinventory = ' || p_dest_subinv, l_api_name);
231 mydebug(' Dest Locator = ' || p_dest_locator_id, l_api_name);
232 mydebug(' Sales Order From = ' || p_sales_order_from, l_api_name);
233 mydebug(' Sales Order To = ' || p_sales_order_to, l_api_name);
234 mydebug(' Freight Code = ' || p_freight_code, l_api_name);
235 mydebug(' Customer ID = ' || p_customer_id, l_api_name);
236 mydebug(' Requested By = ' || p_requested_by, l_api_name);
237 mydebug(' Date Required From = ' || p_date_reqd_from, l_api_name);
238 mydebug(' Date Required To = ' || p_date_reqd_to, l_api_name);
239 mydebug(' PickSlip Group Rule = ' || p_pick_slip_group_rule_id, l_api_name);
240 mydebug(' Request ID = ' || p_request_id, l_api_name);
241 END IF;
242
243 l_max_batch := TO_NUMBER(fnd_profile.VALUE('INV_PICK_SLIP_BATCH_SIZE'));
244
245 IF (l_debug = 1) THEN
246 mydebug('Maximum Batch Size = ' || l_max_batch, l_api_name);
247 END IF;
248
249 IF l_max_batch IS NULL OR l_max_batch <= 0 THEN
250 l_max_batch := 20;
251
252 IF (l_debug = 1) THEN
253 mydebug('Using Default Batch Size 20', l_api_name);
254 END IF;
255 END IF;
256
257 l_batch_size := 0;
258
259 --device integration starts
260 IF (inv_install.adv_inv_installed(p_org_id) = TRUE) THEN --for WMS org
261 IF wms_device_integration_pvt.wms_call_device_request IS NULL THEN
262
263 IF (l_debug = 1) THEN
264 mydebug('Setting global variable for device integration call', l_api_name);
265 END IF;
266 wms_device_integration_pvt.is_device_set_up(p_org_id,wms_device_integration_pvt.WMS_BE_MO_TASK_ALLOC,x_return_status);
267 END IF;
268 END IF;
269 --device integration end
270
271 FOR v_mo_header_rec IN c_move_order_header LOOP -- Added 3772012
272 BEGIN
273 /* FOR v_mo_line_rec IN c_move_order_lines(v_mo_header_rec.header_id, v_mo_header_rec.move_order_type) LOOP */
274 --Start of new code to fix Bug# 4003379
275 OPEN c_move_order_lines(v_mo_header_rec.header_id,
276 v_mo_header_rec.move_order_type,
277 l_max_batch); /* Changed from FOR loop Bug# 4003379 */
278 LOOP
279 FETCH c_move_order_lines INTO v_mo_line_rec;
280 IF c_move_order_lines%NOTFOUND THEN
281 CLOSE c_move_order_lines;
282 COMMIT;
283 l_batch_size := 0;
284 EXIT;
285 END IF;
286 --END of new code added to fix Bug# 4003379
287 l_batch_size := l_batch_size + 1;
288 IF v_mo_line_rec.header_id <> l_prev_header_id THEN
289 l_prev_header_id := v_mo_line_rec.header_id;
290 IF p_pick_slip_group_rule_id IS NOT NULL AND v_mo_line_rec.move_order_type IN (1,2) THEN
291 IF l_debug = 1 THEN
292 mydebug('New Header ID... So updating Pick Slip Grouping Rule', l_api_name);
293 END IF;
294 UPDATE mtl_txn_request_headers
295 SET grouping_rule_id = p_pick_slip_group_rule_id
296 WHERE header_id = v_mo_line_rec.header_id;
297 END IF;
298 END IF;
299
300 SELECT decode(serial_number_control_code, 1, 'F', 'T'), tracking_quantity_ind
301 INTO l_serial_flag, l_tracking_quantity_ind -- Bug 8985168
302 FROM mtl_system_items
303 WHERE inventory_item_id = v_mo_line_rec.inventory_item_id
304 AND organization_id = p_org_id;
305
306 SELECT mtl_material_transactions_s.NEXTVAL INTO l_txn_header_id FROM DUAL;
307
308 inv_replenish_detail_pub.line_details_pub(
309 x_return_status => x_return_status
310 , x_msg_count => l_msg_count
311 , x_msg_data => l_msg_data
312 , x_number_of_rows => l_num_of_rows
313 , x_detailed_qty => l_detailed_qty
314 , x_detailed_qty2 => l_secondary_detailed_qty --INVCONV
315 , x_revision => l_revision
316 , x_locator_id => l_from_loc_id
317 , x_transfer_to_location => l_to_loc_id
321 , p_line_id => v_mo_line_rec.line_id
318 , x_lot_number => l_lot_number
319 , x_expiration_date => l_expiration_date
320 , x_transaction_temp_id => l_transaction_temp_id
322 , p_transaction_header_id => l_txn_header_id
323 , p_transaction_mode => NULL
324 , p_move_order_type => v_mo_line_rec.move_order_type
325 , p_serial_flag => l_serial_flag
326 , p_plan_tasks => p_plan_tasks
327 , p_auto_pick_confirm => FALSE
328 );
329
330
331 --
332 -- Bug 8985168
333 -- Handling the situation where the primary detailed quantity has become 0.
334 IF l_debug = 1 THEN
335 mydebug('l_tracking_quantity_ind : ' ||l_tracking_quantity_ind,
336 l_api_name);
337 mydebug('(1)l_detailed_qty : ' || l_detailed_qty, l_api_name);
338 mydebug('(1)l_secondary_detailed_qty : ' || l_secondary_detailed_qty, l_api_name);
339 END IF;
340 IF (l_tracking_quantity_ind = 'PS') THEN
341 IF (l_detailed_qty = 0) THEN
342 l_secondary_detailed_qty := 0;
343 END IF;
344 -- here theoretically we an raise an error if primary is NON zero while secondary is NULL or 0.
345 -- but we will not raise this error at this time!
346 ELSE
347 l_secondary_detailed_qty := NULL;
348 END IF;
349
350 IF l_debug = 1 THEN
351 mydebug('(2)l_detailed_qty : ' || l_detailed_qty, l_api_name);
352 mydebug('(2)l_secondary_detailed_qty : ' || l_secondary_detailed_qty, l_api_name);
353 END IF;
354 -- End Bug 8985168
355
356 --Bug #4155230
357 UPDATE mtl_txn_request_lines
358 SET quantity_detailed = (NVL(quantity_delivered, 0) + l_detailed_qty),
359 --secondary_quantity_detailed = decode(l_secondary_detailed_qty, 0, NULL, l_secondary_detailed_qty), --INVCONV
360 secondary_quantity_detailed = NVL(secondary_quantity_delivered,0) + l_secondary_detailed_qty, -- Bug 8985168
361 request_id = p_request_id /* Added the updation of request_id to fix Bug# 4003379 */
362 WHERE line_id = v_mo_line_rec.line_id
363 AND organization_id = p_org_id;
364
365 IF l_debug = 1 THEN
366 mydebug('Allocated MO Line = ' || v_mo_line_rec.line_id || ' : Qty Detailed = ' || l_detailed_qty, l_api_name);
367 END IF;
368
369 IF p_pick_slip_group_rule_id IS NOT NULL AND v_mo_line_rec.move_order_type IN (1,2) THEN
370 -- Looping for each allocation of the MO Line for which Pick Slip Number is not stamped.
371 FOR v_mmtt IN c_mmtt(v_mo_line_rec.line_id) LOOP
372 inv_pr_pick_slip_number.get_pick_slip_number(
373 x_api_status => x_return_status
374 , x_error_message => l_msg_data
375 , x_pick_slip_number => l_pick_slip_no
376 , p_pick_grouping_rule_id => p_pick_slip_group_rule_id
377 , p_org_id => p_org_id
378 , p_inventory_item_id => v_mo_line_rec.inventory_item_id
379 , p_revision => v_mmtt.revision
380 , p_lot_number => NULL
381 , p_src_subinventory => v_mmtt.subinventory_code
382 , p_src_locator_id => v_mmtt.locator_id
383 , p_supply_subinventory => v_mmtt.transfer_subinventory
384 , p_supply_locator_id => v_mmtt.transfer_to_location
385 , p_project_id => v_mo_line_rec.project_id
386 , p_task_id => v_mo_line_rec.task_id
387 , p_wip_entity_id => NULL
388 , p_rep_schedule_id => NULL
389 , p_operation_seq_num => NULL
390 , p_dept_id => NULL
391 , p_push_or_pull => NULL
392 );
393
394 UPDATE mtl_material_transactions_temp
395 SET pick_slip_number = l_pick_slip_no
396 WHERE transaction_temp_id = v_mmtt.transaction_temp_id;
397 END LOOP;
398 END IF;
399
400 /*Bug#5140639. Commented the updation of 'distribution_account_id' in MMTT as
401 it is already done in 'INV_Replenish_Detail_PUB.Line_Details_PUB' */
402
403 /* IF v_mo_line_rec.to_account_id IS NOT NULL THEN
404 UPDATE mtl_material_transactions_temp
405 SET distribution_account_id = v_mo_line_rec.to_account_id
406 WHERE move_order_line_id = v_mo_line_rec.line_id;
407 END IF;*/
408
409 IF l_batch_size >= l_max_batch THEN
410 IF (l_debug = 1) THEN
411 mydebug('Current Batch Completed... Committing.',l_api_name);
412 END IF;
413 IF c_move_order_lines%ISOPEN THEN --Added to fix Bug# 4003379
414 CLOSE c_move_order_lines;
415 END IF;
416 COMMIT;
417 OPEN c_move_order_lines(v_mo_header_rec.header_id,
418 v_mo_header_rec.move_order_type,
419 l_max_batch); --Changed from FOR loop bug 4003379
420
421 l_batch_size := 0;
422 END IF;
423 END LOOP;
424 EXCEPTION -- Added 3772012
425 WHEN record_locked THEN
426 fnd_message.set_name('INV', 'INV_MO_LOCKED_SO');
427 IF (l_debug = 1 ) THEN
428 inv_log_util.TRACE('Lines for header '||v_mo_header_rec.header_id||' are locked', 'INV_UTILITIES', 9);
429 END IF;
430 fnd_msg_pub.ADD;
431 END;
432 END LOOP;
436 END IF;
433
434 IF (l_debug = 1) THEN
435 inv_log_util.TRACE('calling Device Integration',l_api_name);
437 -- Call Device Integration API to send the details of this
438 -- PickRelease Wave for Move Order Allocation to devices, if it is a WMS organization.
439 -- Note: We don't check for the return condition of this API as
440 -- we let the Move Order Allocation process succeed
441 -- irrespective of DeviceIntegration succeed or fail.
442 IF (wms_install.check_install(
443 x_return_status => x_return_status,
444 x_msg_count => l_msg_count,
445 x_msg_data => l_msg_data,
446 p_organization_id => p_org_id
447 ) = TRUE ) THEN
448 wms_device_integration_pvt.device_request(
449 p_bus_event => WMS_DEVICE_INTEGRATION_PVT.WMS_BE_MO_TASK_ALLOC,
450 p_call_ctx => WMS_Device_integration_pvt.DEV_REQ_AUTO,
451 p_task_trx_id => NULL,
452 x_request_msg => l_req_msg,
453 x_return_status => x_return_status,
454 x_msg_count => l_msg_count,
455 x_msg_data => l_msg_data);
456
457 IF (l_debug = 1) THEN
458 inv_log_util.TRACE('Device_API: returned status:'||x_return_status, l_api_name);
459 END IF;
460 END IF;
461
462 IF c_move_order_lines%ISOPEN THEN --Added to fix Bug# 4003379
463 CLOSE c_move_order_lines;
464 END IF;
465
466 COMMIT;
467 EXCEPTION
468 WHEN OTHERS THEN
469 x_return_status := fnd_api.g_ret_sts_unexp_error;
470 IF c_move_order_lines%ISOPEN THEN --Added to fix Bug# 4003379
471 CLOSE c_move_order_lines;
472 END IF;
473 END run_detail_engine;
474
475 FUNCTION print_pick_slip(
476 p_organization_id VARCHAR2
477 , p_move_order_from VARCHAR2
478 , p_move_order_to VARCHAR2
479 , p_pick_slip_number_from VARCHAR2
480 , p_pick_slip_number_to VARCHAR2
481 , p_source_subinv VARCHAR2
482 , p_source_locator VARCHAR2
483 , p_dest_subinv VARCHAR2
484 , p_dest_locator VARCHAR2
485 , p_requested_by VARCHAR2
486 , p_date_reqd_from VARCHAR2
487 , p_date_reqd_to VARCHAR2
488 , p_print_option VARCHAR2
489 , p_print_mo_type VARCHAR2
490 , p_sales_order_from VARCHAR2
491 , p_sales_order_to VARCHAR2
492 , p_ship_method_code VARCHAR2
493 , p_customer_id VARCHAR2
494 , p_auto_allocate VARCHAR2
495 , p_plan_tasks VARCHAR2
496 , p_pick_slip_group_rule_id VARCHAR2
497 ) RETURN NUMBER IS
498 l_msg_data VARCHAR2(1000);
499 l_msg_count NUMBER;
500 l_api_name VARCHAR2(30);
501 l_debug NUMBER;
502 l_request_id NUMBER;
503 BEGIN
504 /* Initializing the default values */
505 l_api_name := 'PRINT_PICK_SLIP';
506 l_debug := NVL(fnd_profile.VALUE('INV_DEBUG_TRACE'), 0);
507
508 l_request_id := fnd_request.submit_request(
509 application => 'INV'
510 , program => 'INVTOPKL'
511 , description => NULL
512 , start_time => NULL
513 , sub_request => FALSE
514 , argument1 => p_organization_id
515 , argument2 => p_move_order_from
516 , argument3 => p_move_order_to
517 , argument4 => p_pick_slip_number_from
518 , argument5 => p_pick_slip_number_to
519 , argument6 => p_source_subinv
520 , argument7 => p_source_locator
521 , argument8 => p_dest_subinv
522 , argument9 => p_dest_locator
523 , argument10 => p_requested_by
524 , argument11 => p_date_reqd_from
525 , argument12 => p_date_reqd_to
526 , argument13 => p_print_option
527 , argument14 => p_print_mo_type
528 , argument15 => p_sales_order_from
529 , argument16 => p_sales_order_to
530 , argument17 => p_ship_method_code
531 , argument18 => p_customer_id
532 , argument19 => p_auto_allocate
533 , argument20 => p_plan_tasks
534 , argument21 => p_pick_slip_group_rule_id
535 );
536
537 IF l_debug = 1 THEN
538 mydebug('Request ID = ' || l_request_id, l_api_name);
539 END IF;
540
541 IF l_request_id = 0 THEN
542 fnd_msg_pub.count_and_get(p_encoded=>fnd_api.g_false,p_data=>l_msg_data, p_count=>l_msg_count);
543 IF l_debug = 1 THEN
544 mydebug('Unable to submit the MO Pick Slip Request - ' || l_msg_data, l_api_name);
545 END IF;
546 END IF;
547
548 RETURN l_request_id;
549 END print_pick_slip;
550
551 END inv_pick_slip_report;