DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CPA_SHD

Source


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