[Home] [Help]
PACKAGE BODY: APPS.HR_KI_WF_MISC
Source
1 PACKAGE BODY hr_ki_wf_misc AS
2 /* $Header: hrkiwfms.pkb 120.1 2005/08/31 00:12 santosin noship $ */
3 PROCEDURE RAISE_EVENT
4 ( p_party_site_id IN NUMBER
5 , p_party_id IN NUMBER
6 , p_event_name IN VARCHAR2
7 default 'oracle.apps.per.ki.tradingpartner.initiate'
8 , p_party_type IN VARCHAR2 DEFAULT 'I'
9 , p_response_expected IN VARCHAR2 DEFAULT 'T'
10 , p_event_key OUT NOCOPY NUMBER
11 )
12 IS
13 l_joining_value_1 VARCHAR2(100) DEFAULT '2';
14 l_transaction_type VARCHAR2(100) DEFAULT 'HR';
15 l_transaction_subtype VARCHAR2(100) DEFAULT 'SIO';
16 l_parameter_list wf_parameter_list_t;
17 l_event_key NUMBER;
18 l_user_name VARCHAR2(100);
19 BEGIN
20 --
21 -- Obtain a unique eventkey, which is based on a sequence
22 --
23 SELECT hr_ki_be_s.nextval INTO l_event_key FROM dual;
24 --
25 -- Set required profile values
26 --
27 l_user_name := fnd_profile.value('USERNAME');
28 --
29 -- Now build up the parameter list to pass into the Business Event.
30 --
31 wf_event.AddParameterToList(
32 p_name => 'USER'
33 ,p_value => l_user_name
34 ,p_parameterlist=> l_parameter_list
35 );
36 wf_event.AddParameterToList(
37 p_name => 'RESPONSE_EXPECTED'
38 ,p_value => p_response_expected
39 ,p_parameterlist=> l_parameter_list
40 );
41 wf_event.AddParameterToList (
42 p_name => 'TRANSACTION_TYPE'
43 ,p_value => l_transaction_type
44 ,p_parameterlist=> l_parameter_list
45 );
46 wf_event.AddParameterToList(
47 p_name => 'TRANSACTION_SUBTYPE'
48 ,p_value => l_transaction_subtype
49 ,p_parameterlist=> l_parameter_list
50 );
51 wf_event.AddParameterToList(
52 p_name => 'PARTY_ID'
53 ,p_value => p_party_id
54 ,p_parameterlist=> l_parameter_list
55 );
56 wf_event.AddParameterToList(
57 p_name => 'PARTY_SITE_ID'
58 ,p_value => p_party_site_id
59 ,p_parameterlist=> l_parameter_list
60 );
61 wf_event.AddParameterToList(
62 p_name => 'PARTY_TYPE'
63 ,p_value => p_party_type
64 ,p_parameterlist=> l_parameter_list
65 );
66 wf_event.AddParameterToList(
67 p_name => 'DOCUMENT_ID'
68 ,p_value => l_joining_value_1
69 ,p_parameterlist=> l_parameter_list
70 );
71 --
72 -- Raise the Business Event with the parameter list and sequence
73 --
74 wf_event.raise(
75 p_event_name => p_event_name
76 ,p_event_key => l_event_key
77 ,p_parameters => l_parameter_list
78 );
79 --
80 -- Set the OUT parameter
81 --
82 p_event_key := l_event_key;
83 --
84 EXCEPTION
85 WHEN OTHERS THEN
86 raise;
87 END ;
88
89
90 PROCEDURE ConfirmBodEnabled(
91 itemtype in VARCHAR2,
92 itemkey in VARCHAR2,
93 actid in NUMBER,
94 funcmode in VARCHAR2,
95 result in out NOCOPY VARCHAR2)
96 IS
97
98 l_trans_type ecx_tp_details_v.transaction_type%type;
99 l_trans_subtype ecx_tp_details_v.transaction_subtype%type;
100 l_party_id ecx_tp_headers_v.party_id%type;
101 l_party_site_id ecx_tp_headers_v.party_site_id%type;
102
103 l_enabled number;
104 BEGIN
105 if (funcmode = 'RUN') then
106
107 l_party_id := wf_engine.GetItemAttrText( itemtype =>itemtype,
108 itemkey =>itemkey,
109 aname =>'PARTY_ID');
110
111 l_party_site_id:=wf_engine.GetItemAttrText( itemtype =>itemtype,
112 itemkey =>itemkey,
113 aname =>'PARTY_SITE_ID');
114
115 l_trans_type := wf_engine.GetItemAttrText( itemtype =>itemtype,
116 itemkey =>itemkey,
120 itemkey =>itemkey,
117 aname =>'TRANSACTION_TYPE');
118
119 l_trans_subtype := wf_engine.GetItemAttrText( itemtype =>itemtype,
121 aname =>'TRANSACTION_SUBTYPE');
122
123
124 select etd.confirmation
125 into l_enabled
126 from ecx_tp_headers_v eth
127 ,ecx_tp_details_v etd
128 where eth.tp_header_id=etd.tp_header_id
129 and eth.party_id = l_party_id
130 and eth.party_site_id =l_party_site_id
131 and etd.transaction_type=l_trans_type
132 and etd.transaction_subtype=l_trans_subtype;
133
134 if (l_enabled = 0 or l_enabled= 1) Then
135 result := 'F';
136 else
137 result := 'T';
138 end if;
139
140 return;
141 end if;
142 exception
143 when others then
144 wf_core.context('WF_KI', 'ConfirmBodEnabled', itemtype, itemkey
145 , actid, funcmode);
146 raise;
147 END ConfirmBodEnabled;
148
149 PROCEDURE ConfirmBodError(
150 itemtype in VARCHAR2,
151 itemkey in VARCHAR2,
152 actid in NUMBER,
153 funcmode in VARCHAR2,
154 result in out NOCOPY VARCHAR2)
155 is
156 l_statuslvl varchar2(5);
157 l_url varchar2(1000);
158 unknown_error exception;
159
160 begin
161
162 if (funcmode = 'RUN') then
163
164 l_statuslvl := wf_engine.GetItemAttrText (itemtype =>itemtype,
165 itemkey =>itemkey,
166 aname =>'PARAMETER6');
167
168 l_url := wf_engine.GetItemAttrText (itemtype =>itemtype,
169 itemkey =>itemkey,
170 aname =>'PARAMETER7');
171 --insert into rq_table values(l_url,itemkey);
172
173 if l_statuslvl = '00' then
174 result :='F';
175 elsif l_statuslvl = '99' then
176 result :='T';
177 else
178 raise unknown_error;
179 end if;
180
181
182 end if;
183
184 return;
185 exception
186 when others then
187 wf_core.context('WF_KI', 'ConfirmBodError', itemtype, itemkey
188 , actid, funcmode);
189 raise;
190
191 end ConfirmBodError;
192
193 PROCEDURE isResponseRequired(
194 itemtype in VARCHAR2,
195 itemkey in VARCHAR2,
196 actid in NUMBER,
197 funcmode in VARCHAR2,
198 result in out NOCOPY VARCHAR2)
199 IS
200 l_response varchar2(100);
201 begin
202
203 if (funcmode = 'RUN') then
204 -- Set the flag RECEIVED_XML_FLAG to F.
205 -- This will get set to T once the XML is
206 -- received (should there be any to receive)
207 wf_engine.SetItemAttrText
208 (itemtype => itemtype
209 ,itemkey => itemkey
210 ,aname =>'RECEIVED_XML_FLAG'
211 ,avalue=>'F'
212 );
213 --
214 result :=NVL(wf_engine.GetItemAttrText
215 (itemtype => itemtype
216 ,itemkey => itemkey
217 ,aname =>'RESPONSE_EXPECTED'),'F');
218 --
219 end if;
220 --
221 exception
222 when others then
223 wf_core.context('WF_KI', 'IsResponseRequired', itemtype, itemkey
224 , actid, funcmode);
225 raise;
226 --
227 End isResponseRequired;
228
229 PROCEDURE AlterReceivedFlag(
230 itemtype in VARCHAR2,
231 itemkey in VARCHAR2,
232 actid in NUMBER,
233 funcmode in VARCHAR2,
234 result in out NOCOPY VARCHAR2)
235 is
236 --
237 begin
238
239 if (funcmode = 'RUN') then
240
241 wf_engine.SetItemAttrText
242 (itemtype => itemtype
243 ,itemkey => itemkey
244 ,aname =>'RECEIVED_XML_FLAG'
245 ,avalue=>'T'
246 );
247 end if;
248 result := 'COMPLETE';
249
250 exception
251 when others then
252 wf_core.context('WF_KI', 'AlterReceivedFlag', itemtype, itemkey
253 , actid, funcmode);
254 raise;
255 --
256 END AlterReceivedFlag;
257
258 FUNCTION HasResponseArrived(
259 itemkey in VARCHAR2
260 ) return BOOLEAN
261 is
262 l_itemtype varchar2(10) := 'HR_KI';
263 l_result varchar2(10);
264 begin
265 -- get the value of the item_attribute RECEIVED_XML_FLAG and return true
266 -- if RECEIVED_XML_FLAG = 'T'
267
268 l_result := wf_engine.GetItemAttrText
269 (itemtype => l_itemtype
270 ,itemkey => itemkey
271 ,aname =>'RECEIVED_XML_FLAG');
272 if l_result = 'T' then
273 return TRUE;
274 else
275 return FALSE;
276 end if;
277
278 end HasResponseArrived;
279 --
280 PROCEDURE ContinueWorkflow(
281 itemkey in VARCHAR2,
282 another_response_expected in BOOLEAN DEFAULT FALSE)
283 is
284 l_itemtype varchar2(10) := 'HR_KI';
285 l_response_expected varchar2(5);
286 l_event_name varchar2(50) := 'oracle.apps.per.ki.tradingpartner.continue';
287 begin
288 -- set the value of the item_attribute RESPONSE_EXPECTED and raise the
289 -- continue event
290 if another_response_expected then
291 l_response_expected := 'T';
292 else
293 l_response_expected := 'F';
294 end if;
295
296 wf_engine.SetItemAttrText
297 (itemtype => l_itemtype
298 ,itemkey => itemkey
299 ,aname =>'RESPONSE_EXPECTED'
300 ,avalue=> l_response_expected
301 );
302
303 wf_event.raise(
304 p_event_name => l_event_name
305 ,p_event_key => itemkey
306 );
307
308 end ContinueWorkFlow;
309 END hr_ki_wf_misc;