DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SSD_SHD

Source


1 Package Body per_ssd_shd as
2 /* $Header: pessdrhi.pkb 120.2 2011/04/21 11:28:10 sgnanama noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ssd_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'PER_SP_SUCCESSEE_DETAILS_PK') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   Else
38     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41     fnd_message.raise_error;
42   End If;
43   --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50   (p_successee_detail_id                  in     number
51   ,p_object_version_number                in     number
52   )
53   Return Boolean Is
54   --
55   --
56   -- Cursor selects the 'current' row from the HR Schema
57   --
58   Cursor C_Sel1 is
59     select
60        successee_detail_id
61       ,business_group_id
62       ,successee_type
63       ,successee_id
64       ,display_permissions
65       ,max_plans
66       ,allow_npws
67       ,allow_applicants
68       ,allow_override_search
69       ,key_entity
70       ,risk_of_loss
71       ,impact_of_loss
72       ,plan_readiness_rule
73       ,max_successors
74       ,object_version_number
75     from        per_sp_successee_details
76     where       successee_detail_id = p_successee_detail_id;
77   --
78   l_fct_ret     boolean;
79   --
80 Begin
81   --
82   If (p_successee_detail_id is null and
83       p_object_version_number is null
84      ) Then
85     --
86     -- One of the primary key arguments is null therefore we must
87     -- set the returning function value to false
88     --
89     l_fct_ret := false;
90   Else
91     If (p_successee_detail_id
92         = per_ssd_shd.g_old_rec.successee_detail_id and
93         p_object_version_number
94         = per_ssd_shd.g_old_rec.object_version_number
95        ) Then
96       --
97       -- The g_old_rec is current therefore we must
98       -- set the returning function to true
99       --
100       l_fct_ret := true;
101     Else
102       --
103       -- Select the current row into g_old_rec
104       --
105       Open C_Sel1;
106       Fetch C_Sel1 Into per_ssd_shd.g_old_rec;
107       If C_Sel1%notfound Then
108         Close C_Sel1;
109         --
110         -- The primary key is invalid therefore we must error
111         --
112         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
113         fnd_message.raise_error;
114       End If;
115       Close C_Sel1;
116       If (p_object_version_number
117           <> per_ssd_shd.g_old_rec.object_version_number) Then
118         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
119         fnd_message.raise_error;
120       End If;
121       l_fct_ret := true;
122     End If;
123   End If;
124   Return (l_fct_ret);
125 --
126 End api_updating;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |---------------------------------< lck >----------------------------------|
130 -- ----------------------------------------------------------------------------
131 Procedure lck
132   (p_successee_detail_id                  in     number
133   ,p_object_version_number                in     number
134   ) is
135 --
136 -- Cursor selects the 'current' row from the HR Schema
137 --
138   Cursor C_Sel1 is
139     select
140        successee_detail_id
141       ,business_group_id
142       ,successee_type
143       ,successee_id
144       ,display_permissions
145       ,max_plans
146       ,allow_npws
147       ,allow_applicants
148       ,allow_override_search
149       ,key_entity
150       ,risk_of_loss
151       ,impact_of_loss
152       ,plan_readiness_rule
153       ,max_successors
154       ,object_version_number
155     from        per_sp_successee_details
156     where       successee_detail_id = p_successee_detail_id
157     for update nowait;
158 --
159   l_proc        varchar2(72) := g_package||'lck';
160 --
161 Begin
162   hr_utility.set_location('Entering:'||l_proc, 5);
163   --
164   hr_api.mandatory_arg_error
165     (p_api_name           => l_proc
166     ,p_argument           => 'SUCCESSEE_DETAIL_ID'
167     ,p_argument_value     => p_successee_detail_id
168     );
169   hr_utility.set_location(l_proc,6);
170   hr_api.mandatory_arg_error
171     (p_api_name           => l_proc
172     ,p_argument           => 'OBJECT_VERSION_NUMBER'
173     ,p_argument_value     => p_object_version_number
174     );
175   --
176   Open  C_Sel1;
177   Fetch C_Sel1 Into per_ssd_shd.g_old_rec;
178   If C_Sel1%notfound then
179     Close C_Sel1;
180     --
181     -- The primary key is invalid therefore we must error
182     --
183     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
184     fnd_message.raise_error;
185   End If;
186   Close C_Sel1;
187   If (p_object_version_number
188       <> per_ssd_shd.g_old_rec.object_version_number) Then
189         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
190         fnd_message.raise_error;
191   End If;
192   --
193   hr_utility.set_location(' Leaving:'||l_proc, 10);
194   --
195   -- We need to trap the ORA LOCK exception
196   --
197 Exception
198   When HR_Api.Object_Locked then
199     --
200     -- The object is locked therefore we need to supply a meaningful
201     -- error message.
202     --
203     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
204     fnd_message.set_token('TABLE_NAME', 'per_sp_successee_details');
205     fnd_message.raise_error;
206 End lck;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |-----------------------------< convert_args >-----------------------------|
210 -- ----------------------------------------------------------------------------
211 Function convert_args
212   (p_successee_detail_id            in number
213   ,p_business_group_id              in number
214   ,p_successee_type                 in varchar2
215   ,p_successee_id                   in number
216   ,p_display_permissions            in varchar2
217   ,p_max_plans                      in number
218   ,p_allow_npws                     in varchar2
219   ,p_allow_applicants               in varchar2
220   ,p_allow_override_search          in varchar2
221   ,p_key_entity                     in varchar2
222   ,p_risk_of_loss                   in varchar2
223   ,p_impact_of_loss                 in varchar2
224   ,p_plan_readiness_rule            in varchar2
225   ,p_max_successors                      in     number
226   ,p_object_version_number          in number
227   )
228   Return g_rec_type is
229 --
230   l_rec   g_rec_type;
231 --
232 Begin
233   --
234   -- Convert arguments into local l_rec structure.
235   --
236   l_rec.successee_detail_id              := p_successee_detail_id;
237   l_rec.business_group_id                := p_business_group_id;
238   l_rec.successee_type                   := p_successee_type;
239   l_rec.successee_id                     := p_successee_id;
240   l_rec.display_permissions              := p_display_permissions;
241   l_rec.max_plans                        := p_max_plans;
242   l_rec.allow_npws                       := p_allow_npws;
243   l_rec.allow_applicants                 := p_allow_applicants;
244   l_rec.allow_override_search            := p_allow_override_search;
245   l_rec.key_entity                       := p_key_entity;
246   l_rec.risk_of_loss                     := p_risk_of_loss;
247   l_rec.impact_of_loss                   := p_impact_of_loss;
248   l_rec.plan_readiness_rule              := p_plan_readiness_rule;
249   l_rec.max_successors              := p_max_successors;
250   l_rec.object_version_number            := p_object_version_number;
251   --
252   -- Return the plsql record structure.
253   --
254   Return(l_rec);
255 --
256 End convert_args;
257 --
258 end per_ssd_shd;