DBA Data[Home] [Help]

PACKAGE BODY: APPS.JMF_INTERLOCK_SHIKYU_CP

Source


1 PACKAGE BODY JMF_INTERLOCK_SHIKYU_CP AS
2 -- $Header: JMFCSHKB.pls 120.3.12020000.2 2012/07/26 08:53:20 abhissri ship $
3 --+=======================================================================+
4 --|               Copyright (c) 2005 Oracle Corporation                   |
5 --|                       Redwood Shores, CA, USA                         |
6 --|                         All rights reserved.                          |
7 --+=======================================================================+
8 --| FILENAME                                                              |
9 --|     JMFCSHKB.pls                                                      |
10 --|                                                                       |
11 --| DESCRIPTION                                                           |
12 --|     Interlock SHIKYU Concurrent Program wrapper                       |
13 --| HISTORY                                                               |
14 --|     04/26/2005 pseshadr       Created                                 |
15 --|     07/05/2005 rajkrish       Updated MOAC                            |
16 --|     07/08/2005 vchu           Fixed GSCC error File.Pkg.21            |
17 --+======================================================================--
18 
19 G_PKG_NAME CONSTANT    VARCHAR2(30) := 'JMF_Interlock_Shikyu_CP';
20 g_log_enabled          BOOLEAN;
21 
22 --=============================================
23 -- PROCEDURES AND FUNCTIONS
24 --=============================================
25 
26 --========================================================================
27 -- PROCEDURE : Interlock_SHIKYU_Manager     PUBLIC
28 -- PARAMETERS: x_retcode            OUT NOCOPY Return status
29 --             x_errbuff            OUT NOCOPY Return error message
30 --             p_batch_size         IN    Size of a batch
31 --             p_max_workers        IN    Number of workers allowed
32 --             p_operating_unit     IN    Operating Unit
33 --             p_from_organization  IN    From Organization
34 --             p_to_organization    IN    To Organization
35 --             p_from_po_number     IN    From PO Number
36 --             p_to_po_number       IN    To PO Number
37 --             p_days_in_advance    IN    Number of days in advance
38 -- COMMENT   : This is the concurrent program wrapper for the Interlock
39 --             SHIKYU Manager.This will invoke the JMF_Subcontract_Orders Private
40 --             package to load the subcontract orders and assign records to batches.
41 --=========================================================================
42 PROCEDURE Interlock_SHIKYU_Manager
43 ( x_retcode            OUT NOCOPY VARCHAR2
44 , x_errbuff            OUT NOCOPY VARCHAR2
45 , p_batch_size         IN  NUMBER
46 , p_max_workers        IN  NUMBER
47 , p_from_organization  IN  NUMBER
48 , p_to_organization    IN  NUMBER
49 --ER#9775673: New parameters
50 , p_from_po_number     IN  VARCHAR
51 , p_to_po_number       IN  VARCHAR
52 , p_days_in_advance    IN  NUMBER
53 )
54 IS
55  l_program CONSTANT VARCHAR2(30) := 'Interlock_Shikyu_Manager';
56  l_OU_id   NUMBER ;
57 
58 BEGIN
59 
60   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
61     g_log_enabled := TRUE;
62     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
63                   , G_PKG_NAME
64                   , '>> '||l_program||'Start >>'
65                   );
66   END IF;
67 
68   l_OU_ID := MO_GLOBAL.get_current_org_id ;
69 
70   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
71     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
72                   , G_PKG_NAME
73                   , 'l_OU_ID => '|| l_OU_ID
74                   );
75   END IF;
76 
77   --ER#9775673: Debug messages
78   if g_log_enabled then
79     fnd_file.put_line(fnd_file.LOG, 'Starting the Interlock Manager');
80     fnd_file.put_line(fnd_file.LOG, '==========Parameters being passed:===========');
81     fnd_file.put_line(fnd_file.LOG, 'p_batch_size => ' || p_batch_size);
82     fnd_file.put_line(fnd_file.LOG, 'p_max_workers => ' || p_max_workers);
83     fnd_file.put_line(fnd_file.LOG, 'p_from_organization => ' || p_from_organization);
84     fnd_file.put_line(fnd_file.LOG, 'p_to_organization => ' || p_to_organization);
85     fnd_file.put_line(fnd_file.LOG, 'p_from_po_number => ' || p_from_po_number);
86     fnd_file.put_line(fnd_file.LOG, 'p_to_po_number => ' || p_to_po_number);
87     fnd_file.put_line(fnd_file.LOG, 'p_days_in_advance => ' || p_days_in_advance);
88     fnd_file.put_line(fnd_file.LOG, 'l_OU_ID => ' || l_OU_ID);
89     fnd_file.put_line(fnd_file.LOG, '==============================================');
90   end if;
91 
92   JMF_SUBCONTRACT_ORDERS_PVT.Subcontract_Orders_Manager
93   ( p_batch_size         => p_batch_size
94   , p_max_workers        => p_max_workers
95   , p_operating_unit     => l_ou_id
96   , p_from_organization  => p_from_organization
97   , p_to_organization    => p_to_organization
98   --ER#9775673: Passing the new parameters
99   , p_from_po_number     => p_from_po_number
100   , p_to_po_number       => p_to_po_number
101   , p_days_in_advance    => p_days_in_advance
102   , p_init_msg_list      => FND_API.G_TRUE
103   , p_validation_level   => FND_API.G_VALID_LEVEL_FULL
104   );
105 
106   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
107     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
108                   , G_PKG_NAME
109                   , '  Subcontract_Orders_Manager '
110                   );
111   END IF;
112 
113   IF g_log_enabled
114   THEN
115   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
116     FND_LOG.string( FND_LOG.LEVEL_PROCEDURE
117                   , G_PKG_NAME ||l_program
118                   , 'Exit'
119                   ) ;
120   END IF;
121   END IF;
122 
123 EXCEPTION
124 
125   WHEN OTHERS THEN
126     x_retcode := 2;
127     x_errbuff := SUBSTRB(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE)
128                         ,1
129                         ,250);
130 
131 END Interlock_SHIKYU_Manager;
132 
133 --========================================================================
134 -- PROCEDURE : Interlock_SHIKYU_Worker     PUBLIC
135 -- PARAMETERS: x_retcode            OUT NOCOPY  Return status
136 --             x_errbuff            OUT NOCOPY  Return error message
137 --             p_batch_id           IN    Batch identifier
138 -- COMMENT   : This procedure will process all the records in the batch
139 --=========================================================================
140 PROCEDURE Interlock_SHIKYU_Worker
141 ( x_retcode            OUT NOCOPY VARCHAR2
142 , x_errbuff            OUT NOCOPY VARCHAR2
143 , p_batch_id           IN  NUMBER
144 )
145 IS
146  l_program CONSTANT VARCHAR2(30) := 'Interlock_Shikyu_Worker';
147 
148 BEGIN
149   IF g_log_enabled
150   THEN
151   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
152     FND_LOG.string( FND_LOG.LEVEL_PROCEDURE
153                   , G_PKG_NAME ||l_program
154                   , 'Entry'
155                   ) ;
156   END IF;
157   END IF;
158 
159   JMF_SUBCONTRACT_ORDERS_PVT.Subcontract_Orders_Worker
160   ( p_batch_id  => p_batch_id
161   );
162 
163   IF g_log_enabled
164   THEN
165     IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
166     FND_LOG.string( FND_LOG.LEVEL_PROCEDURE
167                   , G_PKG_NAME ||l_program
168                   , 'Exit'
169                   ) ;
170   END IF;
171   END IF;
172 
173 EXCEPTION
174 
175   WHEN OTHERS THEN
176     x_retcode := 2;
177     x_errbuff := SUBSTRB(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE)
178                         ,1
179                         ,250);
180 
181 
182 END Interlock_SHIKYU_Worker;
183 
184 --========================================================================
185 -- PROCEDURE :Run_SHIKYU_reconciliation     PUBLIC
186 -- PARAMETERS:
187 --             x_retcode            OUT NOCOPY Return status
188 --             x_errbuff            OUT NOCOPY Return error message
189 --             p_operating_unit         IN    Operating Unit
190 --             p_from_organization   IN    From Organization
191 --             p_to_organization       IN    To Organization
192 -- COMMENT   : This is the concurrent program wrapper for the SHIKYU
193 --                            reconciliation process
194 --=========================================================================
195 
196 PROCEDURE Run_SHIKYU_reconciliation
197 ( x_retcode                     OUT NOCOPY VARCHAR2
198 , x_errbuff                     OUT NOCOPY VARCHAR2
199 , p_from_organization           IN  NUMBER
200 , p_to_organization             IN  NUMBER
201 )
202 IS
203 
204 l_return_status VARCHAR2(1) ;
205 l_msg_count      NUMBER ;
206 l_msg_data       VARCHAR2(3000) ;
207 l_OU_ID          NUMBER ;
208 BEGIN
209 
210   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
211   THEN
212     g_log_enabled := TRUE;
213     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
214                  , G_PKG_NAME ||
215             'Run_SHIKYU_reconciliation.invoked'
216                  , 'Entry' ) ;
217   END IF;
218 
219  l_OU_ID   := MO_GLOBAL.get_current_org_id ;
220 
221   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
222   THEN
223     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
224                  , G_PKG_NAME ,
225             'l_OU_ID => '|| l_OU_ID
226                   ) ;
227   END IF;
228 
229    JMF_SHIKYU_RECONCILIAITON_PVT.Process_SHIKYU_Reconciliation
230   ( p_api_version              => 1.0
231   , p_init_msg_list            => NULL
232   , p_commit                   => NULL
233   , p_validation_level         => NULL
234   , x_return_status            => l_return_status
235   , x_msg_count                => l_msg_count
236   , x_msg_data                 => l_msg_data
237   , P_Operating_unit           => l_OU_ID
238   , p_from_organization        => p_from_organization
239   , p_to_organization         => p_to_organization
240   ) ;
241 
242 
243   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
244   THEN
245     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
246                  , G_PKG_NAME || 'Run_SHIKYU_reconciliation'
247                  , 'Returned from Process_SHIKYU_Reconciliation. Status:' || l_return_status
248                   ) ;
249   END IF;
250 
251   if l_return_status <> FND_API.G_RET_STS_SUCCESS
252   then
253     if FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL
254     then
255       FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
256                    , G_PKG_NAME || 'Run_SHIKYU_reconciliation'
257                    , 'Process_SHIKYU_Reconciliation returned::' || l_return_status);
258 
259       x_retcode := 1;
260     end if;
261   else
262     if FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL
263     then
264       FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
265                    , G_PKG_NAME || 'Run_SHIKYU_reconciliation'
266                    , 'Process_SHIKYU_Reconciliation returned::' || l_return_status);
267     end if;
268   end if;
269 
270   IF g_log_enabled
271   THEN
272    IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
273     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
274                  , G_PKG_NAME || 'Run_SHIKYU_reconciliation'
275                  , 'Exit' ) ;
276   END IF;
277   END IF;
278 
279 EXCEPTION
280 
281  WHEN OTHERS THEN
282    x_retcode := 2;
283    x_errbuff := SUBSTRB(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE)
284                        ,1
285                        ,250);
286 
287 END Run_SHIKYU_reconciliation ;
288 
289 END JMF_Interlock_SHIKYU_CP;