DBA Data[Home] [Help]

PACKAGE BODY: APPS.POS_UTIL_PKG

Source


1 PACKAGE BODY pos_util_pkg AS
2 /* $Header: POSUTILB.pls 120.1.12000000.3 2007/08/22 11:31:19 pkapoor ship $ */
3 
4   FUNCTION bool_to_varchar(b IN BOOLEAN)
5     RETURN VARCHAR2 IS
6   begin
7      IF(b) THEN
8 	RETURN 'Y';
9       ELSE
10 	RETURN 'N';
11      END IF;
12   END bool_to_varchar;
13 
14 
15 /** procedure Retrieve_Doc_Security
16     -------------------------------
17 purpose:
18 --------
19 the iSP wrapper api to retrieve where clause for Purchasing Document Security
20 by calling the PO document security api PO_DOCUMENT_CHECKS_GRP.PO_Security_Check
21 
22 implementation:
23 ---------------
24 will give a call to PO_DOCUMENT_CHECKS_GRP.PO_Security_Check 6 times to retrieve the where clause for
25  PO - STANDARD, PLANNED
26  PA - BLANKET, CONTRACT
27  RELEASE - BLANKET, SCHEDULED
28 */
29 
30   procedure Retrieve_Doc_Security (p_query_table  IN VARCHAR2,
31                                    p_owner_id_column  IN VARCHAR2,
32                                    p_employee_id IN VARCHAR2,
33                                    p_employee_bind_start  IN NUMBER,
34                                    p_org_id  IN NUMBER,
35                                    x_return_status OUT  NOCOPY  VARCHAR2,
36                                    x_msg_data OUT  NOCOPY  VARCHAR2,
37                                    x_where_clause OUT  NOCOPY  VARCHAR2)  is
38 
39 --  l_employee_bind_start  Number;
40   l_flag VARCHAR2(1) := 'N';
41   l_where_clause VARCHAR2(32000) := '';
42   l_call_where_clause VARCHAR2(32000) := '';
43 
44 BEGIN
45 
46    l_where_clause := '((';
47 
48  --  l_employee_bind_start  := p_employee_bind_start ;
49 
50 /*
51      PO_DOCUMENT_CHECKS_GRP.PO_Security_Check(
52                                                p_api_version => 1.0,
53                                                p_query_table => p_query_table ,
54                                                p_owner_id_column => p_owner_id_column ,
55                                                p_employee_id => p_employee_id,
56                                                p_org_id => p_org_id,
57                                                p_minimum_access_level => 'VIEW_ONLY',
58                                                p_document_type => 'PO',
59                                                p_document_subtype => 'STANDARD',
60                                                p_type_clause => 'TYPE_LOOKUP_CODE = ''STANDARD''',
61                                                x_return_status => x_return_status,
62                                                x_msg_data => x_msg_data,
63                                                x_where_clause => l_call_where_clause);
64 
65 
66    if  (l_call_where_clause is not null) then
67      if (l_flag = 'N') then
68         l_where_clause := l_where_clause || l_call_where_clause;
69         l_flag := 'Y';
70      else
71        l_where_clause := l_where_clause || ') AND (' || l_call_where_clause;
72      end if;
73   --   l_employee_bind_start  := l_employee_bind_start  + 1;
74   end if;
75 
76 
77 PO_DOCUMENT_CHECKS_GRP.PO_Security_Check(
78                                                p_api_version => 1.0,
79                                                p_query_table => p_query_table ,
80                                                p_owner_id_column => p_owner_id_column ,
81                                                p_employee_id => p_employee_id,
82                                                p_org_id => p_org_id,
83                                                p_minimum_access_level => 'VIEW_ONLY',
84                                                p_document_type => 'PO',
85                                                p_document_subtype => 'PLANNED',
86                                                p_type_clause => 'TYPE_LOOKUP_CODE = ''PLANNED''',
87                                                x_return_status => x_return_status,
88                                                x_msg_data => x_msg_data,
89                                                x_where_clause => l_call_where_clause);
90 
91 
92    if  (l_call_where_clause is not null) then
93      if (l_flag = 'N') then
94         l_where_clause := l_where_clause || l_call_where_clause;
95         l_flag := 'Y';
96      else
97        l_where_clause := l_where_clause || ') AND (' || l_call_where_clause;
98      end if;
99    --  l_employee_bind_start  := l_employee_bind_start  + 1;
100  end if;
101 
102 
103 PO_DOCUMENT_CHECKS_GRP.PO_Security_Check(
104                                                p_api_version => 1.0,
105                                                p_query_table => p_query_table ,
106                                                p_owner_id_column => p_owner_id_column ,
107                                                p_employee_id => p_employee_id,
108                                                p_org_id => p_org_id,
109                                                p_minimum_access_level => 'VIEW_ONLY',
110                                                p_document_type => 'PA',
111                                                p_document_subtype => 'BLANKET',
112                                                p_type_clause => 'TYPE_LOOKUP_CODE = ''BLANKET''',
113                                                x_return_status => x_return_status,
114                                                x_msg_data => x_msg_data,
115                                                x_where_clause => l_call_where_clause);
116 
117 
118    if  (l_call_where_clause is not null) then
119      if (l_flag = 'N') then
120         l_where_clause := l_where_clause || l_call_where_clause;
121         l_flag := 'Y';
122      else
123        l_where_clause := l_where_clause || ') AND (' || l_call_where_clause;
124      end if;
125     -- l_employee_bind_start  := l_employee_bind_start  + 1;
126  end if;
127 
128 
129 PO_DOCUMENT_CHECKS_GRP.PO_Security_Check(
130                                                p_api_version => 1.0,
131                                                p_query_table => p_query_table ,
132                                                p_owner_id_column => p_owner_id_column ,
133                                                p_employee_id => p_employee_id,
134                                                p_org_id => p_org_id,
135                                                p_minimum_access_level => 'VIEW_ONLY',
136                                                p_document_type => 'PA',
137                                                p_document_subtype => 'CONTRACT',
138                                                p_type_clause => 'TYPE_LOOKUP_CODE = ''CONTRACT''',
139                                                x_return_status => x_return_status,
140                                                x_msg_data => x_msg_data,
141                                                x_where_clause => l_call_where_clause);
142 
143 
144    if  (l_call_where_clause is not null) then
145      if (l_flag = 'N') then
146         l_where_clause := l_where_clause || l_call_where_clause;
147         l_flag := 'Y';
148      else
149        l_where_clause := l_where_clause || ') AND (' || l_call_where_clause;
150      end if;
151    --  l_employee_bind_start  := l_employee_bind_start  + 1;
152  end if;
153 
154 
155 PO_DOCUMENT_CHECKS_GRP.PO_Security_Check(
156                                                p_api_version => 1.0,
157                                                p_query_table => p_query_table ,
158                                                p_owner_id_column => p_owner_id_column ,
159                                                p_employee_id => p_employee_id,
160                                                p_org_id => p_org_id,
161                                                p_minimum_access_level => 'VIEW_ONLY',
162                                                p_document_type => 'RELEASE',
163                                                p_document_subtype => 'BLANKET',
164                                                p_type_clause => 'TYPE_LOOKUP_CODE = ''BLANKET''',
165                                                x_return_status => x_return_status,
166                                                x_msg_data => x_msg_data,
167                                                x_where_clause => l_call_where_clause);
168 
169 
170    if  (l_call_where_clause is not null) then
171      if (l_flag = 'N') then
172         l_where_clause := l_where_clause || l_call_where_clause;
173         l_flag := 'Y';
174      else
175        l_where_clause := l_where_clause || ') AND (' || l_call_where_clause;
176      end if;
177     -- l_employee_bind_start  := l_employee_bind_start  + 1;
178  end if;
179 
180 
181 PO_DOCUMENT_CHECKS_GRP.PO_Security_Check(
182                                                p_api_version => 1.0,
183                                                p_query_table => p_query_table ,
184                                                p_owner_id_column => p_owner_id_column ,
185                                                p_employee_id => p_employee_id,
186                                                p_org_id => p_org_id,
187                                                p_minimum_access_level => 'VIEW_ONLY',
188                                                p_document_type => 'RELEASE',
189                                                p_document_subtype => 'SCHEDULED',
190                                                p_type_clause => 'TYPE_LOOKUP_CODE = ''PLANNED''',
191                                                x_return_status => x_return_status,
192                                                x_msg_data => x_msg_data,
193                                                x_where_clause => l_call_where_clause);
194 
195 */
196 
197 
198 l_call_where_clause :=   '(agent_id = '|| p_employee_id || ')  OR  ( ' ||
199     '  ( (access_level_code IS NULL OR access_level_code = ''FULL'') OR ' ||
200     '    (access_level_code = ''VIEW_ONLY'' AND ''VIEW_ONLY'' NOT IN (''MODIFY'',''FULL'')) OR ' ||
201     '    (access_level_code = ''MODIFY'' AND ''VIEW_ONLY''<> ''FULL'')) AND ' ||
202     '  ( (security_level_code = ''PUBLIC'')  OR ' ||
203     '    (security_level_code IN (''PRIVATE'', ''PURCHASING'', ''HIERARCHY'') ' ||
204     '     AND EXISTS ' ||
205     '      ( SELECT ''Employee is in approval path of this document''  FROM   PO_ACTION_HISTORY POAH ' ||
206     '        WHERE  POAH.employee_id = ' || p_employee_id ||
207     '        AND    POAH.object_type_code IN (''PO'', ''PA'') ' ||
208     '        AND    POAH.object_id = po_header_id) ) ' ||
209     '    OR  ' ||
210     '    (security_level_code = ''PURCHASING'' AND EXISTS ' ||
211     '      ( SELECT ''User is a BUYER'' FROM po_agents poa ' ||
212     '        WHERE poa.agent_id = '|| p_employee_id ||
213     '        AND SYSDATE BETWEEN  NVL(POA.start_date_active, SYSDATE) AND  ' ||
214     '        NVL(POA.end_date_active, SYSDATE + 1)) ' ||
215     '    ) ' ||
216     '    OR ' ||
217     '    (security_level_code = ''HIERARCHY'' AND EXISTS ' ||
218     '       ( SELECT ''User exists in the HIERARCHY'' FROM (SELECT org_id poeh_org_id, position_structure_id, '||
219     '                      employee_id, superior_id ' ||
220     '                 FROM po_employee_hierarchies) poeh, ' ||
221     '                 (SELECT org_id psp_org_id, security_position_structure_id ' ||
222     '                   FROM po_system_parameters_all) psp ' ||
223     '             WHERE poeh.superior_id   = ' || p_employee_id ||
224     '             AND psp.psp_org_id       = org_id  ' ||
225     '            AND poeh.employee_id = agent_id ' ||
226     '             AND poeh.position_structure_id = ' ||
227     '                   NVL(psp.security_position_structure_id,-1) ' ||
228     '           )) ) )  ' ;
229 
230 
231    if  (l_call_where_clause is not null) then
232      if (l_flag = 'N') then
233         l_where_clause := l_where_clause || l_call_where_clause;
234         l_flag := 'Y';
235      else
236        l_where_clause := l_where_clause || ') AND (' || l_call_where_clause;
237      end if;
238      --     l_employee_bind_start  := l_employee_bind_start  + 1;
239      end if;
240 
241     if (l_flag = 'N') then
242          l_where_clause := null;
243     else
244          l_where_clause := l_where_clause || '))';
245     end if;
246 
247     x_where_clause := l_where_clause;
248 
249  EXCEPTION when others then
250 
251      x_where_clause := null;
252      x_return_status := 'U';
253      x_msg_data := sqlcode || ':' || sqlerrm(sqlcode);
254 
255  END Retrieve_Doc_Security;
256 
257 
258 
259  PROCEDURE update_revision (p_organizationId in number,
260                            p_inventoryItemId in number,
261                            p_vendorId in number,
262                            p_batchId in number,
263                            x_returnCode out NOCOPY varchar,
264                            x_err_msg out NOCOPY varchar) is
265 
266 PURCHASING_BY_REV      CONSTANT INTEGER := 1;
267 NOT_PURCHASING_BY_REV  CONSTANT INTEGER := 2;
268 UNDER_REV_CONTROL      CONSTANT INTEGER := 2;
269 NOT_UNDER_REV_CONTROL  CONSTANT INTEGER := 1;
270 var_purchasing_by_rev  NUMBER := to_number(FND_PROFILE.VALUE('MRP_PURCHASING_BY_REVISION'));
271 
272 var_revision        VARCHAR2(3);
273 var_revision_ctrl   NUMBER;
274 
275 BEGIN
276 
277   BEGIN
278     SELECT max(rev.revision),
279            max(msi.revision_qty_control_code)
280     INTO   var_revision, var_revision_ctrl
281     FROM   mtl_system_items_b msi,
282            mtl_item_revisions rev
283     WHERE  msi.inventory_item_id = p_inventoryItemId
284     AND    msi.organization_id = p_organizationId
285     AND    rev.inventory_item_id = msi.inventory_item_id
286     AND    rev.organization_id = msi.organization_id
287     AND    TRUNC(rev.effectivity_date) =
288            (SELECT TRUNC(max(rev2.effectivity_date))
289             FROM    mtl_item_revisions rev2
290             WHERE   rev2.implementation_date IS NOT NULL
291             AND     rev2.effectivity_date <= TRUNC(SYSDATE)+.99999
292             AND     rev2.organization_id = rev.organization_id
293             AND     rev2.inventory_item_id = rev.inventory_item_id);
294 
295    EXCEPTION
296     WHEN NO_DATA_FOUND THEN
297       var_revision_ctrl := NOT_UNDER_REV_CONTROL;
298     WHEN OTHERS THEN
299        x_returnCode := 'U';
300        x_err_msg := sqlerrm;
301        RAISE;
302   END;
303 
304   BEGIN
305        UPDATE PO_REQUISITIONS_INTERFACE
306        set    item_revision = DECODE(var_purchasing_by_rev, NULL,
307                               DECODE(var_revision_ctrl, NOT_UNDER_REV_CONTROL, NULL, var_revision),
308                                      PURCHASING_BY_REV, var_revision,
309                                      NOT_PURCHASING_BY_REV, NULL)
310        WHERE BATCH_ID = p_batchId;
311 
312   EXCEPTION
313     WHEN OTHERS THEN
314        x_returnCode := 'U';
315        x_err_msg := sqlerrm;
316        RAISE;
317   END;
318 
319   x_returnCode := 'S';
320   x_err_msg := 'SUCCESS';
321 
322 END update_revision;
323 
324 
325 /** function IS_FV_ENABLED
326     -----------------------
327 purpose:
328 --------
329 The iSP wrapper api to retrieve the value of Profile Option FV: Federal Enabled
330 by calling the Federal Financial api fv_install.enabled.
331 Returns 'T' if the Federal is enabled otherwise 'F'.
332 
333 */
334 
335 FUNCTION IS_FV_ENABLED RETURN VARCHAR2
336   IS
337 BEGIN
338 IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
339 	FND_LOG.string(
340 			fnd_log.level_statement,
341 			g_log_module_name,
342 			' starts IS_FV_ENABLED '
343 		      );
344 END IF;
345 if(fv_install.enabled) then
346   RETURN 'T';
347 else
348   RETURN 'F';
349 end if;
350 
351 EXCEPTION
352     WHEN OTHERS THEN
353       raise_application_error(-20060, 'Failure in IS_FV_ENABLED ', true);
354 END;
355 
356 
357 /** PROCEDURE FV_IS_CCR
358     -----------------------
359 purpose:
360 --------
361 The iSP wrapper api to know if record is in CCR,
362 by calling the Federal Financial api FV_CCR_GRP.FV_IS_CCR
363 
364 p_object_type, p_object_id:
365 Here S-> Supplier  --> Pass supplier_id
366      B=> Bank branch  --> pass bank brnahc id
367      T=> Supplier site -->  Pass Pay site or main address site id
368      A-> Bank account Bank account id
369 */
370 PROCEDURE FV_IS_CCR
371 (       p_api_version           IN      NUMBER,
372         p_init_msg_list         IN      VARCHAR2 ,
373         p_object_id                     IN      NUMBER,
374         p_object_type           IN VARCHAR2,
375         x_return_status         OUT     NOCOPY VARCHAR2,
376         x_msg_count                     OUT     NOCOPY NUMBER,
377         x_msg_data                      OUT     NOCOPY VARCHAR2,
378         x_ccr_id                        OUT     NOCOPY NUMBER,
379         x_out_status            OUT     NOCOPY VARCHAR2,
380         x_error_code            OUT NOCOPY NUMBER
381 )
382 IS
383 BEGIN
384 IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
385 	FND_LOG.string(
386 			fnd_log.level_statement,
387 			g_log_module_name,
388 			' start FV_IS_CCR'
389 		      );
390 END IF;
391 
392 IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
393 	FND_LOG.string(
394 			fnd_log.level_statement,
395 			g_log_module_name,
396 			'Calling FV_CCR_GRP.FV_IS_CCR with p_object_id = '||p_object_id||' p_object_type = '||p_object_type
397 		      );
398 END IF;
399 FV_CCR_GRP.FV_IS_CCR(
400   p_api_version,
401   p_init_msg_list,
402   p_object_id,
403   p_object_type,
404   x_return_status,
405   x_msg_count,
406   x_msg_data,
407   x_ccr_id,
408   x_out_status,
409   x_error_code
410 );
411 EXCEPTION
412     WHEN OTHERS THEN
413       raise_application_error(-20060, 'Failure in FV_CCR_GRP.FV_IS_CCR ', true);
414 END FV_IS_CCR;
415 
416 
417 /** function IS_ADDR_CCR
418     -----------------------
419 purpose:
420 --------
421 The iSP wrapper api over FV_IS_CCR to know if there is any CCR Site associated
422 to an address
423 p_object_id: party_site_id for the address.
424 
425 Returns 'T' if the Address has atleast one CCR site, otherwise 'F'
426 
427 */
428 FUNCTION IS_ADDR_CCR(
429  p_api_version           IN      NUMBER,
430  p_init_msg_list         IN      VARCHAR2 ,
431  p_object_id             IN      NUMBER
432  )RETURN VARCHAR2
433 IS
434 l_out_status     	VARCHAR2(1);
435 is_enabled 		VARCHAR2(1);
436 l_return_status     	VARCHAR2(1);
437 l_msg_count             NUMBER;
438 l_msg_data              VARCHAR2(3000);
439 l_error_code            NUMBER;
440 l_ccr_id                NUMBER;
441 cursor l_addr_site_cur is
442 select vendor_site_id from ap_supplier_sites_all
443 WHERE party_site_id = p_object_id;
444 BEGIN
445 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
446 		FND_LOG.string(
447 		  fnd_log.level_statement,
448 		  g_log_module_name,
449 		  'Start IS_ADDR_CCR with p_object_id = '||p_object_id
450 		);
451 	END IF;
452 	l_out_status := 'F';
453 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
454 		FND_LOG.string(
455 		  fnd_log.level_statement,
456 		  g_log_module_name,
457 		  'Calling pos_util_pkg.IS_FV_ENABLED'
458 		);
459 	END IF;
460 	is_enabled := pos_util_pkg.IS_FV_ENABLED();
461         IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
462                 FND_LOG.string(
463                   fnd_log.level_statement,
464                   g_log_module_name,
465                   'After pos_util_pkg.IS_FV_ENABLED is_enabled = '||is_enabled
466                 );
467         END IF;
468 	if is_enabled <> 'T' then
469 		return l_out_status;
470 	else
471 		for  i in l_addr_site_cur  loop
472 			IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
473 				FND_LOG.string(
474 				  fnd_log.level_statement,
475 				  g_log_module_name,
476 				  'Calling FV_CCR_GRP.FV_IS_CCR with i.vendor_site_id = '||i.vendor_site_id
477 		      	 	  );
478 			END IF;
479 			FV_CCR_GRP.FV_IS_CCR(
480 			  p_api_version,
481 			  p_init_msg_list,
482 			  i.vendor_site_id,
483 			  'T',
484 			  l_return_status,
485 			  l_msg_count,
486 			  l_msg_data,
487 			  l_ccr_id,
488 			  l_out_status,
489 			  l_error_code
490 			);
491 			IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
492                                 FND_LOG.string(
493                                   fnd_log.level_statement,
494                                   g_log_module_name,
495                                   'After Calling FV_CCR_GRP.FV_IS_CCR with i.vendor_site_id = '||i.vendor_site_id||' l_return_status ='||l_return_status||'l_out_status = '||l_out_status
496                                 );
497                         END IF;
498 
499 			if l_out_status <> 'F' then
500 				return l_out_status;
501 			end if;
502 		end loop;
503 	end if;
504 IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
505 	FND_LOG.string(
506 			fnd_log.level_statement,
507 			g_log_module_name,
508 			'End IS_ADDR_CCR with p_object_id = '||p_object_id||'l_out_status = '||l_out_status
509 		      );
510 END IF;
511 return l_out_status;
512 EXCEPTION
513     WHEN OTHERS THEN
514       raise_application_error(-20060, 'Failure in IS_ADDR_CCR ', true);
515 END ;
516 
517 
518 /** function IS_SITE_CCR
519     -----------------------
520 purpose:
521 --------
522 The iSP wrapper api over FV_IS_CCR to know if site is a CCR Site
523 p_object_id: vendor_site_id
524 
525 Returns 'T' if the site is CCR Site otherwise 'F'
526 
527 */
528 FUNCTION IS_SITE_CCR(
529  p_api_version           IN      NUMBER,
530  p_init_msg_list         IN      VARCHAR2 ,
531  p_object_id             IN      NUMBER
532  )RETURN VARCHAR2
533 IS
534 l_out_status            VARCHAR2(1);
535 is_enabled              VARCHAR2(1);
536 l_return_status         VARCHAR2(1);
537 l_msg_count             NUMBER;
538 l_msg_data              VARCHAR2(3000);
539 l_error_code            NUMBER;
540 l_ccr_id                NUMBER;
541 BEGIN
542 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
543 		FND_LOG.string(
544 		  fnd_log.level_statement,
545 		  g_log_module_name,
546 		  'Start IS_SITE_CCR with p_object_id = '||p_object_id
547 		);
548 	END IF;
549         l_out_status := 'F';
550 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
551 		FND_LOG.string(
552 		  fnd_log.level_statement,
553 		  g_log_module_name,
554 		  'Calling pos_util_pkg.IS_FV_ENABLED'
555 	        );
556 	END IF;
557         is_enabled := pos_util_pkg.IS_FV_ENABLED();
558 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
559 		FND_LOG.string(
560 		  fnd_log.level_statement,
561 		  g_log_module_name,
562 		  'After Calling pos_util_pkg.IS_FV_ENABLED is_enabled = '||is_enabled
563 		);
564 	END IF;
565 
566         if is_enabled <> 'T' then
567                 return l_out_status;
568         else
569 		IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
570 		THEN
571 			FND_LOG.string(
572 			  fnd_log.level_statement,
573 			  g_log_module_name,
574 			  'Calling FV_CCR_GRP.FV_IS_CCR with p_object_id = '||p_object_id
575 			);
576 		END IF;
577                 FV_CCR_GRP.FV_IS_CCR(
578 		  p_api_version,
579 		  p_init_msg_list,
580 		  p_object_id,
581 		  'T',
582 		  l_return_status,
583 		  l_msg_count,
584 		  l_msg_data,
585 		  l_ccr_id,
586 		  l_out_status,
587 		  l_error_code
588 		);
589 		IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
590 		THEN
591 			FND_LOG.string(
592 			  fnd_log.level_statement,
593 			  g_log_module_name,
594 			  'After Calling FV_CCR_GRP.FV_IS_CCR l_out_status = '||l_out_status
595 			);
596 		END IF;
597         end if;
598 return l_out_status;
599 EXCEPTION
600     WHEN OTHERS THEN
601       raise_application_error(-20060, 'Failure in IS_SITE_CCR ', true);
602 END ;
603 
604 
605 /** function IS_SUPP_CCR
606     -----------------------
607 purpose:
608 --------
609 The iSP wrapper api over FV_IS_CCR to know if Supplier is a CCR Supplier.
610 p_object_id: vendor_id.
611 
612 Returns 'T' if the supplier is CCR Supplier otherwise 'F'
613 
614 */
615 
616 FUNCTION IS_SUPP_CCR(
617  p_api_version           IN      NUMBER,
618  p_init_msg_list         IN      VARCHAR2 ,
619  p_object_id             IN      NUMBER
620  )RETURN VARCHAR2
621 IS
622 l_out_status            VARCHAR2(1);
623 is_enabled              VARCHAR2(1);
624 l_return_status         VARCHAR2(1);
625 l_msg_count             NUMBER;
626 l_msg_data              VARCHAR2(3000);
627 l_error_code            NUMBER;
628 l_ccr_id                NUMBER;
629 BEGIN
630         l_out_status := 'F';
631 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
632 		FND_LOG.string(
633 	  	  fnd_log.level_statement,
634 		  g_log_module_name,
635 		  'Start IS_SUPP_CCR with p_object_id = '||p_object_id
636 		);
637 	END IF;
638         IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
639                 FND_LOG.string(
640                   fnd_log.level_statement,
641                   g_log_module_name,
642                   'Calling pos_util_pkg.IS_FV_ENABLED'
643                 );
644         END IF;
645         is_enabled := pos_util_pkg.IS_FV_ENABLED();
646 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
647                 FND_LOG.string(
648                   fnd_log.level_statement,
649                   g_log_module_name,
650                   'After Calling pos_util_pkg.IS_FV_ENABLED is_enabled ='||is_enabled
651                 );
652         END IF;
653         if is_enabled <> 'T' then
654                 return l_out_status;
655         else
656 		IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
657 		THEN
658 			FND_LOG.string(
659 			  fnd_log.level_statement,
660 			  g_log_module_name,
661 			  'Calling FV_CCR_GRP.FV_IS_CCR with p_object_id = '||p_object_id
662 			);
663 		END IF;
664                 FV_CCR_GRP.FV_IS_CCR(
665 		  p_api_version,
666 		  p_init_msg_list,
667 		  p_object_id,
668 		  'S',
669 		  l_return_status,
670 		  l_msg_count,
671 		  l_msg_data,
672 		  l_ccr_id,
673 		  l_out_status,
674 		  l_error_code
675 		);
676 		IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
677 		THEN
678                         FND_LOG.string(
679                           fnd_log.level_statement,
680                           g_log_module_name,
681                           'After Calling FV_CCR_GRP.FV_IS_CCR with l_out_status = '||l_out_status
682                         );
683                 END IF;
684         end if;
685 return l_out_status;
686 END ;
687 
688 /** function IS_CCR_SITE_ACTIVE
689     -----------------------
690 purpose:
691 --------
692 The iSP wrapper api over FV_CCR_GRP.FV_CCR_REG_STATUS to know if site is CCR
693 site and if registration_status is active.
694 p_object_id: vendor_site_id.
695 
696 Returns 'T' if the site is CCR Site and registration_status is active otherwise
697 'F'
698 
699 */
700 
701 FUNCTION IS_CCR_SITE_ACTIVE(
702  p_api_version           IN      NUMBER,
703  p_init_msg_list         IN      VARCHAR2 ,
704  p_object_id             IN      NUMBER
705  )RETURN VARCHAR2
706 IS
707 l_out_status            VARCHAR2(1);
708 is_enabled              VARCHAR2(1);
709 l_return_status         VARCHAR2(1);
710 l_msg_count             NUMBER;
711 l_msg_data              VARCHAR2(3000);
712 l_error_code            NUMBER;
713 l_ccr_id                NUMBER;
714 BEGIN
715 	IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
716                 FND_LOG.string(
717                   fnd_log.level_statement,
718                   g_log_module_name,
719                   'Start IS_CCR_SITE_ACTIVE with p_object_id = '||p_object_id
720                 );
721         END IF;
722         IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) THEN
723                 FND_LOG.string(
724                   fnd_log.level_statement,
725                   g_log_module_name,
726                   'Calling pos_util_pkg.IS_FV_ENABLED'
727                 );
728         END IF;
729         l_out_status := 'F';
730 
731         is_enabled := pos_util_pkg.IS_FV_ENABLED();
732         if is_enabled <> 'T' then
733                 return 'F';
734         else
735 		IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
736                 THEN
737                         FND_LOG.string(
738                           fnd_log.level_statement,
739                           g_log_module_name,
740                           'Calling FV_CCR_GRP.FV_IS_CCR with p_object_id = '||p_object_id
741                         );
742                 END IF;
743 
744                 FV_CCR_GRP.FV_IS_CCR(
745 		  p_api_version,
746 		  p_init_msg_list,
747 		  p_object_id,
748 		  'T',
749 		  l_return_status,
750 		  l_msg_count,
751 		  l_msg_data,
752 		  l_ccr_id,
753 		  l_out_status,
754 		  l_error_code
755 		);
756 		IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
757                 THEN
758                         FND_LOG.string(
759                           fnd_log.level_statement,
760                           g_log_module_name,
761                           'After Calling FV_CCR_GRP.FV_IS_CCR with l_out_status = '||l_out_status
762                         );
763                 END IF;
764 
765 		if l_out_status <> 'T' then
766 			return 'F';
767 		else
768 			IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
769 	                THEN
770                 	        FND_LOG.string(
771         	                  fnd_log.level_statement,
772 	                          g_log_module_name,
773                 	          'Calling FV_CCR_GRP.FV_CCR_REG_STATUS with p_object_id = '||p_object_id
774         	                );
775 	                END IF;
776 			FV_CCR_GRP.FV_CCR_REG_STATUS(
777 			  p_api_version,
778 			  p_init_msg_list,
779 			  p_object_id,
780 			  l_return_status,
781 			  l_msg_count,
782 			  l_msg_data,
783 			  l_out_status,
784 			  l_error_code
785 			);
786 			IF (fnd_log.level_statement >= FND_LOG.G_CURRENT_RUNTIME_LEVEL )
787                         THEN
788                                 FND_LOG.string(
789                                   fnd_log.level_statement,
790                                   g_log_module_name,
791                                   'After Calling FV_CCR_GRP.FV_CCR_REG_STATUS with l_out_status = '||l_out_status
792                                 );
793                         END IF;
794 
795 		end if;
796         end if;
797 return l_out_status;
798 EXCEPTION
799     WHEN OTHERS THEN
800       raise_application_error(-20060, 'Failure in IS_CCR_SITE_ACTIVE', true);
801 END ;
802 
803 end pos_util_pkg;