DBA Data[Home] [Help]

PACKAGE BODY: APPS.JMF_CUSTOM_HOOK

Source


1 PACKAGE BODY JMF_CUSTOM_HOOK AS
2 /* $Header: JMFCUSHB.pls 120.0.12020000.1 2012/08/29 06:06:26 ntungare noship $ */
3 --+=======================================================================+
4 --|               Copyright (c) 2012 Oracle Corporation                   |
5 --|                       Redwood Shores, CA, USA                         |
6 --|                         All rights reserved.                          |
7 --+=======================================================================+
8 --| FILENAME                                                              |
9 --|     JMFCUSHB.pls                                                      |
10 --|                                                                       |
11 --| DESCRIPTION                                                           |
12 --|     Body. of JMF_CUSTOM_HOOK                                          |
13 --|                                                                       |
14 --| PROCEDURE LIST                                                        |
15 --|     Default_OE_Hdr_Attr                                               |
16 --|     Default_OE_Line_Attr                                              |
17 --|                                                                       |
18 --| HISTORY                                                               |
19 --|     06/11/2012 anagubad     Created                                   |
20 --+======================================================================*/
21 
22 --===================
23 -- CONSTANTS
24 --===================
25 G_PKG_NAME CONSTANT VARCHAR2(30) := 'JMF_CUSTOM_HOOK';
26 g_log_enabled       VARCHAR2(1)  := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'), 'N');
27 
28 --========================================================================
29 -- PROCEDURE : Default_OE_Hdr_Attr     PRIVATE
30 -- PARAMETERS: p_api_version_number    known api version
31 --             p_init_msg_list         FND_API.G_TRUE to reset list
32 --             p_x_header_Rec
33 --             x_attribute1 - x_attribute20      DFF attributes
34 --             x_return_status         return status
35 --             x_msg_count             message count
36 --             x_msg_data              error message
37 -- COMMENT   : This is the custom hook procedure which is called before
38 --             processing the sales order to default some of the
39 --             attributes if the user wanted to define their own values.
40 --========================================================================
41 PROCEDURE Default_OE_Hdr_Attr
42    (  p_api_version_number IN   NUMBER
43     , p_init_msg_list      IN   VARCHAR2 := FND_API.G_FALSE
44     , p_x_header_Rec       IN   OE_Order_PUB.Header_Rec_Type
45     , x_attribute1         OUT  NOCOPY VARCHAR2
46     , x_attribute2         OUT  NOCOPY VARCHAR2
47     , x_attribute3         OUT  NOCOPY VARCHAR2
48     , x_attribute4         OUT  NOCOPY VARCHAR2
49     , x_attribute5         OUT  NOCOPY VARCHAR2
50     , x_attribute6         OUT  NOCOPY VARCHAR2
51     , x_attribute7         OUT  NOCOPY VARCHAR2
52     , x_attribute8         OUT  NOCOPY VARCHAR2
53     , x_attribute9         OUT  NOCOPY VARCHAR2
54     , x_attribute10        OUT  NOCOPY VARCHAR2
55     , x_attribute11        OUT  NOCOPY VARCHAR2
56     , x_attribute12        OUT  NOCOPY VARCHAR2
57     , x_attribute13        OUT  NOCOPY VARCHAR2
58     , x_attribute14        OUT  NOCOPY VARCHAR2
59     , x_attribute15        OUT  NOCOPY VARCHAR2
60     , x_attribute16        OUT  NOCOPY VARCHAR2
61     , x_attribute17        OUT  NOCOPY VARCHAR2
62     , x_attribute18        OUT  NOCOPY VARCHAR2
63     , x_attribute19        OUT  NOCOPY VARCHAR2
64     , x_attribute20        OUT  NOCOPY VARCHAR2
65     , x_return_status      OUT  NOCOPY VARCHAR2
66     , x_msg_count          OUT  NOCOPY NUMBER
67     , x_msg_data           OUT  NOCOPY VARCHAR2
68    )
69 
70 IS
71 
72    l_program                 CONSTANT VARCHAR2(30) := 'Default_OE_Hdr_Attr';
73    l_header_rec              OE_Order_PUB.Header_Rec_Type;
74    l_api_version_number      NUMBER := 1.0;
75 
76 BEGIN
77 
78    IF  g_log_enabled = 'Y'
79    AND (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
80    THEN
81       FND_LOG.string(  FND_LOG.LEVEL_PROCEDURE
82                      , G_PKG_NAME
83                      , '>> ' || G_PKG_NAME || '.' || l_program || ': Start'
84                     );
85    END IF;
86 
87    IF NOT FND_API.Compatible_API_Call
88         (  l_api_version_number
89          , p_api_version_number
90          , l_program
91          , G_PKG_NAME
92         )
93    THEN
94       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
95    END IF;
96 
97    --  Initialize message stack if required
98    IF FND_API.to_Boolean(p_init_msg_list)
99    THEN
100       FND_MSG_PUB.initialize;
101    END IF;
102 
103    x_return_status := FND_API.G_RET_STS_SUCCESS;
104 
105    l_header_rec    := p_x_header_Rec;
106 
107    x_attribute1    := l_header_rec.attribute1;
108    x_attribute2    := l_header_rec.attribute2;
109    x_attribute3    := l_header_rec.attribute3;
110    x_attribute4    := l_header_rec.attribute4;
111    x_attribute5    := l_header_rec.attribute5;
112    x_attribute6    := l_header_rec.attribute6;
113    x_attribute7    := l_header_rec.attribute7;
114    x_attribute8    := l_header_rec.attribute8;
115    x_attribute9    := l_header_rec.attribute9;
116    x_attribute10   := l_header_rec.attribute10;
117    x_attribute11   := l_header_rec.attribute11;
118    x_attribute12   := l_header_rec.attribute12;
119    x_attribute13   := l_header_rec.attribute13;
120    x_attribute14   := l_header_rec.attribute14;
121    x_attribute15   := l_header_rec.attribute15;
122    x_attribute16   := l_header_rec.attribute16;
123    x_attribute17   := l_header_rec.attribute17;
124    x_attribute18   := l_header_rec.attribute18;
125    x_attribute19   := l_header_rec.attribute19;
126    x_attribute20   := l_header_rec.attribute20;
127 
128    /* If you need to modify the default values for the following columns
129       DO IT HERE. If there is no change required then the values for these
130       columns are the same values obtained when calling this procedure
131 
132       To define your own defaults:
133       STEP 1: replace the value required with the columns as
134               indicated by <replace attribute1>
135       STEP 2: Remove the comment from the line which is indicated by
136               "--" in the beginning of the line.
137 
138       For eg: If you want to replace the attibute1 with a value
139               10, then the first line would read as follows:
140               x_attribute1 := '10';
141 
142    */
143 
144    --x_attribute1    := <replace attribute1>
145    --x_attribute2    := <replace attribute2>
146    --x_attribute3    := <replace attribute3>
147    --x_attribute4    := <replace attribute4>
148    --x_attribute5    := <replace attribute5>
149    --x_attribute6    := <replace attribute6>
150    --x_attribute7    := <replace attribute7>
151    --x_attribute8    := <replace attribute8>
152    --x_attribute9    := <replace attribute9>
153    --x_attribute10   := <replace attribute10>
154    --x_attribute11   := <replace attribute11>
155    --x_attribute12   := <replace attribute12>
156    --x_attribute13   := <replace attribute13>
157    --x_attribute14   := <replace attribute14>
158    --x_attribute15   := <replace attribute15>
159    --x_attribute16   := <replace attribute16>
160    --x_attribute17   := <replace attribute17>
161    --x_attribute18   := <replace attribute18>
162    --x_attribute19   := <replace attribute19>
163    --x_attribute20   := <replace attribute20>
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_PKG_NAME
169                      , '>> ' || G_PKG_NAME || '.' || l_program || ': End'
170                     );
171    END IF;
172 
173 EXCEPTION
174    WHEN FND_API.G_EXC_ERROR
175    THEN
176       x_return_status := FND_API.G_RET_STS_ERROR;
177 
178       --  Get message count and data
179       FND_MSG_PUB.Count_And_Get
180          (  p_count => x_msg_count
181           , p_data  => x_msg_data
182          );
183 
184    WHEN FND_API.G_EXC_UNEXPECTED_ERROR
185    THEN
186       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
187 
188       --  Get message count and data
189       FND_MSG_PUB.Count_And_Get
190         (  p_count => x_msg_count
191          , p_data  => x_msg_data
192         );
193    WHEN OTHERS
194    THEN
195       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
196 
197       IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
198       THEN
199          FND_MSG_PUB.Add_Exc_Msg
200            (  G_PKG_NAME
201             , 'Default_OE_Hdr_Attr'
202            );
203       END IF;
204 
205       --  Get message count and data
206       FND_MSG_PUB.Count_And_Get
207         (  p_count => x_msg_count
208          , p_data  => x_msg_data
209         );
210 
211 END Default_OE_Hdr_Attr;
212 
213 
214 --========================================================================
215 -- PROCEDURE : Default_OE_Line_Attr    PRIVATE
216 -- PARAMETERS: p_api_version_number    known api version
217 --             p_init_msg_list         FND_API.G_TRUE to reset list
218 --             p_x_line_tbl
219 --             x_line_attr_tbl         Line DFF attributes
220 --             x_return_status         return status
221 --             x_msg_count             message count
222 --             x_msg_data              error message
223 -- COMMENT   : This is the custom hook procedure which is called before
224 --             processing the sales order to default some of the
225 --             attributes if the user wanted to define their own values.
226 --========================================================================
227 PROCEDURE Default_OE_Line_Attr
228    (  p_api_version_number IN   NUMBER
229     , p_init_msg_list      IN   VARCHAR2 := FND_API.G_FALSE
230     , p_x_line_tbl         IN   OE_Order_PUB.Line_Tbl_Type
231     , x_line_attr_tbl      OUT  NOCOPY Line_Attr_Tbl_Type
232     , x_return_status      OUT  NOCOPY VARCHAR2
233     , x_msg_count          OUT  NOCOPY NUMBER
234     , x_msg_data           OUT  NOCOPY VARCHAR2
235    )
236 
237 IS
238 
239    l_program                 CONSTANT VARCHAR2(30) := 'Default_OE_Line_Attr';
240    l_line_tbl                OE_Order_PUB.Line_Tbl_Type;
241    l_api_version_number      NUMBER := 1.0;
242 
243 BEGIN
244 
245    IF  g_log_enabled = 'Y'
246    AND (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
247    THEN
248       FND_LOG.string(  FND_LOG.LEVEL_PROCEDURE
249                      , G_PKG_NAME
250                      , '>> ' || G_PKG_NAME || '.' || l_program || ': Start'
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_program
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_line_tbl      := p_x_line_tbl;
273 
274    x_line_attr_tbl(1).attribute1    :=  l_line_tbl(1).attribute1;
275    x_line_attr_tbl(1).attribute2    :=  l_line_tbl(1).attribute2;
276    x_line_attr_tbl(1).attribute3    :=  l_line_tbl(1).attribute3;
277    x_line_attr_tbl(1).attribute4    :=  l_line_tbl(1).attribute4;
278    x_line_attr_tbl(1).attribute5    :=  l_line_tbl(1).attribute5;
279    x_line_attr_tbl(1).attribute6    :=  l_line_tbl(1).attribute6;
280    x_line_attr_tbl(1).attribute7    :=  l_line_tbl(1).attribute7;
281    x_line_attr_tbl(1).attribute8    :=  l_line_tbl(1).attribute8;
282    x_line_attr_tbl(1).attribute9    :=  l_line_tbl(1).attribute9;
283    x_line_attr_tbl(1).attribute10   :=  l_line_tbl(1).attribute10;
284    x_line_attr_tbl(1).attribute11   :=  l_line_tbl(1).attribute11;
285    x_line_attr_tbl(1).attribute12   :=  l_line_tbl(1).attribute12;
286    x_line_attr_tbl(1).attribute13   :=  l_line_tbl(1).attribute13;
287    x_line_attr_tbl(1).attribute14   :=  l_line_tbl(1).attribute14;
288    x_line_attr_tbl(1).attribute15   :=  l_line_tbl(1).attribute15;
289    x_line_attr_tbl(1).attribute16   :=  l_line_tbl(1).attribute16;
290    x_line_attr_tbl(1).attribute17   :=  l_line_tbl(1).attribute17;
291    x_line_attr_tbl(1).attribute18   :=  l_line_tbl(1).attribute18;
292    x_line_attr_tbl(1).attribute19   :=  l_line_tbl(1).attribute19;
293    x_line_attr_tbl(1).attribute20   :=  l_line_tbl(1).attribute20;
294 
295    /* If you need to modify the default values for the following columns
296       DO IT HERE. If there is no change required then the values for these
297       columns are the same values obtained when calling this procedure
298 
299       To define your own defaults:
300       STEP 1: replace the value required with the columns as
301               indicated by <replace attribute1>
302       STEP 2: Remove the comment from the line which is indicated by
303               "--" in the beginning of the line.
304 
305       For eg: If you want to replace the attibute1 with a value
306               10, then the first line would read as follows:
307               x_line_attr_tbl(1).attribute1 := '10';
308 
309    */
310 
311    --x_line_attr_tbl(1).attribute1    :=  <replace line attribute1>
312    --x_line_attr_tbl(1).attribute2    :=  <replace line attribute2>
313    --x_line_attr_tbl(1).attribute3    :=  <replace line attribute3>
314    --x_line_attr_tbl(1).attribute4    :=  <replace line attribute4>
315    --x_line_attr_tbl(1).attribute5    :=  <replace line attribute5>
316    --x_line_attr_tbl(1).attribute6    :=  <replace line attribute6>
317    --x_line_attr_tbl(1).attribute7    :=  <replace line attribute7>
318    --x_line_attr_tbl(1).attribute8    :=  <replace line attribute8>
319    --x_line_attr_tbl(1).attribute9    :=  <replace line attribute9>
320    --x_line_attr_tbl(1).attribute10   :=  <replace line attribute10>
321    --x_line_attr_tbl(1).attribute11   :=  <replace line attribute11>
322    --x_line_attr_tbl(1).attribute12   :=  <replace line attribute12>
323    --x_line_attr_tbl(1).attribute13   :=  <replace line attribute13>
324    --x_line_attr_tbl(1).attribute14   :=  <replace line attribute14>
325    --x_line_attr_tbl(1).attribute15   :=  <replace line attribute15>
326    --x_line_attr_tbl(1).attribute16   :=  <replace line attribute16>
327    --x_line_attr_tbl(1).attribute17   :=  <replace line attribute17>
328    --x_line_attr_tbl(1).attribute18   :=  <replace line attribute18>
329    --x_line_attr_tbl(1).attribute19   :=  <replace line attribute19>
330    --x_line_attr_tbl(1).attribute20   :=  <replace line attribute20>
331 
332    IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)
333    THEN
334       FND_LOG.string(  FND_LOG.LEVEL_PROCEDURE
335                      , G_PKG_NAME
336                      , '>> ' || G_PKG_NAME || '.' || l_program || ': End'
337                     );
338    END IF;
339 
340 EXCEPTION
341 
342    WHEN FND_API.G_EXC_ERROR
343    THEN
344       x_return_status := FND_API.G_RET_STS_ERROR;
345 
346       --  Get message count and data
347       FND_MSG_PUB.Count_And_Get
348          (  p_count => x_msg_count
349           , p_data  => x_msg_data
350          );
351 
352    WHEN FND_API.G_EXC_UNEXPECTED_ERROR
353    THEN
354       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
355 
356       --  Get message count and data
357       FND_MSG_PUB.Count_And_Get
358         (  p_count => x_msg_count
359          , p_data  => x_msg_data
360         );
361 
362    WHEN OTHERS
363    THEN
364       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
365 
366       IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
367       THEN
368          FND_MSG_PUB.Add_Exc_Msg
369             (  G_PKG_NAME
370              , 'Default_Attr'
371             );
372       END IF;
373 
374       --  Get message count and data
375       FND_MSG_PUB.Count_And_Get
376         (  p_count => x_msg_count
377          , p_data  => x_msg_data
378         );
379 
380 END Default_OE_Line_Attr;
381 
382 END JMF_CUSTOM_HOOK;