DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_BLANKET_PVT

Source


1 PACKAGE BODY OE_Blanket_PVT AS
2 /* $Header: OEXVBSOB.pls 120.0.12010000.3 2008/11/30 00:05:38 smusanna ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'OE_Blanket_PVT';
7 g_header_id                   NUMBER;
8 g_blaket_header_rec            oe_blanket_pub.header_Rec_type ;
9 
10 /*----------------------------------------------------------------------
11 PROCEDURE Header
12 -----------------------------------------------------------------------*/
13 
14 PROCEDURE Header
15 (   p_control_rec                   IN  OE_BLANKET_PUB.Control_Rec_Type
16 ,   p_validation_level              IN  NUMBER := FND_API.G_VALID_LEVEL_FULL
17 ,   p_x_header_rec         IN OUT NOCOPY OE_Blanket_PUB.header_Rec_Type
18 ,   p_x_old_header_rec     IN OUT NOCOPY OE_Blanket_PUB.header_Rec_Type
19 ,   x_return_status                 OUT NOCOPY VARCHAR2
20 )
21 IS
22 l_old_header_rec OE_Blanket_PUB.header_Rec_Type;
23 l_return_status varchar2(1);
24 l_sec_result NUMBER;
25 --
26 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
27 --
28 BEGIN
29                    x_return_status := FND_API.G_RET_STS_SUCCESS;
30      IF l_debug_level  > 0 THEN
31          oe_debug_pub.add(  'INSIDE BLANKET HEADER' ,1 ) ;
32         END IF;
33 
34 	-- Query Old Record
35 
36 		IF p_x_header_rec.operation <> oe_globals.g_opr_create THEN
37 		oe_blanket_util.query_header( p_header_id =>
38 					p_x_header_rec.header_id,
39 		                          x_header_rec => p_x_old_header_rec,
40                                           x_return_status => l_return_status);
41               IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
42                  x_return_status := l_return_status;
43               END IF;
44 				l_old_header_rec := p_x_old_header_rec;
45 		END IF;
46 
47     OE_MSG_PUB.set_msg_context(
48 	 p_entity_code			=> 'BLANKET_HEADER'
49   	,p_entity_id         		=> p_x_header_rec.header_id
50     	,p_header_id         		=> p_x_header_rec.header_id
51     	,p_line_id           		=> null
52     	,p_orig_sys_document_ref	=> null
53     	,p_orig_sys_document_line_ref	=> null
54         ,p_change_sequence              => null
55     	,p_source_document_id		=> null
56     	,p_source_document_line_id	=> null
57 	,p_order_source_id            => null
58 	,p_source_document_type_id    => null);
59 
60    -- Check security
61    IF    OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510'
62     AND  p_control_rec.check_security
63     AND (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
64          OR p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
65          OR p_x_header_rec.operation = OE_GLOBALS.G_OPR_DELETE)  -- hashraf pack J
66    THEN
67 
68         IF l_debug_level  > 0 THEN
69             oe_debug_pub.add(  'CHECK BLANKET HEADER ATTRIBUTES SECURITY', 1 ) ;
70         END IF;
71         -- check if this operation is allowed
72         -- on all the changed attributes
73            OE_Blanket_Header_Security.Attributes
74                 (p_header_rec   	=> p_x_header_rec
75                 , p_old_header_rec	=> l_old_header_rec
76                 , x_result      	=> l_sec_result
77                 , x_return_status 	=> l_return_status
78                 );
79 
80                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
81                      x_return_status := l_return_status;
82                   END IF;
83 
84            IF l_sec_result = OE_PC_GLOBALS.YES THEN
85                 RAISE FND_API.G_EXC_ERROR;
86            END IF;
87 
88     END IF;
89 
90 
91 	-- Validate User passed attributes
92 
93 
94 		IF p_control_rec.validate_attributes THEN
95           oe_debug_pub.add(  ' Validate Blanket Attribute ' ,1);
96 	oe_blanket_util.validate_attributes( p_x_header_Rec => p_x_header_rec,
97 					  p_old_header_rec => l_old_header_rec,
98 					  p_validation_level => p_validation_level,
99 					  x_return_status => l_return_status);
100                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
101                      x_return_status := l_return_status;
102                   END IF;
103                END IF;
104 
105 
106        --   Default Attributes if the operation is create
107 
108 		IF p_x_header_rec.operation = oe_globals.g_opr_create THEN
109 			oe_blanket_util.default_attributes (
110 				 p_x_header_Rec => p_x_header_rec,
111                                  x_return_status => l_return_status);
112                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
113                      x_return_status := l_return_status;
114                   END IF;
115 
116 		END IF;
117 
118 
119 
120         -- Validate entity security
121    IF    OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510'
122     AND  p_control_rec.check_security
123     AND (p_x_header_rec.operation = OE_GLOBALS.G_OPR_CREATE
124          OR p_x_header_rec.operation = OE_GLOBALS.G_OPR_UPDATE
125          OR p_x_header_rec.operation = OE_GLOBALS.G_OPR_DELETE) -- hashraf Pack J
126    THEN
127         IF l_debug_level  > 0 THEN
128             oe_debug_pub.add(  'CHECK BLANKET HEADER ENTITY SECURITY' ) ;
129         END IF;
130         -- check if this operation is allowed
131         -- on all the changed attributes
132            OE_Blanket_Header_Security.Entity
133                 (p_header_rec   	=> p_x_header_rec
134                 , x_result      	=> l_sec_result
135                 , x_return_status 	=> l_return_status
136                 );
137 
138                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
139                      x_return_status := l_return_status;
140                   END IF;
141 
142            IF l_sec_result = OE_PC_GLOBALS.YES THEN
143                 RAISE FND_API.G_EXC_ERROR;
144            END IF;
145 
146     END IF;
147 
148 
149 	-- Validate entity and check required fields
150 
151 		IF p_control_rec.validate_entity  THEN
152 	oe_blanket_util.Validate_entity ( p_header_rec => p_x_header_rec,
153 		             p_old_header_rec => l_old_header_rec,
154 		             x_return_status => l_return_status);
155                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
156                      x_return_status := l_return_status;
157                   END IF;
158 		END IF;
159 
160 
161          -- Write the record into database
162 
163 		IF p_control_rec.write_to_db AND
164                    x_return_status = FND_API.G_RET_STS_SUCCESS THEN
165 
166 		IF p_x_header_rec.operation = oe_globals.g_opr_update THEN
167  		  oe_blanket_util.update_row (p_header_rec => p_x_header_rec,
168                                     x_return_status => l_return_status);
169                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
170                      x_return_status := l_return_status;
171                   END IF;
172 
173 		ELSIF p_x_header_rec.operation = oe_globals.g_opr_create THEN
174 		  oe_blanket_util.insert_row (p_header_rec => p_x_header_rec,
175                                     x_return_status => l_return_status);
176                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
177                      x_return_status := l_return_status;
178                   END IF;
179 
180 -- hashraf start of pack J
181 		ELSIF p_x_header_rec.operation = oe_globals.g_opr_delete THEN
182 		  oe_blanket_util.delete_row (p_header_id => p_x_header_rec.header_id,
183                                     x_return_status => l_return_status);
184                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
185                      x_return_status := l_return_status;
186                   END IF;
187 
188 -- hashraf end of Pack J
189 
190 		END IF;
191 
192 		END IF;
193 
194         OE_MSG_PUB.reset_msg_context('BLANKET_HEADER');
195 
196 EXCEPTION
197 
198     WHEN FND_API.G_EXC_ERROR THEN
199         IF NOT (OE_GLOBALS.G_UI_FLAG) THEN
200     if l_debug_level > 0 then
201           oe_debug_pub.add('delete request1',2);
202     end if;
203           OE_Delayed_Requests_Pvt.Clear_Request
204                     (x_return_status => l_return_status);
205                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
206                      x_return_status := l_return_status;
207                   END IF;
208         END IF;
209 
210         OE_MSG_PUB.reset_msg_context('BLANKET_HEADER');
211         p_x_header_rec.return_status  := FND_API.G_RET_STS_ERROR;
212 	x_return_status 	:= FND_API.G_RET_STS_ERROR;
213 
214     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
215         IF NOT (OE_GLOBALS.G_UI_FLAG) THEN
216           if l_debug_level > 0 then
217             oe_debug_pub.add('delete request1',2);
218           end if;
219           OE_Delayed_Requests_Pvt.Clear_Request
220                     (x_return_status => l_return_status);
221                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
222                      x_return_status := l_return_status;
223                   END IF;
224         END IF;
225 
226         OE_MSG_PUB.reset_msg_context('BLANKET_HEADER');
227         p_x_header_rec.return_status    := FND_API.G_RET_STS_UNEXP_ERROR;
228 	x_return_status 		 := FND_API.G_RET_STS_UNEXP_ERROR;
229 
230     WHEN OTHERS THEN
231         IF NOT (OE_GLOBALS.G_UI_FLAG) THEN
232           if l_debug_level > 0 then
233             oe_debug_pub.add('delete request1',2);
234           end if;
235           OE_Delayed_Requests_Pvt.Clear_Request
236                     (x_return_status => l_return_status);
237                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
238                      x_return_status := l_return_status;
239                   END IF;
240         END IF;
241 
242         OE_MSG_PUB.reset_msg_context('BLANKET_HEADER');
243         p_x_header_rec.return_status     := FND_API.G_RET_STS_UNEXP_ERROR;
244 	 x_return_status 		 := FND_API.G_RET_STS_UNEXP_ERROR;
245 END Header;
246 
247 
248 
249 /*---------------------------------------------------------------------- */
250 
251 PROCEDURE Lines
252 (   p_control_rec                   IN  oe_blanket_pub.Control_Rec_Type
253 ,   p_validation_level              IN  NUMBER := FND_API.G_VALID_LEVEL_FULL
254 ,   p_x_line_tbl   IN OUT NOCOPY  OE_Blanket_PUB.line_tbl_Type
255 ,   p_x_old_line_tbl IN OUT NOCOPY OE_Blanket_PUB.line_tbl_Type
256 ,   x_return_status                 OUT NOCOPY VARCHAR2
257 )
258 IS
259 l_old_line_rec  OE_Blanket_PUB.line_rec_Type;
260 l_line_rec  OE_Blanket_PUB.line_rec_Type;
261 l_return_status varchar2(1);
262 I number;
263 l_sec_result NUMBER;
264 --
265 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
266 --
267 BEGIN
268                    x_return_status := FND_API.G_RET_STS_SUCCESS;
269 
270 		I := p_x_line_tbl.first;
271 		WHILE I is not null
272 		LOOP
273 -- Loop for each line in the table
274 
275 -- Query the old  record if exists
276 
277 			l_line_rec := p_x_line_tbl(I);
278 
279 		IF l_line_rec.operation <> oe_globals.g_opr_create THEN
280 	l_old_line_rec :=oe_blanket_util.query_row(p_line_id =>
281 				l_line_rec.line_id );
282 			p_x_old_line_tbl(I) := l_old_line_rec;
283 		END IF;
284 
285     OE_MSG_PUB.set_msg_context(
286 	 p_entity_code			=> 'BLANKET_LINE'
287   	,p_entity_id         		=> l_line_rec.line_id
288     	,p_header_id         		=> l_line_rec.header_id
289     	,p_line_id           		=> l_line_rec.line_id
290     	,p_orig_sys_document_ref	=> null
291     	,p_orig_sys_document_line_ref	=> null
292         ,p_change_sequence              => null
293     	,p_source_document_id		=> null
294     	,p_source_document_line_id	=> null
295 	,p_order_source_id            => null
296 	,p_source_document_type_id    => null);
297 
298 -- Validate user passed attributes
299 
300 			IF p_control_rec.validate_attributes THEN
301 		oe_blanket_util.validate_attributes( p_x_line_Rec => l_line_rec,
302 					  p_old_line_rec => l_old_line_rec,
303 					  p_validation_level => p_validation_level,
304 					  x_return_status => l_return_status);
305                         IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
306                            x_return_status := l_return_status;
307                          END IF;
308                		END IF;
309 
310    -- Check security attributes
311    IF    OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510'
312     AND  p_control_rec.check_security
313     AND (l_line_rec.operation = OE_GLOBALS.G_OPR_CREATE
314          OR l_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE
315 OR l_line_rec.operation = OE_GLOBALS.G_OPR_DELETE) -- hashraf pack J
316    THEN
317 
318         IF l_debug_level  > 0 THEN
319             oe_debug_pub.add(  'CHECK BLANKET LINE ATTRIBUTES SECURITY' ) ;
320         END IF;
321         -- check if this operation is allowed
322         -- on all the changed attributes
323            OE_Blanket_Line_Security.Attributes
324                 (p_line_rec   	=> l_line_rec
325                 , p_old_line_rec	=> l_old_line_rec
326                 , x_result      	=> l_sec_result
327                 , x_return_status 	=> l_return_status
328                 );
329 
330                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
331                      x_return_status := l_return_status;
332                   END IF;
333 
334            IF l_sec_result = OE_PC_GLOBALS.YES THEN
335                 RAISE FND_API.G_EXC_ERROR;
336            END IF;
337 
338     END IF;
339 
340        --   Default Attributes if the operation is create
341 
342 
343 		IF l_line_rec.operation = oe_globals.g_opr_create
344 			  THEN
345 			oe_blanket_util.default_attributes (
346 				 p_x_line_rec => l_line_rec,
347                                p_default_from_header => p_control_rec.default_from_header,
348                               x_return_status => l_return_status);
349                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
350                      x_return_status := l_return_status;
351                   END IF;
352 
353 		END IF;
354 
355 
356    -- Check security attributes
357    IF    OE_CODE_CONTROL.CODE_RELEASE_LEVEL >= '110510'
358     AND  p_control_rec.check_security
359     AND (l_line_rec.operation = OE_GLOBALS.G_OPR_CREATE
360          OR l_line_rec.operation = OE_GLOBALS.G_OPR_UPDATE
361 OR l_line_rec.operation = OE_GLOBALS.G_OPR_DELETE) -- hashraf pack J
362    THEN
363 
364         IF l_debug_level  > 0 THEN
365             oe_debug_pub.add(  'CHECK BLANKET LINE ENTITY SECURITY' ) ;
366         END IF;
367         -- check if this operation is allowed
368         -- on all the changed attributes
369            OE_Blanket_Line_Security.Entity
370                 (p_line_rec   	=> l_line_rec
371                 , x_result      	=> l_sec_result
372                 , x_return_status 	=> l_return_status
373                 );
374 
375                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
376                      x_return_status := l_return_status;
377                   END IF;
378 
379            IF l_sec_result = OE_PC_GLOBALS.YES THEN
380                 RAISE FND_API.G_EXC_ERROR;
381            END IF;
382 
383     END IF;
384 
385 	-- Vaildate entity and required fields
386 
387 
388 		IF p_control_rec.validate_entity  THEN
389 
390 		oe_blanket_util.Validate_entity ( p_line_rec => l_line_rec,
391 		             p_old_line_rec => l_old_line_rec,
392 		             x_return_status => l_return_status);
393                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
394                      x_return_status := l_return_status;
395                   END IF;
396 
397 		END IF;
398 
399 
400 	-- Write the records into database
401 
402 		IF p_control_rec.write_to_db  AND
403                    x_return_status = FND_API.G_RET_STS_SUCCESS THEN
404 
405 		IF l_line_rec.operation = oe_globals.g_opr_update THEN
406 	              oe_blanket_util.update_row (p_line_rec => l_line_rec,
407                                   x_return_status => l_return_status);
408                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
409                      x_return_status := l_return_status;
410                   END IF;
411 
412 		ELSIF l_line_rec.operation = oe_globals.g_opr_create THEN
413 
414 
415 	oe_blanket_util.insert_row (p_line_rec => l_line_rec,
416                                   x_return_status => l_return_status);
417                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
418                      x_return_status := l_return_status;
419                   END IF;
420 
421 -- hashraf start of Pack J
422 		ELSIF l_line_rec.operation = oe_globals.g_opr_delete THEN
423 
424 
425 	oe_blanket_util.delete_row (p_line_id => l_line_rec.line_id,
426                                   x_return_status => l_return_status);
427                   IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
428                      x_return_status := l_return_status;
429                   END IF;
430 -- hashraf end of Pack J
431 
432 		END IF;
433 
434 
435 		END IF;
436 			l_line_rec.return_status := x_return_status;
437 			p_x_line_tbl(I) := l_line_rec;
438 
439                 OE_MSG_PUB.reset_msg_context('BLANKET_LINE');
440 
441 		--  Process next Line
442 
443 			I := p_x_line_tbl.next(I);
444 	END LOOP;
445 
446 
447 
448 NULL;
449 
450 
451 EXCEPTION
452 
453   WHEN FND_API.G_EXC_ERROR THEN
454         IF NOT (OE_GLOBALS.G_UI_FLAG) THEN
455           if l_debug_level > 0 then
456             oe_debug_pub.add('delete request1',2);
457           end if;
458           OE_Delayed_Requests_Pvt.Clear_Request
459                     (x_return_status => l_return_status);
460               IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
461                  x_return_status := l_return_status;
462               END IF;
463 
464         END IF;
465 
466         OE_MSG_PUB.reset_msg_context('BLANKET_LINE');
467     x_return_status  := FND_API.G_RET_STS_ERROR;
468 
469 
470   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
471         IF NOT (OE_GLOBALS.G_UI_FLAG) THEN
472           if l_debug_level > 0 then
473             oe_debug_pub.add('delete request1',2);
474           end if;
475           OE_Delayed_Requests_Pvt.Clear_Request
476                     (x_return_status => l_return_status);
477               IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
478                  x_return_status := l_return_status;
479               END IF;
480 
481         END IF;
482 
483         OE_MSG_PUB.reset_msg_context('BLANKET_LINE');
484 	x_return_status  := FND_API.G_RET_STS_UNEXP_ERROR;
485 
486 
487   WHEN OTHERS THEN
488         IF NOT (OE_GLOBALS.G_UI_FLAG) THEN
489           if l_debug_level > 0 then
490             oe_debug_pub.add('delete request1',2);
491           end if;
492           OE_Delayed_Requests_Pvt.Clear_Request
493                     (x_return_status => l_return_status);
494               IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
495                  x_return_status := l_return_status;
496               END IF;
497 
498         END IF;
499 
500         OE_MSG_PUB.reset_msg_context('BLANKET_LINE');
501     x_return_status  := FND_API.G_RET_STS_UNEXP_ERROR;
502 
503 
504 END Lines;
505 
506 
507 /*----------------------------------------------------------------
508 --  Start of Comments
509 --  API name    Process_Blanket
510 --  Type        Private
511 --
512 --  Pre-reqs
513 --
514 --  Parameters
515 --
516 --  Version     Current version = 1.0
517 --              Initial version = 1.0
518 --
519 --  Notes
520 --
521 --  End of Comments
522 ----------------------------------------------------------------*/
523 PROCEDURE Process_Blanket
524 (   p_org_id                        IN  NUMBER := NULL --MOAC
525 ,   p_operating_unit                IN  VARCHAR2 := NULL -- MOAC
526 ,   p_api_version_number            IN  NUMBER := 1.0
527 ,   p_validation_level              IN  NUMBER := FND_API.G_VALID_LEVEL_FULL
528 ,   x_return_status                 OUT NOCOPY VARCHAR2
529 ,   x_msg_count                     OUT NOCOPY NUMBER
530 ,   x_msg_data                      OUT NOCOPY VARCHAR2
531 ,   p_header_rec            IN  oe_blanket_pub.header_Rec_type :=
532                                         oe_blanket_pub.G_MISS_header_rec
533 ,   p_line_tbl              IN  oe_blanket_pub.line_tbl_Type :=
534                                         oe_blanket_pub.G_MISS_line_tbl
535 ,   p_control_rec                   IN  oe_blanket_pub.Control_rec_type :=
536                                 oe_blanket_pub.G_MISS_CONTROL_REC
537 ,   x_header_rec           OUT NOCOPY oe_blanket_pub.header_Rec_type
538 ,   x_line_tbl             OUT NOCOPY oe_blanket_pub.line_tbl_Type
539 )
540 IS
541 l_api_name                    CONSTANT VARCHAR2(30):= 'Process_Blanket';
542 l_return_status               VARCHAR2(1);
543 l_old_header_rec           OE_Blanket_PUB.header_Rec_Type;
544 l_header_rec           OE_Blanket_PUB.header_Rec_Type := p_header_rec;
545 l_line_rec            OE_Blanket_PUB.Line_Rec_Type;
546 l_line_tbl            OE_Blanket_PUB.line_tbl_Type := p_line_tbl;
547 l_old_line_rec        OE_Blanket_PUB.Line_rec_Type;
548 l_old_line_tbl        OE_Blanket_PUB.line_tbl_Type;
549 I number;
550 
551 --MOAC
552 l_org_id                      NUMBER;
553 l_operating_unit              VARCHAR2(240);
554 
555 --
556 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
557 --
558 BEGIN
559 NULL;
560 
561         x_return_status := FND_API.G_RET_STS_SUCCESS;
562 	G_BATCH_MODE := TRUE;
563 
564 	   SAVEPOINT Process_Blanket;
565 
566 
567     if l_debug_level > 0 then
568       oe_debug_pub.add('Entering OE_BLANKET_PVT.PROCESS_BLANKET', 1);
569     end if;
570     --  Standard call to check for call compatibility
571 
572 
573     -------------------------------------------------------
574     -- Process Blanket Header
575     -------------------------------------------------------
576     IF p_header_rec.operation IS NOT NULL THEN
577 
578       Header
579       (   p_control_rec                 => p_control_rec
580       ,   p_validation_level            => p_validation_level
581       ,   p_x_header_rec           => l_header_Rec
582       ,   p_x_old_header_rec        => l_old_header_Rec
583       ,   x_return_status               => l_return_status
584       );
585 
586       IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
587        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
588       ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
589        RAISE FND_API.G_EXC_ERROR;
590       END IF;
591 	x_header_rec := l_header_rec;
592 
593 END IF;
594 
595 
596     -------------------------------------------------------
597     -- Process Blanket Lines
598     -------------------------------------------------------
599 
600 
601     IF l_line_tbl.COUNT > 0 THEN
602 
603     if l_debug_level > 0 then
604       oe_debug_pub.add('before lines processing', 2);
605     end if;
606 		I := l_line_tbl.first;
607 
608 		While I is not null
609 		Loop
610 			IF l_line_tbl(I).operation = oe_globals.g_opr_create AND
611 				l_line_tbl(I).header_id IS NULL THEN
612 				l_line_tbl(I).header_id := l_header_rec.header_id;
613 			END IF;
614 
615 
616 		I := l_line_tbl.next(I);
617 		End loop;
618 
619     Lines
620     (   p_control_rec                 => p_control_rec
621     ,   p_validation_level            => p_validation_level
622     ,   p_x_line_tbl          => l_line_tbl
623     ,   p_x_old_line_tbl      => l_old_line_tbl
624     ,   x_return_status               => l_return_status
625     );
626 
627     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
628 
629        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
630     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
631 
632          RAISE FND_API.G_EXC_ERROR;
633     END IF;
634     if l_debug_level > 0 then
635       oe_debug_pub.add('after lines processing', 2);
636     end if;
637     END IF;
638 		x_line_tbl := l_line_tbl;
639 
640 -- Process Object level requests
641 
642 	oe_blanket_util.Process_Object( x_return_status => l_return_status);
643 
644     IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
645        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
646     ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
647          RAISE FND_API.G_EXC_ERROR;
648     END IF;
649 
650 
651     OE_MSG_PUB.Count_And_Get
652     (   p_count                       => x_msg_count
653     ,   p_data                        => x_msg_data
654     );
655 
656 
657     if l_debug_level > 0 then
658       oe_debug_pub.ADD('Exiting OE_BLANKET_PUB.PROCESS_BLANKET', 1);
659     end if;
660 EXCEPTION
661 
662     WHEN FND_API.G_EXC_ERROR THEN
663 
664         if l_debug_level > 0 then
665           oe_debug_pub.add('BO: Exiting Process Blanket with Error', 2);
666         end if;
667         x_return_status := FND_API.G_RET_STS_ERROR;
668 
669   	      ROLLBACK TO SAVEPOINT Process_blanket;
670 
671 
672         --  Get message count and data
673 
674         OE_MSG_PUB.Count_And_Get
675         (   p_count                       => x_msg_count
676         ,   p_data                        => x_msg_data
677         );
678 
679     WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
680 
681         if l_debug_level > 0 then
682          oe_debug_pub.add('bO: Exiting Process Blanket with Unexpected Error', 2);
683         end if;
684         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
685 
686 	      ROLLBACK TO SAVEPOINT Process_Blanket;
687 
688 
689         --  Get message count and data
690 
691         OE_MSG_PUB.Count_And_Get
692         (   p_count                       => x_msg_count
693         ,   p_data                        => x_msg_data
694         );
695 
696     WHEN OTHERS THEN
697         if l_debug_level > 0 then
698           oe_debug_pub.add('bO: Exiting Process Blanket with others Error', 2);
699         end if;
700 
701         x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
702 
703      	ROLLBACK TO SAVEPOINT Process_Blanket;
704 
705 
706         IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
707         THEN
708             OE_MSG_PUB.Add_Exc_Msg
709             (   G_PKG_NAME
710             ,   'Process_Blanket'
711             );
712         END IF;
713 
714         --  Get message count and data
715 
716         OE_MSG_PUB.Count_And_Get
717         (   p_count                       => x_msg_count
718         ,   p_data                        => x_msg_data
719         );
720 
721 END Process_Blanket;
722 
723 END OE_Blanket_PVT;