[Home] [Help]
PACKAGE BODY: APPS.EAM_SUB_RESOURCE_VALIDATE_PVT
Source
1 PACKAGE BODY EAM_SUB_RESOURCE_VALIDATE_PVT AS
2 /* $Header: EAMVSRVB.pls 120.0 2005/05/24 17:31:04 appldev noship $ */
3 /***************************************************************************
4 --
5 -- Copyright (c) 2002 Oracle Corporation, Redwood Shores, CA, USA
6 -- All rights reserved.
7 --
8 -- FILENAME
9 --
10 -- EAMVSRVB.pls
11 --
12 -- DESCRIPTION
13 --
14 -- Body of package EAM_SUB_RESOURCE_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_SUB_RESOURCE_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 : Sub Resource Record
33 * Parameters OUT NOCOPY: Old Sub Resource Record
34 * Mesg Token Table
35 * Return Status
36 * Purpose : Procedure will query the old Sub 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_sub_res_rec IN EAM_PROCESS_WO_PUB.eam_sub_res_rec_type
49 , x_old_eam_sub_res_rec OUT NOCOPY EAM_PROCESS_WO_PUB.eam_sub_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 Sub Resource'); END IF;
61
62 EAM_SUB_RESOURCE_UTILITY_PVT.Query_Row
63 ( p_wip_entity_id => p_eam_sub_res_rec.wip_entity_id
64 , p_organization_id => p_eam_sub_res_rec.organization_id
65 , p_operation_seq_num => p_eam_sub_res_rec.operation_seq_num
66 , p_resource_seq_num => p_eam_sub_res_rec.resource_seq_num
67 , x_eam_sub_res_rec => x_old_eam_sub_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_sub_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_sub_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_SR_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_sub_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_sub_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_SR_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 ' || 'Sub Resource '|| p_eam_sub_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_sub_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_sub_res_rec.transaction_type := EAM_PROCESS_WO_PVT.G_OPR_UPDATE;
124 ELSE
125 x_old_eam_sub_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 : Sub Resource Column record
141 * Old Sub 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 PROCEDURE Check_Attributes
149 ( p_eam_sub_res_rec IN EAM_PROCESS_WO_PUB.eam_sub_res_rec_type
150 , p_old_eam_sub_res_rec IN EAM_PROCESS_WO_PUB.eam_sub_res_rec_type
151 , x_return_status OUT NOCOPY VARCHAR2
152 , x_Mesg_Token_Tbl OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
153 )
154 IS
155 l_err_text VARCHAR2(2000) := NULL;
156 l_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
157 l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
158 l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
159
160 BEGIN
161
162
163
164 -- operation_seq_num
165
166 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating operation_seq_num . . . '); END IF;
167
168 begin
169
170 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
171
172 select 1
173 into g_dummy
174 from wip_operations wo
175 where wo.organization_id = p_eam_sub_res_rec.organization_id
176 and wo.wip_entity_id = p_eam_sub_res_rec.wip_entity_id
177 and wo.operation_seq_num = p_eam_sub_res_rec.operation_seq_num;
178
179 end if;
180
181 x_return_status := FND_API.G_RET_STS_SUCCESS;
182
183 exception
184 when others then
185
186 l_token_tbl(1).token_name := 'OP_SEQ_NUM';
187 l_token_tbl(1).token_value := p_eam_sub_res_rec.operation_seq_num;
188
189 l_out_mesg_token_tbl := l_mesg_token_tbl;
190 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
191 ( p_message_name => 'EAM_SR_OP_SEQ_INVALID'
192 , p_token_tbl => l_token_tbl
193 , p_mesg_token_tbl => l_mesg_token_tbl
194 , x_mesg_token_tbl => l_out_mesg_token_tbl
195 );
196 l_mesg_token_tbl := l_out_mesg_token_tbl;
197
198 x_return_status := FND_API.G_RET_STS_ERROR;
199 x_mesg_token_tbl := l_mesg_token_tbl ;
200 return;
201
202 end;
203
204
205 -- start_date
206 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating start_date . . . '); END IF;
207
208 begin
209
210 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
211
212 if p_eam_sub_res_rec.start_date > p_eam_sub_res_rec.completion_date then
213 raise fnd_api.g_exc_unexpected_error;
214 end if;
215
216 end if;
217
218 x_return_status := FND_API.G_RET_STS_SUCCESS;
219
220 exception
221 when others then
222
223 l_token_tbl(1).token_name := 'START_DATE';
224 l_token_tbl(1).token_value := p_eam_sub_res_rec.start_date;
225
226 l_out_mesg_token_tbl := l_mesg_token_tbl;
227 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
228 ( p_message_name => 'EAM_SR_START_DATE_INVALID'
229 , p_token_tbl => l_token_tbl
230 , p_mesg_token_tbl => l_mesg_token_tbl
231 , x_mesg_token_tbl => l_out_mesg_token_tbl
232 );
233 l_mesg_token_tbl := l_out_mesg_token_tbl;
234
235 x_return_status := FND_API.G_RET_STS_ERROR;
236 x_mesg_token_tbl := l_mesg_token_tbl ;
237 return;
238
239 end;
240
241
242 -- assigned_units
243 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating assigned_units . . . '); END IF;
244
245 begin
246
247 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
248
249 if (p_eam_sub_res_rec.assigned_units < 0 ) then
250 raise fnd_api.g_exc_unexpected_error;
251 end if;
252
253 end if;
254
255 x_return_status := FND_API.G_RET_STS_SUCCESS;
256
257 exception
258 when others then
259
260 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
261 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
262
263 l_out_mesg_token_tbl := l_mesg_token_tbl;
264 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
265 ( p_message_name => 'EAM_SR_ASSIGNED_UNIT_INVALID'
266 , p_token_tbl => l_token_tbl
267 , p_mesg_token_tbl => l_mesg_token_tbl
268 , x_mesg_token_tbl => l_out_mesg_token_tbl
269 );
270 l_mesg_token_tbl := l_out_mesg_token_tbl;
271
272 x_return_status := FND_API.G_RET_STS_ERROR;
273 x_mesg_token_tbl := l_mesg_token_tbl ;
274 return;
275
276 end;
277
278
279 -- resource_id
280 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating resource_id . . . '); END IF;
281
282 begin
283
284 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
285
286 select 1
287 into g_dummy
288 from bom_resources
289 where organization_id = p_eam_sub_res_rec.organization_id
290 and resource_id = p_eam_sub_res_rec.resource_id;
291
292 end if;
293
294 x_return_status := FND_API.G_RET_STS_SUCCESS;
295
296 exception
297 when others then
298
299 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
300 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
301
302 l_out_mesg_token_tbl := l_mesg_token_tbl;
303 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
304 ( p_message_name => 'EAM_SR_RESOURCE_INVALID'
305 , p_token_tbl => l_token_tbl
306 , p_mesg_token_tbl => l_mesg_token_tbl
307 , x_mesg_token_tbl => l_out_mesg_token_tbl
308 );
309 l_mesg_token_tbl := l_out_mesg_token_tbl;
310
311 x_return_status := FND_API.G_RET_STS_ERROR;
312 x_mesg_token_tbl := l_mesg_token_tbl ;
313 return;
314
315 end;
316
317
318 -- uom_code
319 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating uom_code . . . '); END IF;
320
321 begin
322
323 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
324
325 select 1
326 into g_dummy
327 from mtl_units_of_measure
328 where uom_code = p_eam_sub_res_rec.uom_code;
329
330 end if;
331
332 x_return_status := FND_API.G_RET_STS_SUCCESS;
333
334 exception
335 when others then
336
337 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
338 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
339
340 l_out_mesg_token_tbl := l_mesg_token_tbl;
341 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
342 ( p_message_name => 'EAM_SR_UOM_INVALID'
343 , p_token_tbl => l_token_tbl
344 , p_mesg_token_tbl => l_mesg_token_tbl
345 , x_mesg_token_tbl => l_out_mesg_token_tbl
346 );
347 l_mesg_token_tbl := l_out_mesg_token_tbl;
348
349 x_return_status := FND_API.G_RET_STS_ERROR;
350 x_mesg_token_tbl := l_mesg_token_tbl ;
351 return;
352
353 end;
354
355
356 -- basis_type
357 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating basis_type . . . '); END IF;
358
359 begin
360
361 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
362
363 select 1
364 into g_dummy
365 from mfg_lookups
366 where lookup_type = 'CST_BASIS'
367 and lookup_code in (1,2)
368 and lookup_code = p_eam_sub_res_rec.basis_type;
369
370 end if;
371
372 x_return_status := FND_API.G_RET_STS_SUCCESS;
373
374 exception
375 when others then
376
377 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
378 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
379
380 l_out_mesg_token_tbl := l_mesg_token_tbl;
381 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
382 ( p_message_name => 'EAM_SR_BASIS_TYPE_INVALID'
383 , p_token_tbl => l_token_tbl
384 , p_mesg_token_tbl => l_mesg_token_tbl
385 , x_mesg_token_tbl => l_out_mesg_token_tbl
386 );
387 l_mesg_token_tbl := l_out_mesg_token_tbl;
388
389 x_return_status := FND_API.G_RET_STS_ERROR;
390 x_mesg_token_tbl := l_mesg_token_tbl ;
391 return;
392
393 end;
394
395
396 -- activity_id
397 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating activity_id . . . '); END IF;
398
399 begin
400
401 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
402
403 IF (p_eam_sub_res_rec.activity_id is not NULL)
404 THEN
405
406 select 1
407 into g_dummy
408 from cst_activities
409 where (organization_id = p_eam_sub_res_rec.organization_id or organization_id is null)
410 and nvl(disable_date, sysdate + 2) > sysdate
411 and activity_id = p_eam_sub_res_rec.activity_id;
412
413 END IF;
414
415 end if;
416
417 x_return_status := FND_API.G_RET_STS_SUCCESS;
418
419 exception
420 when others then
421
422 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
423 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
424
425 l_out_mesg_token_tbl := l_mesg_token_tbl;
426 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
427 ( p_message_name => 'EAM_SR_ACTIVITY_INVALID'
428 , p_token_tbl => l_token_tbl
429 , p_mesg_token_tbl => l_mesg_token_tbl
430 , x_mesg_token_tbl => l_out_mesg_token_tbl
431 );
432 l_mesg_token_tbl := l_out_mesg_token_tbl;
433
434 x_return_status := FND_API.G_RET_STS_ERROR;
435 x_mesg_token_tbl := l_mesg_token_tbl ;
436 return;
437
438 end;
439
440
441 -- autocharge_type
442 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating autocharge_type . . . '); END IF;
443
444 begin
445
446 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
447
448 select 1
449 into g_dummy
450 from mfg_lookups
451 where lookup_type = g_autocharge_type
452 and lookup_code in (2,3)
453 and lookup_code = p_eam_sub_res_rec.autocharge_type;
454
455 end if;
456
457 x_return_status := FND_API.G_RET_STS_SUCCESS;
458
459 exception
460 when others then
461
462 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
463 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
464
465 l_out_mesg_token_tbl := l_mesg_token_tbl;
466 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
467 ( p_message_name => 'EAM_SR_AC_TYPE_INVALID'
468 , p_token_tbl => l_token_tbl
469 , p_mesg_token_tbl => l_mesg_token_tbl
470 , x_mesg_token_tbl => l_out_mesg_token_tbl
471 );
472 l_mesg_token_tbl := l_out_mesg_token_tbl;
473
474 x_return_status := FND_API.G_RET_STS_ERROR;
475 x_mesg_token_tbl := l_mesg_token_tbl ;
476 return;
477
478 end;
479
480
481 -- scheduled_flag
482 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating schedule_flag . . . '); END IF;
483
484 begin
485
486 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
487
488 select 1
489 into g_dummy
490 from mfg_lookups
491 where lookup_type = 'BOM_RESOURCE_SCHEDULE_TYPE'
492 and lookup_code = p_eam_sub_res_rec.scheduled_flag;
493
494 end if;
495
496 x_return_status := FND_API.G_RET_STS_SUCCESS;
497
498 exception
499 when others then
500
501 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
502 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
503
504 l_out_mesg_token_tbl := l_mesg_token_tbl;
505 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
506 ( p_message_name => 'EAM_SR_SCHEDULE_TYPE_INVALID'
507 , p_token_tbl => l_token_tbl
508 , p_mesg_token_tbl => l_mesg_token_tbl
509 , x_mesg_token_tbl => l_out_mesg_token_tbl
510 );
511 l_mesg_token_tbl := l_out_mesg_token_tbl;
512
513 x_return_status := FND_API.G_RET_STS_ERROR;
514 x_mesg_token_tbl := l_mesg_token_tbl ;
515 return;
516
517 end;
518
519
520 -- standard_rate_flag
521 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating schedule_flag . . . '); END IF;
522
523 begin
524
525 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
526
527 IF (p_eam_sub_res_rec.standard_rate_flag is not NULL) and (p_eam_sub_res_rec.standard_rate_flag not in (1, 2))
528 THEN
529
530 raise fnd_api.g_exc_unexpected_error;
531
532 END IF;
533
534 end if;
535
536 x_return_status := FND_API.G_RET_STS_SUCCESS;
537
538 exception
539 when others then
540
541 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
542 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
543
544 l_out_mesg_token_tbl := l_mesg_token_tbl;
545 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
546 ( p_message_name => 'EAM_SR_STANDARD_RATE_INVALID'
547 , p_token_tbl => l_token_tbl
548 , p_mesg_token_tbl => l_mesg_token_tbl
549 , x_mesg_token_tbl => l_out_mesg_token_tbl
550 );
551 l_mesg_token_tbl := l_out_mesg_token_tbl;
552
553 x_return_status := FND_API.G_RET_STS_ERROR;
554 x_mesg_token_tbl := l_mesg_token_tbl ;
555 return;
556
557 end;
558
559 -- department_id
560 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating Department. . .
561 '); END IF;
562
563 begin
564
565 -- Check whether sub resource dept and op dept match.
566 select 1 into g_dummy from
567 wip_operations wo
568 where wo.wip_entity_id = p_eam_sub_res_rec.wip_entity_id
569 and wo.organization_id = p_eam_sub_res_rec.organization_id
570 and wo.operation_seq_num = p_eam_sub_res_rec.operation_seq_num
571 and wo.department_id = p_eam_sub_res_rec.department_id;
572
573 -- Check whether dept is defined in BOM.
574 select 1 into g_dummy from
575 bom_departments bd where
576 bd.organization_id = p_eam_sub_res_rec.organization_id
577 and bd.department_id = p_eam_sub_res_rec.department_id;
578
579 -- Check whether trying to update department (which is disallowed).
580 IF p_eam_sub_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_UPDATE THEN
581
582 select 1 into g_dummy from
583 wip_sub_operation_resources wsor where
584 wsor.wip_entity_id = p_eam_sub_res_rec.wip_entity_id
585 and wsor.organization_id = p_eam_sub_res_rec.organization_id
586 and wsor.resource_seq_num = p_eam_sub_res_rec.resource_seq_num
587 and wsor.operation_seq_num = p_eam_sub_res_rec.operation_seq_num
588 and wsor.department_id = p_eam_sub_res_rec.department_id;
589
590 END IF;
591
592 x_return_status := FND_API.G_RET_STS_SUCCESS;
593
594 exception
595 when others then
596
597 l_out_mesg_token_tbl := l_mesg_token_tbl;
598 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
599 ( p_message_name => 'EAM_SR_DEPARTMENT_INVALID'
600 , p_token_tbl => l_token_tbl
601 , p_mesg_token_tbl => l_mesg_token_tbl
602 , x_mesg_token_tbl => l_out_mesg_token_tbl
603 );
604 l_mesg_token_tbl := l_out_mesg_token_tbl;
605
606 x_return_status := FND_API.G_RET_STS_ERROR;
607 x_mesg_token_tbl := l_mesg_token_tbl ;
608 return;
609
610 end;
611
612
613
614 -- usage_rate_or_amount
615 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating usage_rate_or_amount . . . '); END IF;
616 declare
617 l_hour_uom varchar2(50);
618 l_hour_uom_class varchar2(200);
619 l_uom_time_class_flag varchar2(3);
620 l_uom_class varchar2(10);
621 begin
622
623 if (p_eam_sub_res_rec.transaction_type in (EAM_PROCESS_WO_PVT.G_OPR_CREATE, EAM_PROCESS_WO_PVT.G_OPR_UPDATE)) then
624
625 l_hour_uom := FND_PROFILE.value('BOM:HOUR_UOM_CODE');
626 l_hour_uom_class := WIP_OP_RESOURCES_UTILITIES.Get_Uom_Class(l_hour_uom);
627
628 select UOM.uom_class
629 into l_uom_class
630 from BOM_RESOURCES BR, MTL_UNITS_OF_MEASURE_VL UOM
631 where BR.resource_id = p_eam_sub_res_rec.resource_id
632 and BR.unit_of_measure = UOM.uom_code;
633
634 IF l_hour_uom_class = l_uom_class THEN
635 l_uom_time_class_flag := 'Y';
636 ELSE
637 l_uom_time_class_flag := '';
638 END IF;
639
640 IF (p_eam_sub_res_rec.usage_rate_or_amount < 0 and (p_eam_sub_res_rec.autocharge_type = 3 or l_uom_time_class_flag = 'Y'))
641 THEN
642
643 raise fnd_api.g_exc_unexpected_error;
644
645 END IF;
646
647 end if;
648
649 x_return_status := FND_API.G_RET_STS_SUCCESS;
650
651 exception
652 when others then
653
654 l_token_tbl(1).token_name := 'RES_SEQ_NUM';
655 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
656
657 l_out_mesg_token_tbl := l_mesg_token_tbl;
658 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
659 ( p_message_name => 'EAM_SR_USAGE_RATE_INVALID'
660 , p_token_tbl => l_token_tbl
661 , p_mesg_token_tbl => l_mesg_token_tbl
662 , x_mesg_token_tbl => l_out_mesg_token_tbl
663 );
664 l_mesg_token_tbl := l_out_mesg_token_tbl;
665
666 x_return_status := FND_API.G_RET_STS_ERROR;
667 x_mesg_token_tbl := l_mesg_token_tbl ;
668 return;
669
670 end;
671
672
673
674 -- delete substitute_resource
675 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating substitute_resource . . . '); END IF;
676
677 declare
678 l_count_wt NUMBER :=0;
679 l_count_wcti NUMBER :=0;
680 l_applied_res_units NUMBER :=0;
681 begin
682
683 if (p_eam_sub_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_DELETE) then
684
685 select count(*)
686 into l_count_wt
687 from DUAL
688 WHERE EXISTS (SELECT 1
689 FROM wip_transactions
690 where wip_entity_id = p_eam_sub_res_rec.wip_entity_id
691 and organization_id = p_eam_sub_res_rec.organization_id
692 and operation_seq_num = p_eam_sub_res_rec.operation_seq_num
693 and resource_seq_num = p_eam_sub_res_rec.resource_seq_num
694 and resource_id = p_eam_sub_res_rec.resource_id);
695
696 if(l_count_wt > 0) then
697 raise fnd_api.g_exc_unexpected_error;
698 end if;
699
700 select count(*)
701 into l_count_wcti
702 from DUAL
703 WHERE EXISTS (SELECT 1
704 FROM wip_cost_txn_interface
705 where wip_entity_id = p_eam_sub_res_rec.wip_entity_id
706 and organization_id = p_eam_sub_res_rec.organization_id
707 and operation_seq_num = p_eam_sub_res_rec.operation_seq_num
708 and resource_seq_num = p_eam_sub_res_rec.resource_seq_num
709 and resource_id = p_eam_sub_res_rec.resource_id);
710
711 if(l_count_wcti > 0) then
712 raise fnd_api.g_exc_unexpected_error;
713 end if;
714
715 select applied_resource_units
716 into l_applied_res_units
717 from wip_operation_resources
718 where wip_entity_id = p_eam_sub_res_rec.wip_entity_id
719 and organization_id = p_eam_sub_res_rec.organization_id
720 and operation_seq_num = p_eam_sub_res_rec.operation_seq_num
721 and resource_seq_num = p_eam_sub_res_rec.resource_seq_num
722 and resource_id = p_eam_sub_res_rec.resource_id;
723
724 if(l_applied_res_units <> 0) then
725 raise fnd_api.g_exc_unexpected_error;
726 end if;
727
728 end if;
729
730 x_return_status := FND_API.G_RET_STS_SUCCESS;
731
732 exception
733 when others then
734
735 l_token_tbl(1).token_name := 'WIP_ENTITY_ID';
736 l_token_tbl(1).token_value := p_eam_sub_res_rec.wip_entity_id;
737
738 l_out_mesg_token_tbl := l_mesg_token_tbl;
739 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
740 ( p_message_name => 'EAM_SR_DELETE_INVALID'
741 , p_token_tbl => l_token_tbl
742 , p_mesg_token_tbl => l_mesg_token_tbl
743 , x_mesg_token_tbl => l_out_mesg_token_tbl
744 );
745 l_mesg_token_tbl := l_out_mesg_token_tbl;
746
747 x_return_status := FND_API.G_RET_STS_ERROR;
748 x_mesg_token_tbl := l_mesg_token_tbl ;
749 return;
750
751 end;
752
753
754 -- delete substitute_resource
755 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Validating substitute_resource . . . '); END IF;
756
757 declare
758 l_count_po NUMBER :=0;
759 l_count_req NUMBER :=0;
760 l_count_dist NUMBER :=0;
761 begin
762
763 if (p_eam_sub_res_rec.transaction_type = EAM_PROCESS_WO_PVT.G_OPR_DELETE) then
764
765 select count(*)
766 into l_count_po
767 from DUAL
768 WHERE EXISTS (SELECT 1
769 FROM po_requisitions_interface
770 where wip_entity_id = p_eam_sub_res_rec.wip_entity_id
771 and destination_organization_id = p_eam_sub_res_rec.organization_id
772 and wip_operation_seq_num = p_eam_sub_res_rec.operation_seq_num
773 and wip_resource_seq_num = p_eam_sub_res_rec.resource_seq_num
774 and bom_resource_id = p_eam_sub_res_rec.resource_id);
775
776 if(l_count_po <> 0) then
777 raise fnd_api.g_exc_unexpected_error;
778 end if;
779
780
781 select count(*)
782 into l_count_req
783 from DUAL
784 WHERE EXISTS (SELECT 1
785 FROM po_requisition_lines
786 where wip_entity_id = p_eam_sub_res_rec.wip_entity_id
787 and destination_organization_id = p_eam_sub_res_rec.organization_id
788 and wip_operation_seq_num = p_eam_sub_res_rec.operation_seq_num
789 and wip_resource_seq_num = p_eam_sub_res_rec.resource_seq_num
790 and bom_resource_id = p_eam_sub_res_rec.resource_id);
791
792 if(l_count_req <> 0) then
793 raise fnd_api.g_exc_unexpected_error;
794 end if;
795
796
797 select count(*)
798 into l_count_dist
799 from DUAL
800 WHERE EXISTS (SELECT 1
801 FROM po_distributions
802 where wip_entity_id = p_eam_sub_res_rec.wip_entity_id
803 and destination_organization_id = p_eam_sub_res_rec.organization_id
804 and wip_operation_seq_num = p_eam_sub_res_rec.operation_seq_num
805 and wip_resource_seq_num = p_eam_sub_res_rec.resource_seq_num
806 and bom_resource_id = p_eam_sub_res_rec.resource_id);
807
808 if(l_count_dist <> 0) then
809 raise fnd_api.g_exc_unexpected_error;
810 end if;
811
812 end if;
813
814 x_return_status := FND_API.G_RET_STS_SUCCESS;
815
816 exception
817 when others then
818
819 l_token_tbl(1).token_name := 'WIP_ENTITY_ID';
820 l_token_tbl(1).token_value := p_eam_sub_res_rec.wip_entity_id;
821
822 l_out_mesg_token_tbl := l_mesg_token_tbl;
823 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
824 ( p_message_name => 'EAM_SR_DELETE_PO_INVALID'
825 , p_token_tbl => l_token_tbl
826 , p_mesg_token_tbl => l_mesg_token_tbl
827 , x_mesg_token_tbl => l_out_mesg_token_tbl
828 );
829 l_mesg_token_tbl := l_out_mesg_token_tbl;
830
831 x_return_status := FND_API.G_RET_STS_ERROR;
832 x_mesg_token_tbl := l_mesg_token_tbl ;
833 return;
834
835 end;
836
837
838
839 x_return_status := FND_API.G_RET_STS_SUCCESS;
840
841 IF EAM_PROCESS_WO_PVT.GET_DEBUG = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Within Sub Resource Check Attributes . . . '); END IF;
842
843
844
845 END Check_Attributes;
846
847 /*********************************************************************
848 * Procedure : Check_Required
849 * Parameters IN : Sub Resource column record
850 * Parameters OUT NOCOPY: Mesg Token Table
851 * Return_Status
852 * Purpose :
853 **********************************************************************/
854
855 PROCEDURE Check_Required
856 ( p_eam_sub_res_rec IN EAM_PROCESS_WO_PUB.eam_sub_res_rec_type
857 , x_return_status OUT NOCOPY VARCHAR2
858 , x_Mesg_Token_Tbl OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
859 )
860 IS
861 l_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
862 l_out_Mesg_Token_Tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
863 l_Token_Tbl EAM_ERROR_MESSAGE_PVT.Token_Tbl_Type;
864 BEGIN
865
866 x_return_status := FND_API.G_RET_STS_SUCCESS;
867
868 IF p_eam_sub_res_rec.wip_entity_id IS NULL
869 THEN
870 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
871 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
872
873 l_out_mesg_token_tbl := l_mesg_token_tbl;
874 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
875 ( p_message_name => 'EAM_SR_ENTITY_ID_REQUIRED'
876 , p_token_tbl => l_Token_tbl
877 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
878 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
879 );
880 l_mesg_token_tbl := l_out_mesg_token_tbl;
881
882 x_return_status := FND_API.G_RET_STS_ERROR;
883
884 END IF;
885
886
887 IF p_eam_sub_res_rec.organization_id IS NULL
888 THEN
889 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
890 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
891
892 l_out_mesg_token_tbl := l_mesg_token_tbl;
893 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
894 ( p_message_name => 'EAM_SR_ORG_REQUIRED'
895 , p_token_tbl => l_Token_tbl
896 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
897 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
898 );
899 l_mesg_token_tbl := l_out_mesg_token_tbl;
900
901 x_return_status := FND_API.G_RET_STS_ERROR;
902
903 END IF;
904
905
906 IF p_eam_sub_res_rec.operation_seq_num IS NULL
907 THEN
908 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
909 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
910
911 l_out_mesg_token_tbl := l_mesg_token_tbl;
912 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
913 ( p_message_name => 'EAM_SR_OP_SEQ_REQUIRED'
914 , p_token_tbl => l_Token_tbl
915 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
916 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
917 );
918 l_mesg_token_tbl := l_out_mesg_token_tbl;
919
920 x_return_status := FND_API.G_RET_STS_ERROR;
921
922 END IF;
923
924
925 IF p_eam_sub_res_rec.resource_seq_num IS NULL
926 THEN
927 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
928 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
929
930 l_out_mesg_token_tbl := l_mesg_token_tbl;
931 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
932 ( p_message_name => 'EAM_SR_RES_SEQ_REQUIRED'
933 , p_token_tbl => l_Token_tbl
934 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
935 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
936 );
937 l_mesg_token_tbl := l_out_mesg_token_tbl;
938
939 x_return_status := FND_API.G_RET_STS_ERROR;
940
941 END IF;
942
943
944 IF p_eam_sub_res_rec.resource_id IS NULL
945 THEN
946 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
947 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
948
949 l_out_mesg_token_tbl := l_mesg_token_tbl;
950 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
951 ( p_message_name => 'EAM_SR_RESOURCE_REQUIRED'
952 , p_token_tbl => l_Token_tbl
953 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
954 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
955 );
956 l_mesg_token_tbl := l_out_mesg_token_tbl;
957
958 x_return_status := FND_API.G_RET_STS_ERROR;
959
960 END IF;
961
962
963 IF p_eam_sub_res_rec.basis_type IS NULL
964 THEN
965 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
966 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
967
968 l_out_mesg_token_tbl := l_mesg_token_tbl;
969 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
970 ( p_message_name => 'EAM_SR_BASIS_TYPE_REQUIRED'
971 , p_token_tbl => l_Token_tbl
972 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
973 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
974 );
975 l_mesg_token_tbl := l_out_mesg_token_tbl;
976
977 x_return_status := FND_API.G_RET_STS_ERROR;
978
979 END IF;
980
981
982 IF p_eam_sub_res_rec.usage_rate_or_amount IS NULL
983 THEN
984 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
985 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
986
987 l_out_mesg_token_tbl := l_mesg_token_tbl;
988 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
989 ( p_message_name => 'EAM_SR_USAGE_RATE_REQUIRED'
990 , p_token_tbl => l_Token_tbl
991 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
992 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
993 );
994 l_mesg_token_tbl := l_out_mesg_token_tbl;
995
996 x_return_status := FND_API.G_RET_STS_ERROR;
997
998 END IF;
999
1000
1001 IF p_eam_sub_res_rec.scheduled_flag IS NULL
1002 THEN
1003 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1004 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
1005
1006 l_out_mesg_token_tbl := l_mesg_token_tbl;
1007 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1008 ( p_message_name => 'EAM_SR_SCHEDULE_TYPE_REQUIRED'
1009 , p_token_tbl => l_Token_tbl
1010 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1011 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1012 );
1013 l_mesg_token_tbl := l_out_mesg_token_tbl;
1014
1015 x_return_status := FND_API.G_RET_STS_ERROR;
1016
1017 END IF;
1018
1019
1020 IF p_eam_sub_res_rec.autocharge_type IS NULL
1021 THEN
1022 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1023 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
1024
1025 l_out_mesg_token_tbl := l_mesg_token_tbl;
1026 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1027 ( p_message_name => 'EAM_SR_AC_REQUIRED'
1028 , p_token_tbl => l_Token_tbl
1029 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1030 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1031 );
1032 l_mesg_token_tbl := l_out_mesg_token_tbl;
1033
1034 x_return_status := FND_API.G_RET_STS_ERROR;
1035
1036 END IF;
1037
1038
1039 IF p_eam_sub_res_rec.standard_rate_flag IS NULL
1040 THEN
1041 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1042 l_token_tbl(1).token_value := p_eam_sub_res_rec.resource_seq_num;
1043
1044 l_out_mesg_token_tbl := l_mesg_token_tbl;
1045 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1046 ( p_message_name => 'EAM_SR_STD_RATE_REQUIRED'
1047 , p_token_tbl => l_Token_tbl
1048 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1049 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1050 );
1051 l_mesg_token_tbl := l_out_mesg_token_tbl;
1052
1053 x_return_status := FND_API.G_RET_STS_ERROR;
1054
1055 END IF;
1056
1057
1058 IF p_eam_sub_res_rec.applied_resource_units IS NULL
1059 THEN
1060 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1061 l_token_tbl(1).token_value := p_eam_sub_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_SR_APPL_UNIT_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_sub_res_rec.applied_resource_value IS NULL
1078 THEN
1079 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1080 l_token_tbl(1).token_value := p_eam_sub_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_SR_APPL_VALUE_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_sub_res_rec.start_date IS NULL
1097 THEN
1098 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1099 l_token_tbl(1).token_value := p_eam_sub_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_SR_START_DATE_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_sub_res_rec.completion_date IS NULL
1116 THEN
1117 l_token_tbl(1).token_name := 'RESOURCE_SEQ_NUM';
1118 l_token_tbl(1).token_value := p_eam_sub_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_SR_COMPL_DATE_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 IF p_eam_sub_res_rec.department_id IS NULL
1134 THEN
1135
1136 l_out_mesg_token_tbl := l_mesg_token_tbl;
1137 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
1138 ( p_message_name => 'EAM_SR_DEPARTMENT_REQUIRED'
1139 , p_token_tbl => l_Token_tbl
1140 , p_Mesg_Token_Tbl => l_Mesg_Token_Tbl
1141 , x_Mesg_Token_Tbl => l_out_Mesg_Token_Tbl
1142 );
1143 l_mesg_token_tbl := l_out_mesg_token_tbl;
1144
1145 x_return_status := FND_API.G_RET_STS_ERROR;
1146
1147 END IF;
1148
1149
1150
1151 x_Mesg_Token_Tbl := l_Mesg_Token_Tbl;
1152
1153 END Check_Required;
1154
1155
1156 END EAM_SUB_RESOURCE_VALIDATE_PVT;