DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HSD_SHD

Source


1 Package Body hxc_hsd_shd as
2 /* $Header: hxchsdrhi.pkb 120.3 2005/09/23 10:44:51 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hxc_hsd_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_SEEDDATA_BY_LEVEL_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   Else
28     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31     fnd_message.raise_error;
32   End If;
33   --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40   (p_object_id                            in     number
41   ,p_object_type                          in     varchar2
42   )
43   Return Boolean Is
44   --
45   --
46   -- Cursor selects the 'current' row from the HR Schema
47   --
48   Cursor C_Sel1 is
49     select
50        object_id
51       ,object_type
52       ,hxc_required
53       ,owner_application_id
54     from        hxc_seeddata_by_level
55     where       object_id = p_object_id
56     and   object_type = p_object_type;
57   --
58   l_fct_ret     boolean;
59   --
60 Begin
61   --
62   If (p_object_id is null and
63       p_object_type is null
64      ) Then
65     --
66     -- One of the primary key arguments is null therefore we must
67     -- set the returning function value to false
68     --
69     l_fct_ret := false;
70   Else
71     If (p_object_id
72         = hxc_hsd_shd.g_old_rec.object_id and
73         p_object_type
74         = hxc_hsd_shd.g_old_rec.object_type
75        ) Then
76       --
77       -- The g_old_rec is current therefore we must
78       -- set the returning function to true
79       --
80       l_fct_ret := true;
81     Else
82       --
83       -- Select the current row into g_old_rec
84       --
85       Open C_Sel1;
86       Fetch C_Sel1 Into hxc_hsd_shd.g_old_rec;
87       If C_Sel1%notfound Then
88         Close C_Sel1;
89         --
90         -- The primary key is invalid therefore we must error
91         --
92         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
93         fnd_message.raise_error;
94       End If;
95       Close C_Sel1;
96       --
97       l_fct_ret := true;
98     End If;
99   End If;
100   Return (l_fct_ret);
101 --
102 End api_updating;
103 --
104 -- ----------------------------------------------------------------------------
105 -- |---------------------------------< lck >----------------------------------|
106 -- ----------------------------------------------------------------------------
107 Procedure lck
108   (p_object_id                            in     number
109   ,p_object_type                          in     varchar2
110   ) is
111 --
112 -- Cursor selects the 'current' row from the HR Schema
113 --
114   Cursor C_Sel1 is
115     select
116        object_id
117       ,object_type
118       ,hxc_required
119       ,owner_application_id
120     from        hxc_seeddata_by_level
121     where       object_id = p_object_id
122     and   object_type = p_object_type
123     for update nowait;
124 --
125   l_proc        varchar2(72);
126 --
127 Begin
128   g_debug:=hr_utility.debug_enabled;
129   if g_debug then
130 	l_proc := g_package||'lck';
131 	hr_utility.set_location('Entering:'||l_proc, 5);
132   end if;
133   --
134   hr_api.mandatory_arg_error
135     (p_api_name           => l_proc
136     ,p_argument           => 'OBJECT_ID'
137     ,p_argument_value     => p_object_id
138     );
139   if g_debug then
140 	hr_utility.set_location(l_proc,6);
141   end if;
142   hr_api.mandatory_arg_error
143     (p_api_name           => l_proc
144     ,p_argument           => 'OBJECT_TYPE'
145     ,p_argument_value     => p_object_type
146     );
147   --
148   Open  C_Sel1;
149   Fetch C_Sel1 Into hxc_hsd_shd.g_old_rec;
150   If C_Sel1%notfound then
151     Close C_Sel1;
152     --
153     -- The primary key is invalid therefore we must error
154     --
155     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
156     fnd_message.raise_error;
157   End If;
158   Close C_Sel1;
159   --
160   --
161   if g_debug then
162 	hr_utility.set_location(' Leaving:'||l_proc, 10);
163   end if;
164   --
165   -- We need to trap the ORA LOCK exception
166   --
167 Exception
168   When HR_Api.Object_Locked then
169     --
170     -- The object is locked therefore we need to supply a meaningful
171     -- error message.
172     --
173     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
174     fnd_message.set_token('TABLE_NAME', 'hxc_seeddata_by_level');
175     fnd_message.raise_error;
176 End lck;
177 --
178 -- ----------------------------------------------------------------------------
179 -- |-----------------------------< convert_args >-----------------------------|
180 -- ----------------------------------------------------------------------------
181 Function convert_args
182   (p_object_id                      in number
183   ,p_object_type                    in varchar2
184   ,p_hxc_required                   in varchar2
185   ,p_owner_application_id           in number
186   )
187   Return g_rec_type is
188 --
189   l_rec   g_rec_type;
190 --
191 Begin
192   --
193   -- Convert arguments into local l_rec structure.
194   --
195   l_rec.object_id                        := p_object_id;
196   l_rec.object_type                      := p_object_type;
197   l_rec.hxc_required                     := p_hxc_required;
198   l_rec.owner_application_id             := p_owner_application_id;
199   --
200   -- Return the plsql record structure.
201   --
202   Return(l_rec);
203 --
204 End convert_args;
205 --
206 end hxc_hsd_shd;