DBA Data[Home] [Help]

PACKAGE BODY: APPS.BSC_LAUNCH_PAD_PUB

Source


1 PACKAGE BODY BSC_LAUNCH_PAD_PUB AS
2 /* $Header: BSCCVDEFB.pls 120.1 2006/05/22 21:28:16 akchan ship $ */
3 
4 
5 PROCEDURE Delete_LaunchPad_Links
6 (
7      p_menu_id              IN          NUMBER
8     ,x_return_status        OUT NOCOPY  VARCHAR2
9     ,x_msg_count            OUT NOCOPY  NUMBER
10     ,x_msg_data             OUT NOCOPY  VARCHAR2
11 );
12 
13 /*
14   is_Menu_Id_Valid added for Bug #3236356
15 */
16 FUNCTION is_Menu_Id_Valid
17 (
18   p_Menu_Id         IN NUMBER
19 )RETURN NUMBER;
20 
21 /**********************************************************************
22  Name :- get_Form_Function_Name
23  Description :- This fucntion will return the form fucntion name
24                 corresponding to the fucntion id.
25  Input :- p_Function_Id
26  OutPut:- Form fucntion name
27  Creator ;-ashankar 15-DEC-2003
28 /**********************************************************************/
29 
30 
31 FUNCTION get_Form_Function_Name
32 (
33   p_Function_Id         IN      FND_FORM_FUNCTIONS.function_id% TYPE
34 )RETURN VARCHAR2
35 IS
36 l_function_name         FND_FORM_FUNCTIONS.Function_Name%TYPE;
37 
38  BEGIN
39 
40     SELECT Function_Name
41     INTO   l_function_name
42     FROM   FND_FORM_FUNCTIONS
43     WHERE  Function_Id     =   p_Function_Id;
44 
45  RETURN  l_function_name;
46 END get_Form_Function_Name;
47 
48 /*****************************************************************************
49  Name   :- get_next_entry_sequence
50  Description :- This fucntion will return the entry sequence of the menu id
51  Input :- menu id
52  Output :- Next Entry sequence
53 /*****************************************************************************/
54 
55 
56 FUNCTION get_next_entry_sequence
57 (
58     p_Menu_Id      FND_MENUS.menu_id%TYPE
59 )RETURN NUMBER
60 IS
61     l_count     NUMBER;
62 BEGIN
63 
64    SELECT NVL(MAX(Entry_Sequence),0)Entry_Sequence
65    INTO   l_count
66    FROM   FND_MENU_ENTRIES
67    WHERE  Menu_Id =p_Menu_Id;
68 
69    RETURN  (l_count + 1);
70 
71 END get_next_entry_sequence;
72 
73 
74 /*********************************************************************************/
75 FUNCTION Is_More
76 (       p_fucntion_ids   IN  OUT NOCOPY  VARCHAR2
77     ,   p_fucntion_id        OUT NOCOPY  VARCHAR2
78 ) RETURN BOOLEAN
79 IS
80     l_pos_ids               NUMBER;
81     l_pos_rel_types         NUMBER;
82     l_pos_rel_columns       NUMBER;
83 BEGIN
84     IF (p_fucntion_ids IS NOT NULL) THEN
85         l_pos_ids        := INSTR(p_fucntion_ids,   ',');
86         IF (l_pos_ids > 0) THEN
87             p_fucntion_id  :=  TRIM(SUBSTR(p_fucntion_ids,    1,    l_pos_ids - 1));
88             p_fucntion_ids :=  TRIM(SUBSTR(p_fucntion_ids,    l_pos_ids + 1));
89         ELSE
90             p_fucntion_id  :=  TRIM(p_fucntion_ids);
91             p_fucntion_ids :=  NULL;
92         END IF;
93         RETURN TRUE;
94     ELSE
95         RETURN FALSE;
96     END IF;
97 END Is_More;
98 
99 /*****************************************************************************
100  Name :- get_Menu_Name
101  Description :-This fucntion returns the default menu name by appending the menu
102                id if menu name is not being passed from UI.
103  Input  :- menuid
104  output :- 'BSC_LAUNCHPAD_menuid
105  Creator:-  ashankar 21-OCT-2003
106 /******************************************************************************/
107 
108 FUNCTION get_Menu_Name(
109     p_Menu_Id     IN     FND_MENUS.MENU_ID%TYPE
110 )
111 RETURN VARCHAR2
112 IS
113 BEGIN
114 
115     RETURN 'BSC_LAUNCHPAD_'|| p_Menu_Id;
116 
117 END get_Menu_Name;
118 
119 /*****************************************************************************
120  Name :- validate_Menu_UserMenu_Names
121  Description :-This function validates if the menu name and the user menu name entered by the
122                user are valid or not .i.e it checks for the uniqueness of menu name and
123                user menu name. if either of the name is invalid it returns 'N' and 'U'.
124                otherwise it reurns 'T'.
125  Input :-   p_menu_id
126             p_menu_name
127             p_user_menu_name
128  Ouput :- 'T' valid
129           'U' invalid user menu name
130           'N' invalid menu name
131  Creator:-  ashankar 21-OCT-2003
132  /******************************************************************************/
133 
134 FUNCTION validate_Menu_UserMenu_Names(
135      p_menu_id                 IN       NUMBER
136     ,p_menu_name               IN       VARCHAR2
137     ,p_user_menu_name          IN       VARCHAR2
138 )RETURN VARCHAR2
139 IS
140     l_return       VARCHAR2(2);
141 BEGIN
142     l_return := BSC_LAUNCH_PAD_PVT.CHECK_MENU_NAMES
143                 (
144                    X_MENU_ID        => p_menu_id
145                   ,X_MENU_NAME      => p_menu_name
146                   ,X_USER_MENU_NAME => p_user_menu_name
147                 );
148 
149    RETURN l_return;
150 
151 END validate_Menu_UserMenu_Names;
152 /*****************************************************************************
153  Name :- validate_Function_Names
154  Description :- This function validates if the menu name and the user menu name entered by the
155                 user are valid or not .i.e it checks for the uniqueness of menu name and
156                 user menu name. if either of the name is invalid it returns 'N' and 'U'.
157                 otherwise it reurns 'T'.
158  Input :-   p_function_id
159             p_fucntion_name
160             p_user_function_name
161  Ouput :- 'T' valid
162           'U' invalid user_function_name
163           'N' invalid fucntion_name
164  Creator:-  ashankar 21-OCT-2003
165  /******************************************************************************/
166 
167 FUNCTION validate_Function_Names(
168      p_function_id             IN       NUMBER
169     ,p_fucntion_name           IN       VARCHAR2
170     ,p_user_function_name      IN       VARCHAR2
171 )RETURN VARCHAR2
172 IS
173     l_return       VARCHAR2(2);
174 BEGIN
175     l_return := BSC_LAUNCH_PAD_PVT.CHECK_FUNCTION_NAMES
176                 (
177                       X_FUNCTION_ID         => p_function_id
178                     , X_FUNCTION_NAME       => p_fucntion_name
179                     , X_USER_FUNCTION_NAME  => p_user_function_name
180                 );
181 
182    RETURN l_return;
183 
184 END validate_Function_Names;
185 
186 
187 /*****************************************************************************
188  Name :-get_User_Id
189  Ouput :- USER ID
190  Creator :- ashankar 26-OCT-2003
191  /******************************************************************************/
192 
193 FUNCTION get_User_Id
194 RETURN NUMBER
195 IS
196 BEGIN
197 
198     -- Ref: bug#3482442 In corner cases this query can return more than one
199     -- row and it will fail. AUDSID is not PK. After meeting with
200     -- Vinod and Kris and Venu, we should use FNG_GLOBAL.user_id
201     RETURN BSC_APPS.fnd_global_user_id;
202 
203 END get_User_Id;
204 
205 /*****************************************************************************
206  Name :- get_Menu_Id_From_Menu_Name
207  Description :-This function returns menu ID from menu name from the database
208  Input :- p_Menu_Name
209  Ouput :- l_menu_id
210  Creator :- ashankar 26-OCT-2003
211 /*****************************************************************************/
212 
213 FUNCTION get_Menu_Id_From_Menu_Name(
214     p_Menu_Name     IN     FND_MENUS.MENU_NAME%TYPE
215 )RETURN NUMBER
216 IS
217  l_menu_id  FND_MENUS.MENU_ID%TYPE;
218 BEGIN
219 
220     SELECT  menu_id
221     INTO   l_menu_id
222     FROM   fnd_menus
223     WHERE  menu_name = p_Menu_Name;
224 
225     RETURN l_menu_id;
226 
227 END get_Menu_Id_From_Menu_Name;
228 
229 /*****************************************************************************
230  Name :- get_Menu_Name_From_Menu_Id
231  Description :-This function returns menu name from menu Id from the database
232  Input :- p_Menu_Id
233  Ouput :- l_menu_name
234  Creator :- ashankar 26-OCT-2003
235 /*****************************************************************************/
236 FUNCTION get_Menu_Name_From_Menu_Id(
237     p_Menu_Id     IN     FND_MENUS.MENU_ID%TYPE
238 )RETURN VARCHAR2
239 IS
240  l_menu_name  FND_MENUS.MENU_NAME%TYPE;
241 BEGIN
242 
243     SELECT  menu_name
244     INTO   l_menu_name
245     FROM   fnd_menus
246     WHERE  menu_id = p_Menu_Id;
247 
248     RETURN l_menu_name;
249 
250 END get_Menu_Name_From_Menu_Id;
251 
252 /*********************************************************************************
253  Procedure :- get_All_Root_Menu
254  Description :- This procedure will return the table which contains all the
255                 root menus to which the launchpad is to be attached.
256                 The roor menus are based on the responsibilities to which the
257                 scorecard is attached when it is created.So when the launchpad is
258                 created it will be assigned to each of the root menus.
259  Input  :-    table type
260  Output :-    table type which contains all the root menus to which the launchpad
261               needs to be attached.
262  creator :- ashankar 12-DEC-03
263 /*********************************************************************************/
264 
265 PROCEDURE get_All_Root_Menu
266 (
267     x_Root_Menu_Tbl  IN OUT NOCOPY BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Tbl_Type
268 
269 )IS
270 l_count         NUMBER;
271 
272 CURSOR c_root_menu IS
273 SELECT  DISTINCT A.Menu_Id
274        , A.Menu_Name
275 FROM   FND_MENUS_VL A
276       ,FND_RESPONSIBILITY_VL B
277 WHERE B.Application_Id =271
278 AND   B.Menu_Id = A.MENU_ID
279 AND   B.Responsibility_Id IN (SELECT DISTINCT Responsibility_Id from BSC_USER_TAB_ACCESS);
280 
281 BEGIN
282 
283     FOR table_index in 0..x_Root_Menu_Tbl.COUNT-1 LOOP
284         x_Root_Menu_Tbl.DELETE(table_index);
285     END LOOP;
286 
287     l_count := 0;
288     FOR cd IN c_root_menu LOOP
289      x_Root_Menu_Tbl(l_count).Bsc_menu_id  := cd.Menu_Id;
290      x_Root_Menu_Tbl(l_count).Bsc_menu_name:= cd.Menu_Name;
291      l_count := l_count + 1;
292     END LOOP;
293 
294 END get_All_Root_Menu;
295 
296 /********************************************************************************
297 Name :- Add_Launch_Pad_Root_Menu
298 Description :- This fucntion will add the created launchpad to all the root menus
299                attached to the scorecards.
300 Input:- p_Launchpad_Id
301         p_Description
302 
303 Creator :- ashankar 12-DEC-03
304 /********************************************************************************/
305 
306 PROCEDURE Add_Launch_Pad_Root_Menu
307 (
308     p_Launchpad_Id           IN              FND_MENUS.menu_id%TYPE
309   , p_Description            IN              VARCHAR2
310   , x_return_status          OUT    NOCOPY   VARCHAR2
311   , x_msg_count              OUT    NOCOPY   NUMBER
312   , x_msg_data               OUT    NOCOPY   VARCHAR2
313 )IS
314 
315  l_Root_Menu_Tbl         BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Tbl_Type;
316  l_root_menu_count       NUMBER;
317 
318 BEGIN
319    SAVEPOINT AddLaunchPadRootMenu;
320    FND_MSG_PUB.Initialize;
321    x_return_status := FND_API.G_RET_STS_SUCCESS;
322 
323    get_All_Root_Menu(x_Root_Menu_Tbl  => l_Root_Menu_Tbl);
324    l_root_menu_count :=0;
325 
326    WHILE((l_root_menu_count<= l_Root_Menu_Tbl.COUNT - 1)) LOOP
327 
328       BSC_LAUNCH_PAD_PVT.INSERT_APP_MENU_ENTRIES_VB
329       (
330           X_Menu_Id           => l_Root_Menu_Tbl(l_root_menu_count).Bsc_menu_id
331         , X_Entry_Sequence    => get_next_entry_sequence(l_Root_Menu_Tbl(l_root_menu_count).Bsc_menu_id)
332         , X_Sub_Menu_Id       => p_Launchpad_Id
333         , X_Function_Id       => NULL
334         , X_Grant_Flag        =>'Y'
335         , X_Prompt            => NULL
336         , X_Description       => p_Description
337         , X_User_Id           => get_User_Id
338       );
339       l_root_menu_count := l_root_menu_count + 1;
340    END LOOP;
341 
342 EXCEPTION
343 WHEN FND_API.G_EXC_ERROR THEN
344     ROLLBACK TO AddLaunchPadRootMenu;
345     IF (x_msg_data IS NULL) THEN
346     FND_MSG_PUB.Count_And_Get
347     (      p_encoded   =>  FND_API.G_FALSE
348             ,  p_count     =>  x_msg_count
349             ,  p_data      =>  x_msg_data
350     );
351     END IF;
352     x_return_status :=  FND_API.G_RET_STS_ERROR;
353 
354  WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
355     ROLLBACK TO AddLaunchPadRootMenu;
356     IF (x_msg_data IS NULL) THEN
357         FND_MSG_PUB.Count_And_Get
358         (      p_encoded   =>  FND_API.G_FALSE
359             ,  p_count     =>  x_msg_count
360             ,  p_data      =>  x_msg_data
361         );
362     END IF;
363     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
364 
365  WHEN NO_DATA_FOUND THEN
366     ROLLBACK TO AddLaunchPadRootMenu;
367     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
368     IF (x_msg_data IS NOT NULL) THEN
369         x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Add_Launch_Pad_Root_Menu ';
370     ELSE
371         x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Add_Launch_Pad_Root_Menu ';
372     END IF;
373 
374  WHEN OTHERS THEN
375     ROLLBACK TO AddLaunchPadRootMenu;
376     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
377     IF (x_msg_data IS NOT NULL) THEN
378         x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Add_Launch_Pad_Root_Menu ';
379     ELSE
380         x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Add_Launch_Pad_Root_Menu ';
381     END IF;
382 END Add_Launch_Pad_Root_Menu;
383 
384 /*****************************************************************************
385  Name :- Create_Launch_Pad
386  Description :-This fucntion creates the lauchpad entry into FND_MENUS.
387  Validations :-
388 
389          1. Generate the menu id internally
390          2. Generate the menu name internally if null.
391          3. Set the type to UNKNOWN if not passed from UI
392          4. First create the Menu.
393          5. Next create the association between menus and functions
394          6. set the order of entry_sequence sequentially.
395          7. call the menu function association API
396  Input :-   p_menu_name
397             p_user_menu_name
398             p_menu_type
399             p_description
400             p_fucntion_ids
401             p_fucntions_order
402  Ouput :- New launchpad is created
403  Creator :- ashankar
404 /******************************************************************************/
405 
406 PROCEDURE Create_Launch_Pad
407 (
408    p_commit                     IN              VARCHAR2 := FND_API.G_FALSE
409   ,p_menu_name              IN      VARCHAR2 := NULL
410   ,p_user_menu_name             IN      VARCHAR2
411   ,p_menu_type              IN      VARCHAR2 :='UNKNOWN'
412   ,p_description            IN      VARCHAR2
413   ,p_fucntion_ids                   IN              VARCHAR2
414   ,p_fucntions_order                IN              VARCHAR2 := NULL
415   ,x_return_status              OUT    NOCOPY   VARCHAR2
416   ,x_msg_count                  OUT    NOCOPY   NUMBER
417   ,x_msg_data                   OUT    NOCOPY   VARCHAR2
418 ) IS
419 
420  l_check_val          VARCHAR2(2);
421  l_user_id            FND_MENUS.LAST_UPDATED_BY%TYPE := NULL;
422  l_count              NUMBER :=0;
423  l_fucntion_ids       VARCHAR2(32000);
424  l_fucntion_id        VARCHAR2(10);
425  l_menu_id            FND_MENUS.menu_id%TYPE;
426  l_sequence           NUMBER;
427  l_menu_name          FND_MENUS.menu_name%TYPE;
428 
429 BEGIN
430 
431     SAVEPOINT CreateLaunchPad;
432     FND_MSG_PUB.Initialize;
433     x_return_status := FND_API.G_RET_STS_SUCCESS;
434 
435     IF(p_user_menu_name IS NULL) THEN
436         FND_MESSAGE.SET_NAME('BSC','BSC_REQ_FIELD_MISSING');
437         FND_MESSAGE.SET_TOKEN('FIELD_NAME', BSC_APPS.Get_Lookup_Value('BSC_UI_COMMON', 'NAME'), TRUE);
438         FND_MSG_PUB.ADD;
439         RAISE FND_API.G_EXC_ERROR;
440     END IF;
441 
442     SELECT FND_MENUS_S.NEXTVAL
443     INTO   l_menu_id
444     FROM   DUAL;
445 
446     l_menu_name := p_menu_name;
447 
448     IF (l_menu_name IS NULL) THEN
449       l_menu_name := get_Menu_Name(l_menu_id);
450     END IF;
451 
452     l_check_val := validate_Menu_UserMenu_Names
453                     (
454                     p_menu_id       =>  l_menu_id
455                    ,p_menu_name     =>  l_menu_name
456                    ,p_user_menu_name    =>  UPPER(p_user_menu_name)
457                     );
458 
459     IF (l_check_val<>'T') THEN
460 
461         FND_MESSAGE.SET_NAME('BSC','BSC_D_NAME_EXIST');
462         FND_MSG_PUB.ADD;
463         RAISE FND_API.G_EXC_ERROR;
464 
465     ELSE
466 
467         BSC_LAUNCH_PAD_PVT.INSERT_APP_MENU_VB
468          (
469               X_MENU_ID        => l_menu_id
470              ,X_MENU_NAME      => l_menu_name
471              ,X_USER_MENU_NAME => p_user_menu_name
472              ,X_MENU_TYPE      => p_menu_type
473              ,X_DESCRIPTION    => p_description
474              ,X_USER_ID        => get_User_Id
475          );
476 
477       /*************************************************************************
478        Now add the newly created launchpad to the root menus attached to the scorecard
479       /*************************************************************************/
480 
481         Add_Launch_Pad_Root_Menu
482         (
483             p_Launchpad_Id  => l_menu_id
484           , p_Description   => p_description
485           , x_return_status => x_return_status
486           , x_msg_count     => x_msg_count
487           , x_msg_data      => x_msg_data
488         );
489         IF (x_return_status  <> FND_API.G_RET_STS_SUCCESS) THEN
490           --DBMS_OUTPUT.PUT_LINE('BSC_LAUNCH_PAD_PUB.Create_Launch_Pad Failed: at BSC_LAUNCH_PAD_PUB.Add_Launch_Pad_Root_Menu <'||x_msg_data||'>');
491           RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
492         END IF;
493 
494       /*************************************************************************
495        Create the association between the menus and the fucntions
496       /*************************************************************************/
497 
498         IF (p_fucntion_ids IS NOT NULL) THEN
499            l_fucntion_ids := p_fucntion_ids;
500            WHILE (Is_More(  p_fucntion_ids   =>  l_fucntion_ids
501                            ,p_fucntion_id    =>  l_fucntion_id)
502                  )LOOP
503 
504                  l_sequence :=   (l_count + 1)*SEQ_MULTIPLIER;
505 
506                  Create_MenuFunction_Link
507                  (
508                       p_menu_id         => l_menu_id
509                     , p_entry_sequence  => l_sequence
510                     , p_function_id     => l_fucntion_id
511                     , p_description     => p_description
512                     , x_return_status   => x_return_status
513                     , x_msg_count       => x_msg_count
514                     , x_msg_data        => x_msg_data
515                  );
516                IF (x_return_status  <> FND_API.G_RET_STS_SUCCESS) THEN
517          --DBMS_OUTPUT.PUT_LINE('BSC_LAUNCH_PAD_PUB.Create_MenuFunction_Link Failed: at BSC_LAUNCH_PAD_PUB.Create_Launch_Pad <'||x_msg_data||'>');
518          RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
519            END IF;
520            l_count  := l_count + 1;
521           END LOOP;
522     END IF;
523    END IF;
524 
525 EXCEPTION
526     WHEN FND_API.G_EXC_ERROR THEN
527         ROLLBACK TO CreateLaunchPad;
528         IF (x_msg_data IS NULL) THEN
529         FND_MSG_PUB.Count_And_Get
530         (      p_encoded   =>  FND_API.G_FALSE
531             ,  p_count     =>  x_msg_count
532             ,  p_data      =>  x_msg_data
533         );
534     END IF;
535     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
536     x_return_status :=  FND_API.G_RET_STS_ERROR;
537 
538     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
539         ROLLBACK TO CreateLaunchPad;
540         IF (x_msg_data IS NULL) THEN
541             FND_MSG_PUB.Count_And_Get
542             (      p_encoded   =>  FND_API.G_FALSE
543                 ,  p_count     =>  x_msg_count
544                 ,  p_data      =>  x_msg_data
545             );
546         END IF;
547     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
548     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_UNEXPECTED_ERROR '||x_msg_data);
549 
550     WHEN NO_DATA_FOUND THEN
551         ROLLBACK TO CreateLaunchPad;
552         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
553         IF (x_msg_data IS NOT NULL) THEN
554             x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Create_Launch_Pad ';
555         ELSE
556             x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Create_Launch_Pad ';
557         END IF;
558     --DBMS_OUTPUT.PUT_LINE('EXCEPTION NO_DATA_FOUND '||x_msg_data);
559 
560     WHEN OTHERS THEN
561         ROLLBACK TO CreateLaunchPad;
562         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
563         IF (x_msg_data IS NOT NULL) THEN
564             x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Create_Launch_Pad ';
565         ELSE
566             x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Create_Launch_Pad ';
567         END IF;
568     --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
569 
570 END Create_Launch_Pad;
571 
572 
573 /*****************************************************************************
574  Name :- Retrieve_Launch_Pad
575  Description :- This procedure will retrieve the metadata corresponding to the
576                 launchPad.This procedure should be called from update launchpad
577  Input Parameters :- p_Menu_Id
578                      x_launch_pad_Rec
579  Out Parameters   :- x_launch_pad_Rec
580  Creatore         :- ashankar
581 /******************************************************************************/
582 
583 PROCEDURE Retrieve_Launch_Pad
584 (
585      p_menu_id                  IN              NUMBER
586     ,x_launch_pad_Rec           IN OUT NOCOPY   BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Rec_Type
587     ,x_return_status            OUT    NOCOPY   VARCHAR2
588     ,x_msg_count                OUT    NOCOPY   NUMBER
589     ,x_msg_data                 OUT    NOCOPY   VARCHAR2
590 
591 ) IS
592 BEGIN
593      FND_MSG_PUB.Initialize;
594      x_return_status := FND_API.G_RET_STS_SUCCESS;
595 
596      SELECT  menu_id
597             ,menu_name
598             ,type
599             ,last_update_date
600             ,last_updated_by
601             ,last_update_login
602             ,user_menu_name
603             ,description
604      INTO    x_launch_pad_Rec.Bsc_menu_id
605             ,x_launch_pad_Rec.Bsc_menu_name
606             ,x_launch_pad_Rec.Bsc_type
607             ,x_launch_pad_Rec.Bsc_last_update_date
608             ,x_launch_pad_Rec.Bsc_last_updated_by
609             ,x_launch_pad_Rec.Bsc_last_update_login
610             ,x_launch_pad_Rec.Bsc_user_menu_name
611             ,x_launch_pad_Rec.Bsc_description
612       FROM  FND_MENUS_VL
613       WHERE menu_id = p_menu_id;
614 
615 EXCEPTION
616     WHEN NO_DATA_FOUND THEN
617         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
618         IF (x_msg_data IS NOT NULL) THEN
619             x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Retrieve_Launch_Pad ';
620         ELSE
621            x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Retrieve_Launch_Pad ';
622         END IF;
623         RAISE;
624     WHEN OTHERS THEN
625        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
626        IF (x_msg_data IS NOT NULL) THEN
627            x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Retrieve_Tab_View ';
628        ELSE
629            x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Retrieve_Tab_View ';
630        END IF;
631        RAISE;
632 END Retrieve_Launch_Pad;
633 
634 /*****************************************************************************
635  Name :- Update_Launch_Pad
636  Description :- This procedure will update the menu entries in the database.
637                 It will get the previous values from the database and check
638                 it with the new values. if the new values are being passed
639                 then they will be updated.. otherwise the old values will be
640                 retained.
641  Input Parameters:- p_launch_pad_rec --> which holds the metadata of the menu.
642  Output Parameters :- x_return_status
643  creator :-ashankar
644 /******************************************************************************/
645 
646 PROCEDURE Update_Launch_Pad
647 (
648    p_launch_pad_rec             IN              BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Rec_Type
649   ,x_return_status              OUT    NOCOPY   VARCHAR2
650   ,x_msg_count                  OUT    NOCOPY   NUMBER
651   ,x_msg_data                   OUT    NOCOPY   VARCHAR2
652 ) IS
653 
654     l_launch_pad_rec            BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Rec_Type;
655     l_count                     NUMBER;
656 
657 BEGIN
658     SAVEPOINT UpdateLaunchPad;
659     FND_MSG_PUB.Initialize;
660     x_return_status := FND_API.G_RET_STS_SUCCESS;
661 
662     IF(p_launch_pad_rec.Bsc_menu_id IS NOT NULL) THEN
663 
664          -- Bug #3236356
665          l_count := is_Menu_Id_Valid(p_launch_pad_rec.Bsc_menu_id);
666 
667          IF(l_count =0) THEN
668               FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
669               FND_MESSAGE.SET_TOKEN('BSC_MENU', p_launch_pad_rec.Bsc_menu_id);
670               FND_MSG_PUB.ADD;
671               RAISE FND_API.G_EXC_ERROR;
672          END IF;
673 
674     ELSE
675               FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
676               FND_MESSAGE.SET_TOKEN('BSC_MENU', p_launch_pad_rec.Bsc_menu_id);
677               FND_MSG_PUB.ADD;
678               RAISE FND_API.G_EXC_ERROR;
679     END IF;
680 
681     Retrieve_Launch_Pad
682     (
683          p_menu_id          =>      p_launch_pad_rec.Bsc_menu_id
684         ,x_launch_pad_Rec   =>      l_launch_pad_rec
685         ,x_return_status    =>      x_return_status
686         ,x_msg_count        =>      x_msg_count
687         ,x_msg_data         =>      x_msg_data
688     );
689 
690     IF(p_launch_pad_rec.Bsc_menu_name IS NOT NULL) THEN
691         l_launch_pad_rec.Bsc_menu_name := p_launch_pad_rec.Bsc_menu_name;
692     END IF;
693 
694     IF(p_launch_pad_rec.Bsc_user_menu_name IS NOT NULL) THEN
695         l_launch_pad_rec.Bsc_user_menu_name := p_launch_pad_rec.Bsc_user_menu_name;
696     END IF;
697 
698     IF(p_launch_pad_rec.Bsc_description IS NOT NULL) THEN
699         l_launch_pad_rec.Bsc_description := p_launch_pad_rec.Bsc_description;
700     END IF;
701     IF(p_launch_pad_rec.Bsc_last_update_login IS NOT NULL) THEN
702         l_launch_pad_rec.Bsc_last_update_login := p_launch_pad_rec.Bsc_last_update_login;
703     END IF;
704 
705     IF(p_launch_pad_rec.Bsc_type IS NOT NULL) THEN
706         l_launch_pad_rec.Bsc_type := p_launch_pad_rec.Bsc_type;
707     END IF;
708 
709     FND_MENUS_PKG.UPDATE_ROW
710     (
711          X_MENU_ID              => l_launch_pad_rec.Bsc_menu_id
712         ,X_MENU_NAME            => l_launch_pad_rec.Bsc_menu_name
713         ,X_USER_MENU_NAME       => l_launch_pad_rec.Bsc_user_menu_name
714         ,X_MENU_TYPE            => l_launch_pad_rec.Bsc_type
715         ,X_DESCRIPTION          => l_launch_pad_rec.Bsc_description
716         ,X_LAST_UPDATE_DATE     => SYSDATE
717         ,X_LAST_UPDATED_BY      => get_User_Id
718         ,X_LAST_UPDATE_LOGIN    => 0
719      );
720 
721 EXCEPTION
722     WHEN FND_API.G_EXC_ERROR THEN
723         ROLLBACK TO UpdateLaunchPad;
724         IF (x_msg_data IS NULL) THEN
725             FND_MSG_PUB.Count_And_Get
726             (      p_encoded   =>  FND_API.G_FALSE
727                 ,  p_count     =>  x_msg_count
728                 ,  p_data      =>  x_msg_data
729             );
730         END IF;
731         --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
732         x_return_status :=  FND_API.G_RET_STS_ERROR;
733 
734     WHEN NO_DATA_FOUND THEN
735         ROLLBACK TO UpdateLaunchPad;
736         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
737         IF (x_msg_data IS NOT NULL) THEN
738             x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
739         ELSE
740             x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
741         END IF;
742         --DBMS_OUTPUT.PUT_LINE('EXCEPTION NO_DATA_FOUND '||x_msg_data);
743 
744     WHEN OTHERS THEN
745         ROLLBACK TO UpdateLaunchPad;
746         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
747         IF (x_msg_data IS NOT NULL) THEN
748             x_msg_data      :=  x_msg_data||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
749         ELSE
750             x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
751         END IF;
752         --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
753 END Update_Launch_Pad;
754 
755 
756 
757 /*****************************************************************************
758  Name   :- Update_Launch_Pad
759  Description    :- This procedure will update the launchpad metadata.
760                    It will validate if the menu name and the user menu name being
761                    passed are unique or not.
762                    It will remove all the associations of menus and fucntions and
763                    recreate if any functions are there.
764  Validations :-
765               1. Check if the user_menu_name being passed is null or not.
766                  if yes then throw the exception.
767               2. Check for the validity of the menu id
768               3. Check if the menu name is null then retrieve the menu name
769               4. Validate menu name and user menu name for uniqueness
770               5. First update the menu metadata.
771               6. remove the menu and function assocation
772               7. Recreate the associations if the fucnction ids are not null.
773 
774  Created by   :- ashankar 29-OCT-2003
775 /******************************************************************************/
776 PROCEDURE Update_Launch_Pad
777 (
778    p_commit                     IN              VARCHAR2   := FND_API.G_FALSE
779   ,p_menu_id                    IN              NUMBER
780   ,p_menu_name                  IN              VARCHAR2   := NULL
781   ,p_user_menu_name             IN              VARCHAR2
782   ,p_menu_type                  IN              VARCHAR2
783   ,p_description                IN              VARCHAR2
784   ,p_fucntion_ids               IN              VARCHAR2
785   ,p_fucntions_order            IN              VARCHAR2    := NULL
786   ,x_return_status              OUT    NOCOPY   VARCHAR2
787   ,x_msg_count                  OUT    NOCOPY   NUMBER
788   ,x_msg_data                   OUT    NOCOPY   VARCHAR2
789 ) IS
790    l_check_val          VARCHAR2(2);
791    l_launch_pad_rec     BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Rec_Type;
792    l_fucntion_ids       VARCHAR2(32000);
793    l_fucntion_id        VARCHAR2(10);
794    l_sequence           NUMBER;
795    l_menu_name          FND_MENUS.menu_name%TYPE;
796    l_count              NUMBER :=0;
797 
798 BEGIN
799     FND_MSG_PUB.Initialize;
800     x_return_status := FND_API.G_RET_STS_SUCCESS;
801 
802     l_menu_name := p_menu_name;
803 
804     IF(p_user_menu_name IS NULL) THEN
805         FND_MESSAGE.SET_NAME('BSC','BSC_REQ_FIELD_MISSING');
806         FND_MESSAGE.SET_TOKEN('FIELD_NAME', BSC_APPS.Get_Lookup_Value('BSC_UI_COMMON', 'NAME'), TRUE);
807         FND_MSG_PUB.ADD;
808         RAISE FND_API.G_EXC_ERROR;
809     END IF;
810 
811     IF(p_menu_id IS NOT NULL) THEN
812         -- Bug #3236356
813         l_count := is_Menu_Id_Valid(p_menu_id);
814          IF(l_count =0) THEN
815               FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
816               FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
817               FND_MSG_PUB.ADD;
818               RAISE FND_API.G_EXC_ERROR;
819          END IF;
820 
821     ELSE
822               FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
823               FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
824               FND_MSG_PUB.ADD;
825               RAISE FND_API.G_EXC_ERROR;
826     END IF;
827 
828 
829     IF(l_menu_name IS NULL) THEN
830       l_menu_name := get_Menu_Name_From_Menu_Id(p_Menu_Id => p_menu_id);
831     END IF;
832 
833     l_check_val := validate_Menu_UserMenu_Names
834                    (   p_menu_id        =>  p_menu_id
835                       ,p_menu_name      =>  l_menu_name
836                       ,p_user_menu_name =>  UPPER(p_user_menu_name)
837                    );
838 
839     IF (l_check_val<>'T') THEN
840         FND_MESSAGE.SET_NAME('BSC','BSC_D_NAME_EXIST');
841         FND_MSG_PUB.ADD;
842         RAISE FND_API.G_EXC_ERROR;
843     ELSE
844          l_launch_pad_rec.Bsc_menu_id := p_menu_id;
845          l_launch_pad_rec.Bsc_menu_name := l_menu_name;
846          l_launch_pad_rec.Bsc_user_menu_name := p_user_menu_name;
847          l_launch_pad_rec.Bsc_description := p_description;
848 
849          BSC_LAUNCH_PAD_PUB.Update_Launch_Pad
850          (
851            p_launch_pad_rec     =>  l_launch_pad_rec
852           ,x_return_status      =>  x_return_status
853           ,x_msg_count          =>  x_msg_count
854           ,x_msg_data           =>  x_msg_data
855          );
856        /****************************************************
857          The logic here is to delete all the previous associations
858          of the menus and fucntions and create the new asociations
859          if there are any new fucntions
860         1.Delete all the menu and fucntion asspciations
861         2.Recreate the menu and the fucntion associations.
862        /****************************************************/
863 
864          Delete_MenuFunction_Link
865           (
866              p_menu_id          => p_menu_id
867             ,x_return_status    => x_return_status
868             ,x_msg_count        => x_msg_count
869             ,x_msg_data         => x_msg_data
870           );
871 
872         /*****************************************************
873          Check if the menu is having the fucntions attached
874          to it. if yes then create the association between them.
875         /*****************************************************/
876          l_count :=0;
877          IF (p_fucntion_ids IS NOT NULL) THEN
878              l_fucntion_ids := p_fucntion_ids;
879 
880              WHILE (Is_More(  p_fucntion_ids   =>  l_fucntion_ids
881                              ,p_fucntion_id    =>  l_fucntion_id)
882                    )LOOP
883                     l_sequence :=   (l_count    + 1)*SEQ_MULTIPLIER;
884 
885                     Create_MenuFunction_Link
886                     (
887                           p_menu_id         => p_menu_id
888                         , p_entry_sequence  => l_sequence
889                         , p_function_id     => l_fucntion_id
890                         , p_description     => p_description
891                         , x_return_status   => x_return_status
892                         , x_msg_count       => x_msg_count
893                         , x_msg_data        => x_msg_data
894                      );
895                      IF (x_return_status  <> FND_API.G_RET_STS_SUCCESS) THEN
896                         --DBMS_OUTPUT.PUT_LINE('BSC_LAUNCH_PAD_PUB.Create_MenuFunction_Link Failed: at BSC_LAUNCH_PAD_PUB.Create_Launch_Pad <'||x_msg_data||'>');
897                         RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
898                      END IF;
899                      l_count                := l_count + 1;
900                  END LOOP;
901          END IF;
902     END IF;
903 EXCEPTION
904     WHEN FND_API.G_EXC_ERROR THEN
905 
906         IF (x_msg_data IS NULL) THEN
907         FND_MSG_PUB.Count_And_Get
908         (      p_encoded   =>  FND_API.G_FALSE
909             ,  p_count     =>  x_msg_count
910             ,  p_data      =>  x_msg_data
911         );
912     END IF;
913     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
914     x_return_status :=  FND_API.G_RET_STS_ERROR;
915 
916     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
917 
918         IF (x_msg_data IS NULL) THEN
919             FND_MSG_PUB.Count_And_Get
920             (      p_encoded   =>  FND_API.G_FALSE
921                 ,  p_count     =>  x_msg_count
922                 ,  p_data      =>  x_msg_data
923             );
924         END IF;
925     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
926     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_UNEXPECTED_ERROR '||x_msg_data);
927 
928     WHEN NO_DATA_FOUND THEN
929 
930         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
931         IF (x_msg_data IS NOT NULL) THEN
932             x_msg_data      :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
933         ELSE
934             x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
935         END IF;
936         --DBMS_OUTPUT.PUT_LINE('EXCEPTION NO_DATA_FOUND '||x_msg_data);
937 
938     WHEN OTHERS THEN
939         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
940 
941         IF (x_msg_data IS NOT NULL) THEN
942             x_msg_data      :=  x_msg_data||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
943         ELSE
944             x_msg_data      :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad ';
945         END IF;
946 
947         --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
948 
949 END Update_Launch_Pad;
950 
951 /**************************************************************************************
952  Name :- Delete_Root_Menu_LaunchPad
953  Description :- This procedure will delete the entry of the launchpads from the rootmenus
954                 when the launchpad is deleted.
955  Input :- p_Launch_pad_Id
956  Creator :- ashankar 12-DEC-03
957 /**************************************************************************************/
958 
959 PROCEDURE Delete_Root_Menu_LaunchPad
960 (
961       p_Launch_Pad_Id                     FND_MENUS.menu_id%TYPE
962     , x_return_status     OUT    NOCOPY   VARCHAR2
963     , x_msg_count         OUT    NOCOPY   NUMBER
964     , x_msg_data          OUT    NOCOPY   VARCHAR2
965 )IS
966   l_Root_Menu_Tbl         BSC_LAUNCH_PAD_PUB.Bsc_LauchPad_Tbl_Type;
967   l_root_menu_count       NUMBER;
968   l_entry_sequence        FND_MENU_ENTRIES.Entry_Sequence%TYPE;
969 
970 BEGIN
971      SAVEPOINT DeleteRootMenuLaunchPad;
972      FND_MSG_PUB.Initialize;
973      x_return_status := FND_API.G_RET_STS_SUCCESS;
974 
975      get_All_Root_Menu(x_Root_Menu_Tbl  => l_Root_Menu_Tbl);
976      l_root_menu_count :=0;
977 
978      WHILE((l_root_menu_count)<=(l_Root_Menu_Tbl.COUNT - 1)) LOOP
979         IF(BSC_LAUNCH_PAD_PVT.is_Launch_Pad_Attached(p_Menu_Id=>l_Root_Menu_Tbl(l_root_menu_count).Bsc_menu_id,p_Sub_Menu_Id =>p_Launch_pad_Id))THEN
980           l_entry_sequence := BSC_LAUNCH_PAD_PVT.get_entry_sequence(p_Menu_Id=>l_Root_Menu_Tbl(l_root_menu_count).Bsc_menu_id,p_Sub_Menu_Id =>p_Launch_pad_Id);
981 
982           BSC_LAUNCH_PAD_PVT.DELETE_APP_MENU_ENTRIES_VB
983           (
984                 X_Menu_Id        => l_Root_Menu_Tbl(l_root_menu_count).Bsc_menu_id
985               , X_Entry_Sequence => l_entry_sequence
986           );
987         END IF;
988         l_root_menu_count := l_root_menu_count + 1;
989      END LOOP;
990 EXCEPTION
991 
992 WHEN FND_API.G_EXC_ERROR THEN
993     ROLLBACK TO DeleteRootMenuLaunchPad;
994     IF (x_msg_data IS NULL) THEN
995         FND_MSG_PUB.Count_And_Get
996         (      p_encoded   =>  FND_API.G_FALSE
997             ,  p_count     =>  x_msg_count
998             ,  p_data      =>  x_msg_data
999         );
1000     END IF;
1001     x_return_status :=  FND_API.G_RET_STS_ERROR;
1002 
1003 WHEN OTHERS THEN
1004     ROLLBACK TO DeleteRootMenuLaunchPad;
1005     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1006     IF (x_msg_data IS NOT NULL) THEN
1007         x_msg_data      :=  x_msg_data||' -> BSC_CUSTOM_VIEW_PUB.Delete_Root_Menu_LaunchPad ';
1008     ELSE
1009         x_msg_data      :=  SQLERRM||' at BSC_CUSTOM_VIEW_PUB.Delete_Root_Menu_LaunchPad ';
1010     END IF;
1011 
1012 END Delete_Root_Menu_LaunchPad;
1013 
1014 
1015 /*===========================================================================+
1016 |
1017 |   Name:          Delte_Launch_Pad
1018 |
1019 |   Description:   It is a wrapper for FND_MENUS_PKG.DELETE_ROW function.
1020 |                  This procedure is to be called from a JAVA Layer
1021 |
1022 |   Parameters:    x_menu_id - Menu id of the Launch Pad
1023 |   Validations : need to check if the menu id being passed is the valid one or not.
1024 |                 if not then throw the exception that the menu id is invalid /no menu exists
1025 |                 by this id.if it is valid then only delete the menu. otherwise not.
1026 |
1027 |   Notes:
1028 |
1029 +============================================================================*/
1030 
1031 PROCEDURE Delete_Launch_Pad
1032 (
1033      p_menu_id              IN              NUMBER
1034     ,x_return_status        OUT    NOCOPY   VARCHAR2
1035     ,x_msg_count            OUT    NOCOPY   NUMBER
1036     ,x_msg_data             OUT    NOCOPY   VARCHAR2
1037 ) IS
1038     l_count       NUMBER;
1039 BEGIN
1040   SAVEPOINT DelteLaunchPad;
1041   FND_MSG_PUB.Initialize;
1042   x_return_status := FND_API.G_RET_STS_SUCCESS;
1043 
1044   IF(p_menu_id IS NOT NULL) THEN
1045 
1046        -- Bug #3236356
1047        l_count := is_Menu_Id_Valid(p_menu_id);
1048 
1049        IF(l_count =0) THEN
1050           FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1051           FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
1052           FND_MSG_PUB.ADD;
1053           RAISE FND_API.G_EXC_ERROR;
1054        END IF;
1055 
1056   ELSE
1057 
1058           FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1059           FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
1060           FND_MSG_PUB.ADD;
1061           RAISE FND_API.G_EXC_ERROR;
1062 
1063   END IF;
1064 
1065   FND_MENUS_PKG.DELETE_ROW
1066   (
1067     X_MENU_ID  => p_menu_id
1068   );
1069 
1070   Delete_Root_Menu_LaunchPad
1071   (
1072       p_Launch_Pad_Id   => p_menu_id
1073     , x_return_status   => x_return_status
1074     , x_msg_count       => x_msg_count
1075     , x_msg_data        => x_msg_data
1076   );
1077 
1078 
1079   Delete_MenuFunction_Link
1080   (
1081      p_menu_id          => p_menu_id
1082     ,x_return_status    => x_return_status
1083     ,x_msg_count        => x_msg_count
1084     ,x_msg_data         => x_msg_data
1085   );
1086 
1087   Delete_LaunchPad_Links
1088   (
1089         p_menu_id          => p_menu_id
1090     ,   x_return_status    => x_return_status
1091     ,   x_msg_count        => x_msg_count
1092     ,   x_msg_data         => x_msg_data
1093 
1094   );
1095 
1096 
1097 
1098 EXCEPTION
1099 WHEN FND_API.G_EXC_ERROR THEN
1100 
1101         ROLLBACK TO DelteLaunchPad;
1102         IF (x_msg_data IS NULL) THEN
1103             FND_MSG_PUB.Count_And_Get
1104             (      p_encoded   =>  FND_API.G_FALSE
1105                ,   p_count     =>  x_msg_count
1106                ,   p_data      =>  x_msg_data
1107             );
1108         END IF;
1109         --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1110         x_return_status :=  FND_API.G_RET_STS_ERROR;
1111 
1112 WHEN OTHERS THEN
1113 
1114       ROLLBACK TO DelteLaunchPad;
1115       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1116 
1117       IF (x_msg_data IS NOT NULL) THEN
1118         x_msg_data :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Delte_Launch_Pad ';
1119       ELSE
1120         x_msg_data :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Delte_Launch_Pad ';
1121       END IF;
1122 
1123       --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1124 
1125 END Delete_Launch_Pad;
1126 
1127 
1128 /************************************************************************************
1129  Description :- This procedure will remove the Launchpad entry from BSC_TAB_VIEW_LABELS_TL
1130                 and BSC_TAB_VIEW_LABELS_B.This should be called from within the delete_launchpad
1131  Input Parameters :- 1.p_Menu_Id    menu_id
1132 
1133  output           :- return status
1134  Created BY       :- ashankar
1135 /************************************************************************************/
1136 
1137 PROCEDURE Delete_LaunchPad_Links
1138 (
1139      p_menu_id              IN          NUMBER
1140     ,x_return_status        OUT NOCOPY  VARCHAR2
1141     ,x_msg_count            OUT NOCOPY  NUMBER
1142     ,x_msg_data             OUT NOCOPY  VARCHAR2
1143 )IS
1144  l_Count        NUMBER;
1145  l_label_id     BSC_TAB_VIEW_LABELS_VL.label_id%TYPE;
1146 
1147  CURSOR c_Launch_Pad_Links IS
1148  SELECT Tab_id,Tab_view_id,Label_id
1149  FROM   BSC_TAB_VIEW_LABELS_VL
1150  WHERE  LINK_ID = p_menu_id
1151  AND    LABEL_TYPE =2;
1152 
1153 BEGIN
1154     SAVEPOINT  deletelaunchpadlinks;
1155     FND_MSG_PUB.Initialize;
1156     x_return_status := FND_API.G_RET_STS_SUCCESS;
1157 
1158     IF(p_menu_id IS NULL) THEN
1159         FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1160         FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
1161         FND_MSG_PUB.ADD;
1162         RAISE FND_API.G_EXC_ERROR;
1163     END IF;
1164 
1165     FOR cd IN c_Launch_Pad_Links LOOP
1166         DELETE FROM BSC_TAB_VIEW_LABELS_TL
1167         WHERE  Tab_Id      = cd.Tab_Id
1168         AND    Tab_view_id = cd.Tab_view_id
1169         AND    Label_id    = cd.Label_id;
1170 
1171         DELETE FROM BSC_TAB_VIEW_LABELS_B
1172         WHERE  Tab_Id      = cd.Tab_Id
1173         AND    Tab_view_id = cd.Tab_view_id
1174         AND    Label_id    = cd.Label_id;
1175     END LOOP;
1176 
1177 
1178 EXCEPTION
1179   WHEN FND_API.G_EXC_ERROR THEN
1180 
1181    IF(c_Launch_Pad_Links%ISOPEN) THEN
1182       CLOSE c_Launch_Pad_Links;
1183    END IF;
1184 
1185    ROLLBACK TO deletelaunchpadlinks;
1186    IF (x_msg_data IS NULL) THEN
1187        FND_MSG_PUB.Count_And_Get
1188        (            p_encoded    =>  FND_API.G_FALSE
1189                  ,   p_count     =>  x_msg_count
1190                  ,   p_data      =>  x_msg_data
1191        );
1192    END IF;
1193    --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1194    x_return_status :=  FND_API.G_RET_STS_ERROR;
1195 
1196   WHEN OTHERS THEN
1197 
1198     IF(c_Launch_Pad_Links%ISOPEN) THEN
1199           CLOSE c_Launch_Pad_Links;
1200     END IF;
1201 
1202     ROLLBACK TO deletelaunchpadlinks;
1203     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1204 
1205     IF (x_msg_data IS NOT NULL) THEN
1206       x_msg_data :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Delete_LaunchPad_Links ';
1207     ELSE
1208       x_msg_data :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Delete_LaunchPad_Links ';
1209     END IF;
1210 
1211   --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1212 END Delete_LaunchPad_Links;
1213 
1214 
1215 /************************************************************************************
1216                         FORM FUNCTION ROUTINES (FOR LINKS)
1217 *************************************************************************************/
1218 
1219 /************************************************************************************
1220  Description :- This procedure will remove the menu and fucntion association.
1221                 This procedure should be called while upadting the lauchpads.
1222  Input Parameters :- 1.p_Menu_Id    menu_id
1223                      2.p_entry_sequence   order of fucntions/submenu within the menu
1224  output           :- return status
1225  Created BY       :- ashankar
1226 /************************************************************************************/
1227 
1228 PROCEDURE Delete_MenuFunction_Link
1229 (
1230      p_menu_id              IN          NUMBER
1231     ,x_return_status        OUT NOCOPY  VARCHAR2
1232     ,x_msg_count            OUT NOCOPY  NUMBER
1233     ,x_msg_data             OUT NOCOPY  VARCHAR2
1234 )IS
1235 
1236     CURSOR c_menu_entries IS
1237     SELECT entry_sequence
1238     FROM   FND_MENU_ENTRIES
1239     WHERE  menu_id = p_menu_id;
1240 BEGIN
1241       SAVEPOINT  deletemenufunctionlink;
1242       FND_MSG_PUB.Initialize;
1243       x_return_status := FND_API.G_RET_STS_SUCCESS;
1244 
1245       IF(p_menu_id IS NULL) THEN
1246         FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1247         FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
1248         FND_MSG_PUB.ADD;
1249         RAISE FND_API.G_EXC_ERROR;
1250       END IF;
1251 
1252 
1253       IF(c_menu_entries%ISOPEN) THEN
1254             CLOSE c_menu_entries;
1255       END IF;
1256 
1257       FOR cd IN c_menu_entries LOOP
1258 
1259         FND_MENU_ENTRIES_PKG.DELETE_ROW
1260          (
1261             X_MENU_ID           => p_menu_id
1262            ,X_ENTRY_SEQUENCE    => cd.entry_sequence
1263          );
1264       END LOOP;
1265 
1266 EXCEPTION
1267   WHEN FND_API.G_EXC_ERROR THEN
1268 
1269    IF(c_menu_entries%ISOPEN) THEN
1270       CLOSE c_menu_entries;
1271    END IF;
1272 
1273    ROLLBACK TO deletemenufunctionlink;
1274    IF (x_msg_data IS NULL) THEN
1275        FND_MSG_PUB.Count_And_Get
1276        (            p_encoded    =>  FND_API.G_FALSE
1277                  ,   p_count     =>  x_msg_count
1278                  ,   p_data      =>  x_msg_data
1279        );
1280    END IF;
1281    --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1282    x_return_status :=  FND_API.G_RET_STS_ERROR;
1283 
1284   WHEN OTHERS THEN
1285 
1286     IF(c_menu_entries%ISOPEN) THEN
1287           CLOSE c_menu_entries;
1288     END IF;
1289 
1290     ROLLBACK TO deletemenufunctionlink;
1291     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1292 
1293     IF (x_msg_data IS NOT NULL) THEN
1294       x_msg_data :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Delete_MenuFunction_Link ';
1295     ELSE
1296       x_msg_data :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Delete_MenuFunction_Link ';
1297     END IF;
1298 
1299   --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1300 END Delete_MenuFunction_Link;
1301 
1302 /************************************************************************************
1303  Create_MenuFunction_Link
1304  Description :- This procedure will create the menu and the fucntion association
1305  Input Parameters :- 1.p_Menu_Id
1306                      2.p_entry_sequence
1307                      3.p_function_id
1308                      4.p_description
1309  output           :- return status
1310  Created BY       :- ashankar
1311 /************************************************************************************/
1312 
1313 PROCEDURE Create_MenuFunction_Link
1314 (
1315       p_menu_id                  IN          NUMBER
1316     , p_entry_sequence           IN          NUMBER
1317     , p_function_id              IN          NUMBER
1318     , p_description              IN          VARCHAR2
1319     , x_return_status           OUT NOCOPY   VARCHAR2
1320     , x_msg_count               OUT NOCOPY   NUMBER
1321     , x_msg_data                OUT NOCOPY   VARCHAR2
1322 
1323 ) IS
1324     row_id             VARCHAR2(30);
1325     l_user_id          NUMBER ;
1326 BEGIN
1327       FND_MSG_PUB.Initialize;
1328       x_return_status := FND_API.G_RET_STS_SUCCESS;
1329 
1330       IF(p_menu_id IS NULL) THEN
1331         FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1332         FND_MESSAGE.SET_TOKEN('BSC_MENU', p_menu_id);
1333         FND_MSG_PUB.ADD;
1334         RAISE FND_API.G_EXC_ERROR;
1335       END IF;
1336 
1337       IF (p_entry_sequence IS NULL) THEN
1338          FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_ENTRY_SEQUENCE');
1339          FND_MSG_PUB.ADD;
1340          RAISE FND_API.G_EXC_ERROR;
1341       END IF;
1342 
1343       l_user_id := get_User_Id;
1344 
1345       FND_MENU_ENTRIES_PKG.INSERT_ROW
1346       (      X_ROWID                =>  row_id
1347             ,X_MENU_ID              =>  p_menu_id
1348             ,X_ENTRY_SEQUENCE       =>  p_entry_sequence
1349             ,X_SUB_MENU_ID          =>  NULL
1350             ,X_FUNCTION_ID          =>  p_function_id
1351             ,X_GRANT_FLAG           =>  'Y'
1352             ,X_PROMPT               =>  NULL
1353             ,X_DESCRIPTION          =>  p_description
1354             ,X_CREATION_DATE        =>  SYSDATE
1355             ,X_CREATED_BY           =>  l_user_id
1356             ,X_LAST_UPDATE_DATE     =>  SYSDATE
1357             ,X_LAST_UPDATED_BY      =>  l_user_id
1358             ,X_LAST_UPDATE_LOGIN    =>  0
1359        );
1360 
1361 EXCEPTION
1362 WHEN FND_API.G_EXC_ERROR THEN
1363     IF (x_msg_data IS NULL) THEN
1364         FND_MSG_PUB.Count_And_Get
1365         (      p_encoded   =>  FND_API.G_FALSE
1366             ,  p_count     =>  x_msg_count
1367             ,  p_data      =>  x_msg_data
1368         );
1369     END IF;
1370 
1371     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1372     x_return_status :=  FND_API.G_RET_STS_ERROR;
1373 
1374 WHEN OTHERS THEN
1375 
1376     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1377 
1378     IF (x_msg_data IS NOT NULL) THEN
1379      x_msg_data :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Create_MenuFunction_Link ';
1380     ELSE
1381       x_msg_data :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Create_MenuFunction_Link ';
1382     END IF;
1383 
1384     --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1385 END Create_MenuFunction_Link;
1386 
1387 /*===========================================================================+
1388 |
1389 |   Name:          INSERT_FORM_FUNCTION_VB
1390 |
1391 |   Description:   This procedure creates  a new fucntion in FND_FORM_FUNCTIONS
1392 |                  metadata.It will also return the fucntion id of the newly created
1393 |                  function.The transaction is still not commited. It will be done from
1394 |                  the UI only.
1395 |   Input Parameters :-  p_user_function_name  --> cannot be null
1396 |                        p_url                 --> can be null
1397 |                        p_type                --> by default 'WWW'
1398 |
1399 |   Out Parameters:
1400 |                        p_function_id         --> needs to be generated
1401 +============================================================================*/
1402 
1403 PROCEDURE Create_Launch_Pad_Link
1404 (
1405    p_commit                 IN              VARCHAR2   := FND_API.G_FALSE
1406  , p_user_function_name     IN              VARCHAR2
1407  , p_url                    IN              VARCHAR2
1408  , p_type                   IN              VARCHAR2 :='WWW'
1409  , x_function_id            OUT    NOCOPY   FND_FORM_FUNCTIONS.function_id% TYPE
1410  , x_return_status          OUT    NOCOPY   VARCHAR2
1411  , x_msg_count              OUT    NOCOPY   NUMBER
1412  , x_msg_data               OUT    NOCOPY   VARCHAR2
1413 ) IS
1414 
1415 l_function_id       FND_FORM_FUNCTIONS.function_id% TYPE;
1416 l_function_name     FND_FORM_FUNCTIONS.function_name%TYPE;
1417 l_ret_val           VARCHAR2(2);
1418 l_user_id           NUMBER := NULL;
1419 row_id              VARCHAR2(30);
1420 l_url               FND_FORM_FUNCTIONS.web_host_name%TYPE;
1421 BEGIN
1422     FND_MSG_PUB.Initialize;
1423     x_return_status := FND_API.G_RET_STS_SUCCESS;
1424 
1425     IF (p_user_function_name IS NULL) THEN
1426         FND_MESSAGE.SET_NAME('BSC','BSC_REQ_FIELD_MISSING');
1427         FND_MESSAGE.SET_TOKEN('FIELD_NAME', BSC_APPS.Get_Lookup_Value('BSC_UI_COMMON', 'FUCNTION_NAME'), TRUE);
1428         FND_MSG_PUB.ADD;
1429         RAISE FND_API.G_EXC_ERROR;
1430     END IF;
1431 
1432 
1433     SELECT FND_FORM_FUNCTIONS_S.NEXTVAL
1434     INTO l_function_id
1435     FROM DUAL;
1436 
1437     l_function_name := 'BSC_LINKS_'||l_function_id;
1438     l_user_id       :=  get_User_Id;
1439 
1440 
1441     FND_FORM_FUNCTIONS_PKG.INSERT_ROW
1442         (
1443                X_ROWID                  => row_id,
1444                X_FUNCTION_ID            => l_function_id,
1445                X_WEB_HOST_NAME          => SUBSTR(p_url,1,79),
1446                X_WEB_AGENT_NAME         => NULL,
1447                X_WEB_HTML_CALL          => p_url,
1448                X_WEB_ENCRYPT_PARAMETERS => 'N',
1449                X_WEB_SECURED            => 'N',
1450                X_WEB_ICON               => NULL,
1451                X_OBJECT_ID              => NULL,
1452                X_REGION_APPLICATION_ID  => NULL,
1453                X_REGION_CODE            => NULL,
1454                X_FUNCTION_NAME          => l_function_name,
1455                X_APPLICATION_ID         => 271,
1456                X_FORM_ID                => NULL,
1457                X_PARAMETERS             => NULL,
1458                X_TYPE                   => p_type,
1459                X_USER_FUNCTION_NAME     => p_user_function_name,
1460                X_DESCRIPTION            => p_url,
1461                X_CREATION_DATE          => SYSDATE,
1462                X_CREATED_BY             => l_user_id,
1463                X_LAST_UPDATE_DATE       => SYSDATE,
1464                X_LAST_UPDATED_BY        => l_user_id,
1465                X_LAST_UPDATE_LOGIN      => 0
1466     );
1467 
1468       x_function_id := l_function_id;
1469 
1470       IF (p_commit = FND_API.G_TRUE) THEN
1471         commit;
1472       END IF;
1473 
1474 EXCEPTION
1475 
1476 WHEN FND_API.G_EXC_ERROR THEN
1477     IF (x_msg_data IS NULL) THEN
1478         FND_MSG_PUB.Count_And_Get
1479         (      p_encoded   =>  FND_API.G_FALSE
1480             ,  p_count     =>  x_msg_count
1481             ,  p_data      =>  x_msg_data
1482         );
1483     END IF;
1484 
1485     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1486     x_return_status :=  FND_API.G_RET_STS_ERROR;
1487 
1488 WHEN OTHERS THEN
1489 
1490   x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1491 
1492   IF (x_msg_data IS NOT NULL) THEN
1493     x_msg_data :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Create_Launch_Pad_Link ';
1494   ELSE
1495     x_msg_data :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Create_Launch_Pad_Link ';
1496   END IF;
1497 
1498   --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1499 
1500 END Create_Launch_Pad_Link;
1501 
1502 
1503 /******************************************************************************
1504  Description :- This procedure deletes the lauchpad link and its association with
1505                 the menus.First it deletes the lauchpad link and then removes the
1506                 association of the lauchpad links with all the menus using it.
1507  Input       :- Function_Id
1508 
1509  Creator :-ashankar
1510 /*******************************************************************************/
1511 
1512 
1513 PROCEDURE Delete_Launch_Pad_Link
1514 (
1515        p_fucntion_id            IN     FND_FORM_FUNCTIONS.function_id%TYPE
1516      , x_return_status          OUT    NOCOPY   VARCHAR2
1517      , x_msg_count              OUT    NOCOPY   NUMBER
1518      , x_msg_data               OUT    NOCOPY   VARCHAR2
1519 )IS
1520 
1521     CURSOR c_menu_functions IS
1522     SELECT MENU_ID,
1523            ENTRY_SEQUENCE
1524     FROM   FND_MENU_ENTRIES_VL
1525     WHERE  FUNCTION_ID = p_fucntion_id;
1526 
1527     l_menu_id               FND_MENU_ENTRIES_VL.menu_id%TYPE;
1528     l_entrysequence         FND_MENU_ENTRIES_VL.entry_sequence%TYPE;
1529     l_count                 NUMBER;
1530 
1531 BEGIN
1532     SAVEPOINT deletelauchpadlink;
1533     FND_MSG_PUB.Initialize;
1534     x_return_status := FND_API.G_RET_STS_SUCCESS;
1535 
1536     IF(p_fucntion_id IS NOT NULL) THEN
1537 
1538          -- Bug #3236356
1539          SELECT COUNT(0)
1540          INTO   l_count
1541          FROM   FND_FORM_FUNCTIONS_TL
1542          WHERE  FUNCTION_ID = p_fucntion_id;
1543 
1544               IF(l_count =0) THEN
1545                 FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1546                 FND_MESSAGE.SET_TOKEN('BSC_MENU', p_fucntion_id);
1547                 FND_MSG_PUB.ADD;
1548                 RAISE FND_API.G_EXC_ERROR;
1549               END IF;
1550 
1551         ELSE
1552 
1553               FND_MESSAGE.SET_NAME('BSC','BSC_INVALID_MENU_ID');
1554               FND_MESSAGE.SET_TOKEN('BSC_MENU', p_fucntion_id);
1555               FND_MSG_PUB.ADD;
1556               RAISE FND_API.G_EXC_ERROR;
1557 
1558     END IF;
1559 
1560     FND_FORM_FUNCTIONS_PKG.DELETE_ROW(X_FUNCTION_ID => p_fucntion_id);
1561 
1562     IF (c_menu_functions%ISOPEN) THEN
1563       CLOSE c_menu_functions;
1564     END IF;
1565 
1566     FOR cd IN c_menu_functions LOOP
1567 
1568       l_menu_id := cd.menu_id;
1569       l_entrysequence := cd.entry_sequence;
1570 
1571       FND_MENU_ENTRIES_PKG.DELETE_ROW
1572       (
1573            X_MENU_ID        => l_menu_id
1574           ,X_ENTRY_SEQUENCE => l_entrysequence
1575       );
1576 
1577     END LOOP;
1578 
1579 EXCEPTION
1580 
1581 WHEN FND_API.G_EXC_ERROR THEN
1582     --DBMS_OUTPUT.PUT_LINE('p_fucntion_id---> '||p_fucntion_id);
1583     IF (c_menu_functions%ISOPEN) THEN
1584           CLOSE c_menu_functions;
1585     END IF;
1586 
1587     ROLLBACK TO deletelauchpadlink;
1588     IF (x_msg_data IS NULL) THEN
1589         FND_MSG_PUB.Count_And_Get
1590         (      p_encoded   =>  FND_API.G_FALSE
1591             ,  p_count     =>  x_msg_count
1592             ,  p_data      =>  x_msg_data
1593         );
1594     END IF;
1595 
1596     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1597     x_return_status :=  FND_API.G_RET_STS_ERROR;
1598 
1599 WHEN OTHERS THEN
1600     --DBMS_OUTPUT.PUT_LINE('p_fucntion_id others---> '||p_fucntion_id);
1601     IF (c_menu_functions%ISOPEN) THEN
1602           CLOSE c_menu_functions;
1603     END IF;
1604 
1605     ROLLBACK TO deletelauchpadlink;
1606     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1607     IF (x_msg_data IS NOT NULL) THEN
1608         x_msg_data      :=  x_msg_data||' -> BSC_CUSTOM_VIEW_PUB.delete_Custom_View ';
1609     ELSE
1610         x_msg_data      :=  SQLERRM||' at BSC_CUSTOM_VIEW_PUB.delete_Custom_View ';
1611     END IF;
1612     --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1613 END Delete_Launch_Pad_Link;
1614 
1615 /****************************************************************************
1616  Name :- Update_Launch_Pad_Link
1617  Description :- This procedure will update the Form Function in the FND_FORM_FUCNTIONS.
1618                 It should be called only for those launchpad links whose short_name
1619                 starts with 'BSC'
1620  Input :- p_user_function_name
1621           p_url
1622           p_type
1623           p_function_id
1624  Creator :-ashankar
1625 /****************************************************************************/
1626 
1627 
1628 PROCEDURE Update_Launch_Pad_Link
1629 (
1630    p_commit                 IN              VARCHAR2   := FND_API.G_FALSE
1631  , p_user_function_name     IN              VARCHAR2
1632  , p_url                    IN              VARCHAR2
1633  , p_type                   IN              VARCHAR2 :='WWW'
1634  , p_function_id            IN              FND_FORM_FUNCTIONS.function_id% TYPE
1635  , x_return_status          OUT    NOCOPY   VARCHAR2
1636  , x_msg_count              OUT    NOCOPY   NUMBER
1637  , x_msg_data               OUT    NOCOPY   VARCHAR2
1638 ) IS
1639 
1640 l_function_name     FND_FORM_FUNCTIONS.function_name%TYPE;
1641 
1642 BEGIN
1643     FND_MSG_PUB.Initialize;
1644     x_return_status := FND_API.G_RET_STS_SUCCESS;
1645 
1646     IF (p_user_function_name IS NULL) THEN
1647         FND_MESSAGE.SET_NAME('BSC','BSC_REQ_FIELD_MISSING');
1648         FND_MESSAGE.SET_TOKEN('FIELD_NAME', BSC_APPS.Get_Lookup_Value('BSC_UI_COMMON', 'FUCNTION_NAME'), TRUE);
1649         FND_MSG_PUB.ADD;
1650         RAISE FND_API.G_EXC_ERROR;
1651     END IF;
1652 
1653     IF (p_user_function_name IS NULL) THEN
1654         FND_MESSAGE.SET_NAME('BSC','BSC_REQ_FIELD_MISSING');
1655         FND_MESSAGE.SET_TOKEN('FIELD_NAME', BSC_APPS.Get_Lookup_Value('BSC_UI_COMMON', 'ADD_URL'), TRUE);
1656         FND_MSG_PUB.ADD;
1657         RAISE FND_API.G_EXC_ERROR;
1658     END IF;
1659 
1660     l_function_name := get_Form_Function_Name(p_function_id);
1661 
1662         BSC_LAUNCH_PAD_PVT.UPDATE_FORM_FUNCTION_VB
1663         (
1664               X_FUNCTION_ID              => p_function_id
1665             , X_WEB_HOST_NAME            => SUBSTR(p_url,1,79)
1666             , X_WEB_AGENT_NAME           => NULL
1667             , X_WEB_HTML_CALL            => p_url
1668             , X_WEB_ENCRYPT_PARAMETERS   => 'N'
1669             , X_WEB_SECURED              => 'N'
1670             , X_WEB_ICON                 => NULL
1671             , X_OBJECT_ID                => NULL
1672             , X_REGION_APPLICATION_ID    => NULL
1673             , X_REGION_CODE              => NULL
1674             , X_FUNCTION_NAME            => l_function_name
1675             , X_APPLICATION_ID           => 271
1676             , X_FORM_ID                  => NULL
1677             , X_PARAMETERS               => NULL
1678             , X_TYPE                     => p_type
1679             , X_USER_FUNCTION_NAME       => p_user_function_name
1680             , X_DESCRIPTION              => p_url
1681             , X_USER_ID                  => get_User_Id
1682         );
1683 
1684 
1685      IF (p_commit = FND_API.G_TRUE) THEN
1686       COMMIT;
1687      END IF;
1688 
1689 EXCEPTION
1690 
1691 WHEN FND_API.G_EXC_ERROR THEN
1692     IF (x_msg_data IS NULL) THEN
1693         FND_MSG_PUB.Count_And_Get
1694         (      p_encoded   =>  FND_API.G_FALSE
1695             ,  p_count     =>  x_msg_count
1696             ,  p_data      =>  x_msg_data
1697         );
1698     END IF;
1699     --DBMS_OUTPUT.PUT_LINE('EXCEPTION FND_API.G_EXC_ERROR '||x_msg_data);
1700     x_return_status :=  FND_API.G_RET_STS_ERROR;
1701 
1702 WHEN OTHERS THEN
1703      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1704      IF (x_msg_data IS NOT NULL) THEN
1705         x_msg_data :=  x_msg_data||' -> BSC_LAUNCH_PAD_PUB.Update_Launch_Pad_Link ';
1706      ELSE
1707         x_msg_data :=  SQLERRM||' at BSC_LAUNCH_PAD_PUB.Update_Launch_Pad_Link ';
1708      END IF;
1709       --DBMS_OUTPUT.PUT_LINE('EXCEPTION OTHERS '||x_msg_data);
1710 END Update_Launch_Pad_Link;
1711 
1712 /*
1713   is_Menu_Id_Valid added for Bug #3236356
1714 */
1715 
1716 FUNCTION is_Menu_Id_Valid
1717 (
1718   p_Menu_Id         IN NUMBER
1719 )RETURN NUMBER IS
1720 
1721   l_count   NUMBER := 0;
1722 
1723 BEGIN
1724   SELECT COUNT(0)
1725   INTO   l_count
1726   FROM   FND_MENUS_TL
1727   WHERE  MENU_ID = p_Menu_Id;
1728 
1729 
1730   RETURN l_count;
1731 END is_Menu_Id_Valid;
1732 
1733 END BSC_LAUNCH_PAD_PUB;
1734