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