DBA Data[Home] [Help]

PACKAGE BODY: APPS.INV_MGD_MVT_DEF_ATTR

Source


1 PACKAGE BODY INV_MGD_MVT_DEF_ATTR AS
2 /* $Header: INVDEFSB.pls 120.0 2005/05/25 05:22:47 appldev noship $ */
3 --+=======================================================================+
4 --|               Copyright (c) 1998 Oracle Corporation                   |
5 --|                       Redwood Shores, CA, USA                         |
6 --|                         All rights reserved.                          |
7 --+=======================================================================+
8 --| FILENAME                                                              |
9 --|    INVDEFSB.pls                                                       |
10 --|                                                                       |
11 --| DESCRIPTION                                                           |
12 --|     Spec. of INV_MGD_MVT_DEF_ATTR                                     |
13 --|                                                                       |
14 --| PROCEDURE LIST                                                        |
15 --|     Default_Attr                                                      |
16 --| HISTORY                                                               |
17 --|     05/11/1999 pseshadr     Created                                   |
18 --|     12/04/2002 vma          Default_Attr: added NOCOPY to x_return_sta|
19 --|                             tus, x_msg_count, x_msg data. Change the  |
20 --|                             other OUT parameters to IN OUT NOCOPY     |
21 --|                             parameters. This is to comply with new    |
22 --|                             PL/SQL standards for better performance.  |
23 --|                           ! Following this change, l_movement_transact|
24 --|                           ! ion should be used whenever the program   |
25 --|                           ! wants to read the original input value of |
26 --|                           ! p_movement_transaction.                   |
27 --|    03/17/2005 yawang        Add new program for default movement amt  |
28 --|                             stat_ext_value, document price and vlaue  |
29 --+======================================================================*/
30 
31 --===================
32 -- CONSTANTS
33 --===================
34 G_PKG_NAME CONSTANT VARCHAR2(30) := 'INV_MGD_MVT_DEF_ATTR';
35 G_MODULE_NAME CONSTANT VARCHAR2(100) := 'inv.plsql.INV_MGD_MVT_DEF_ATTR.';
36 
37 --========================================================================
38 -- PROCEDURE : Default_Attr      PRIVATE
39 -- PARAMETERS: p_api_version_number    known api version
40 --             p_init_msg_list         FND_API.G_TRUE to reset list
41 --             p_movement_transaction
42 --             x_transaction_nature    Transaction Nature
43 --             x_delivery_terms        Delivery Terms
44 --             x_area                  Area where goods arrive/depart
45 --             x_Port                  Port where goods arrive/depart
46 --             x_csa_code              Csa code
47 --             x_oil_reference_code    Used in oil industry
48 --             x_container_type_code   Container Type
49 --             x_flow_indicator_code   Used in the oil industry
50 --             x_affiliation_reference_code
51 --             x_traic_code            Taric Code
52 --             x_preference_code       Preference Code
53 --             x_return_status         return status
54 --             x_msg_count             number of messages in the list
55 --             x_msg_data              message text
56 -- COMMENT   : This is the callout procedure which is called before
57 --             inserting records into MVt Stats table to default some of the
58 --             attributes if the user wanted to define their own values.
59 --========================================================================
60 
61 PROCEDURE Default_Attr
62 ( p_api_version_number   IN  NUMBER
63 , p_init_msg_list        IN  VARCHAR2
64 , p_movement_transaction IN
65     Inv_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
66 , x_transaction_nature         IN OUT NOCOPY VARCHAR2
67 , x_delivery_terms             IN OUT NOCOPY VARCHAR2
68 , x_area                       IN OUT NOCOPY VARCHAR2
69 , x_port                       IN OUT NOCOPY VARCHAR2
70 , x_csa_code                   IN OUT NOCOPY VARCHAR2
71 , x_oil_reference_code         IN OUT NOCOPY VARCHAR2
72 , x_container_type_code        IN OUT NOCOPY VARCHAR2
73 , x_flow_indicator_code        IN OUT NOCOPY VARCHAR2
74 , x_affiliation_reference_code IN OUT NOCOPY VARCHAR2
75 , x_taric_code                 IN OUT NOCOPY VARCHAR2
76 , x_preference_code            IN OUT NOCOPY VARCHAR2
77 , x_statistical_procedure_code IN OUT NOCOPY VARCHAR2
78 , x_transport_mode             IN OUT NOCOPY VARCHAR2
79 , x_return_status              OUT NOCOPY VARCHAR2
80 , x_msg_count                  OUT NOCOPY NUMBER
81 , x_msg_data                   OUT NOCOPY VARCHAR2
82 )
83 IS
84 
85 l_movement_transaction
86     Inv_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type;
87 l_return_status           VARCHAR2(1);
88 l_api_version_number      NUMBER := 1.0;
89 l_procedure_name          CONSTANT VARCHAR2(30) := 'Default_Attr';
90 
91 BEGIN
92   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
93   THEN
94     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
95                   , G_MODULE_NAME || l_procedure_name || '.begin'
96                   ,'enter procedure'
97                   );
98   END IF;
99 
100   IF NOT FND_API.Compatible_API_Call
101          ( l_api_version_number
102          , p_api_version_number
103          , l_procedure_name
104          , G_PKG_NAME
105          )
106   THEN
107     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
108   END IF;
109 
110   --  Initialize message stack if required
111   IF FND_API.to_Boolean(p_init_msg_list)
112   THEN
113     FND_MSG_PUB.initialize;
114   END IF;
115 
116   x_return_status := FND_API.G_RET_STS_SUCCESS;
117 
118   l_movement_transaction       := p_movement_transaction;
119   x_transaction_nature         := l_movement_transaction.transaction_nature;
120   x_delivery_terms             := l_movement_transaction.delivery_terms;
121   x_area                       := l_movement_transaction.area;
122   x_port                       := l_movement_transaction.port;
123   x_csa_code                   := l_movement_transaction.csa_code;
124   x_oil_reference_code         := l_movement_transaction.oil_reference_code;
125   x_container_type_code        := l_movement_transaction.container_type_code;
126   x_flow_indicator_code        := l_movement_transaction.flow_indicator_code;
127   x_affiliation_reference_code :=
128      l_movement_transaction.affiliation_reference_code;
129   x_taric_code                 := l_movement_transaction.taric_code;
130   x_preference_code            := l_movement_transaction.preference_code;
131   x_statistical_procedure_code := l_movement_transaction.statistical_procedure_code;
132   x_transport_mode             := l_movement_transaction.transport_mode;
133 
134 /* If you need to modify the default values for the following columns
135    DO IT HERE. If there is no change required then the values for these
136    columns are the same values obtained when calling this procedure
137 
138    To define your own defaults:
139    STEP 1: replace the value required with the columns as
140            indicated by <replace transaction_nature>
141    STEP 2: Remove the comment from the line which is indicated by
142 	   "--" in the beginning of the line.
143 
144   For eg: If you want to replace the transaction_nature with a value
145           10, then the first line would read as follows:
146           x_transaction_nature := '10';
147 
148 */
149 
150 --  x_transaction_nature         := <replace transaction_nature>
151 --  x_delivery_terms             := <replace delivery_terms>
152 --  x_area                       := <replace area>
153 --  x_port                       := <replace port>
154 --  x_csa_code                   := <replace csa_code>
155 --  x_oil_reference_code         := <replace oil_reference_code>
156 --  x_container_type_code        := <replace container_type_code>
157 --  x_flow_indicator_code        := <replace flow_indicator_code>
158 --  x_affiliation_reference_code :=
159 --     <replace affiliation_reference_code>
160 --  x_taric_code                 := <replace taric_code>
161 --  x_preference_code            := <replace preference_code>
162 --  x_statistical_procedure_code := <replace statistical_procedure_code>
163 --  x_transport_mode             := <replace transport_mode>
164 
165   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
166   THEN
167     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
168                   , G_MODULE_NAME || l_procedure_name || '.end'
169                   ,'exit procedure'
170                   );
171   END IF;
172 EXCEPTION
173 
174   WHEN FND_API.G_EXC_ERROR THEN
175     x_return_status := FND_API.G_RET_STS_ERROR;
176 
177     --  Get message count and data
178     FND_MSG_PUB.Count_And_Get
179     ( p_count => x_msg_count
180     , p_data  => x_msg_data
181     );
182   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
183     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
184 
185     --  Get message count and data
186     FND_MSG_PUB.Count_And_Get
187     ( p_count => x_msg_count
188     , p_data  => x_msg_data
189     );
190   WHEN OTHERS THEN
191     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
192 
193     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
194     THEN
195       FND_MSG_PUB.Add_Exc_Msg
196       ( G_PKG_NAME
197       , 'Default_Attr'
198       );
199      END IF;
200      --  Get message count and data
201      FND_MSG_PUB.Count_And_Get
202      ( p_count => x_msg_count
203      , p_data  => x_msg_data
204      );
205 
206 END Default_Attr;
207 
208 --========================================================================
209 -- PROCEDURE : Default_Value
210 -- PARAMETERS: p_api_version_number       known api version
211 --             p_init_msg_list            FND_API.G_TRUE to reset list
212 --             p_movement_transaction     IN Movement Statistics Record Type
213 --             x_document_unit_price      IN OUT Unit price on SO/PO
214 --             x_document_line_ext_vlaue  IN OUT Line value on SO/PO
215 --             x_movement_amount          IN OUT Movement amount
216 --             x_stat_ext_value           IN OUT Statistics value
217 --             x_return_status            return status
218 --             x_msg_count                number of messages in the list
219 --             x_msg_data                 message text
220 -- COMMENT   : This is the callout procedure which is called before
221 --             inserting records into MVt Stats table to default some of the
222 --             values if the user wanted to define their own.
223 --========================================================================
224 
225 PROCEDURE Default_Value
226 ( p_api_version_number   IN  NUMBER
227 , p_init_msg_list        IN  VARCHAR2
228 , p_movement_transaction IN
229     Inv_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type
230 , x_document_unit_price        IN OUT NOCOPY NUMBER
231 , x_document_line_ext_value    IN OUT NOCOPY NUMBER
232 , x_movement_amount            IN OUT NOCOPY NUMBER
233 , x_stat_ext_value             IN OUT NOCOPY NUMBER
234 , x_return_status              OUT NOCOPY VARCHAR2
235 , x_msg_count                  OUT NOCOPY NUMBER
236 , x_msg_data                   OUT NOCOPY VARCHAR2
237 )
238 IS
239 l_movement_transaction
240     Inv_MGD_MVT_DATA_STR.Movement_Transaction_Rec_Type;
241 l_return_status           VARCHAR2(1);
242 l_api_version_number      NUMBER := 1.0;
243 l_procedure_name          CONSTANT VARCHAR2(30) := 'Default_Value';
244 
245 BEGIN
246   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
247   THEN
248     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
249                   , G_MODULE_NAME || l_procedure_name || '.begin'
250                   ,'enter procedure'
251                   );
252   END IF;
253 
254   IF NOT FND_API.Compatible_API_Call
255          ( l_api_version_number
256          , p_api_version_number
257          , l_procedure_name
258          , G_PKG_NAME
259          )
260   THEN
261     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
262   END IF;
263 
264   --  Initialize message stack if required
265   IF FND_API.to_Boolean(p_init_msg_list)
266   THEN
267     FND_MSG_PUB.initialize;
268   END IF;
269 
270   x_return_status := FND_API.G_RET_STS_SUCCESS;
271 
272   l_movement_transaction       := p_movement_transaction;
273   x_document_unit_price        := l_movement_transaction.document_unit_price;
274   x_document_line_ext_value    := l_movement_transaction.document_line_ext_value;
275   x_movement_amount            := l_movement_transaction.movement_amount;
276   x_stat_ext_value             := l_movement_transaction.stat_ext_value;
277 
278 /* If you need to modify the values for the following columns
279    DO IT HERE. If there is no change required then the values for these
280    columns are the same values obtained when calling this procedure
281 
282    To define your own values:
283    STEP 1: replace the value required with the columns as
284            indicated by <replace document_unit_price>
285    STEP 2: Remove the comment from the line which is indicated by
286 	   "--" in the beginning of the line.
287 
288   For eg: If you want to replace the document_unit_price with a value 1500
289           from your own logic, then the first line would read as follows:
290           x_document_unit_price := 1500;
291 
292 */
293 
294 --  x_document_unit_price         := <replace document_unit_price>
295 --  x_document_line_ext_value     := <replace document_line_ext_value>
296 --  x_movement_amount             := <replace movement_amount>
297 --  x_stat_ext_value              := <replace stat_ext_value>
298 
299   IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
300   THEN
301     FND_LOG.string(FND_LOG.LEVEL_PROCEDURE
302                   , G_MODULE_NAME || l_procedure_name || '.end'
303                   ,'exit procedure'
304                   );
305   END IF;
306 EXCEPTION
307 
308   WHEN FND_API.G_EXC_ERROR THEN
309     x_return_status := FND_API.G_RET_STS_ERROR;
310 
311     --  Get message count and data
312     FND_MSG_PUB.Count_And_Get
313     ( p_count => x_msg_count
314     , p_data  => x_msg_data
315     );
316   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
317     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
318 
319     --  Get message count and data
320     FND_MSG_PUB.Count_And_Get
321     ( p_count => x_msg_count
322     , p_data  => x_msg_data
323     );
324   WHEN OTHERS THEN
325     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
326 
327     IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
328     THEN
329       FND_MSG_PUB.Add_Exc_Msg
330       ( G_PKG_NAME
331       , 'Default_Attr'
332       );
333      END IF;
334      --  Get message count and data
335      FND_MSG_PUB.Count_And_Get
336      ( p_count => x_msg_count
337      , p_data  => x_msg_data
338      );
339 END Default_Value;
340 
341 END INV_MGD_MVT_DEF_ATTR;