DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PAB_SHD

Source


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