DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_RFP_SHD

Source


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