[Home] [Help]
PACKAGE BODY: APPS.GMF_RESOURCECOST_PUB
Source
1 PACKAGE BODY GMF_ResourceCost_PUB AS
2 /* $Header: GMFPRESB.pls 120.7 2012/01/24 12:35:04 smukalla ship $ */
3
4 /* Start of comments
5 --+==========================================================================+
6 --| Copyright (c) 1998 Oracle Corporation |
7 --| Redwood Shores, CA, USA |
8 --| All rights reserved. |
9 --+==========================================================================+
10 --| File Name : GMFPRESB.pls |
11 --| Package Name : GMF_ResourceCost_PUB |
12 --| API name : GMF_ResourceCost_PUB |
13 --| Type : Public |
14 --| Pre-reqs : N/A |
15 --| Function : Allocation Definition creation, updatation and |
16 --| deletetion. |
17 --| Parameters : N/A |
18 --| |
19 --| Current Vers : 2.0 |
20 --| Previous Vers : 1.0 |
21 --| Initial Vers : 1.0 |
22 --| |
23 --| Contents |
24 --| Create_Resource_Cost |
25 --| Update_Resource_Cost |
26 --| Delete_Resource_Cost |
27 --| |
28 --| Notes |
29 --| This package contains public procedures relating to Resource Cost |
30 --| creation, updatation and deletetion. |
31 --| |
32 --| |
33 --| Pre-defined API message levels |
34 --| |
35 --| Valid values for message levels are from 1-50. |
36 --| 1 being least severe and 50 highest. |
37 --| |
38 --| The pre-defined levels correspond to standard API |
39 --| return status. Debug levels are used to control the amount of |
40 --| debug information a program writes to the PL/SQL message table. |
41 --| |
42 --| G_MSG_LVL_UNEXP_ERROR CONSTANT NUMBER := 60; |
43 --| G_MSG_LVL_ERROR CONSTANT NUMBER := 50; |
44 --| G_MSG_LVL_SUCCESS CONSTANT NUMBER := 40; |
45 --| G_MSG_LVL_DEBUG_HIGH CONSTANT NUMBER := 30; |
46 --| G_MSG_LVL_DEBUG_MEDIUM CONSTANT NUMBER := 20; |
47 --| G_MSG_LVL_DEBUG_LOW CONSTANT NUMBER := 10; |
48 --| |
49 --| HISTORY |
50 --| 27/Feb/2001 Uday Moogala Created Bug# 1418689 |
51 --| |
52 --| 05/NOV/2002 Uday Moogala Bug# 2659435 |
53 --| Performance related fixes. |
54 --| 1. remove G_MISS_xxx assignments. |
55 --| 2. Conditionally calling debug routine. |
56 --| Also, fixed issues found during unit testing. Search for the bug |
57 --| number to find the fixes. |
58 --| 30-OCT-2002 RajaSekhar Bug#2641405 Added NOCOPY hint |
59 --| 21/NOV/2002 Uday Moogala Bug# 2681243 |
60 --| 1. Return value of GMA_GLOBAL_GRP.set_who has changed to -1 from 0 |
61 --| in case of invalid users. |
62 --| 2. Removed "when others" section in validate_input_params |
63 --| 03/Dec/2002 Uday Moogala Bug# 2692459 |
64 --| Modified code to verify for same usage um type as rsrc um type. |
65 --| 13/May/2004 Dinesh Vadivel Bug# 3628252 |
66 --| Removed validation for nominal cost in VALIDATE_INPUT_PARAMS |
67 --| so that it takes negative entries |
68 --| 19-sep-2005 Prasad marada Inventory convergence modification, adding|
69 --| legal entity, organization id, period id, |
70 --| cost_type_id,usage_uom coulmns |
71 08-APR-2011 Uday Phadtare. Bug 12333658. Modified code in Validate_Input_Params(). Do not raise ERROR even
72 though both organization_id and organization_code are NULL because organization_id in CM_RSRC_DTL is not mandatory.
73 --| 28-Apr-2011 Pramod B.H. Bug# 12404853
74 --| Modified cursor Cur_rsrc_dtl in function check_records_exist to |
75 --| handle the condition of Organization_id not mandatory in cm_rsrc_dtl|
76 --| 24-12-2011 Smukalla Bug13617803: Modified code to call the procedure, add_header_to_error_stack when
77 --| check_records_exist returns FALSE
78 --+==========================================================================+
79 End of comments */
80
81
82
83 PROCEDURE Validate_Input_Params
84 (
85 p_rsrc_cost_rec IN Resource_Cost_Rec_Type
86 ,x_rsrc_cost_rec OUT NOCOPY Resource_Cost_Rec_Type
87 ,x_user_id OUT NOCOPY NUMBER
88 ,x_return_status OUT NOCOPY VARCHAR2
89 ) ;
90 --
91 -- Modified the function parameter as per the inventory convergence
92 FUNCTION check_records_exist
93 (
94 p_legal_entity_id cm_rsrc_dtl.legal_entity_id%TYPE,
95 p_organization_id cm_rsrc_dtl.organization_id%TYPE,
96 p_resources cm_rsrc_dtl.resources%TYPE,
97 p_period_id cm_rsrc_dtl.period_id%TYPE,
98 p_cost_type_id cm_rsrc_dtl.cost_type_id%TYPE
99 )
100
101 RETURN BOOLEAN ;
102 --
103 PROCEDURE log_msg -- Bug 2659435: Removed first param for debug level
104 (
105 p_msg_text IN VARCHAR2
106 );
107 --
108 -- Bug 2659435: Added new procedure to log header message
109 PROCEDURE add_header_to_error_stack
110 (
111 p_header Resource_Cost_Rec_Type
112 );
113 --
114
115
116 -- Global variables
117 G_PKG_NAME CONSTANT VARCHAR2(30) := 'GMF_ResourceCost_PUB';
118
119 -- Bug 2659435
120 G_operation VARCHAR2(30); -- values will be Insert, Update or Delete
121 G_tmp BOOLEAN := FND_MSG_PUB.Check_Msg_Level(0) ; -- temp call to initialize the
122 -- msg level threshhold gobal
123 -- variable.
124 G_debug_level NUMBER(2) := FND_MSG_PUB.G_Msg_Level_Threshold; -- Use this variable everywhere
125 -- to decide to log a debug msg.
126 G_header_logged VARCHAR2(1); -- to indicate whether header is already in
127 -- error stack or not - avoid logging duplicate headers
128
129
130 --Start of comments
131 --+========================================================================+
132 --| API Name : Create_Resource_Cost |
133 --| TYPE : Public |
134 --| Function : Creates a new Resource Cost based on the input |
135 --| into table CM_RSRC_DTL |
136 --| Pre-reqa : None. |
137 --| Parameters : |
138 --| IN : |
139 --| p_api_version IN NUMBER - Required |
140 --| p_init_msg_list IN VARCHAR2 - Optional |
141 --| p_commit IN VARCHAR2 - Optional |
142 --| p_resource_cost_rec IN Resource_Cost_Rec_Type |
143 --| OUT : |
144 --| x_return_status OUT VARCHAR2 |
145 --| x_msg_count OUT NUMBER |
146 --| x_msg_data OUT VARCHAR2 |
147 --| |
148 --| Version : |
149 --| Current Version : 2.0 |
150 --| Previous Version : 1.0 |
151 --| Initial Version : 1.0 |
152 --| |
153 --| Notes : |
154 --| |
155 --| HISTORY |
156 --| 01-Mar-01 Uday Moogala - Created |
157 --| |
158 --+========================================================================+
159 -- End of comments
160
161 PROCEDURE Create_Resource_Cost
162 ( p_api_version IN NUMBER ,
163 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
164 p_commit IN VARCHAR2 := FND_API.G_FALSE ,
165
166 x_return_status OUT NOCOPY VARCHAR2 ,
167 x_msg_count OUT NOCOPY NUMBER ,
168 x_msg_data OUT NOCOPY VARCHAR2 ,
169
170 p_resource_cost_rec IN Resource_Cost_Rec_Type
171 )
172 IS
173 l_api_name CONSTANT VARCHAR2(30) := 'Create_Resource_Cost' ;
174 l_api_version CONSTANT NUMBER := 2.0 ;
175
176 l_rsrc_cost_rec Resource_Cost_Rec_Type ;
177 l_return_status VARCHAR2(2) ;
178 l_user_id NUMBER ;--fnd_user.user_id%TYPE ;
179 l_count NUMBER(10) ;
180 l_data VARCHAR2(2000) ;
181 l_no_rows_ins NUMBER(10) ;
182
183 BEGIN
184
185 -- Standard Start of API savepoint
186 SAVEPOINT Create_Alloc_Definition_PUB;
187
188 -- Initialize message list if p_init_msg_list is set to TRUE.
189 IF FND_API.to_Boolean( p_init_msg_list ) THEN
190 FND_MSG_PUB.initialize;
191 END IF;
192
193 -- Standard call to check for call compatibility.
194 IF NOT FND_API.Compatible_API_Call ( l_api_version ,
195 p_api_version ,
196 l_api_name ,
197 G_PKG_NAME )
198 THEN
199 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
200 END IF;
201
202 -- Initialize API return status to success
203 x_return_status := FND_API.G_RET_STS_SUCCESS;
204
205 G_operation := 'INSERT'; -- Bug 2659435
206 G_header_logged := 'N'; -- to avoid logging duplicate header for errors
207
208 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
209 log_msg('Validating input parameters');
210 END IF;
211 -- Validate all the input parameters.
212 VALIDATE_INPUT_PARAMS
213 (p_rsrc_cost_rec => p_resource_cost_rec
214 ,x_rsrc_cost_rec => l_rsrc_cost_rec
215 ,x_user_id => l_user_id
216 ,x_return_status => l_return_status) ;
217
218 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
219 log_msg('Return Status after validating : ' || l_return_status);
220 END IF;
221
222
223 -- Return if validation failures detected
224 IF l_return_status = FND_API.G_RET_STS_ERROR
225 THEN
226 RAISE FND_API.G_EXC_ERROR;
227 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
228 THEN
229 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
230 END IF;
231
232 --
233 -- Check for duplicate record.
234 --
235 IF check_records_exist(p_legal_entity_id => l_rsrc_cost_rec.legal_entity_id,
236 p_organization_id => l_rsrc_cost_rec.organization_id,
237 p_resources => l_rsrc_cost_rec.resources,
238 p_period_id => l_rsrc_cost_rec.period_id,
239 p_cost_type_id => l_rsrc_cost_rec.cost_type_id) THEN
240 add_header_to_error_stack(p_resource_cost_rec); -- Bug13617803
241 FND_MESSAGE.SET_NAME('GMF','GMF_API_DUPLICATE_RES_COST');
242 FND_MESSAGE.SET_TOKEN('RESOURCES',l_rsrc_cost_rec.resources);
243 FND_MESSAGE.SET_TOKEN('LEGAL_ENTITY_ID',l_rsrc_cost_rec.legal_entity_id);
244 FND_MESSAGE.SET_TOKEN('ORGANIZATION_ID',l_rsrc_cost_rec.organization_id);
245 FND_MESSAGE.SET_TOKEN('PERIOD_ID',l_rsrc_cost_rec.period_id);
246 FND_MESSAGE.SET_TOKEN('COST_TYPE_ID',l_rsrc_cost_rec.cost_type_id);
247 FND_MSG_PUB.Add;
248 RAISE FND_API.G_EXC_ERROR;
249 END IF;
250
251 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
252 log_msg('Inserting record for resource : ' || l_rsrc_cost_rec.resources ||
253 ' Legal entity id ' || l_rsrc_cost_rec.legal_entity_id ||
254 ' Organization Id ' || l_rsrc_cost_rec.organization_id ||
255 ' Period Id ' || l_rsrc_cost_rec.Period_id ||
256 ' Cost type Id ' || l_rsrc_cost_rec.cost_type_id);
257
258 END IF;
259
260 -- call to private API to insert to record
261 GMF_ResourceCost_PVT.Create_Resource_Cost
262 ( p_api_version => 2.0
263 , p_init_msg_list => FND_API.G_FALSE
264 , p_commit => FND_API.G_FALSE
265
266 , x_return_status => l_return_status
267 , x_msg_count => l_count
268 , x_msg_data => l_data
269
270 , p_resource_cost_rec => l_rsrc_cost_rec
271 , p_user_id => l_user_id
272 );
273 -- created row count
274 l_no_rows_ins := SQL%ROWCOUNT ;
275 -- Return in case of insert fails
276 IF l_return_status = FND_API.G_RET_STS_ERROR
277 THEN
278 RAISE FND_API.G_EXC_ERROR;
279 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
280 THEN
281 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
282 END IF;
283
284 add_header_to_error_stack(p_resource_cost_rec); -- Bug 2659435
285 FND_MESSAGE.SET_NAME('GMF','GMF_API_ROWS_INS');
286 FND_MESSAGE.SET_TOKEN('NUM_ROWS',l_no_rows_ins);
287 FND_MSG_PUB.Add;
288
289 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
290 log_msg('1 row inserted');
291 END IF;
292
293 -- Standard check of p_commit.
294 IF FND_API.To_Boolean( p_commit ) THEN
295 COMMIT WORK;
296 END IF;
297
298 -- Standard call to get message count and if count is 1, get message info.
299 FND_MSG_PUB.Count_And_Get
300 ( p_count => x_msg_count ,
301 p_data => x_msg_data
302 );
303
304 EXCEPTION
305 WHEN FND_API.G_EXC_ERROR THEN
306 ROLLBACK TO Create_Alloc_Definition_PUB;
307 x_return_status := FND_API.G_RET_STS_ERROR ;
308 FND_MSG_PUB.Count_And_Get
309 ( p_count => x_msg_count ,
310 p_data => x_msg_data
311 );
312 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
313 ROLLBACK TO Create_Alloc_Definition_PUB;
314 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
315 FND_MSG_PUB.Count_And_Get
316 ( p_count => x_msg_count ,
317 p_data => x_msg_data
318 );
319 WHEN OTHERS THEN
320 ROLLBACK TO Create_Alloc_Definition_PUB;
321 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
322 IF FND_MSG_PUB.Check_Msg_Level
323 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
324 THEN
325 FND_MSG_PUB.Add_Exc_Msg
326 ( G_PKG_NAME ,
327 l_api_name
328 );
329 END IF;
330 FND_MSG_PUB.Count_And_Get
331 ( p_count => x_msg_count ,
332 p_data => x_msg_data
333 );
334
335 END Create_Resource_Cost;
336
337
338 --Start of comments
339 --+========================================================================+
340 --| API Name : Update_Resource_Cost |
341 --| TYPE : Public |
342 --| Function : Updates Allocation Definition based on the input |
343 --| into GL_ALOC_BAS |
344 --| Pre-reqa : None. |
345 --| Parameters : |
346 --| IN : |
347 --| p_api_version IN NUMBER - Required |
348 --| p_init_msg_list IN VARCHAR2 - Optional |
349 --| p_commit IN VARCHAR2 - Optional |
350 --| p_resource_cost_rec IN Resource_Cost_Rec_Type |
351 --| OUT : |
352 --| x_return_status OUT VARCHAR2 |
353 --| x_msg_count OUT NUMBER |
354 --| x_msg_data OUT VARCHAR2 |
355 --| |
356 --| Version : |
357 --| Current Version : 2.0 |
358 --| Previous Version : 1.0 |
359 --| Initial Version : 1.0 |
360 --| |
361 --| Notes : |
362 --| |
363 --| HISTORY |
364 --| 01-Mar-01 Uday Moogala - Created |
365 --| |
366 --+========================================================================+
367 -- End of comments
368
369 PROCEDURE Update_Resource_Cost
370 ( p_api_version IN NUMBER ,
371 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
372 p_commit IN VARCHAR2 := FND_API.G_FALSE ,
373
374 x_return_status OUT NOCOPY VARCHAR2 ,
375 x_msg_count OUT NOCOPY NUMBER ,
376 x_msg_data OUT NOCOPY VARCHAR2 ,
377
378 p_resource_cost_rec IN Resource_Cost_Rec_Type
379 )
380 IS
381 l_api_name CONSTANT VARCHAR2(30) := 'Update_Resource_Cost' ;
382 l_api_version CONSTANT NUMBER := 2.0 ;
383
384 l_rsrc_cost_rec Resource_Cost_Rec_Type ;
385 l_no_rows_upd NUMBER(10) ;
386 l_return_status VARCHAR2(2) ;
387 l_user_id fnd_user.user_id%TYPE ;
388 l_count NUMBER(10) ;
389 l_data VARCHAR2(2000) ;
390
391 BEGIN
392 -- Standard Start of API savepoint
393 SAVEPOINT Update_Alloc_Definition_PUB;
394
395 -- Initialize message list if p_init_msg_list is set to TRUE.
396 IF FND_API.to_Boolean( p_init_msg_list ) THEN
397 FND_MSG_PUB.initialize;
398 END IF;
399
400 -- Standard call to check for call compatibility.
401 IF NOT FND_API.Compatible_API_Call ( l_api_version ,
402 p_api_version ,
403 l_api_name ,
404 G_PKG_NAME )
405 THEN
406 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
407 END IF;
408
409 -- Initialize API return status to success
410 x_return_status := FND_API.G_RET_STS_SUCCESS;
411
412 G_operation := 'UPDATE'; -- Bug 2659435
413 G_header_logged := 'N'; -- to avoid logging duplicate header for errors
414
415 -- Validate all the input parameters.
416 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
417 log_msg('Validating input parameters');
418 END IF;
419
420 VALIDATE_INPUT_PARAMS
421 (p_rsrc_cost_rec => p_resource_cost_rec
422 ,x_rsrc_cost_rec => l_rsrc_cost_rec
423 ,x_user_id => l_user_id
424 ,x_return_status => l_return_status) ;
425
426 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
427 log_msg('Return Status after validating : ' || l_return_status);
428 END IF;
429
430 -- Return if validation failures detected
431 IF l_return_status = FND_API.G_RET_STS_ERROR
432 THEN
433 RAISE FND_API.G_EXC_ERROR;
434 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
435 THEN
436 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
437 END IF;
438
439 -- Check whether any records exists for update
440 IF NOT check_records_exist(p_legal_entity_id => l_rsrc_cost_rec.legal_entity_id,
441 p_organization_id => l_rsrc_cost_rec.organization_id,
442 p_resources => l_rsrc_cost_rec.resources,
443 p_period_id => l_rsrc_cost_rec.period_id,
444 p_cost_type_id => l_rsrc_cost_rec.cost_type_id) THEN
445 add_header_to_error_stack(p_resource_cost_rec); -- Bug13617803
446 FND_MESSAGE.SET_NAME('GMF','GMF_API_RSRC_NO_REC_FOUND');
447 FND_MESSAGE.SET_TOKEN('RESOURCES',l_rsrc_cost_rec.resources);
448 FND_MESSAGE.SET_TOKEN('LEGAL_ENTITY_ID',l_rsrc_cost_rec.legal_entity_id);
449 FND_MESSAGE.SET_TOKEN('ORGANIZATION_ID',l_rsrc_cost_rec.organization_id);
450 FND_MESSAGE.SET_TOKEN('PERIOD_ID',l_rsrc_cost_rec.period_id);
451 FND_MESSAGE.SET_TOKEN('COST_TYPE_ID',l_rsrc_cost_rec.cost_type_id);
452 FND_MSG_PUB.Add;
453 RAISE FND_API.G_EXC_ERROR;
454 END IF ;
455
456 IF l_rsrc_cost_rec.delete_mark = 1 THEN
457 add_header_to_error_stack(p_resource_cost_rec); -- Bug 2659435
458 FND_MESSAGE.SET_NAME('GMF','GMF_API_CANT_MARK_FOR_PURGE');
459 FND_MSG_PUB.Add;
460 RAISE FND_API.G_EXC_ERROR;
461 END IF ;
462
463 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
464 log_msg('Updating record for resource : ' || l_rsrc_cost_rec.resources ||
465 ' Legal entity id ' || l_rsrc_cost_rec.legal_entity_id ||
466 ' Organization Id ' || l_rsrc_cost_rec.organization_id ||
467 ' Period Id ' || l_rsrc_cost_rec.Period_id ||
468 ' Cost type Id ' || l_rsrc_cost_rec.cost_type_id);
469 END IF;
470 -- call to private API to insert to record
471 GMF_ResourceCost_PVT.Update_Resource_Cost
472 ( p_api_version => 2.0
473 , p_init_msg_list => FND_API.G_FALSE
474 , p_commit => FND_API.G_FALSE
475
476 , x_return_status => l_return_status
477 , x_msg_count => l_count
478 , x_msg_data => l_data
479
480 , p_Resource_Cost_rec => l_rsrc_cost_rec
481 , p_user_id => l_user_id
482 );
483 l_no_rows_upd := SQL%ROWCOUNT ;
484
485 -- Return in case of insert fails
486 IF l_return_status = FND_API.G_RET_STS_ERROR
487 THEN
488 RAISE FND_API.G_EXC_ERROR;
489 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
490 THEN
491 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
492 END IF;
493
494 add_header_to_error_stack(p_resource_cost_rec); -- Bug 2659435
495 FND_MESSAGE.SET_NAME('GMF','GMF_API_ROWS_UPD');
496 FND_MESSAGE.SET_TOKEN('NUM_ROWS',l_no_rows_upd);
497 FND_MSG_PUB.Add;
498
499 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
500 log_msg( l_no_rows_upd || ' rows updated.');
501 END IF;
502
503 -- Standard check of p_commit.
504 IF FND_API.To_Boolean( p_commit ) THEN
505 COMMIT WORK;
506 END IF;
507
508 -- Standard call to get message count and if count is 1, get message info.
509 FND_MSG_PUB.Count_And_Get
510 ( p_count => x_msg_count ,
511 p_data => x_msg_data
512 );
513
514 EXCEPTION
515 WHEN FND_API.G_EXC_ERROR THEN
516 ROLLBACK TO Update_Alloc_Definition_PUB;
517 x_return_status := FND_API.G_RET_STS_ERROR ;
518 FND_MSG_PUB.Count_And_Get
519 ( p_count => x_msg_count ,
520 p_data => x_msg_data
521 );
522 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
523 ROLLBACK TO Update_Alloc_Definition_PUB;
524 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
525 FND_MSG_PUB.Count_And_Get
526 ( p_count => x_msg_count ,
527 p_data => x_msg_data
528 );
529 WHEN OTHERS THEN
530 ROLLBACK TO Update_Alloc_Definition_PUB;
531 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
532 IF FND_MSG_PUB.Check_Msg_Level
533 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
534 THEN
535 FND_MSG_PUB.Add_Exc_Msg
536 ( G_PKG_NAME ,
537 l_api_name
538 );
539 END IF;
540 FND_MSG_PUB.Count_And_Get
541 ( p_count => x_msg_count ,
542 p_data => x_msg_data
543 );
544
545 END Update_Resource_Cost ;
546
547
548 --Start of comments
549 --+========================================================================+
550 --| API Name : Delete_Resource_Cost |
551 --| TYPE : Public |
552 --| Function : Deletes Resource Costs based on the input from CM_RSRC_MST|
553 --| Pre-reqa : None. |
554 --| Parameters : |
555 --| IN : |
556 --| p_api_version IN NUMBER - Required |
557 --| p_init_msg_list IN VARCHAR2 - Optional |
558 --| p_commit IN VARCHAR2 - Optional |
559 --| p_resource_cost_rec IN Resource_Cost_Rec_Type |
560 --| OUT : |
561 --| x_return_status OUT VARCHAR2 |
562 --| x_msg_count OUT NUMBER |
563 --| x_msg_data OUT VARCHAR2 |
564 --| |
565 --| Version : |
566 --| Current Version : 2.0 |
567 --| Previous Version : 1.0 |
568 --| Initial Version : 1.0 |
569 --| |
570 --| Notes : |
571 --| |
572 --| HISTORY |
573 --| 01-Mar-01 Uday Moogala - Created |
574 --| |
575 --+========================================================================+
576 -- End of comments
577
578 PROCEDURE Delete_Resource_Cost
579 ( p_api_version IN NUMBER ,
580 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
581 p_commit IN VARCHAR2 := FND_API.G_FALSE ,
582
583 x_return_status OUT NOCOPY VARCHAR2 ,
584 x_msg_count OUT NOCOPY NUMBER ,
585 x_msg_data OUT NOCOPY VARCHAR2 ,
586
587 p_resource_cost_rec IN Resource_Cost_Rec_Type
588 )
589 IS
590 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Resource_Cost' ;
591 l_api_version CONSTANT NUMBER := 2.0 ;
592
593 l_rsrc_cost_rec Resource_Cost_Rec_Type ;
594 l_no_rows_del NUMBER(10) ;
595 l_return_status VARCHAR2(2) ;
596 l_user_id fnd_user.user_id%TYPE ;
597 l_count NUMBER(10) ;
598 l_data VARCHAR2(2000) ;
599
600 BEGIN
601
602 -- Standard Start of API savepoint
603 SAVEPOINT Delete_Alloc_Definition_PUB;
604
605 -- Initialize message list if p_init_msg_list is set to TRUE.
606 IF FND_API.to_Boolean( p_init_msg_list ) THEN
607 FND_MSG_PUB.initialize;
608 END IF;
609
610 -- Standard call to check for call compatibility.
611 IF NOT FND_API.Compatible_API_Call ( l_api_version ,
612 p_api_version ,
613 l_api_name ,
614 G_PKG_NAME )
615 THEN
616 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
617 END IF;
618
619 -- Initialize API return status to success
620 x_return_status := FND_API.G_RET_STS_SUCCESS;
621
622 G_operation := 'DELETE'; -- Bug 2659435
623 G_header_logged := 'N'; -- to avoid logging duplicate header for errors
624
625 -- Validate all the input parameters.
626 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
627 log_msg('Validating input parameters');
628 END IF;
629
630 VALIDATE_INPUT_PARAMS
631 (p_rsrc_cost_rec => p_resource_cost_rec
632 ,x_rsrc_cost_rec => l_rsrc_cost_rec
633 ,x_user_id => l_user_id
634 ,x_return_status => l_return_status) ;
635
636 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
637 log_msg('Return Status after validating : ' || l_return_status);
638 END IF;
639
640 -- Return if validation failures detected
641 IF l_return_status = FND_API.G_RET_STS_ERROR
642 THEN
643 RAISE FND_API.G_EXC_ERROR;
644 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
645 THEN
646 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
647 END IF;
648
649 -- Check whether any records exists for update
650 IF NOT check_records_exist(p_legal_entity_id => l_rsrc_cost_rec.legal_entity_id,
651 p_organization_id => l_rsrc_cost_rec.organization_id,
652 p_resources => l_rsrc_cost_rec.resources,
653 p_period_id => l_rsrc_cost_rec.period_id,
654 p_cost_type_id => l_rsrc_cost_rec.cost_type_id) THEN
655 add_header_to_error_stack(p_resource_cost_rec); -- Bug13617803
656 FND_MESSAGE.SET_NAME('GMF','GMF_API_RSRC_NO_REC_FOUND');
657 FND_MESSAGE.SET_TOKEN('RESOURCES',l_rsrc_cost_rec.resources);
658 FND_MESSAGE.SET_TOKEN('LEGAL_ENTITY_ID',l_rsrc_cost_rec.legal_entity_id);
659 FND_MESSAGE.SET_TOKEN('ORGANIZATION_ID',l_rsrc_cost_rec.organization_id);
660 FND_MESSAGE.SET_TOKEN('PERIOD_ID',l_rsrc_cost_rec.period_id);
661 FND_MESSAGE.SET_TOKEN('COST_TYPE_ID',l_rsrc_cost_rec.cost_type_id);
662 FND_MSG_PUB.Add;
663 RAISE FND_API.G_EXC_ERROR;
664 END IF ;
665
666 -- set delete mark to 1 irrespective of users input.
667 l_rsrc_cost_rec.delete_mark := 1 ;
668
669 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
670 log_msg('Deleting record for resource : ' || l_rsrc_cost_rec.resources ||
671 ' Legal entity id ' || l_rsrc_cost_rec.legal_entity_id ||
672 ' Organization Id ' || l_rsrc_cost_rec.organization_id ||
673 ' Period Id ' || l_rsrc_cost_rec.Period_id ||
674 ' Cost type Id ' || l_rsrc_cost_rec.cost_type_id);
675 END IF;
676
677 -- call to private API to insert to record
678 GMF_ResourceCost_PVT.Update_Resource_Cost
679 ( p_api_version => 2.0
680 , p_init_msg_list => FND_API.G_FALSE
681 , p_commit => FND_API.G_FALSE
682
683 , x_return_status => l_return_status
684 , x_msg_count => l_count
685 , x_msg_data => l_data
686
687 , p_Resource_Cost_rec => l_rsrc_cost_rec
688 , p_user_id => l_user_id
689 );
690 -- deleted records row count
691 l_no_rows_del := SQL%ROWCOUNT ;
692
693 -- Return in case of insert fails
694 IF l_return_status = FND_API.G_RET_STS_ERROR
695 THEN
696 RAISE FND_API.G_EXC_ERROR;
697 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
698 THEN
699 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
700 END IF;
701
702 add_header_to_error_stack(p_resource_cost_rec); -- Bug 2659435
703 FND_MESSAGE.SET_NAME('GMF','GMF_API_ROWS_DEL');
704 FND_MESSAGE.SET_TOKEN('NUM_ROWS',l_no_rows_del);
705 FND_MSG_PUB.Add;
706
707 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
708 log_msg(l_no_rows_del || ' row(s) deleted.');
709 END IF;
710
711 -- Standard check of p_commit.
712 IF FND_API.To_Boolean( p_commit ) THEN
713 COMMIT WORK;
714 END IF;
715
716 -- Standard call to get message count and if count is 1, get message info.
717 FND_MSG_PUB.Count_And_Get
718 ( p_count => x_msg_count ,
719 p_data => x_msg_data
720 );
721
722 EXCEPTION
723 WHEN FND_API.G_EXC_ERROR THEN
724 ROLLBACK TO Delete_Alloc_Definition_PUB;
725 x_return_status := FND_API.G_RET_STS_ERROR ;
726 FND_MSG_PUB.Count_And_Get
727 ( p_count => x_msg_count ,
728 p_data => x_msg_data
729 );
730 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
731 ROLLBACK TO Delete_Alloc_Definition_PUB;
732 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
733 FND_MSG_PUB.Count_And_Get
734 ( p_count => x_msg_count ,
735 p_data => x_msg_data
736 );
737 WHEN OTHERS THEN
738 ROLLBACK TO Delete_Alloc_Definition_PUB;
739 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
740 IF FND_MSG_PUB.Check_Msg_Level
741 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
742 THEN
743 FND_MSG_PUB.Add_Exc_Msg
744 ( G_PKG_NAME ,
745 l_api_name
746 );
747 END IF;
748 FND_MSG_PUB.Count_And_Get
749 ( p_count => x_msg_count ,
750 p_data => x_msg_data
751 );
752
753 END Delete_Resource_Cost ;
754
755 --Start of comments
756 --+========================================================================+
757 --| API Name : Get_Resource_Cost |
758 --| TYPE : Public |
759 --| Function : Retrive Resource Cost based on the input from table |
760 --| CM_RSRC_DTL |
761 --| Pre-reqa : None. |
762 --| Parameters : |
763 --| IN : |
764 --| p_api_version IN NUMBER - Required |
765 --| p_init_msg_list IN VARCHAR2 - Optional |
766 --| p_resource_cost_rec IN Resource_Cost_Rec_Type |
767 --| OUT : |
768 --| x_return_status OUT VARCHAR2 |
769 --| x_msg_count OUT NUMBER |
770 --| x_msg_data OUT VARCHAR2 |
771 --| x_resource_cost_rec OUT Resource_Cost_Rec_Type |
772 --| |
773 --| Version : |
774 --| Current Version : 2.0 |
775 --| Previous Version : 1.0 |
776 --| Initial Version : 1.0 |
777 --| |
778 --| Notes : |
779 --| |
780 --| HISTORY |
781 --| 26-Apr-01 Uday Moogala - Created |
782 --| |
783 --+========================================================================+
784 -- End of comments
785
786 PROCEDURE Get_Resource_Cost
787 ( p_api_version IN NUMBER ,
788 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
789
790 x_return_status OUT NOCOPY VARCHAR2 ,
791 x_msg_count OUT NOCOPY NUMBER ,
792 x_msg_data OUT NOCOPY VARCHAR2 ,
793
794 p_resource_cost_rec IN Resource_Cost_Rec_Type ,
795 x_resource_cost_rec OUT NOCOPY Resource_Cost_Rec_Type
796 )
797 IS
798 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Item_Cost' ;
799 l_api_version CONSTANT NUMBER := 2.0 ;
800
801 l_return_status VARCHAR2(2) ;
802 l_count NUMBER(10) ;
803 l_data VARCHAR2(2000) ;
804
805 BEGIN
806
807 -- Standard Start of API savepoint
808 SAVEPOINT Get_Resource_Cost_PUB;
809
810 -- Initialize message list if p_init_msg_list is set to TRUE.
811 IF FND_API.to_Boolean( p_init_msg_list ) THEN
812 FND_MSG_PUB.initialize;
813 END IF;
814
815 -- Standard call to check for call compatibility.
816 IF NOT FND_API.Compatible_API_Call ( l_api_version ,
817 p_api_version ,
818 l_api_name ,
819 G_PKG_NAME )
820 THEN
821 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
822 END IF;
823
824 -- Initialize API return status to success
825 x_return_status := FND_API.G_RET_STS_SUCCESS;
826
827 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
828 log_msg('Beginning Get Resource Cost process.');
829 END IF;
830
831 G_header_logged := 'N'; -- to avoid logging duplicate header for errors
832
833 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
834 log_msg('Calling private API to fetch records...');
835 END IF;
836
837 GMF_ResourceCost_PVT.Get_Resource_Cost
838 (
839 p_api_version => 2.0
840 , p_init_msg_list => FND_API.G_FALSE
841
842 , x_return_status => l_return_status
843 , x_msg_count => l_count
844 , x_msg_data => l_data
845
846 , p_resource_cost_rec => p_resource_cost_rec
847
848 , x_resource_cost_rec => x_resource_cost_rec
849 );
850
851 -- Return if update fails for any reason
852 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
853 RAISE FND_API.G_EXC_ERROR;
854 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
855 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
856 END IF;
857
858 /*
859 -- Standard check of p_commit.
860 IF FND_API.To_Boolean( p_commit ) THEN
861 COMMIT WORK;
862 END IF;
863 */
864 -- Standard call to get message count and if count is 1, get message info.
865 FND_MSG_PUB.Count_And_Get
866 ( p_count => x_msg_count ,
867 p_data => x_msg_data
868 );
869
870 EXCEPTION
871 WHEN FND_API.G_EXC_ERROR THEN
872 ROLLBACK TO Get_Resource_Cost_PUB;
873 x_return_status := FND_API.G_RET_STS_ERROR ;
874 FND_MSG_PUB.Count_And_Get
875 ( p_count => x_msg_count ,
876 p_data => x_msg_data
877 );
878 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
879 ROLLBACK TO Get_Resource_Cost_PUB;
880 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
881 FND_MSG_PUB.Count_And_Get
882 ( p_count => x_msg_count ,
883 p_data => x_msg_data
884 );
885 WHEN OTHERS THEN
886 ROLLBACK TO Get_Resource_Cost_PUB;
887 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
888 IF FND_MSG_PUB.Check_Msg_Level
889 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
890 THEN
891 FND_MSG_PUB.Add_Exc_Msg
892 ( G_PKG_NAME ,
893 l_api_name
894 );
895 END IF;
896 FND_MSG_PUB.Count_And_Get
897 ( p_count => x_msg_count ,
898 p_data => x_msg_data
899 );
900
901 END Get_Resource_Cost;
902
903 /* Proc start of comments
904 --+==========================================================================+
905 --| PROCEDURE NAME |
906 --| Validate_Input_Params |
907 --| |
908 --| DESCRIPTION |
909 --| Validates all the input parameters. |
910 --| |
911 --| PARAMETERS |
912 --| p_resource_cost_rec IN Resource_Cost_Rec_Type |
913 --| x_return_status OUT VARCHAR2 |
914 --| |
915 --| RETURNS |
916 --| TRUE - If succesfully initialized all variables |
917 --| FALSE - If any error |
918 --| |
919 --| HISTORY |
920 --| 27/02/2001 Uday Moogla - Created |
921 --| |
922 --| 03/Dec/2002 Uday Moogala Bug# 2692459 |
923 --| Modified code to verify for same usage um type as rsrc um type. |
924 --| |
925 --| 13/May/2004 Dinesh Vadivel Bug# 3628252 |
926 --| Removed validation for nominal cost so that it takes negative |
927 --| entries |
928 --| 22/Nov/2005 Prasad Marada Bug 4689137,Modified input parameter |
929 --| validation as per datamodel changes |
930 08-APR-2011 Uday Phadtare. Bug 12333658. Do not raise ERROR even though both organization_id
931 and organization_code are NULL because organization_id in CM_RSRC_DTL is not mandatory.
932 --+==========================================================================+
933 Proc end of comments */
934
935 PROCEDURE Validate_Input_Params
936 (
937 p_rsrc_cost_rec IN Resource_Cost_Rec_Type
938 ,x_rsrc_cost_rec OUT NOCOPY Resource_Cost_Rec_Type
939 ,x_user_id OUT NOCOPY NUMBER
940 ,x_return_status OUT NOCOPY VARCHAR2
941 )
942 IS
943
944 l_resources cm_rsrc_dtl.resources%TYPE ;
945 l_legal_entity_id cm_rsrc_dtl.legal_entity_id%TYPE;
946 l_organization_id cm_rsrc_dtl.organization_id%TYPE;
947 l_organization_code mtl_parameters.organization_code%TYPE;
948 l_period_id cm_rsrc_dtl.period_id%TYPE;
949 l_calendar_code cm_rsrc_dtl.calendar_code%TYPE ;
950 l_period_code cm_rsrc_dtl.period_code%TYPE ;
951 -- l_period_status cm_cldr_dtl.period_status%TYPE ;
952 l_cost_type_id cm_rsrc_dtl.cost_type_id%TYPE;
953 l_cost_type_code cm_rsrc_dtl.cost_mthd_code%TYPE ;
954 l_usage_uom cm_rsrc_dtl.usage_uom%TYPE ;
955 l_nominal_cost NUMBER ;
956 l_delete_mark NUMBER ;
957 l_user_name fnd_user.user_name%TYPE ;
958 l_user_id NUMBER ;
959
960 -- Bug 2692459
961 l_usage_uom_class mtl_units_of_measure.uom_class%TYPE ;
962 l_resource_uom_class mtl_units_of_measure.uom_class%TYPE ;
963 l_resource_uom cr_rsrc_mst.std_usage_uom%TYPE ;
964
965
966 BEGIN
967
968 l_resources := p_rsrc_cost_rec.resources ;
969 l_legal_entity_id := p_rsrc_cost_rec.legal_entity_id ;
970 l_organization_id := p_rsrc_cost_rec.organization_id;
971 l_organization_code := p_rsrc_cost_rec.organization_code;
972 l_period_id := p_rsrc_cost_rec.period_id ;
973 l_calendar_code := p_rsrc_cost_rec.calendar_code ;
974 l_period_code := p_rsrc_cost_rec.period_code ;
975 l_cost_type_id := p_rsrc_cost_rec.cost_type_id ;
976 l_cost_type_code := p_rsrc_cost_rec.cost_mthd_code ;
977
978 l_usage_uom := p_rsrc_cost_rec.usage_uom ;
979 l_nominal_cost := p_rsrc_cost_rec.nominal_cost ;
980 l_delete_mark := p_rsrc_cost_rec.delete_mark ;
981 l_user_name := p_rsrc_cost_rec.user_name ;
982
983 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
984 log_msg( 'resources : ' || l_resources);
985 log_msg( 'legal_entity_id : ' || l_legal_entity_id);
986 log_msg( 'organization_id : ' || l_organization_id);
987 log_msg( 'period_id : ' || l_period_id);
988 log_msg( 'cost_type_id : ' || l_cost_type_id);
989 log_msg( 'usage_uom : ' || l_usage_uom);
990 log_msg( 'nominal_cost : ' || l_nominal_cost);
991 log_msg( 'delete_mark : ' || l_delete_mark);
992 log_msg( 'user_name : ' || l_user_name);
993 END IF;
994
995 -------------
996 -- Resources
997 -------------
998 IF (l_resources <> FND_API.G_MISS_CHAR) AND
999 (l_resources IS NOT NULL) THEN
1000 -- validate alloc_id
1001 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1002 log_msg('validating resources : '|| l_resources);
1003 END IF;
1004
1005 --
1006 -- Bug 2692459
1007 -- get uom type also.
1008 --
1009 IF NOT (GMF_VALIDATIONS_PVT.Validate_Resources(l_resources)) THEN
1010 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1011 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_RESOURCES');
1012 FND_MESSAGE.SET_TOKEN('RESOURCES',l_resources);
1013 FND_MSG_PUB.Add;
1014 RAISE FND_API.G_EXC_ERROR;
1015 END IF;
1016 -- Get the resource UOM code, resource UOM class for further processing
1017 GMF_VALIDATIONS_PVT.Validate_Resource(l_resources,l_resource_uom,l_resource_uom_class);
1018 IF l_resource_uom IS NULL AND l_resource_uom_class IS NULL THEN
1019 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1020 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_RESOURCES');
1021 FND_MESSAGE.SET_TOKEN('RESOURCES',l_resources);
1022 FND_MSG_PUB.Add;
1023 RAISE FND_API.G_EXC_ERROR;
1024 END IF;
1025 ELSE
1026 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1027 FND_MESSAGE.SET_NAME('GMF','GMF_API_RESOURCES_REQ');
1028 FND_MSG_PUB.Add;
1029 RAISE FND_API.G_EXC_ERROR;
1030 END IF;
1031 -- End Resource
1032
1033 --------------------------
1034 -- Legal entity
1035 --------------------------
1036 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1037 log_msg('validating legal_entity_id : ' || l_legal_entity_id);
1038 END IF;
1039
1040 IF (l_legal_entity_id <> FND_API.G_MISS_NUM) AND
1041 (l_legal_entity_id IS NOT NULL) THEN
1042 IF NOT GMF_VALIDATIONS_PVT.Validate_legal_entity_id(l_legal_entity_id) THEN
1043 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1044 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_LE_ID');
1045 FND_MESSAGE.SET_TOKEN('LEGAL_ENTITY',l_legal_entity_id);
1046 FND_MSG_PUB.Add;
1047 RAISE FND_API.G_EXC_ERROR;
1048 END IF;
1049 ELSE
1050 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1051 FND_MESSAGE.SET_NAME('GMF','GMF_API_LE_ID_REQ');
1052 FND_MSG_PUB.Add;
1053 RAISE FND_API.G_EXC_ERROR;
1054 END IF;
1055
1056 -- End legal entity
1057
1058 --------------------------
1059 -- Organization validation
1060 --------------------------
1061 -- validate organization id
1062 IF ((l_organization_id <> FND_API.G_MISS_NUM) AND (l_organization_id IS NOT NULL)) THEN
1063 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_debug_level THEN
1064 log_msg('Validation Organization ID : '||l_organization_id);
1065 END IF;
1066 -- invoke validate organization id method
1067 IF NOT gmf_validations_pvt.Validate_organization_id(l_organization_id) THEN
1068 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_ORGN_ID');
1069 FND_MESSAGE.SET_TOKEN('ORGANIZATION_ID', l_organization_id);
1070 FND_MSG_PUB.Add;
1071 RAISE FND_API.G_EXC_ERROR;
1072 END IF;
1073 -- if organization code also passed then log a message to ignore organization code
1074 IF ( l_organization_code <> FND_API.G_MISS_CHAR) AND (l_organization_code IS NOT NULL) THEN
1075 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
1076 FND_MESSAGE.SET_NAME('GMF','GMF_API_IGNORE_ORGN_CODE');
1077 FND_MESSAGE.SET_TOKEN('ORGANIZATION_CODE', l_organization_code);
1078 FND_MSG_PUB.Add;
1079 END IF;
1080 END IF;
1081 -- Organization code passed
1082 ELSIF (l_organization_code <> FND_API.G_MISS_CHAR ) AND (l_organization_code IS NOT NULL ) THEN
1083 IF (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level) THEN
1084 log_msg('Validating Organization Code : ' ||l_organization_code);
1085 END IF;
1086 -- get the organization id
1087 l_organization_id := gmf_validations_pvt.validate_organization_code(l_organization_code);
1088 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1089 log_msg('Organization id : ' || l_organization_id);
1090 END IF;
1091 -- if organization id is null then log message
1092 IF l_organization_id IS NULL THEN
1093 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_ORGN_CODE');
1094 FND_MESSAGE.SET_TOKEN('ORG_CODE', l_organization_code);
1095 FND_MSG_PUB.Add;
1096 RAISE FND_API.G_EXC_ERROR;
1097 END IF;
1098 -- Either organization id or organization code required
1099 ELSE
1100 /* Bug 12333658. Do not raise ERROR even though both organization_id and organization_code are NULL */
1101 /*
1102 FND_MESSAGE.SET_NAME('GMF','GMF_API_ORGANIZATION_ID_REQ');
1103 FND_MSG_PUB.Add;
1104 RAISE FND_API.G_EXC_ERROR;
1105 */
1106 null;
1107 END IF;
1108 -- End of Organization validation
1109
1110 ----------------------------
1111 -- * Cost Type Validation *
1112 ----------------------------
1113 IF (l_cost_type_id <> FND_API.G_MISS_NUM) AND (l_cost_type_id IS NOT NULL) THEN
1114 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1115 log_msg('Validating Cost Type Id : ' || l_cost_type_id);
1116 END IF;
1117 -- Invoke cost type id validation method
1118 IF NOT gmf_validations_pvt.validate_cost_type_id (l_cost_type_id) THEN
1119 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_COST_TYPE_ID');
1120 FND_MESSAGE.SET_TOKEN('COST_TYPE_ID', l_cost_type_id);
1121 FND_MSG_PUB.Add;
1122 RAISE FND_API.G_EXC_ERROR;
1123 END IF;
1124 -- if cost method code is not then log a message
1125 IF (l_cost_type_code <> FND_API.G_MISS_CHAR) AND (l_cost_type_code IS NOT NULL) THEN
1126 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
1127 FND_MESSAGE.SET_NAME('GMF','GMF_API_IGNORE_COST_TYPE');
1128 FND_MESSAGE.SET_TOKEN('COST_TYPE', l_cost_type_code);
1129 FND_MSG_PUB.Add;
1130 END IF;
1131 END IF;
1132 ELSIF (l_cost_type_code <> FND_API.G_MISS_CHAR) AND (l_cost_type_code IS NOT NULL) THEN
1133
1134 -- Get the cost type id from the method
1135 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1136 log_msg('Validating Cost Type Code : ' || l_cost_type_code);
1137 END IF;
1138
1139 l_cost_type_id := GMF_VALIDATIONS_PVT.Validate_cost_type_code(l_cost_type_code);
1140 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1141 log_msg('Cost Type Id : ' || l_cost_type_id);
1142 END IF;
1143 IF l_cost_type_id IS NULL THEN
1144 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_COST_TYPE');
1145 FND_MESSAGE.SET_TOKEN('COST_TYPE',l_cost_type_code);
1146 FND_MSG_PUB.Add;
1147 RAISE FND_API.G_EXC_ERROR;
1148 END IF;
1149 ELSE
1150 FND_MESSAGE.SET_NAME('GMF','GMF_API_COST_TYPE_ID_REQ');
1151 FND_MSG_PUB.Add;
1152 RAISE FND_API.G_EXC_ERROR;
1153 END IF;
1154 -- End Cost Method
1155 --
1156
1157 --------------------------
1158 -- * Period Validation *
1159 --------------------------
1160 IF (l_period_id <> FND_API.G_MISS_NUM) AND (l_period_id IS NOT NULL) THEN
1161 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1162 log_msg('Validating Period Id : ' || l_period_id);
1163 END IF;
1164 -- Invoke validate period id method
1165 IF NOT gmf_validations_pvt.validate_period_id(l_period_id) THEN
1166 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_PERIOD_ID');
1167 FND_MESSAGE.SET_TOKEN('PERIOD_ID', l_period_id);
1168 FND_MSG_PUB.Add;
1169 RAISE FND_API.G_EXC_ERROR;
1170 END IF;
1171 -- If period code also passed then ignore period code
1172 IF ((l_calendar_code <> FND_API.G_MISS_CHAR) AND (l_calendar_code IS NOT NULL))
1173 AND ((l_period_code <> FND_API.G_MISS_CHAR) AND (l_period_code IS NOT NULL)) THEN
1174 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
1175 FND_MESSAGE.SET_NAME('GMF','GMF_API_IGNORE_PERIOD_CODE');
1176 FND_MESSAGE.SET_TOKEN('CALENDAR_CODE', l_calendar_code);
1177 FND_MESSAGE.SET_TOKEN('PERIOD_CODE', l_period_code);
1178 FND_MSG_PUB.Add;
1179 END IF;
1180 END IF;
1181 ELSIF (l_calendar_code <> FND_API.G_MISS_CHAR) AND (l_calendar_code IS NOT NULL)
1182 AND ((l_period_code <> FND_API.G_MISS_CHAR) AND (l_period_code IS NOT NULL)) THEN
1183
1184 -- Get the period id passing period code to the validate period id method
1185 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1186 log_msg('Validating Calendar Code : ' || l_calendar_code||', Period Code : '||l_period_code);
1187 END IF;
1188
1189 /* Begin Bug 12333658 */
1190 IF l_organization_id IS NOT NULL THEN
1191 l_period_id := GMF_VALIDATIONS_PVT.Validate_period_code(l_organization_id, l_calendar_code, l_period_code, l_cost_type_id);
1192 ELSE /* both organization_id and organization_code not passed */
1193 BEGIN
1194 /* Get period_id with reference to l_legal_entity_id */
1195 SELECT period_id
1196 INTO l_period_id
1197 FROM gmf_period_statuses
1198 WHERE legal_entity_id = l_legal_entity_id
1199 AND calendar_code = l_calendar_code
1200 AND period_code = l_period_code
1201 AND cost_type_id = l_cost_type_id;
1202
1203 EXCEPTION
1204 WHEN OTHERS THEN
1205 l_period_id := NULL;
1206 END;
1207 END IF;
1208 /* End Bug 12333658 */
1209
1210 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN
1211 log_msg('Period Id : ' || l_period_id);
1212 END IF;
1213 -- if period id null then log message with invalid period code
1214 IF l_period_id IS NULL THEN
1215 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_CLDR_PERIOD');
1216 FND_MESSAGE.SET_TOKEN('CALENDAR_CODE',l_calendar_code);
1217 FND_MESSAGE.SET_TOKEN('PERIOD_CODE',l_period_code);
1218 FND_MSG_PUB.Add;
1219 RAISE FND_API.G_EXC_ERROR;
1220 END IF;
1221 ELSE
1222 FND_MESSAGE.SET_NAME('GMF','GMF_API_PERIOD_ID_REQ');
1223 FND_MSG_PUB.Add;
1224 RAISE FND_API.G_EXC_ERROR;
1225 END IF;
1226
1227 -- End Period Validation
1228
1229
1230 -- Enough of validations for delete.
1231 -- For update and insert we should do all validations.
1232 --
1233
1234 IF (G_operation <> 'DELETE') THEN
1235
1236 --
1237 -- Usage Unit of Measure
1238 --
1239 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1240 log_msg('validating usage_uom : ' || l_usage_uom);
1241 END IF;
1242
1243 IF (l_usage_uom <> FND_API.G_MISS_CHAR) AND
1244 (l_usage_uom IS NOT NULL) THEN
1245
1246 --
1247 -- Bug 2692459
1248 -- get usage uom class also and verify whether it is same uom class as resource uom
1249 --
1250 -- get the Usgae UOM class
1251 GMF_VALIDATIONS_PVT.Validate_Usage_Uom(l_usage_uom, l_usage_uom_class) ;
1252 IF l_usage_uom_class IS NULL THEN
1253 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1254 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_USAGE_UM');
1255 FND_MESSAGE.SET_TOKEN('USAGE_UM',l_usage_uom);
1256 FND_MSG_PUB.Add;
1257 RAISE FND_API.G_EXC_ERROR;
1258 END IF;
1259
1260 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1261 log_msg('Usage UOM Class : ' || l_usage_uom_class ||
1262 ' resource UOM Class : ' || l_resource_uom_class);
1263 END IF;
1264
1265 -- Usage UOM must be of the same type as the resource UOM
1266 IF (l_resource_uom_class <> l_usage_uom_class) THEN
1267 add_header_to_error_stack(p_rsrc_cost_rec);
1268 FND_MESSAGE.SET_NAME('GMF','GMF_API_USAGE_UOM_SAMETYPE_REQ');
1269 FND_MESSAGE.SET_TOKEN('USAGE_UM',l_usage_uom);
1270 FND_MESSAGE.SET_TOKEN('RESOURCE_UM',l_resource_uom);
1271 FND_MSG_PUB.Add;
1272 RAISE FND_API.G_EXC_ERROR;
1273 END IF;
1274 -- End of bug 2692459
1275
1276 ELSIF (l_usage_uom = FND_API.G_MISS_CHAR AND
1277 G_operation = 'UPDATE') OR
1278 (G_operation = 'INSERT') THEN
1279 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1280 FND_MESSAGE.SET_NAME('GMF','GMF_API_USAGE_UM_REQ');
1281 FND_MSG_PUB.Add;
1282 RAISE FND_API.G_EXC_ERROR;
1283 END IF;
1284 -- End Usage Unit of Measure
1285
1286 --
1287 -- Nominal Cost
1288 -- Nominal Cost should be > 0
1289 -- In the form the format mask for this is : 999999999D999999999(999,999,999.999999999)
1290 -- To put that check here, the cost should not be >= 1,000,000,000
1291 --
1292 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1293 log_msg('Validating Nominal Cost : '||l_nominal_cost);
1294 END IF;
1295
1296 /*************************************************************************
1297 * dvadivel 13-May-2004 Bug # 3628252 Removed validation for Nominal cost
1298 *************************************************************************/
1299 /* IF (l_nominal_cost <> FND_API.G_MISS_NUM) AND
1300 (l_nominal_cost IS NOT NULL) THEN
1301 IF ((nvl(l_nominal_cost,0) <= 0) OR (nvl(l_nominal_cost,0) >= 1000000000)) THEN
1302 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1303 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_NOMINAL_COST');
1304 FND_MESSAGE.SET_TOKEN('NOMINAL_COST',l_nominal_cost);
1305 FND_MSG_PUB.Add;
1306 RAISE FND_API.G_EXC_ERROR;
1307 END IF;
1308 ELSIF (l_nominal_cost = FND_API.G_MISS_NUM AND
1309 */
1310 IF ((l_nominal_cost = FND_API.G_MISS_NUM) OR (l_nominal_cost IS NULL)) AND
1311 ((G_operation = 'UPDATE') OR
1312 (G_operation = 'INSERT')) THEN
1313 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1314 FND_MESSAGE.SET_NAME('GMF','GMF_API_NOMINAL_COST_REQ');
1315 FND_MSG_PUB.Add;
1316 RAISE FND_API.G_EXC_ERROR;
1317 END IF;
1318 -- End Nominal Cost
1319
1320 --
1321 -- Delete Mark
1322 --
1323 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1324 log_msg('Validating delete_mark : ' || l_delete_mark);
1325 END IF;
1326
1327 IF (l_delete_mark <> FND_API.G_MISS_NUM) AND
1328 (l_delete_mark IS NOT NULL) THEN
1329 IF l_delete_mark NOT IN (0,1) THEN
1330 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1331 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_DELETE_MARK');
1332 FND_MESSAGE.SET_TOKEN('DELETE_MARK',l_delete_mark);
1333 FND_MSG_PUB.Add;
1334 RAISE FND_API.G_EXC_ERROR;
1335 END IF;
1336 ELSIF (l_delete_mark = FND_API.G_MISS_NUM AND
1337 G_operation = 'UPDATE') OR
1338 (G_operation = 'INSERT') THEN
1339 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1340 FND_MESSAGE.SET_NAME('GMF','GMF_API_DELETE_MARK_REQ');
1341 FND_MSG_PUB.Add;
1342 RAISE FND_API.G_EXC_ERROR;
1343 END IF;
1344
1345 -- Bug 2692459
1346 IF ((G_operation = 'UPDATE') AND (l_delete_mark = 1)) THEN
1347 add_header_to_error_stack(p_rsrc_cost_rec);
1348 FND_MESSAGE.SET_NAME('GMF','GMF_API_CANT_MARK_FOR_PURGE');
1349 FND_MSG_PUB.Add;
1350 RAISE FND_API.G_EXC_ERROR;
1351 END IF;
1352 -- End Delete Mark
1353
1354 END IF; -- Bug 2692459: G_operation <> 'DELETE'
1355
1356 -- Populate WHO columns
1357 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1358 log_msg('Validating user name : ' || l_user_name);
1359 END IF;
1360
1361 IF (l_user_name <> FND_API.G_MISS_CHAR) AND
1362 (l_user_name IS NOT NULL) THEN
1363 GMA_GLOBAL_GRP.Get_who( p_user_name => l_user_name
1364 , x_user_id => l_user_id
1365 );
1366
1367 IF FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW >= G_Debug_Level THEN -- Bug 2659435
1368 log_msg('user id : ' || l_user_id);
1369 END IF;
1370
1371 IF l_user_id = -1 THEN -- Bug 2681243: GMA changed return status value to -1.
1372 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1373 FND_MESSAGE.SET_NAME('GMF','GMF_API_INVALID_USER_NAME');
1374 FND_MESSAGE.SET_TOKEN('USER_NAME',l_user_name);
1375 FND_MSG_PUB.Add;
1376 RAISE FND_API.G_EXC_ERROR;
1377 END IF;
1378
1379 ELSE
1380 add_header_to_error_stack(p_rsrc_cost_rec); -- Bug 2659435
1381 FND_MESSAGE.SET_NAME('GMF','GMF_API_USER_NAME_REQ');
1382 FND_MSG_PUB.Add;
1383 RAISE FND_API.G_EXC_ERROR;
1384 END IF;
1385 -- End User Name
1386
1387
1388 x_rsrc_cost_rec.resources := l_resources ;
1389 x_rsrc_cost_rec.legal_entity_id := l_legal_entity_id ;
1390 x_rsrc_cost_rec.organization_id := l_organization_id ;
1391 x_rsrc_cost_rec.organization_code:= l_organization_code ;
1392 x_rsrc_cost_rec.period_id := l_period_id;
1393 x_rsrc_cost_rec.calendar_code := l_calendar_code ;
1394 x_rsrc_cost_rec.period_code := l_period_code ;
1395 x_rsrc_cost_rec.cost_type_id := l_cost_type_id ;
1396 x_rsrc_cost_rec.cost_mthd_code := l_cost_type_code ;
1397 x_rsrc_cost_rec.usage_uom := l_usage_uom ;
1398 x_rsrc_cost_rec.nominal_cost := round(l_nominal_cost,9) ;
1399 x_rsrc_cost_rec.delete_mark := l_delete_mark ;
1400 x_rsrc_cost_rec.user_name := l_user_name ;
1401 x_user_id := l_user_id ;
1402
1403 EXCEPTION -- Bug 2681243: removed when others to capture ORA errors.
1404 WHEN FND_API.G_EXC_ERROR THEN
1405 x_return_status := FND_API.G_RET_STS_ERROR ;
1406 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1407 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1408 END Validate_Input_Params;
1409
1410 -- Func start of comments
1411 --+==========================================================================+
1412 --| Function Name |
1413 --| check_records_exist |
1414 --| |
1415 --| DESCRIPTION |
1416 --| This procedure checks for the existance of records for a given |
1417 --| resource, orgn, calendar, period and cost method. |
1418 --| |
1419 --| USAGE |
1420 --| In case of insert API, if record exists raise error. |
1421 --| In case of update/delete API, if record does not exists raise error|
1422 --| |
1423 --| PARAMETERS |
1424 --| p_resources IN VARCHAR2 - Actual Message Text |
1425 --| p_orgn_code IN VARCHAR2 - Actual Message Text |
1426 --| p_calendar_code IN VARCHAR2 - Actual Message Text |
1427 --| p_period_code IN VARCHAR2 - Actual Message Text |
1428 --| p_cost_mthd_code IN VARCHAR2 - Actual Message Text |
1429 --| |
1430 --| RETURNS |
1431 --| TRUE : If records exist |
1432 --| TRUE : If records does not exist |
1433 --| |
1434 --| HISTORY |
1435 --| 27/02/2001 Uday Moogla - Created |
1436 --| 2-sep-2005 pmarada - Modified the cursor and where clause |
1437 --| 07-mar-2007 pmarada - Bug 5586122 Modified the cursor parameters, |
1438 --| |
1439 --+==========================================================================+
1440 -- Func end of comments
1441
1442 FUNCTION check_records_exist
1443 (
1444 p_legal_entity_id IN cm_rsrc_dtl.legal_entity_id%TYPE,
1445 p_organization_id IN cm_rsrc_dtl.organization_id%TYPE,
1446 p_resources IN cm_rsrc_dtl.resources%TYPE,
1447 p_period_id IN cm_rsrc_dtl.period_id%TYPE,
1448 p_cost_type_id IN cm_rsrc_dtl.cost_type_id%TYPE
1449 )
1450 RETURN BOOLEAN
1451 IS
1452 CURSOR Cur_rsrc_dtl
1453 ( cp_legal_entity_id cm_rsrc_dtl.legal_entity_id%TYPE,
1454 cp_organization_id cm_rsrc_dtl.organization_id%TYPE ,
1455 cp_resources cm_rsrc_dtl.resources%TYPE ,
1456 cp_period_id cm_rsrc_dtl.period_id%TYPE,
1457 cp_cost_type_id cm_rsrc_dtl.cost_type_id%TYPE
1458 ) IS
1459 SELECT 'x'
1460 FROM cm_rsrc_dtl
1461 WHERE legal_entity_id = cp_legal_entity_id
1462 /*B12404853 - Added nvl as Organization_id is not mandatory in cm_rsrc_dtl (Refer B12333658)
1463 AND organization_id = cp_organization_id */
1464 AND nvl(organization_id,0) = nvl(cp_organization_id,0) /*B12404853*/
1465 AND resources = cp_resources
1466 AND period_id = cp_period_id
1467 AND cost_type_id = cp_cost_type_id;
1468
1469 l_rec_found VARCHAR2(10);
1470 BEGIN
1471
1472 l_rec_found := NULL;
1473 OPEN Cur_rsrc_dtl(p_legal_entity_id, p_organization_id, p_resources, p_period_id, p_cost_type_id) ;
1474 FETCH cur_rsrc_dtl INTO l_rec_found;
1475
1476 IF (l_rec_found IS NOT NULL) THEN
1477 RETURN TRUE;
1478 ELSE
1479 RETURN FALSE ;
1480 END IF;
1481 CLOSE Cur_rsrc_dtl ;
1482
1483 END check_records_exist ;
1484
1485 -- Func start of comments
1486 --+==========================================================================+
1487 --| Procedure Name |
1488 --| log_msg |
1489 --| |
1490 --| DESCRIPTION |
1491 --| This procedure logs messages to message stack. |
1492 --| |
1493 --| PARAMETERS |
1494 --| p_msg_lvl IN NUMBER(10) - Message Level |
1495 --| p_msg_text IN NUMBER(10) - Actual Message Text |
1496 --| |
1497 --| RETURNS |
1498 --| |
1499 --| HISTORY |
1500 --| 27/02/2001 Uday Moogla - Created |
1501 --| 05/nov/2002 Uday Moogala Bug 2659435 |
1502 --| Removed first param for debug level |
1503 --| |
1504 --+==========================================================================+
1505 -- Func end of comments
1506
1507 PROCEDURE log_msg
1508 (
1509 p_msg_text IN VARCHAR2
1510 )
1511 IS
1512 BEGIN
1513
1514 -- IF FND_MSG_PUB.Check_Msg_Level (p_msg_lvl) THEN Bug 2659435
1515 FND_MESSAGE.SET_NAME('GMF','GMF_API_DEBUG');
1516 FND_MESSAGE.SET_TOKEN('MSG',p_msg_text);
1517 FND_MSG_PUB.Add;
1518 -- END IF; Bug 2659435
1519
1520 END log_msg ;
1521
1522 -- Func start of comments
1523 --+==========================================================================+
1524 --| Procedure Name |
1525 --| add_header_to_error_stack |
1526 --| |
1527 --| DESCRIPTION |
1528 --| This procedure logs header to message stack. |
1529 --| |
1530 --| PARAMETERS |
1531 --| p_header Header Record to be logged |
1532 --| |
1533 --| RETURNS |
1534 --| |
1535 --| HISTORY |
1536 --| 05/11/2001 Uday Moogla - Created Bug 2659435 |
1537 --| 20-sep-2005 Pmarada - modified the message and tokens |
1538 --| |
1539 --+==========================================================================+
1540 -- Func end of comments
1541
1542 PROCEDURE add_header_to_error_stack
1543 (
1544 p_header Resource_Cost_Rec_Type
1545 )
1546 IS
1547 BEGIN
1548
1549 IF G_header_logged = 'N' THEN
1550 G_header_logged := 'Y';
1551 FND_MESSAGE.SET_NAME('GMF','GMF_API_RESOURCE_COST_HEADER');
1552 FND_MESSAGE.SET_TOKEN('RESOURCES',p_header.resources);
1553 FND_MESSAGE.SET_TOKEN('LEGAL_ENTITY_ID',p_header.legal_entity_id);
1554 FND_MESSAGE.SET_TOKEN('ORGANIZATION_ID',p_header.organization_id);
1555 FND_MESSAGE.SET_TOKEN('PERIOD_ID',p_header.period_id);
1556 FND_MESSAGE.SET_TOKEN('COST_TYPE_ID',p_header.cost_type_id);
1557 FND_MSG_PUB.Add;
1558 END IF;
1559
1560 END add_header_to_error_stack;
1561
1562 END GMF_ResourceCost_PUB;