DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAD_SHD

Source


1 Package Body hxc_had_shd as
2 /* $Header: hxchadrhi.pkb 120.2 2005/09/23 10:40:21 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_had_shd.';  -- Global package name
9 g_debug	boolean	:=hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15   (p_constraint_name in all_constraints.constraint_name%TYPE
16   ) Is
17 --
18   l_proc 	varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21   --
22   If (p_constraint_name = 'HXC_ALIAS_DEFINITIONS_PK') Then
23     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24     fnd_message.set_token('PROCEDURE', l_proc);
25     fnd_message.set_token('STEP','5');
26     fnd_message.raise_error;
27   ElsIf (p_constraint_name = 'HXC_ALIAS_DEFINITIONS_UK2') Then
28     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('STEP','10');
31     fnd_message.raise_error;
32   Else
33     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
36     fnd_message.raise_error;
37   End If;
38   --
39 End constraint_error;
40 --
41 -- ----------------------------------------------------------------------------
42 -- |-----------------------------< api_updating >-----------------------------|
43 -- ----------------------------------------------------------------------------
44 Function api_updating
45   (p_alias_definition_id                  in     number
46   ,p_object_version_number                in     number
47   )
48   Return Boolean Is
49 --
50   --
51   -- Cursor selects the 'current' row from the HR Schema
52   --
53   Cursor C_Sel1 is
54     select
55        alias_definition_id
56       ,description
57       ,alias_definition_name
58       ,alias_context_code
59       ,business_group_id
60       ,legislation_code
61       ,timecard_field
62       ,object_version_number
63       ,alias_type_id
64     from	hxc_alias_definitions
65     where	alias_definition_id = p_alias_definition_id;
66 --
67   l_fct_ret	boolean;
68 --
69 Begin
70   --
71   If (p_alias_definition_id is null and
72       p_object_version_number is null
73      ) Then
74     --
75     -- One of the primary key arguments is null therefore we must
76     -- set the returning function value to false
77     --
78     l_fct_ret := false;
79   Else
80     If (p_alias_definition_id
81         = hxc_had_shd.g_old_rec.alias_definition_id and
82         p_object_version_number
83         = hxc_had_shd.g_old_rec.object_version_number
84        ) Then
85       --
86       -- The g_old_rec is current therefore we must
87       -- set the returning function to true
88       --
89       l_fct_ret := true;
90     Else
91       --
92       -- Select the current row into g_old_rec
93       --
94       Open C_Sel1;
95       Fetch C_Sel1 Into hxc_had_shd.g_old_rec;
96       If C_Sel1%notfound Then
97         Close C_Sel1;
98         --
99         -- The primary key is invalid therefore we must error
100         --
101         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
102         fnd_message.raise_error;
103       End If;
104       Close C_Sel1;
105       If (p_object_version_number
106           <> hxc_had_shd.g_old_rec.object_version_number) Then
107         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
108         fnd_message.raise_error;
109       End If;
110       l_fct_ret := true;
111     End If;
112   End If;
113   Return (l_fct_ret);
114 --
115 End api_updating;
116 --
117 -- ----------------------------------------------------------------------------
118 -- |---------------------------------< lck >----------------------------------|
119 -- ----------------------------------------------------------------------------
120 Procedure lck
121   (p_alias_definition_id                  in     number
122   ,p_object_version_number                in     number
123   ) is
124 --
125 -- Cursor selects the 'current' row from the HR Schema
126 --
127   Cursor C_Sel1 is
128     select
129        alias_definition_id
130       ,description
131       ,alias_definition_name
132       ,alias_context_code
133       ,business_group_id
134       ,legislation_code
135       ,timecard_field
136       ,object_version_number
137       ,alias_type_id
138     from	hxc_alias_definitions
139     where	alias_definition_id = p_alias_definition_id
140     for	update nowait;
141 --
142   l_proc	varchar2(72);
143 --
144 Begin
145   g_debug:=hr_utility.debug_enabled;
146   if g_debug then
147 	l_proc := g_package||'lck';
148 	hr_utility.set_location('Entering:'||l_proc, 5);
149   end if;
150   --
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'ALIAS_DEFINITION_ID'
154     ,p_argument_value     => p_alias_definition_id
155     );
156   --
157   Open  C_Sel1;
158   Fetch C_Sel1 Into hxc_had_shd.g_old_rec;
159   If C_Sel1%notfound then
160     Close C_Sel1;
161     --
162     -- The primary key is invalid therefore we must error
163     --
164     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
165     fnd_message.raise_error;
166   End If;
167   Close C_Sel1;
168   If (p_object_version_number
169       <> hxc_had_shd.g_old_rec.object_version_number) Then
170         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
171         fnd_message.raise_error;
172   End If;
173   --
174   if g_debug then
175 	hr_utility.set_location(' Leaving:'||l_proc, 10);
176   end if;
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', 'hxc_alias_definitions');
188     fnd_message.raise_error;
189 End lck;
190 --
191 -- ----------------------------------------------------------------------------
192 -- |-----------------------------< convert_args >-----------------------------|
193 -- ----------------------------------------------------------------------------
194 Function convert_args
195   (p_alias_definition_id            in number
196   ,p_description                    in varchar2
197   ,p_alias_definition_name          in varchar2
198   ,p_alias_context_code             in varchar2
199   ,p_business_group_id              in number
200   ,p_legislation_code               in varchar2
201   ,p_timecard_field                 in varchar2
202   ,p_object_version_number          in number
203   ,p_alias_type_id                  in number
204   )
205   Return g_rec_type is
206 --
207   l_rec   g_rec_type;
208 --
209 Begin
210   --
211   -- Convert arguments into local l_rec structure.
212   --
213   l_rec.alias_definition_id              := p_alias_definition_id;
214   l_rec.description                      := p_description;
215   l_rec.alias_definition_name            := p_alias_definition_name;
216   l_rec.alias_context_code               := p_alias_context_code;
217   l_rec.business_group_id                := p_business_group_id;
218   l_rec.legislation_code                 := p_legislation_code;
219   l_rec.timecard_field                   := p_timecard_field;
220   l_rec.object_version_number            := p_object_version_number;
221   l_rec.alias_type_id   		 := p_alias_type_id;
222   --
223   -- Return the plsql record structure.
224   --
225   Return(l_rec);
226 --
227 End convert_args;
228 --
229 end hxc_had_shd;