DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGW_BUDGETS_PUB

Source


1 PACKAGE BODY Igw_Budgets_Pub AS
2 --$Header: igwpbvsb.pls 115.0 2002/12/19 22:43:48 ashkumar noship $
3 
4    ---------------------------------------------------------------------------
5 
6    G_PKG_NAME  VARCHAR2(30) := 'IGW_BUDGETS_PUB';
7 
8    ---------------------------------------------------------------------------
9 
10    PROCEDURE Get_Oh_Rate_Class_Id
11    (
12       p_oh_rate_class_name IN VARCHAR2,
13       x_oh_rate_class_id   OUT NOCOPY VARCHAR2
14    ) IS
15    BEGIN
16 
17       IF p_oh_rate_class_name IS NOT NULL THEN
18 
19          SELECT rate_class_id
20          INTO   x_oh_rate_class_id
21          FROM   igw_rate_classes
22          WHERE  description = p_oh_rate_class_name;
23 
24       END IF;
25 
26   EXCEPTION
27 
28       WHEN no_data_found THEN
29 
30          Fnd_Message.Set_Name('IGW','IGW_UPLD_OH_RATE_CLASS_INV');
31          Fnd_Msg_Pub.Add;
32 
33    END Get_Oh_Rate_Class_Id;
34 
35    ---------------------------------------------------------------------------
36 
37    PROCEDURE Create_Budget_Version
38    (
39       p_validate_only                IN VARCHAR2,
40       p_commit                       IN VARCHAR2,
41       p_proposal_number              IN VARCHAR2,
42       p_start_date                   IN DATE,
43       p_end_date                     IN DATE,
44       p_oh_rate_class_name           IN VARCHAR2,
45       p_proposal_form_number         IN VARCHAR2,
46       p_total_cost_limit             IN NUMBER,
47       p_total_cost                   IN NUMBER,
48       p_total_direct_cost            IN NUMBER,
49       p_total_indirect_cost          IN NUMBER,
50       p_cost_sharing_amount          IN NUMBER,
51       p_underrecovery_amount         IN NUMBER,
52       p_residual_funds               IN NUMBER,
53       p_final_version_flag           IN VARCHAR2,
54       p_enter_budget_at_period_level IN VARCHAR2,
55       p_apply_inflation_setup_rates  IN VARCHAR2,
56       p_apply_eb_setup_rates         IN VARCHAR2,
57       p_apply_oh_setup_rates         IN VARCHAR2,
58       p_comments                     IN VARCHAR2,
59       x_return_status                OUT NOCOPY VARCHAR2,
60       x_msg_count                    OUT NOCOPY NUMBER,
61       x_msg_data                     OUT NOCOPY VARCHAR2
62    ) IS
63 
64       l_api_name  CONSTANT  VARCHAR2(30) := 'Create_Budget_Version';
65       l_rowid               VARCHAR2(60);
66       l_proposal_id         IGW_PROPOSALS_ALL.PROPOSAL_ID%TYPE;
67       l_oh_rate_class_id    IGW_BUDGETS.OH_RATE_CLASS_ID%TYPE;
68 
69    BEGIN
70 
71       /*
72       **   Establish Savepoint for Rollback
73       */
74 
75       SAVEPOINT Create_Budget_Version_Pub;
76 
77       /*
78       **   Initialize Processing
79       */
80 
81       x_return_status := Fnd_Api.G_Ret_Sts_Success;
82 
83       Fnd_Msg_Pub.Initialize;
84 
85       /*
86       **   Verify Mandatory Inputs. Value-Id Conversions.
87       */
88 
89       IF p_proposal_number IS NULL THEN
90 
91          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
92          Fnd_Message.Set_Token('PARAM_NAME','P_PROPOSAL_NUMBER');
93          Fnd_Msg_Pub.Add;
94 
95       ELSE
96 
97          Igw_Utils.Get_Proposal_Id
98          (
99             p_context_field    => 'PROPOSAL_ID',
100             p_check_id_flag    => 'N',
101             p_proposal_number  => p_proposal_number,
102             p_proposal_id      => l_proposal_id,
103             x_proposal_id      => l_proposal_id,
104             x_return_status    => x_return_status
105          );
106 
107       END IF;
108 
109       IF p_start_date IS NULL THEN
110 
111          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
112          Fnd_Message.Set_Token('PARAM_NAME','P_START_DATE');
113          Fnd_Msg_Pub.Add;
114 
115       END IF;
116 
117       IF p_end_date IS NULL THEN
118 
119          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
120          Fnd_Message.Set_Token('PARAM_NAME','P_END_DATE');
121          Fnd_Msg_Pub.Add;
122 
123       END IF;
124 
125       IF p_oh_rate_class_name IS NULL THEN
126 
127          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
128          Fnd_Message.Set_Token('PARAM_NAME','P_OH_RATE_CLASS_NAME');
129          Fnd_Msg_Pub.Add;
130 
131       ELSE
132 
133          Get_Oh_Rate_Class_Id
134          (
135             p_oh_rate_class_name => p_oh_rate_class_name,
136             x_oh_rate_class_id   => l_oh_rate_class_id
137          );
138 
139       END IF;
140 
141       IF p_proposal_form_number IS NULL THEN
142 
143          Fnd_Message.Set_Name('IGW','IGW_UPLD_MISSING_PARAMETER');
144          Fnd_Message.Set_Token('PARAM_NAME','P_PROPOSAL_FORM_NUMBER');
145          Fnd_Msg_Pub.Add;
146 
147       END IF;
148 
149       IF p_final_version_flag NOT IN ('N','Y') THEN
150 
154 
151          Fnd_Message.Set_Name('IGW','IGW_UPLD_INVALID_FLAG');
152          Fnd_Message.Set_Token('PARAM_NAME','P_FINAL_VERSION_FLAG');
153          Fnd_Msg_Pub.Add;
155       END IF;
156 
157       IF p_enter_budget_at_period_level NOT IN ('N','Y') THEN
158 
159          Fnd_Message.Set_Name('IGW','IGW_UPLD_INVALID_FLAG');
160          Fnd_Message.Set_Token('PARAM_NAME','P_ENTER_BUDGET_AT_PERIOD_LEVEL');
161          Fnd_Msg_Pub.Add;
162 
163       END IF;
164 
165       IF p_apply_inflation_setup_rates NOT IN ('N','Y') THEN
166 
167          Fnd_Message.Set_Name('IGW','IGW_UPLD_INVALID_FLAG');
168          Fnd_Message.Set_Token('PARAM_NAME','P_APPLY_INFLATION_SETUP_RATES');
169          Fnd_Msg_Pub.Add;
170 
171       END IF;
172 
173       IF p_apply_eb_setup_rates NOT IN ('N','Y') THEN
174 
175          Fnd_Message.Set_Name('IGW','IGW_UPLD_INVALID_FLAG');
176          Fnd_Message.Set_Token('PARAM_NAME','P_APPLY_EB_SETUP_RATES');
177          Fnd_Msg_Pub.Add;
178 
179       END IF;
180 
181       IF p_apply_oh_setup_rates NOT IN ('N','Y') THEN
182 
183          Fnd_Message.Set_Name('IGW','IGW_UPLD_INVALID_FLAG');
184          Fnd_Message.Set_Token('PARAM_NAME','P_APPLY_OH_SETUP_RATES');
185          Fnd_Msg_Pub.Add;
186 
187       END IF;
188 
189       /*
190       **   Discontinue processing if any error has been encountered during
191       **   the earlier stages
192       */
193 
194       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
195 
196          RAISE Fnd_Api.G_Exc_Error;
197 
198       END IF;
199 
200       Igw_Budgets_Pvt.Create_Budget_Version
201       (
202          p_init_msg_list                => Fnd_Api.G_True,
203          p_commit                       => Fnd_Api.G_False,
204          p_validate_only                => p_validate_only,
205          p_proposal_id                  => l_proposal_id,
206          p_version_id                   => null,
207          p_start_date                   => p_start_date,
208          p_end_date                     => p_end_date,
209          p_total_cost                   => p_total_cost,
210          p_total_direct_cost            => p_total_direct_cost,
211          p_total_indirect_cost          => p_total_indirect_cost,
212          p_cost_sharing_amount          => p_cost_sharing_amount,
213          p_underrecovery_amount         => p_underrecovery_amount,
214          p_residual_funds               => p_residual_funds,
215          p_total_cost_limit             => p_total_cost_limit,
216          p_oh_rate_class_id             => l_oh_rate_class_id,
217          p_oh_rate_class_name           => null,
218          p_proposal_form_number         => p_proposal_form_number,
219          p_comments                     => p_comments,
220          p_final_version_flag           => p_final_version_flag,
221          p_budget_type_code             => 'PROPOSAL_BUDGET',
222          p_enter_budget_at_period_level => p_enter_budget_at_period_level,
223          p_apply_inflation_setup_rates  => p_apply_inflation_setup_rates,
224          p_apply_eb_setup_rates         => p_apply_eb_setup_rates,
225          p_apply_oh_setup_rates         => p_apply_oh_setup_rates,
226          p_attribute_category           => null,
227          p_attribute1                   => null,
228          p_attribute2                   => null,
229          p_attribute3                   => null,
230          p_attribute4                   => null,
231          p_attribute5                   => null,
232          p_attribute6                   => null,
233          p_attribute7                   => null,
234          p_attribute8                   => null,
235          p_attribute9                   => null,
236          p_attribute10                  => null,
237          p_attribute11                  => null,
238          p_attribute12                  => null,
239          p_attribute13                  => null,
240          p_attribute14                  => null,
241          p_attribute15                  => null,
242          x_rowid                        => l_rowid,
243          x_return_status                => x_return_status,
244          x_msg_count                    => x_msg_count,
245          x_msg_data                     => x_msg_data
246       );
247 
248       IF Fnd_Msg_Pub.Count_Msg > 0 THEN
249 
250          RAISE Fnd_Api.G_Exc_Error;
251 
252       END IF;
253 
254 
255       /*
256       **   Commit data if API invoked in commit mode
257       */
258 
259       IF Fnd_Api.To_Boolean(p_commit) THEN
260 
261          COMMIT;
262 
263       END IF;
264 
265    EXCEPTION
266 
267       WHEN Fnd_Api.G_Exc_Error THEN
268 
269          ROLLBACK TO Create_Budget_Version_Pub;
270 
271          x_return_status := Fnd_Api.G_Ret_Sts_Error;
272 
273          Fnd_Msg_Pub.Count_And_Get
274          (
275             p_encoded => Fnd_Api.G_False,
276             p_count   => x_msg_count,
277             p_data    => x_msg_data
278          );
279 
280       WHEN others THEN
281 
282          ROLLBACK TO Create_Budget_Version_Pub;
283 
284          x_return_status := Fnd_Api.G_Ret_Sts_Unexp_Error;
285 
286          Fnd_Msg_Pub.Add_Exc_Msg
287          (
288             p_pkg_name       => G_PKG_NAME,
289             p_procedure_name => l_api_name
290          );
291 
292          Fnd_Msg_Pub.Count_And_Get
293          (
294             p_encoded => Fnd_Api.G_False,
295             p_count   => x_msg_count,
296             p_data    => x_msg_data
297          );
298 
299    END Create_Budget_Version;
300 
301    ---------------------------------------------------------------------------
302 
303 END Igw_Budgets_Pub;