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