[Home] [Help]
PACKAGE BODY: APPS.BEN_PSG_SHD
Source
1 Package Body ben_psg_shd as
2 /* $Header: bepsgrhi.pkb 120.0 2005/09/29 06:19:33 ssarkar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_psg_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 = 'BEN_PIL_ASSIGNMENT_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 ElsIf (p_constraint_name = 'BEN_PIL_ASSIGNMENT_UNIQUE') Then
38 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('STEP','10');
41 fnd_message.raise_error;
42 Else
43 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
44 fnd_message.set_token('PROCEDURE', l_proc);
45 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
46 fnd_message.raise_error;
47 End If;
48 --
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (p_pil_assignment_id in number
56 ,p_object_version_number in number
57 )
58 Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 pil_assignment_id
66 ,per_in_ler_id
67 ,applicant_assignment_id
68 ,offer_assignment_id
69 ,object_version_number
70 from ben_pil_assignment
71 where pil_assignment_id = p_pil_assignment_id;
72 --
73 l_fct_ret boolean;
74 --
75 Begin
76 --
77 If (p_pil_assignment_id is null and
78 p_object_version_number is null
79 ) Then
80 --
81 -- One of the primary key arguments is null therefore we must
82 -- set the returning function value to false
83 --
84 l_fct_ret := false;
85 Else
86 If (p_pil_assignment_id
87 = ben_psg_shd.g_old_rec.pil_assignment_id and
88 p_object_version_number
89 = ben_psg_shd.g_old_rec.object_version_number
90 ) Then
91 --
92 -- The g_old_rec is current therefore we must
93 -- set the returning function to true
94 --
95 l_fct_ret := true;
96 Else
97 --
98 -- Select the current row into g_old_rec
99 --
100 Open C_Sel1;
101 Fetch C_Sel1 Into ben_psg_shd.g_old_rec;
102 If C_Sel1%notfound Then
103 Close C_Sel1;
104 --
105 -- The primary key is invalid therefore we must error
106 --
107 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
108 fnd_message.raise_error;
109 End If;
110 Close C_Sel1;
111 If (p_object_version_number
112 <> ben_psg_shd.g_old_rec.object_version_number) Then
113 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
114 fnd_message.raise_error;
115 End If;
116 l_fct_ret := true;
117 End If;
118 End If;
119 Return (l_fct_ret);
120 --
121 End api_updating;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |---------------------------------< lck >----------------------------------|
125 -- ----------------------------------------------------------------------------
126 Procedure lck
127 (p_pil_assignment_id in number
128 ,p_object_version_number in number
129 ) is
130 --
131 -- Cursor selects the 'current' row from the HR Schema
132 --
133 Cursor C_Sel1 is
134 select
135 pil_assignment_id
136 ,per_in_ler_id
137 ,applicant_assignment_id
138 ,offer_assignment_id
139 ,object_version_number
140 from ben_pil_assignment
141 where pil_assignment_id = p_pil_assignment_id
142 for update nowait;
143 --
144 l_proc varchar2(72) := g_package||'lck';
145 --
146 Begin
147 hr_utility.set_location('Entering:'||l_proc, 5);
148 --
149 hr_api.mandatory_arg_error
150 (p_api_name => l_proc
151 ,p_argument => 'PIL_ASSIGNMENT_ID'
152 ,p_argument_value => p_pil_assignment_id
153 );
154 hr_utility.set_location(l_proc,6);
155 hr_api.mandatory_arg_error
156 (p_api_name => l_proc
157 ,p_argument => 'OBJECT_VERSION_NUMBER'
158 ,p_argument_value => p_object_version_number
159 );
160 --
161 Open C_Sel1;
162 Fetch C_Sel1 Into ben_psg_shd.g_old_rec;
163 If C_Sel1%notfound then
164 Close C_Sel1;
165 --
166 -- The primary key is invalid therefore we must error
167 --
168 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
169 fnd_message.raise_error;
170 End If;
171 Close C_Sel1;
172 If (p_object_version_number
173 <> ben_psg_shd.g_old_rec.object_version_number) Then
174 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
175 fnd_message.raise_error;
176 End If;
177 --
178 hr_utility.set_location(' Leaving:'||l_proc, 10);
179 --
180 -- We need to trap the ORA LOCK exception
181 --
182 Exception
183 When HR_Api.Object_Locked then
184 --
185 -- The object is locked therefore we need to supply a meaningful
186 -- error message.
187 --
188 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
189 fnd_message.set_token('TABLE_NAME', 'ben_pil_assignment');
190 fnd_message.raise_error;
191 End lck;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< convert_args >-----------------------------|
195 -- ----------------------------------------------------------------------------
196 Function convert_args
197 (p_pil_assignment_id in number
198 ,p_per_in_ler_id in number
199 ,p_applicant_assignment_id in number
200 ,p_offer_assignment_id in number
201 ,p_object_version_number in number
202 )
203 Return g_rec_type is
204 --
205 l_rec g_rec_type;
206 --
207 Begin
208 --
209 -- Convert arguments into local l_rec structure.
210 --
211 l_rec.pil_assignment_id := p_pil_assignment_id;
212 l_rec.per_in_ler_id := p_per_in_ler_id;
213 l_rec.applicant_assignment_id := p_applicant_assignment_id;
214 l_rec.offer_assignment_id := p_offer_assignment_id;
215 l_rec.object_version_number := p_object_version_number;
216 --
217 -- Return the plsql record structure.
218 --
219 Return(l_rec);
220 --
221 End convert_args;
222 --
223 end ben_psg_shd;