DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_FDG_SHD

Source


1 Package Body hr_fdg_shd as
2 /* $Header: hrfdgrhi.pkb 115.4 2002/12/03 10:53:27 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_fdg_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc 	varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If    (p_constraint_name = 'HR_FORM_DATA_GROUPS_B_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   ElsIf (p_constraint_name = 'HR_FORM_DATA_GROUPS_B_UK') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
37   --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_form_data_group_id                   in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48 --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        form_data_group_id
55       ,object_version_number
56       ,application_id
57       ,form_id
58       ,data_group_name
59     from	hr_form_data_groups_b
60     where	form_data_group_id = p_form_data_group_id;
61 --
62   l_fct_ret	boolean;
63 --
64 Begin
65   --
66   If (p_form_data_group_id is null and
67       p_object_version_number is null
68      ) Then
69     --
70     -- One of the primary key arguments is null therefore we must
71     -- set the returning function value to false
72     --
73     l_fct_ret := false;
74   Else
75     If (p_form_data_group_id
76         = hr_fdg_shd.g_old_rec.form_data_group_id and
77         p_object_version_number
78         = hr_fdg_shd.g_old_rec.object_version_number
79        ) Then
80       --
81       -- The g_old_rec is current therefore we must
82       -- set the returning function to true
83       --
84       l_fct_ret := true;
85     Else
86       --
87       -- Select the current row into g_old_rec
88       --
89       Open C_Sel1;
90       Fetch C_Sel1 Into hr_fdg_shd.g_old_rec;
91       If C_Sel1%notfound Then
92         Close C_Sel1;
93         --
94         -- The primary key is invalid therefore we must error
95         --
96         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
97         fnd_message.raise_error;
98       End If;
99       Close C_Sel1;
100       If (p_object_version_number
101           <> hr_fdg_shd.g_old_rec.object_version_number) Then
102         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
103         fnd_message.raise_error;
104       End If;
105       l_fct_ret := true;
106     End If;
107   End If;
108   Return (l_fct_ret);
109 --
110 End api_updating;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |---------------------------------< lck >----------------------------------|
114 -- ----------------------------------------------------------------------------
115 Procedure lck
116   (p_form_data_group_id                   in     number
117   ,p_object_version_number                in     number
118   ) is
119 --
120 -- Cursor selects the 'current' row from the HR Schema
121 --
122   Cursor C_Sel1 is
123     select
124        form_data_group_id
125       ,object_version_number
126       ,application_id
127       ,form_id
128       ,data_group_name
129     from	hr_form_data_groups_b
130     where	form_data_group_id = p_form_data_group_id
131     for	update nowait;
132 --
133   l_proc	varchar2(72) := g_package||'lck';
134 --
135 Begin
136   hr_utility.set_location('Entering:'||l_proc, 5);
137   --
138   hr_api.mandatory_arg_error
139     (p_api_name           => l_proc
140     ,p_argument           => 'FORM_DATA_GROUP_ID'
141     ,p_argument_value     => p_form_data_group_id
142     );
143 
144   --Bug:1790746 fix Start
145   hr_api.mandatory_arg_error
146     (p_api_name		=> l_proc
147     ,p_argument	=> 'object_version_number'
148     ,p_argument_value  => p_object_version_number
149      );
150   --Bug:1790746 fix End
151 
152   Open  C_Sel1;
153   Fetch C_Sel1 Into hr_fdg_shd.g_old_rec;
154   If C_Sel1%notfound then
155     Close C_Sel1;
156     --
157     -- The primary key is invalid therefore we must error
158     --
159     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
160     fnd_message.raise_error;
161   End If;
162   Close C_Sel1;
163   If (p_object_version_number
164       <> hr_fdg_shd.g_old_rec.object_version_number) Then
165         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
166         fnd_message.raise_error;
167   End If;
168   --
169   hr_utility.set_location(' Leaving:'||l_proc, 10);
170   --
171   -- We need to trap the ORA LOCK exception
172   --
173 Exception
174   When HR_Api.Object_Locked then
175     --
176     -- The object is locked therefore we need to supply a meaningful
177     -- error message.
178     --
179     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
180     fnd_message.set_token('TABLE_NAME', 'hr_form_data_groups_b');
181     fnd_message.raise_error;
182 End lck;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< convert_args >-----------------------------|
186 -- ----------------------------------------------------------------------------
187 Function convert_args
188   (p_form_data_group_id             in number
189   ,p_object_version_number          in number
190   ,p_application_id                 in number
191   ,p_form_id                        in number
192   ,p_data_group_name                in varchar2
193   )
194   Return g_rec_type is
195 --
196   l_rec   g_rec_type;
197 --
198 Begin
199   --
200   -- Convert arguments into local l_rec structure.
201   --
202   l_rec.form_data_group_id               := p_form_data_group_id;
203   l_rec.object_version_number            := p_object_version_number;
204   l_rec.application_id                   := p_application_id;
205   l_rec.form_id                          := p_form_id;
206   IF p_data_group_name <> hr_api.g_varchar2 THEN
207     l_rec.data_group_name                  := UPPER(p_data_group_name);
208   ELSE
209     l_rec.data_group_name                  := p_data_group_name;
210   END IF;
211   --
212   -- Return the plsql record structure.
213   --
214   Return(l_rec);
215 --
216 End convert_args;
217 --
218 end hr_fdg_shd;