DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_FWN_SHD

Source


1 Package Body hr_fwn_shd as
2 /* $Header: hrfwnrhi.pkb 115.4 2002/12/03 13:32:42 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_fwn_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_WINDOWS_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_WINDOWS_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_window_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_window_id
55       ,object_version_number
56       ,application_id
57       ,form_id
58       ,window_name
59     from	hr_form_windows_b
60     where	form_window_id = p_form_window_id;
61 --
62   l_fct_ret	boolean;
63 --
64 Begin
65   --
66   If (p_form_window_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_window_id
76         = hr_fwn_shd.g_old_rec.form_window_id and
77         p_object_version_number
78         = hr_fwn_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_fwn_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_fwn_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_window_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_window_id
125       ,object_version_number
126       ,application_id
127       ,form_id
128       ,window_name
129     from	hr_form_windows_b
130     where	form_window_id = p_form_window_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_WINDOW_ID'
141     ,p_argument_value     => p_form_window_id
142     );
143   --Bug:1790746 fix Start
144   hr_api.mandatory_arg_error
145     (p_api_name	       => l_proc
146     ,p_argument	       => 'object_version_number'
147     ,p_argument_value  => p_object_version_number
148      );
149   --Bug:1790746 fix End
150   Open  C_Sel1;
151   Fetch C_Sel1 Into hr_fwn_shd.g_old_rec;
152   If C_Sel1%notfound then
153     Close C_Sel1;
154     --
155     -- The primary key is invalid therefore we must error
156     --
157     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
158     fnd_message.raise_error;
159   End If;
160   Close C_Sel1;
161   If (p_object_version_number
162       <> hr_fwn_shd.g_old_rec.object_version_number) Then
163         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
164         fnd_message.raise_error;
165   End If;
166   --
167   hr_utility.set_location(' Leaving:'||l_proc, 10);
168   --
169   -- We need to trap the ORA LOCK exception
170   --
171 Exception
172   When HR_Api.Object_Locked then
173     --
174     -- The object is locked therefore we need to supply a meaningful
175     -- error message.
176     --
177     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
178     fnd_message.set_token('TABLE_NAME', 'hr_form_windows_b');
179     fnd_message.raise_error;
180 End lck;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------------< convert_args >-----------------------------|
184 -- ----------------------------------------------------------------------------
185 Function convert_args
186   (p_form_window_id                 in number
187   ,p_object_version_number          in number
188   ,p_application_id                 in number
189   ,p_form_id                        in number
190   ,p_window_name                    in varchar2
191   )
192   Return g_rec_type is
193 --
194   l_rec   g_rec_type;
195 --
196 Begin
197   --
198   -- Convert arguments into local l_rec structure.
199   --
200   l_rec.form_window_id                   := p_form_window_id;
201   l_rec.object_version_number            := p_object_version_number;
202   l_rec.application_id                   := p_application_id;
203   l_rec.form_id                          := p_form_id;
204   IF p_window_name <> hr_api.g_varchar2 THEN
205     l_rec.window_name                      := UPPER(p_window_name);
206   ELSE
207     l_rec.window_name                      := p_window_name;
208   END IF;
209   --
210   -- Return the plsql record structure.
211   --
212   Return(l_rec);
213 --
214 End convert_args;
215 --
216 end hr_fwn_shd;