DBA Data[Home] [Help]

PACKAGE BODY: APPS.WMS_INSTALL

Source


1 PACKAGE BODY WMS_INSTALL  AS
2 /* $Header: WMSINSTB.pls 120.1 2005/06/15 13:45:22 appldev  $ */
3 
4 -- Global constant holding package name
5 g_pkg_name constant varchar2(50) := 'WMS_INSTALL';
6 
7 /*
8 ** -------------------------------------------------------------------------
9 ** Function:    check_install
10 ** Description: Checks to see if WMS is installed
11 ** Output:
12 **      x_return_status
13 **              return status indicating success, error, unexpected error
14 **      x_msg_count
15 **              number of messages in message list
16 **      x_msg_data
17 **              if the number of messages in message list is 1, contains
18 **              message text
19 ** Input:
20 **      p_organization_id
21 **             -specific organization to be checked if WMS enabled.
22 **
23 **             -if NULL, the check is just made at site level
24 **              and not for any specific organization.This is more relaxed than
25 **              passing a specific organization.
26 ** Returns:
27 **	TRUE if WMS installed, else FALSE
28 **
29 **      Please use return value to determine if WMS is installed or not.
30 **      Do not use x_return_status for this purpose as
31 **      . x_return_status could be success and yet WMS not be installed.
32 **      . x_return_status is set to error when an error(such as SQL error)
33 **        occurs.
34 ** --------------------------------------------------------------------------
35 */
36 
37 function check_install (
38   x_return_status               OUT NOCOPY VARCHAR2
39 , x_msg_count                   OUT NOCOPY NUMBER
40 , x_msg_data                    OUT NOCOPY VARCHAR2
41 , p_organization_id             IN         NUMBER    ) return boolean is
42 
43 -- constants
44 c_api_name		constant varchar(30) := 'check_install';
45 
46 l_return_val         boolean := FALSE;
47 
48 -- WMS has an application id of 385 in fnd_application table
49 l_wms_application_id constant number := 385;
50 
51 l_status             varchar2(10);
52 l_industry           varchar2(10);
53 l_wms_enabled_flag   varchar2(1);
54 
55 begin
56     x_return_status := fnd_api.g_ret_sts_success ;
57 
58     /*
59     ** Check if WMS is installed. Use cached value if available
60     */
61 
62     if (g_wms_installation_status is not null) then
63 	l_status := WMS_INSTALL.g_wms_installation_status;
64     else
65     	l_return_val := fnd_installation.get(
66 			appl_id         => l_wms_application_id,
67                         dep_appl_id 	=> l_wms_application_id,
68                       	status      	=> l_status,
69                         industry    	=> l_industry);
70 
71         WMS_INSTALL.g_wms_installation_status := l_status;
72     end if;
73 
74     /*
75     ** If WMS installed, proceed
76     */
77     if (l_status = 'I') then
78 	if p_organization_id is NULL then
79 		return TRUE;
80 	else
81 		/*
82 		** If the previous org checked for WMS enable is same as this org
83 		** reuse the cached value
84 		*/
85 		if (p_organization_id = WMS_INSTALL.g_organization_id) then
86 			l_wms_enabled_flag := WMS_INSTALL.g_wms_enabled_flag;
87 	        else
88 			select wms_enabled_flag
89 			into l_wms_enabled_flag
90 			from mtl_parameters
91 			where organization_id = p_organization_id;
92 
93 			WMS_INSTALL.g_organization_id  := p_organization_id;
94 			WMS_INSTALL.g_wms_enabled_flag := l_wms_enabled_flag;
95 		end if;
96 
97 		if (l_wms_enabled_flag in ('Y','y')) then
98 			return TRUE;
99 		else
100 			return FALSE;
101 		end if;
102 	end if;
103     else
104 	return FALSE;
105     end if;
106 
107     exception
108       when others then
109      	x_return_status := fnd_api.g_ret_sts_unexp_error ;
110 
111       	if (fnd_msg_pub.check_msg_level
112        	    (fnd_msg_pub.g_msg_lvl_unexp_error)) then
113 	    fnd_msg_pub.add_exc_msg(g_pkg_name, c_api_name);
114       	end if;
115 
116 	return FALSE;
117 end check_install;
118 end WMS_INSTALL;