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