DBA Data[Home] [Help]

PACKAGE BODY: APPS.INV_MGD_MVT_STATS_PUB

Source


1 PACKAGE BODY INV_MGD_MVT_STATS_PUB AS
2 -- $Header: INVPMVTB.pls 115.5 2002/12/11 00:46:19 yawang ship $
3 --+=======================================================================+
4 --|               Copyright (c) 1998 Oracle Corporation                   |
5 --|                       Redwood Shores, CA, USA                         |
6 --|                         All rights reserved.                          |
7 --+=======================================================================+
8 --| FILENAME                                                              |
9 --|     INVPMVTB.pls                                                      |
10 --|                                                                       |
11 --| DESCRIPTION                                                           |
12 --|    Body of INV_MGD_MVT_STATS_PUB                                |
13 --|                                                                       |
14 --| PROCEDURE LIST                                                        |
15 --|     Process_Transaction                                               |
16 --|     Create_Movement_Statistics                                        |
17 --|     Reset_Transaction_Status                                            |
18 --|     Validate_Movement_Statistics                                      |
19 --|     Update_Movement_Statistics                                        |
20 --|                                                                       |
21 --| HISTORY                                                               |
22 --|     06/14/00 pseshadr        Created                                  |
23 --|     06/15/00 ksaini          Added Procedures                         |
24 --+======================================================================*/
25 
26 --===================
27 -- CONSTANTS
28 --===================
29 G_PKG_NAME CONSTANT VARCHAR2(30) := 'INV_MGD_MVT_STATS_PUB';
30 
31 --===================
32 -- PUBLIC PROCEDURES
33 --===================
34 --========================================================================
35 -- PROCEDURE : Process_Transaction PUBLIC
36 -- PARAMETERS: p_api_version_number    known api version
37 --             p_init_msg_list         FND_API.G_TRUE to reset list
38 --             x_return_status         return status
39 --             x_msg_count             number of messages in the list
40 --             x_msg_data              message text
41 --             p_legal_entity_id       Legal Entity ID
42 --             p_start_date            Transaction start date
43 --             p_end_date              Transaction end date
44 --             p_source type           Transaction type (SO,PO etc)
45 -- COMMENT   : Public Procedure
46 -- COMMENT   :
47 --             This processes all the transaction for the specified legal
48 --             entity that have a transaction date within the specified
49 --             date range.
50 --========================================================================
51 
52 PROCEDURE Process_Transaction
53 ( p_api_version_number   IN  NUMBER
54 , p_init_msg_list        IN  VARCHAR2 := FND_API.G_FALSE
55 , p_legal_entity_id      IN  NUMBER
56 , p_start_date           IN  DATE
57 , p_end_date             IN  DATE
58 , p_source_type          IN  VARCHAR2
59 , x_return_status        OUT NOCOPY VARCHAR2
60 , x_msg_count            OUT NOCOPY NUMBER
61 , x_msg_data             OUT NOCOPY VARCHAR2
62 )
63 IS
64 l_return_status           VARCHAR2(1);
65 l_api_version_number      NUMBER := 1.0;
66 L_API_NAME                CONSTANT VARCHAR2(30) := 'Process_Transaction';
67 
68 BEGIN
69 
70   --  Standard call to check for call compatibility
71   IF NOT FND_API.Compatible_API_Call
72          ( l_api_version_number
73          , p_api_version_number
74          , L_API_NAME
75          , G_PKG_NAME
76          )
77   THEN
78     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
79   END IF;
80 
81   --  Initialize message stack if required
82   IF FND_API.to_Boolean(p_init_msg_list)
83   THEN
84     FND_MSG_PUB.initialize;
85   END IF;
86 
87   x_return_status := FND_API.G_RET_STS_SUCCESS;
88 
89 -- Call the Private Process Transaction which does the logic for
90 -- Movement Statistics before inserting the record in the
91 -- Movement Statistics table.
92 
93    INV_MGD_MVT_STATS_PROC.PROCESS_TRANSACTION
94    ( p_api_version_number   => l_api_version_number
95    , p_init_msg_list        => FND_API.G_FALSE
96    , p_legal_entity_id      => p_legal_entity_id
97    , p_start_date           => p_start_date
98    , p_end_date             => p_end_date
99    , p_source_type          => p_source_type
100    , x_return_status        => l_return_status
101    , x_msg_count            => x_msg_count
102    , x_msg_data             => x_msg_data
103    );
104 
105   IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
106   THEN
107     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
108   ELSIF l_return_status = FND_API.G_RET_STS_ERROR
109   THEN
110     RAISE FND_API.G_EXC_ERROR;
111   END IF;
112 
113 EXCEPTION
114 
115   WHEN FND_API.G_EXC_ERROR THEN
116     x_return_status := FND_API.G_RET_STS_ERROR;
117 
118     --  Get message count and data
119     FND_MSG_PUB.Count_And_Get
120     ( p_count => x_msg_count
121     , p_data  => x_msg_data
122     );
123   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
124     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
125 
126     --  Get message count and data
127     FND_MSG_PUB.Count_And_Get
128     ( p_count => x_msg_count
129     , p_data  => x_msg_data
130     );
131   WHEN OTHERS THEN
132     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
133 
134     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
135     THEN
136       FND_MSG_PUB.Add_Exc_Msg
137       ( G_PKG_NAME
138       , 'Process_Transaction'
139       );
140      END IF;
141      --  Get message count and data
142      FND_MSG_PUB.Count_And_Get
143      ( p_count => x_msg_count
144      , p_data  => x_msg_data
145      );
146 
147 END Process_Transaction;
148 
149 --========================================================================
150 -- PROCEDURE : Create_Movement_Statistics PUBLIC
151 -- PARAMETERS: p_api_version_number    known api version
152 --             p_init_msg_list         FND_API.G_TRUE to reset list
153 --             x_return_status         return status
154 --             x_msg_count             number of messages in the list
155 --             x_msg_data              message text
156 --             p_movement_transaction  movement transaction data record
157 -- VERSION   : current version         1.0
158 --             initial version         1.0
159 -- COMMENT   : Public Procedure
160 --=======================================================================
161 
162 PROCEDURE Create_Movement_Statistics
163 ( p_api_version_number   IN  NUMBER
164 , p_init_msg_list        IN  VARCHAR2 := FND_API.G_FALSE
165 , p_movement_transaction IN
166     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
167 , x_movement_transaction OUT
168     INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
169 , x_return_status        OUT NOCOPY VARCHAR2
170 , x_msg_count            OUT NOCOPY NUMBER
171 , x_msg_data             OUT NOCOPY VARCHAR2
172 )
173 
174 IS
175 l_return_status       VARCHAR2(1);
176 l_api_version_number  NUMBER := 1.0;
177 L_API_NAME            CONSTANT VARCHAR2(30) := 'Create_Movement_Statistics';
178 l_movement_transaction
179   INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type;
180 
181 BEGIN
182 
183   --  Standard call to check for call compatibility
184   IF NOT FND_API.Compatible_API_Call
185          ( l_api_version_number
186          , p_api_version_number
187          , L_API_NAME
188          , G_PKG_NAME
189          )
190   THEN
191     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
192   END IF;
193 
194   --  Initialize message stack if required
195   IF FND_API.to_Boolean(p_init_msg_list)
196   THEN
197     FND_MSG_PUB.initialize;
198   END IF;
199 
200   x_return_status := FND_API.G_RET_STS_SUCCESS;
201 
202   l_movement_transaction := p_movement_transaction;
203 
204 -- Call the Private package which does the insert in the
205 -- Movement Statistics table.
206 
207   INV_MGD_MVT_STATS_PVT.Create_Movement_Statistics
208   ( p_api_version_number   => l_api_version_number
209   , p_init_msg_list        => FND_API.G_FALSE
210   , x_movement_transaction => l_movement_transaction
211   , x_return_status        => x_return_status
212   , x_msg_count            => x_msg_count
213   , x_msg_data             => x_msg_data
214   );
215 
216   x_movement_transaction := l_movement_transaction;
217 
218   IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
219   THEN
220     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
221   ELSIF l_return_status = FND_API.G_RET_STS_ERROR
222   THEN
223     RAISE FND_API.G_EXC_ERROR;
224   END IF;
225 
226 EXCEPTION
227 
228   WHEN FND_API.G_EXC_ERROR THEN
229     x_return_status := FND_API.G_RET_STS_ERROR;
230 
231     --  Get message count and data
232     FND_MSG_PUB.Count_And_Get
233     ( p_count => x_msg_count
234     , p_data  => x_msg_data
235     );
236   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
237     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
238 
239     --  Get message count and data
240     FND_MSG_PUB.Count_And_Get
241     ( p_count => x_msg_count
242     , p_data  => x_msg_data
243     );
244   WHEN OTHERS THEN
245     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
246 
247     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
248     THEN
249       FND_MSG_PUB.Add_Exc_Msg
250       ( G_PKG_NAME
251       , 'Create_Movement_Statistics'
252       );
253      END IF;
254      --  Get message count and data
255      FND_MSG_PUB.Count_And_Get
256      ( p_count => x_msg_count
257      , p_data  => x_msg_data
258      );
259 END Create_Movement_Statistics;
260 
261 
262 
263 
264 --========================================================================
265 -- PROCEDURE : Reset_Transaction_Status   PUBLIC
266 --
267 -- PARAMETERS: x_return_status      Procedure return status
268 --             x_msg_count          Number of messages in the list
269 --             x_msg_data           Message text
270 --             p_api_version_number Known Version Number
271 --             p_init_msg_list      Empty PL/SQL Table listfor
272 --                                  Initialization
273 --
274 --             p_legal_entity_id    Legal Entity
275 --             p_zone_code          Zonal Code
276 --             p_usage_type         Usage Type
277 --             p_stat_type          Stat Type
278 ----           p_period_name        Period Name for processing
279 --             p_document_source_type Document Source Type
280 --                                    (PO,SO,INV,RMA,RTV)
281 --             p_reset_option       Reset for All, Ignore only or exclude
282 --                                  Ignore record
283 --
284 -- VERSION   : current version         1.0
285 --             initial version         1.0
286 --
287 -- Updated   :  18/Apr/2002
288 -- History   :  yawang add parameter p_reset_option
289 --=======================================================================--
290 
291 PROCEDURE Reset_Transaction_Status
292 ( p_api_version_number   IN  NUMBER
293 , p_init_msg_list        IN  VARCHAR2 := FND_API.G_FALSE
294 , p_legal_entity_id      IN   NUMBER
295 , p_zone_code            IN   VARCHAR2
296 , p_usage_type           IN   VARCHAR2
297 , p_stat_type            IN   VARCHAR2
298 , p_period_name          IN   VARCHAR2
299 , p_document_source_type IN   VARCHAR2
300 , p_reset_option         IN   VARCHAR2
301 , x_return_status        OUT NOCOPY  VARCHAR2
302 , x_msg_count            OUT NOCOPY NUMBER
303 , x_msg_data             OUT NOCOPY VARCHAR2
304 )
305 IS
306 
307  l_api_version_number      NUMBER := 1.0;
308  l_init_msg_list          VARCHAR2(300)   := FND_API.G_FALSE ;
309  l_api_name      CONSTANT VARCHAR2(30)    := 'Reset_Transaction_Status';
310  l_period_name            VARCHAR2(15);
311  l_legal_entity_id        NUMBER;
312  l_zone_code              VARCHAR2(10);
313  l_usage_type             VARCHAR2(30);
314  l_stat_type              VARCHAR2(30);
315  l_document_source_type   VARCHAR2(30);
316  l_reset_option           VARCHAR2(30);
317  l_return_status          VARCHAR2(1);
318 
319 BEGIN
320 
321 --  Standard call to check for call compatibility
322  IF NOT FND_API.Compatible_API_Call
323   ( l_api_version_number
324   , p_api_version_number
325   , L_API_NAME
326   , G_PKG_NAME
327   )
328  THEN
329    RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
330  END IF;
331 
332 --  Initialize message stack if required
333  IF FND_API.to_Boolean(p_init_msg_list)
334  THEN
335    FND_MSG_PUB.initialize;
336  END IF;
337 
338  l_return_status := FND_API.G_RET_STS_SUCCESS;
339 
340 
341 -- Assign the Local Variables
342 
343   l_api_version_number   :=   p_api_version_number ;
344   l_init_msg_list        :=   p_init_msg_list ;
345   l_period_name          :=   p_period_name;
346   l_legal_entity_id      :=   p_legal_entity_id;
347   l_zone_code            :=   p_zone_code ;
348   l_usage_type           :=   p_usage_type;
349   l_stat_type            :=   p_stat_type;
350   l_document_source_type :=   p_document_source_type ;
351   l_reset_option         :=   p_reset_option;
352   x_return_status        :=   l_return_status ;
353 
354 
355 -- Call the Reset_Transaction_Status procedure from the
356 -- INV_MGD_MVT_STATS_PVT package
357 --
358 
359  INV_MGD_MVT_RESET_TRANS.Reset_Transaction_Status
360  ( p_api_version_number   => l_api_version_number
361  , p_init_msg_list        => FND_API.G_FALSE
362  , p_legal_entity_id      => l_legal_entity_id
363  , p_zone_code            => l_zone_code
364  , p_usage_type           => l_stat_type
365  , p_stat_type            => l_stat_type
366  , p_period_name          => l_period_name
367  , p_document_source_type => l_document_source_type
368  , p_reset_option         => l_reset_option
369  , x_return_status        => l_return_status
370  , x_msg_count            => x_msg_count
371  , x_msg_data             => x_msg_data
372  );
373 
374 
375 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
376   THEN
377     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
378   ELSIF l_return_status = FND_API.G_RET_STS_ERROR
379   THEN
380     RAISE FND_API.G_EXC_ERROR;
381   END IF;
382 
383 EXCEPTION
384 
385   WHEN FND_API.G_EXC_ERROR THEN
386     x_return_status := FND_API.G_RET_STS_ERROR;
387 
388     --  Get message count and data
389     FND_MSG_PUB.Count_And_Get
390     ( p_count => x_msg_count
391     , p_data  => x_msg_data
392     );
393   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
394     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
395 
396     --  Get message count and data
397     FND_MSG_PUB.Count_And_Get
398     ( p_count => x_msg_count
399     , p_data  => x_msg_data
400     );
401   WHEN OTHERS THEN
402     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
403 
404     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
405     THEN
406       FND_MSG_PUB.Add_Exc_Msg
407       ( G_PKG_NAME
408       , 'Reset_Transaction_Status'
409       );
410      END IF;
411      --  Get message count and data
412      FND_MSG_PUB.Count_And_Get
413      ( p_count => x_msg_count
414      , p_data  => x_msg_data
415      );
416 
417 END Reset_Transaction_Status ;
418 
419 --========================================================================
420 -- PROCEDURE : Purge_Movement_Transactions   PUBLIC
421 --
422 -- PARAMETERS: x_return_status      Procedure return status
423 --             p_legal_entity_id    Legal Entity
424 --             p_zone_code          Zonal Code
425 --             p_usage_type         Usage Type
426 --             p_stat_type          Stat Type
427 ----           p_period_name        Period Name for processing
428 --             p_document_source_type Document Source Type
429 --                                    (PO,SO,INV,RMA,RTV)
430 --
431 -- VERSION   : current version         1.0
432 --             initial version         1.0
433 --
434 -- COMMENT   : Procedure specification
435 
436 -- Updated   :  09/Jul/2000
437 --=======================================================================--
438 
439 PROCEDURE Purge_Movement_Transactions
440 ( p_api_version_number   IN  NUMBER
441 , p_init_msg_list        IN  VARCHAR2 := FND_API.G_FALSE
442 , p_legal_entity_id      IN   NUMBER
443 , p_zone_code            IN   VARCHAR2
444 , p_usage_type           IN   VARCHAR2
445 , p_stat_type            IN   VARCHAR2
446 , p_period_name          IN   VARCHAR2
447 , p_document_source_type IN   VARCHAR2
448 , x_return_status        OUT NOCOPY  VARCHAR2
449 , x_msg_count            OUT NOCOPY NUMBER
450 , x_msg_data             OUT NOCOPY VARCHAR2
451 )
452 IS
453 
454  l_api_version_number     NUMBER          := 1.0 ;
455  l_init_msg_list          VARCHAR2(300)   := FND_API.G_FALSE ;
456  l_api_name      CONSTANT VARCHAR2(30)    := 'Reset_Transaction_Status';
457  l_period_name            VARCHAR2(15);
458  l_legal_entity_id        NUMBER;
459  l_zone_code              VARCHAR2(10);
460  l_usage_type             VARCHAR2(30);
461  l_stat_type              VARCHAR2(30);
462  l_document_source_type   VARCHAR2(30);
463  l_return_status          VARCHAR2(1);
464 
465 BEGIN
466 
467 --  Standard call to check for call compatibility
468  IF NOT FND_API.Compatible_API_Call
469   ( l_api_version_number
470   , p_api_version_number
471   , L_API_NAME
472   , G_PKG_NAME
473   )
474  THEN
475    RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
476  END IF;
477 
478 --  Initialize message stack if required
479  IF FND_API.to_Boolean(p_init_msg_list)
480  THEN
481    FND_MSG_PUB.initialize;
482  END IF;
483 
484  l_return_status := FND_API.G_RET_STS_SUCCESS;
485 
486 
487 -- Assign the Local Variables
488 
489   l_api_version_number   :=   p_api_version_number ;
490   l_init_msg_list        :=   p_init_msg_list ;
491   l_period_name          :=   p_period_name;
492   l_legal_entity_id      :=   p_legal_entity_id;
493   l_zone_code            :=   p_zone_code ;
494   l_usage_type           :=   p_usage_type;
495   l_stat_type            :=   p_stat_type;
496   l_document_source_type :=   p_document_source_type ;
497   x_return_status        :=   l_return_status ;
498 
499 
500 -- Call the Reset_Transaction_Status procedure from the
501 -- INV_MGD_MVT_STATS_PVT package
502 --
503 
504  INV_MGD_MVT_PURGE_TRANS.Purge_Movement_Transactions
505 ( p_api_version_number   => l_api_version_number
506  , p_init_msg_list        => FND_API.G_FALSE
507  , p_legal_entity_id      => l_legal_entity_id
508  , p_zone_code            => l_zone_code
509  , p_usage_type           => l_stat_type
510  , p_stat_type            => l_stat_type
511  , p_period_name          => l_period_name
512  , p_document_source_type => l_document_source_type
513  , x_return_status        => l_return_status
514  , x_msg_count            => x_msg_count
515  , x_msg_data             => x_msg_data
516  );
517 
518 
519 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
520   THEN
521     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
522   ELSIF l_return_status = FND_API.G_RET_STS_ERROR
523   THEN
524     RAISE FND_API.G_EXC_ERROR;
525   END IF;
526 
527 EXCEPTION
528 
529   WHEN FND_API.G_EXC_ERROR THEN
530     x_return_status := FND_API.G_RET_STS_ERROR;
531 
532     --  Get message count and data
533     FND_MSG_PUB.Count_And_Get
534     ( p_count => x_msg_count
535     , p_data  => x_msg_data
536     );
537   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
538     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
539 
540     --  Get message count and data
541     FND_MSG_PUB.Count_And_Get
542     ( p_count => x_msg_count
543     , p_data  => x_msg_data
544     );
545   WHEN OTHERS THEN
546     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
547 
548     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
549     THEN
550       FND_MSG_PUB.Add_Exc_Msg
551       ( G_PKG_NAME
552       , 'Purge_Movement_Transactions'
553       );
554      END IF;
555      --  Get message count and data
556      FND_MSG_PUB.Count_And_Get
557      ( p_count => x_msg_count
558      , p_data  => x_msg_data
559      );
560 
561 END Purge_Movement_Transactions ;
562 
563 --=============================================================================-
564 -- PROCEDURE : Validate_Movement_Statistics  PUBLIC
565 --
566 -- PARAMETERS:
567 --             p_movement_statistics     Material Movement Statistics transaction
568 --                                       Input data record
569 --             p_movement_stat_usages_rec usage record
570 --             x_excp_list               PL/SQL Table type list for storing
571 --                                       and returning the Exception messages
572 --             x_return_status           Procedure return status
573 --             x_msg_count               Number of messages in the list
574 --             x_msg_data                Message text
575 --             x_movement_statistics     Material Movement Statistics transaction
576 --                                       Output data record
577 --
578 -- VERSION   : current version           1.0
579 --             initial version           1.0
580 --
581 -- COMMENT   :  Procedure specification to Perform the
582 --              Validation for the Movement
583 --             Statistics Record FOR Exceptions
584 --
585 -- CREATED  : 10/20/1999
586 --=============================================================================-
587 PROCEDURE Validate_Movement_Statistics
588  ( p_movement_statistics     IN
589      INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
590  , p_movement_stat_usages_rec IN
591      INV_MGD_MVT_DATA_STR.Movement_Stat_Usages_Rec_Type
592  , x_excp_list                OUT NOCOPY
593      INV_MGD_MVT_DATA_STR.excp_list
594  , x_updated_flag             OUT NOCOPY VARCHAR2
595  , x_return_status            OUT NOCOPY VARCHAR2
596  , x_msg_count                OUT NOCOPY NUMBER
597  , x_msg_data                 OUT NOCOPY VARCHAR2
598  , x_movement_statistics      OUT
599      INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
600  )
601 IS
602 
603 -- local variables
604  l_mtl_movement_statistics
605                    INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type;
606  l_movement_stat_usages_rec
607                    INV_MGD_MVT_DATA_STR.Movement_Stat_Usages_Rec_Type;
608 
609  l_excp_list       INV_MGD_MVT_DATA_STR.excp_list;
610  l_ret_movement_statistics
611                    INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type;
612  l_record_status   VARCHAR2(1);
613  l_return_status   VARCHAR2(1);
614  l_updated_flag    VARCHAR2(1);
615 
616 BEGIN
617 
618  l_return_status := FND_API.G_RET_STS_SUCCESS;
619 
620  INV_MGD_MVT_STATS_PVT.Validate_Movement_Statistics
621     ( p_movement_statistics      => p_movement_statistics
622     , p_movement_stat_usages_rec => p_movement_stat_usages_rec
623     , x_return_status            => l_return_status
624     , x_updated_flag             => x_updated_flag
625     , x_msg_count                => x_msg_count
626     , x_msg_data                 => x_msg_data
627     , x_excp_list                => l_excp_list
628     , x_movement_statistics      => l_ret_movement_statistics
629     );
630 
631 x_movement_statistics := l_ret_movement_statistics;
632 
633 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
634   THEN
635     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
636   ELSIF x_return_status = FND_API.G_RET_STS_ERROR
637   THEN
638     RAISE FND_API.G_EXC_ERROR;
639   END IF;
640 
641 EXCEPTION
642 
643   WHEN FND_API.G_EXC_ERROR THEN
644     l_return_status := FND_API.G_RET_STS_ERROR;
645 
646     --  Get message count and data
647     FND_MSG_PUB.Count_And_Get
648     ( p_count => x_msg_count
649     , p_data  => x_msg_data
650     );
651   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
652     l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
653 
654     --  Get message count and data
655     FND_MSG_PUB.Count_And_Get
656     ( p_count => x_msg_count
657     , p_data  => x_msg_data
658     );
659   WHEN OTHERS THEN
660     l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
661 
662     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
663     THEN
664       FND_MSG_PUB.Add_Exc_Msg
665       ( G_PKG_NAME
666       , 'Validate_Movement_Statistics'
667       );
668      END IF;
669      --  Get message count and data
670      FND_MSG_PUB.Count_And_Get
671      ( p_count => x_msg_count
672      , p_data  => x_msg_data
673      );
674 
675 END Validate_Movement_Statistics;
676 
677 
678 --========================================================================
679 -- PROCEDURE : Update_Movement_Statistics   PUBLIC
680 --
681 -- PARAMETERS: x_return_status      Procedure return status
682 --             x_msg_count          Number of messages in the list
683 --             x_msg_data           Message text
684 --             p_movement_statistics  Material Movement Statistics transaction
685 --                                  Input data record
686 --
687 -- COMMENT   : Procedure body to Update the Movement
688 --             Statistics record with the
689 --             calculated values ( EX: Invoice information, Status etc ).
690 -- Updated   : 09/Jul/1999
691 --=======================================================================--
692 
693 PROCEDURE Update_Movement_Statistics (
694   p_movement_statistics  IN
695   INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
696 , x_return_status                OUT NOCOPY    VARCHAR2
697 , x_msg_count                    OUT NOCOPY    NUMBER
698 , x_msg_data                     OUT NOCOPY    VARCHAR2
699 )
700 IS
701 
702   l_ret_movement_statistics
703                    INV_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type;
704   l_return_status      VARCHAR2(1);
705   l_msg_count          NUMBER;
706   l_msg_data           VARCHAR2(100);
707 
708 BEGIN
709 
710 
711   x_return_status := FND_API.G_RET_STS_SUCCESS;
712 
713 INV_MGD_MVT_STATS_PVT.Update_Movement_Statistics
714                ( p_movement_statistics => l_ret_movement_statistics
715                , x_return_status   => l_return_status
716                , x_msg_count  => l_msg_count
717                , x_msg_data   => l_msg_data
718                );
719 
720 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR
721   THEN
722     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
723   ELSIF l_return_status = FND_API.G_RET_STS_ERROR
724   THEN
725     RAISE FND_API.G_EXC_ERROR;
726   END IF;
727 
728 EXCEPTION
729 
730   WHEN FND_API.G_EXC_ERROR THEN
731     l_return_status := FND_API.G_RET_STS_ERROR;
732 
733     --  Get message count and data
734     FND_MSG_PUB.Count_And_Get
735     ( p_count => x_msg_count
736     , p_data  => x_msg_data
737     );
738   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
739     l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
740 
741     --  Get message count and data
742     FND_MSG_PUB.Count_And_Get
743     ( p_count => x_msg_count
744     , p_data  => x_msg_data
745     );
746   WHEN OTHERS THEN
747     l_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
748 
749     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
750     THEN
751       FND_MSG_PUB.Add_Exc_Msg
752       ( G_PKG_NAME
753       , 'Update_Movement_Statistics'
754       );
755      END IF;
756      --  Get message count and data
757      FND_MSG_PUB.Count_And_Get
758      ( p_count => x_msg_count
759      , p_data  => x_msg_data
760      );
761   END Update_Movement_Statistics;
762 
763 
764 END INV_MGD_MVT_STATS_PUB;