DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKC_KL_TERM_ASMBLR_PVT

Source


1 PACKAGE BODY OKC_KL_TERM_ASMBLR_PVT AS
2 /* $Header: OKCRKLTB.pls 120.0 2005/05/25 22:36:43 appldev noship $ */
3 
4 	l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
5 
6 PROCEDURE acn_assemble(
7   p_api_version       IN NUMBER,
8   p_init_msg_list     IN VARCHAR2 ,
9   x_return_status     OUT NOCOPY VARCHAR2,
10   x_msg_count         OUT NOCOPY NUMBER,
11   x_msg_data          OUT NOCOPY VARCHAR2,
12 
13   p_k_class		IN VARCHAR2,
14   p_k_id		IN NUMBER,
15   p_kl_id		IN NUMBER,
16   p_kl_term_date		IN DATE,
17   p_kl_term_reason		IN VARCHAR2,
18   p_k_number		IN VARCHAR2,
19   p_k_nbr_mod		IN VARCHAR2,
20   p_k_subclass		IN VARCHAR2,
21   p_kl_status_code		IN VARCHAR2,
22   p_estimated_amount		IN NUMBER  )  IS
23 
24  l_api_name     CONSTANT VARCHAR2(30) := 'acn_assemble';
25  l_api_version   CONSTANT NUMBER := 1.0;
26  i               NUMBER := 1;
27  l_corrid_rec    okc_aq_pvt.corrid_rec_typ;
28  l_msg_tbl       okc_aq_pvt.msg_tab_typ;
29  l_msg_count     number;
30  l_msg_data      varchar2(1000);
31  l_return_status varchar2(1);
32 
33  CURSOR cur_corr_csr IS
34  SELECT aae.element_name
35 	   ,aae.format_mask format_mask
36    FROM okc_actions_b acn,okc_action_attributes_b aae
37   WHERE acn.id = aae.acn_id
38     AND acn.correlation = 'KLTERM' ;
39 
40 BEGIN
41 
42  l_return_status := OKC_API.START_ACTIVITY
43                     (l_api_name
44                     ,p_init_msg_list
45                     ,'_PROCESS'
46                     ,x_return_status);
47 
48   IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
49      RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
50   ELSIF l_return_status = OKC_API.G_RET_STS_ERROR THEN
51      RAISE OKC_API.G_EXCEPTION_ERROR;
52   END IF;
53 
54  l_corrid_rec.corrid := 'KLTERM' ;
55 
56  -- check if action is enabled
57  IF OKC_K_SIGN_ASMBLR_PVT.isActionEnabled(l_corrid_rec.corrid) = 'Y' THEN
58 
59 
60 l_msg_tbl := okc_aq_pvt.msg_tab_typ();
61  FOR corr_rec IN cur_corr_csr
62  LOOP
63 
64  IF corr_rec.element_name = 'K_CLASS' THEN
65   l_msg_tbl.extend;
66   l_msg_tbl(i).element_name     := corr_rec.element_name;
67   l_msg_tbl(i).element_value    := P_k_class;
68  ELSIF corr_rec.element_name = 'K_ID' THEN
69    l_msg_tbl.extend;
70   l_msg_tbl(i).element_name    := corr_rec.element_name;
71   l_msg_tbl(i).element_value   := P_k_id;
72  ELSIF corr_rec.element_name = 'KL_ID' THEN
73    l_msg_tbl.extend;
74   l_msg_tbl(i).element_name    := corr_rec.element_name;
75   l_msg_tbl(i).element_value   := P_kl_id;
76  ELSIF corr_rec.element_name = 'KL_TERM_DATE' THEN
77    l_msg_tbl.extend;
78   l_msg_tbl(i).element_name    := corr_rec.element_name;
79   --l_msg_tbl(i).element_value   := P_kl_term_date;
80   IF corr_rec.format_mask IS NOT NULL THEN
81        l_msg_tbl(i).element_value := to_char(p_kl_term_date,
82 		      corr_rec.format_mask);
83   ELSE
84        l_msg_tbl(i).element_value := to_char(p_kl_term_date,'DD-MON-YY');
85   END IF;
86  ELSIF corr_rec.element_name = 'KL_TERM_REASON' THEN
87    l_msg_tbl.extend;
88   l_msg_tbl(i).element_name    := corr_rec.element_name;
89   l_msg_tbl(i).element_value   := P_kl_term_reason;
90  ELSIF corr_rec.element_name = 'K_NUMBER' THEN
91    l_msg_tbl.extend;
92   l_msg_tbl(i).element_name    := corr_rec.element_name;
93   l_msg_tbl(i).element_value   := P_k_number;
94  ELSIF corr_rec.element_name = 'K_NBR_MOD' THEN
95    l_msg_tbl.extend;
96   l_msg_tbl(i).element_name    := corr_rec.element_name;
97   l_msg_tbl(i).element_value   := P_k_nbr_mod;
98  ELSIF corr_rec.element_name = 'K_SUBCLASS' THEN
99    l_msg_tbl.extend;
100   l_msg_tbl(i).element_name    := corr_rec.element_name;
101   l_msg_tbl(i).element_value   := P_k_subclass;
102  ELSIF corr_rec.element_name = 'KL_STATUS_CODE' THEN
103    l_msg_tbl.extend;
104   l_msg_tbl(i).element_name    := corr_rec.element_name;
105   l_msg_tbl(i).element_value   := P_kl_status_code;
106  ELSIF corr_rec.element_name = 'ESTIMATED_AMOUNT' THEN
107    l_msg_tbl.extend;
108   l_msg_tbl(i).element_name    := corr_rec.element_name;
109   l_msg_tbl(i).element_value   := P_estimated_amount;
110  END IF;
111 
112   i := i + 1;
113  END LOOP;
114 
115 
116 
117 
118   OKC_AQ_PUB.send_message(p_api_version     =>1.0
119                          ,x_msg_count       => l_msg_count
120                          ,x_msg_data        => l_msg_data
121                          ,x_return_status   => l_return_status
122                          ,p_corrid_rec      => l_corrid_rec
123                          ,p_msg_tab         => l_msg_tbl
124                          ,p_queue_name      => okc_aq_pvt.g_event_queue_name);
125 
126     IF l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
127         RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
128     ELSIF l_return_status = OKC_API.G_RET_STS_ERROR THEN
129         RAISE OKC_API.G_EXCEPTION_ERROR;
130     END IF;
131 END IF; -- OKC_K_SIGN_ASMBLR_PVT.isActionEnabled
132  OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
133 
134 EXCEPTION
135  WHEN OKC_API.G_EXCEPTION_ERROR THEN
136   x_return_status := OKC_API.HANDLE_EXCEPTIONS
137                        (l_api_name,
138                         G_PKG_NAME,
139                       'OKC_API.G_RET_STS_ERROR',
140                         x_msg_count,
141                         x_msg_data,
142                         '_PROCESS');
143  WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
144   x_return_status := OKC_API.HANDLE_EXCEPTIONS
145                        (l_api_name,
146                         G_PKG_NAME,
147                        'OKC_API.G_RET_STS_UNEXP_ERROR',
148                         x_msg_count,
149                         x_msg_data,
150                         '_PROCESS');
151  WHEN OTHERS THEN
152   x_return_status := OKC_API.HANDLE_EXCEPTIONS
153                        (l_api_name,
154                         G_PKG_NAME,
155                         'OTHERS',
156                         x_msg_count,
157                         x_msg_data,
158                         '_PROCESS');
159 END acn_assemble;
160 
161 END OKC_KL_TERM_ASMBLR_PVT;