[Home] [Help]
PACKAGE BODY: APPS.EAM_RES_VALIDATE_PVT
Source
1 PACKAGE BODY EAM_RES_VALIDATE_PVT AS
2 /* $Header: EAMVRSVB.pls 120.3.12010000.2 2008/11/06 23:52:18 mashah ship $ */
3 /***************************************************************************
4 --
5 -- Copyright (c) 2002 Oracle Corporation, Redwood Shores, CA, USA
6 -- All rights reserved.
7 --
8 -- FILENAME
9 --
10 -- EAMVRSVB.pls
11 --
12 -- DESCRIPTION
13 --
14 -- Body of package EAM_RES_VALIDATE_PVT
15 --
16 -- NOTES
17 --
18 -- HISTORY
19 --
20 -- 30-JUN-2002 Kenichi Nagumo Initial Creation
21 ***************************************************************************/
22
23 G_Pkg_Name VARCHAR2(30) := 'EAM_RES_VALIDATE_PVT';
24
25 g_token_tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
26 g_dummy NUMBER;
27 g_autocharge_type VARCHAR2(30) := EAM_CONSTANTS.G_AUTOCHARGE_TYPE;
28
29 /*******************************************************************
30 * Procedure : Check_Existence
31 * Returns : None
32 * Parameters IN : Resource Record
33 * Parameters OUT NOCOPY: Old Resource Record
34 * Mesg Token Table
35 * Return Status
36 * Purpose : Procedure will query the old Resource
37 * record and return it in old record variables. If the
38 * Transaction Type is Create and the record already
39 * exists the return status would be error or if the
40 * transaction type is Update and the record
41 * does not exist then the return status would be an
42 * error as well. Mesg_Token_Table will carry the
43 * error messsage and the tokens associated with the
44 * message.
45 *********************************************************************/
46
47 PROCEDURE Check_Existence
48 ( p_eam_res_rec IN EAM_PROCESS_WO_PUB.eam_res_rec_type
49 , x_old_eam_res_rec OUT NOCOPY EAM_PROCESS_WO_PUB.eam_res_rec_type
50 , x_Mesg_Token_Tbl OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
51 , x_return_status OUT NOCOPY VARCHAR2
52 )
53 IS
54 l_token_tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
55 l_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
56 l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
57 l_return_status VARCHAR2(1);
58 BEGIN
59
60 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Quering Resource'); END IF;
61
62 EAM_RES_UTILITY_PVT.Query_Row
63 ( p_wip_entity_id => p_eam_res_rec.wip_entity_id
64 , p_organization_id => p_eam_res_rec.organization_id
65 , p_operation_seq_num => p_eam_res_rec.operation_seq_num
66 , p_resource_seq_num => p_eam_res_rec.resource_seq_num
67 , x_eam_res_rec => x_old_eam_res_rec
68 , x_Return_status => l_return_status
69 );
70
71 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Query Row Returned with : ' || l_return_status); END IF;
72
73 IF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_FOUND AND
74 p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_CREATE
75 THEN
76 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
77 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
78
79 l_out_mesg_token_tbl := l_mesg_token_tbl;
80 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
81 ( x_Mesg_token_tbl => l_out_Mesg_Token_Tbl
82 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
83 , p_message_name => 'EAM_RES_ALREADY_EXISTS'
84 , p_token_tbl => l_token_tbl
85 );
86 l_mesg_token_tbl := l_out_mesg_token_tbl;
87
88 l_return_status := FND_API.G_RET_STS_ERROR;
89
90 ELSIF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_NOT_FOUND AND
91 p_eam_res_rec.transaction_type IN
92 (EAM_PROCESS_WO_PVT.G_OPR_UPDATE, EAM_PROCESS_WO_PVT.G_OPR_DELETE)
93 THEN
94 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
95 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
96
97 l_out_mesg_token_tbl := l_mesg_token_tbl;
98 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
99 ( x_Mesg_token_tbl => l_out_Mesg_Token_Tbl
100 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
101 , p_message_name => 'EAM_RES_DOESNOT_EXISTS'
102 , p_token_tbl => l_token_tbl
103 );
104 l_mesg_token_tbl := l_out_mesg_token_tbl;
105
106 l_return_status := FND_API.G_RET_STS_ERROR;
107
108 ELSIF l_Return_status = FND_API.G_RET_STS_UNEXP_ERROR
109 THEN
110 l_out_mesg_token_tbl := l_mesg_token_tbl;
111 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
112 ( x_Mesg_token_tbl => l_out_Mesg_Token_Tbl
113 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
114 , p_message_name => NULL
115 , p_message_text => 'Unexpected error while existence verification of ' || 'Resource '|| p_eam_res_rec.resource_seq_num , p_token_tbl => l_token_tbl
116 );
117 l_mesg_token_tbl := l_out_mesg_token_tbl;
118 l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
119
120 ELSE /* Assign the relevant transaction type for SYNC operations */
121 IF p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_SYNC THEN
122 IF l_return_status = EAM_PROCESS_WO_PVT.G_RECORD_FOUND THEN
123 x_old_eam_res_rec.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_UPDATE;
124 ELSE
125 x_old_eam_res_rec.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_CREATE;
126 END IF;
127 END IF;
128 l_return_status := FND_API.G_RET_STS_SUCCESS;
129
130 END IF;
131
132 x_return_status := l_return_status;
133 x_mesg_token_tbl := l_mesg_token_tbl;
134 END Check_Existence;
135
136
137
138 /********************************************************************
139 * Procedure : Check_Attributes
140 * Parameters IN : Resource Column record
141 * Old Resource Column record
142 * Parameters OUT NOCOPY: Return Status
143 * Mesg Token Table
144 * Purpose : Check_Attrbibutes procedure will validate every
145 * revised item attrbiute in its entirety.
146 **********************************************************************/
147
148
149
150 PROCEDURE Check_Attributes
151 ( p_eam_res_rec IN EAM_PROCESS_WO_PUB.eam_res_rec_type
152 , p_old_eam_res_rec IN EAM_PROCESS_WO_PUB.eam_res_rec_type
153 , x_return_status OUT NOCOPY VARCHAR2
154 , x_Mesg_Token_Tbl OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
155 )
156 IS
157 l_err_text VARCHAR2(2000) := NULL;
158 l_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
159 l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
160 l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
161 l_24_hr_resource NUMBER ;
162 l_calendar_code VARCHAR2(10);
163 l_count_shift_num NUMBER;
164 BEGIN
165
166 -- operation_seq_num
167
168 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating operation_seq_num . . . '); END IF;
169
170 begin
171
172 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
173
174 select 1
175 into g_dummy
176 from wip_operations wo
177 where wo.organization_id = p_eam_res_rec.organization_id
178 and wo.wip_entity_id = p_eam_res_rec.wip_entity_id
179 and wo.operation_seq_num = p_eam_res_rec.operation_seq_num;
180
181 end if;
182
183 x_return_status := FND_API.G_RET_STS_SUCCESS;
184
185 exception
186 when others then
187
188 l_token_tbl(1).token_name := 'OP_SEQ_NUM_INVALID';
189 l_token_tbl(1).token_value := p_eam_res_rec.operation_seq_num;
190
191 l_out_mesg_token_tbl := l_mesg_token_tbl;
192 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
193 ( p_message_name => 'EAM_RES_OP_SEQ_INVALID'
194 , p_token_tbl => l_token_tbl
195 , p_mesg_token_tbl => l_mesg_token_tbl
196 , x_mesg_token_tbl => l_out_mesg_token_tbl
197 );
198 l_mesg_token_tbl := l_out_mesg_token_tbl;
199
200 x_return_status := FND_API.G_RET_STS_ERROR;
201 x_mesg_token_tbl := l_mesg_token_tbl ;
202 return;
203
204 end;
205
206
207 -- start_date
208 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating start_date . . . '); END IF;
209
210 begin
211
212 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
213
214 if p_eam_res_rec.start_date > p_eam_res_rec.completion_date then
215 raise fnd_api.g_exc_unexpected_error;
216 end if;
217
218 end if;
219
220 x_return_status := FND_API.G_RET_STS_SUCCESS;
221
222 exception
223 when others then
224
225 l_token_tbl(1).token_name := 'START_DATE';
226 l_token_tbl(1).token_value := p_eam_res_rec.start_date;
227
228 l_out_mesg_token_tbl := l_mesg_token_tbl;
229 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
230 ( p_message_name => 'EAM_RES_START_DATE_INVALID'
231 , p_token_tbl => l_token_tbl
232 , p_mesg_token_tbl => l_mesg_token_tbl
233 , x_mesg_token_tbl => l_out_mesg_token_tbl
234 );
235 l_mesg_token_tbl := l_out_mesg_token_tbl;
236
237 x_return_status := FND_API.G_RET_STS_ERROR;
238 x_mesg_token_tbl := l_mesg_token_tbl ;
239 return;
240
241 end;
242
243
244 -- assigned_units
245 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating assigned_units . . . '); END IF;
246
247 begin
248
249 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
250
251 if (p_eam_res_rec.assigned_units is null or p_eam_res_rec.assigned_units < 0 ) then
252 raise fnd_api.g_exc_unexpected_error;
253 end if;
254
255 end if;
256
257 x_return_status := FND_API.G_RET_STS_SUCCESS;
258
259 exception
260 when others then
261
262 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
263 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
264
265 l_out_mesg_token_tbl := l_mesg_token_tbl;
266 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
267 ( p_message_name => 'EAM_RES_ASSIGNED_UNIT_INVALID'
268 , p_token_tbl => l_token_tbl
269 , p_mesg_token_tbl => l_mesg_token_tbl
270 , x_mesg_token_tbl => l_out_mesg_token_tbl
271 );
272 l_mesg_token_tbl := l_out_mesg_token_tbl;
273
274 x_return_status := FND_API.G_RET_STS_ERROR;
275 x_mesg_token_tbl := l_mesg_token_tbl ;
276 return;
277
278 end;
279 /*commenting this check for 7183942
280
281 -- A resource cannot be added to same operation twice
282 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating resource uniquness in operation . . . '); END IF;
283
284 begin
285
286 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE)) then
287
288 begin
289 select 1
290 into g_dummy
291 from wip_operation_resources wor
292 where wor.organization_id = p_eam_res_rec.organization_id
293 and wor.wip_entity_id = p_eam_res_rec.wip_entity_id
294 and wor.operation_seq_num = p_eam_res_rec.operation_seq_num
295 and wor.resource_id = p_eam_res_rec.resource_id;
296
297 if g_dummy >=1 then
298 raise fnd_api.g_exc_unexpected_error;
299 end if;
300 exception when NO_DATA_FOUND then
301 null;
302 end ;
303
304 end if;
305
306 x_return_status := FND_API.G_RET_STS_SUCCESS;
307
308 exception
309 when others then
310
311 l_token_tbl(1).token_name := 'RES_ID';
312 l_token_tbl(1).token_value := p_eam_res_rec.resource_id;
313
314 l_out_mesg_token_tbl := l_mesg_token_tbl;
315 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
316 ( p_message_name => 'EAM_RES_ALD_ADDED_WO'
317 , p_token_tbl => l_token_tbl
318 , p_mesg_token_tbl => l_mesg_token_tbl
319 , x_mesg_token_tbl => l_out_mesg_token_tbl
320 );
321 l_mesg_token_tbl := l_out_mesg_token_tbl;
322
323 x_return_status := FND_API.G_RET_STS_ERROR;
324 x_mesg_token_tbl := l_mesg_token_tbl ;
325 return;
326
327 end;
328
329 /*commenting this check for 7183942*/
330 -- resource_id
331 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating resource_id . . . '); END IF;
332
333 begin
334
335 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
336
337 select 1
338 into g_dummy
339 from bom_resources
340 where organization_id = p_eam_res_rec.organization_id
341 and resource_id = p_eam_res_rec.resource_id;
342
343 -- baroy - check whether the resource specified belongs to the department of the operation
344 select
345 1 into g_dummy
346 from
347 wip_operations wo,
348 bom_departments bd,
349 bom_department_resources bdr
350 where
351 wo.organization_id = p_eam_res_rec.organization_id
352 and wo.wip_entity_id = p_eam_res_rec.wip_entity_id
353 and wo.operation_seq_num = p_eam_res_rec.operation_seq_num
354 and bd.department_id = wo.department_id
355 and bdr.department_id = bd.department_id
356 and bdr.resource_id = p_eam_res_rec.resource_id;
357
358 end if;
359
360 x_return_status := FND_API.G_RET_STS_SUCCESS;
361
362 exception
363 when others then
364
365 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
366 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
367
368 l_out_mesg_token_tbl := l_mesg_token_tbl;
369 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
370 ( p_message_name => 'EAM_RES_RESOURCE_SEQ_INVALID'
371 , p_token_tbl => l_token_tbl
372 , p_mesg_token_tbl => l_mesg_token_tbl
373 , x_mesg_token_tbl => l_out_mesg_token_tbl
374 );
375 l_mesg_token_tbl := l_out_mesg_token_tbl;
376
377 x_return_status := FND_API.G_RET_STS_ERROR;
378 x_mesg_token_tbl := l_mesg_token_tbl ;
379 return;
380
381 end;
382
383
384 -- uom_code
385 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating uom_code . . . '); END IF;
386
387 begin
388
389 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
390
391 select 1
392 into g_dummy
393 from mtl_units_of_measure
394 where uom_code = p_eam_res_rec.uom_code;
395
396 -- baroy - check whether the uom_code - resource association is correct.
397 select 1 into g_dummy from bom_resources
398 where organization_id = p_eam_res_rec.organization_id
399 and resource_id = p_eam_res_rec.resource_id
400 and unit_of_measure = p_eam_res_rec.uom_code;
401
402 end if;
403
404 x_return_status := FND_API.G_RET_STS_SUCCESS;
405
406 exception
407 when others then
408
409 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
410 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
411
412 l_out_mesg_token_tbl := l_mesg_token_tbl;
413 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
414 ( p_message_name => 'EAM_RES_UOM_INVALID'
415 , p_token_tbl => l_token_tbl
416 , p_mesg_token_tbl => l_mesg_token_tbl
417 , x_mesg_token_tbl => l_out_mesg_token_tbl
418 );
419 l_mesg_token_tbl := l_out_mesg_token_tbl;
420
421 x_return_status := FND_API.G_RET_STS_ERROR;
422 x_mesg_token_tbl := l_mesg_token_tbl ;
423 return;
424
425 end;
426
427
428 -- basis_type
429 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating basis_type . . . '); END IF;
430
431 begin
432
433 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
434
435 select 1
436 into g_dummy
437 from mfg_lookups
438 where lookup_type = 'CST_BASIS'
439 and lookup_code in (1,2)
440 and lookup_code = p_eam_res_rec.basis_type;
441
442 end if;
443
444 x_return_status := FND_API.G_RET_STS_SUCCESS;
445
446 exception
447 when others then
448
449 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
450 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
451
452 l_out_mesg_token_tbl := l_mesg_token_tbl;
453 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
454 ( p_message_name => 'EAM_RES_BASIS_TYPE_INVALID'
455 , p_token_tbl => l_token_tbl
456 , p_mesg_token_tbl => l_mesg_token_tbl
457 , x_mesg_token_tbl => l_out_mesg_token_tbl
458 );
459 l_mesg_token_tbl := l_out_mesg_token_tbl;
460
461 x_return_status := FND_API.G_RET_STS_ERROR;
462 x_mesg_token_tbl := l_mesg_token_tbl ;
463 return;
464
465 end;
466
467
468 -- activity_id
469 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating activity_id . . . '); END IF;
470
471 begin
472
473 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
474
475 IF (p_eam_res_rec.activity_id is not NULL)
476 THEN
477
478 select 1
479 into g_dummy
480 from cst_activities
481 where (organization_id = p_eam_res_rec.organization_id or organization_id is null)
482 and nvl(disable_date, sysdate + 2) > sysdate
483 and activity_id = p_eam_res_rec.activity_id;
484
485 END IF;
486
487 end if;
488
489 x_return_status := FND_API.G_RET_STS_SUCCESS;
490
491 exception
492 when others then
493
494 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
495 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
496
497
498 l_out_mesg_token_tbl := l_mesg_token_tbl;
499 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
500 ( p_message_name => 'EAM_RES_ACTIVITY_INVALID'
501 , p_token_tbl => l_token_tbl
502 , p_mesg_token_tbl => l_mesg_token_tbl
503 , x_mesg_token_tbl => l_out_mesg_token_tbl
504 );
505 l_mesg_token_tbl := l_out_mesg_token_tbl;
506
507 x_return_status := FND_API.G_RET_STS_ERROR;
508 x_mesg_token_tbl := l_mesg_token_tbl ;
509 return;
510
511 end;
512
513
514 -- autocharge_type
515 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating autocharge_type . . . '); END IF;
516
517 begin
518
519 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
520
521 select 1
522 into g_dummy
523 from mfg_lookups
524 where lookup_type = g_autocharge_type
525 and lookup_code in (2,3)
526 and lookup_code = p_eam_res_rec.autocharge_type;
527
528 end if;
529
530 x_return_status := FND_API.G_RET_STS_SUCCESS;
531
532 exception
533 when others then
534
535 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
536 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
537
538 l_out_mesg_token_tbl := l_mesg_token_tbl;
539 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
540 ( p_message_name => 'EAM_RES_AC_TYPE_INVALID'
541 , p_token_tbl => l_token_tbl
542 , p_mesg_token_tbl => l_mesg_token_tbl
543 , x_mesg_token_tbl => l_out_mesg_token_tbl
544 );
545 l_mesg_token_tbl := l_out_mesg_token_tbl;
546
547 x_return_status := FND_API.G_RET_STS_ERROR;
548 x_mesg_token_tbl := l_mesg_token_tbl ;
549 return;
550
551 end;
552
553
554 -- scheduled_flag
555 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating schedule_flag . . . '); END IF;
556
557 begin
558
559 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
560
561 if p_eam_res_rec.scheduled_flag not in (1,2) then
562 raise fnd_api.g_exc_error;
563 end if;
564
565 end if;
566
567 x_return_status := FND_API.G_RET_STS_SUCCESS;
568
569 exception
570 when others then
571
572 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
573 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
574
575 l_out_mesg_token_tbl := l_mesg_token_tbl;
576 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
577 ( p_message_name => 'EAM_RES_SCHEDULE_TYPE_INVALID'
578 , p_token_tbl => l_token_tbl
579 , p_mesg_token_tbl => l_mesg_token_tbl
580 , x_mesg_token_tbl => l_out_mesg_token_tbl
581 );
582 l_mesg_token_tbl := l_out_mesg_token_tbl;
583
584 x_return_status := FND_API.G_RET_STS_ERROR;
585 x_mesg_token_tbl := l_mesg_token_tbl ;
586 return;
587
588 end;
589
590
591 -- standard_rate_flag
592 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating schedule_flag . . . '); END IF;
593
594 begin
595
596 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
597
598 IF (p_eam_res_rec.standard_rate_flag is not NULL) and (p_eam_res_rec.standard_rate_flag not in (1, 2))
599 THEN
600
601 raise fnd_api.g_exc_unexpected_error;
602
603 END IF;
604
605 end if;
606
607 x_return_status := FND_API.G_RET_STS_SUCCESS;
608
609 exception
610 when others then
611
612 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
613 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
614
615 l_out_mesg_token_tbl := l_mesg_token_tbl;
616 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
617 ( p_message_name => 'EAM_RES_STANDARD_RATE_INVALID'
618 , p_token_tbl => l_token_tbl
619 , p_mesg_token_tbl => l_mesg_token_tbl
620 , x_mesg_token_tbl => l_out_mesg_token_tbl
621 );
622 l_mesg_token_tbl := l_out_mesg_token_tbl;
623
624 x_return_status := FND_API.G_RET_STS_ERROR;
625 x_mesg_token_tbl := l_mesg_token_tbl ;
626 return;
627
628 end;
629
630 -- department_id
631 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating Department. . . '); END IF;
632
633 begin
634
635 -- Check whether resource dept and op dept match.
636 select 1 into g_dummy from
637 wip_operations wo
638 where wo.wip_entity_id = p_eam_res_rec.wip_entity_id
639 and wo.organization_id = p_eam_res_rec.organization_id
640 and wo.operation_seq_num = p_eam_res_rec.operation_seq_num
641 and wo.department_id = p_eam_res_rec.department_id;
642
643 -- Check whether dept is defined in BOM.
644 select 1 into g_dummy from
645 bom_departments bd where
646 bd.organization_id = p_eam_res_rec.organization_id
647 and bd.department_id = p_eam_res_rec.department_id;
648
649 -- Check whether trying to update department (which is disallowed).
650 IF p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_UPDATE THEN
651 SELECT 1 into g_dummy
652 FROM wip_operation_resources wor, wip_operations wo
653 WHERE wor.wip_entity_id = p_eam_res_rec.wip_entity_id
654 AND wo.wip_entity_id = p_eam_res_rec.wip_entity_id
655 AND wor.organization_id = p_eam_res_rec.organization_id
656 AND wo.organization_id = p_eam_res_rec.organization_id
657 AND wor.resource_seq_num = p_eam_res_rec.resource_seq_num
658 AND wor.operation_seq_num = p_eam_res_rec.operation_seq_num
659 AND wo.operation_seq_num = p_eam_res_rec.operation_seq_num
660 AND wo.department_id = p_eam_res_rec.department_id;
661 END IF;
662
663 x_return_status := FND_API.G_RET_STS_SUCCESS;
664
665 exception
666 when others then
667
668 l_out_mesg_token_tbl := l_mesg_token_tbl;
669 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
670 ( p_message_name => 'EAM_RES_DEPARTMENT_INVALID'
671 , p_token_tbl => l_token_tbl
672 , p_mesg_token_tbl => l_mesg_token_tbl
673 , x_mesg_token_tbl => l_out_mesg_token_tbl
674 );
675 l_mesg_token_tbl := l_out_mesg_token_tbl;
676
677 x_return_status := FND_API.G_RET_STS_ERROR;
678 x_mesg_token_tbl := l_mesg_token_tbl ;
679 return;
680
681 end;
682
683
684 -- usage_rate_or_amount
685 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating usage_rate_or_amount . . . '); END IF;
686 declare
687 l_hour_uom varchar2(50);
688 l_hour_uom_class varchar2(200);
689 l_uom_time_class_flag varchar2(3);
690 l_uom_class varchar2(10);
691 begin
692
693 if (p_eam_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
694
695 l_hour_uom := FND_PROFILE.value('BOM:HOUR_UOM_CODE');
696 l_hour_uom_class := WIP_OP_RESOURCES_UTILITIES.Get_Uom_Class(l_hour_uom);
697
698 select UOM.uom_class
699 into l_uom_class
700 from BOM_RESOURCES BR, MTL_UNITS_OF_MEASURE_VL UOM
701 where BR.resource_id = p_eam_res_rec.resource_id
702 and BR.unit_of_measure = UOM.uom_code;
703
704 IF l_hour_uom_class = l_uom_class THEN
705 l_uom_time_class_flag := 'Y';
706 ELSE
707 l_uom_time_class_flag := '';
708 END IF;
709
710 IF (p_eam_res_rec.usage_rate_or_amount < 0 and (p_eam_res_rec.autocharge_type = 3 or l_uom_time_class_flag = 'Y'))
711 THEN
712
713 raise fnd_api.g_exc_unexpected_error;
714
715 END IF;
716
717 end if;
718
719 x_return_status := FND_API.G_RET_STS_SUCCESS;
720
721 exception
722 when others then
723
724 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
725 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
726
727 l_out_mesg_token_tbl := l_mesg_token_tbl;
728 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
729 ( p_message_name => 'EAM_RES_USAGE_RATE_INVALID'
730 , p_token_tbl => l_token_tbl
731 , p_mesg_token_tbl => l_mesg_token_tbl
732 , x_mesg_token_tbl => l_out_mesg_token_tbl
733 );
734 l_mesg_token_tbl := l_out_mesg_token_tbl;
735
736 x_return_status := FND_API.G_RET_STS_ERROR;
737 x_mesg_token_tbl := l_mesg_token_tbl ;
738 return;
739
740 end;
741
742
743 /* added for bug no 3393323 */
744 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating that shift must exists if resource is not 24 hr resource . . . '); END IF;
745
746 begin
747
748 if p_eam_res_rec.scheduled_flag = 1 then
749 -- Shift must exists for a resource which is not 24 hour resource
750
751 select calendar_code into l_calendar_code
752 from mtl_parameters
753 where organization_id = p_eam_res_rec.organization_id;
754
755 select available_24_hours_flag into l_24_hr_resource
756 from bom_department_resources bdr
757 where bdr.department_id = p_eam_res_rec.department_id
758 and bdr.resource_id = p_eam_res_rec.resource_id ;
759
760 -- available_24_hours_flag is '1' for 24 hr resource and '2' for not 24 hr resource
761
762 if (l_24_hr_resource = 2) then
763 select count(rsh.shift_num) into l_count_shift_num
764 from bom_shift_times shf,
765 bom_resource_shifts rsh,
766 bom_department_resources bdr
767 where bdr.department_id = p_eam_res_rec.department_id
768 and bdr.resource_id = p_eam_res_rec.resource_id
769 and nvl(bdr.share_from_dept_id, bdr.department_id) = rsh.department_id
770 and bdr.resource_id = rsh.resource_id
771 and rsh.shift_num = shf.shift_num
772 and shf.calendar_code = l_calendar_code;
773
774
775 if(l_count_shift_num=0) then
776 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
777 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
778
779 l_out_mesg_token_tbl := l_mesg_token_tbl;
780 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
781 ( p_message_name => 'EAM_RES_RESOURCE_SHIFT_ND'
782 , p_token_tbl => l_token_tbl
783 , p_mesg_token_tbl => l_mesg_token_tbl
784 , x_mesg_token_tbl => l_out_mesg_token_tbl
785 );
786 l_mesg_token_tbl := l_out_mesg_token_tbl;
787
788 x_return_status := FND_API.G_RET_STS_ERROR;
789 x_mesg_token_tbl := l_mesg_token_tbl ;
790 return;
791 end if;
792 end if;
793 x_return_status := FND_API.G_RET_STS_SUCCESS;
794 end if;
795 exception
796 when others then
797 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
798 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
799
800 l_out_mesg_token_tbl := l_mesg_token_tbl;
801 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
802 ( p_message_name => 'EAM_RES_RESOURCE_SHIFT_ND'
803 , p_token_tbl => l_token_tbl
804 , p_mesg_token_tbl => l_mesg_token_tbl
805 , x_mesg_token_tbl => l_out_mesg_token_tbl
806 );
807 l_mesg_token_tbl := l_out_mesg_token_tbl;
808
809 x_return_status := FND_API.G_RET_STS_ERROR;
810 x_mesg_token_tbl := l_mesg_token_tbl ;
811 return;
812 end;
813
814
815 -- delete resource
816 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating resource . . . '); END IF;
817
818 declare
819 l_count_wt NUMBER :=0;
820 l_count_wcti NUMBER :=0;
821 l_applied_res_units NUMBER :=0;
822 begin
823
824 if (p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_DELETE) then
825
826 select count(*)
827 into l_count_wt
828 from DUAL
829 WHERE EXISTS (SELECT 1
830 FROM wip_transactions
831 where wip_entity_id = p_eam_res_rec.wip_entity_id
832 and organization_id = p_eam_res_rec.organization_id
833 and operation_seq_num = p_eam_res_rec.operation_seq_num
834 and resource_seq_num = p_eam_res_rec.resource_seq_num
835 and resource_id = p_eam_res_rec.resource_id);
836
837 if(l_count_wt > 0) then
838 raise fnd_api.g_exc_unexpected_error;
839 end if;
840
841 select count(*)
842 into l_count_wcti
843 from DUAL
844 WHERE EXISTS (SELECT 1
845 FROM wip_cost_txn_interface
846 where wip_entity_id = p_eam_res_rec.wip_entity_id
847 and organization_id = p_eam_res_rec.organization_id
848 and operation_seq_num = p_eam_res_rec.operation_seq_num
849 and resource_seq_num = p_eam_res_rec.resource_seq_num
850 and resource_id = p_eam_res_rec.resource_id);
851
852 if(l_count_wcti > 0) then
853 raise fnd_api.g_exc_unexpected_error;
854 end if;
855
856 select nvl(applied_resource_units,0)
857 into l_applied_res_units
858 from wip_operation_resources
859 where wip_entity_id = p_eam_res_rec.wip_entity_id
860 and organization_id = p_eam_res_rec.organization_id
861 and operation_seq_num = p_eam_res_rec.operation_seq_num
862 and resource_seq_num = p_eam_res_rec.resource_seq_num
863 and resource_id = p_eam_res_rec.resource_id;
864
865 if(l_applied_res_units <> 0) then
866 raise fnd_api.g_exc_unexpected_error;
867 end if;
868
869 end if;
870
871 x_return_status := FND_API.G_RET_STS_SUCCESS;
872
873 exception
874 when others then
875
876 l_token_tbl(1).token_name := 'WIP_ENTITY_ID';
877 l_token_tbl(1).token_value := p_eam_res_rec.wip_entity_id;
878
879 l_out_mesg_token_tbl := l_mesg_token_tbl;
880 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
881 ( p_message_name => 'EAM_RES_DELETE_INVALID'
882 , p_token_tbl => l_token_tbl
883 , p_mesg_token_tbl => l_mesg_token_tbl
884 , x_mesg_token_tbl => l_out_mesg_token_tbl
885 );
886 l_mesg_token_tbl := l_out_mesg_token_tbl;
887
888 x_return_status := FND_API.G_RET_STS_ERROR;
889 x_mesg_token_tbl := l_mesg_token_tbl ;
890 return;
891
892 end;
893
894 --if any resource instances are there we should not be able to delete the resource
895 declare
896 l_count_inst NUMBER :=0;
897 begin
898 if (p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_DELETE) then
899 select count(*)
900 into l_count_inst
901 from wip_op_resource_instances
902 where wip_entity_id = p_eam_res_rec.wip_entity_id
903 and organization_id = p_eam_res_rec.organization_id
904 and operation_seq_num = p_eam_res_rec.operation_seq_num
905 and resource_seq_num = p_eam_res_rec.resource_seq_num
906 and rownum <=1;
907
908 if(l_count_inst <> 0) then
909 raise fnd_api.g_exc_unexpected_error;
910 end if;
911 end if;
912 exception
913 when others then
914
915 l_out_mesg_token_tbl := l_mesg_token_tbl;
916 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
917 ( p_message_name => 'EAM_INSTANCES_EXIST'
918 , p_token_tbl => l_token_tbl
919 , p_mesg_token_tbl => l_mesg_token_tbl
920 , x_mesg_token_tbl => l_out_mesg_token_tbl
921 );
922 l_mesg_token_tbl := l_out_mesg_token_tbl;
923
924 x_return_status := FND_API.G_RET_STS_ERROR;
925 x_mesg_token_tbl := l_mesg_token_tbl ;
926 return;
927 end;
928
929
930 -- delete resource
931 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating substitute_resource . . . '); END IF;
932
933 declare
934 l_count_po NUMBER :=0;
935 l_count_req NUMBER :=0;
936 l_count_dist NUMBER :=0;
937 begin
938
939 if (p_eam_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_DELETE) then
940
941 select count(*)
942 into l_count_po
943 from DUAL
944 WHERE EXISTS (SELECT 1
945 FROM po_requisitions_interface
946 where wip_entity_id = p_eam_res_rec.wip_entity_id
947 and destination_organization_id = p_eam_res_rec.organization_id
948 and wip_operation_seq_num = p_eam_res_rec.operation_seq_num
949 and wip_resource_seq_num = p_eam_res_rec.resource_seq_num
950 and bom_resource_id = p_eam_res_rec.resource_id);
951
952 if(l_count_po <> 0) then
953 raise fnd_api.g_exc_unexpected_error;
954 end if;
955
956
957 select count(*)
958 into l_count_req
959 from DUAL
960 WHERE EXISTS (SELECT 1
961 FROM po_requisition_lines prl, po_requisition_headers prh
962 where prl.requisition_header_id = prh.requisition_header_id
963 and prl.wip_entity_id = p_eam_res_rec.wip_entity_id
964 and prl.destination_organization_id = p_eam_res_rec.organization_id
965 and prl.wip_operation_seq_num = p_eam_res_rec.operation_seq_num
966 and prl.wip_resource_seq_num = p_eam_res_rec.resource_seq_num
967 and prl.bom_resource_id = p_eam_res_rec.resource_id
968 and (prh.authorization_status <>'CANCELLED'
969 or prh.authorization_status is null)
970 and (prl.cancel_flag <>'Y' or prl.cancel_flag is null)
971 and (prl.closed_code not in ('FINALLY CLOSED')
972 or prl.closed_code is null)
973 and (prl.modified_by_agent_flag <> 'Y'
974 or prl.modified_by_agent_flag is null));
975
976
977 if(l_count_req <> 0) then
978 raise fnd_api.g_exc_unexpected_error;
979 end if;
980
981
982 select count(*)
983 into l_count_dist
984 from DUAL
985 WHERE EXISTS (SELECT 1
986 FROM po_distributions pds,po_line_locations poll
987 where pds.line_location_id = poll.line_location_id
988 and pds.wip_entity_id = p_eam_res_rec.wip_entity_id
989 and pds.destination_organization_id = p_eam_res_rec.organization_id
990 and pds.wip_operation_seq_num = p_eam_res_rec.operation_seq_num
991 and pds.wip_resource_seq_num = p_eam_res_rec.resource_seq_num
992 and pds.bom_resource_id = p_eam_res_rec.resource_id
993 and (poll.cancel_flag <>'Y' or poll.cancel_flag is null)
994 and (poll.closed_code not in ('CANCELLED','FINALLY CLOSED')
995 or poll.closed_code is null));
996
997
998 if(l_count_dist <> 0) then
999 raise fnd_api.g_exc_unexpected_error;
1000 end if;
1001
1002 end if;
1003
1004 x_return_status := FND_API.G_RET_STS_SUCCESS;
1005
1006 exception
1007 when others then
1008
1009 l_token_tbl(1).token_name := 'WIP_ENTITY_ID';
1010 l_token_tbl(1).token_value := p_eam_res_rec.wip_entity_id;
1011
1012 l_out_mesg_token_tbl := l_mesg_token_tbl;
1013 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1014 ( p_message_name => 'EAM_RES_DELETE_PO_INVALID'
1015 , p_token_tbl => l_token_tbl
1016 , p_mesg_token_tbl => l_mesg_token_tbl
1017 , x_mesg_token_tbl => l_out_mesg_token_tbl
1018 );
1019 l_mesg_token_tbl := l_out_mesg_token_tbl;
1020
1021 x_return_status := FND_API.G_RET_STS_ERROR;
1022 x_mesg_token_tbl := l_mesg_token_tbl ;
1023 return;
1024
1025 end;
1026
1027
1028
1029 x_return_status := FND_API.G_RET_STS_SUCCESS;
1030
1031 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Within Resource Check Attributes . . . '); END IF;
1032
1033
1034
1035 END Check_Attributes;
1036
1037 /*********************************************************************
1038 * Procedure : Check_Required
1039 * Parameters IN : Resource column record
1040 * Parameters OUT NOCOPY: Mesg Token Table
1041 * Return_Status
1042 * Purpose :
1043 **********************************************************************/
1044
1045 PROCEDURE Check_Required
1046 ( p_eam_res_rec IN EAM_PROCESS_WO_PUB.eam_res_rec_type
1047 , x_return_status OUT NOCOPY VARCHAR2
1048 , x_Mesg_Token_Tbl OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
1049 )
1050 IS
1051 l_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
1052 l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
1053 l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
1054 BEGIN
1055
1056 x_return_status := FND_API.G_RET_STS_SUCCESS;
1057
1058 IF p_eam_res_rec.wip_entity_id IS NULL
1059 THEN
1060 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1061 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1062
1063 l_out_mesg_token_tbl := l_mesg_token_tbl;
1064 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1065 ( p_message_name => 'EAM_RES_ENTITY_ID_REQUIRED'
1066 , p_token_tbl => l_Token_tbl
1067 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1068 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1069 );
1070 l_mesg_token_tbl := l_out_mesg_token_tbl;
1071
1072 x_return_status := FND_API.G_RET_STS_ERROR;
1073
1074 END IF;
1075
1076
1077 IF p_eam_res_rec.organization_id IS NULL
1078 THEN
1079 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1080 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1081
1082 l_out_mesg_token_tbl := l_mesg_token_tbl;
1083 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1084 ( p_message_name => 'EAM_RES_ORG_REQUIRED'
1085 , p_token_tbl => l_Token_tbl
1086 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1087 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1088 );
1089 l_mesg_token_tbl := l_out_mesg_token_tbl;
1090
1091 x_return_status := FND_API.G_RET_STS_ERROR;
1092
1093 END IF;
1094
1095
1096 IF p_eam_res_rec.operation_seq_num IS NULL
1097 THEN
1098 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1099 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1100
1101 l_out_mesg_token_tbl := l_mesg_token_tbl;
1102 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1103 ( p_message_name => 'EAM_RES_OP_SEQ_REQUIRED'
1104 , p_token_tbl => l_Token_tbl
1105 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1106 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1107 );
1108 l_mesg_token_tbl := l_out_mesg_token_tbl;
1109
1110 x_return_status := FND_API.G_RET_STS_ERROR;
1111
1112 END IF;
1113
1114
1115 IF p_eam_res_rec.resource_seq_num IS NULL
1116 THEN
1117 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1118 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1119
1120 l_out_mesg_token_tbl := l_mesg_token_tbl;
1121 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1122 ( p_message_name => 'EAM_RES_RES_SEQ_REQUIRED'
1123 , p_token_tbl => l_Token_tbl
1124 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1125 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1126 );
1127 l_mesg_token_tbl := l_out_mesg_token_tbl;
1128
1129 x_return_status := FND_API.G_RET_STS_ERROR;
1130
1131 END IF;
1132
1133
1134 IF p_eam_res_rec.resource_id IS NULL
1135 THEN
1136 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1137 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1138
1139 l_out_mesg_token_tbl := l_mesg_token_tbl;
1140 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1141 ( p_message_name => 'EAM_RES_RESOURCE_REQUIRED'
1142 , p_token_tbl => l_Token_tbl
1143 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1144 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1145 );
1146 l_mesg_token_tbl := l_out_mesg_token_tbl;
1147
1148 x_return_status := FND_API.G_RET_STS_ERROR;
1149
1150 END IF;
1151
1152
1153 IF p_eam_res_rec.basis_type IS NULL
1154 THEN
1155 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1156 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1157
1158 l_out_mesg_token_tbl := l_mesg_token_tbl;
1159 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1160 ( p_message_name => 'EAM_RES_BASIS_TYPE_REQUIRED'
1161 , p_token_tbl => l_Token_tbl
1162 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1163 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1164 );
1165 l_mesg_token_tbl := l_out_mesg_token_tbl;
1166
1167 x_return_status := FND_API.G_RET_STS_ERROR;
1168
1169 END IF;
1170
1171
1172 IF p_eam_res_rec.usage_rate_or_amount IS NULL
1173 THEN
1174 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1175 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1176
1177 l_out_mesg_token_tbl := l_mesg_token_tbl;
1178 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1179 ( p_message_name => 'EAM_RES_USAGE_RATE_REQUIRED'
1180 , p_token_tbl => l_Token_tbl
1181 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1182 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1183 );
1184 l_mesg_token_tbl := l_out_mesg_token_tbl;
1185
1186 x_return_status := FND_API.G_RET_STS_ERROR;
1187
1188 END IF;
1189
1190
1191 IF p_eam_res_rec.scheduled_flag IS NULL
1192 THEN
1193 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1194 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1195
1196 l_out_mesg_token_tbl := l_mesg_token_tbl;
1197 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1198 ( p_message_name => 'EAM_RES_SCHEDULE_TYPE_REQUIRED'
1199 , p_token_tbl => l_Token_tbl
1200 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1201 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1202 );
1203 l_mesg_token_tbl := l_out_mesg_token_tbl;
1204
1205 x_return_status := FND_API.G_RET_STS_ERROR;
1206
1207 END IF;
1208
1209
1210 IF p_eam_res_rec.autocharge_type IS NULL
1211 THEN
1212 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1213 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1214
1215 l_out_mesg_token_tbl := l_mesg_token_tbl;
1216 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1217 ( p_message_name => 'EAM_RES_AC_TYPE_REQUIRED'
1218 , p_token_tbl => l_Token_tbl
1219 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1220 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1221 );
1222 l_mesg_token_tbl := l_out_mesg_token_tbl;
1223
1224 x_return_status := FND_API.G_RET_STS_ERROR;
1225
1226 END IF;
1227
1228
1229 IF p_eam_res_rec.standard_rate_flag IS NULL
1230 THEN
1231 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1232 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1233
1234 l_out_mesg_token_tbl := l_mesg_token_tbl;
1235 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1236 ( p_message_name => 'EAM_RES_STD_RATE_REQUIRED'
1237 , p_token_tbl => l_Token_tbl
1238 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1239 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1240 );
1241 l_mesg_token_tbl := l_out_mesg_token_tbl;
1242
1243 x_return_status := FND_API.G_RET_STS_ERROR;
1244
1245 END IF;
1246
1247
1248 IF p_eam_res_rec.applied_resource_units IS NULL
1249 THEN
1250 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1251 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1252
1253 l_out_mesg_token_tbl := l_mesg_token_tbl;
1254 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1255 ( p_message_name => 'EAM_RES_APPL_UNIT_REQUIRED'
1256 , p_token_tbl => l_Token_tbl
1257 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1258 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1259 );
1260 l_mesg_token_tbl := l_out_mesg_token_tbl;
1261
1262 x_return_status := FND_API.G_RET_STS_ERROR;
1263
1264 END IF;
1265
1266
1267 IF p_eam_res_rec.applied_resource_value IS NULL
1268 THEN
1269 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1270 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1271
1272 l_out_mesg_token_tbl := l_mesg_token_tbl;
1273 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1274 ( p_message_name => 'EAM_RES_APPL_VALUE_REQUIRED'
1275 , p_token_tbl => l_Token_tbl
1276 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1277 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1278 );
1279 l_mesg_token_tbl := l_out_mesg_token_tbl;
1280
1281 x_return_status := FND_API.G_RET_STS_ERROR;
1282
1283 END IF;
1284
1285
1286 IF p_eam_res_rec.start_date IS NULL
1287 THEN
1288 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1289 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1290
1291 l_out_mesg_token_tbl := l_mesg_token_tbl;
1292 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1293 ( p_message_name => 'EAM_RES_START_DATE_REQUIRED'
1294 , p_token_tbl => l_Token_tbl
1295 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1296 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1297 );
1298 l_mesg_token_tbl := l_out_mesg_token_tbl;
1299
1300 x_return_status := FND_API.G_RET_STS_ERROR;
1301
1302 END IF;
1303
1304
1305 IF p_eam_res_rec.completion_date IS NULL
1306 THEN
1307 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1308 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1309
1310 l_out_mesg_token_tbl := l_mesg_token_tbl;
1311 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1312 ( p_message_name => 'EAM_RES_COMPL_DATE_REQUIRED'
1313 , p_token_tbl => l_Token_tbl
1314 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1315 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1316 );
1317 l_mesg_token_tbl := l_out_mesg_token_tbl;
1318
1319 x_return_status := FND_API.G_RET_STS_ERROR;
1320
1321 END IF;
1322
1323
1324 IF p_eam_res_rec.department_id IS NULL
1325 THEN
1326 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1327 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1328
1329 l_out_mesg_token_tbl := l_mesg_token_tbl;
1330 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1331 ( p_message_name => 'EAM_RES_DEPARTMENT_REQUIRED'
1332 , p_token_tbl => l_Token_tbl
1333 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1334 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1335 );
1336 l_mesg_token_tbl := l_out_mesg_token_tbl;
1337
1338 x_return_status := FND_API.G_RET_STS_ERROR;
1339
1340 END IF;
1341
1342 IF p_eam_res_rec.uom_code IS NULL
1343 THEN
1344 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1345 l_token_tbl(1).token_value := p_eam_res_rec.resource_seq_num;
1346
1347 l_out_mesg_token_tbl := l_mesg_token_tbl;
1348 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1349 ( p_message_name => 'EAM_RES_UOM_CODE_REQUIRED'
1350 , p_token_tbl => l_Token_tbl
1351 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1352 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1353 );
1354 l_mesg_token_tbl := l_out_mesg_token_tbl;
1355
1356 x_return_status := FND_API.G_RET_STS_ERROR;
1357
1358 END IF;
1359
1360
1361 x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
1362
1363 END Check_Required;
1364
1365 END EAM_RES_VALIDATE_PVT;