[Home] [Help]
PACKAGE BODY: APPS.INV_MGD_PERIOD_CONTROL_CP
Source
1 PACKAGE BODY INV_MGD_PERIOD_CONTROL_CP AS
2 /* $Header: INVCPOPB.pls 120.1 2006/03/09 03:54:51 vmutyala noship $ */
3 --+=======================================================================+
4 --| Copyright (c) 2000 Oracle Corporation |
5 --| Redwood Shores, CA, USA |
6 --| All rights reserved. |
7 --+=======================================================================+
8 --| FILENAME |
9 --| INVCPCLB.pls |
10 --| |
11 --| DESCRIPTION |
12 --| Spec of INV_MGD_OPEN_PERIODS_CP |
13 --| |
14 --| HISTORY |
15 --| 26-Sep-2000 rajkrish Created |
16 --| 12-DEc-2000 rajkrish Updated Hierarchy Origin |
17 --| 12/05/2001 vjavli Updated with new apis for performance |
18 --| improvement |
19 --| 11/21/2002 vma Change code to print to log only when |
20 --| debug profile option is enabled |
21 --| 03-FEB-2004 nkamaraj x_errbuff and x_retcode should be in order |
22 --| according to AOL standards inorder to |
23 --| display warning and error messages. |
24 --| Otherwise, conc. manager will consider as |
25 --| completed normal eventhough exception raised|
26 --| 04/08/2004 nesoni Bug 3555234. Error/Exceptions should be |
27 --| logged irrespective of FND Debug Enabled |
28 --| profile option. |
29 --+======================================================================*/
30
31
32 --===============================================
33 -- CONSTANTS for concurrent program return values
34 --===============================================
35 -- Return values for RETCODE parameter (standard for concurrent programs)
36
37 G_PKG_NAME CONSTANT VARCHAR2(30) := 'INV_MGD_PERIOD_CONTROL_CP';
38 g_log_level NUMBER := NULL;
39 g_log_mode VARCHAR2(3) := 'OFF'; -- possible values: OFF,SQL,SRS
40
41 --===============================================
42 -- GLOBAL VARIABLES
43 --===============================================
44 G_DEBUG VARCHAR2(1) := NVL(fnd_profile.value('AFLOG_ENABLED'), 'N');
45
46 --=========================
47 -- PROCEDURES AND FUNCTIONS
48 --=========================
49
50 --========================================================================
51 -- PROCEDURE : Run_Open_Periods PUBLIC
52 -- PARAMETERS: x_retcode return status
53 -- x_errbuf return error messages
54 -- p_org_hierarchy_origin IN NUMBER
55 -- p_org_hierarchy_id IN NUMBER
56 -- p_close_period_name IN VARCHAR2
57 -- p_open_period_count IN NUMBER
58 -- p_open_or_close_flag IN VARCHAR2
59 -- p_requests_count IN NUMBER
60 --
61 -- COMMENT : The concurrent program to Open / Close periods for
62 -- each organization in
63 -- organization hierarchy level list.
64
65 --=========================================================================
66 PROCEDURE Run_Period_Control
67 ( x_errbuf OUT NOCOPY VARCHAR2
68 , x_retcode OUT NOCOPY VARCHAR2
69 , p_org_hierarchy_origin IN NUMBER
70 , p_org_hierarchy_id IN NUMBER
71 , p_close_period_name IN VARCHAR2
72 , p_close_if_res_recmd IN VARCHAR2
73 , p_open_period_count IN NUMBER
74 , p_open_or_close_flag IN VARCHAR2
75 , p_requests_count IN NUMBER
76 )
77 IS
78
79 BEGIN
80
81 IF G_DEBUG = 'Y' THEN
82 INV_ORGHIERARCHY_PVT.Log
83 (INV_ORGHIERARCHY_PVT.G_LOG_PROCEDURE
84 ,'> INV_MGD_OPEN_PERIODS_CP.Run_Period_Control '
85 );
86 END IF;
87
88 FND_PROFILE.Put('AFLOG_LEVEL', '1');
89 -- initialize log
90 IF G_DEBUG = 'Y' THEN
91 INV_ORGHIERARCHY_PVT.Log_Initialize;
92 END IF;
93
94 -- initialize the message stack
95 FND_MSG_PUB.Initialize;
96
97 IF G_DEBUG = 'Y' THEN
98 INV_ORGHIERARCHY_PVT.Log
99 (INV_ORGHIERARCHY_PVT.G_LOG_STATEMENT
100 ,' Calling INV_MGD_PRD_CONTROL_MEDIATOR.Period_Control for '||
101 p_open_or_close_flag
102 );
103 END IF;
104
105 INV_MGD_PRD_CONTROL_MEDIATOR.Period_Control
106 ( x_retcode => x_retcode
107 , x_errbuff => x_errbuf
108 , p_org_hierarchy_origin => p_org_hierarchy_origin
109 , p_org_hierarchy_id => p_org_hierarchy_id
110 , p_close_period_name => p_close_period_name
111 , p_close_if_res_recmd => p_close_if_res_recmd
112 , p_open_period_count => p_open_period_count
113 , p_open_or_close_flag => p_open_or_close_flag
114 , p_requests_count => p_requests_count
115 );
116
117 IF G_DEBUG = 'Y' THEN
118 INV_ORGHIERARCHY_PVT.Log
119 (INV_ORGHIERARCHY_PVT.G_LOG_STATEMENT
120 ,' Out of Period_Control '
121 );
122 END IF;
123
124 -- SRS success
125 -- x_errbuf := NULL;
126 -- x_retcode := 0 ;
127
128 IF G_DEBUG = 'Y' THEN
129 INV_ORGHIERARCHY_PVT.Log
130 (INV_ORGHIERARCHY_PVT.G_LOG_PROCEDURE
131 ,'< INV_MGD_OPEN_PERIODS_CP.Run_Period_Control '
132 );
133 END IF;
134
135 EXCEPTION
136 WHEN OTHERS THEN
137 /* This executable is used by concurrent program so
138 Error/Exception logging should not depend on
139 FND Debug Enabled profile otpion. Bug: 3555234
140 IF G_DEBUG = 'Y' THEN
141 */
142 INV_ORGHIERARCHY_PVT.Log( INV_ORGHIERARCHY_PVT.G_LOG_EXCEPTION
143 , 'SQLERRM '|| SQLERRM) ;
144 --END IF;
145 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
146 THEN
147 FND_MSG_PUB.Add_Exc_Msg
148 ( G_PKG_NAME
149 , ' Run_Period_Control '
150 );
151 END IF;
152
153 x_retcode := '2' ;
154 x_errbuf := SUBSTRB(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE),1,255);
155 ROLLBACK;
156 RAISE;
157
158 END Run_Period_Control ;
159
160
161 END INV_MGD_PERIOD_CONTROL_CP ;
162