DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SEU_SHD

Source


1 Package Body pay_seu_shd as
2 /* $Header: pyseurhi.pkb 115.3 2003/02/05 17:11:00 arashid noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_seu_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 = 'PAY_SHADOW_ELE_TYPE_USAGES_FK1') 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 = 'PAY_SHADOW_ELE_TYPE_USAGES_FK2') 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   ElsIf (p_constraint_name = 'PAY_SHADOW_ELE_TYPE_USAGES_PK') Then
32     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   Else
37     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
40     fnd_message.raise_error;
41   End If;
42   --
43 End constraint_error;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |-----------------------------< api_updating >-----------------------------|
47 -- ----------------------------------------------------------------------------
48 Function api_updating
49   (p_element_type_usage_id                in     number
50   ,p_object_version_number                in     number
51   )
52   Return Boolean Is
53 --
54   --
55   -- Cursor selects the 'current' row from the HR Schema
56   --
57   Cursor C_Sel1 is
58     select
59        element_type_usage_id
60       ,element_type_id
61       ,inclusion_flag
62       ,run_type_name
63       ,exclusion_rule_id
64       ,object_version_number
65     from	pay_shadow_ele_type_usages
66     where	element_type_usage_id = p_element_type_usage_id;
67 --
68   l_fct_ret	boolean;
69 --
70 Begin
71   --
72   If (p_element_type_usage_id is null and
73       p_object_version_number is null
74      ) Then
75     --
76     -- One of the primary key arguments is null therefore we must
77     -- set the returning function value to false
78     --
79     l_fct_ret := false;
80   Else
81     If (p_element_type_usage_id
82         = pay_seu_shd.g_old_rec.element_type_usage_id and
83         p_object_version_number
84         = pay_seu_shd.g_old_rec.object_version_number
85        ) Then
86       --
87       -- The g_old_rec is current therefore we must
88       -- set the returning function to true
89       --
90       l_fct_ret := true;
91     Else
92       --
93       -- Select the current row into g_old_rec
94       --
95       Open C_Sel1;
96       Fetch C_Sel1 Into pay_seu_shd.g_old_rec;
97       If C_Sel1%notfound Then
98         Close C_Sel1;
99         --
100         -- The primary key is invalid therefore we must error
101         --
102         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
103         fnd_message.raise_error;
104       End If;
105       Close C_Sel1;
106       If (p_object_version_number
107           <> pay_seu_shd.g_old_rec.object_version_number) Then
108         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
109         fnd_message.raise_error;
110       End If;
111       l_fct_ret := true;
112     End If;
113   End If;
114   Return (l_fct_ret);
115 --
116 End api_updating;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |---------------------------------< lck >----------------------------------|
120 -- ----------------------------------------------------------------------------
121 Procedure lck
122   (p_element_type_usage_id                in     number
123   ,p_object_version_number                in     number
124   ) is
125 --
126 -- Cursor selects the 'current' row from the HR Schema
127 --
128   Cursor C_Sel1 is
129     select
130        element_type_usage_id
131       ,element_type_id
132       ,inclusion_flag
133       ,run_type_name
134       ,exclusion_rule_id
135       ,object_version_number
136     from	pay_shadow_ele_type_usages
137     where	element_type_usage_id = p_element_type_usage_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           => 'OBJECT_VERSION_NUMBER'
148     ,p_argument_value     => p_object_version_number
149     );
150   hr_api.mandatory_arg_error
151     (p_api_name           => l_proc
152     ,p_argument           => 'ELEMENT_TYPE_USAGE_ID'
153     ,p_argument_value     => p_element_type_usage_id
154     );
155   --
156   Open  C_Sel1;
157   Fetch C_Sel1 Into pay_seu_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       <> pay_seu_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', 'pay_shadow_ele_type_usages');
185     fnd_message.raise_error;
186 End lck;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< convert_args >-----------------------------|
190 -- ----------------------------------------------------------------------------
191 Function convert_args
192   (p_element_type_usage_id          in number
193   ,p_element_type_id                in number
194   ,p_inclusion_flag                 in varchar2
195   ,p_run_type_name                  in varchar2
196   ,p_exclusion_rule_id              in number
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.element_type_usage_id            := p_element_type_usage_id;
208   l_rec.element_type_id                  := p_element_type_id;
209   l_rec.inclusion_flag                   := p_inclusion_flag;
210   l_rec.run_type_name                    := p_run_type_name;
211   l_rec.exclusion_rule_id                := p_exclusion_rule_id;
212   l_rec.object_version_number            := p_object_version_number;
213   --
214   -- Return the plsql record structure.
215   --
216   Return(l_rec);
217 --
218 End convert_args;
219 --
220 end pay_seu_shd;