DBA Data[Home] [Help]

PACKAGE BODY: APPS.BIS_COMPUTED_TARGET_PVT

Source


1 package BODY BIS_COMPUTED_TARGET_PVT AS
2 /* $Header: BISVCTVB.pls 115.11 2003/01/27 13:44:19 sugopal noship $ */
3 
4 G_PKG_NAME CONSTANT varchar2(30) := 'BIS_COMPUTED_TARGET_PVT';
5 G_BISTAR_CLAUSE CONSTANT varchar2(50) := '%pFunctionType=BISTAR%' ;
6 
7 PROCEDURE Retrieve_Computed_Targets
8 ( p_api_version          IN  number
9 , x_Computed_Target_Tbl  out NOCOPY Computed_Target_Tbl_Type
10 , x_return_status        OUT NOCOPY VARCHAR2
11 , x_error_tbl            OUT NOCOPY BIS_UTILITIES_PUB.Error_Tbl_Type
12 )
13 IS
14 
15 i NUMBER := 0;
16 cursor comp_target is
17     select function_id,function_name, user_function_name
18     from fnd_form_functions_vl
19  where parameters like G_BISTAR_CLAUSE ;
20     --where TYPE = 'BISTAR';
21 
22 l_rec Computed_target_Rec_Type;
23 
24 BEGIN
25 
26     x_return_status := FND_API.G_RET_STS_SUCCESS;
27 
28     for comptar in comp_target loop
29       i := i+1;
30 
31 
32       l_rec.Computed_Target_id := comptar.function_id;
33       l_rec.Computed_Target_Short_name := comptar.function_name;
34       l_rec.Computed_Target_name := comptar.user_function_name;
35 
36       x_Computed_Target_Tbl(i) := l_rec;
37 
38     end loop;
39     if comp_target%isopen then close comp_target; end if;
40 
41 EXCEPTION
42    when FND_API.G_EXC_ERROR then
43       x_return_status := FND_API.G_RET_STS_ERROR ;
44       RAISE FND_API.G_EXC_ERROR;
45    when FND_API.G_EXC_UNEXPECTED_ERROR then
46       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
47       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
48    when others then
49       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
50       BIS_UTILITIES_PVT.Add_Error_Message
51       ( p_error_msg_id      => SQLCODE
52       , p_error_description => SQLERRM
53       , p_error_proc_name   => G_PKG_NAME||'.Retrieve_Computed_Targets'
54       );
55       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
56 
57 END Retrieve_Computed_Targets;
58 --
59 PROCEDURE Validate_Computed_Target_Id
60 ( p_api_version           IN  NUMBER
61 , p_validation_level      IN  NUMBER := FND_API.G_VALID_LEVEL_FULL
62 , p_Computed_Target_ID    IN  NUMBER
63 , x_return_status         OUT NOCOPY VARCHAR2
64 , x_error_Tbl             OUT NOCOPY BIS_UTILITIES_PUB.Error_Tbl_Type
65 )
66 IS
67 
68 CURSOR val_cur is
69     select 1
70     from fnd_form_functions_vl
71     where function_id = p_Computed_Target_ID
72   and parameters like G_BISTAR_CLAUSE ;
73     --and  TYPE = 'BISTAR';
74 l_dummy number;
75 l_error_Tbl BIS_UTILITIES_PUB.Error_Tbl_Type;
76 
77 BEGIN
78   --added status
79   x_return_status := FND_API.G_RET_STS_SUCCESS;
80   if(   BIS_UTILITIES_PUB.Value_Not_Missing(p_Computed_Target_ID)
81         =FND_API.G_TRUE
82     AND BIS_UTILITIES_PUB.Value_Not_NULL(p_Computed_Target_ID)
83         =FND_API.G_TRUE ) then
84     open val_cur;
85     fetch val_cur into l_dummy;
86     if (val_cur%NOTFOUND) then
87       close val_cur;
88       -- POPULATE THE TABLE
89       --added last two params
90       l_error_Tbl := x_error_tbl;
91 
92       BIS_UTILITIES_PVT.Add_Error_Message
93       ( p_error_msg_name    => 'BIS_INVALID_COMP_FUNCTION'
94       , p_error_msg_level   => FND_MSG_PUB.G_MSG_LVL_ERROR
95       , p_error_proc_name   => G_PKG_NAME||'.Validate_Computed_Target_Id'
96       , p_error_type        => BIS_UTILITIES_PUB.G_ERROR
97        , p_error_table       => l_error_Tbl
98       , x_error_table       => x_error_tbl
99       );
100       RAISE FND_API.G_EXC_ERROR;
101     end if;
102     close val_cur;
103   end if;
104 --commented RAISE
105 EXCEPTION
106    when FND_API.G_EXC_ERROR then
107       x_return_status := FND_API.G_RET_STS_ERROR ;
108       --RAISE FND_API.G_EXC_ERROR;
109    when FND_API.G_EXC_UNEXPECTED_ERROR then
110       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
111       --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
112    when others then
113       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
114       BIS_UTILITIES_PVT.Add_Error_Message
115       ( p_error_msg_id      => SQLCODE
116       , p_error_description => SQLERRM
117       , p_error_proc_name   => G_PKG_NAME||'.Validate_Computed_Target_Id'
118       );
119       --RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
120 
121 END Validate_Computed_Target_Id;
122 --
123 --
124 PROCEDURE Value_ID_Conversion
125 ( p_api_version                IN  NUMBER
126 , p_Computed_Target_Short_Name IN  VARCHAR2
127 , p_Computed_Target_Name       IN  VARCHAR2
128 , x_Computed_Target_ID         OUT NOCOPY NUMBER
129 , x_return_status              OUT NOCOPY VARCHAR2
130 , x_error_Tbl                  OUT NOCOPY BIS_UTILITIES_PUB.Error_Tbl_Type
131 )
132 IS
133 
134 BEGIN
135 
136   x_return_status  := FND_API.G_RET_STS_SUCCESS;
137 
138   if (BIS_UTILITIES_PUB.Value_Not_Missing(p_Computed_Target_Short_Name)
139                        = FND_API.G_TRUE) then
140 
141     select function_id into x_Computed_Target_ID
142     from fnd_form_functions_vl
143     where function_name = p_Computed_Target_Short_Name
144  and parameters like G_BISTAR_CLAUSE;
145     --and  TYPE = 'BISTAR';
146 
147   elsif (BIS_UTILITIES_PUB.Value_Not_Missing(p_Computed_Target_Name)
148                        = FND_API.G_TRUE) then
149 
150     select function_id into x_Computed_Target_ID
151     from fnd_form_functions_vl
152     where user_function_name = p_Computed_Target_Name
153  and parameters like G_BISTAR_CLAUSE ;
154     --and  TYPE = 'BISTAR';
155 
156   else
157     -- POLPULATE ERROR TABLE
158     BIS_UTILITIES_PVT.Add_Error_Message
159     ( p_error_msg_name    => 'BIS_INVALID_COMP_FUNC_VALUE'
160     , p_error_msg_level   => FND_MSG_PUB.G_MSG_LVL_ERROR
161     , p_error_proc_name   => G_PKG_NAME||'.Value_ID_Conversion'
162     , p_error_type        => BIS_UTILITIES_PUB.G_ERROR
163     );
164     RAISE FND_API.G_EXC_ERROR;
165   end if;
166 
167 EXCEPTION
168    when FND_API.G_EXC_ERROR then
169       x_return_status := FND_API.G_RET_STS_ERROR ;
170       RAISE FND_API.G_EXC_ERROR;
171    when FND_API.G_EXC_UNEXPECTED_ERROR then
172       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
173       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
174    when others then
175       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
176       BIS_UTILITIES_PVT.Add_Error_Message
177       ( p_error_msg_id      => SQLCODE
178       , p_error_description => SQLERRM
179       , p_error_proc_name   => G_PKG_NAME||'.Value_ID_Conversion'
180       );
181       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
182 
183 END Value_ID_Conversion;
184 --
185 --
186 END BIS_COMPUTED_TARGET_PVT;