DBA Data[Home] [Help]

PACKAGE BODY: APPS.WSH_CC_USERS_PKG

Source


1 PACKAGE BODY WSH_CC_USERS_PKG AS
2    /* $Header: WSHUSTHB.pls 115.3 2002/06/03 12:32:33 pkm ship        $ */
3   --  Global constant holding the package name
4   G_PKG_NAME      CONSTANT VARCHAR2(30) := 'WSH_CC_USERS_PKG';
5 
6  /*----------------------------------------------------------*/
7  /* Insert_Row Procedure                                     */
8  /*----------------------------------------------------------*/
9  /*  --
10    -- Purpose
11    --  Insert a row into WSH_CC_USERS entity
12    --
13    -- Input Parameters
14    --   p_api_version
15    --      API version number (current version is 1.0)
16    --   p_init_msg_list (optional, default FND_API.G_FALSE)
17    --          Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
18    --                           if set to FND_API.G_TRUE
19    --                                   initialize error message list
20    --                           if set to FND_API.G_FALSE - not initialize error
21    --                                   message list
22    --   p_commit (optional, default FND_API.G_FALSE)
23    --           whether or not to commit the changes to database
24    --
25    -- Input parameters for clear cross users informations
26    --     p_APPLICATION_ID --Application ID added.
27    --     p_MASTER_ORGANIZATION_ID   - Master Org
28    --     p_ORGANIZATION_ID   - Org
29    --     p_APPLICATION_USER_ID  - Application User
30    --     p_CC_USER_ID - Clear Cross User
31    --     p_ENCRYPTED_USER_PASSWORD - Password
32    --
33    -- Output Parameters
34    --   x_return_status
35    --       if the process succeeds, the value is
36    --           fnd_api.g_ret_sts_success;
37    --       if there is an expected error, the value is
38    --           fnd_api.g_ret_sts_error;
39    --       if there is an unexpected error, the value is
40    --           fnd_api.g_ret_sts_unexp_error;
41    --   x_msg_count
42    --       if there is one or more errors, the number of error messages
43    --           in the buffer
44    --   x_msg_data
45    --       if there is one and only one error, the error message
46    --   (See fnd_api package for more details about the above output parameters)
47    --   p_CC_USER_SEQUENCE_ID  - Clear Cross sequence Id ( PK)
48    --*/
49 
50  PROCEDURE Insert_Row
51  (
52    p_api_version        IN      NUMBER                          ,
53    p_init_msg_list      IN      VARCHAR2 := fnd_api.g_false     ,
54    p_commit             IN      VARCHAR2 := fnd_api.g_false     ,
55    x_return_status      OUT     VARCHAR2                        ,
56    x_msg_count          OUT     NUMBER                          ,
57    x_msg_data           OUT     VARCHAR2                        ,
58    p_APPLICATION_ID          IN  NUMBER,
59    p_MASTER_ORGANIZATION_ID  IN  NUMBER,
60    p_ORGANIZATION_ID         IN  NUMBER default null,
61    p_APPLICATION_USER_ID     IN  NUMBER default null,
62    p_CC_USER_ID              IN  VARCHAR2,
63    p_ENCRYPTED_USER_PASSWORD IN  VARCHAR2,
64    p_CC_USER_SEQUENCE_ID    OUT  NUMBER
65   )
66 IS
67    l_CC_USER_SEQUENCE_ID NUMBER ;
68    l_api_name        CONSTANT VARCHAR2(30)      := 'Insert_Row';
69    l_api_version     number := 1.0;
70 begin
71 --dbms_output.put_line('begin api');
72   -- Standard Start of API savepoint
73   SAVEPOINT  WSH_CC_USERS_PKG;
74   -- Standard call to check for call compatibility.
75   IF NOT FND_API.Compatible_API_Call ( l_api_version   ,
76                                        p_api_version   ,
77 							    l_api_name      ,
78 							    G_PKG_NAME )
79   THEN
80      FND_MESSAGE.SET_NAME('WSH', 'WSH_INCOMPATIBLE_API_CALL');
81      FND_MSG_PUB.ADD;
82      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
83   END IF;
84   -- Initialize message list if p_init_msg_list is set to TRUE.
85   IF FND_API.to_Boolean( p_init_msg_list ) THEN
86     FND_MSG_PUB.initialize;
87   END IF;
88    -- Initialize API return status to success
89   x_return_status := FND_API.G_RET_STS_SUCCESS;
90   --dbms_output.put_line('begin api-2');
91 
92   select wsh_cc_user_setups_s.nextval into l_CC_USER_SEQUENCE_ID from dual;
93   /* Validate input parameters if any */
94 
95   -- Insert a row into wsh_cc_users entity with all detail information
96     insert into wsh_cc_user_setups
97     ( CC_USER_SEQUENCE_ID
98      ,APPLICATION_ID
99      ,MASTER_ORGANIZATION_ID
100      ,ORGANIZATION_ID
101      ,APPLICATION_USER_ID
102      ,CC_USER_ID
103      ,ENCRYPTED_USER_PASSWORD
104      ,CREATION_DATE
105      ,CREATED_BY
106      ,LAST_UPDATE_DATE
107      ,LAST_UPDATED_BY
108      ,LAST_UPDATE_LOGIN
109      )
110     values (
111      l_CC_USER_SEQUENCE_ID
112     ,p_APPLICATION_ID
113     ,p_MASTER_ORGANIZATION_ID
114     ,p_ORGANIZATION_ID
115     ,p_APPLICATION_USER_ID
116     ,p_CC_USER_ID
117     ,p_ENCRYPTED_USER_PASSWORD
118     ,sysdate
119     ,FND_GLOBAL.user_id
120     ,sysdate
121     ,FND_GLOBAL.user_id
122     ,FND_GLOBAL.login_id
123     ) ;
124   IF SQL%NOTFOUND THEN
125      FND_MESSAGE.SET_NAME('WSH', 'WSH_INSERT_FAILED');
126      FND_MSG_PUB.ADD;
127      x_return_status := FND_API.G_RET_STS_ERROR;
128      RAISE FND_API.G_EXC_ERROR ;
129   END IF;
130 --dbms_output.put_line('Seq Id got it '||l_CC_USER_SEQUENCE_ID||'success');
131   x_return_status := fnd_api.g_ret_sts_success;
132   p_CC_USER_SEQUENCE_ID := l_CC_USER_SEQUENCE_ID;
133   -- End of API body
134   -- Standard check of p_commit.
135   IF FND_API.To_Boolean( p_commit ) THEN
136      COMMIT WORK;
137   END IF;
138   -- Standard call to get message count and if count is 1,
139   -- get message info.
140   FND_MSG_PUB.Count_And_Get
141   (  p_count         =>      x_msg_count,
142      p_data          =>      x_msg_data
143    );
144 
145 EXCEPTION
146    WHEN FND_API.G_EXC_ERROR THEN
147      ROLLBACK TO WSH_CC_USERS_PKG;
148 	x_return_status := FND_API.G_RET_STS_ERROR;
149 	FND_MSG_PUB.Count_And_Get
150        (       p_count         =>      x_msg_count,
151 	          p_data          =>      x_msg_data
152 	   );
153    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
154      ROLLBACK TO WSH_CC_USERS_PKG;
155      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
156      FND_MSG_PUB.Count_And_Get
157         (       p_count         =>      x_msg_count,
158 	           p_data          =>      x_msg_data
159         );
160    WHEN OTHERS THEN
161      ROLLBACK TO WSH_CC_USERS_PKG;
162      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
163      IF   FND_MSG_PUB.Check_Msg_Level
164         (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
165      THEN
166        FND_MSG_PUB.Add_Exc_Msg
167 	  (    G_PKG_NAME      ,
168 	       l_api_name
169         );
170 	END IF;
171 	FND_MSG_PUB.Count_And_Get
172 	(       p_count         =>      x_msg_count,
173 	        p_data          =>      x_msg_data
174  	 );
175 End Insert_Row;
176  /*----------------------------------------------------------*/
177  /* Update_Row Procedure                                     */
178  /*----------------------------------------------------------*/
179  /*  --
180    -- Purpose
181    --  Update a row into WSH_CC_USERS entity for the given cc seq id
182    --
183    -- Input Parameters
184    --   p_api_version
185    --      API version number (current version is 1.0)
186    --   p_init_msg_list (optional, default FND_API.G_FALSE)
187    --          Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
188    --                           if set to FND_API.G_TRUE
189    --                                   initialize error message list
190    --                           if set to FND_API.G_FALSE - not initialize error
191    --                                   message list
192    --   p_commit (optional, default FND_API.G_FALSE)
193    --           whether or not to commit the changes to database
194    --
195    -- Input parameters for clear cross users informations
196    --     p_APPLICATION_ID --Application added
197    --     p_MASTER_ORGANIZATION_ID   -- Master Org
198    --     p_ORGANIZATION_ID   --Org
199    --     p_APPLICATION_USER_ID  -- Application User
200    --     p_CC_USER_ID -- Clear Cross User
201    --     p_ENCRYPTED_USER_PASSWORD -- Password
202    --     p_CC_USER_SEQUENCE_ID  -- CC Seq Id
203    --
204    --
205    -- Output Parameters
206    --   x_return_status
207    --       if the process succeeds, the value is
208    --           fnd_api.g_ret_sts_success;
209    --       if there is an expected error, the value is
210    --           fnd_api.g_ret_sts_error;
211    --       if there is an unexpected error, the value is
212    --           fnd_api.g_ret_sts_unexp_error;
213    --   x_msg_count
214    --       if there is one or more errors, the number of error messages
215    --           in the buffer
216    --   x_msg_data
217    --       if there is one and only one error, the error message
218    --   (See fnd_api package for more details about the above output parameters)
219 
220    --*/
221  PROCEDURE Update_Row
222  (
223    p_api_version        IN      NUMBER                          ,
224    p_init_msg_list      IN      VARCHAR2 := fnd_api.g_false     ,
225    p_commit             IN      VARCHAR2 := fnd_api.g_false     ,
226    x_return_status      OUT     VARCHAR2                        ,
227    x_msg_count          OUT     NUMBER                          ,
228    x_msg_data           OUT     VARCHAR2                        ,
229    p_APPLICATION_ID          IN  NUMBER,
230    p_MASTER_ORGANIZATION_ID  IN  NUMBER,
231    p_ORGANIZATION_ID         IN  NUMBER default fnd_api.g_miss_num,
232    p_APPLICATION_USER_ID     IN  NUMBER default fnd_api.g_miss_num,
233    p_CC_USER_ID              IN  VARCHAR2,
234    p_ENCRYPTED_USER_PASSWORD IN  VARCHAR2,
235    p_CC_USER_SEQUENCE_ID     IN  NUMBER
236   )
237 IS
238    l_api_name        CONSTANT VARCHAR2(30) := 'Update_Row'  ;
239    l_api_version     number := 1.0;
240 BEGIN
241 --dbms_output.put_line('begin');
242   -- Standard Start of API savepoint
243   SAVEPOINT  WSH_CC_USERS_PKG;
244   -- Standard call to check for call compatibility.
245   IF NOT FND_API.Compatible_API_Call ( l_api_version   ,
246                                        p_api_version   ,
247 				       l_api_name      ,
248 				       G_PKG_NAME )
249   THEN
250      FND_MESSAGE.SET_NAME('WSH', 'WSH_INCOMPATIBLE_API_CALL');
251      FND_MSG_PUB.ADD;
252      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
253   END IF;
254   -- Initialize message list if p_init_msg_list is set to TRUE.
255   IF FND_API.to_Boolean( p_init_msg_list ) THEN
256     FND_MSG_PUB.initialize;
257   END IF;
258    -- Initialize API return status to success
259   x_return_status := FND_API.G_RET_STS_SUCCESS;
260 
261   -- Update a row into wsh_cc_users entity with all detail information
262   -- for the given cc seq id
263 
264  update wsh_cc_user_setups
265  SET
266   APPLICATION_ID           = p_APPLICATION_ID
267  ,MASTER_ORGANIZATION_ID   = p_MASTER_ORGANIZATION_ID
268  ,ORGANIZATION_ID         = decode(p_ORGANIZATION_ID,fnd_api.g_miss_num,
269                             ORGANIZATION_ID,p_ORGANIZATION_ID)
270  ,APPLICATION_USER_ID     = decode(p_APPLICATION_USER_ID,fnd_api.g_miss_num,
271                             APPLICATION_USER_ID,p_APPLICATION_USER_ID)
272  ,CC_USER_ID              = p_CC_USER_ID
273  ,ENCRYPTED_USER_PASSWORD = p_ENCRYPTED_USER_PASSWORD
274  ,LAST_UPDATE_DATE         = sysdate
275  ,LAST_UPDATED_BY          = FND_GLOBAL.user_id
276  ,LAST_UPDATE_LOGIN        = FND_GLOBAL.login_id
277   where cc_user_sequence_id = p_cc_user_sequence_id ;
278   IF SQL%NOTFOUND THEN
279      FND_MESSAGE.SET_NAME('WSH', 'WSH_UPDATE_FAILED');
280      FND_MSG_PUB.ADD;
281      x_return_status := FND_API.G_RET_STS_ERROR;
282      RAISE FND_API.G_EXC_ERROR ;
283   END IF;
284 --dbms_output.put_line('begin-5');
285   x_return_status := fnd_api.g_ret_sts_success;
286 
287   -- End of API body
288   -- Standard check of p_commit.
289   IF FND_API.To_Boolean( p_commit ) THEN
290      COMMIT WORK;
291   END IF;
292   -- Standard call to get message count and if count is 1,
293   -- get message info.
294   FND_MSG_PUB.Count_And_Get
295   (  p_count         =>      x_msg_count,
296      p_data          =>      x_msg_data
297    );
298 
299 EXCEPTION
300    WHEN FND_API.G_EXC_ERROR THEN
301 --dbms_output.put_line(sqlerrm);
302      ROLLBACK TO WSH_CC_USERS_PKG;
303 	x_return_status := FND_API.G_RET_STS_ERROR;
304 	FND_MSG_PUB.Count_And_Get
305        (       p_count         =>      x_msg_count,
306 	          p_data          =>      x_msg_data
307 	   );
308    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
309 --dbms_output.put_line(sqlerrm);
310      ROLLBACK TO WSH_CC_USERS_PKG;
311      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
312      FND_MSG_PUB.Count_And_Get
313         (       p_count         =>      x_msg_count,
314 	           p_data          =>      x_msg_data
315         );
316    WHEN OTHERS THEN
317 --dbms_output.put_line(sqlerrm);
318      ROLLBACK TO WSH_CC_USERS_PKG;
319      x_return_status := 'W';
320      IF   FND_MSG_PUB.Check_Msg_Level
321         (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
322      THEN
323        FND_MSG_PUB.Add_Exc_Msg
324 	  (    G_PKG_NAME      ,
325 	       l_api_name
326         );
327 	END IF;
328 	FND_MSG_PUB.Count_And_Get
329 	(       p_count         =>      x_msg_count,
330 	        p_data          =>      x_msg_data
331  	 );
332 
333 End Update_Row;
334  /*----------------------------------------------------------*/
335  /* Delete_Row Procedure                                     */
336  /*----------------------------------------------------------*/
337  /*  --
338    -- Purpose
339    --  Delete a row from WSH_CC_USERS entity for the given cc seq id
340    --
341    -- Input Parameters
342    --   p_api_version
343    --      API version number (current version is 1.0)
344    --   p_init_msg_list (optional, default FND_API.G_FALSE)
345    --          Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
346    --                           if set to FND_API.G_TRUE
347    --                                   initialize error message list
348    --                           if set to FND_API.G_FALSE - not initialize error
349    --                                   message list
350    --   p_commit (optional, default FND_API.G_FALSE)
351    --           whether or not to commit the changes to database
352    --
353    -- Input parameters for clear cross users informations
354    --     p_CC_USER_SEQUENCE_ID  -- CC Seq Id
355    --
356    --
357    -- Output Parameters
358    --   x_return_status
359    --       if the process succeeds, the value is
360    --           fnd_api.g_ret_sts_success;
361    --       if there is an expected error, the value is
362    --           fnd_api.g_ret_sts_error;
363    --       if there is an unexpected error, the value is
364    --           fnd_api.g_ret_sts_unexp_error;
365    --   x_msg_count
366    --       if there is one or more errors, the number of error messages
367    --           in the buffer
368    --   x_msg_data
369    --       if there is one and only one error, the error message
370    --   (See fnd_api package for more details about the above output parameters)
371 
372    --*/
373  PROCEDURE Delete_Row
374  (
375    p_api_version        IN      NUMBER                          ,
376    p_init_msg_list      IN      VARCHAR2 := fnd_api.g_false     ,
377    p_commit             IN      VARCHAR2 := fnd_api.g_false     ,
378    x_return_status      OUT     VARCHAR2                        ,
379    x_msg_count          OUT     NUMBER                          ,
380    x_msg_data           OUT     VARCHAR2                        ,
381    p_CC_USER_SEQUENCE_ID     IN  NUMBER
382   )
383 IS
384    l_api_name        CONSTANT VARCHAR2(30) := 'Delete_Row'  ;
385    l_api_version     number := 1.0;
386 BEGIN
387 --dbms_output.put_line('begin');
388   -- Standard Start of API savepoint
389   SAVEPOINT  WSH_CC_USERS_PKG;
390   -- Standard call to check for call compatibility.
391   IF NOT FND_API.Compatible_API_Call ( l_api_version   ,
392                                        p_api_version   ,
393 				       l_api_name      ,
394 				       G_PKG_NAME )
395   THEN
396      FND_MESSAGE.SET_NAME('WSH', 'WSH_INCOMPATIBLE_API_CALL');
397      FND_MSG_PUB.ADD;
398      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
399   END IF;
400   -- Initialize message list if p_init_msg_list is set to TRUE.
401   IF FND_API.to_Boolean( p_init_msg_list ) THEN
402     FND_MSG_PUB.initialize;
403   END IF;
404    -- Initialize API return status to success
405   x_return_status := FND_API.G_RET_STS_SUCCESS;
406 
407   -- Delete a row from wsh_cc_users entity
408   -- for the given cc seq id
409 
410  DELETE from wsh_cc_user_setups
411  WHERE cc_user_sequence_id = p_cc_user_sequence_id ;
412   IF SQL%NOTFOUND THEN
413      FND_MESSAGE.SET_NAME('WSH', 'WSH_DELETE_FAILED');
414      FND_MSG_PUB.ADD;
415      x_return_status := FND_API.G_RET_STS_ERROR;
416      RAISE FND_API.G_EXC_ERROR ;
417   END IF;
418 --dbms_output.put_line('begin-5');
419   x_return_status := fnd_api.g_ret_sts_success;
420 
421   -- End of API body
422   -- Standard check of p_commit.
423   IF FND_API.To_Boolean( p_commit ) THEN
424      COMMIT WORK;
425   END IF;
426   -- Standard call to get message count and if count is 1,
427   -- get message info.
428   FND_MSG_PUB.Count_And_Get
429   (  p_count         =>      x_msg_count,
430      p_data          =>      x_msg_data
431    );
432 
433 EXCEPTION
434    WHEN FND_API.G_EXC_ERROR THEN
435 --dbms_output.put_line(sqlerrm);
436      ROLLBACK TO WSH_CC_USERS_PKG;
437 	x_return_status := FND_API.G_RET_STS_ERROR;
438 	FND_MSG_PUB.Count_And_Get
439        (       p_count         =>      x_msg_count,
440 	          p_data          =>      x_msg_data
441 	   );
442    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
443 --dbms_output.put_line(sqlerrm);
444      ROLLBACK TO WSH_CC_USERS_PKG;
445      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
446      FND_MSG_PUB.Count_And_Get
447         (       p_count         =>      x_msg_count,
448 	           p_data          =>      x_msg_data
449         );
450    WHEN OTHERS THEN
451 --dbms_output.put_line(sqlerrm);
452      ROLLBACK TO WSH_CC_USERS_PKG;
453      x_return_status := 'W';
454      IF   FND_MSG_PUB.Check_Msg_Level
455         (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
456      THEN
457        FND_MSG_PUB.Add_Exc_Msg
458 	  (    G_PKG_NAME      ,
459 	       l_api_name
460         );
461 	END IF;
462 	FND_MSG_PUB.Count_And_Get
463 	(       p_count         =>      x_msg_count,
464 	        p_data          =>      x_msg_data
465  	 );
466 
467 End Delete_Row;
468  /*----------------------------------------------------------*/
469  /*----------------------------------------------------------*/
470  /* Lock_Row Procedure                                       */
471  /*----------------------------------------------------------*/
472  /*  --
473    -- Purpose
474    --  Lock a row into WSH_CC_USERS entity for the given cc seq id
475    --
476    -- Input Parameters
477    --   p_api_version
478    --      API version number (current version is 1.0)
479    --   p_init_msg_list (optional, default FND_API.G_FALSE)
480    --          Valid values: FND_API.G_FALSE or FND_API.G_TRUE.
481    --                           if set to FND_API.G_TRUE
482    --                                   initialize error message list
483    --                           if set to FND_API.G_FALSE - not initialize error
484    --                                   message list
485    --   p_commit (optional, default FND_API.G_FALSE)
486    --           whether or not to commit the changes to database
487    --
488    -- Input parameters for clear cross users informations
489    --     p_MASTER_ORGANIZATION_ID   -- Master Org
490    --     p_APPLICATION_ID --Application_id added.
491    --     p_ORGANIZATION_ID   --Org
492    --     p_APPLICATION_USER_ID  -- Application User
493    --     p_CC_USER_ID -- Clear Cross User
494    --     p_ENCRYPTED_USER_PASSWORD -- Password
495    --     p_CC_SEQUENCE_ID  -- CC Seq Id
496    --
497    --
498    -- Output Parameters
499    --   x_return_status
500    --       if the process succeeds, the value is
501    --           fnd_api.g_ret_sts_success;
502    --       if there is an expected error, the value is
503    --           fnd_api.g_ret_sts_error;
504    --       if there is an unexpected error, the value is
505    --           fnd_api.g_ret_sts_unexp_error;
506    --   x_msg_count
507    --       if there is one or more errors, the number of error messages
508    --           in the buffer
509    --   x_msg_data
510    --       if there is one and only one error, the error message
511    --   (See fnd_api package for more details about the above output parameters)
512 
513    --*/
514  PROCEDURE Lock_Row
515  (
516    p_api_version        IN      NUMBER                          ,
517    p_init_msg_list      IN      VARCHAR2 := fnd_api.g_false     ,
518    p_commit             IN      VARCHAR2 := fnd_api.g_false     ,
519    x_return_status      OUT     VARCHAR2                        ,
520    x_msg_count          OUT     NUMBER                          ,
521    x_msg_data           OUT     VARCHAR2                        ,
522    p_APPLICATION_ID          IN  NUMBER,
523    p_MASTER_ORGANIZATION_ID  IN  NUMBER,
524    p_ORGANIZATION_ID         IN  NUMBER default fnd_api.g_miss_num,
525    p_APPLICATION_USER_ID     IN  NUMBER default fnd_api.g_miss_num,
526    p_CC_USER_ID              IN  VARCHAR2,
527    p_ENCRYPTED_USER_PASSWORD IN  VARCHAR2,
528    p_CC_USER_SEQUENCE_ID     IN  NUMBER,
529    p_rowid                   IN VARCHAR2
530   )
531 IS
532    CURSOR lock_row IS
533    SELECT *
534    FROM wsh_cc_user_setups
535    WHERE rowid = p_rowid
536    FOR UPDATE OF CC_USER_SEQUENCE_ID NOWAIT;
537 
538    Recinfo lock_row%ROWTYPE;
539 
540    l_api_name        CONSTANT VARCHAR2(30) := 'Lock_Row'  ;
541    l_api_version     number := 1.0;
542 BEGIN
543 --dbms_output.put_line('begin');
544   -- Standard Start of API savepoint
545   SAVEPOINT  WSH_CC_USERS_PKG;
546   -- Standard call to check for call compatibility.
547   IF NOT FND_API.Compatible_API_Call ( l_api_version   ,
548                                        p_api_version   ,
549 				       l_api_name      ,
550 				       G_PKG_NAME )
551   THEN
552      FND_MESSAGE.SET_NAME('WSH', 'WSH_INCOMPATIBLE_API_CALL');
553      FND_MSG_PUB.ADD;
554      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
555   END IF;
556   -- Initialize message list if p_init_msg_list is set to TRUE.
557   IF FND_API.to_Boolean( p_init_msg_list ) THEN
558     FND_MSG_PUB.initialize;
559   END IF;
560    -- Initialize API return status to success
561   x_return_status := FND_API.G_RET_STS_SUCCESS;
562 
563   -- Check Lock a row into wsh_cc_users entity with all detail information
564   OPEN lock_row;
565   FETCH lock_row into Recinfo;
566 
567   IF (lock_row%NOTFOUND) THEN
568      CLOSE lock_row;
569      FND_MESSAGE.Set_Name('FND','FORM_RECORD_DELETED');
570      app_exception.raise_exception;
571   END IF;
572   CLOSE lock_row;
573 
574   IF (
575 	     (Recinfo.CC_USER_SEQUENCE_ID = p_CC_USER_SEQUENCE_ID)
576      AND ((Recinfo.master_organization_id =p_master_organization_id) OR
577 	    ( (Recinfo.master_organization_id is null)
578 		  AND (p_master_organization_id is null )))
579      AND ((Recinfo.organization_id =p_organization_id) OR
580 	    ( (Recinfo.organization_id is null)
581 		  AND (p_organization_id is null )))
582      AND ((Recinfo.cc_user_id =p_cc_user_id) OR
583 	    ( (Recinfo.cc_user_id is null)
584 		  AND (p_cc_user_id is null )))
585      AND ((Recinfo.application_user_id =p_application_user_id) OR
586 	    ( (Recinfo.application_user_id is null)
587 		  AND (p_application_user_id is null )))
588      AND ((Recinfo.encrypted_user_password =p_encrypted_user_password) OR
589 	    ( (Recinfo.encrypted_user_password is null)
590 		  AND (p_encrypted_user_password is null )))
591      AND ((Recinfo.application_id =p_APPLICATION_ID) OR
592             ( (Recinfo.application_id IS NULL)
593                   AND (p_APPLICATION_ID IS NULL)))
594      ) THEN
595        x_return_status := FND_API.G_RET_STS_SUCCESS;
596   ELSE
597     x_return_status := FND_API.G_RET_STS_ERROR;
598     FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
599     app_exception.raise_exception;
600   END IF;
601  EXCEPTION
602  WHEN others THEN
603      IF (lock_row%ISOPEN) then
604          close lock_row;
605 	End if;
606 End Lock_Row;
607 END WSH_CC_USERS_PKG;