DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_HEADER_ADJ_SECURITY

Source


1 PACKAGE BODY OE_Header_Adj_Security AS
2 /* $Header: OEXXHADB.pls 120.0.12010000.2 2010/02/23 11:01:54 aambasth ship $ */
3 
4 
5 --  Global constant holding the package name
6 
7 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'OE_Header_Adj_Security';
8 
9 g_header_id                   NUMBER := FND_API.G_MISS_NUM;
10 
11 -- LOCAL PROCEDURES
12 
13 FUNCTION Is_Op_Constrained
14 ( p_operation           IN VARCHAR2
15  , p_column_name         IN VARCHAR2 DEFAULT NULL
16  , p_record       IN OE_AK_HEADER_PRCADJS_V%ROWTYPE
17 , x_on_operation_action OUT NOCOPY NUMBER
18 
19 ) RETURN NUMBER IS
20 l_constraint_id	NUMBER;
21 l_grp	NUMBER;
22 l_result		NUMBER;
23 l_constrained_column	VARCHAR2(30);
24 l_audit_trail_enabled VARCHAR2(1) := OE_SYS_PARAMETERS.VALUE('AUDIT_TRAIL_ENABLE_FLAG');
25 l_code_level varchar2(6) := OE_CODE_CONTROL.GET_CODE_RELEASE_LEVEL;
26 l_order_booked_flag   VARCHAR2(1);
27 
28 CURSOR IS_ORDER_BOOKED(x_header_id NUMBER) IS
29        SELECT NVL(BOOKED_FLAG,'N')
30        FROM   OE_ORDER_HEADERS_ALL
31        WHERE  HEADER_ID = x_header_id;
32 
33 l_transaction_phase_code VARCHAR2(30);
34 --
35 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
36 --
37 BEGIN
38 
39 -- Bug 1755817: if header adjustment belongs to a different order, then
40 -- clear the cached results so that the cache is reset for
41 -- the new order
42 IF p_record.header_id <> g_header_id THEN
43    OE_PC_Constraints_Admin_Pvt.Clear_Cached_Results;
44    g_header_id := p_record.header_id;
45 END IF;
46 
47 IF l_code_level >= '110510' THEN
48    OE_Order_Cache.Load_Order_Header(p_record.header_id);
49    l_transaction_phase_code := oe_order_cache.g_header_rec.transaction_phase_code;
50 END IF;
51 
52 l_result := OE_PC_Constraints_Admin_PVT.Is_OP_constrained
53     ( p_responsibility_id     => nvl(fnd_global.resp_id, -1)
54     , p_application_id          => nvl(fnd_global.resp_appl_id,-1) --added for bug3631547
55     , p_operation   => p_operation
56     , p_qualifier_attribute => l_transaction_phase_code
57     , p_entity_id   => OE_PC_GLOBALS.G_ENTITY_HEADER_ADJ
58     , p_column_name => p_column_name
59     , p_check_all_cols_constraint  => g_check_all_cols_constraint
60     , p_is_caller_defaulting  => g_is_caller_defaulting
61     , p_use_cached_results    => 'Y'
62     , x_constraint_id    => l_constraint_id
63     , x_constraining_conditions_grp     => l_grp
64     , x_on_operation_action   => x_on_operation_action
65     );
66 
67 if l_result = OE_PC_GLOBALS.YES then
68 
69     IF g_check_all_cols_constraint = 'Y'
70        AND (p_operation = OE_PC_GLOBALS.UPDATE_OP
71             OR p_operation = OE_PC_GLOBALS.CREATE_OP)
72        AND x_on_operation_action = 0
73        AND p_column_name IS NOT NULL THEN
74         SELECT column_name
75         INTO l_constrained_column
76         FROM oe_pc_constraints
77         WHERE constraint_id = l_constraint_id;
78         if l_constrained_column is null then
79             RAISE FND_API.G_EXC_ERROR;
80         end if;
81     END IF;
82 
83 elsif l_result = OE_PC_GLOBALS.ERROR then
84 
85     raise FND_API.G_EXC_UNEXPECTED_ERROR;
86 
87 end if;
88 
89 g_check_all_cols_constraint := 'N';
90 
91 /* Start Versioning */
92 IF l_code_level >= '110510' AND
93   ( p_column_name = 'TRANSACTION_PHASE_CODE' OR
94     x_on_operation_action IN (.1,.2))THEN
95    OE_Versioning_Util.Check_Security(p_column_name => p_column_name,
96                    p_on_operation_action => x_on_operation_action);
97 END IF;
98 /* End Versioning */
99 
100 /* Start AuditTrail */
101 -- Code level should be OM-H and
102 -- Audit Trail Enabled
103 IF g_is_caller_defaulting = 'N' THEN
104 IF l_code_level >= '110508' and nvl(l_audit_trail_enabled,'D') <> 'D' and
105       nvl(l_transaction_phase_code,'F') = 'F' and
106       not OE_GLOBALS.G_HEADER_CREATED THEN
107    IF l_audit_trail_enabled = 'B' THEN  -- capture only for booked orders
108       OPEN IS_ORDER_BOOKED (p_record.header_id);
109       FETCH IS_ORDER_BOOKED INTO l_order_booked_flag;
110       CLOSE IS_ORDER_BOOKED;
111       IF l_order_booked_flag = 'Y' THEN
112          IF l_result = OE_PC_GLOBALS.YES THEN
113             IF x_on_operation_action = 1 THEN
114                -- set OUT result to NOT CONSTRAINED
115                IF l_debug_level  > 0 THEN
116                    oe_debug_pub.add(  'HEADER ADJUSTMENTS SECURITY - SETTING REQUIRES REASON TO TRUE' , 5 ) ;
117                END IF;
118                OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG := 'Y';
119                OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'N';
120             ELSIF x_on_operation_action = 2 THEN
121                -- set OUT result to NOT CONSTRAINED
122                IF OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG <> 'Y' then
123                   IF l_debug_level  > 0 THEN
124                       oe_debug_pub.add(  'HEADER ADJUSTMENTS SECURITY - SETTING REQUIRES HISTORY TO TRUE' , 5 ) ;
125                   END IF;
126 	          OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'Y';
127                END IF;
128             END IF;
129          END IF;
130       END IF;
131    ELSE -- capture audit trail for all orders
132       IF l_result = OE_PC_GLOBALS.YES THEN
133          IF x_on_operation_action = 1 THEN
134             -- set OUT result to NOT CONSTRAINED
135             IF l_debug_level  > 0 THEN
136                 oe_debug_pub.add(  'HEADER ADJUSTMENTS SECURITY - SETTING REQUIRES REASON TO TRUE' , 5 ) ;
137             END IF;
138             OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG := 'Y';
139             OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'N';
140          ELSIF x_on_operation_action = 2 THEN
141             -- set OUT result to NOT CONSTRAINED
142             IF OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG <> 'Y' then
143                IF l_debug_level  > 0 THEN
144                    oe_debug_pub.add(  'HEADER ADJUSTMENTS SECURITY - SETTING REQUIRES HISTORY TO TRUE' , 5 ) ;
145                END IF;
146 	       OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'Y';
147             END IF;
148          END IF;
149       END IF;
150    END IF;
151 END IF;
152 END IF;
153 /* End AuditTrail */
154 IF x_on_operation_action > 0 THEN
155    l_result := OE_PC_GLOBALS.NO;
156 END IF;
157 
158 RETURN l_result;
159 
160 END Is_Op_Constrained;
161 
162 
163 -- PUBLIC PROCEDURES
164 
165 
166 FUNCTION ATTRIBUTE1
167 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
168 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
169 , x_on_operation_action OUT NOCOPY NUMBER
170 
171 ) RETURN NUMBER
172 IS
173 l_result 	NUMBER;
174 --
175 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
176 --
177 BEGIN
178 
179     l_result := Is_OP_constrained
180         (p_operation	=> p_operation
181         ,p_column_name	=> 'ATTRIBUTE1'
182         ,p_record	=> p_record
183         ,x_on_operation_action	=> x_on_operation_action
184         );
185 
186 RETURN(l_result);
187 
188 END ATTRIBUTE1;
189 
190 
191 FUNCTION ATTRIBUTE10
192 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
193 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
194 , x_on_operation_action OUT NOCOPY NUMBER
195 
196 ) RETURN NUMBER
197 IS
198 l_result 	NUMBER;
199 --
200 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
201 --
202 BEGIN
203 
204     l_result := Is_OP_constrained
205         (p_operation	=> p_operation
206         ,p_column_name	=> 'ATTRIBUTE10'
207         ,p_record	=> p_record
208         ,x_on_operation_action	=> x_on_operation_action
209         );
210 
211 RETURN(l_result);
212 
213 END ATTRIBUTE10;
214 
215 
216 FUNCTION ATTRIBUTE11
217 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
218 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
219 , x_on_operation_action OUT NOCOPY NUMBER
220 
221 ) RETURN NUMBER
222 IS
223 l_result 	NUMBER;
224 --
225 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
226 --
227 BEGIN
228 
229     l_result := Is_OP_constrained
230         (p_operation	=> p_operation
231         ,p_column_name	=> 'ATTRIBUTE11'
232         ,p_record	=> p_record
233         ,x_on_operation_action	=> x_on_operation_action
234         );
235 
236 RETURN(l_result);
237 
238 END ATTRIBUTE11;
239 
240 
241 FUNCTION ATTRIBUTE12
242 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
243 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
244 , x_on_operation_action OUT NOCOPY NUMBER
245 
246 ) RETURN NUMBER
247 IS
248 l_result 	NUMBER;
249 --
250 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
251 --
252 BEGIN
253 
254     l_result := Is_OP_constrained
255         (p_operation	=> p_operation
256         ,p_column_name	=> 'ATTRIBUTE12'
257         ,p_record	=> p_record
258         ,x_on_operation_action	=> x_on_operation_action
259         );
260 
261 RETURN(l_result);
262 
263 END ATTRIBUTE12;
264 
265 
266 FUNCTION ATTRIBUTE13
267 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
268 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
269 , x_on_operation_action OUT NOCOPY NUMBER
270 
271 ) RETURN NUMBER
272 IS
273 l_result 	NUMBER;
274 --
275 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
276 --
277 BEGIN
278 
279     l_result := Is_OP_constrained
280         (p_operation	=> p_operation
281         ,p_column_name	=> 'ATTRIBUTE13'
282         ,p_record	=> p_record
283         ,x_on_operation_action	=> x_on_operation_action
284         );
285 
286 RETURN(l_result);
287 
288 END ATTRIBUTE13;
289 
290 
291 FUNCTION ATTRIBUTE14
292 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
293 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
294 , x_on_operation_action OUT NOCOPY NUMBER
295 
296 ) RETURN NUMBER
297 IS
298 l_result 	NUMBER;
299 --
300 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
301 --
302 BEGIN
303 
304     l_result := Is_OP_constrained
305         (p_operation	=> p_operation
306         ,p_column_name	=> 'ATTRIBUTE14'
307         ,p_record	=> p_record
308         ,x_on_operation_action	=> x_on_operation_action
309         );
310 
311 RETURN(l_result);
312 
313 END ATTRIBUTE14;
314 
315 
316 FUNCTION ATTRIBUTE15
317 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
318 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
319 , x_on_operation_action OUT NOCOPY NUMBER
320 
321 ) RETURN NUMBER
322 IS
323 l_result 	NUMBER;
324 --
325 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
326 --
327 BEGIN
328 
329     l_result := Is_OP_constrained
330         (p_operation	=> p_operation
331         ,p_column_name	=> 'ATTRIBUTE15'
332         ,p_record	=> p_record
333         ,x_on_operation_action	=> x_on_operation_action
334         );
335 
336 RETURN(l_result);
337 
338 END ATTRIBUTE15;
339 
340 
341 FUNCTION ATTRIBUTE2
342 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
343 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
344 , x_on_operation_action OUT NOCOPY NUMBER
345 
346 ) RETURN NUMBER
347 IS
348 l_result 	NUMBER;
349 --
350 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
351 --
352 BEGIN
353 
354     l_result := Is_OP_constrained
355         (p_operation	=> p_operation
356         ,p_column_name	=> 'ATTRIBUTE2'
357         ,p_record	=> p_record
358         ,x_on_operation_action	=> x_on_operation_action
359         );
360 
361 RETURN(l_result);
362 
363 END ATTRIBUTE2;
364 
365 
366 FUNCTION ATTRIBUTE3
367 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
368 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
369 , x_on_operation_action OUT NOCOPY NUMBER
370 
371 ) RETURN NUMBER
372 IS
373 l_result 	NUMBER;
374 --
375 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
376 --
377 BEGIN
378 
379     l_result := Is_OP_constrained
380         (p_operation	=> p_operation
381         ,p_column_name	=> 'ATTRIBUTE3'
382         ,p_record	=> p_record
383         ,x_on_operation_action	=> x_on_operation_action
384         );
385 
386 RETURN(l_result);
387 
388 END ATTRIBUTE3;
389 
390 
391 FUNCTION ATTRIBUTE4
392 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
393 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
394 , x_on_operation_action OUT NOCOPY NUMBER
395 
396 ) RETURN NUMBER
397 IS
398 l_result 	NUMBER;
399 --
400 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
401 --
402 BEGIN
403 
404     l_result := Is_OP_constrained
405         (p_operation	=> p_operation
406         ,p_column_name	=> 'ATTRIBUTE4'
407         ,p_record	=> p_record
408         ,x_on_operation_action	=> x_on_operation_action
409         );
410 
411 RETURN(l_result);
412 
413 END ATTRIBUTE4;
414 
415 
416 FUNCTION ATTRIBUTE5
417 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
418 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
419 , x_on_operation_action OUT NOCOPY NUMBER
420 
421 ) RETURN NUMBER
422 IS
423 l_result 	NUMBER;
424 --
425 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
426 --
427 BEGIN
428 
429     l_result := Is_OP_constrained
430         (p_operation	=> p_operation
431         ,p_column_name	=> 'ATTRIBUTE5'
432         ,p_record	=> p_record
433         ,x_on_operation_action	=> x_on_operation_action
434         );
435 
436 RETURN(l_result);
437 
438 END ATTRIBUTE5;
439 
440 
441 FUNCTION ATTRIBUTE6
442 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
443 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
444 , x_on_operation_action OUT NOCOPY NUMBER
445 
446 ) RETURN NUMBER
447 IS
448 l_result 	NUMBER;
449 --
450 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
451 --
452 BEGIN
453 
454     l_result := Is_OP_constrained
455         (p_operation	=> p_operation
456         ,p_column_name	=> 'ATTRIBUTE6'
457         ,p_record	=> p_record
458         ,x_on_operation_action	=> x_on_operation_action
459         );
460 
461 RETURN(l_result);
462 
463 END ATTRIBUTE6;
464 
465 
466 FUNCTION ATTRIBUTE7
467 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
468 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
469 , x_on_operation_action OUT NOCOPY NUMBER
470 
471 ) RETURN NUMBER
472 IS
473 l_result 	NUMBER;
474 --
475 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
476 --
477 BEGIN
478 
479     l_result := Is_OP_constrained
480         (p_operation	=> p_operation
481         ,p_column_name	=> 'ATTRIBUTE7'
482         ,p_record	=> p_record
483         ,x_on_operation_action	=> x_on_operation_action
484         );
485 
486 RETURN(l_result);
487 
488 END ATTRIBUTE7;
489 
490 
491 FUNCTION ATTRIBUTE8
492 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
493 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
494 , x_on_operation_action OUT NOCOPY NUMBER
495 
496 ) RETURN NUMBER
497 IS
498 l_result 	NUMBER;
499 --
500 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
501 --
502 BEGIN
503 
504     l_result := Is_OP_constrained
505         (p_operation	=> p_operation
506         ,p_column_name	=> 'ATTRIBUTE8'
507         ,p_record	=> p_record
508         ,x_on_operation_action	=> x_on_operation_action
509         );
510 
511 RETURN(l_result);
512 
513 END ATTRIBUTE8;
514 
515 
516 FUNCTION ATTRIBUTE9
517 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
518 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
519 , x_on_operation_action OUT NOCOPY NUMBER
520 
521 ) RETURN NUMBER
522 IS
523 l_result 	NUMBER;
524 --
525 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
526 --
527 BEGIN
528 
529     l_result := Is_OP_constrained
530         (p_operation	=> p_operation
531         ,p_column_name	=> 'ATTRIBUTE9'
532         ,p_record	=> p_record
533         ,x_on_operation_action	=> x_on_operation_action
534         );
535 
536 RETURN(l_result);
537 
538 END ATTRIBUTE9;
539 
540 
541 FUNCTION AUTOMATIC
542 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
543 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
544 , x_on_operation_action OUT NOCOPY NUMBER
545 
546 ) RETURN NUMBER
547 IS
548 l_result 	NUMBER;
549 --
550 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
551 --
552 BEGIN
553 
554     l_result := Is_OP_constrained
555         (p_operation	=> p_operation
556         ,p_column_name	=> 'AUTOMATIC_FLAG'
557         ,p_record	=> p_record
558         ,x_on_operation_action	=> x_on_operation_action
559         );
560 
561 RETURN(l_result);
562 
563 END AUTOMATIC;
564 
565 
566 FUNCTION CONTEXT
567 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
568 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
569 , x_on_operation_action OUT NOCOPY NUMBER
570 
571 ) RETURN NUMBER
572 IS
573 l_result 	NUMBER;
574 --
575 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
576 --
577 BEGIN
578 
579     l_result := Is_OP_constrained
580         (p_operation	=> p_operation
581         ,p_column_name	=> 'CONTEXT'
582         ,p_record	=> p_record
583         ,x_on_operation_action	=> x_on_operation_action
584         );
585 
586 RETURN(l_result);
587 
588 END CONTEXT;
589 
590 
591 FUNCTION CREATED_BY
592 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
593 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
594 , x_on_operation_action OUT NOCOPY NUMBER
595 
596 ) RETURN NUMBER
597 IS
598 l_result 	NUMBER;
599 --
600 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
601 --
602 BEGIN
603 
604     l_result := Is_OP_constrained
605         (p_operation	=> p_operation
606         ,p_column_name	=> 'CREATED_BY'
607         ,p_record	=> p_record
608         ,x_on_operation_action	=> x_on_operation_action
609         );
610 
611 RETURN(l_result);
612 
613 END CREATED_BY;
614 
615 
616 FUNCTION CREATION_DATE
617 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
618 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
619 , x_on_operation_action OUT NOCOPY NUMBER
620 
621 ) RETURN NUMBER
622 IS
623 l_result 	NUMBER;
624 --
625 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
626 --
627 BEGIN
628 
629     l_result := Is_OP_constrained
630         (p_operation	=> p_operation
631         ,p_column_name	=> 'CREATION_DATE'
632         ,p_record	=> p_record
633         ,x_on_operation_action	=> x_on_operation_action
634         );
635 
636 RETURN(l_result);
637 
638 END CREATION_DATE;
639 
640 
641 FUNCTION DISCOUNT
642 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
643 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
644 , x_on_operation_action OUT NOCOPY NUMBER
645 
646 ) RETURN NUMBER
647 IS
648 l_result 	NUMBER;
649 --
650 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
651 --
652 BEGIN
653 
654     l_result := Is_OP_constrained
655         (p_operation	=> p_operation
656         ,p_column_name	=> 'DISCOUNT_ID'
657         ,p_record	=> p_record
658         ,x_on_operation_action	=> x_on_operation_action
659         );
660 
661 RETURN(l_result);
662 
663 END DISCOUNT;
664 
665 FUNCTION OPERAND
666 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
667 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
668 , x_on_operation_action OUT NOCOPY NUMBER
669 
670 ) RETURN NUMBER
671 IS
672 l_result 	NUMBER;
673 --
674 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
675 --
676 BEGIN
677 
678     l_result := Is_OP_constrained
679         (p_operation	=> p_operation
680         ,p_column_name	=> 'OPERAND'
681         ,p_record	=> p_record
682         ,x_on_operation_action	=> x_on_operation_action
683         );
684 
685 RETURN(l_result);
686 
687 END OPERAND;
688 
689 FUNCTION DISCOUNT_LINE
690 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
691 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
692 , x_on_operation_action OUT NOCOPY NUMBER
693 
694 ) RETURN NUMBER
695 IS
696 l_result 	NUMBER;
697 --
698 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
699 --
700 BEGIN
701 
702     l_result := Is_OP_constrained
703         (p_operation	=> p_operation
704         ,p_column_name	=> 'DISCOUNT_LINE_ID'
705         ,p_record	=> p_record
706         ,x_on_operation_action	=> x_on_operation_action
707         );
708 
709 RETURN(l_result);
710 
711 END DISCOUNT_LINE;
712 
713 
714 FUNCTION HEADER
715 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
716 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
717 , x_on_operation_action OUT NOCOPY NUMBER
718 
719 ) RETURN NUMBER
720 IS
721 l_result 	NUMBER;
722 --
723 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
724 --
725 BEGIN
726 
727     l_result := Is_OP_constrained
728         (p_operation	=> p_operation
729         ,p_column_name	=> 'HEADER_ID'
730         ,p_record	=> p_record
731         ,x_on_operation_action	=> x_on_operation_action
732         );
733 
734 RETURN(l_result);
735 
736 END HEADER;
737 
738 
739 FUNCTION LAST_UPDATED_BY
740 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
741 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
742 , x_on_operation_action OUT NOCOPY NUMBER
743 
744 ) RETURN NUMBER
745 IS
746 l_result 	NUMBER;
747 --
748 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
749 --
750 BEGIN
751 
752     l_result := Is_OP_constrained
753         (p_operation	=> p_operation
754         ,p_column_name	=> 'LAST_UPDATED_BY'
755         ,p_record	=> p_record
756         ,x_on_operation_action	=> x_on_operation_action
757         );
758 
759 RETURN(l_result);
760 
761 END LAST_UPDATED_BY;
762 
763 
764 FUNCTION LAST_UPDATE_DATE
765 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
766 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
767 , x_on_operation_action OUT NOCOPY NUMBER
768 
769 ) RETURN NUMBER
770 IS
771 l_result 	NUMBER;
772 --
773 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
774 --
775 BEGIN
776 
777     l_result := Is_OP_constrained
778         (p_operation	=> p_operation
779         ,p_column_name	=> 'LAST_UPDATE_DATE'
780         ,p_record	=> p_record
781         ,x_on_operation_action	=> x_on_operation_action
782         );
783 
784 RETURN(l_result);
785 
786 END LAST_UPDATE_DATE;
787 
788 
789 FUNCTION LAST_UPDATE_LOGIN
790 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
791 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
792 , x_on_operation_action OUT NOCOPY NUMBER
793 
794 ) RETURN NUMBER
795 IS
796 l_result 	NUMBER;
797 --
798 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
799 --
800 BEGIN
801 
802     l_result := Is_OP_constrained
803         (p_operation	=> p_operation
804         ,p_column_name	=> 'LAST_UPDATE_LOGIN'
805         ,p_record	=> p_record
806         ,x_on_operation_action	=> x_on_operation_action
807         );
808 
809 RETURN(l_result);
810 
811 END LAST_UPDATE_LOGIN;
812 
813 
814 FUNCTION LINE
815 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
816 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
817 , x_on_operation_action OUT NOCOPY NUMBER
818 
819 ) RETURN NUMBER
820 IS
821 l_result 	NUMBER;
822 --
823 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
824 --
825 BEGIN
826 
827     l_result := Is_OP_constrained
828         (p_operation	=> p_operation
829         ,p_column_name	=> 'LINE_ID'
830         ,p_record	=> p_record
831         ,x_on_operation_action	=> x_on_operation_action
832         );
833 
834 RETURN(l_result);
835 
836 END LINE;
837 
838 
839 FUNCTION PERCENT
840 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
841 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
842 , x_on_operation_action OUT NOCOPY NUMBER
843 
844 ) RETURN NUMBER
845 IS
846 l_result 	NUMBER;
847 --
848 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
849 --
850 BEGIN
851 
852     l_result := Is_OP_constrained
853         (p_operation	=> p_operation
854         ,p_column_name	=> 'PERCENT'
855         ,p_record	=> p_record
856         ,x_on_operation_action	=> x_on_operation_action
857         );
858 
859 RETURN(l_result);
860 
861 END PERCENT;
862 
863 
864 FUNCTION PRICE_ADJUSTMENT
865 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
866 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
867 , x_on_operation_action OUT NOCOPY NUMBER
868 
869 ) RETURN NUMBER
870 IS
871 l_result 	NUMBER;
872 --
873 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
874 --
875 BEGIN
876 
877     l_result := Is_OP_constrained
878         (p_operation	=> p_operation
879         ,p_column_name	=> 'PRICE_ADJUSTMENT_ID'
880         ,p_record	=> p_record
881         ,x_on_operation_action	=> x_on_operation_action
882         );
883 
884 RETURN(l_result);
885 
886 END PRICE_ADJUSTMENT;
887 
888 
889 FUNCTION PROGRAM_APPLICATION
890 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
891 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
892 , x_on_operation_action OUT NOCOPY NUMBER
893 
894 ) RETURN NUMBER
895 IS
896 l_result 	NUMBER;
897 --
898 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
899 --
900 BEGIN
901 
902     l_result := Is_OP_constrained
903         (p_operation	=> p_operation
904         ,p_column_name	=> 'PROGRAM_APPLICATION_ID'
905         ,p_record	=> p_record
906         ,x_on_operation_action	=> x_on_operation_action
907         );
908 
909 RETURN(l_result);
910 
911 END PROGRAM_APPLICATION;
912 
913 
914 FUNCTION PROGRAM
915 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
916 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
917 , x_on_operation_action OUT NOCOPY NUMBER
918 
919 ) RETURN NUMBER
920 IS
921 l_result 	NUMBER;
922 --
923 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
924 --
925 BEGIN
926 
927     l_result := Is_OP_constrained
928         (p_operation	=> p_operation
929         ,p_column_name	=> 'PROGRAM_ID'
930         ,p_record	=> p_record
931         ,x_on_operation_action	=> x_on_operation_action
932         );
933 
934 RETURN(l_result);
935 
936 END PROGRAM;
937 
938 
939 FUNCTION PROGRAM_UPDATE_DATE
940 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
941 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
942 , x_on_operation_action OUT NOCOPY NUMBER
943 
944 ) RETURN NUMBER
945 IS
946 l_result 	NUMBER;
947 --
948 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
949 --
950 BEGIN
951 
952     l_result := Is_OP_constrained
953         (p_operation	=> p_operation
954         ,p_column_name	=> 'PROGRAM_UPDATE_DATE'
955         ,p_record	=> p_record
956         ,x_on_operation_action	=> x_on_operation_action
957         );
958 
959 RETURN(l_result);
960 
961 END PROGRAM_UPDATE_DATE;
962 
963 
964 FUNCTION REQUEST
965 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
966 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
967 , x_on_operation_action OUT NOCOPY NUMBER
968 
969 ) RETURN NUMBER
970 IS
971 l_result 	NUMBER;
972 --
973 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
974 --
975 BEGIN
976 
977     l_result := Is_OP_constrained
978         (p_operation	=> p_operation
979         ,p_column_name	=> 'REQUEST_ID'
980         ,p_record	=> p_record
981         ,x_on_operation_action	=> x_on_operation_action
982         );
983 
984 RETURN(l_result);
985 
986 END REQUEST;
987 
988 
989 FUNCTION list_header
990 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
991 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
992 , x_on_operation_action OUT NOCOPY NUMBER
993 
994 ) RETURN NUMBER
995 IS
996 l_result 	NUMBER;
997 --
998 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
999 --
1000 BEGIN
1001 
1002     l_result := Is_OP_constrained
1003         (p_operation	=> p_operation
1004         ,p_column_name	=> 'LIST_HEADER_ID'
1005 	   ,p_record	=> p_record
1006         ,x_on_operation_action	=> x_on_operation_action
1007         );
1008 
1009 RETURN(l_result);
1010 
1011 END list_header;
1012 
1013 FUNCTION list_line
1014 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1015 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1016 , x_on_operation_action OUT NOCOPY NUMBER
1017 
1018 ) RETURN NUMBER
1019 IS
1020 l_result 	NUMBER;
1021 --
1022 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1023 --
1024 BEGIN
1025 
1026     l_result := Is_OP_constrained
1027         (p_operation	=> p_operation
1028         ,p_column_name	=> 'LIST_LINE_ID'
1029 	   ,p_record	=> p_record
1030         ,x_on_operation_action	=> x_on_operation_action
1031         );
1032 
1033 RETURN(l_result);
1034 
1035 END list_line;
1036 
1037 FUNCTION line_type_code
1038 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1039 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1040 , x_on_operation_action OUT NOCOPY NUMBER
1041 
1042 ) RETURN NUMBER
1043 IS
1044 l_result 	NUMBER;
1045 --
1046 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1047 --
1048 BEGIN
1049 
1050     l_result := Is_OP_constrained
1051         (p_operation	=> p_operation
1052         ,p_column_name	=> 'LIST_LINE_TYPE_CODE'
1053 	   ,p_record	=> p_record
1054         ,x_on_operation_action	=> x_on_operation_action
1055         );
1056 
1057 RETURN(l_result);
1058 
1059 END line_type_code;
1060 
1061 FUNCTION modifier_mechanism
1062 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1063 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1064 , x_on_operation_action OUT NOCOPY NUMBER
1065 
1066 ) RETURN NUMBER
1067 IS
1068 l_result 	NUMBER;
1069 --
1070 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1071 --
1072 BEGIN
1073 
1074     l_result := Is_OP_constrained
1075         (p_operation	=> p_operation
1076         ,p_column_name	=> 'MODIFIER_MECHANISM_TYPE_CODE'
1077 	   ,p_record	=> p_record
1078         ,x_on_operation_action	=> x_on_operation_action
1079         );
1080 
1081 RETURN(l_result);
1082 
1083 END modifier_mechanism;
1084 
1085 FUNCTION modified_from
1086 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1087 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1088 , x_on_operation_action OUT NOCOPY NUMBER
1089 
1090 ) RETURN NUMBER
1091 IS
1092 l_result 	NUMBER;
1093 --
1094 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1095 --
1096 BEGIN
1097 
1098     l_result := Is_OP_constrained
1099         (p_operation	=> p_operation
1100         ,p_column_name	=> 'MODIFIED_FROM'
1101 	   ,p_record	=> p_record
1102         ,x_on_operation_action	=> x_on_operation_action
1103         );
1104 
1105 RETURN(l_result);
1106 
1107 END modified_from;
1108 
1109 FUNCTION modified_to
1110 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1111 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1112 , x_on_operation_action OUT NOCOPY NUMBER
1113 
1114 ) RETURN NUMBER
1115 IS
1116 l_result 	NUMBER;
1117 --
1118 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1119 --
1120 BEGIN
1121 
1122     l_result := Is_OP_constrained
1123         (p_operation	=> p_operation
1124         ,p_column_name	=> 'MODIFIED_TO'
1125 	   ,p_record	=> p_record
1126         ,x_on_operation_action	=> x_on_operation_action
1127         );
1128 
1129 RETURN(l_result);
1130 
1131 END modified_to;
1132 
1133 FUNCTION updated_flag
1134 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1135 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1136 , x_on_operation_action OUT NOCOPY NUMBER
1137 
1138 ) RETURN NUMBER
1139 IS
1140 l_result 	NUMBER;
1141 --
1142 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1143 --
1144 BEGIN
1145 
1146     l_result := Is_OP_constrained
1147         (p_operation	=> p_operation
1148         ,p_column_name	=> 'UPDATED_FLAG'
1149 	   ,p_record	=> p_record
1150         ,x_on_operation_action	=> x_on_operation_action
1151         );
1152 
1153 RETURN(l_result);
1154 
1155 END updated_flag;
1156 
1157 FUNCTION update_allowed
1158 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1159 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1160 , x_on_operation_action OUT NOCOPY NUMBER
1161 
1162 ) RETURN NUMBER
1163 IS
1164 l_result 	NUMBER;
1165 --
1166 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1167 --
1168 BEGIN
1169 
1170     l_result := Is_OP_constrained
1171         (p_operation	=> p_operation
1172         ,p_column_name	=> 'UPDATE_ALLOWED'
1173 	   ,p_record	=> p_record
1174         ,x_on_operation_action	=> x_on_operation_action
1175         );
1176 
1177 RETURN(l_result);
1178 
1179 END update_allowed;
1180 
1181 FUNCTION applied_flag
1182 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1183 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1184 , x_on_operation_action OUT NOCOPY NUMBER
1185 
1186 ) RETURN NUMBER
1187 IS
1188 l_result 	NUMBER;
1189 --
1190 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1191 --
1192 BEGIN
1193 
1194     l_result := Is_OP_constrained
1195         (p_operation	=> p_operation
1196         ,p_column_name	=> 'APPLIED_FLAG'
1197 	   ,p_record	=> p_record
1198         ,x_on_operation_action	=> x_on_operation_action
1199         );
1200 
1201 RETURN(l_result);
1202 
1203 END applied_flag;
1204 
1205 FUNCTION change_code
1206 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1207 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1208 , x_on_operation_action OUT NOCOPY NUMBER
1209 
1210 ) RETURN NUMBER
1211 IS
1212 l_result 	NUMBER;
1213 --
1214 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1215 --
1216 BEGIN
1217 
1218     l_result := Is_OP_constrained
1219         (p_operation	=> p_operation
1220         ,p_column_name	=> 'CHANGE_REASON_CODE'
1221 	   ,p_record	=> p_record
1222         ,x_on_operation_action	=> x_on_operation_action
1223         );
1224 
1225 RETURN(l_result);
1226 
1227 END change_code;
1228 
1229 FUNCTION change_text
1230 (   p_operation                     IN  VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
1231 ,   p_record                        IN  OE_AK_HEADER_PRCADJS_V%ROWTYPE
1232 , x_on_operation_action OUT NOCOPY NUMBER
1233 
1234 ) RETURN NUMBER
1235 IS
1236 l_result 	NUMBER;
1237 --
1238 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1239 --
1240 BEGIN
1241 
1242     l_result := Is_OP_constrained
1243         (p_operation	=> p_operation
1244         ,p_column_name	=> 'CHANGE_REASON_TEXT'
1245 	   ,p_record	=> p_record
1246         ,x_on_operation_action	=> x_on_operation_action
1247         );
1248 
1249 RETURN(l_result);
1250 
1251 END change_text;
1252 
1253 PROCEDURE Entity
1254 (   p_HEADER_ADJ_rec                IN  OE_Order_PUB.HEADER_ADJ_Rec_Type
1255 , x_result OUT NOCOPY NUMBER
1256 
1257 , x_return_status OUT NOCOPY VARCHAR2
1258 
1259 ) IS
1260 l_operation	VARCHAR2(1);
1261 l_on_operation_action	NUMBER;
1262 l_rowtype_rec	OE_AK_HEADER_PRCADJS_V%ROWTYPE;
1263 --
1264 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1265 --
1266 BEGIN
1267 
1268 IF l_debug_level  > 0 THEN
1269     oe_debug_pub.add(  'ENTER OE_HEADER_ADJ_SECURITY.ENTITY' , 1 ) ;
1270 END IF;
1271 
1272 -- Initializing return status to SUCCESS
1273 x_return_status := FND_API.G_RET_STS_SUCCESS;
1274 
1275 IF p_HEADER_ADJ_rec.operation = OE_GLOBALS.G_OPR_CREATE THEN
1276     l_operation := OE_PC_GLOBALS.CREATE_OP;
1277 ELSIF p_HEADER_ADJ_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
1278     l_operation := OE_PC_GLOBALS.UPDATE_OP;
1279 ELSIF p_HEADER_ADJ_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
1280     l_operation := OE_PC_GLOBALS.DELETE_OP;
1281 ELSE
1282     IF l_debug_level  > 0 THEN
1283         oe_debug_pub.add(  'INVALID OPERATION' , 1 ) ;
1284     END IF;
1285     RAISE FND_API.G_EXC_ERROR;
1286 END IF;
1287 
1288 OE_Header_Adj_Util.API_Rec_To_Rowtype_Rec(p_HEADER_ADJ_rec
1289 								, l_rowtype_rec);
1290 
1291 --Initialize security global record
1292 OE_HEADER_ADJ_SECURITY.g_record := l_rowtype_rec;
1293 
1294 x_result := Is_OP_constrained
1295     (p_operation	=> l_operation
1296     ,p_record	=> l_rowtype_rec
1297     ,x_on_operation_action	=> l_on_operation_action
1298     );
1299 
1300 IF l_debug_level  > 0 THEN
1301     oe_debug_pub.add(  'EXIT OE_HEADER_ADJ_SECURITY.ENTITY' , 1 ) ;
1302 END IF;
1303 
1304 EXCEPTION
1305     WHEN OTHERS THEN
1306     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1307     IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1308         OE_MSG_PUB.Add_Exc_Msg
1309         (   G_PKG_NAME
1310         ,   'Entity'
1311         );
1312     END IF;
1313 
1314 END Entity;
1315 
1316 
1317 PROCEDURE Attributes
1318 (   p_HEADER_ADJ_rec                IN  OE_Order_PUB.HEADER_ADJ_Rec_Type
1319 ,   p_old_HEADER_ADJ_rec            IN  OE_Order_PUB.HEADER_ADJ_Rec_Type := OE_Order_PUB.G_MISS_HEADER_ADJ_REC
1320 , x_result OUT NOCOPY NUMBER
1321 
1322 , x_return_status OUT NOCOPY VARCHAR2
1323 
1324 ) IS
1325 l_operation	VARCHAR2(1);
1326 l_on_operation_action  NUMBER;
1327 l_result		NUMBER;
1328 l_rowtype_rec	OE_AK_HEADER_PRCADJS_V%ROWTYPE;
1329 l_column_name	VARCHAR2(30);
1330 l_check_all_cols_constraint VARCHAR2(1);
1331 --
1332 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
1333 --
1334 BEGIN
1335 IF l_debug_level  > 0 THEN
1336     oe_debug_pub.add(  'ENTER OE_HEADER_ADJ_SECURITY.ATTRIBUTES' , 1 ) ;
1337 END IF;
1338 
1339 -- Initializing return status to SUCCESS
1340 x_return_status := FND_API.G_RET_STS_SUCCESS;
1341 
1342 -- Initializing out result to NOT CONSTRAINED
1343 x_result := OE_PC_GLOBALS.NO;
1344 
1345  -- Get the operation code to be passed to the security framework API
1346 IF p_HEADER_ADJ_rec.operation = OE_GLOBALS.G_OPR_CREATE THEN
1347     l_operation := OE_PC_GLOBALS.CREATE_OP;
1348     -- Bug 1755817: if there are no attribute-specific insert
1349     -- constraints, then no need to go further. Entity level
1350     -- security check for CREATE will be called again from
1351     -- process order after defaulting.
1352     IF NOT OE_PC_Constraints_Admin_PVT.Check_On_Insert_Exists
1353            (p_entity_id   => OE_PC_GLOBALS.G_ENTITY_HEADER_ADJ
1354            ,p_responsibility_id     => nvl(fnd_global.resp_id, -1)
1355            ,p_application_id        => nvl(fnd_global.resp_appl_id,-1) --added for bug3631547
1356            )
1357     THEN
1358        RETURN;
1359     END IF;
1360 ELSIF p_HEADER_ADJ_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
1361     l_operation := OE_PC_GLOBALS.UPDATE_OP;
1362 ELSE
1363     IF l_debug_level  > 0 THEN
1364         oe_debug_pub.add(  'INVALID OPERATION' , 1 ) ;
1365     END IF;
1366     RAISE FND_API.G_EXC_ERROR;
1367 END IF;
1368 
1369 OE_Header_Adj_Util.API_Rec_To_Rowtype_Rec(p_HEADER_ADJ_rec
1370 								, l_rowtype_rec);
1371 
1372 --Initialize security global record
1373 OE_HEADER_ADJ_SECURITY.g_record := l_rowtype_rec;
1374 
1375     --Bug 9323560 starts
1376     oe_debug_pub.add( 'p_header_adj_rec.applied_flag: ' || p_header_adj_rec.applied_flag );
1377 
1378     IF p_header_adj_rec.applied_flag = FND_API.G_MISS_CHAR THEN
1379         NULL;
1380     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.applied_flag,p_old_header_adj_rec.applied_flag) THEN
1381         oe_debug_pub.add( 'l_rowtype_rec.automatic_flag: ' || l_rowtype_rec.automatic_flag );
1382         oe_debug_pub.add( 'l_rowtype_rec.applied_flag: ' || l_rowtype_rec.applied_flag );
1383 
1384         IF l_rowtype_rec.automatic_flag='Y' AND l_rowtype_rec.applied_flag='N' THEN
1385         --Automatic modifiers are not deleted, instead they are unapplied
1386         --That is, when deleted, applied_flag is updated as 'N'.
1387         --The operation code remains UPDATE in this case instead of DELETE so
1388         --this code is exclusively added for this case.
1389             x_result := Is_OP_constrained ( p_operation => OE_PC_GLOBALS.DELETE_OP
1390                                           , p_record    => l_rowtype_rec
1391                                           , x_on_operation_action => l_on_operation_action
1392                                           );
1393             IF l_result = OE_PC_GLOBALS.YES THEN
1394                 x_result := OE_PC_GLOBALS.YES;
1395             END IF;
1396         END IF;
1397     END IF;
1398     --Bug 9323560 ends
1399 
1400 
1401 -- Compare the new and old entity records and
1402 -- check constraints for all the changed attributes.
1403 
1404     IF p_header_adj_rec.automatic_flag = FND_API.G_MISS_CHAR THEN NULL;
1405     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.automatic_flag,p_old_header_adj_rec.automatic_flag) THEN
1406 
1407         l_result := AUTOMATIC
1408             (p_operation        => l_operation
1409             ,p_record   => l_rowtype_rec
1410             ,x_on_operation_action => l_on_operation_action
1411             );
1412 
1413         IF l_result = OE_PC_GLOBALS.YES THEN
1414             -- set OUT result to CONSTRAINED
1415             x_result := OE_PC_GLOBALS.YES;
1416         END IF;
1417 
1418     END IF;
1419 
1420     IF p_header_adj_rec.discount_id = FND_API.G_MISS_NUM THEN NULL;
1421     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.discount_id,p_old_header_adj_rec.discount_id) THEN
1422 
1423         l_result := DISCOUNT
1424             (p_operation        => l_operation
1425             ,p_record   => l_rowtype_rec
1426             ,x_on_operation_action => l_on_operation_action
1427             );
1428 
1429         IF l_result = OE_PC_GLOBALS.YES THEN
1430             -- set OUT result to CONSTRAINED
1431             x_result := OE_PC_GLOBALS.YES;
1432         END IF;
1433 
1434     END IF;
1435 
1436     IF p_header_adj_rec.operand = FND_API.G_MISS_NUM THEN NULL;
1437     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.operand,p_old_header_adj_rec.operand) THEN
1438 
1439         l_result := OPERAND
1440             (p_operation        => l_operation
1441             ,p_record   => l_rowtype_rec
1442             ,x_on_operation_action => l_on_operation_action
1443             );
1444 
1445         IF l_result = OE_PC_GLOBALS.YES THEN
1446             -- set OUT result to CONSTRAINED
1447             x_result := OE_PC_GLOBALS.YES;
1448         END IF;
1449 
1450     END IF;
1451 
1452     IF p_header_adj_rec.discount_line_id = FND_API.G_MISS_NUM THEN NULL;
1453     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.discount_line_id,p_old_header_adj_rec.discount_line_id) THEN
1454 
1455         l_result := DISCOUNT_LINE
1456             (p_operation        => l_operation
1457             ,p_record   => l_rowtype_rec
1458             ,x_on_operation_action => l_on_operation_action
1459             );
1460 
1461         IF l_result = OE_PC_GLOBALS.YES THEN
1462             -- set OUT result to CONSTRAINED
1463             x_result := OE_PC_GLOBALS.YES;
1464         END IF;
1465 
1466     END IF;
1467 
1468     IF p_header_adj_rec.percent = FND_API.G_MISS_NUM THEN NULL;
1469     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.percent,p_old_header_adj_rec.percent) THEN
1470 
1471         l_result := PERCENT
1472             (p_operation        => l_operation
1473             ,p_record   => l_rowtype_rec
1474             ,x_on_operation_action => l_on_operation_action
1475             );
1476 
1477         IF l_result = OE_PC_GLOBALS.YES THEN
1478             -- set OUT result to CONSTRAINED
1479             x_result := OE_PC_GLOBALS.YES;
1480         END IF;
1481 
1482     END IF;
1483 
1484     IF p_header_adj_rec.request_id = FND_API.G_MISS_NUM THEN NULL;
1485     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.request_id,p_old_header_adj_rec.request_id) THEN
1486 
1487         l_result := REQUEST
1488             (p_operation        => l_operation
1489             ,p_record   => l_rowtype_rec
1490             ,x_on_operation_action => l_on_operation_action
1491             );
1492 
1493         IF l_result = OE_PC_GLOBALS.YES THEN
1494             -- set OUT result to CONSTRAINED
1495             x_result := OE_PC_GLOBALS.YES;
1496         END IF;
1497 
1498     END IF;
1499 
1500 
1501     -- BEGIN: CHECK FOR CONSTRAINTS ON DESC FLEXFIELD ATTRIBUTES
1502     -- Bug 2003823:
1503     -- If profile indicates that generic update constraints (e.g. seeded
1504     -- closed order condition) should not be checked for DFF, then
1505     -- set the global to 'N'.
1506     -- Also, store the current value of global in a local variable and
1507     -- re-set it after DFF check. If DFF were the only fields being
1508     -- updated and profile was set to 'N', global at the end should
1509     -- be re-set to 'Y' - this indicates to process order that no
1510     -- constrainable attributes were updated and thus, it would
1511     -- suppress entity level security check also.
1512     IF OE_PC_GLOBALS.G_CHECK_UPDATE_ALL_FOR_DFF = 'N' THEN
1513        l_check_all_cols_constraint := g_check_all_cols_constraint;
1514        g_check_all_cols_constraint := 'N';
1515     END IF;
1516 
1517     IF p_header_adj_rec.context = FND_API.G_MISS_CHAR THEN NULL;
1518     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.context,p_old_header_adj_rec.context) THEN
1519 
1520         l_result := CONTEXT
1521             (p_operation        => l_operation
1522             ,p_record   => l_rowtype_rec
1523             ,x_on_operation_action => l_on_operation_action
1524             );
1525 
1526         IF l_result = OE_PC_GLOBALS.YES THEN
1527             -- set OUT result to CONSTRAINED
1528             x_result := OE_PC_GLOBALS.YES;
1529         END IF;
1530 
1531     END IF;
1532 
1533     IF p_header_adj_rec.attribute1 = FND_API.G_MISS_CHAR THEN NULL;
1534     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute1,p_old_header_adj_rec.attribute1) THEN
1535 
1536         l_result := ATTRIBUTE1
1537             (p_operation        => l_operation
1538             ,p_record   => l_rowtype_rec
1539             ,x_on_operation_action => l_on_operation_action
1540             );
1541 
1542         IF l_result = OE_PC_GLOBALS.YES THEN
1543             -- set OUT result to CONSTRAINED
1544             x_result := OE_PC_GLOBALS.YES;
1545         END IF;
1546 
1547     END IF;
1548 
1549     IF p_header_adj_rec.attribute10 = FND_API.G_MISS_CHAR THEN NULL;
1550     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute10,p_old_header_adj_rec.attribute10) THEN
1551 
1552         l_result := ATTRIBUTE10
1553             (p_operation        => l_operation
1554             ,p_record   => l_rowtype_rec
1555             ,x_on_operation_action => l_on_operation_action
1556             );
1557 
1558         IF l_result = OE_PC_GLOBALS.YES THEN
1559             -- set OUT result to CONSTRAINED
1560             x_result := OE_PC_GLOBALS.YES;
1561         END IF;
1562 
1563     END IF;
1564 
1565     IF p_header_adj_rec.attribute11 = FND_API.G_MISS_CHAR THEN NULL;
1566     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute11,p_old_header_adj_rec.attribute11) THEN
1567 
1568         l_result := ATTRIBUTE11
1569             (p_operation        => l_operation
1570             ,p_record   => l_rowtype_rec
1571             ,x_on_operation_action => l_on_operation_action
1572             );
1573 
1574         IF l_result = OE_PC_GLOBALS.YES THEN
1575             -- set OUT result to CONSTRAINED
1576             x_result := OE_PC_GLOBALS.YES;
1577         END IF;
1578 
1579     END IF;
1580 
1581     IF p_header_adj_rec.attribute12 = FND_API.G_MISS_CHAR THEN NULL;
1582     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute12,p_old_header_adj_rec.attribute12) THEN
1583 
1584         l_result := ATTRIBUTE12
1585             (p_operation        => l_operation
1586             ,p_record   => l_rowtype_rec
1587             ,x_on_operation_action => l_on_operation_action
1588             );
1589 
1590         IF l_result = OE_PC_GLOBALS.YES THEN
1591             -- set OUT result to CONSTRAINED
1592             x_result := OE_PC_GLOBALS.YES;
1593         END IF;
1594 
1595     END IF;
1596 
1597     IF p_header_adj_rec.attribute13 = FND_API.G_MISS_CHAR THEN NULL;
1598     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute13,p_old_header_adj_rec.attribute13) THEN
1599 
1600         l_result := ATTRIBUTE13
1601             (p_operation        => l_operation
1602             ,p_record   => l_rowtype_rec
1603             ,x_on_operation_action => l_on_operation_action
1604             );
1605 
1606         IF l_result = OE_PC_GLOBALS.YES THEN
1607             -- set OUT result to CONSTRAINED
1608             x_result := OE_PC_GLOBALS.YES;
1609         END IF;
1610 
1611     END IF;
1612 
1613     IF p_header_adj_rec.attribute14 = FND_API.G_MISS_CHAR THEN NULL;
1614     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute14,p_old_header_adj_rec.attribute14) THEN
1615 
1616         l_result := ATTRIBUTE14
1617             (p_operation        => l_operation
1618             ,p_record   => l_rowtype_rec
1619             ,x_on_operation_action => l_on_operation_action
1620             );
1621 
1622         IF l_result = OE_PC_GLOBALS.YES THEN
1623             -- set OUT result to CONSTRAINED
1624             x_result := OE_PC_GLOBALS.YES;
1625         END IF;
1626 
1627     END IF;
1628 
1629     IF p_header_adj_rec.attribute15 = FND_API.G_MISS_CHAR THEN NULL;
1630     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute15,p_old_header_adj_rec.attribute15) THEN
1631 
1632         l_result := ATTRIBUTE15
1633             (p_operation        => l_operation
1634             ,p_record   => l_rowtype_rec
1635             ,x_on_operation_action => l_on_operation_action
1636             );
1637 
1638         IF l_result = OE_PC_GLOBALS.YES THEN
1639             -- set OUT result to CONSTRAINED
1640             x_result := OE_PC_GLOBALS.YES;
1641         END IF;
1642 
1643     END IF;
1644 
1645     IF p_header_adj_rec.attribute2 = FND_API.G_MISS_CHAR THEN NULL;
1646     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute2,p_old_header_adj_rec.attribute2) THEN
1647 
1648         l_result := ATTRIBUTE2
1649             (p_operation        => l_operation
1650             ,p_record   => l_rowtype_rec
1651             ,x_on_operation_action => l_on_operation_action
1652             );
1653 
1654         IF l_result = OE_PC_GLOBALS.YES THEN
1655             -- set OUT result to CONSTRAINED
1656             x_result := OE_PC_GLOBALS.YES;
1657         END IF;
1658 
1659     END IF;
1660 
1661     IF p_header_adj_rec.attribute3 = FND_API.G_MISS_CHAR THEN NULL;
1662     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute3,p_old_header_adj_rec.attribute3) THEN
1663 
1664         l_result := ATTRIBUTE3
1665             (p_operation        => l_operation
1666             ,p_record   => l_rowtype_rec
1667             ,x_on_operation_action => l_on_operation_action
1668             );
1669 
1670         IF l_result = OE_PC_GLOBALS.YES THEN
1671             -- set OUT result to CONSTRAINED
1672             x_result := OE_PC_GLOBALS.YES;
1673         END IF;
1674 
1675     END IF;
1676 
1677     IF p_header_adj_rec.attribute4 = FND_API.G_MISS_CHAR THEN NULL;
1678     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute4,p_old_header_adj_rec.attribute4) THEN
1679 
1680         l_result := ATTRIBUTE4
1681             (p_operation        => l_operation
1682             ,p_record   => l_rowtype_rec
1683             ,x_on_operation_action => l_on_operation_action
1684             );
1685 
1686         IF l_result = OE_PC_GLOBALS.YES THEN
1687             -- set OUT result to CONSTRAINED
1688             x_result := OE_PC_GLOBALS.YES;
1689         END IF;
1690 
1691     END IF;
1692 
1693     IF p_header_adj_rec.attribute5 = FND_API.G_MISS_CHAR THEN NULL;
1694     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute5,p_old_header_adj_rec.attribute5) THEN
1695 
1696         l_result := ATTRIBUTE5
1697             (p_operation        => l_operation
1698             ,p_record   => l_rowtype_rec
1699             ,x_on_operation_action => l_on_operation_action
1700             );
1701 
1702         IF l_result = OE_PC_GLOBALS.YES THEN
1703             -- set OUT result to CONSTRAINED
1704             x_result := OE_PC_GLOBALS.YES;
1705         END IF;
1706 
1707     END IF;
1708 
1709     IF p_header_adj_rec.attribute6 = FND_API.G_MISS_CHAR THEN NULL;
1710     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute6,p_old_header_adj_rec.attribute6) THEN
1711 
1712         l_result := ATTRIBUTE6
1713             (p_operation        => l_operation
1714             ,p_record   => l_rowtype_rec
1715             ,x_on_operation_action => l_on_operation_action
1716             );
1717 
1718         IF l_result = OE_PC_GLOBALS.YES THEN
1719             -- set OUT result to CONSTRAINED
1720             x_result := OE_PC_GLOBALS.YES;
1721         END IF;
1722 
1723     END IF;
1724 
1725     IF p_header_adj_rec.attribute7 = FND_API.G_MISS_CHAR THEN NULL;
1726     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute7,p_old_header_adj_rec.attribute7) THEN
1727 
1728         l_result := ATTRIBUTE7
1729             (p_operation        => l_operation
1730             ,p_record   => l_rowtype_rec
1731             ,x_on_operation_action => l_on_operation_action
1732             );
1733 
1734         IF l_result = OE_PC_GLOBALS.YES THEN
1735             -- set OUT result to CONSTRAINED
1736             x_result := OE_PC_GLOBALS.YES;
1737         END IF;
1738 
1739     END IF;
1740 
1741     IF p_header_adj_rec.attribute8 = FND_API.G_MISS_CHAR THEN NULL;
1742     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute8,p_old_header_adj_rec.attribute8) THEN
1743 
1744         l_result := ATTRIBUTE8
1745             (p_operation        => l_operation
1746             ,p_record   => l_rowtype_rec
1747             ,x_on_operation_action => l_on_operation_action
1748             );
1749 
1750         IF l_result = OE_PC_GLOBALS.YES THEN
1751             -- set OUT result to CONSTRAINED
1752             x_result := OE_PC_GLOBALS.YES;
1753         END IF;
1754 
1755     END IF;
1756 
1757     IF p_header_adj_rec.attribute9 = FND_API.G_MISS_CHAR THEN NULL;
1758     ELSIF NOT OE_GLOBALS.EQUAL(p_header_adj_rec.attribute9,p_old_header_adj_rec.attribute9) THEN
1759 
1760         l_result := ATTRIBUTE9
1761             (p_operation        => l_operation
1762             ,p_record   => l_rowtype_rec
1763             ,x_on_operation_action => l_on_operation_action
1764             );
1765 
1766         IF l_result = OE_PC_GLOBALS.YES THEN
1767             -- set OUT result to CONSTRAINED
1768             x_result := OE_PC_GLOBALS.YES;
1769         END IF;
1770 
1771     END IF;
1772 
1773     IF OE_PC_GLOBALS.G_CHECK_UPDATE_ALL_FOR_DFF = 'N' THEN
1774        IF l_debug_level  > 0 THEN
1775            oe_debug_pub.add(  'SETTING CHECK ALL COLS CONSTRAINT TO:'||L_CHECK_ALL_COLS_CONSTRAINT ) ;
1776        END IF;
1777        g_check_all_cols_constraint := l_check_all_cols_constraint;
1778     END IF;
1779 
1780     -- END: CHECK FOR CONSTRAINTS ON DESC FLEXFIELD ATTRIBUTES
1781     -- NOTE: Please add constraints check for new attributes before the
1782     -- descriptive flexfield attributes check.
1783 
1784 IF l_debug_level  > 0 THEN
1785     oe_debug_pub.add(  'EXIT OE_HEADER_ADJ_SECURITY.ATTRIBUTES' , 1 ) ;
1786 END IF;
1787 
1788 EXCEPTION
1789     WHEN FND_API.G_EXC_ERROR THEN
1790     x_return_status := FND_API.G_RET_STS_ERROR;
1791     WHEN OTHERS THEN
1792     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1793     IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1794         OE_MSG_PUB.Add_Exc_Msg
1795         (   G_PKG_NAME
1796         ,   'Attributes'
1797         );
1798     END IF;
1799 
1800 END Attributes;
1801 
1802 END OE_Header_Adj_Security;