DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_REQIMP_S

Source


1 PACKAGE BODY PO_REQIMP_S AS
2 /* $Header: POXRQIMB.pls 120.3 2006/08/16 17:31:04 pbamb noship $*/
3 
4 --< Bug 3540365 Start >
5 g_bulk_limit CONSTANT NUMBER := 1000;  -- Bulk collect limit in number of rows
6 --< Bug 3540365 End >
7 
8 PROCEDURE get_list_price_conversion(x_request_id IN NUMBER,x_currency_code IN VARCHAR2,x_set_of_books_id IN NUMBER) IS
9 
10 x_progress	VARCHAR2(3)  := NULL ;
11 x_rowid 	VARCHAR2(250) := '';
12 x_item_id	NUMBER;
13 x_source_org_id	NUMBER := NULL;
14 x_rate_date	DATE;
15 x_gl_date	DATE;
16 x_creation_date	DATE;
17 x_list_price_conv_temp NUMBER;
18 
19 CURSOR inv_lines IS
20     select rowid, item_id,rate_date, gl_date, creation_date, source_organization_id
21     from po_requisitions_interface
22     where source_type_code = 'INVENTORY'
23     and unit_price is NULL
24     and item_id is not NULL
25     and source_organization_id is not null
26     and request_id = x_request_id;
27 
28 BEGIN
29     x_progress := '010';
30     OPEN inv_lines;
31     LOOP
32       FETCH inv_lines into
33 		x_rowid,
34                 x_item_id,
35                 x_rate_date,
36                 x_gl_date,
37                 x_creation_date,
38                 x_source_org_id;
39     EXIT WHEN inv_lines%NOTFOUND;
40 
41     begin
42        Select round(gl_currency_api.get_closest_rate_sql(x_set_of_books_id,glsob.currency_code,
43            trunc(nvl(nvl(nvl(x_rate_date,x_gl_date),x_creation_date),sysdate)),
44                        psp.DEFAULT_RATE_TYPE, 30),10)
45 	INTO x_list_price_conv_temp
46 	FROM gl_sets_of_books glsob,org_organization_definitions ood,po_system_parameters psp
47 	WHERE  x_currency_code <> glsob.currency_code
48 	    AND  glsob.set_of_books_id = ood.set_of_books_id
49 	    AND ood.organization_id = x_source_org_id
50 	    AND psp.DEFAULT_RATE_TYPE in (select DEFAULT_RATE_TYPE from po_system_parameters);
51        EXCEPTION
52          WHEN NO_DATA_FOUND THEN
53          x_list_price_conv_temp := 1;
54          WHEN OTHERS THEN
55          x_list_price_conv_temp := 1;
56        END;
57 
58       If (x_list_price_conv_temp < 0) then
59 
60      	update po_requisitions_interface
61 	     set unit_price = (select  msi.list_price_per_unit
62                          FROM mtl_system_items msi
63                         WHERE msi.inventory_item_id = x_item_id
64                           AND msi.organization_id = x_source_org_id)
65 		where rowid = x_rowid;
66 
67       else
68 
69 	update po_requisitions_interface
70 	     set unit_price = (select ( msi.list_price_per_unit * x_list_price_conv_temp)
71                          FROM mtl_system_items msi
72                         WHERE msi.inventory_item_id = x_item_id
73                           AND msi.organization_id = x_source_org_id)
74      		where rowid = x_rowid;
75       end if;
76 
77   END LOOP;
78   CLOSE inv_lines;
79 
80   EXCEPTION
81   WHEN OTHERS THEN
82     po_message_s.sql_error('get_list_price', x_progress, sqlcode);
83     RAISE;
84 END get_list_price_conversion;
85 
86 
87 PROCEDURE get_uom_conversion(x_request_id IN NUMBER,x_inventory_org_id IN NUMBER) IS
88 
89   x_progress		VARCHAR2(3)  := NULL ;
90   x_rowid			VARCHAR2(250) := '';
91   x_item_id			NUMBER;
92   x_uom				VARCHAR2(30);
93   x_uom_conversion_temp		NUMBER := 1;
94 
95 
96 CURSOR vendor_lines IS
97     select rowid, item_id,unit_of_measure
98     from po_requisitions_interface
99     where source_type_code = 'VENDOR'
100     and unit_price is NULL
101     and request_id = x_request_id;
102 
103 BEGIN
104 
105     x_progress := '010';
106     OPEN vendor_lines;
107     LOOP
108       FETCH vendor_lines into
109 		x_rowid,
110                 x_item_id,
111                 x_uom;
112     EXIT WHEN vendor_lines%NOTFOUND;
113 
114     begin
115        --Bug# 1347733
116        --togeorge 12/05/2000
117        --Switched the first two arguments in the call to the procedure po_uom_convert.
118        --This is done to avoid inaccurate value after conversion.
119        --SELECT  round(po_uom_s.po_uom_convert(msi.primary_unit_of_measure,  x_uom,  x_item_id),10)
120        SELECT  round(po_uom_s.po_uom_convert(x_uom, msi.primary_unit_of_measure, x_item_id),10)
121 	INTO x_uom_conversion_temp
122              FROM mtl_system_items msi
123             WHERE msi.inventory_item_id = x_item_id
124             AND x_inventory_org_id = msi.organization_id
125             AND msi.primary_unit_of_measure <> x_uom;
126        EXCEPTION
127          WHEN NO_DATA_FOUND THEN
128 	 x_uom_conversion_temp := 1;
129          WHEN OTHERS THEN
130 	 x_uom_conversion_temp := 1;
131        END;
132 
133        UPDATE po_requisitions_interface pri
134        --Bug# 1347733
135        --togeorge 12/05/2000
136        --List price is multiplied with uom conversion instead of dividing.
137        --This is done to avoid inaccurate value after conversion.
138        --SET pri.unit_price = (SELECT round(msi.list_price_per_unit / (x_uom_conversion_temp),10)
139                SET pri.unit_price = (SELECT round(msi.list_price_per_unit * (x_uom_conversion_temp),10)
140                              FROM mtl_system_items msi,
141                                   po_line_types plt
142                             WHERE msi.inventory_item_id = pri.item_id
143                               AND x_inventory_org_id
144                                          = msi.organization_id
145                               AND pri.line_type_id = plt.line_type_id
146                               AND plt.order_type_lookup_code = 'QUANTITY')
147              WHERE rowid = x_rowid;
148   END LOOP;
149   CLOSE vendor_lines;
150 
151   EXCEPTION
152   WHEN OTHERS THEN
153     po_message_s.sql_error('get_uom', x_progress, sqlcode);
154     RAISE;
155 END get_uom_conversion;
156 
157 --< Bug 3540365 Start >
158 --------------------------------------------------------------------------------
159 --Start of Comments
160 --Name: default_trx_reason_codes
161 --Pre-reqs:
162 --  None.
163 --Modifies:
164 --  PO_REQUISITIONS_INTERFACE
165 --Locks:
166 --  None.
167 --Function:
168 --  Defaults transaction reason codes based upon req line data in the interface
169 --  table only if defaulting is supported in the current installation.
170 --  Defaulting logic implemented by JL team. Writes to concurrent log file
171 --  when unexpected errors occur.
172 --Parameters:
173 --IN:
174 --p_request_id
175 --  The ID for the current requistion import request.
176 --End of Comments
177 --------------------------------------------------------------------------------
178 PROCEDURE default_trx_reason_codes( p_request_id IN NUMBER )
179 IS
180 
181 CURSOR l_null_pri_trx_csr IS
182     SELECT transaction_id
183          , destination_organization_id
184          , item_id
185       FROM po_requisitions_interface
186      WHERE request_id = p_request_id
187        AND transaction_reason_code IS NULL;
188 
189 l_return_status          VARCHAR2(1);
190 l_default_supported_flag VARCHAR2(1);
191 l_progress               VARCHAR2(3);
192 
193 l_fsp_inv_org_id FINANCIALS_SYSTEM_PARAMS_ALL.inventory_organization_id%TYPE;
194 l_org_id         FINANCIALS_SYSTEM_PARAMS_ALL.org_id%TYPE;
195 
196 /*Bug#4430300 Replaced the references to JLBR data types with the po standard data types */
197 l_transaction_id_tbl  po_tbl_number;
198 l_dest_org_id_tbl     po_tbl_number;
199 l_item_id_tbl         po_tbl_number;
200 l_trx_reason_code_tbl po_tbl_varchar100;
201 l_error_code_tbl      po_tbl_number;
202 
203 BEGIN
204     l_progress := '000';
205 
206     -- Only proceed if defaulting of transaction reason is supported
207     PO_JL_INTERFACE_PVT.chk_def_trx_reason_flag
208         ( x_return_status       => l_return_status
209         , x_def_trx_reason_flag => l_default_supported_flag
210         );
211     IF (l_return_status <> FND_API.g_ret_sts_success) THEN
212         RAISE FND_API.g_exc_unexpected_error;
213     ELSIF (NVL(l_default_supported_flag,'N') <> 'Y') THEN
214         -- Exit procedure because defaulting is not supported.
215         RETURN;
216     END IF;
217 
218     l_progress := '010';
219     -- Get data needed to call defaulting logic. This data is the same for each
220     -- call to the defaulting API, so retrieve it outside the loop.
221     SELECT org_id
222          , inventory_organization_id
223       INTO l_org_id
224          , l_fsp_inv_org_id
225       FROM financials_system_parameters;
226 
227     l_progress := '020';
228     -- Bulk collect data from req lines for defaulting. Bulk process in a loop
229     -- to ensure we do not take up too much memory for the collections.
230     OPEN l_null_pri_trx_csr;
231     LOOP
232         FETCH l_null_pri_trx_csr BULK COLLECT
233          INTO l_transaction_id_tbl
234             , l_dest_org_id_tbl
235             , l_item_id_tbl
236         LIMIT g_bulk_limit;
237 
238         EXIT WHEN (l_transaction_id_tbl IS NULL) OR
239                   (l_transaction_id_tbl.COUNT = 0);
240 
241         l_progress := '030';
242         -- Derive transaction reasons for each req line
243         PO_JL_INTERFACE_PVT.get_trx_reason_code
244             ( p_fsp_inv_org_id       => l_fsp_inv_org_id
245             , p_inventory_org_id_tbl => l_dest_org_id_tbl
246             , p_item_id_tbl          => l_item_id_tbl
247             , p_org_id               => l_org_id
248             , x_return_status        => l_return_status
249             , x_trx_reason_code_tbl  => l_trx_reason_code_tbl
250             , x_error_code_tbl       => l_error_code_tbl
251             );
252         IF (l_return_status <> FND_API.g_ret_sts_success) THEN
253             RAISE FND_API.g_exc_unexpected_error;
254         END IF;
255 
256         -- Defaulting call was successful. Only update records if the API
257         -- populated the output tables with values
258         IF (l_trx_reason_code_tbl IS NOT NULL) AND
259            (l_error_code_tbl IS NOT NULL)
260         THEN
261             l_progress := '040';
262             -- Update the interface table with the derived transaction reasons.
263             -- Do not update those lines with a non-zero error code; those lines
264             -- failed defaulting, so the trx reason should be left NULL.
265             FORALL i IN l_transaction_id_tbl.FIRST..l_transaction_id_tbl.LAST
266                 UPDATE po_requisitions_interface
267                    SET transaction_reason_code = l_trx_reason_code_tbl(i)
268                  WHERE transaction_id = l_transaction_id_tbl(i)
269                    AND l_error_code_tbl(i) = 0;
270         END IF;
271 
272         -- Need to exit when all records have been fetched
273         EXIT WHEN l_null_pri_trx_csr%NOTFOUND;
274 
275     END LOOP;
276 EXCEPTION
277     WHEN FND_API.g_exc_unexpected_error THEN
278         -- Unexpected error status returned from our API calls. Write to log.
279         FOR i IN 1..FND_MSG_PUB.count_msg LOOP
280             FND_FILE.put_line(FND_FILE.LOG, l_progress||': '||FND_MSG_PUB.get(i,'F'));
281         END LOOP;
282     WHEN OTHERS THEN
283         -- Any other exception should be written to log with generic error msg.
284         FND_MSG_PUB.build_exc_msg
285             ( p_pkg_name       => 'PO_REQIMP_S'
286             , p_procedure_name => 'default_trx_reason_codes-'||l_progress
287             );
288         FND_FILE.put_line(FND_FILE.log, FND_MESSAGE.get);
289 END default_trx_reason_codes;
290 --< Bug 3540365 End >
291 
292 
293 --<INVCONV R12 START>
294 --------------------------------------------------------------------------------
295 --Start of Comments
296 --Name: REQIMPORT_DEF_VALIDATE_SEC_QTY
297 --Pre-reqs:
298 --  None.
299 --Modifies:
300 --  PO_REQUISITIONS_INTERFACE
301 --Locks:
302 --  None.
303 --Function:
304 --  Validates (deviation), Derives Secondary Quantities in  Req Import Tables for dual uom
305 --  controlled items. For internal orders it checks deviation for both source and
306 --  destination organization.
307 --Parameters:
308 --IN:
309 --p_request_id
310 --  The ID for the current requistion import request.
311 --End of Comments
312 --------------------------------------------------------------------------------
313 
314 PROCEDURE REQIMPORT_DEF_VALIDATE_SEC_QTY
315 ( p_request_id		IN 		 NUMBER
316 )
317 
318 
319 IS
320 
321   l_progress               VARCHAR2(3);
322 
323   l_rec PO_INTERFACE_ERRORS%ROWTYPE;
324   l_rtn_status VARCHAR2(1);
325   l_msg_count NUMBER;
326   l_msg_data VARCHAR2(2000);
327   l_row_id ROWID;
328 
329 
330   l_item_um2		MTL_UNITS_OF_MEASURE.UOM_CODE%TYPE;
331   l_item_id		MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID%TYPE;
332   l_tracking_qty_ind	MTL_SYSTEM_ITEMS.TRACKING_QUANTITY_IND%TYPE;
333   l_secondary_default_ind MTL_SYSTEM_ITEMS.SECONDARY_DEFAULT_IND%TYPE;
334 
335 
336   l_item_unit_of_measure_s	MTL_UNITS_OF_MEASURE.UNIT_OF_MEASURE%TYPE;
337   l_item_um2_s		MTL_UNITS_OF_MEASURE.UOM_CODE%TYPE;
338   l_tracking_qty_ind_s	MTL_SYSTEM_ITEMS.TRACKING_QUANTITY_IND%TYPE;
339   l_secondary_default_ind_s MTL_SYSTEM_ITEMS.SECONDARY_DEFAULT_IND%TYPE;
340   l_unit_of_measure_s   MTL_UNITS_OF_MEASURE.UNIT_OF_MEASURE%TYPE;
341 
342   l_sec_qty_source      NUMBER;
343 
344 Cursor Cr_int_req IS
345 Select	pri.rowid,
346         pri.transaction_id,
347         pri.source_type_code,
348 	pri.source_organization_id,
349 	pri.destination_organization_id,
350 	pri.item_id,
351 	pri.secondary_unit_of_measure,
352 	pri.secondary_uom_code,
353 	pri.secondary_quantity,
354 	pri.quantity,
355 	pri.unit_of_measure,
356 	pri.preferred_grade
357 From	po_requisitions_interface pri
358 Where   pri.request_id = p_request_id
359 FOR UPDATE OF pri.secondary_unit_of_measure;
360 
361 Cursor Cr_item_attr(p_inv_item_id IN NUMBER,p_organization_id IN NUMBER) IS
362 Select	m.tracking_quantity_ind,
363 	m.secondary_uom_code,
364 	m.secondary_default_ind
365 From	mtl_system_items m
366 Where	m.inventory_item_id = p_inv_item_id
367 And     m.organization_id = p_organization_id;
368 
369 BEGIN
370 l_progress := '000';
371 --Loop for every record in the interface table for the current concurrent request.
372 FOR Cr_rec IN Cr_int_req LOOP
373 
374   l_item_um2		:= NULL;
375   l_tracking_qty_ind	:= NULL;
376   l_secondary_default_ind := NULL;
377 
378   l_tracking_qty_ind_s	       := NULL;
379   l_item_um2_s		       := NULL;
380   l_secondary_default_ind_s    := NULL;
381   l_unit_of_measure_s          := NULL;
382   l_sec_qty_source	:= NULL;
383 
384   --Only where item_id is specified.
385   IF Cr_rec.item_id IS NOT NULL THEN
386 
387     -- Get Item Attributes
388     BEGIN
389        OPEN Cr_item_attr(cr_rec.item_id, cr_rec.destination_organization_id);
390        FETCH Cr_item_attr INTO  l_tracking_qty_ind,
391   	       			l_item_um2		,
392   	       			l_secondary_default_ind;
393        CLOSE Cr_item_attr;
394     END;
395     l_progress := '010';
396     --If secondary quantity is not provided then compute it and update interface table.
397     IF cr_rec.secondary_unit_of_measure IS NOT NULL AND
398        l_tracking_qty_ind = 'PS' THEN
399 
400        IF (cr_rec.secondary_quantity IS NULL OR
401            l_secondary_default_ind = 'F')
402        THEN
403 
404           cr_rec.secondary_quantity := INV_CONVERT.inv_um_convert(
405                                                   item_id        =>  cr_rec.item_id,
406                                                   precision	 =>  6,
407                                                   from_quantity  =>  cr_rec.quantity,
408                                                   from_unit      => NULL,
409                                                   to_unit        => NULL,
410                                                   from_name	 =>  cr_rec.unit_of_measure ,
411                                                   to_name	 =>  cr_rec.secondary_unit_of_measure );
412           l_progress := '020';
413           IF cr_rec.secondary_quantity <=0 THEN
414                 l_rec.interface_type     := 'REQIMPORT';
415                 l_rec.interface_transaction_id := cr_rec.transaction_id;
416                 l_rec.column_name        := 'SECONDARY_QUANTITY';
417                 l_rec.table_name         := 'PO_REQUISITIONS_INTERFACE';
418                 l_rec.error_message_name := 'INV_NO_CONVERSION_ERR';
419 
420                 fnd_message.set_name('INV', l_rec.error_message_name);
421                 l_rec.error_message := FND_MESSAGE.get;
422 
423                 PO_INTERFACE_ERRORS_GRP.log_error
424                  ( p_api_version => 1.0,
425                    p_init_msg_list => FND_API.G_TRUE,
426                    x_return_status => l_rtn_status,
427                    x_msg_count => l_msg_count,
428                    x_msg_data => l_msg_data,
429                    p_rec => l_rec,
430                    x_row_id => l_row_id);
431 
432                 IF (l_rtn_status <> FND_API.G_RET_STS_SUCCESS) THEN
433                    RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
434                 END IF;
435           ELSE
436              UPDATE po_requisitions_interface
437              SET    secondary_quantity = cr_rec.secondary_quantity
438              WHERE  rowid = cr_rec.rowid;
439           END IF;
440           l_progress := '030';
441        --If secondary quantity is specified then check deviation for type Default and No Default items
442        --for fixed type items do the conversion and update interface table.
443        ELSE
444           l_progress := '040';
445 
446           IF INV_CONVERT.within_deviation(
447                       p_organization_id      =>  cr_rec.destination_organization_id ,
448                       p_inventory_item_id    =>  cr_rec.item_id,
449                       p_lot_number           =>  null ,
450                       p_precision            =>  6 ,
451                       p_quantity             =>  cr_rec.quantity,
452                       p_unit_of_measure1     =>  cr_rec.unit_of_measure ,
453                       p_quantity2            =>  cr_rec.secondary_quantity ,
454                       p_unit_of_measure2     =>  cr_rec.secondary_unit_of_measure,
455                       p_uom_code1            =>  NULL,
456                       p_uom_code2            =>  NULL) = 0 THEN
457 
458              l_rec.interface_type     := 'REQIMPORT';
459              l_rec.interface_transaction_id := cr_rec.transaction_id;
460              l_rec.column_name        := 'SECONDARY_QUANTITY';
461              l_rec.table_name         := 'PO_REQUISITIONS_INTERFACE';
462              l_rec.error_message      := FND_MSG_PUB.GET(p_msg_index => FND_MSG_PUB.G_LAST,p_encoded => 'F');
463 
464              l_progress := '050';
465 
466              PO_INTERFACE_ERRORS_GRP.log_error
467                  ( p_api_version => 1.0,
468                    p_init_msg_list => FND_API.G_TRUE,
469                    x_return_status => l_rtn_status,
470                    x_msg_count => l_msg_count,
471                    x_msg_data => l_msg_data,
472                    p_rec => l_rec,
473                    x_row_id => l_row_id);
474 
475                 IF (l_rtn_status <> FND_API.G_RET_STS_SUCCESS) THEN
476                    RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
477                 END IF;
478              l_progress := '060';
479           END IF; /*NOT INV_CONVERT.within_deviation( */
480        END IF; /*cr_rec.secondary_quantity IS NULL*/
481     --Since item is not dual um controlled update all secondary attributes to NULL
482     /*ELSIF l_tracking_qty_ind = 'P' THEN
483        UPDATE po_requisitions_interface
484        SET    secondary_quantity = NULL,
485               secondary_uom_code = NULL,
486               secondary_unit_of_measure = NULL
487        WHERE  rowid = cr_rec.rowid;    */
488     END IF; /*cr_rec.secondary_unit_of_measure IS NOT NULL*/
489 
490     l_progress := '070';
491     --Internal Orders
492     --Validate that quantity is within deviation for both source and destination organization
493     --only if item is dual uom controlled in destination organization
494     IF cr_rec.source_type_code = 'INVENTORY' AND
495        cr_rec.source_organization_id IS NOT NULL AND
496        cr_rec.secondary_unit_of_measure IS NOT NULL THEN
497 
498        -- Get Item Attributes for source organization
499        BEGIN
500           OPEN Cr_item_attr(cr_rec.item_id, cr_rec.source_organization_id);
501           FETCH Cr_item_attr INTO  l_tracking_qty_ind_s,
502   	       			   l_item_um2_s		,
503   	       			   l_secondary_default_ind_s;
504           CLOSE Cr_item_attr;
505        END;
506        l_progress := '080';
507        IF l_tracking_qty_ind_s = 'PS' THEN
508 
509           IF l_item_um2_s <> l_item_um2 THEN
510 
511              l_sec_qty_source := INV_CONVERT.inv_um_convert(
512                                         item_id   =>  cr_rec.item_id,
513                                         precision =>  6,
514                                         from_quantity  => cr_rec.secondary_quantity,
515                                         from_unit =>  l_item_um2 ,
516                                         to_unit	  =>  l_item_um2_s,
517                                         from_name =>  NULL ,
518                                         to_name	 =>   NULL
519                                          );
520 
521              select unit_of_measure
522              into   l_unit_of_measure_s
523              from   mtl_units_of_measure
524              where  uom_code = l_item_um2_s;
525 
526              l_progress := '090';
527 
528           ELSE
529              l_sec_qty_source := cr_rec.secondary_quantity;
530              l_unit_of_measure_s := cr_rec.secondary_unit_of_measure;
531           END IF;
532 
533           IF INV_CONVERT.within_deviation(
534                          p_organization_id   	=>  cr_rec.source_organization_id ,
535                          p_inventory_item_id    =>  cr_rec.item_id,
536                          p_lot_number           =>  null ,
537                          p_precision            =>  6 ,
538                          p_quantity             =>  cr_rec.quantity,
539                          p_unit_of_measure1     =>  cr_rec.unit_of_measure  ,
540                          p_quantity2            =>  l_sec_qty_source ,
541                          p_unit_of_measure2     =>  l_unit_of_measure_s,
542                          p_uom_code1            =>  NULL,
543                          p_uom_code2            =>  NULL) = 0 THEN
544 
545              l_rec.interface_type     := 'REQIMPORT';
546              l_rec.interface_transaction_id := cr_rec.transaction_id;
547              l_rec.column_name        := 'SECONDARY_QUANTITY';
548              l_rec.table_name         := 'PO_REQUISITIONS_INTERFACE';
549              l_rec.error_message_name := 'PO_SRCE_ORG_OUT_OF_DEV';
550 
551              l_progress := '100';
552 
553              fnd_message.set_name('PO', l_rec.error_message_name);
554              l_rec.error_message := FND_MESSAGE.get;
555 
556              PO_INTERFACE_ERRORS_GRP.log_error
557               ( p_api_version => 1.0,
558                 p_init_msg_list => FND_API.G_TRUE,
559                 x_return_status => l_rtn_status,
560                 x_msg_count => l_msg_count,
561                 x_msg_data => l_msg_data,
562                 p_rec => l_rec,
563                 x_row_id => l_row_id);
564 
565              IF (l_rtn_status <> FND_API.G_RET_STS_SUCCESS) THEN
566                 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
567              END IF;
568           END IF; /*NOT INV_CONVERT.within_deviation( */
569        END IF; /*l_tracking_qty_ind_s = 'PS'*/
570     END IF; /*cr_rec.source_type_code = 'INVENTORY'*/
571 
572     l_progress := '110';
573   ELSIF cr_rec.item_id IS NULL  THEN
574     l_progress := '120';
575        --since its a one time item update all process attributes to NULL.
576        UPDATE po_requisitions_interface
577        SET    secondary_quantity = NULL,
578               secondary_uom_code = NULL,
579               secondary_unit_of_measure = NULL,
580               preferred_grade = NULL
581        WHERE  rowid = cr_rec.rowid;
582   END IF;
583   l_progress := '130';
584 END LOOP;
585 
586 EXCEPTION
587   WHEN OTHERS THEN
588      po_message_s.sql_error('reqimport_def_validate_sec_qty', l_progress, sqlcode);
589      RAISE;
590 
591 END REQIMPORT_DEF_VALIDATE_SEC_QTY;
592 --<INVCONV R12 END>
593 
594 END PO_REQIMP_S;
595