DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PPU_SHD

Source


1 Package Body hr_ppu_shd as
2 /* $Header: hrppurhi.pkb 115.1 99/07/17 05:36:57 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_ppu_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 --
34 Begin
35   hr_utility.set_location('Entering:'||l_proc, 5);
36   --
37   If (p_constraint_name = 'HR_PPU_HIERARCHY_LEVEL') Then
38     fnd_message.set_name('PAY', 'HR_51018_HR_PPU_LEVEL');
39     fnd_message.raise_error;
40   ElsIf (p_constraint_name = 'HR_PPU_PK') Then
41     fnd_message.set_name('PAY', 'HR_51019_HR_PPU_PK');
42     fnd_message.raise_error;
43   ElsIf (p_constraint_name = 'HR_PPU_UK01') Then
44     fnd_message.set_name('PAY', 'HR_51020_HR_PPU_UK01');
45     fnd_message.raise_error;
46   ElsIf (p_constraint_name = 'HR_PPU_UK02') Then
47     fnd_message.set_name('PAY', 'HR_51021_HR_PPU_UK02');
48     fnd_message.raise_error;
49   Else
50     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
51     fnd_message.set_token('PROCEDURE',l_proc);
52     fnd_message.set_token('CONSTRAINT_NAME',p_constraint_name);
53     fnd_message.raise_error;
54 
55   End If;
56   --
57   hr_utility.set_location(' Leaving:'||l_proc, 10);
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64   (
65   p_purpose_usage_id                   in number,
66   p_object_version_number              in number
67   )      Return Boolean Is
68 --
69   --
70   -- Cursor selects the 'current' row from the HR Schema
71   --
72   Cursor C_Sel1 is
73     select
74 		purpose_usage_id,
75 	entity_name,
76 	pattern_purpose,
77 	hierarchy_level,
78 	object_version_number
79     from	hr_pattern_purpose_usages
80     where	purpose_usage_id = p_purpose_usage_id;
81 --
82   l_proc	varchar2(72)	:= g_package||'api_updating';
83   l_fct_ret	boolean;
84 --
85 Begin
86   hr_utility.set_location('Entering:'||l_proc, 5);
87   --
88   If (
89 	p_purpose_usage_id is null and
90 	p_object_version_number is null
91      ) Then
92     --
93     -- One of the primary key arguments is null therefore we must
94     -- set the returning function value to false
95     --
96     l_fct_ret := false;
97   Else
98     If (
99 	p_purpose_usage_id = g_old_rec.purpose_usage_id and
100 	p_object_version_number = g_old_rec.object_version_number
101        ) Then
102       hr_utility.set_location(l_proc, 10);
103       --
104       -- The g_old_rec is current therefore we must
105       -- set the returning function to true
106       --
107       l_fct_ret := true;
108     Else
109       --
110       -- Select the current row into g_old_rec
111       --
112       Open C_Sel1;
113       Fetch C_Sel1 Into g_old_rec;
114       If C_Sel1%notfound Then
115         Close C_Sel1;
116         --
117         -- The primary key is invalid therefore we must error
118         --
119         fnd_message.set_name('PAY', 'HR_51019_HR_PPU_PK');
120         fnd_message.raise_error;
121       End If;
122       Close C_Sel1;
123       If (p_object_version_number <> g_old_rec.object_version_number) Then
124         hr_utility.set_message('801', 'HR_7155_OBJECT_INVALID');
125         hr_utility.raise_error;
126       End If;
127       hr_utility.set_location(l_proc, 15);
128       l_fct_ret := true;
129     End If;
130   End If;
131   hr_utility.set_location(' Leaving:'||l_proc, 20);
132   Return (l_fct_ret);
133 --
134 End api_updating;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |---------------------------------< lck >----------------------------------|
138 -- ----------------------------------------------------------------------------
139 Procedure lck
140   (
141   p_purpose_usage_id                   in number,
142   p_object_version_number              in number
143   ) is
144 --
145 -- Cursor selects the 'current' row from the HR Schema
146 --
147   Cursor C_Sel1 is
148     select 	purpose_usage_id,
149 	entity_name,
150 	pattern_purpose,
151 	hierarchy_level,
152 	object_version_number
153     from	hr_pattern_purpose_usages
154     where	purpose_usage_id = p_purpose_usage_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_51019_HR_PPU_PK');
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         hr_utility.set_message('801', 'HR_7155_OBJECT_INVALID');
182         hr_utility.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     hr_utility.set_message('801', 'HR_7165_OBJECT_LOCKED');
196     hr_utility.set_message_token('TABLE_NAME', 'hr_pattern_purpose_usages');
197     hr_utility.raise_error;
198 End lck;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |-----------------------------< convert_args >-----------------------------|
202 -- ----------------------------------------------------------------------------
203 Function convert_args
204 	(
205 	p_purpose_usage_id              in number,
206 	p_entity_name                   in varchar2,
207 	p_pattern_purpose               in varchar2,
208 	p_hierarchy_level               in number,
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.purpose_usage_id                 := p_purpose_usage_id;
223   l_rec.entity_name                      := p_entity_name;
224   l_rec.pattern_purpose                  := p_pattern_purpose;
225   l_rec.hierarchy_level                  := p_hierarchy_level;
226   l_rec.object_version_number            := p_object_version_number;
227   --
228   -- Return the plsql record structure.
229   --
230   hr_utility.set_location(' Leaving:'||l_proc, 10);
231   Return(l_rec);
232 --
233 End convert_args;
234 --
235 end hr_ppu_shd;