DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RER_SHD

Source


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