DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_AP_EXTENSION_PVT

Source


1 PACKAGE BODY OKL_AP_EXTENSION_PVT AS
2 /* $Header: OKLCPXHB.pls 120.1 2007/08/06 13:48:18 prasjain noship $ */
3   ----------------------------------------------------------------------------------
4   -- Start of comments
5   --
6   -- Procedure Name  : create_pxh_extension
7   -- Description     : wrapper api for creating Transaction Extension
8   -- Business Rules  :
9   -- Parameters      : p_api_version ,p_init_msg_list,x_return_status
10   --                  ,x_msg_count ,x_msg_data ,p_pxhv_rec, p_pxlv_tbl
11   --                  ,x_pxhv_rec, x_pxlv_tbl
12   -- Version         : 1.0
13   -- End of comments
14   ----------------------------------------------------------------------------------
15   PROCEDURE create_pxh_extension(
16      p_api_version                  IN  NUMBER
17     ,p_init_msg_list                IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
18     ,x_return_status                OUT NOCOPY VARCHAR2
19     ,x_msg_count                    OUT NOCOPY NUMBER
20     ,x_msg_data                     OUT NOCOPY VARCHAR2
21     ,p_pxhv_rec                     IN  pxhv_rec_type
22     ,p_pxlv_tbl                     IN  pxlv_tbl_type
23     ,x_pxhv_rec                     OUT NOCOPY pxhv_rec_type
24     ,x_pxlv_tbl                     OUT NOCOPY pxlv_tbl_type
25     )
26   IS
27     i                               NUMBER;
28     l_pxhv_rec                      pxhv_rec_type;
29     l_return_status                 VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
30     l_pxlv_tbl                      pxlv_tbl_type := p_pxlv_tbl;
31   BEGIN
32     -- Populate Tpx EXTENSION
33     create_pxh_extension(
34       p_api_version   => p_api_version
35      ,p_init_msg_list => p_init_msg_list
36      ,x_return_status => x_return_status
37      ,x_msg_count     => x_msg_count
38      ,x_msg_data      => x_msg_data
39      ,p_pxhv_rec      => p_pxhv_rec
40      ,x_pxhv_rec      => x_pxhv_rec);
41     IF x_return_status = OKC_API.G_RET_STS_SUCCESS
42     THEN
43       -- populate the foreign key for the detail
44       IF (l_pxlv_tbl.COUNT > 0)
45       THEN
46         i:= l_pxlv_tbl.FIRST;
47         LOOP
48           l_pxlv_tbl(i).header_extension_id := x_pxhv_rec.header_extension_id;
49           EXIT WHEN(i = l_pxlv_tbl.LAST);
50           i := l_pxlv_tbl.NEXT(i);
51         END LOOP;
52       END IF;
53       -- populate the detail
54       create_pxl_extension(
55         p_api_version   => p_api_version
56         ,p_init_msg_list => p_init_msg_list
57         ,x_return_status => x_return_status
58         ,x_msg_count     => x_msg_count
59         ,x_msg_data      => x_msg_data
60         ,p_pxlv_tbl      => l_pxlv_tbl
61         ,x_pxlv_tbl      => x_pxlv_tbl);
62      END IF;
63     EXCEPTION
64       WHEN G_EXCEPTION_HALT_VALIDATION
65       THEN
66         NULL;
67       WHEN OTHERS
68       THEN
69         OKC_API.SET_MESSAGE(
70            p_app_name          => g_app_name
71           ,p_msg_name          => g_unexpected_error
72           ,p_token1            => g_sqlcode_token
73           ,p_token1_value      => sqlcode
74           ,p_token2            => g_sqlerrm_token
75           ,p_token2_value      => sqlerrm);
76         x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
77   END create_pxh_extension;
78 
79   ----------------------------------------------------------------------------------
80   -- Start of comments
81   --
82   -- Procedure Name  : create_pxh_extension
83   -- Description     : wrapper api for creating Transaction Extension Header
84   -- Business Rules  :
85   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
86   --                   ,x_msg_count, x_msg_data, p_pxhv_rec, x_pxhv_rec
87   -- Version         : 1.0
88   -- End of comments
89   ----------------------------------------------------------------------------------
90   PROCEDURE create_pxh_extension(
91      p_api_version             IN  NUMBER
92     ,p_init_msg_list           IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
93     ,x_return_status           OUT NOCOPY VARCHAR2
94     ,x_msg_count               OUT NOCOPY NUMBER
95     ,x_msg_data                OUT NOCOPY VARCHAR2
96     ,p_pxhv_rec                IN  pxhv_rec_type
97     ,x_pxhv_rec                OUT NOCOPY pxhv_rec_type) IS
98     l_return_status            VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
99   BEGIN
100     okl_pxh_pvt.insert_row(
101        p_api_version   => p_api_version
102       ,p_init_msg_list => p_init_msg_list
103       ,x_return_status => x_return_status
104       ,x_msg_count     => x_msg_count
105       ,x_msg_data      => x_msg_data
106       ,p_pxhv_rec      => p_pxhv_rec
107       ,x_pxhv_rec      => x_pxhv_rec);
108 
109     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
110     THEN
111        RAISE G_EXCEPTION_HALT_VALIDATION;
112     ELSE
113       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
114       THEN
115         l_return_status := x_return_status;
116       END IF;
117     END IF;
118     -- Custom code if any
119     EXCEPTION
120       WHEN G_EXCEPTION_HALT_VALIDATION
121       THEN
122         NULL;
123       WHEN OTHERS
124       THEN
125         OKC_API.SET_MESSAGE(p_app_name          => g_app_name
126                            ,p_msg_name          => g_unexpected_error
127                            ,p_token1            => g_sqlcode_token
128                            ,p_token1_value      => sqlcode
129                            ,p_token2            => g_sqlerrm_token
130                            ,p_token2_value      => sqlerrm);
131         x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
132   END create_pxh_extension;
133 
134   ----------------------------------------------------------------------------------
135   -- Start of comments
136   --
137   -- Procedure Name  : create_pxh_extension
138   -- Description     : wrapper api for creating a table of records for
139   --                   Transaction Extension Header
140   -- Business Rules  :
141   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
142   --                   ,x_msg_count, x_msg_data, p_pxhv_tbl, x_pxhv_tbl
143   -- Version         : 1.0
144   -- End of comments
145   ----------------------------------------------------------------------------------
146   PROCEDURE create_pxh_extension(
147      p_api_version               IN  NUMBER
148     ,p_init_msg_list             IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
149     ,x_return_status             OUT NOCOPY VARCHAR2
150     ,x_msg_count                 OUT NOCOPY NUMBER
151     ,x_msg_data                  OUT NOCOPY VARCHAR2
152     ,p_pxhv_tbl                  IN  pxhv_tbl_type
153     ,x_pxhv_tbl                  OUT NOCOPY pxhv_tbl_type) IS
154     l_return_status              VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
155     l_overall_status             VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
156     i                            NUMBER := 0;
157   BEGIN
158     Okc_Api.init_msg_list(p_init_msg_list);
159     -- Make sure PL/SQL table has records in it before passing
160     IF (p_pxhv_tbl.COUNT > 0)
161     THEN
162       i := p_pxhv_tbl.FIRST;
163       LOOP
164         create_pxh_extension(
165            p_api_version                  => p_api_version
166           ,p_init_msg_list                => Okc_Api.G_FALSE
167           ,x_return_status                => x_return_status
168           ,x_msg_count                    => x_msg_count
169           ,x_msg_data                     => x_msg_data
170           ,p_pxhv_rec                     => p_pxhv_tbl(i)
171           ,x_pxhv_rec                     => x_pxhv_tbl(i));
172           -- store the highest degree of error
173           IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
174           THEN
175             IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
176             THEN
177               l_overall_status := x_return_status;
178             END IF;
179           END IF;
180         EXIT WHEN (i = p_pxhv_tbl.LAST);
181         i := p_pxhv_tbl.NEXT(i);
182       END LOOP;
183     END IF;
184     x_return_status := l_overall_status;
185     EXCEPTION
186       WHEN G_EXCEPTION_HALT_VALIDATION
187       THEN
188         NULL;
189       WHEN OTHERS
190       THEN
191         OKC_API.SET_MESSAGE(
192            p_app_name          => g_app_name
193           ,p_msg_name          => g_unexpected_error
194           ,p_token1            => g_sqlcode_token
195           ,p_token1_value      => sqlcode
196           ,p_token2            => g_sqlerrm_token
197           ,p_token2_value      => sqlerrm);
198         x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
199   END create_pxh_extension;
200 
201   ----------------------------------------------------------------------------------
202   -- Start of comments
203   --
204   -- Procedure Name  : update_pxh_extension
205   -- Description     : wrapper api for updating Transaction Extension
206   -- Business Rules  :
207   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
208   --                   ,x_msg_count, x_msg_data, p_pxhv_rec, p_pxlv_tbl,
209   --                   ,x_pxhv_rec, x_pxlv_tbl
210   -- Version         : 1.0
211   -- End of comments
212   ----------------------------------------------------------------------------------
213   PROCEDURE update_pxh_extension(
214     p_api_version           IN  NUMBER,
215     p_init_msg_list         IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
216     x_return_status         OUT NOCOPY VARCHAR2,
217     x_msg_count             OUT NOCOPY NUMBER,
218     x_msg_data              OUT NOCOPY VARCHAR2,
219     p_pxhv_rec              IN  pxhv_rec_type,
220     p_pxlv_tbl              IN  pxlv_tbl_type,
221     x_pxhv_rec              OUT NOCOPY pxhv_rec_type,
222     x_pxlv_tbl              OUT NOCOPY pxlv_tbl_type) IS
223     l_return_status         VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
224   BEGIN
225     -- Update the master
226     update_pxh_extension(
227        p_api_version   => p_api_version
228       ,p_init_msg_list => p_init_msg_list
229       ,x_return_status => x_return_status
230       ,x_msg_count     => x_msg_count
231       ,x_msg_data      => x_msg_data
232       ,p_pxhv_rec      => p_pxhv_rec
233       ,x_pxhv_rec      => x_pxhv_rec);
234 
235     IF (x_return_status = OKC_API.G_RET_STS_SUCCESS)
236     THEN
237       -- Update the detail
238       update_pxl_extension(
239          p_api_version   => p_api_version
240         ,p_init_msg_list => p_init_msg_list
241         ,x_return_status => x_return_status
242         ,x_msg_count     => x_msg_count
243         ,x_msg_data      => x_msg_data
244         ,p_pxlv_tbl      => p_pxlv_tbl
245         ,x_pxlv_tbl      => x_pxlv_tbl);
246      END IF;
247   EXCEPTION
248     WHEN G_EXCEPTION_HALT_VALIDATION
249     THEN
250       NULL;
251     WHEN OTHERS
252     THEN
253       OKC_API.SET_MESSAGE(p_app_name          => g_app_name
254                          ,p_msg_name          => g_unexpected_error
255                          ,p_token1            => g_sqlcode_token
256                          ,p_token1_value      => sqlcode
257                          ,p_token2            => g_sqlerrm_token
258                          ,p_token2_value      => sqlerrm);
259     x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
260   END update_pxh_extension;
261 
262   ----------------------------------------------------------------------------------
263   -- Start of comments
264   --
265   -- Procedure Name  : validate_pxh_extension
266   -- Description     : wrapper api for validating Transaction Extension
267   -- Business Rules  :
268   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
269   --                   ,x_msg_count, x_msg_data, p_pxhv_rec, p_pxlv_tbl
270   -- Version         : 1.0
271   -- End of comments
272   ----------------------------------------------------------------------------------
273   PROCEDURE validate_pxh_extension(
274      p_api_version           IN  NUMBER
275     ,p_init_msg_list         IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
276     ,x_return_status         OUT NOCOPY VARCHAR2
277     ,x_msg_count             OUT NOCOPY NUMBER
278     ,x_msg_data              OUT NOCOPY VARCHAR2
279     ,p_pxhv_rec              IN  pxhv_rec_type
280     ,p_pxlv_tbl              IN  pxlv_tbl_type) IS
281 
282     l_return_status         VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
283     l_overall_status        VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
284   BEGIN
285     -- Validate the master
286     validate_pxh_extension(
287        p_api_version   => p_api_version
288       ,p_init_msg_list => p_init_msg_list
289       ,x_return_status => x_return_status
290       ,x_msg_count     => x_msg_count
291       ,x_msg_data      => x_msg_data
292       ,p_pxhv_rec      => p_pxhv_rec);
293 
294     IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
295     THEN
296        IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
297        THEN
298          l_overall_status := x_return_status;
299        END IF;
300     END IF;
301     -- Validate the detail
302     validate_pxl_extension(
303        p_api_version   => p_api_version
304       ,p_init_msg_list => p_init_msg_list
305       ,x_return_status => x_return_status
306       ,x_msg_count     => x_msg_count
307       ,x_msg_data      => x_msg_data
308       ,p_pxlv_tbl      => p_pxlv_tbl);
309     IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
310     THEN
311        IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
312        THEN
313          l_overall_status := x_return_status;
314        END IF;
315     END IF;
316     x_return_status := l_overall_status;
317   EXCEPTION
318     WHEN G_EXCEPTION_HALT_VALIDATION THEN
319       NULL;
320     WHEN OTHERS THEN
321       OKC_API.SET_MESSAGE(p_app_name          => g_app_name
322                          ,p_msg_name          => g_unexpected_error
323                          ,p_token1            => g_sqlcode_token
324                          ,p_token1_value      => sqlcode
325                          ,p_token2            => g_sqlerrm_token
326                          ,p_token2_value      => sqlerrm);
327       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
328 
329   END validate_pxh_extension;
330 
331   ----------------------------------------------------------------------------------
332   -- Start of comments
333   --
334   -- Procedure Name  : lock_pxh_extension
335   -- Description     : wrapper api for locking a record
336   -- Business Rules  :
337   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
338   --                   ,x_msg_count, x_msg_data, p_pxhv_rec
339   -- Version         : 1.0
340   -- End of comments
341 ----------------------------------------------------------------------------------
342   PROCEDURE lock_pxh_extension(
343      p_api_version           IN  NUMBER
344     ,p_init_msg_list         IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
345     ,x_return_status         OUT NOCOPY VARCHAR2
346     ,x_msg_count             OUT NOCOPY NUMBER
347     ,x_msg_data              OUT NOCOPY VARCHAR2
348     ,p_pxhv_rec              IN  pxhv_rec_type) IS
349     l_return_status          VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
350   BEGIN
351     okl_pxh_pvt.lock_row(
352       p_api_version   => p_api_version
353      ,p_init_msg_list => p_init_msg_list
354      ,x_return_status => x_return_status
355      ,x_msg_count     => x_msg_count
356      ,x_msg_data      => x_msg_data
357      ,p_pxhv_rec      => p_pxhv_rec);
358 
359     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
360     THEN
361       RAISE G_EXCEPTION_HALT_VALIDATION;
362     ELSE
363       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
364       THEN
365         l_return_status := x_return_status;
366       END IF;
367     END IF;
368   EXCEPTION
369     WHEN G_EXCEPTION_HALT_VALIDATION THEN
370       NULL;
371     WHEN OTHERS THEN
372       OKC_API.SET_MESSAGE(p_app_name          => g_app_name
373                          ,p_msg_name          => g_unexpected_error
374                          ,p_token1            => g_sqlcode_token
375                          ,p_token1_value      => sqlcode
376                          ,p_token2            => g_sqlerrm_token
377                          ,p_token2_value      => sqlerrm);
378       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
379   END lock_pxh_extension;
380 
381   ----------------------------------------------------------------------------------
382   -- Start of comments
383   --
384   -- Procedure Name  : lock_pxh_extension
385   -- Description     : wrapper api for locking a table of records
386   -- Business Rules  :
387   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
388   --                   ,x_msg_count, x_msg_data, p_pxhv_tbl
389   -- Version         : 1.0
390   -- End of comments
391   ----------------------------------------------------------------------------------
392   PROCEDURE lock_pxh_extension(
393      p_api_version           IN  NUMBER
394     ,p_init_msg_list         IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
395     ,x_return_status         OUT NOCOPY VARCHAR2
396     ,x_msg_count             OUT NOCOPY NUMBER
397     ,x_msg_data              OUT NOCOPY VARCHAR2
398     ,p_pxhv_tbl              IN  pxhv_tbl_type) IS
399     l_return_status          VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
400     l_overall_status         VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
401     i                        NUMBER := 0;
402   BEGIN
403     Okc_Api.init_msg_list(p_init_msg_list);
404     -- Make sure PL/SQL table has records in it before passing
405     IF (p_pxhv_tbl.COUNT > 0)
406     THEN
407       i := p_pxhv_tbl.FIRST;
408       LOOP
409         lock_pxh_extension(
410            p_api_version                  => p_api_version
411           ,p_init_msg_list                => Okc_Api.G_FALSE
412           ,x_return_status                => x_return_status
413           ,x_msg_count                    => x_msg_count
414           ,x_msg_data                     => x_msg_data
415           ,p_pxhv_rec                     => p_pxhv_tbl(i));
416         -- store the highest degree of error
417         IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
418         THEN
419           IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
420           THEN
421              l_overall_status := x_return_status;
422            END IF;
423          END IF;
424         EXIT WHEN (i = p_pxhv_tbl.LAST);
425         i := p_pxhv_tbl.NEXT(i);
426       END LOOP;
427     END IF;
428     x_return_status := l_overall_status;
429   EXCEPTION
430     WHEN G_EXCEPTION_HALT_VALIDATION
431     THEN
432       NULL;
433     WHEN OTHERS
434     THEN
435       OKC_API.SET_MESSAGE(
436          p_app_name          => g_app_name
437         ,p_msg_name          => g_unexpected_error
438         ,p_token1            => g_sqlcode_token
439         ,p_token1_value      => sqlcode
440         ,p_token2            => g_sqlerrm_token
441         ,p_token2_value      => sqlerrm);
442       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
443   END lock_pxh_extension;
444 
445   ----------------------------------------------------------------------------------
446   -- Start of comments
447   --
448   -- Procedure Name  : update_pxh_extension
449   -- Description     : wrapper api for updating a Header record
450   -- Business Rules  :
451   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
452   --                   ,x_msg_count, x_msg_data, p_pxhv_rec, x_pxhv_rec
453   -- Version         : 1.0
454   -- End of comments
455   ----------------------------------------------------------------------------------
456   PROCEDURE update_pxh_extension(
457      p_api_version                IN  NUMBER
458     ,p_init_msg_list              IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
459     ,x_return_status              OUT NOCOPY VARCHAR2
460     ,x_msg_count                  OUT NOCOPY NUMBER
461     ,x_msg_data                   OUT NOCOPY VARCHAR2
462     ,p_pxhv_rec                   IN  pxhv_rec_type
463     ,x_pxhv_rec                   OUT NOCOPY pxhv_rec_type) IS
464     l_return_status               VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
465   BEGIN
466     okl_pxh_pvt.update_row(
467        p_api_version   => p_api_version
468       ,p_init_msg_list => p_init_msg_list
469       ,x_return_status => x_return_status
470       ,x_msg_count     => x_msg_count
471       ,x_msg_data      => x_msg_data
472       ,p_pxhv_rec      => p_pxhv_rec
473       ,x_pxhv_rec      => x_pxhv_rec);
474     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
475     THEN
476       RAISE G_EXCEPTION_HALT_VALIDATION;
477     ELSE
478       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
479       THEN
480         l_return_status := x_return_status;
481       END IF;
482     END IF;
483   EXCEPTION
484     WHEN G_EXCEPTION_HALT_VALIDATION THEN
485       NULL;
486     WHEN OTHERS THEN
487       OKC_API.SET_MESSAGE(p_app_name          => g_app_name
488                          ,p_msg_name          => g_unexpected_error
489                          ,p_token1            => g_sqlcode_token
490                          ,p_token1_value      => sqlcode
491                          ,p_token2            => g_sqlerrm_token
492                          ,p_token2_value      => sqlerrm);
493       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
494   END update_pxh_extension;
495 
496   ----------------------------------------------------------------------------------
497   -- Start of comments
498   --
499   -- Procedure Name  : update_pxh_extension
500   -- Description     : wrapper api for updating a table of Header records
501   -- Business Rules  :
502   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
503   --                   ,x_msg_count, x_msg_data, p_pxhv_tbl, x_pxhv_tbl
504   -- Version         : 1.0
505   -- End of comments
506   ----------------------------------------------------------------------------------
507   PROCEDURE update_pxh_extension(
508      p_api_version                IN  NUMBER
509     ,p_init_msg_list              IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
510     ,x_return_status              OUT NOCOPY VARCHAR2
511     ,x_msg_count                  OUT NOCOPY NUMBER
512     ,x_msg_data                   OUT NOCOPY VARCHAR2
513     ,p_pxhv_tbl                   IN  pxhv_tbl_type
514     ,x_pxhv_tbl                   OUT NOCOPY pxhv_tbl_type) IS
515     l_return_status               VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
516     l_overall_status              VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
517     i                             NUMBER := 0;
518   BEGIN
519     Okc_Api.init_msg_list(p_init_msg_list);
520     -- Make sure PL/SQL table has records in it before passing
521     IF (p_pxhv_tbl.COUNT > 0) THEN
522       i := p_pxhv_tbl.FIRST;
523       LOOP
524         update_pxh_extension(
525           p_api_version                  => p_api_version,
526           p_init_msg_list                => Okc_Api.G_FALSE,
527           x_return_status                => x_return_status,
528           x_msg_count                    => x_msg_count,
529           x_msg_data                     => x_msg_data,
530           p_pxhv_rec                     => p_pxhv_tbl(i),
531           x_pxhv_rec                     => x_pxhv_tbl(i));
532         -- store the highest degree of error
533         IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
534         THEN
535           IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
536           THEN
537             l_overall_status := x_return_status;
538           END IF;
539         END IF;
540         EXIT WHEN (i = p_pxhv_tbl.LAST);
541         i := p_pxhv_tbl.NEXT(i);
542       END LOOP;
543     END IF;
544     x_return_status := l_overall_status;
545   EXCEPTION
546     WHEN G_EXCEPTION_HALT_VALIDATION
547     THEN
548       NULL;
549     WHEN OTHERS
550     THEN
551       OKC_API.SET_MESSAGE(p_app_name          => g_app_name
552                          ,p_msg_name          => g_unexpected_error
553                          ,p_token1            => g_sqlcode_token
554                          ,p_token1_value      => sqlcode
555                          ,p_token2            => g_sqlerrm_token
556                          ,p_token2_value      => sqlerrm);
557       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
558   END update_pxh_extension;
559 
560   ----------------------------------------------------------------------------------
561   -- Start of comments
562   --
563   -- Procedure Name  : delete_pxh_extension
564   -- Description     : wrapper api for deleting a record
565   -- Business Rules  :
566   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
567   --                   ,x_msg_count, x_msg_data, p_pxhv_rec
568   -- Version         : 1.0
569   -- End of comments
570   ----------------------------------------------------------------------------------
571   PROCEDURE delete_pxh_extension(
572      p_api_version           IN  NUMBER
573     ,p_init_msg_list         IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
574     ,x_return_status         OUT NOCOPY VARCHAR2
575     ,x_msg_count             OUT NOCOPY NUMBER
576     ,x_msg_data              OUT NOCOPY VARCHAR2
577     ,p_pxhv_rec              IN  pxhv_rec_type) IS
578     i                        NUMBER :=0;
579     l_return_status          VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
580     l_pxlv_tbl               pxlv_tbl_type;
581 
582     CURSOR pxl_csr IS
583       SELECT pxl.line_extension_id
584         FROM OKL_EXT_ap_LINE_SOURCES_B pxl
585        WHERE pxl.header_extension_id = p_pxhv_rec.header_extension_id;
586   BEGIN
587     FOR pxl_rec IN pxl_csr
588     LOOP
589       i := i + 1;
590       l_pxlv_tbl(i).line_extension_id := pxl_rec.line_extension_id;
591     END LOOP;
592     delete_pxl_extension(
593        p_api_version   => p_api_version
594       ,p_init_msg_list => p_init_msg_list
595       ,x_return_status => x_return_status
596       ,x_msg_count     => x_msg_count
597       ,x_msg_data      => x_msg_data
598       ,p_pxlv_tbl      => l_pxlv_tbl);
599     IF x_return_status = OKC_API.G_RET_STS_SUCCESS
600     THEN
601       okl_pxh_pvt.delete_row(
602          p_api_version   => p_api_version
603         ,p_init_msg_list => p_init_msg_list
604         ,x_return_status => x_return_status
605         ,x_msg_count     => x_msg_count
606         ,x_msg_data      => x_msg_data
607         ,p_pxhv_rec      => p_pxhv_rec);
608     END IF;
609   EXCEPTION
610     WHEN G_EXCEPTION_HALT_VALIDATION
611     THEN
612       NULL;
613     WHEN OTHERS
614     THEN
615       OKC_API.SET_MESSAGE(
616          p_app_name          => g_app_name
617         ,p_msg_name          => g_unexpected_error
618         ,p_token1            => g_sqlcode_token
619         ,p_token1_value      => sqlcode
620         ,p_token2            => g_sqlerrm_token
621         ,p_token2_value      => sqlerrm);
622       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
623   END delete_pxh_extension;
624 
625   ----------------------------------------------------------------------------------
626   -- Start of comments
627   --
628   -- Procedure Name  : delete_pxh_extension
629   -- Description     : wrapper api for deleting a table of records
630   -- Business Rules  :
631   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
632   --                   ,x_msg_count, x_msg_data, p_pxhv_tbl
633   -- Version         : 1.0
634   -- End of comments
635   ----------------------------------------------------------------------------------
636   PROCEDURE delete_pxh_extension(
637      p_api_version           IN  NUMBER
638     ,p_init_msg_list         IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
639     ,x_return_status         OUT NOCOPY VARCHAR2
640     ,x_msg_count             OUT NOCOPY NUMBER
641     ,x_msg_data              OUT NOCOPY VARCHAR2
642     ,p_pxhv_tbl              IN  pxhv_tbl_type) IS
643     i                        NUMBER :=0;
644     l_return_status          VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
645     l_overall_status         VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
646 
647   BEGIN
648     --Initialize the return status
649     x_return_status := OKC_API.G_RET_STS_SUCCESS;
650     IF (p_pxhv_tbl.COUNT > 0)
651     THEN
652       i := p_pxhv_tbl.FIRST;
653       LOOP
654         delete_pxh_extension(
655            p_api_version   => p_api_version
656           ,p_init_msg_list => p_init_msg_list
657           ,x_return_status => x_return_status
658           ,x_msg_count     => x_msg_count
659           ,x_msg_data      => x_msg_data
660           ,p_pxhv_rec      => p_pxhv_tbl(i));
661          IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
662          THEN
663            IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
664            THEN
665              l_overall_status := x_return_status;
666            END IF;
667          END IF;
668          EXIT WHEN (i = p_pxhv_tbl.LAST);
669          i := p_pxhv_tbl.NEXT(i);
670        END LOOP;
671       END IF;
672       x_return_status := l_overall_status;
673   EXCEPTION
674     WHEN G_EXCEPTION_HALT_VALIDATION
675     THEN
676       NULL;
677     WHEN OTHERS
678     THEN
679       OKC_API.SET_MESSAGE(
680          p_app_name          => g_app_name
681         ,p_msg_name          => g_unexpected_error
682         ,p_token1            => g_sqlcode_token
683         ,p_token1_value      => sqlcode
684         ,p_token2            => g_sqlerrm_token
685         ,p_token2_value      => sqlerrm);
686       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
687   END delete_pxh_extension;
688 
689   ----------------------------------------------------------------------------------
690   -- Start of comments
691   --
692   -- Procedure Name  : validate_pxh_extension
693   -- Description     : wrapper api for validating a Header record
694   -- Business Rules  :
695   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
696   --                   ,x_msg_count, x_msg_data, p_pxhv_rec
697   -- Version         : 1.0
698   -- End of comments
699 ----------------------------------------------------------------------------------
700   PROCEDURE validate_pxh_extension(
701      p_api_version                IN  NUMBER
702     ,p_init_msg_list              IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
703     ,x_return_status              OUT NOCOPY VARCHAR2
704     ,x_msg_count                  OUT NOCOPY NUMBER
705     ,x_msg_data                   OUT NOCOPY VARCHAR2
706     ,p_pxhv_rec                   IN  pxhv_rec_type) IS
707     l_return_status               VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
708   BEGIN
709     okl_pxh_pvt.validate_row(
710        p_api_version   => p_api_version
711       ,p_init_msg_list => p_init_msg_list
712       ,x_return_status => x_return_status
713       ,x_msg_count     => x_msg_count
714       ,x_msg_data      => x_msg_data
715       ,p_pxhv_rec      => p_pxhv_rec);
716     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
717     THEN
718        RAISE G_EXCEPTION_HALT_VALIDATION;
719     ELSE
720       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
721       THEN
722         l_return_status := x_return_status;
723       END IF;
724     END IF;
725   EXCEPTION
726     WHEN G_EXCEPTION_HALT_VALIDATION
727     THEN
728       NULL;
729     WHEN OTHERS
730     THEN
731       OKC_API.SET_MESSAGE(
732          p_app_name          => g_app_name
733         ,p_msg_name          => g_unexpected_error
734         ,p_token1            => g_sqlcode_token
735         ,p_token1_value      => sqlcode
736         ,p_token2            => g_sqlerrm_token
737         ,p_token2_value      => sqlerrm);
738       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
739   END validate_pxh_extension;
740 
741   ----------------------------------------------------------------------------------
742   -- Start of comments
743   --
744   -- Procedure Name  : validate_pxh_extension
745   -- Description     : wrapper api for validating a table of Header records
746   -- Business Rules  :
747   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
748   --                   ,x_msg_count, x_msg_data, p_pxhv_tbl
749   -- Version         : 1.0
750   -- End of comments
751   ----------------------------------------------------------------------------------
752   PROCEDURE validate_pxh_extension(
753       p_api_version               IN  NUMBER,
754       p_init_msg_list             IN  VARCHAR2 DEFAULT OKC_API.G_FALSE,
755       x_return_status             OUT NOCOPY VARCHAR2,
756       x_msg_count                 OUT NOCOPY NUMBER,
757       x_msg_data                  OUT NOCOPY VARCHAR2,
758       p_pxhv_tbl                  IN  pxhv_tbl_type)
759   IS
760     l_return_status               VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
761     l_overall_status              VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
762     i                           NUMBER := 0;
763   BEGIN
764     Okc_Api.init_msg_list(p_init_msg_list);
765     -- Make sure PL/SQL table has records in it before passing
766     IF (p_pxhv_tbl.COUNT > 0)
767     THEN
768       i := p_pxhv_tbl.FIRST;
769       LOOP
770         validate_pxh_extension(
771            p_api_version                  => p_api_version
772           ,p_init_msg_list                => Okc_Api.G_FALSE
773           ,x_return_status                => x_return_status
774           ,x_msg_count                    => x_msg_count
775           ,x_msg_data                     => x_msg_data
776           ,p_pxhv_rec                     => p_pxhv_tbl(i));
777         -- store the highest degree of error
778         IF x_return_status <> Okc_Api.G_RET_STS_SUCCESS
779         THEN
780           IF l_overall_status <> Okc_Api.G_RET_STS_UNEXP_ERROR
781           THEN
782             l_overall_status := x_return_status;
783           END IF;
784         END IF;
785         EXIT WHEN (i = p_pxhv_tbl.LAST);
786         i := p_pxhv_tbl.NEXT(i);
787       END LOOP;
788     END IF;
789     x_return_status := l_overall_status;
790   EXCEPTION
791     WHEN G_EXCEPTION_HALT_VALIDATION
792     THEN
793       NULL;
794     WHEN OTHERS
795     THEN
796       OKC_API.SET_MESSAGE(
797          p_app_name          => g_app_name
798         ,p_msg_name          => g_unexpected_error
799         ,p_token1            => g_sqlcode_token
800         ,p_token1_value      => sqlcode
801         ,p_token2            => g_sqlerrm_token
802         ,p_token2_value      => sqlerrm);
803       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
804   END validate_pxh_extension;
805 
806   ----------------------------------------------------------------------------------
807   -- Start of comments
808   --
809   -- Procedure Name  : create_pxl_extension
810   -- Description     : wrapper api for creation of Transaction Extension Line
811   -- Business Rules  :
812   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
813   --                   ,x_msg_count, x_msg_data, p_pxlv_rec, x_pxlv_rec
814   -- Version         : 1.0
815   -- End of comments
816   ----------------------------------------------------------------------------------
817   PROCEDURE create_pxl_extension(
818      p_api_version                    IN  NUMBER
819     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
820     ,x_return_status                  OUT NOCOPY VARCHAR2
821     ,x_msg_count                      OUT NOCOPY NUMBER
822     ,x_msg_data                       OUT NOCOPY VARCHAR2
823     ,p_pxlv_rec                       IN  pxlv_rec_type
824     ,x_pxlv_rec                       OUT NOCOPY pxlv_rec_type)
825   IS
826     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
827   BEGIN
828     okl_pxl_pvt.insert_row(
829        p_api_version   => p_api_version
830       ,p_init_msg_list => p_init_msg_list
831       ,x_return_status => x_return_status
832       ,x_msg_count     => x_msg_count
833       ,x_msg_data      => x_msg_data
834       ,p_pxlv_rec      => p_pxlv_rec
835       ,x_pxlv_rec      => x_pxlv_rec);
836     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
837     THEN
838       RAISE G_EXCEPTION_HALT_VALIDATION;
839     ELSE
840       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
841       THEN
842         l_return_status := x_return_status;
843       END IF;
844     END IF;
845   EXCEPTION
846     WHEN G_EXCEPTION_HALT_VALIDATION
847     THEN
848       NULL;
849     WHEN OTHERS
850     THEN
851       OKC_API.SET_MESSAGE(
852          p_app_name          => g_app_name
853         ,p_msg_name          => g_unexpected_error
854         ,p_token1            => g_sqlcode_token
855         ,p_token1_value      => sqlcode
856         ,p_token2            => g_sqlerrm_token
857         ,p_token2_value      => sqlerrm);
858       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
859   END create_pxl_extension;
860 
861   ----------------------------------------------------------------------------------
862   -- Start of comments
863   --
864   -- Procedure Name  : create_pxl_extension
865   -- Description     : wrapper api for creation of multiple records of
866   --                   Transaction Extension Line
867   -- Business Rules  :
868   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
869   --                   ,x_msg_count, x_msg_data, p_pxlv_tbl, x_pxlv_tbl
870   -- Version         : 1.0
871   -- End of comments
872   ----------------------------------------------------------------------------------
873   PROCEDURE create_pxl_extension(
874      p_api_version                    IN  NUMBER
875     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
876     ,x_return_status                  OUT NOCOPY VARCHAR2
877     ,x_msg_count                      OUT NOCOPY NUMBER
878     ,x_msg_data                       OUT NOCOPY VARCHAR2
879     ,p_pxlv_tbl                       IN  pxlv_tbl_type
880     ,x_pxlv_tbl                       OUT NOCOPY pxlv_tbl_type)
881   IS
882     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
883     l_overall_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
884     i        NUMBER := 0;
885   BEGIN
886     OKC_API.init_msg_list(p_init_msg_list);
887     -- Make sure PL/SQL table has records in it before passing
888     IF (p_pxlv_tbl.COUNT > 0)
889     THEN
890       i := p_pxlv_tbl.FIRST;
891       LOOP
892         create_pxl_extension(
893            p_api_version                  => p_api_version
894           ,p_init_msg_list                => OKC_API.G_FALSE
895           ,x_return_status                => x_return_status
896           ,x_msg_count                    => x_msg_count
897           ,x_msg_data                     => x_msg_data
898           ,p_pxlv_rec                     => p_pxlv_tbl(i)
899           ,x_pxlv_rec                     => x_pxlv_tbl(i));
900         -- store the highest degree of error
901         IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
902         THEN
903           IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR
904           THEN
905             l_overall_status := x_return_status;
906           END IF;
907         END IF;
908         EXIT WHEN (i = p_pxlv_tbl.LAST);
909         i := p_pxlv_tbl.NEXT(i);
910       END LOOP;
911     END IF;
912     x_return_status := l_overall_status;
913   EXCEPTION
914     WHEN G_EXCEPTION_HALT_VALIDATION
915     THEN
916       NULL;
917     WHEN OTHERS
918     THEN
919       OKC_API.SET_MESSAGE(
920          p_app_name          => g_app_name
921         ,p_msg_name          => g_unexpected_error
922         ,p_token1            => g_sqlcode_token
923         ,p_token1_value      => sqlcode
924         ,p_token2            => g_sqlerrm_token
925         ,p_token2_value      => sqlerrm);
926       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
927   END create_pxl_extension;
928   ----------------------------------------------------------------------------------
929   -- Start of comments
930   --
931   -- Procedure Name  : lock_pxl_extension
932   -- Description     : wrapper api for locking a record
933   -- Business Rules  :
934   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
935   --                   ,x_msg_count, x_msg_data, p_pxlv_rec
936   -- Version         : 1.0
937   -- End of comments
938   ----------------------------------------------------------------------------------
939   PROCEDURE lock_pxl_extension(
940      p_api_version                    IN  NUMBER
941     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
942     ,x_return_status                  OUT NOCOPY VARCHAR2
943     ,x_msg_count                      OUT NOCOPY NUMBER
944     ,x_msg_data                       OUT NOCOPY VARCHAR2
945     ,p_pxlv_rec                       IN  pxlv_rec_type) IS
946     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
947   BEGIN
948     okl_pxl_pvt.lock_row(
949        p_api_version   => p_api_version
950       ,p_init_msg_list => p_init_msg_list
951       ,x_return_status => x_return_status
952       ,x_msg_count     => x_msg_count
953       ,x_msg_data      => x_msg_data
954       ,p_pxlv_rec      => p_pxlv_rec );
955     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
956     THEN
957       RAISE G_EXCEPTION_HALT_VALIDATION;
958     ELSE
959       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
960       THEN
961         l_return_status := x_return_status;
962       END IF;
963     END IF;
964   EXCEPTION
965     WHEN G_EXCEPTION_HALT_VALIDATION
966     THEN
967       NULL;
968     WHEN OTHERS
969     THEN
970       OKC_API.SET_MESSAGE(
971          p_app_name          => g_app_name
972         ,p_msg_name          => g_unexpected_error
973         ,p_token1            => g_sqlcode_token
974         ,p_token1_value      => sqlcode
975         ,p_token2            => g_sqlerrm_token
976         ,p_token2_value      => sqlerrm);
977       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
978   END lock_pxl_extension;
979 
980   ----------------------------------------------------------------------------------
981   -- Start of comments
982   --
983   -- Procedure Name  : lock_pxl_extension
984   -- Description     : wrapper api for locking a table of records
985   -- Business Rules  :
986   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
987   --                   ,x_msg_count, x_msg_data, p_pxlv_tbl
988   -- Version         : 1.0
989   -- End of comments
990   ----------------------------------------------------------------------------------
991   PROCEDURE lock_pxl_extension(
992      p_api_version                   IN  NUMBER
993     ,p_init_msg_list                 IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
994     ,x_return_status                 OUT NOCOPY VARCHAR2
995     ,x_msg_count                     OUT NOCOPY NUMBER
996     ,x_msg_data                      OUT NOCOPY VARCHAR2
997     ,p_pxlv_tbl                      IN  pxlv_tbl_type)
998   IS
999     l_return_status                  VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1000     l_overall_status                 VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1001     i                  NUMBER := 0;
1002   BEGIN
1003     OKC_API.init_msg_list(p_init_msg_list);
1004     -- Make sure PL/SQL table has records in it before passing
1005     IF (p_pxlv_tbl.COUNT > 0)
1006     THEN
1007       i := p_pxlv_tbl.FIRST;
1008       LOOP
1009         lock_pxl_extension(
1010            p_api_version                  => p_api_version
1011           ,p_init_msg_list                => OKC_API.G_FALSE
1012           ,x_return_status                => x_return_status
1013           ,x_msg_count                    => x_msg_count
1014           ,x_msg_data                     => x_msg_data
1015           ,p_pxlv_rec                     => p_pxlv_tbl(i));
1016         -- store the highest degree of error
1017         IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
1018         THEN
1019           IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR
1020           THEN
1021             l_overall_status := x_return_status;
1022           END IF;
1023         END IF;
1024         EXIT WHEN (i = p_pxlv_tbl.LAST);
1025         i := p_pxlv_tbl.NEXT(i);
1026       END LOOP;
1027     END IF;
1028     x_return_status := l_overall_status;
1029   EXCEPTION
1030     WHEN G_EXCEPTION_HALT_VALIDATION
1031     THEN
1032       NULL;
1033     WHEN OTHERS
1034     THEN
1035       OKC_API.SET_MESSAGE(
1036          p_app_name          => g_app_name
1037         ,p_msg_name          => g_unexpected_error
1038         ,p_token1            => g_sqlcode_token
1039         ,p_token1_value      => sqlcode
1040         ,p_token2            => g_sqlerrm_token
1041         ,p_token2_value      => sqlerrm);
1042       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1043   END lock_pxl_extension;
1044 
1045   ----------------------------------------------------------------------------------
1046   -- Start of comments
1047   --
1048   -- Procedure Name  : update_pxl_extension
1049   -- Description     : wrapper api for updating a record
1050   -- Business Rules  :
1051   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
1052   --                   ,x_msg_count, x_msg_data, p_pxlv_rec, x_pxlv_rec
1053   -- Version         : 1.0
1054   -- End of comments
1055   ----------------------------------------------------------------------------------
1056   PROCEDURE update_pxl_extension(
1057      p_api_version                    IN  NUMBER
1058     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1059     ,x_return_status                  OUT NOCOPY VARCHAR2
1060     ,x_msg_count                      OUT NOCOPY NUMBER
1061     ,x_msg_data                       OUT NOCOPY VARCHAR2
1062     ,p_pxlv_rec                       IN  pxlv_rec_type
1063     ,x_pxlv_rec                       OUT NOCOPY pxlv_rec_type)
1064   IS
1065     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1066   BEGIN
1067     okl_pxl_pvt.update_row(
1068                            p_api_version   => p_api_version
1069                           ,p_init_msg_list => p_init_msg_list
1070                           ,x_return_status => x_return_status
1071                           ,x_msg_count     => x_msg_count
1072                           ,x_msg_data      => x_msg_data
1073                           ,p_pxlv_rec      => p_pxlv_rec
1074                           ,x_pxlv_rec      => x_pxlv_rec
1075                           );
1076       IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1077        RAISE G_EXCEPTION_HALT_VALIDATION;
1078       ELSE
1079         IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
1080           l_return_status := x_return_status;
1081            END IF;
1082       END IF;
1083   EXCEPTION
1084     WHEN G_EXCEPTION_HALT_VALIDATION
1085     THEN
1086       NULL;
1087     WHEN OTHERS
1088     THEN
1089       OKC_API.SET_MESSAGE(
1090          p_app_name          => g_app_name
1091         ,p_msg_name          => g_unexpected_error
1092         ,p_token1            => g_sqlcode_token
1093         ,p_token1_value      => sqlcode
1094         ,p_token2            => g_sqlerrm_token
1095         ,p_token2_value      => sqlerrm);
1096       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1097   END update_pxl_extension;
1098 
1099   ----------------------------------------------------------------------------------
1100   -- Start of comments
1101   --
1102   -- Procedure Name  : update_pxl_extension
1103   -- Description     : wrapper api for updating a table of records
1104   -- Business Rules  :
1105   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
1106   --                   ,x_msg_count, x_msg_data, p_pxlv_tbl, x_pxlv_tbl
1107   -- Version         : 1.0
1108   -- End of comments
1109   ----------------------------------------------------------------------------------
1110   PROCEDURE update_pxl_extension(
1111      p_api_version                    IN  NUMBER
1112     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1113     ,x_return_status                  OUT NOCOPY VARCHAR2
1114     ,x_msg_count                      OUT NOCOPY NUMBER
1115     ,x_msg_data                       OUT NOCOPY VARCHAR2
1116     ,p_pxlv_tbl                       IN  pxlv_tbl_type
1117     ,x_pxlv_tbl                       OUT NOCOPY pxlv_tbl_type)
1118   IS
1119     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1120     l_overall_status                  VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1121     i                                 NUMBER := 0;
1122   BEGIN
1123     OKC_API.init_msg_list(p_init_msg_list);
1124     -- Make sure PL/SQL table has records in it before passing
1125     IF (p_pxlv_tbl.COUNT > 0)
1126     THEN
1127       i := p_pxlv_tbl.FIRST;
1128       LOOP
1129         update_pxl_extension(
1130           p_api_version                  => p_api_version,
1131           p_init_msg_list                => OKC_API.G_FALSE,
1132           x_return_status                => x_return_status,
1133           x_msg_count                    => x_msg_count,
1134           x_msg_data                     => x_msg_data,
1135           p_pxlv_rec                     => p_pxlv_tbl(i),
1136           x_pxlv_rec                     => x_pxlv_tbl(i));
1137         -- store the highest degree of error
1138         IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
1139         THEN
1140           IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR
1141           THEN
1142             l_overall_status := x_return_status;
1143           END IF;
1144         END IF;
1145         EXIT WHEN (i = p_pxlv_tbl.LAST);
1146         i := p_pxlv_tbl.NEXT(i);
1147       END LOOP;
1148     END IF;
1149     x_return_status := l_overall_status;
1150   EXCEPTION
1151     WHEN G_EXCEPTION_HALT_VALIDATION
1152     THEN
1153       NULL;
1154     WHEN OTHERS
1155     THEN
1156       OKC_API.SET_MESSAGE(
1157          p_app_name          => g_app_name
1158         ,p_msg_name          => g_unexpected_error
1159         ,p_token1            => g_sqlcode_token
1160         ,p_token1_value      => sqlcode
1161         ,p_token2            => g_sqlerrm_token
1162         ,p_token2_value      => sqlerrm);
1163       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1164   END update_pxl_extension;
1165 
1166   ----------------------------------------------------------------------------------
1167   -- Start of comments
1168   --
1169   -- Procedure Name  : delete_pxl_extension
1170   -- Description     : wrapper api for deleting record
1171   -- Business Rules  :
1172   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
1173   --                   ,x_msg_count, x_msg_data, p_pxlv_rec
1174   -- Version         : 1.0
1175   -- End of comments
1176   ----------------------------------------------------------------------------------
1177   PROCEDURE delete_pxl_extension(
1178      p_api_version                    IN  NUMBER
1179     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1180     ,x_return_status                  OUT NOCOPY VARCHAR2
1181     ,x_msg_count                      OUT NOCOPY NUMBER
1182     ,x_msg_data                       OUT NOCOPY VARCHAR2
1183     ,p_pxlv_rec                       IN  pxlv_rec_type) IS
1184     i                                 NUMBER :=0;
1185     l_return_status                   VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1186   BEGIN
1187     okl_pxl_pvt.delete_row(
1188        p_api_version   => p_api_version
1189       ,p_init_msg_list => p_init_msg_list
1190       ,x_return_status => x_return_status
1191       ,x_msg_count     => x_msg_count
1192       ,x_msg_data      => x_msg_data
1193       ,p_pxlv_rec      => p_pxlv_rec);
1194     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
1195     THEN
1196       RAISE G_EXCEPTION_HALT_VALIDATION;
1197     ELSE
1198       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
1199       THEN
1200         l_return_status := x_return_status;
1201       END IF;
1202     END IF;
1203   EXCEPTION
1204     WHEN G_EXCEPTION_HALT_VALIDATION
1205     THEN
1206       NULL;
1207     WHEN OTHERS
1208     THEN
1209       OKC_API.SET_MESSAGE(
1210          p_app_name          => g_app_name
1211         ,p_msg_name          => g_unexpected_error
1212         ,p_token1            => g_sqlcode_token
1213         ,p_token1_value      => sqlcode
1214         ,p_token2            => g_sqlerrm_token
1215         ,p_token2_value      => sqlerrm);
1216       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1217   END delete_pxl_extension;
1218 
1219   ----------------------------------------------------------------------------------
1220   -- Start of comments
1221   --
1222   -- Procedure Name  : delete_pxl_extension
1223   -- Description     : wrapper api for deleting a table of records
1224   -- Business Rules  :
1225   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
1226   --                   ,x_msg_count, x_msg_data, p_pxlv_tbl
1227   -- Version         : 1.0
1228   -- End of comments
1229   ----------------------------------------------------------------------------------
1230   PROCEDURE delete_pxl_extension(
1231      p_api_version                    IN  NUMBER
1232     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1233     ,x_return_status                  OUT NOCOPY VARCHAR2
1234     ,x_msg_count                      OUT NOCOPY NUMBER
1235     ,x_msg_data                       OUT NOCOPY VARCHAR2
1236     ,p_pxlv_tbl                       IN  pxlv_tbl_type)
1237   IS
1238     i                                 NUMBER :=0;
1239     l_return_status                   VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1240     l_overall_status                  VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1241   BEGIN
1242     --Initialize the return status
1243     x_return_status := OKC_API.G_RET_STS_SUCCESS;
1244     IF (p_pxlv_tbl.COUNT > 0)
1245     THEN
1246       i := p_pxlv_tbl.FIRST;
1247       LOOP
1248         delete_pxl_extension(
1249            p_api_version   => p_api_version
1250           ,p_init_msg_list => p_init_msg_list
1251           ,x_return_status => x_return_status
1252           ,x_msg_count     => x_msg_count
1253           ,x_msg_data      => x_msg_data
1254           ,p_pxlv_rec      => p_pxlv_tbl(i));
1255        IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
1256        THEN
1257           IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR
1258           THEN
1259             l_overall_status := x_return_status;
1260           END IF;
1261         END IF;
1262         EXIT WHEN (i = p_pxlv_tbl.LAST);
1263         i := p_pxlv_tbl.NEXT(i);
1264       END LOOP;
1265     END IF;
1266     x_return_status := l_overall_status;
1267   EXCEPTION
1268     WHEN G_EXCEPTION_HALT_VALIDATION
1269     THEN
1270       NULL;
1271     WHEN OTHERS
1272     THEN
1273       OKC_API.SET_MESSAGE(
1274          p_app_name          => g_app_name
1275         ,p_msg_name          => g_unexpected_error
1276         ,p_token1            => g_sqlcode_token
1277         ,p_token1_value      => sqlcode
1278         ,p_token2            => g_sqlerrm_token
1279         ,p_token2_value      => sqlerrm);
1280       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1281   END delete_pxl_extension;
1282 
1283   ----------------------------------------------------------------------------------
1284   -- Start of comments
1285   --
1286   -- Procedure Name  : validate_pxl_extension
1287   -- Description     : wrapper api for validating a record
1288   -- Business Rules  :
1289   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
1290   --                   ,x_msg_count, x_msg_data, p_pxlv_rec
1291   -- Version         : 1.0
1292   -- End of comments
1293   ----------------------------------------------------------------------------------
1294   PROCEDURE validate_pxl_extension(
1295      p_api_version                    IN  NUMBER
1296     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1297     ,x_return_status                  OUT NOCOPY VARCHAR2
1298     ,x_msg_count                      OUT NOCOPY NUMBER
1299     ,x_msg_data                       OUT NOCOPY VARCHAR2
1300     ,p_pxlv_rec                       IN  pxlv_rec_type) IS
1301     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1302   BEGIN
1303     okl_pxl_pvt.validate_row(
1304        p_api_version   => p_api_version
1305       ,p_init_msg_list => p_init_msg_list
1306       ,x_return_status => x_return_status
1307       ,x_msg_count     => x_msg_count
1308       ,x_msg_data      => x_msg_data
1309       ,p_pxlv_rec      => p_pxlv_rec );
1310     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR
1311     THEN
1312       RAISE G_EXCEPTION_HALT_VALIDATION;
1313     ELSE
1314       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
1315       THEN
1316         l_return_status := x_return_status;
1317       END IF;
1318     END IF;
1319   EXCEPTION
1320     WHEN G_EXCEPTION_HALT_VALIDATION
1321     THEN
1322       NULL;
1323     WHEN OTHERS
1324     THEN
1325       OKC_API.SET_MESSAGE(
1326          p_app_name          => g_app_name
1327         ,p_msg_name          => g_unexpected_error
1328         ,p_token1            => g_sqlcode_token
1329         ,p_token1_value      => sqlcode
1330         ,p_token2            => g_sqlerrm_token
1331         ,p_token2_value      => sqlerrm);
1332       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1333   END validate_pxl_extension;
1334 
1335   ----------------------------------------------------------------------------------
1336   -- Start of comments
1337   --
1338   -- Procedure Name  : validate_pxl_extension
1339   -- Description     : wrapper api for validating a table of records
1340   -- Business Rules  :
1341   -- Parameters      : p_api_version, p_init_msg_list, x_return_status
1342   --                   ,x_msg_count, x_msg_data, p_pxlv_tbl
1343   -- Version         : 1.0
1344   -- End of comments
1345   ----------------------------------------------------------------------------------
1346   PROCEDURE validate_pxl_extension(
1347      p_api_version                    IN  NUMBER
1348     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1349     ,x_return_status                  OUT NOCOPY VARCHAR2
1350     ,x_msg_count                      OUT NOCOPY NUMBER
1351     ,x_msg_data                       OUT NOCOPY VARCHAR2
1352     ,p_pxlv_tbl                       IN  pxlv_tbl_type)
1353   IS
1354     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1355     l_overall_status                  VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1356     i                                 NUMBER := 0;
1357   BEGIN
1358     OKC_API.init_msg_list(p_init_msg_list);
1359     -- Make sure PL/SQL table has records in it before passing
1360     IF (p_pxlv_tbl.COUNT > 0)
1361     THEN
1362       i := p_pxlv_tbl.FIRST;
1363       LOOP
1364         validate_pxl_extension(
1365            p_api_version                  => p_api_version
1366           ,p_init_msg_list                => OKC_API.G_FALSE
1367           ,x_return_status                => x_return_status
1368           ,x_msg_count                    => x_msg_count
1369           ,x_msg_data                     => x_msg_data
1370           ,p_pxlv_rec                     => p_pxlv_tbl(i));
1371         -- store the highest degree of error
1372         IF x_return_status <> OKC_API.G_RET_STS_SUCCESS
1373         THEN
1374           IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR
1375           THEN
1376             l_overall_status := x_return_status;
1377           END IF;
1378         END IF;
1379         EXIT WHEN (i = p_pxlv_tbl.LAST);
1380         i := p_pxlv_tbl.NEXT(i);
1381       END LOOP;
1382       x_return_status := l_overall_status;
1383     END IF;
1384   EXCEPTION
1385     WHEN G_EXCEPTION_HALT_VALIDATION
1386     THEN
1387       NULL;
1388     WHEN OTHERS
1389     THEN
1390       OKC_API.SET_MESSAGE(
1391          p_app_name          => g_app_name
1392         ,p_msg_name          => g_unexpected_error
1393         ,p_token1            => g_sqlcode_token
1394         ,p_token1_value      => sqlcode
1395         ,p_token2            => g_sqlerrm_token
1396         ,p_token2_value      => sqlerrm);
1397       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1398   END validate_pxl_extension;
1399 
1400   ----------------------------------------------------------------------------------
1401   -- Start of comments
1402   --
1403   -- Added for Bug# 6268782 : PRASJAIN
1404   --
1405   -- Procedure Name  : create_pxh_extension
1406   -- Description     : wrapper api for creating Transaction Extension
1407   -- Business Rules  :
1408   -- Parameters      : p_api_version ,p_init_msg_list,x_return_status
1409   --                  ,x_msg_count ,x_msg_data ,p_pxh_rec, p_pxhl_tbl
1410   --                  ,x_pxh_rec, x_pxhl_tbl
1411   -- Version         : 1.0
1412   -- End of comments
1413   ----------------------------------------------------------------------------------
1414   PROCEDURE create_pxh_extension(
1415      p_api_version             IN  NUMBER
1416     ,p_init_msg_list           IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1417     ,x_return_status           OUT NOCOPY VARCHAR2
1418     ,x_msg_count               OUT NOCOPY NUMBER
1419     ,x_msg_data                OUT NOCOPY VARCHAR2
1420     ,p_pxh_rec                 IN  pxh_rec_type
1421     ,p_pxhl_tbl                IN  pxhl_tbl_type
1422     ,x_pxh_rec                 OUT NOCOPY pxh_rec_type
1423     ,x_pxhl_tbl                OUT NOCOPY pxhl_tbl_type) IS
1424     l_return_status            VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1425   BEGIN
1426   okl_pxh_pvt.insert_row(
1427                            p_api_version   => p_api_version
1428                           ,p_init_msg_list => p_init_msg_list
1429                           ,x_return_status => x_return_status
1430                           ,x_msg_count     => x_msg_count
1431                           ,x_msg_data      => x_msg_data
1432                           ,p_pxh_rec       => p_pxh_rec
1433                           ,p_pxhl_tbl      => p_pxhl_tbl
1434                           ,x_pxh_rec       => x_pxh_rec
1435                           ,x_pxhl_tbl      => x_pxhl_tbl
1436                           );
1437 
1438     IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1439        RAISE G_EXCEPTION_HALT_VALIDATION;
1440     ELSE
1441       IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
1442         l_return_status := x_return_status;
1443       END IF;
1444     END IF;
1445   -- Custom code if any
1446 
1447     EXCEPTION
1448       WHEN G_EXCEPTION_HALT_VALIDATION THEN
1449         NULL;
1450 
1451       WHEN OTHERS THEN
1452         OKC_API.SET_MESSAGE(p_app_name          => g_app_name
1453                            ,p_msg_name          => g_unexpected_error
1454                            ,p_token1            => g_sqlcode_token
1455                            ,p_token1_value      => sqlcode
1456                            ,p_token2            => g_sqlerrm_token
1457                            ,p_token2_value      => sqlerrm);
1458         x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1459   END create_pxh_extension;
1460 
1461   ----------------------------------------------------------------------------------
1462   -- Start of comments
1463   --
1464   -- Added for Bug# 6268782 : PRASJAIN
1465   --
1466   -- Procedure Name  : create_pxl_extension
1467   -- Description     : wrapper api for creating Transaction Extension
1468   -- Business Rules  :
1469   -- Parameters      : p_api_version ,p_init_msg_list,x_return_status
1470   --                  ,x_msg_count ,x_msg_data ,p_pxl_rec, p_pxll_tbl
1471   --                  ,x_pxl_rec, x_pxll_tbl
1472   -- Version         : 1.0
1473   -- End of comments
1474   ----------------------------------------------------------------------------------
1475   PROCEDURE create_pxl_extension(
1476      p_api_version                    IN  NUMBER
1477     ,p_init_msg_list                  IN  VARCHAR2 DEFAULT OKC_API.G_FALSE
1478     ,x_return_status                  OUT NOCOPY VARCHAR2
1479     ,x_msg_count                      OUT NOCOPY NUMBER
1480     ,x_msg_data                       OUT NOCOPY VARCHAR2
1481     ,p_pxl_rec                        IN  pxl_rec_type
1482     ,p_pxll_tbl                       IN  pxll_tbl_type
1483     ,x_pxl_rec                        OUT NOCOPY pxl_rec_type
1484     ,x_pxll_tbl                       OUT NOCOPY pxll_tbl_type) IS
1485     l_return_status                   VARCHAR2(1)   := OKC_API.G_RET_STS_SUCCESS;
1486    BEGIN
1487     okl_pxl_pvt.insert_row(
1488                            p_api_version   => p_api_version
1489                           ,p_init_msg_list => p_init_msg_list
1490                           ,x_return_status => x_return_status
1491                           ,x_msg_count     => x_msg_count
1492                           ,x_msg_data      => x_msg_data
1493                           ,p_pxl_rec       => p_pxl_rec
1494                           ,p_pxll_tbl      => p_pxll_tbl
1495                           ,x_pxl_rec       => x_pxl_rec
1496                           ,x_pxll_tbl      => x_pxll_tbl
1497                           );
1498       IF x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1499        RAISE G_EXCEPTION_HALT_VALIDATION;
1500       ELSE
1501         IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
1502           l_return_status := x_return_status;
1503            END IF;
1504       END IF;
1505   EXCEPTION
1506     WHEN G_EXCEPTION_HALT_VALIDATION THEN
1507       NULL;
1508     WHEN OTHERS THEN
1509       OKC_API.SET_MESSAGE(p_app_name          => g_app_name
1510                          ,p_msg_name          => g_unexpected_error
1511                          ,p_token1            => g_sqlcode_token
1512                          ,p_token1_value      => sqlcode
1513                          ,p_token2            => g_sqlerrm_token
1514                          ,p_token2_value      => sqlerrm);
1515         x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1516   END create_pxl_extension;
1517 END OKL_AP_EXTENSION_PVT;