DBA Data[Home] [Help]

PACKAGE BODY: APPS.CSFW_SERVICEREQUEST_PUB

Source


1 PACKAGE BODY csfw_servicerequest_pub AS
2 /*  $Header: csfwpsrb.pls 120.3 2006/02/09 00:10:45 hgotur noship $ */
3 /*===========================================================================+
4  |  PROCEDURE NAME                                                           |
5  |    update_request_resolution                                              |
6  |                                                                           |
7  |  DESCRIPTION                                                              |
8  |    To update the resolution of a service request (=Incident)              |
9  |                                                                           |
10  |  NOTES                                                                    |
11  |    Error handling is not yet implemented!!!                               |
12  |                                                                           |
13  |  DEPENDENCIES                                                             |
14  |                                                                           |
15  |  HISTORY                                                                  |
16  |    18-JAN-2001  M. Raap  Created.                                         |
17  |                                                                           |
18  |    11-JUN-2001  P. Giri edited for an extra )  at line 269                |
19  |    30-AUG-2004  pgiri     Added parameters for spares to use this API     |
20  |                           API update_request_resolution                   |
21  |                                                                           |
22  |    23-oct-2004  pgiri   Added new parameter to update_request_resolution  |
23  |                                                                           |
24  +===========================================================================*/
25 PROCEDURE update_request_resolution
26   ( p_incident_id     IN  NUMBER
27   , p_resolution_code IN  VARCHAR2
28   , P_RESOLUTION_SUMMARY IN  VARCHAR2
29   , p_problem_code IN varchar2
30   , p_cust_po_number   IN varchar2
31   , p_commit       IN Boolean
32   , p_init_msg_list  IN BOOLEAN
33   , X_RETURN_STATUS   OUT NOCOPY VARCHAR2
34   , X_MSG_COUNT       OUT NOCOPY INTEGER
35   , X_MSG_DATA        OUT NOCOPY VARCHAR2
36   , p_object_version_number IN NUMBER default null
37   )
38 IS
39 
40   l_return_status        VARCHAR2(10);
41   l_msg_count            NUMBER;
42   l_msg_data             VARCHAR2(2000);
43 
44   l_counter              NUMBER(3);
45   l_data                 VARCHAR2(2000);
46   l_msg_index_out        NUMBER;
47 
48   lr_service_request_rec cs_servicerequest_pub.service_request_rec_type;
49   lt_notes_tab           cs_servicerequest_pub.notes_table;
50   lt_contacts_tab        cs_servicerequest_pub.contacts_table;
51 
52   l_workflow_process_id  NUMBER;
53   l_interaction_id       NUMBER;
54 
55   l_user_id	NUMBER;
56   l_object_version_number NUMBER;
57   l_incident_number varchar2(30);
58   l_type_id number;
59   L_LAST_UPDATE_PROGRAM_CODE VARCHAR2(30);
60   l_msg varchar2(250);
61   r_msg varchar2(250);
62 
63 cursor c_version(v_incident_id number) is
64 select object_version_number from cs_incidents_all_vl where incident_id = v_incident_id;
65 
66 cursor c_incident_type_id (v_incident_id number) is
67 select INCIDENT_TYPE_ID,
68        incident_number,
69        LAST_UPDATE_PROGRAM_CODE
70   from cs_incidents_all_b where incident_id = v_incident_id;
71 
72 r_incident_type_id           c_incident_type_id%ROWTYPE;
73 
74 BEGIN
75   l_user_id := FND_GLOBAL.user_id ;
76 
77     if p_init_msg_list then
78         fnd_msg_pub.initialize;
79     end if;
80 
81 IF p_object_version_number IS NULL THEN
82   open c_version(p_incident_id);
83   fetch c_version into l_object_version_number;
84   close c_version ;
85 ELSE
86  l_object_version_number := p_object_version_number ;
87 END IF;
88 
89   cs_servicerequest_pub.initialize_rec
90     ( p_sr_record => lr_service_request_rec
91     );
92 
93 
94   open c_incident_type_id(p_incident_id);
95   fetch c_incident_type_id into r_incident_type_id ;
96   close c_incident_type_id ;
97 
98   l_type_id := r_incident_type_id.INCIDENT_TYPE_ID;
99 --  l_incident_number := r_incident_type_id.incident_number;
100   L_LAST_UPDATE_PROGRAM_CODE:= r_incident_type_id.LAST_UPDATE_PROGRAM_CODE;
101 
102 --dbms_output.put_line(' in csfw pub statring with incident '||p_incident_id);
103 
104   lr_service_request_rec.resolution_code := p_resolution_code;
105 
106   if P_RESOLUTION_SUMMARY IS NOT NULL THEN
107 	lr_service_request_rec.resolution_summary := P_RESOLUTION_SUMMARY;
108   END IF;
109 
110   IF  p_problem_code IS NOT NULL THEN
111     lr_service_request_rec.problem_code := p_problem_code;
112   END IF;
113 
114   IF  p_cust_po_number IS NOT NULL THEN
115     lr_service_request_rec.cust_po_number := p_cust_po_number;
116   END IF;
117 
118   lr_service_request_rec.type_id          := l_type_id;
119   lr_service_request_rec.last_update_program_code :=L_LAST_UPDATE_PROGRAM_CODE;
120 
121   cs_servicerequest_pub.update_servicerequest
122     (
123   p_api_version            => 3.0 ,
124   p_init_msg_list          => FND_API.G_FALSE,
125   p_commit                 => FND_API.G_TRUE,
126   x_return_status          => l_return_status,
127   x_msg_count              => l_msg_count,
128   x_msg_data               => l_msg_data,
129   p_request_id             => p_incident_id,
130   p_request_number         => null,--l_incident_number,
131   p_audit_comments         => NULL,
132   p_object_version_number  => l_object_version_number,
133   p_resp_appl_id           => NULL,
134   p_resp_id                => NULL,
135   p_last_updated_by        => l_user_id ,
136   p_last_update_login      => NULL,
137   p_last_update_date       => sysdate ,
138   p_service_request_rec    => lr_service_request_rec,
139   p_notes                  => lt_notes_tab,
140   p_contacts               => lt_contacts_tab,
141   p_called_by_workflow     => FND_API.G_FALSE,
142   p_workflow_process_id    => NULL,
143   x_workflow_process_id    => l_workflow_process_id,
144   x_interaction_id         => l_interaction_id
145     );
146 
147 
148 --dbms_output.put_line(' in csfw pub , cs_pub returned status =  '||l_return_status);
149 
150     X_RETURN_STATUS         := l_return_status;       -- output-parameter
151     X_MSG_COUNT             := l_msg_count;           -- output-parameter
152 
153     --dbms_output.put_line('return_status: '||l_return_status);
154   IF l_return_status = FND_API.G_RET_STS_SUCCESS
155   THEN
156      if p_commit then
157       commit;
158      end if;
159   ELSE
160       FOR l_counter IN 1 .. l_msg_count
161       LOOP
162         fnd_msg_pub.get
163           ( p_msg_index     => l_counter
164           , p_encoded       => FND_API.G_FALSE
165           , p_data          => l_data
166           , p_msg_index_out => l_msg_index_out
167           );
168         --dbms_output.put_line( 'Message: '||l_data );
169       END LOOP ;
170       X_MSG_DATA := l_data;
171   END IF;
172 
173 EXCEPTION
174   WHEN OTHERS
175   THEN
176     --dbms_output.put_line('Exception');
177     --dbms_output.put_line(SQLERRM);
178     X_MSG_DATA := SQLERRM;
179 END update_request_resolution;
180 
181 /*===========================================================================+
182  |  PROCEDURE NAME                                                           |
183  |    get_reaction_time                                                      |
184  |                                                                           |
185  |  DESCRIPTION                                                              |
186  |    To retrieve the reaction time, specified in a contract, of a service   |
187  |    request (=Incident)                                                    |
188  |                                                                           |
189  |  NOTES                                                                    |
190  |    Error handling is not yet implemented!!!                               |
191  |                                                                           |
192  |  DEPENDENCIES                                                             |
193  |                                                                           |
194  |  HISTORY                                                                  |
195  |    23-JAN-2001  M. Raap  Created.
196  |    01-MAY-2001  mmerchan  Contract Number added for reaction time
197  |    14-NOV-2001  mmerchan  contract service id returned
198  |                                                                           |
199  +===========================================================================*/
200 PROCEDURE get_reaction_time
201   ( p_incident_id   IN  NUMBER
202   , p_task_id       IN  NUMBER
203   , p_resource_id   IN  NUMBER
204   , p_error_type    OUT NOCOPY NUMBER
205   , p_error         OUT NOCOPY VARCHAR2
206   , x_react_within  OUT NOCOPY NUMBER
207   , x_react_tuom    OUT NOCOPY VARCHAR2
208   , x_react_by_date OUT NOCOPY VARCHAR2
209   , x_contract_service_id OUT NOCOPY NUMBER
210   , x_contract_number OUT NOCOPY VARCHAR2
211   , x_txn_group_id OUT NOCOPY NUMBER
212   )
213 IS
214 
215 
216   CURSOR c_incident
217     ( b_incident_id cs_incidents_all_b.incident_id%TYPE
218     )
219   IS
220     SELECT ci_all_b.incident_date   incident_date    -- bug # 4337147
221     ,      ci_all_b.incident_severity_id incident_severity_id
222     ,      ci_all_b.contract_service_id  contract_service_id
223     ,      cit.business_process_id       business_process_id
224     ,	   ci_all_b.contract_number	 contract_number
225     FROM   cs_incidents_all_b ci_all_b
226     ,      cs_incident_types  cit
227     WHERE  ci_all_b.incident_type_id = cit.incident_type_id
228     AND    ci_all_b.incident_id      = b_incident_id;
229 
230   -- cursor is modified
231   -- bug # 4337147
232   CURSOR C_TXN_GROUP_ID(v_business_process_id NUMBER,
233 	v_contract_service_id NUMBER)
234   IS
235    SELECT BPL.Id
236    FROM OKS_K_Lines_B KSL,
237         OKC_K_LINES_B BPL
238   WHERE KSL.Cle_ID = v_contract_service_id
239     AND BPL.Cle_ID = KSL.COVERAGE_ID
240     AND BPL.Lse_Id IN (3,16,21)
241     AND EXISTS (SELECT 'x'
242                    FROM OKC_K_Items BIT
243                   WHERE BIT.Cle_id = BPL.Id
244                     AND Object1_Id1 = v_business_process_id
245                     AND Jtot_Object1_Code = 'OKX_BUSIPROC');
246    /*
247   Select a.id
248   from okc_k_lines_b a
249   where a.lse_id in (3,16,21)
250   and exists (select 'x'
251    	      from okc_k_items
252               where cle_id = a.id and
253               object1_id1 = v_business_process_id and
254               jtot_object1_code = 'OKX_BUSIPROC')
255   connect by a.cle_id = prior(a.id)
256   start with a.id = v_contract_service_id;
257   */
258 
259   r_incident           c_incident%ROWTYPE;
260 
261   --l_server_timezone_id VARCHAR2(200);
262   l_server_timezone_id NUMBER;
263   l_server_timezone_name VARCHAR2(200);
264 
265   l_counter            NUMBER(3);
266   l_data               VARCHAR2(2000);
267   l_msg_index_out      NUMBER;
268   l_return_status      VARCHAR2(10);
269   l_msg_count          NUMBER;
270   l_msg_data           VARCHAR2(200);
271   l_react_by_date DATE;
272   l_date_format        varchar(20);
273   p_inp_rec     oks_entitlements_pub.grt_inp_rec_type;
274   x_resolve_rec oks_entitlements_pub.rcn_rsn_rec_type;
275   x_react_rec   oks_entitlements_pub.rcn_rsn_rec_type;
276   l_client_tz_id number;
277   l_server_tz_id number;
278   l_client_date date;
279 
280 
281 BEGIN
282 
283   p_error_type := 0; -- Assume success
284 
285 
286   OPEN c_incident
287     ( b_incident_id => p_incident_id
288     );
289   FETCH c_incident
290   INTO r_incident;
291   CLOSE c_incident;
292 
293   --dbms_output.put_line('INCIDENT_DATE: '||r_incident.incident_date);
294   --dbms_output.put_line('INCIDENT_SEVERITY_ID: '||r_incident.incident_severity_id);
295   --dbms_output.put_line('CONTRACT_SERVICE_ID: '||r_incident.contract_service_id);
296   --dbms_output.put_line('CONTRACT_NUMBER: '||r_incident.contract_number);
297   --dbms_output.put_line('BUSINESS_PROCESS_ID: '||r_incident.business_process_id);
298 
299   /*
300   FND_PROFILE.Get
301     ( name => 'SERVER_TIMEZONE_ID'
302     , val  => l_server_timezone_id
303     );
304   */
305   -- bug # 4337147
306   -- Get timezone using SR API
307   CS_TZ_GET_DETAILS_PVT.CUSTOMER_PREFERRED_TIME_ZONE
308   ( p_incident_id             => p_incident_id
309   , p_task_id                 => p_task_id
310   , p_resource_id             => p_resource_id
311   , p_cont_pref_time_zone_id  => NULL
312   , p_incident_location_id    => NULL
313   , p_incident_location_type  => NULL
314   , p_contact_party_id        => NULL
315   , p_contact_phone_id        => NULL
316   , p_contact_address_id      => NULL
317   , p_customer_id             => NULL
318   , p_customer_phone_id       => NULL
319   , p_customer_address_id     => NULL
320   , x_timezone_id             => l_server_timezone_id
321   , x_timezone_name           => l_server_timezone_name
322   );
323 
324   --dbms_output.put_line('SERVER_TIMEZONE_ID: '||l_server_timezone_id);
325 
326   IF r_incident.contract_service_id IS NULL
327   THEN
328     /* There is no contract attached to incident */
329     --dbms_output.put_line('No contract for this service request');
330     p_error_type := 2; -- No Contract
331     --- not translated message. JSP should translate
332     p_error := 'No contract for this service request';
333   ELSE
334 
335     x_contract_service_id := r_incident.contract_service_id;
336     x_contract_number := r_incident.contract_number;
337 
338     p_inp_rec.contract_line_id     := r_incident.contract_service_id;
339     p_inp_rec.business_process_id  := r_incident.business_process_id;
340     p_inp_rec.severity_id          := r_incident.incident_severity_id;
341     p_inp_rec.request_date         := r_incident.incident_date;
342     p_inp_rec.time_zone_id         := l_server_timezone_id;
343     p_inp_rec.category_rcn_rsn     := oks_entitlements_pub.G_RESOLUTION;
344     p_inp_rec.compute_option       := oks_entitlements_pub.G_FIRST;
345 
346     /* There is a contract attached to the incident. Retrieve reaction time. */
347      oks_entitlements_pub.get_react_resolve_by_time
348     (p_api_version		=> 1.0
349     ,p_init_msg_list		=> FND_API.G_TRUE
350     ,p_inp_rec                  => p_inp_rec
351     ,x_return_status 		=> l_return_status
352     ,x_msg_count		=> l_msg_count
353     ,x_msg_data			=> l_msg_data
354     ,x_react_rec                => x_react_rec
355     ,x_resolve_rec              => x_resolve_rec);
356 
357 
358      /* Find the contract line id / txn group id associated with the business
359 	process for the contract related to the service request */
360      x_txn_group_id := -1;
361      OPEN C_TXN_GROUP_ID(r_incident.business_process_id,
362 	r_incident.contract_service_id);
363      FETCH C_TXN_GROUP_ID
364      INTO x_txn_group_id;
365      CLOSE C_TXN_GROUP_ID;
366 
367 /*
368     oks_entitlements_pub.check_reaction_times
369       ( p_api_version         => 1.0
370       , p_init_msg_list       => FND_API.G_TRUE
371       , p_business_process_id => r_incident.business_process_id
372       , p_request_date        => r_incident.incident_date
373       , p_sr_severity         => r_incident.incident_severity_id
374       , p_time_zone_id        => l_server_timezone_id
375       , p_contract_line_id    => r_incident.contract_service_id
376       , x_return_status       => l_return_status
377       , x_msg_count           => l_msg_count
378       , x_msg_data            => l_msg_data
379       , x_react_within        => x_react_within
380       , x_react_tuom          => x_react_tuom
381       , x_react_by_date       => l_react_by_date
382       );
383   */
384 
385     IF l_return_status = FND_API.G_RET_STS_SUCCESS
386     THEN
387       /* API-call was successfull */
388 	 --dbms_output.put_line('duration: '||x_resolve_rec.duration);
389          --dbms_output.put_line('uom: '||x_resolve_rec.uom);
390          --dbms_output.put_line('by_date_end: '||to_char(x_resolve_rec.by_date_end, 'MM/DD/YYYY HH24:MI:SS'));
391 
392 	 -- Lets get the Resolution record's values;
393 	 -- l_react_by_date is actually the resolve by date.
394 	 -- We used to use it for React time which is now obsolete
395 	   x_react_within        := x_resolve_rec.duration;
396 	   x_react_tuom          := x_resolve_rec.uom;
397 	   l_react_by_date := x_resolve_rec.by_date_end;
398 
399 
400 		-- bug 3035563 l_react_by_date to Convert to timezone of the client(found in 11.5.8)
401 		l_react_by_date := CSFW_TIMEZONE_PUB.GET_CLIENT_TIME(l_react_by_date);
402 
403 		 -- Now get the profile option to get the data
404 		FND_PROFILE.GET ( 'CSFWDATEFORMAT' , l_date_format);
405 
406 		IF l_date_format = 'DD-MM-YYYY'
407 		THEN
408 			 x_react_by_date := to_char(l_react_by_date, 'DD-MM-YYYY HH24:MI:SS');
409 		ELSIF l_date_format = 'DD/MM/YYYY'
410 		THEN
411 			 x_react_by_date := to_char(l_react_by_date, 'DD/MM/YYYY HH24:MI:SS');
412 		ELSIF l_date_format = 'MM-DD-YYYY'
413 		THEN
414 			 x_react_by_date := to_char(l_react_by_date, 'MM-DD-YYYY HH24:MI:SS');
415 		ELSIF l_date_format = 'MM/DD/YYYY'
416 		THEN
417 			 x_react_by_date := to_char(l_react_by_date, 'MM/DD/YYYY HH24:MI:SS');
418 		ELSIF l_date_format = 'YYYY-MM-DD'
419 		THEN
420 			 x_react_by_date := to_char(l_react_by_date, 'YYYY-MM-DD HH24:MI:SS');
421 		ELSIF l_date_format = 'YYYY/MM/DD'
422 		THEN
423 			 x_react_by_date := to_char(l_react_by_date, 'YYYY/MM/DD HH24:MI:SS');
424 
425 		ELSIF l_date_format = 'DD-MM-YY'
426 		THEN
427 			 x_react_by_date := to_char(l_react_by_date, 'DD-MM-YY HH24:MI:SS');
428 		ELSIF l_date_format = 'DD/MM/YY'
429 		THEN
430 			 x_react_by_date := to_char(l_react_by_date, 'DD/MM/YY HH24:MI:SS');
431 		ELSIF l_date_format = 'MM-DD-YY'
432 		THEN
433 			 x_react_by_date := to_char(l_react_by_date, 'MM-DD-YY HH24:MI:SS');
434 		ELSIF l_date_format = 'MM/DD/YY'
435 		THEN
436 			 x_react_by_date := to_char(l_react_by_date, 'MM/DD/YY HH24:MI:SS');
437 		ELSIF l_date_format = 'YY-MM-DD'
438 		THEN
439 			 x_react_by_date := to_char(l_react_by_date, 'YY-MM-DD HH24:MI:SS');
440 		ELSIF l_date_format = 'YY/MM/DD'
441 		THEN
442 			 x_react_by_date := to_char(l_react_by_date, 'YY/MM/DD HH24:MI:SS');
443 		ELSE
444 			x_react_by_date := to_char(l_react_by_date, 'DD/MM/YYYY HH24:MI:SS');
445 		END IF;
446 
447     ELSE
448       /* API-call was unsuccessfull */
449          --dbms_output.put_line('Error retrieving reaction time through API');
450          --dbms_output.put_line('return_status: '||l_return_status);
451          --dbms_output.put_line('msg_count: '||l_msg_count);
452          --dbms_output.put_line('msg_data: '||l_msg_data);
453       /* To display the error-messages */
454     BEGIN
455       FOR l_counter IN 1 .. l_msg_count
456       LOOP
457         fnd_msg_pub.get
458           ( p_msg_index     => l_counter
459           , p_encoded       => FND_API.G_FALSE
460           , p_data          => l_data
461           , p_msg_index_out => l_msg_index_out
462           );
463         --dbms_output.put_line( 'Message: '||l_data );
464       END LOOP ;
465         p_error_type := 1; -- Failure
466         p_error := l_data;
467      EXCEPTION
468 	WHEN OTHERS THEN
469 		p_error_type := 1; -- Failure
470         	p_error := 'Cant get FND msg';
471      END;
472     END IF;
473   END IF;
474 
475 EXCEPTION
476   WHEN OTHERS
477   THEN
478        --dbms_output.put_line('Exception');
479        --dbms_output.put_line(SQLERRM);
480         p_error_type := -1;-- Failure
481         p_error := SQLERRM;
482 END get_reaction_time;
483 
484 /* Get Billing Types
485 PROCEDURE get_billing_types
486 
487     SELECT billing_type, name, to_char(txn_group_id)
488     from OKS_ENT_BILL_TYPES_V
489     where txn_group_id = b_contract_service_id;
490 
491     SELECT covered_amount, covered_percent
492     from OKS_ENT_BILL_TYPES_V
493     where txn_group_id = b_contract_service_id
494     and billing_type = b_billing_type;
495 
496 
497 
498 END get_billing_types;
499 */
500 
501 
502 
503 /*===========================================================================+
504  |  PROCEDURE NAME                                                           |
505  |    update_request_flex						     |
506  |                                                                           |
507  |  DESCRIPTION                                                              |
508  |    Wrapper on update_servicerequest for updating task fled field	     |
509  |                                                                           |
510  |  DEPENDENCIES                                                             |
511  |                                                                           |
512  |  HISTORY                                                                  |
513  |  20-Apr-2005 hgotur	Created                                              |
514  |                                                                           |
515  +===========================================================================*/
516 PROCEDURE update_request_flex
517   ( p_incident_id	IN  NUMBER
518   , p_attribute_1	IN VARCHAR2
519   , p_attribute_2	IN VARCHAR2
520   , p_attribute_3	IN VARCHAR2
521   , p_attribute_4	IN VARCHAR2
522   , p_attribute_5	IN VARCHAR2
523   , p_attribute_6	IN VARCHAR2
524   , p_attribute_7	IN VARCHAR2
525   , p_attribute_8	IN VARCHAR2
526   , p_attribute_9	IN VARCHAR2
527   , p_attribute_10	IN VARCHAR2
528   , p_attribute_11	IN VARCHAR2
529   , p_attribute_12	IN VARCHAR2
530   , p_attribute_13	IN VARCHAR2
531   , p_attribute_14	IN VARCHAR2
532   , p_attribute_15	IN VARCHAR2
533   , p_context		IN VARCHAR2
534   , X_RETURN_STATUS   OUT NOCOPY VARCHAR2
535   , X_MSG_COUNT		OUT NOCOPY INTEGER
536   , X_MSG_DATA		OUT NOCOPY VARCHAR2
537   )
538 IS
539 
540   l_return_status        VARCHAR2(10);
541   l_msg_count            NUMBER;
542   l_msg_data             VARCHAR2(2000);
543 
544   l_counter              NUMBER(3);
545   l_data                 VARCHAR2(2000);
546   l_msg_index_out        NUMBER;
547 
548   lr_service_request_rec cs_servicerequest_pub.service_request_rec_type;
549   lt_notes_tab           cs_servicerequest_pub.notes_table;
550   lt_contacts_tab        cs_servicerequest_pub.contacts_table;
551 
552   l_workflow_process_id  NUMBER;
553   l_interaction_id       NUMBER;
554 
555   l_user_id	NUMBER;
556   l_object_version_number NUMBER;
557   l_incident_number varchar2(30);
558   l_type_id number;
559   L_LAST_UPDATE_PROGRAM_CODE VARCHAR2(30);
560 
561 cursor c_version(v_incident_id number) is
562 select object_version_number from cs_incidents_all_vl where incident_id = v_incident_id;
563 
564 cursor c_incident_type_id (v_incident_id number) is
565 select INCIDENT_TYPE_ID,
566        incident_number,
567        LAST_UPDATE_PROGRAM_CODE
568   from cs_incidents_all_b where incident_id = v_incident_id;
569 
570 r_incident_type_id           c_incident_type_id%ROWTYPE;
571 
572 BEGIN
573   l_user_id := FND_GLOBAL.user_id ;
574 
575   open c_version(p_incident_id);
576   fetch c_version into l_object_version_number;
577   close c_version ;
578 
579   cs_servicerequest_pub.initialize_rec
580     ( p_sr_record => lr_service_request_rec
581     );
582 
583 
584   open c_incident_type_id(p_incident_id);
585   fetch c_incident_type_id into r_incident_type_id ;
586   close c_incident_type_id ;
587 
588   l_type_id := r_incident_type_id.INCIDENT_TYPE_ID;
589   L_LAST_UPDATE_PROGRAM_CODE:= r_incident_type_id.LAST_UPDATE_PROGRAM_CODE;
590 
591 
592   -- setting the values of Sr record which are to be updated
593   lr_service_request_rec.request_attribute_1	:= p_attribute_1 ;
594   lr_service_request_rec.request_attribute_2	:= p_attribute_2 ;
595   lr_service_request_rec.request_attribute_3	:= p_attribute_3 ;
596   lr_service_request_rec.request_attribute_4	:= p_attribute_4 ;
597   lr_service_request_rec.request_attribute_5	:= p_attribute_5 ;
598   lr_service_request_rec.request_attribute_6	:= p_attribute_6 ;
599   lr_service_request_rec.request_attribute_7	:= p_attribute_7 ;
600   lr_service_request_rec.request_attribute_8	:= p_attribute_8 ;
601   lr_service_request_rec.request_attribute_9	:= p_attribute_9 ;
602   lr_service_request_rec.request_attribute_10	:= p_attribute_10 ;
603   lr_service_request_rec.request_attribute_11	:= p_attribute_11 ;
604   lr_service_request_rec.request_attribute_12	:= p_attribute_12 ;
605   lr_service_request_rec.request_attribute_13	:= p_attribute_13 ;
606   lr_service_request_rec.request_attribute_14	:= p_attribute_14 ;
607   lr_service_request_rec.request_attribute_15	:= p_attribute_15 ;
608   lr_service_request_rec.request_context	:= p_context ;
609 
610   lr_service_request_rec.type_id          := l_type_id;
611   lr_service_request_rec.last_update_program_code :=L_LAST_UPDATE_PROGRAM_CODE;
612   cs_servicerequest_pub.update_servicerequest
613     (
614   p_api_version            => 3.0 ,
615   p_init_msg_list          => FND_API.G_FALSE,
616   p_commit                 => FND_API.G_TRUE,
617   x_return_status          => l_return_status,
618   x_msg_count              => l_msg_count,
619   x_msg_data               => l_msg_data,
620   p_request_id             => p_incident_id,
621   p_request_number         => null,--l_incident_number,
622   p_audit_comments         => NULL,
623   p_object_version_number  => l_object_version_number,
624   p_resp_appl_id           => NULL,
625   p_resp_id                => NULL,
626   p_last_updated_by        => l_user_id ,
627   p_last_update_login      => NULL,
628   p_last_update_date       => sysdate ,
629   p_service_request_rec    => lr_service_request_rec,
630   p_notes                  => lt_notes_tab,
631   p_contacts               => lt_contacts_tab,
632   p_called_by_workflow     => FND_API.G_FALSE,
633   p_workflow_process_id    => NULL,
634   x_workflow_process_id    => l_workflow_process_id,
635   x_interaction_id         => l_interaction_id
636     );
637 
638     X_RETURN_STATUS         := l_return_status;       -- output-parameter
639     X_MSG_COUNT             := l_msg_count;           -- output-parameter
640 
644     /* API-call was successfull */
641     --dbms_output.put_line('return_status: '||l_return_status);
642   IF l_return_status = FND_API.G_RET_STS_SUCCESS
643   THEN
645       null;
646       commit;
647   ELSE
648       FOR l_counter IN 1 .. l_msg_count
649       LOOP
650         fnd_msg_pub.get
651           ( p_msg_index     => l_counter
652           , p_encoded       => FND_API.G_FALSE
653           , p_data          => l_data
654           , p_msg_index_out => l_msg_index_out
655           );
656         --dbms_output.put_line( 'Message: '||l_data );
657       END LOOP ;
658       X_MSG_DATA := l_data;
659   END IF;
660 
661 EXCEPTION
662   WHEN OTHERS
663   THEN
664     --dbms_output.put_line('Exception');
665     --dbms_output.put_line(SQLERRM);
666     X_MSG_DATA := SQLERRM;
667 END update_request_flex;
668 
669 
670 
671 END csfw_servicerequest_pub;
672