1 PACKAGE BODY EAM_MAT_REQ_DEFAULT_PVT AS
2 /* $Header: EAMVMRDB.pls 120.3 2009/11/19 09:55:22 vchidura ship $ */
3 /***************************************************************************
4 --
5 -- Copyright (c) 2002 Oracle Corporation, Redwood Shores, CA, USA
6 -- All rights reserved.
7 --
8 -- FILENAME
9 --
10 -- EAMVMRDB.pls
11 --
12 -- DESCRIPTION
13 --
14 -- Spec of package EAM_MAT_REQ_DEFAULT_PVT
15 --
16 -- NOTES
17 --
18 -- HISTORY
19 --
20 -- 30-JUN-2002 Kenichi Nagumo Initial Creation
21 ***************************************************************************/
22 G_PKG_NAME CONSTANT VARCHAR2(30) := 'EAM_MAT_REQ_DEFAULT_PVT';
23
24
25 /********************************************************************
26 * Procedure : get_flex_eam_mat_req
27 * Return : NUMBER
28 **********************************************************************/
29
30
31 PROCEDURE get_flex_eam_mat_req
32 ( p_eam_mat_req_rec IN EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
33 , x_eam_mat_req_rec OUT NOCOPY EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
34 )
35 IS
36 BEGIN
37
38 -- In the future call Flex APIs for defaults
39 x_eam_mat_req_rec := p_eam_mat_req_rec;
40
41 IF p_eam_mat_req_rec.attribute_category =FND_API.G_MISS_CHAR THEN
42 x_eam_mat_req_rec.attribute_category := NULL;
43 END IF;
44
45 IF p_eam_mat_req_rec.attribute1 = FND_API.G_MISS_CHAR THEN
46 x_eam_mat_req_rec.attribute1 := NULL;
47 END IF;
48
49 IF p_eam_mat_req_rec.attribute2 = FND_API.G_MISS_CHAR THEN
50 x_eam_mat_req_rec.attribute2 := NULL;
51 END IF;
52
53 IF p_eam_mat_req_rec.attribute3 = FND_API.G_MISS_CHAR THEN
54 x_eam_mat_req_rec.attribute3 := NULL;
55 END IF;
56
57 IF p_eam_mat_req_rec.attribute4 = FND_API.G_MISS_CHAR THEN
58 x_eam_mat_req_rec.attribute4 := NULL;
59 END IF;
60
61 IF p_eam_mat_req_rec.attribute5 = FND_API.G_MISS_CHAR THEN
62 x_eam_mat_req_rec.attribute5 := NULL;
63 END IF;
64
65 IF p_eam_mat_req_rec.attribute6 = FND_API.G_MISS_CHAR THEN
66 x_eam_mat_req_rec.attribute6 := NULL;
67 END IF;
68
69 IF p_eam_mat_req_rec.attribute7 = FND_API.G_MISS_CHAR THEN
70 x_eam_mat_req_rec.attribute7 := NULL;
71 END IF;
72
73 IF p_eam_mat_req_rec.attribute8 = FND_API.G_MISS_CHAR THEN
74 x_eam_mat_req_rec.attribute8 := NULL;
75 END IF;
76
77 IF p_eam_mat_req_rec.attribute9 = FND_API.G_MISS_CHAR THEN
78 x_eam_mat_req_rec.attribute9 := NULL;
79 END IF;
80
81 IF p_eam_mat_req_rec.attribute10 = FND_API.G_MISS_CHAR THEN
82 x_eam_mat_req_rec.attribute10 := NULL;
83 END IF;
84
85 IF p_eam_mat_req_rec.attribute11 = FND_API.G_MISS_CHAR THEN
86 x_eam_mat_req_rec.attribute11 := NULL;
87 END IF;
88
89 IF p_eam_mat_req_rec.attribute12 = FND_API.G_MISS_CHAR THEN
90 x_eam_mat_req_rec.attribute12 := NULL;
91 END IF;
92
93 IF p_eam_mat_req_rec.attribute13 = FND_API.G_MISS_CHAR THEN
94 x_eam_mat_req_rec.attribute13 := NULL;
95 END IF;
96
97 IF p_eam_mat_req_rec.attribute14 = FND_API.G_MISS_CHAR THEN
98 x_eam_mat_req_rec.attribute14 := NULL;
99 END IF;
100
101 IF p_eam_mat_req_rec.attribute15 = FND_API.G_MISS_CHAR THEN
102 x_eam_mat_req_rec.attribute15 := NULL;
103 END IF;
104
105 END get_flex_eam_mat_req;
106
107
108 /*********************************************************************
109 * Procedure : Attribute_Defaulting
110 * Parameters IN : Material Requirements record
111 * Parameters OUT NOCOPY: Material Requirements record after defaulting
112 * Mesg_Token_Table
113 * Return_Status
114 * Purpose : Attribute Defaulting will default the necessary null
115 * attribute with appropriate values.
116 **********************************************************************/
117
118 PROCEDURE Attribute_Defaulting
119 ( p_eam_mat_req_rec IN EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
120 , x_eam_mat_req_rec OUT NOCOPY EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
121 , x_mesg_token_tbl OUT NOCOPY EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type
122 , x_return_status OUT NOCOPY VARCHAR2
123 )
124 IS
125 l_out_eam_mat_req_rec EAM_PROCESS_WO_PUB.eam_mat_req_rec_type;
126 BEGIN
127
128 x_eam_mat_req_rec := p_eam_mat_req_rec;
129 -- x_eam_mat_req_rec := p_eam_mat_req_rec;
130 x_return_status := FND_API.G_RET_STS_SUCCESS;
131
132 -- Defaulting AUTO_REQUEST_MATERIAL flag.
133 IF p_eam_mat_req_rec.auto_request_material IS NULL OR
134 p_eam_mat_req_rec.auto_request_material = FND_API.G_MISS_CHAR
135 THEN
136 x_eam_mat_req_rec.auto_request_material := 'Y';
137 END IF;
138
139 -- Defaulting wip_supply_type
140 IF p_eam_mat_req_rec.wip_supply_type IS NULL OR
141 p_eam_mat_req_rec.wip_supply_type = FND_API.G_MISS_NUM OR
142 p_eam_mat_req_rec.wip_supply_type not in (wip_constants.push, wip_constants.bulk, wip_constants.based_on_bom) -- Fix for Bug 3438964
143 THEN
144 x_eam_mat_req_rec.wip_supply_type := 1;
145 END IF;
146
147 -- Defaulting quantity_per_assembly
148 IF p_eam_mat_req_rec.quantity_per_assembly IS NULL OR
149 p_eam_mat_req_rec.quantity_per_assembly = FND_API.G_MISS_NUM
150 THEN
151 x_eam_mat_req_rec.quantity_per_assembly := 1;
152 END IF;
153
154 -- Defaulting mrp_net_flag
155 IF p_eam_mat_req_rec.mrp_net_flag IS NULL OR
156 p_eam_mat_req_rec.mrp_net_flag = FND_API.G_MISS_NUM
157 THEN
158 x_eam_mat_req_rec.mrp_net_flag := 1;
159 END IF;
160
161
162 -- Defaulting quantity_issued
163 IF p_eam_mat_req_rec.quantity_issued IS NULL OR
164 p_eam_mat_req_rec.quantity_issued = FND_API.G_MISS_NUM
165 THEN
166 x_eam_mat_req_rec.quantity_issued := 0;
167 END IF;
168
169 -- Defaulting department_id
170 IF (p_eam_mat_req_rec.department_id IS NULL OR
171 p_eam_mat_req_rec.department_id = FND_API.G_MISS_NUM) AND
172 p_eam_mat_req_rec.operation_seq_num is not null AND
173 p_eam_mat_req_rec.organization_id is not null AND
174 p_eam_mat_req_rec.wip_entity_id is not null
175 THEN
176 IF p_eam_mat_req_rec.operation_seq_num = 1 THEN
177 x_eam_mat_req_rec.department_id := null;
178 ELSE
179 select department_id into x_eam_mat_req_rec.department_id
180 from wip_operations
181 where wip_entity_id = p_eam_mat_req_rec.wip_entity_id
182 and organization_id = p_eam_mat_req_rec.organization_id
183 and operation_seq_num = p_eam_mat_req_rec.operation_seq_num;
184
185 END IF;
186 END IF;
187
188 l_out_eam_mat_req_rec := x_eam_mat_req_rec;
189
190 get_flex_eam_mat_req
191 ( p_eam_mat_req_rec => x_eam_mat_req_rec
192 , x_eam_mat_req_rec => l_out_eam_mat_req_rec
193 );
194
195 x_eam_mat_req_rec := l_out_eam_mat_req_rec;
196
197 EXCEPTION
198 WHEN OTHERS THEN
199 EAM_ERROR_MESSAGE_PVT.Add_Error_Token
200 ( p_message_name => NULL
201 , p_message_text => G_PKG_NAME || SQLERRM
202 , x_mesg_token_Tbl => x_mesg_token_tbl
203 );
204
205 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
206
207 END Attribute_Defaulting;
208
209
210 /******************************************************************
211 * Procedure : Populate_Null_Columns
212 * Parameters IN : Material Requirements column record
213 * Old Material Requirements Column Record
214 * Parameters OUT NOCOPY: Material Requirements column record after populating
215 * Purpose : This procedure will look at the columns that the user
216 * has not filled in and will assign those columns a
217 * value from the old record.
218 * This procedure is not called for CREATE
219 ********************************************************************/
220 PROCEDURE Populate_Null_Columns
221 ( p_eam_mat_req_rec IN EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
222 , p_old_eam_mat_req_rec IN EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
223 , x_eam_mat_req_rec OUT NOCOPY EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
224 )
225 IS
226 BEGIN
227 x_eam_mat_req_rec := p_eam_mat_req_rec;
228 -- x_eam_mat_req_rec := p_eam_mat_req_rec;
229
230 IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Processing null columns prior update'); END IF;
231
232 IF p_eam_mat_req_rec.quantity_per_assembly IS NULL OR
233 p_eam_mat_req_rec.quantity_per_assembly = FND_API.G_MISS_NUM
234 THEN
235 x_eam_mat_req_rec.quantity_per_assembly := p_old_eam_mat_req_rec.quantity_per_assembly;
236 END IF;
237
238 IF p_eam_mat_req_rec.department_id IS NULL OR
239 p_eam_mat_req_rec.department_id = FND_API.G_MISS_NUM
240 THEN
241 x_eam_mat_req_rec.department_id := p_old_eam_mat_req_rec.department_id;
242 END IF;
243
244 IF p_eam_mat_req_rec.wip_supply_type IS NULL OR
245 p_eam_mat_req_rec.wip_supply_type = FND_API.G_MISS_NUM
246 THEN
247 x_eam_mat_req_rec.wip_supply_type := p_old_eam_mat_req_rec.wip_supply_type;
248 END IF;
249
250 IF p_eam_mat_req_rec.date_required IS NULL OR
251 p_eam_mat_req_rec.date_required = FND_API.G_MISS_DATE
252 THEN
253 x_eam_mat_req_rec.date_required := p_old_eam_mat_req_rec.date_required;
254 END IF;
255
256 IF p_eam_mat_req_rec.required_quantity IS NULL OR
257 p_eam_mat_req_rec.required_quantity = FND_API.G_MISS_NUM
258 THEN
259 x_eam_mat_req_rec.required_quantity := p_old_eam_mat_req_rec.required_quantity;
260 END IF;
261
262 IF p_eam_mat_req_rec.quantity_issued IS NULL OR
263 p_eam_mat_req_rec.quantity_issued = FND_API.G_MISS_NUM
264 THEN
265 x_eam_mat_req_rec.quantity_issued := p_old_eam_mat_req_rec.quantity_issued;
266 END IF;
267
268 --fix for 3572280
269 IF p_eam_mat_req_rec.released_quantity IS NULL OR
270 p_eam_mat_req_rec.released_quantity = FND_API.G_MISS_NUM
271 THEN
272 x_eam_mat_req_rec.released_quantity := p_old_eam_mat_req_rec.released_quantity;
273 END IF;
274
275 IF p_eam_mat_req_rec.supply_subinventory IS NULL OR
276 p_eam_mat_req_rec.supply_subinventory = FND_API.G_MISS_CHAR
277 THEN
278 x_eam_mat_req_rec.supply_subinventory := p_old_eam_mat_req_rec.supply_subinventory;
279 END IF;
280
281 IF p_eam_mat_req_rec.supply_locator_id IS NULL OR
282 p_eam_mat_req_rec.supply_locator_id = FND_API.G_MISS_NUM
283 THEN
284 x_eam_mat_req_rec.supply_locator_id := p_old_eam_mat_req_rec.supply_locator_id;
285 END IF;
286
287 IF p_eam_mat_req_rec.mrp_net_flag IS NULL OR
288 p_eam_mat_req_rec.mrp_net_flag = FND_API.G_MISS_NUM
289 THEN
290 x_eam_mat_req_rec.mrp_net_flag := p_old_eam_mat_req_rec.mrp_net_flag;
291 END IF;
292
293 IF p_eam_mat_req_rec.mps_required_quantity IS NULL OR
294 p_eam_mat_req_rec.mps_required_quantity = FND_API.G_MISS_NUM
295 THEN
296 x_eam_mat_req_rec.mps_required_quantity := p_old_eam_mat_req_rec.mps_required_quantity;
297 END IF;
298
299 IF p_eam_mat_req_rec.mps_date_required IS NULL OR
300 p_eam_mat_req_rec.mps_date_required = FND_API.G_MISS_DATE
301 THEN
302 x_eam_mat_req_rec.mps_date_required := p_old_eam_mat_req_rec.mps_date_required;
303 END IF;
304
305 IF p_eam_mat_req_rec.component_sequence_id IS NULL OR
306 p_eam_mat_req_rec.component_sequence_id = FND_API.G_MISS_NUM
307 THEN
308 x_eam_mat_req_rec.component_sequence_id := p_old_eam_mat_req_rec.component_sequence_id;
309 END IF;
310
311 IF p_eam_mat_req_rec.comments IS NULL
312 THEN
313 x_eam_mat_req_rec.comments := p_old_eam_mat_req_rec.comments;
314 END IF;
315
316 --
317 -- Populate Null or missng flex field columns
318 --
319 --changes for 8969942
320
321 IF p_eam_mat_req_rec.attribute_category IS NULL
322 THEN
323 x_eam_mat_req_rec.attribute_category := p_old_eam_mat_req_rec.attribute_category;
324
325 END IF;
326
327 IF p_eam_mat_req_rec.attribute_category = FND_API.G_MISS_CHAR
328 THEN
329 x_eam_mat_req_rec.attribute_category := NULL;
330
331 END IF;
332
333 IF p_eam_mat_req_rec.attribute1 IS NULL
334 THEN
335 x_eam_mat_req_rec.attribute1 := p_old_eam_mat_req_rec.attribute1;
336 END IF;
337
338 IF p_eam_mat_req_rec.attribute1 = FND_API.G_MISS_CHAR
339 THEN
340 x_eam_mat_req_rec.attribute1 := NULL;
341 END IF;
342
343 IF p_eam_mat_req_rec.attribute2 IS NULL
344 THEN
345 x_eam_mat_req_rec.attribute2 := p_old_eam_mat_req_rec.attribute2;
346 END IF;
347
348 IF p_eam_mat_req_rec.attribute2 = FND_API.G_MISS_CHAR
349 THEN
350 x_eam_mat_req_rec.attribute2 := NULL;
351 END IF;
352
353 IF p_eam_mat_req_rec.attribute3 IS NULL
354 THEN
355 x_eam_mat_req_rec.attribute3 := p_old_eam_mat_req_rec.attribute3;
356 END IF;
357
358 IF p_eam_mat_req_rec.attribute3 = FND_API.G_MISS_CHAR
359 THEN
360 x_eam_mat_req_rec.attribute3 := NULL;
361 END IF;
362
363 IF p_eam_mat_req_rec.attribute4 IS NULL
364 THEN
365 x_eam_mat_req_rec.attribute4 := p_old_eam_mat_req_rec.attribute4;
366 END IF;
367
368 IF p_eam_mat_req_rec.attribute4 = FND_API.G_MISS_CHAR
369 THEN
370 x_eam_mat_req_rec.attribute4 := NULL;
371 END IF;
372
373 IF p_eam_mat_req_rec.attribute5 IS NULL
374 THEN
375 x_eam_mat_req_rec.attribute5 := p_old_eam_mat_req_rec.attribute5;
376 END IF;
377
378 IF p_eam_mat_req_rec.attribute5 = FND_API.G_MISS_CHAR
379 THEN
380 x_eam_mat_req_rec.attribute5 := NULL;
381 END IF;
382
383 IF p_eam_mat_req_rec.attribute6 IS NULL
384 THEN
385 x_eam_mat_req_rec.attribute6 := p_old_eam_mat_req_rec.attribute6;
386 END IF;
387
388 IF p_eam_mat_req_rec.attribute6 = FND_API.G_MISS_CHAR
389 THEN
390 x_eam_mat_req_rec.attribute6 := NULL;
391 END IF;
392
393 IF p_eam_mat_req_rec.attribute7 IS NULL
394 THEN
395 x_eam_mat_req_rec.attribute7 := p_old_eam_mat_req_rec.attribute7;
396 END IF;
397
398 IF p_eam_mat_req_rec.attribute7 = FND_API.G_MISS_CHAR
399 THEN
400 x_eam_mat_req_rec.attribute7 := NULL;
401 END IF;
402
403 IF p_eam_mat_req_rec.attribute8 IS NULL
404 THEN
405 x_eam_mat_req_rec.attribute8 := p_old_eam_mat_req_rec.attribute8;
406 END IF;
407
408 IF p_eam_mat_req_rec.attribute8 = FND_API.G_MISS_CHAR
409 THEN
410 x_eam_mat_req_rec.attribute8 := NULL;
411 END IF;
412
413 IF p_eam_mat_req_rec.attribute9 IS NULL
414 THEN
415 x_eam_mat_req_rec.attribute9 := p_old_eam_mat_req_rec.attribute9;
416 END IF;
417
418 IF p_eam_mat_req_rec.attribute9 = FND_API.G_MISS_CHAR
419 THEN
420 x_eam_mat_req_rec.attribute9 := NULL;
421 END IF;
422
423 IF p_eam_mat_req_rec.attribute10 IS NULL
424 THEN
425 x_eam_mat_req_rec.attribute10 := p_old_eam_mat_req_rec.attribute10;
426 END IF;
427
428 IF p_eam_mat_req_rec.attribute10 = FND_API.G_MISS_CHAR
429 THEN
430 x_eam_mat_req_rec.attribute10 := NULL;
431 END IF;
432
433 IF p_eam_mat_req_rec.attribute11 IS NULL
434 THEN
435 x_eam_mat_req_rec.attribute11 := p_old_eam_mat_req_rec.attribute11;
436 END IF;
437
438 IF p_eam_mat_req_rec.attribute11 = FND_API.G_MISS_CHAR
439 THEN
440 x_eam_mat_req_rec.attribute11 := NULL;
441 END IF;
442
443 IF p_eam_mat_req_rec.attribute12 IS NULL
444 THEN
445 x_eam_mat_req_rec.attribute12 := p_old_eam_mat_req_rec.attribute12;
446 END IF;
447
448 IF p_eam_mat_req_rec.attribute12 = FND_API.G_MISS_CHAR
449 THEN
450 x_eam_mat_req_rec.attribute12 := NULL;
451 END IF;
452
453 IF p_eam_mat_req_rec.attribute13 IS NULL
454 THEN
455 x_eam_mat_req_rec.attribute13 := p_old_eam_mat_req_rec.attribute13;
456 END IF;
457
458 IF p_eam_mat_req_rec.attribute13 = FND_API.G_MISS_CHAR
459 THEN
460 x_eam_mat_req_rec.attribute13 := NULL;
461 END IF;
462
463 IF p_eam_mat_req_rec.attribute14 IS NULL
464 THEN
465 x_eam_mat_req_rec.attribute14 := p_old_eam_mat_req_rec.attribute14;
466 END IF;
467
468 IF p_eam_mat_req_rec.attribute14 = FND_API.G_MISS_CHAR
469 THEN
470 x_eam_mat_req_rec.attribute14 := NULL;
471 END IF;
472
473 IF p_eam_mat_req_rec.attribute15 IS NULL
474 THEN
475 x_eam_mat_req_rec.attribute15 := p_old_eam_mat_req_rec.attribute15;
476 END IF;
477
478 IF p_eam_mat_req_rec.attribute15 = FND_API.G_MISS_CHAR
479 THEN
480 x_eam_mat_req_rec.attribute15 := NULL;
481 END IF;
482
483 IF p_eam_mat_req_rec.auto_request_material = FND_API.G_MISS_CHAR OR
484 p_eam_mat_req_rec.auto_request_material IS NULL
485 THEN
486 x_eam_mat_req_rec.auto_request_material := p_old_eam_mat_req_rec.auto_request_material;
487 END IF;
488
489 IF p_eam_mat_req_rec.unit_price IS NULL OR
490 p_eam_mat_req_rec.unit_price = FND_API.G_MISS_NUM
491 THEN
492 x_eam_mat_req_rec.unit_price := p_old_eam_mat_req_rec.unit_price;
493 END IF;
494
495 IF p_eam_mat_req_rec.suggested_vendor_name IS NULL OR
496 p_eam_mat_req_rec.suggested_vendor_name = FND_API.G_MISS_CHAR
497 THEN
498 x_eam_mat_req_rec.suggested_vendor_name := p_old_eam_mat_req_rec.suggested_vendor_name;
499 END IF;
500
501 IF p_eam_mat_req_rec.vendor_id IS NULL OR
502 p_eam_mat_req_rec.vendor_id = FND_API.G_MISS_NUM
503 THEN
504 x_eam_mat_req_rec.vendor_id := p_old_eam_mat_req_rec.vendor_id;
505 END IF;
506
507 IF EAM_PROCESS_WO_PVT.Get_Debug = 'Y' THEN EAM_ERROR_MESSAGE_PVT.Write_Debug('Done processing null columns prior update'); END IF;
508
509
510 END Populate_Null_Columns;
511
512
513
514 /******************************************************************
515 * Procedure : GetMaterials_In_Op1
516 * Parameters IN : Material Requirements table
517 * Organization_ID
518 Wip_Entity_Id
519 * Parameters OUT NOCOPY: Material Requirements table after populating
520 * Purpose : This procedure will find all the materials that are
521 * in operation seq num 1 and append them to the
522 * table.
523 * This procedure is called only when there exists any material in operation 1
524 ********************************************************************/
525
526 PROCEDURE GetMaterials_In_Op1
527 ( p_eam_mat_req_tbl IN EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type
528 , p_organization_id IN NUMBER
529 , p_wip_entity_id IN NUMBER
530 , x_eam_mat_req_tbl OUT NOCOPY EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type
531 )
532 IS
533 l_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type := p_eam_mat_req_tbl;
534 k NUMBER := l_eam_mat_req_tbl.COUNT ;
535
536 CURSOR MaterialREQ IS
537 SELECT
538 WIP_ENTITY_ID WIP_ENTITY_ID
539 , ORGANIZATION_ID ORGANIZATION_ID
540 , OPERATION_SEQ_NUM OPERATION_SEQ_NUM
541 , INVENTORY_ITEM_ID INVENTORY_ITEM_ID
542 , 2 TRANSACTION_TYPE
543 FROM wip_requirement_operations
544 WHERE organization_id = p_organization_id
545 and wip_entity_id = p_wip_entity_id
546 and operation_seq_num = 1;
547
548
549 BEGIN
550
551 FOR matreq IN MaterialREQ LOOP
552 k := k + 1 ;
553
554 l_eam_mat_req_tbl(k).WIP_ENTITY_ID := matreq.WIP_ENTITY_ID;
555 l_eam_mat_req_tbl(k).ORGANIZATION_ID := matreq.ORGANIZATION_ID;
556 l_eam_mat_req_tbl(k).OPERATION_SEQ_NUM := matreq.OPERATION_SEQ_NUM;
557 l_eam_mat_req_tbl(k).INVENTORY_ITEM_ID := matreq.INVENTORY_ITEM_ID;
558 l_eam_mat_req_tbl(k).TRANSACTION_TYPE := matreq.TRANSACTION_TYPE ;
559
560 END LOOP;
561 x_eam_mat_req_tbl := l_eam_mat_req_tbl ;
562
563 END GetMaterials_In_Op1 ;
564
565
566 /******************************************************************
567 * Procedure : Change_OpSeqNum1
568 * Parameters IN : Material Requirements column record
569 * Operation Sequence Number
570 Department Id
571 * Parameters OUT NOCOPY: Material Requirements column record after changing
572 * Purpose : This procedure will change the operation seq num from 1
573 * to the newly created operation ( p_operation_seq_num )
574 * and accordingly the department id
575 * This procedure is called only when there exists any material in operation 1
576 ********************************************************************/
577 PROCEDURE Change_OpSeqNum1
578 ( p_eam_mat_req_rec IN EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
579 , p_operation_seq_num IN NUMBER
580 , p_department_id IN NUMBER
581 , x_eam_mat_req_rec OUT NOCOPY EAM_PROCESS_WO_PUB.eam_mat_req_rec_type
582 )
583 IS
584 l_eam_mat_req_rec EAM_PROCESS_WO_PUB.eam_mat_req_rec_type := p_eam_mat_req_rec;
585
586 BEGIN
587
588 IF ( l_eam_mat_req_rec.operation_seq_num = 1 ) THEN
589 l_eam_mat_req_rec.operation_seq_num := p_operation_seq_num ;
590 l_eam_mat_req_rec.department_id := p_department_id ;
591 END IF;
592
593 x_eam_mat_req_rec := l_eam_mat_req_rec ;
594
595 END Change_OpSeqNum1;
596
597
598
599 END EAM_MAT_REQ_DEFAULT_PVT;