DBA Data[Home] [Help]

PACKAGE: APPS.CST_MGD_LIFO_COST_PROCESSOR

Source


1 PACKAGE CST_MGD_LIFO_COST_PROCESSOR AUTHID CURRENT_USER AS
2 --$Header: CSTGLCPS.pls 120.1 2005/07/07 12:28:44 vjavli noship $
3 --+=======================================================================+
4 --|               Copyright (c) 2001 Oracle Corporation                   |
5 --|                       Redwood Shores, CA, USA                         |
6 --|                         All rights reserved.                          |
7 --+=======================================================================+
8 --| FILENAME                                                              |
9 --|    CSTGLCPS.pls                                                       |
10 --|                                                                       |
11 --| DESCRIPTION                                                           |
12 --|     Incremental Lifo Cost Processor                                   |
13 --|                                                                       |
14 --| HISTORY                                                               |
15 --|     1/29/99      DHerring   Created                                   |
16 --|     2/1/99       DHerring   Compiled                                  |
17 --|     2/3/99       DHerring   Tested                                    |
18 --|     2/5/99       DHerring   Re-Formatted to meet MGD standards        |
19 --|     3/4/99       DHerring   Incorporated feedback from code review    |
20 --|     7/9/99       Dherring   Added procedure CSTGILEV_TEMP             |
21 --|     1/29/01      AFerrara   Added procedure get_pac_id                |
22 --|     			Added procedure check_quantity		  |
23 --|     04/13/2001   Vjavli     Created procedure lifo_purge for the      |
24 --|                             purge functionality                       |
25 --|     04/25/2001   vjavli     order of the parameters modified to       |
26 --|                             the procedure lifo_purge                  |
27 --|     12/04/2002   Fdubois    add NOCOPY for OU parameters              |
28 --|     11/22/2004   vjavli     Logging as per the standards              |
29 --|     07/08/2005   vjavli     declared variables as per the old stds    |
30 --+======================================================================*/
31 
32 --===================
33 -- GLOBAL CONSTANTS
34 --===================
35 G_LOG_ERROR                  CONSTANT NUMBER := 5;
36 G_LOG_EXCEPTION              CONSTANT NUMBER := 4;
37 G_LOG_EVENT                  CONSTANT NUMBER := 3;
38 G_LOG_PROCEDURE              CONSTANT NUMBER := 2;
39 G_LOG_STATEMENT              CONSTANT NUMBER := 1;
40 
41 --===============================================
42 -- CONSTANTS for concurrent program return values
43 --===============================================
44 -- Return values for RETCODE parameter (standard for concurrent programs):
45 RETCODE_SUCCESS                         VARCHAR2(10)    := '0';
46 RETCODE_WARNING                         VARCHAR2(10)    := '1';
47 RETCODE_ERROR                           VARCHAR2(10)    := '2';
48 
49 --=========================
50 -- PROCEDURES AND FUNCTIONS
51 --=========================
52 
53 --=========================================================================
54 -- PROCEDURE  : lifo_cost_processor            PUBLIC
55 -- PARAMETERS : p_pac_period_id                period id
56 --            : p_cost_group_id                cost group id
57 --            : p_cost_type_id                 cost type id
58 --            : p_user_id                      user id
59 --            : p_login_id                     login id
60 --            : p_req_id                       requisition id
61 --            : p_prg_id                       prg id
62 --            : p_prg_appl_id                  prg appl id
63 --            : x_err_num                      error number
64 --            : x_err_code                     error code
65 --            : x_err_msg                      error message
66 -- COMMENT    : Gateway procedure to the three procedures that calcualate
67 --              incremental LIFO. Called from the pac worker after
68 --              transactional processing and loops through all inventory
69 --              items for a particular period.
70 -- PRE-COND   : The weighted average cost recorded in CST_PAC_ITEM_COSTS
71 --              for the period must be solely for items bought or made in
72 --              that period.
73 --=========================================================================
74 PROCEDURE lifo_cost_processor
75 ( p_pac_period_id  IN  NUMBER
76 , p_cost_group_id  IN  NUMBER
77 , p_cost_type_id   IN  NUMBER
78 , p_user_id        IN  NUMBER
79 , p_login_id       IN  NUMBER
80 , p_req_id         IN  NUMBER
81 , p_prg_id         IN  NUMBER
82 , p_prg_appl_id    IN  NUMBER
83 , x_retcode        OUT NOCOPY NUMBER
84 , x_errbuff        OUT NOCOPY VARCHAR2
85 , x_errcode        OUT NOCOPY VARCHAR2
86 );
87 
88 --=========================================================================
89 -- PROCEDURE  : populate_temp_table            PUBLIC
90 -- PARAMETERS : p_legal_entity                 legal entity
91 --            : p_pac_period_id                period id
92 --            : p_cost_group_id                cost group id
93 --            : p_cost_type_id                 cost type id
94 --            : p_item_code_from               beginning of item range
95 --            : p_item_code_to                 end of item range
96 --            : x_retcode                      0 success, 1 warning, 2 error
97 --            : x_errbuff                      error buffer
98 -- COMMENT    : This Procedure first decides whether to populate
99 --              the temporary table CSTGILEV_TEMP with summarized
100 --              or detailed information. The appropriate procedure is then
101 --              called.
102 -- PRE-COND   : The procedure is called from a before report trigger in
103 --              the incremental LIFO evaluation report. The cost processor
104 --              has already run.
105 --=========================================================================
106 PROCEDURE populate_temp_table
107 ( p_legal_entity_id   IN  NUMBER
108 , p_pac_period_id     IN  NUMBER
109 , p_cost_group_id     IN  NUMBER
110 , p_cost_type_id      IN  NUMBER
111 , p_detailed_report   IN  VARCHAR2
112 , p_item_code_from    IN  VARCHAR2
113 , p_item_code_to      IN  VARCHAR2
114 , x_retcode           OUT NOCOPY NUMBER
115 , x_errbuff           OUT NOCOPY VARCHAR2
116 , x_errcode           OUT NOCOPY VARCHAR2
117 );
118 
119 
120 --=========================================================================
121 -- PROCEDURE  : get_period_id		       PUBLIC
122 -- PARAMETERS : p_interface_id                 interface id
123 -- 	      : p_legal_entity                 legal entity
124 --            : p_cost_type_id                 cost type id
125 --            : p_pac_period_id                period id
126 --            : p_err_num		       end of item range
127 --            : p_err_code                     0 success, 1 warning, 2 error
128 --            : p_err_msg                      error buffer
129 -- COMMENT    : This procedere gets the period id to manage
130 --              the LIFO loading layer utility
131 -- PRE-COND   :
132 --=========================================================================
133 PROCEDURE get_pac_id
134 ( p_interface_header_id   IN      NUMBER
135 , p_legal_entity          IN      NUMBER
136 , p_cost_type_id          IN      NUMBER
137 , p_pac_period_id         OUT     NOCOPY NUMBER
138 , p_err_num               OUT     NOCOPY NUMBER
139 , p_err_code              OUT     NOCOPY VARCHAR2
140 , p_err_msg               OUT     NOCOPY VARCHAR2
141 );
142 
143 
144 
145 --=========================================================================
146 -- PROCEDURE  : check_quantity		     PUBLIC
147 -- PARAMETERS : p_interface_group_id         interface id
148 --            : p_err_num		     end of item range
149 --            : p_err_code                   0 success, 1 warning, 2 error
150 --            : p_err_msg                    error buffer
151 -- COMMENT    : This procedere check if layer quantity of period n is equal
152 --              to begin layer quantity of period n+1 for the LIFO loading layer
153 -- PRE-COND   :
154 --=========================================================================
155 PROCEDURE check_quantity
156 ( p_interface_group_id   IN      NUMBER
157 , p_err_num              OUT     NOCOPY NUMBER
158 , p_err_code             OUT     NOCOPY VARCHAR2
159 , p_err_msg              OUT     NOCOPY VARCHAR2
160 );
161 
162 --=========================================================================
163 -- PROCEDURE  : loading_lifo_cost               PUBLIC
164 -- PARAMETERS : p_interface_header_id        interface unique id
165 --            : p_user_id                    user id
166 --            : p_login_id                   login id
167 --            : p_req_id                     req_id
168 --            : p_prg_id                     prg_id
169 --            : p_prg_appl_id                prg_appl_id
170 --            : x_err_num                    end of item range
171 --            : x_err_code                   0 success, 1 warning, 2 error
172 --            : x_err_msg                    error buffer
173 -- COMMENT    : This procedure reads cost group, period id, item id from
174 --              the interface header table and uses them as input to
175 --              the standard procedure that calculates lifo.
176 -- PRE-COND   :
177 --=========================================================================
178 PROCEDURE loading_lifo_cost
179 (p_interface_group_id    IN      NUMBER
180 ,p_user_id               IN      NUMBER
181 ,p_login_id              IN      NUMBER
182 ,p_req_id                IN      NUMBER
183 ,p_prg_id                IN      NUMBER
184 ,p_prg_appl_id           IN      NUMBER
185 ,x_err_num               OUT     NOCOPY NUMBER
186 ,x_err_code              OUT     NOCOPY VARCHAR2
187 ,x_err_msg               OUT     NOCOPY VARCHAR2
188 );
189 
190 --=========================================================================
191 -- PROCEDURE  : lifo_purge                     PUBLIC
192 -- PARAMETERS : x_errbuff                      error buffer
193 --            : x_retcode                      0 success, 1 warning, 2 error
194 --            : p_legal_entity_id              legal entity
195 --            : p_cost_group_id                cost group id
196 --            : p_cost_type_id                 cost type id
197 --            : p_pac_period_id                period id
198 --            : p_category_set_name            Item category set name
199 --            : p_category_struct              Category Structure used by
200 --                                             category pair
201 --            : p_category_from                begining of item category
202 --                                             range
203 --            : p_category_to                  end of item category range
204 --            : p_item_from                    beginning of item range
205 --            : p_item_to                      end of item range
206 -- COMMENT    : This Procedure purges the historical LIFO layers as per the
207 --              purge algorithm.  This procedure will invoke the private
208 --              procedures find_first_period and selective_purge
209 --=========================================================================
210 PROCEDURE lifo_purge
211 (x_errbuff           OUT NOCOPY VARCHAR2
212 ,x_retcode           OUT NOCOPY VARCHAR2
213 ,p_legal_entity_id   IN  NUMBER
214 ,p_cost_group_id     IN  NUMBER
215 ,p_cost_type_id      IN  NUMBER
216 ,p_pac_period_id     IN  NUMBER
217 ,p_category_set_name IN  VARCHAR2
218 ,p_category_struct   IN  NUMBER
219 ,p_category_from     IN  VARCHAR2
220 ,p_category_to       IN  VARCHAR2
221 ,p_item_from         IN  VARCHAR2
222 ,p_item_to           IN  VARCHAR2
223 );
224 
225 END CST_MGD_LIFO_COST_PROCESSOR;