DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_BGM_SHD

Source


1 Package Body pqh_bgm_shd as
2 /* $Header: pqbgmrhi.pkb 115.3 2002/12/05 16:33:25 rpasapul ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_bgm_shd.';  -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17   l_proc 	varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   hr_utility.set_location('Entering:'||l_proc, 5);
21   --
22   If (p_constraint_name = 'PQH_BUDGET_GL_FLEX_MAPS_PK') Then
23     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
24     hr_utility.set_message_token('PROCEDURE', l_proc);
25     hr_utility.set_message_token('STEP','5');
26     hr_utility.raise_error;
27   ElsIf (p_constraint_name = 'PQH_BUDGET_GL_FLEX_MAPS_UK') Then
28     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
29     hr_utility.set_message_token('PROCEDURE', l_proc);
30     hr_utility.set_message_token('STEP','10');
31     hr_utility.raise_error;
32   Else
33     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
34     hr_utility.set_message_token('PROCEDURE', l_proc);
35     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
36     hr_utility.raise_error;
37   End If;
38   --
39   hr_utility.set_location(' Leaving:'||l_proc, 10);
40 End constraint_error;
41 --
42 -- ----------------------------------------------------------------------------
43 -- |-----------------------------< api_updating >-----------------------------|
44 -- ----------------------------------------------------------------------------
45 Function api_updating
46   (
47   p_budget_gl_flex_map_id              in number,
48   p_object_version_number              in number
49   )      Return Boolean Is
50 --
51   --
52   -- Cursor selects the 'current' row from the HR Schema
53   --
54   Cursor C_Sel1 is
55     select
56 		budget_gl_flex_map_id,
57 	budget_id,
58 	gl_account_segment,
59 	payroll_cost_segment,
60 	object_version_number
61     from	pqh_budget_gl_flex_maps
62     where	budget_gl_flex_map_id = p_budget_gl_flex_map_id;
63 --
64   l_proc	varchar2(72)	:= g_package||'api_updating';
65   l_fct_ret	boolean;
66 --
67 Begin
68   hr_utility.set_location('Entering:'||l_proc, 5);
69   --
70   If (
71 	p_budget_gl_flex_map_id is null and
72 	p_object_version_number is null
73      ) Then
74     --
75     -- One of the primary key arguments is null therefore we must
76     -- set the returning function value to false
77     --
78     l_fct_ret := false;
79   Else
80     If (
81 	p_budget_gl_flex_map_id = g_old_rec.budget_gl_flex_map_id and
82 	p_object_version_number = g_old_rec.object_version_number
83        ) Then
84       hr_utility.set_location(l_proc, 10);
85       --
86       -- The g_old_rec is current therefore we must
87       -- set the returning function to true
88       --
89       l_fct_ret := true;
90     Else
91       --
92       -- Select the current row into g_old_rec
93       --
94       Open C_Sel1;
95       Fetch C_Sel1 Into g_old_rec;
96       If C_Sel1%notfound Then
97         Close C_Sel1;
98         --
99         -- The primary key is invalid therefore we must error
100         --
101         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
102         hr_utility.raise_error;
103       End If;
104       Close C_Sel1;
105       If (p_object_version_number <> g_old_rec.object_version_number) Then
106         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
107         hr_utility.raise_error;
108       End If;
109       hr_utility.set_location(l_proc, 15);
110       l_fct_ret := true;
111     End If;
112   End If;
113   hr_utility.set_location(' Leaving:'||l_proc, 20);
114   Return (l_fct_ret);
115 --
116 End api_updating;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |---------------------------------< lck >----------------------------------|
120 -- ----------------------------------------------------------------------------
121 Procedure lck
122   (
123   p_budget_gl_flex_map_id              in number,
124   p_object_version_number              in number
125   ) is
126 --
127 -- Cursor selects the 'current' row from the HR Schema
128 --
129   Cursor C_Sel1 is
130     select 	budget_gl_flex_map_id,
131 	budget_id,
132 	gl_account_segment,
133 	payroll_cost_segment,
134 	object_version_number
135     from	pqh_budget_gl_flex_maps
136     where	budget_gl_flex_map_id = p_budget_gl_flex_map_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   -- Add any mandatory argument checking here:
145   -- Example:
146   -- hr_api.mandatory_arg_error
147   --   (p_api_name       => l_proc,
148   --    p_argument       => 'object_version_number',
149   --    p_argument_value => p_object_version_number);
150   --
151   Open  C_Sel1;
152   Fetch C_Sel1 Into 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     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
159     hr_utility.raise_error;
160   End If;
161   Close C_Sel1;
162   If (p_object_version_number <> g_old_rec.object_version_number) Then
163         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
164         hr_utility.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     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
178     hr_utility.set_message_token('TABLE_NAME', 'pqh_budget_gl_flex_maps');
179     hr_utility.raise_error;
180 End lck;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------------< convert_args >-----------------------------|
184 -- ----------------------------------------------------------------------------
185 Function convert_args
186 	(
187 	p_budget_gl_flex_map_id         in number,
188 	p_budget_id                     in number,
189 	p_gl_account_segment            in varchar2,
190 	p_payroll_cost_segment          in varchar2,
191 	p_object_version_number         in number
192 	)
193 	Return g_rec_type is
194 --
195   l_rec	  g_rec_type;
196   l_proc  varchar2(72) := g_package||'convert_args';
197 --
198 Begin
199   --
200   hr_utility.set_location('Entering:'||l_proc, 5);
201   --
202   -- Convert arguments into local l_rec structure.
203   --
204   l_rec.budget_gl_flex_map_id            := p_budget_gl_flex_map_id;
205   l_rec.budget_id                        := p_budget_id;
206   l_rec.gl_account_segment               := p_gl_account_segment;
207   l_rec.payroll_cost_segment             := p_payroll_cost_segment;
208   l_rec.object_version_number            := p_object_version_number;
209   --
210   -- Return the plsql record structure.
211   --
212   hr_utility.set_location(' Leaving:'||l_proc, 10);
213   Return(l_rec);
214 --
215 End convert_args;
216 --
217 end pqh_bgm_shd;