[Home] [Help]
PACKAGE BODY: APPS.IEX_WF_REP_STATUS_PUB
Source
1 PACKAGE BODY IEX_WF_REP_STATUS_PUB AS
2 /* $Header: iexwfreb.pls 115.1 2002/03/01 09:43:41 pkm ship $ */
3 /*
4 * This procedure needs to be called with an itemtype and workflow process
5 * which'll launch workflow.
6 * This procedure is called to workflow to notify a Third Party for repossession
7 */
8
9 G_PKG_NAME CONSTANT VARCHAR2(30):= 'IEX_WF_REP_STATUS_PUB';
10
11 PROCEDURE start_workflow
12 (
13 p_api_version IN NUMBER := 1.0,
14 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
15 p_commit IN VARCHAR2 := FND_API.G_FALSE,
16 p_delinquency_id IN NUMBER,
17 p_repossession_id IN NUMBER,
18 p_third_party_id IN NUMBER,
19 p_third_party_name IN NUMBER,
20 p_status_yn IN NUMBER,
21 x_return_status OUT VARCHAR2,
22 x_msg_count OUT NUMBER,
23 x_msg_data OUT VARCHAR2
24 )
25 IS
26 l_result VARCHAR2(10);
27 itemtype VARCHAR2(10) ;
28 itemkey VARCHAR2(30);
29 workflowprocess VARCHAR2(30);
30
31 l_error_msg VARCHAR2(2000);
32 l_return_status VARCHAR2(20);
33 l_msg_count NUMBER;
34 l_msg_data VARCHAR2(2000);
35 l_api_name VARCHAR2(100) := 'START_WORKFLOW';
36 l_api_version_number CONSTANT NUMBER := 1.0;
37 BEGIN
38 -- Standard Start of API savepoint
39 SAVEPOINT START_WORKFLOW;
40
41 -- Standard call to check for call compatibility.
42 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
43 p_api_version,
44 l_api_name,
45 G_PKG_NAME)
46 THEN
47 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
48 END IF;
49
50
51 -- Initialize message list if p_init_msg_list is set to TRUE.
52 IF FND_API.to_Boolean( p_init_msg_list )
53 THEN
54 FND_MSG_PUB.initialize;
55 END IF;
56
57 -- Debug Message
58 AS_UTILITY_PVT.Debug_Message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW,
59 'Public API: ' || l_api_name || ' start');
60
61 AS_UTILITY_PVT.Debug_Message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW,
62 'Start time: ' || TO_CHAR(SYSDATE, 'HH24:MI:SSSSS'));
63
64
65 -- Initialize API return status to SUCCESS
66 x_return_status := FND_API.G_RET_STS_SUCCESS;
67
68 itemtype := 'IEXDELRE';
69 workflowprocess := 'REP_NOTE';
70
71 itemkey := TO_CHAR(p_repossession_id);
72
73 wf_engine.createprocess ( itemtype => itemtype,
74 itemkey => itemkey,
75 process => workflowprocess);
76
77 wf_engine.setitemattrnumber( itemtype => itemtype,
78 itemkey => itemkey,
79 aname => 'REPOSSESSION_ID',
80 avalue => to_number(itemkey));
81
82 wf_engine.setitemattrnumber( itemtype => itemtype,
83 itemkey => itemkey,
84 aname => 'DELINQUENCY_ID',
85 avalue => p_delinquency_id);
86
87 wf_engine.setitemattrnumber( itemtype => itemtype,
88 itemkey => itemkey,
89 aname => 'THIRD_PARTY_ID',
90 avalue => p_third_party_id);
91
92 wf_engine.setitemattrnumber( itemtype => itemtype,
93 itemkey => itemkey,
94 aname => 'THIRD_PARTY_NAME',
95 avalue => p_third_party_name);
96
97 wf_engine.setitemattrtext( itemtype => itemtype,
98 itemkey => itemkey,
99 aname => 'STATUS_YN',
100 avalue => p_status_yn);
101
102 wf_engine.startprocess( itemtype => itemtype,
103 itemkey => itemkey);
104 --DBMS_OUTPUT.PUT_LINE('START PROCESS');
105
106 wf_engine.ItemStatus( itemtype => ItemType,
107 itemkey => ItemKey,
108 status => l_return_status,
109 result => l_result);
110
111 if (l_return_status = 'COMPLETE') THEN
112 x_return_status := 'S';
113 commit;
114 else
115 x_return_status := 'F';
116 end if;
117 --DBMS_OUTPUT.PUT_LINE('GET ITEM STATUS = ' || l_return_status);
118 --DBMS_OUTPUT.PUT_LINE('GET ITEM result = ' || l_result);
119
120 -- Debug Message
121 AS_UTILITY_PVT.Debug_Message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW,
122 'PUB: ' || l_api_name || ' end');
123 AS_UTILITY_PVT.Debug_Message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, 'End time:'
124 || TO_CHAR(SYSDATE, 'HH24:MI:SSSSS'));
125
126 -- Standard call to get message count and if count is 1, get message info.
127 FND_MSG_PUB.Count_And_Get
128 ( p_count => x_msg_count,
129 p_data => x_msg_data
130 );
131
132 EXCEPTION
133 WHEN FND_API.G_EXC_ERROR THEN
134 as_utility_pvt.HANDLE_EXCEPTIONS(
135 P_API_NAME => L_API_NAME
136 ,P_PKG_NAME => G_PKG_NAME
137 ,P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_ERROR
138 ,P_PACKAGE_TYPE => AS_UTILITY_PVT.G_PUB
139 ,X_MSG_COUNT => X_MSG_COUNT
140 ,X_MSG_DATA => X_MSG_DATA
141 ,X_RETURN_STATUS => X_RETURN_STATUS);
142
143 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
144 as_utility_pvt.HANDLE_EXCEPTIONS(
145 P_API_NAME => L_API_NAME
146 ,P_PKG_NAME => G_PKG_NAME
147 ,P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR
148 ,P_PACKAGE_TYPE => AS_UTILITY_PVT.G_PUB
149 ,X_MSG_COUNT => X_MSG_COUNT
150 ,X_MSG_DATA => X_MSG_DATA
151 ,X_RETURN_STATUS => X_RETURN_STATUS);
152
153 WHEN OTHERS THEN
154 as_utility_pvt.HANDLE_EXCEPTIONS(
155 P_API_NAME => L_API_NAME
156 ,P_PKG_NAME => G_PKG_NAME
157 ,P_EXCEPTION_LEVEL => as_utility_pvt.G_EXC_OTHERS
158 ,P_PACKAGE_TYPE => AS_UTILITY_PVT.G_PUB
159 ,X_MSG_COUNT => X_MSG_COUNT
160 ,X_MSG_DATA => X_MSG_DATA
161 ,X_RETURN_STATUS => X_RETURN_STATUS);
162 ----------------------------------
163 END start_workflow;
164
165 ----------- procedure update_approval_status -----------------------------
166 PROCEDURE select_notice(itemtype IN varchar2,
167 itemkey IN varchar2,
168 actid IN number,
169 funcmode IN varchar2,
170 result OUT varchar2) is
171
172 l_responder VARCHAR2(100);
173 l_text_value VARCHAR2(2000);
174 l_status VARCHAR2(1);
175 l_repossession_id NUMBER;
176 l_delinquency_id NUMBER;
177 l_api_name VARCHAR2(100) := 'select_notice';
178 l_errmsg_name VARCHAR2(30);
179 L_API_ERROR EXCEPTION;
180
181 BEGIN
182
183 if funcmode <> 'RUN' then
184 result := wf_engine.eng_null;
185 return;
186 end if;
187
188 l_repossession_id := wf_engine.GetItemAttrText(
189 itemtype => itemtype,
190 itemkey => itemkey,
191 aname => 'REPOSSESSION_ID');
192
193
194 l_delinquency_id := wf_engine.GetItemAttrText(
195 itemtype => itemtype,
196 itemkey => itemkey,
197 aname => 'DELINQUENCY_ID');
198
199 l_status := wf_engine.GetItemAttrText(
200 itemtype => itemtype,
201 itemkey => itemkey,
202 aname => 'STATUS_YN');
203
204 IF l_status = 'Y' THEN
205 result := 'COMPLETE:'||'Y';
206 ELSE
207 result := 'COMPLETE:'||'N';
208 END IF;
209
210 EXCEPTION
211 WHEN L_API_ERROR then
212 WF_CORE.Raise(l_errmsg_name);
213 WHEN OTHERS THEN
214 WF_CORE.Context('IEX_WF_REP_STATUS_PUB', 'Select Notice',
215 itemtype, itemkey, actid, funcmode);
216 RAISE;
217 END select_notice;
218
219
220
221 END IEX_WF_REP_STATUS_PUB;