DBA Data[Home] [Help]

PACKAGE BODY: APPS.PSP_PSC_SHD

Source


1 Package Body psp_psc_shd as
2 /* $Header: PSPSCRHB.pls 120.1 2005/11/28 23:27 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  psp_psc_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 = 'PSP_SALARY_CAPS_U1') 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 = 'SYS_C00144998') 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_salary_cap_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        salary_cap_id
55       ,funding_source_code
56       ,start_date
57       ,end_date
58       ,currency_code
59       ,annual_salary_cap
60       ,object_version_number
61       ,seed_flag
62     from        psp_salary_caps
63     where       salary_cap_id = p_salary_cap_id;
64   --
65   l_fct_ret     boolean;
66   --
67 Begin
68   --
69   If (p_salary_cap_id is null and
70       p_object_version_number is null
71      ) Then
72     --
73     -- One of the primary key arguments is null therefore we must
74     -- set the returning function value to false
75     --
76     l_fct_ret := false;
77   Else
78     If (p_salary_cap_id
79         = psp_psc_shd.g_old_rec.salary_cap_id and
80         p_object_version_number
81         = psp_psc_shd.g_old_rec.object_version_number
82        ) Then
83       --
84       -- The g_old_rec is current therefore we must
85       -- set the returning function to true
86       --
87       l_fct_ret := true;
88     Else
89       --
90       -- Select the current row into g_old_rec
91       --
92       Open C_Sel1;
93       Fetch C_Sel1 Into psp_psc_shd.g_old_rec;
94       If C_Sel1%notfound Then
95         Close C_Sel1;
96         --
97         -- The primary key is invalid therefore we must error
98         --
99         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
100         fnd_message.raise_error;
101       End If;
102       Close C_Sel1;
103       If (p_object_version_number
104           <> psp_psc_shd.g_old_rec.object_version_number) Then
105         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
106         fnd_message.raise_error;
107       End If;
108       l_fct_ret := true;
109     End If;
110   End If;
111   Return (l_fct_ret);
112 --
113 End api_updating;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |---------------------------------< lck >----------------------------------|
117 -- ----------------------------------------------------------------------------
118 Procedure lck
119   (p_salary_cap_id                        in     number
120   ,p_object_version_number                in     number
121   ) is
122 --
123 -- Cursor selects the 'current' row from the HR Schema
124 --
125   Cursor C_Sel1 is
126     select
127        salary_cap_id
128       ,funding_source_code
129       ,start_date
130       ,end_date
131       ,currency_code
132       ,annual_salary_cap
133       ,object_version_number
134       ,seed_flag
135     from        psp_salary_caps
136     where       salary_cap_id = p_salary_cap_id
137     for update nowait;
138 --
139   l_proc        varchar2(72) := g_package||'lck';
140 --
141 Begin
142   hr_utility.set_location('Entering:'||l_proc, 5);
143   --
144   hr_api.mandatory_arg_error
145     (p_api_name           => l_proc
146     ,p_argument           => 'SALARY_CAP_ID'
147     ,p_argument_value     => p_salary_cap_id
148     );
149   hr_utility.set_location(l_proc,6);
150   hr_api.mandatory_arg_error
151     (p_api_name           => l_proc
152     ,p_argument           => 'OBJECT_VERSION_NUMBER'
153     ,p_argument_value     => p_object_version_number
154     );
155   --
156   Open  C_Sel1;
157   Fetch C_Sel1 Into psp_psc_shd.g_old_rec;
158   If C_Sel1%notfound then
159     Close C_Sel1;
160     --
161     -- The primary key is invalid therefore we must error
162     --
163     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
164     fnd_message.raise_error;
165   End If;
166   Close C_Sel1;
167   If (p_object_version_number
168       <> psp_psc_shd.g_old_rec.object_version_number) Then
169         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
170         fnd_message.raise_error;
171   End If;
172   --
173   hr_utility.set_location(' Leaving:'||l_proc, 10);
174   --
175   -- We need to trap the ORA LOCK exception
176   --
177 Exception
178   When HR_Api.Object_Locked then
179     --
180     -- The object is locked therefore we need to supply a meaningful
181     -- error message.
182     --
183     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
184     fnd_message.set_token('TABLE_NAME', 'psp_salary_caps');
185     fnd_message.raise_error;
186 End lck;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< convert_args >-----------------------------|
190 -- ----------------------------------------------------------------------------
191 Function convert_args
192   (p_salary_cap_id                  in number
193   ,p_funding_source_code            in varchar2
194   ,p_start_date                     in date
195   ,p_end_date                       in date
196   ,p_currency_code                  in varchar2
197   ,p_annual_salary_cap              in number
198   ,p_object_version_number          in number
199   ,p_seed_flag                      in varchar2
200   )
201   Return g_rec_type is
202 --
203   l_rec   g_rec_type;
204 --
205 Begin
206   --
207   -- Convert arguments into local l_rec structure.
208   --
209   l_rec.salary_cap_id                    := p_salary_cap_id;
210   l_rec.funding_source_code              := p_funding_source_code;
211   l_rec.start_date                       := p_start_date;
212   l_rec.end_date                         := p_end_date;
213   l_rec.currency_code                    := p_currency_code;
214   l_rec.annual_salary_cap                := p_annual_salary_cap;
215   l_rec.object_version_number            := p_object_version_number;
216   l_rec.seed_flag                        := p_seed_flag;
217   --
218   -- Return the plsql record structure.
219   --
220   Return(l_rec);
221 --
222 End convert_args;
223 --
224 end psp_psc_shd;