DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_APS_SHD

Source


1 Package Body hxc_aps_shd as
2 /* $Header: hxcaprpsrhi.pkb 120.2 2005/09/23 10:38:57 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_aps_shd.';  -- Global package name
9 g_debug	   boolean	:= hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16 Begin
17   --
18   Return (nvl(g_api_dml, false));
19   --
20 End return_api_dml_status;
21 --
22 -- ----------------------------------------------------------------------------
23 -- |---------------------------< constraint_error >---------------------------|
24 -- ----------------------------------------------------------------------------
25 Procedure constraint_error
26   (p_constraint_name in all_constraints.constraint_name%TYPE
27   ) Is
28 --
29   l_proc 	varchar2(72) := g_package||'constraint_error';
30 --
31 Begin
32   --
33   If (p_constraint_name = 'HXC_APPROVAL_PERIOD_SETS_PK') Then
34     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
35     fnd_message.set_token('PROCEDURE', l_proc);
36     fnd_message.set_token('STEP','5');
37     fnd_message.raise_error;
38   Else
39     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
40     fnd_message.set_token('PROCEDURE', l_proc);
41     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
42     fnd_message.raise_error;
43   End If;
44   --
45 End constraint_error;
46 --
47 -- ----------------------------------------------------------------------------
48 -- |-----------------------------< api_updating >-----------------------------|
49 -- ----------------------------------------------------------------------------
50 Function api_updating
51   (p_approval_period_set_id               in     number
52   ,p_object_version_number                in     number
53   )
54   Return Boolean Is
55 --
56   --
57   -- Cursor selects the 'current' row from the HR Schema
58   --
59   Cursor C_Sel1 is
60     select
61        approval_period_set_id
62       ,name
63       ,object_version_number
64     from	hxc_approval_period_sets
65     where	approval_period_set_id = p_approval_period_set_id;
66 --
67   l_fct_ret	boolean;
68 --
69 Begin
70   --
71   If (p_approval_period_set_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_approval_period_set_id
81         = hxc_aps_shd.g_old_rec.approval_period_set_id and
82         p_object_version_number
83         = hxc_aps_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_aps_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_aps_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_approval_period_set_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        approval_period_set_id
130       ,name
131       ,object_version_number
132     from	hxc_approval_period_sets
133     where	approval_period_set_id = p_approval_period_set_id
134     for	update nowait;
135 --
136   l_proc	varchar2(72);
137 --
138 Begin
139   g_debug:=hr_utility.debug_enabled;
140   if g_debug then
141 	 l_proc:= g_package||'lck';
142 	 hr_utility.set_location('Entering:'||l_proc, 5);
143   end if;
144   --
145   hr_api.mandatory_arg_error
146     (p_api_name           => l_proc
147     ,p_argument           => 'APPROVAL_PERIOD_SET_ID'
148     ,p_argument_value     => p_approval_period_set_id
149     );
150   --
151   Open  C_Sel1;
152   Fetch C_Sel1 Into hxc_aps_shd.g_old_rec;
153   If C_Sel1%notfound then
154     Close C_Sel1;
155     --
156     -- The primary key is invalid therefore we must error
157     --
158     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
159     fnd_message.raise_error;
160   End If;
161   Close C_Sel1;
162   If (p_object_version_number
163       <> hxc_aps_shd.g_old_rec.object_version_number) Then
164         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
165         fnd_message.raise_error;
166   End If;
167   --
168   if g_debug then
169 	hr_utility.set_location(' Leaving:'||l_proc, 10);
170   end if;
171   --
172   -- We need to trap the ORA LOCK exception
173   --
174 Exception
175   When HR_Api.Object_Locked then
176     --
177     -- The object is locked therefore we need to supply a meaningful
178     -- error message.
179     --
180     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
181     fnd_message.set_token('TABLE_NAME', 'hxc_approval_period_sets');
182     fnd_message.raise_error;
183 End lck;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |-----------------------------< convert_args >-----------------------------|
187 -- ----------------------------------------------------------------------------
188 Function convert_args
189   (p_approval_period_set_id         in number
190   ,p_name                           in varchar2
191   ,p_object_version_number          in number
192   )
193   Return g_rec_type is
194 --
195   l_rec   g_rec_type;
196 --
197 Begin
198   --
199   -- Convert arguments into local l_rec structure.
200   --
201   l_rec.approval_period_set_id           := p_approval_period_set_id;
202   l_rec.name                             := p_name;
203   l_rec.object_version_number            := p_object_version_number;
204   --
205   -- Return the plsql record structure.
206   --
207   Return(l_rec);
208 --
209 End convert_args;
210 --
211 end hxc_aps_shd;