[Home] [Help]
PACKAGE BODY: APPS.JTF_TERR_DEF_MGMT_PUB
Source
1 Package Body JTF_TERR_DEF_MGMT_PUB AS
2 /* $Header: jtfpdefb.pls 120.0 2005/06/02 18:20:39 appldev ship $ */
3
4
5 -- ---------------------------------------------------
6 -- Start of Comments
7 -- ---------------------------------------------------
8 -- PACKAGE NAME: JTF_TERR_DEF_MGMT_PUB
9 -- ---------------------------------------------------
10 -- PURPOSE
11 -- Defect Management territory manager public api's.
12 -- This package is a public API for getting winning territories
13 -- or territory resources.
14 --
15 -- Procedures:
16 -- (see below for specification)
17 --
18 -- NOTES
19 -- This package is publicly available for use
20 --
21 -- HISTORY
22 -- 01/07/99 VNEDUNGA Created
23 -- 01/10/00 VNEDUNGA Added LANGUAGE_CODE_ID to DEF_MGMT
24 -- rec type
25 -- 01/18/00 VNEDUNGA Fixing mispelled platform_id
26 -- 02/01/00 vnedunga Chnaging the get resource SQL
27 -- 02/11/00 vnedunga Fixng call to the dynamic package
28 -- 02/24/00 vnedunga Making changes to call the newly designed
29 -- Generated Engine packages
30 -- 02/24/00 vnedunga Adding the code to rerturn Catch all
31 -- if there was no qualifying Ter
32 -- 03/23/00 vnedunga Making changes to return full_access_flag
33 -- 05/02/00 vnedunga Take out for UPDATE from get rsc cursor
34 -- 10/16/00 vvuyyuru Changed the Defect Management Record Definition
35 -- to make it more generic and also changed the
36 -- related code for the Defects
37 --
38 --
39 -- End of Comments
40 --
41
42
43
44 -- ***************************************************
45 -- GLOBAL VARIABLES
46 -- ***************************************************
47
48 G_PKG_NAME CONSTANT VARCHAR2(30) :='JTF_TERR_DEF_MGMT_PUB';
49 G_FILE_NAME CONSTANT VARCHAR2(12) :='jtfpdefb.pls';
50
51 G_NEW_LINE VARCHAR2(02) := fnd_global.local_chr(10);
52 G_APPL_ID NUMBER := FND_GLOBAL.Prog_Appl_Id;
53 G_LOGIN_ID NUMBER := FND_GLOBAL.Conc_Login_Id;
54 G_PROGRAM_ID NUMBER := FND_GLOBAL.Conc_Program_Id;
55 G_USER_ID NUMBER := FND_GLOBAL.User_Id;
56 G_REQUEST_ID NUMBER := FND_GLOBAL.Conc_Request_Id;
57 G_APP_SHORT_NAME VARCHAR2(15) := FND_GLOBAL.Application_Short_Name;
58
59
60
61
62 -- ***************************************************
63 -- start of comments
64 -- ***************************************************
65 -- api name : Get_WinningTerrMembers
66 -- end of comments
67 PROCEDURE Get_WinningTerrMembers
68 (
69 p_api_version_number IN number,
70 p_init_msg_list IN varchar2 := fnd_api.g_false,
71 p_TerrDefMgmt_Rec IN JTF_TERRITORY_PUB.JTF_Def_Mgmt_rec_type,
72 p_Resource_Type IN varchar2,
73 p_Role IN varchar2,
74 x_return_status OUT NOCOPY varchar2,
75 x_msg_count OUT NOCOPY number,
76 X_msg_data OUT NOCOPY varchar2,
77 x_TerrResource_tbl OUT NOCOPY JTF_TERRITORY_PUB.WinningTerrMember_tbl_type
78 )
79 AS
80
81 l_api_name CONSTANT VARCHAR2(30) := 'Get_WinningTerrMembers';
82 l_api_version_number CONSTANT NUMBER := 1.0;
83 l_return_status VARCHAR2(1);
84 l_Counter NUMBER := 0;
85 l_RscCounter NUMBER := 0;
86 l_NumberOfWinners NUMBER;
87 l_RetCode BOOLEAN;
88
89 lp_rec JTF_TERRITORY_PUB.jtf_bulk_trans_rec_type;
90 lx_rec JTF_TERRITORY_PUB.Winning_bulk_rec_type;
91
92 BEGIN
93 --dbms_output.put_line('Get_WinningTerrMembers: Entering the API');
94
95 -- Standard call to check for call compatibility.
96 IF NOT FND_API.Compatible_API_Call
97 (
98 l_api_version_number,
99 p_api_version_number,
100 l_api_name,
101 G_PKG_NAME
102 ) THEN
103 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
104 END IF;
105
106
107 -- Initialize message list if p_init_msg_list is set to TRUE.
108 IF FND_API.to_Boolean( p_init_msg_list ) THEN
109 FND_MSG_PUB.initialize;
110 END IF;
111
112 -- Debug Message
113 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
114 FND_MESSAGE.Set_Name('JTF', 'JTF_TERR_MEM_DEF_MGMT_START');
115 FND_MSG_PUB.Add;
116 END IF;
117
118 -------------------
119 ----- API body ----
120 -------------------
121
122 x_return_status := FND_API.G_RET_STS_SUCCESS;
123
124 /* initialise trans_object_id and trans_detail_object_id:
125 ** required in JTF_TERR_1004_DEF_MGMT_DYN.SEARCH_TERR_RULES
126 */
127 lp_Rec.trans_object_id := jtf_terr_number_list(-1010);
128 lp_Rec.trans_detail_object_id := jtf_terr_number_list(-1010);
129
130 /* initialise BULK tables with SINGLE record values */
131 lp_Rec.squal_char01 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char01);
132 lp_Rec.squal_char02 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char02);
133 lp_Rec.squal_char03 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char03);
134 lp_Rec.squal_char04 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char04);
135 lp_Rec.squal_char05 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char05);
136 lp_Rec.squal_char06 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char06);
137 lp_Rec.squal_char07 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char07);
138 lp_Rec.squal_char08 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char08);
139 lp_Rec.squal_char09 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char09);
140 lp_Rec.squal_char10 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char10);
141 lp_Rec.squal_char11 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char11);
142 lp_Rec.squal_char12 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char12);
143 lp_Rec.squal_char13 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char13);
144 lp_Rec.squal_char14 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char14);
145 lp_Rec.squal_char15 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char15);
146 lp_Rec.squal_char16 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char16);
147 lp_Rec.squal_char17 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char17);
148 lp_Rec.squal_char18 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char18);
149 lp_Rec.squal_char19 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char19);
150 lp_Rec.squal_char20 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char20);
151 lp_Rec.squal_char21 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char21);
152 lp_Rec.squal_char22 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char22);
153 lp_Rec.squal_char23 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char23);
154 lp_Rec.squal_char24 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char24);
155 lp_Rec.squal_char25 := jtf_terr_char_360list(p_TerrDefMgmt_rec.squal_char25);
156 lp_Rec.squal_num01 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num01);
157 lp_Rec.squal_num02 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num02);
158 lp_Rec.squal_num03 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num03);
159 lp_Rec.squal_num04 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num04);
160 lp_Rec.squal_num05 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num05);
161 lp_Rec.squal_num06 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num06);
162 lp_Rec.squal_num07 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num07);
163 lp_Rec.squal_num08 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num08);
164 lp_Rec.squal_num09 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num09);
165 lp_Rec.squal_num10 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num10);
166 lp_Rec.squal_num11 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num11);
167 lp_Rec.squal_num12 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num12);
168 lp_Rec.squal_num13 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num13);
169 lp_Rec.squal_num14 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num14);
170 lp_Rec.squal_num15 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num15);
171 lp_Rec.squal_num16 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num16);
172 lp_Rec.squal_num17 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num17);
173 lp_Rec.squal_num18 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num18);
174 lp_Rec.squal_num19 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num19);
175 lp_Rec.squal_num20 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num20);
176 lp_Rec.squal_num21 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num21);
177 lp_Rec.squal_num22 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num22);
178 lp_Rec.squal_num23 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num23);
179 lp_Rec.squal_num24 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num24);
180 lp_Rec.squal_num25 := jtf_terr_number_list(p_TerrDefMgmt_rec.squal_num25);
181
182 jtf_terr_1004_def_mgmt_dyn.search_terr_rules(
183 p_rec => lp_rec
184 , x_rec => lx_rec
185 , p_role => p_role
186 , p_resource_type => p_resource_type );
187
188 l_counter := lx_rec.terr_id.FIRST;
189
190 WHILE (l_counter <= lx_rec.terr_id.LAST) LOOP
191
192 x_TerrResource_tbl(l_counter).TERR_RSC_ID := lx_rec.terr_rsc_id(l_counter);
193 x_TerrResource_tbl(l_counter).RESOURCE_ID := lx_rec.resource_id(l_counter);
194 x_TerrResource_tbl(l_counter).RESOURCE_TYPE := lx_rec.resource_type(l_counter);
195 x_TerrResource_tbl(l_counter).GROUP_ID := lx_rec.group_id(l_counter);
196 x_TerrResource_tbl(l_counter).ROLE := lx_rec.role(l_counter);
197 x_TerrResource_tbl(l_counter).PRIMARY_CONTACT_FLAG := lx_rec.full_access_flag(l_counter);
198 x_TerrResource_tbl(l_counter).FULL_ACCESS_FLAG := lx_rec.primary_contact_flag(l_counter);
199 x_TerrResource_tbl(l_counter).TERR_ID := lx_rec.terr_id(l_counter);
200
201 l_counter := l_counter + 1;
202
203 END LOOP;
204 IF (l_Counter = 1) THEN
205 NULL;
206 --dbms_output.put_line('No records returned');
207 END IF;
208
209 -- Debug Message
210 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
211 FND_MESSAGE.Set_Name('JTF', 'JTF_TERR_MEM_DEF_MGMT_END');
212 FND_MSG_PUB.Add;
213 END IF;
214
215 -- Standard call to get message count and if count is 1, get message info.
216 FND_MSG_PUB.Count_And_Get
217 (
218 p_count => x_msg_count,
219 p_data => x_msg_data
220 );
221 --dbms_output.put_line('Get_Escalation_TerrMembers: Exiting the API');
222
223 EXCEPTION
224
225 WHEN OTHERS THEN
226 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
227 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR ) THEN
228 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
229 END IF;
230
231 FND_MSG_PUB.Count_And_Get
232 (
233 p_count => x_msg_count,
234 p_data => x_msg_data
235 );
236
237 END Get_WinningTerrMembers;
238
239
240 END JTF_TERR_DEF_MGMT_PUB;