[Home] [Help]
PACKAGE BODY: APPS.CS_SERVICEREQUEST_PVT
Source
1 PACKAGE BODY CS_ServiceRequest_PVT AS
2 /* $Header: csvsrb.pls 120.48.12010000.2 2008/11/14 22:03:06 rtripath ship $ */
3
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'CS_ServiceRequest_PVT';
5 G_INITIALIZED CONSTANT VARCHAR2(1) := 'R';
6 G_SR_SUBTYPE CONSTANT VARCHAR2(5) := 'INC';
7 G_API_REVISION CONSTANT NUMBER := 1.0;
8 G_TABLE_NAME CONSTANT VARCHAR2(40) := 'CS_INCIDENTS_ALL_B';
9 G_TL_TABLE_NAME CONSTANT VARCHAR2(40) := 'CS_INCIDENTS_ALL_TL';
10
11 --
12 --This procedure checks if an attribute is g_miss_char, if no then it returns.
13 --otherwise it checks if the given attribute is part of
14 --global context, if yes then it sets attribute value to value from old record
15 --otherwise it sets attribute to null.
16 PROCEDURE set_attribute_value(x_attr_val in out nocopy varchar2,
17 p_attr_val_old in varchar2,
18 p_ff_name in varchar2,
19 p_attr_col in varchar2);
20 --============================================================================
21 -- PROCEDURE : Get_incident_type_details PRIVATE
22 -- PARAMETERS: p_incident_typeId Incicent Type identifier
23 -- COMMENT : This procedure gets business process associated with incident type.
24 -- :
25 -- PRE-COND : Incident Type is assumed to be valid
26 -- :
27 -- EXCEPTIONS: None
28 -- Modification History:
29 -- Date Name Desc
30 -- ------- -------- ------------------------------------------------------------
31 -- 07/11/05 smisra Added abort workflow, launch workflow, workflow columns
32 -- to select statement and out parameters to this procedure
33 -- -----------------------------------------------------------------------------
34 PROCEDURE get_incident_type_details
35 ( p_incident_type_id IN NUMBER
36 , x_business_process_id OUT NOCOPY NUMBER
37 , x_autolaunch_workflow_flag OUT NOCOPY VARCHAR2
38 , x_abort_workflow_close_flag OUT NOCOPY VARCHAR2
39 , x_workflow OUT NOCOPY VARCHAR2
40 , x_return_status OUT NOCOPY VARCHAR2
41 )
42 IS
43 BEGIN
44 x_return_status := FND_API.G_RET_STS_SUCCESS;
45
46 SELECT
47 business_process_id
48 , autolaunch_workflow_flag
49 , abort_workflow_close_flag
50 , workflow
51 INTO
52 x_business_process_id
53 , x_autolaunch_workflow_flag
54 , x_abort_workflow_close_flag
55 , x_workflow
56 FROM
57 cs_incident_types_b
58 WHERE incident_type_id = p_incident_type_id;
59
60 EXCEPTION
61 WHEN no_data_found THEN
62 x_workflow := NULL;
63 x_business_process_id := NULL;
64 x_autolaunch_workflow_flag := NULL;
65 x_abort_workflow_close_flag := NULL;
66 x_return_status := FND_API.G_RET_STS_ERROR;
67 WHEN others THEN
68 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
69 FND_MESSAGE.set_name ('CS', 'CS_API_SR_UNKNOWN_ERROR');
70 FND_MESSAGE.set_token
71 ('P_TEXT'
72 , 'CS_SERVICEREQUEST_UTIL.get_incident_type_details'||'-'||SQLERRM
73 );
74 FND_MSG_PUB.ADD;
75 END get_incident_type_details;
76 -- -----------------------------------------------------------------------------
77 -- PROCEDURE : Get_default_contract PRIVATE
78 -- PARAMETERS: p_business_process_id Business Process associayed with incident type
79 -- : p_customer_id Service Request customer
80 -- : p_install_site_use_id Install site
81 -- : p_account_id Customer Account
82 -- : p_system_id System Id
83 -- : p_inventory_item_id Inventory Item
84 -- : p_customer_product_id Customer Product
85 -- : p_request_date Service Request Date
86 -- : p_severity_id Service Request Severity
87 -- : p_time_zone_id Time Zone
88 -- : p_incident_location_type Service request location type
89 -- : p_incident_location_id Service Request Location Id
90 -- : p_primary_contact_party_id party id of the SR primary contact
91 -- : p_primary_contact_point_id contact point id of the SR primary contact
92 -- : p_incident_id Request Identifier
93 -- COMMENT : This procedure gets a contract applicable to service request attributes
94 -- :
95 -- :
96 -- PRE-COND : All input parameters are process for g_miss values
97 -- :
98 -- EXCEPTIONS: None
99 -- Modification History:
100 -- Date Name Desc
101 -- ------- -------- ------------------------------------------------------------
102 -- 07/11/05 smisra added new parameters primary contact, contact point,
103 -- location id, location type and incident id to this
104 -- procedure for timezone changes
105 -- Called CS_TZ_GET_DETAILS_PVT.customer_preferred_time_zone
106 -- to get customer preferred time zone. This time zone is
107 -- passed to contract API.
108 -- 08/03/05 smisra added a new paramter p_incident_occurred_date
109 -- passed incident_occurred_date, time_zone_id and
110 -- dates_in_input_tz to contract record.
111 -- 12/23/05 smisra Bug 4894942
112 -- Added a new parameter p_default_coverage_template_id
113 -- Moved the logic based on default coverage template from
114 -- Create service request to this procedure
115 -- -----------------------------------------------------------------------------
116 PROCEDURE get_default_contract
117 ( p_business_process_id IN NUMBER
118 , p_customer_id IN NUMBER
119 , p_install_site_use_id IN NUMBER
120 , p_account_id IN NUMBER
121 , p_system_id IN NUMBER
122 , p_inventory_item_id IN NUMBER
123 , p_customer_product_id IN NUMBER
124 , p_request_date IN DATE
125 , p_incident_occurred_date IN DATE
126 , p_severity_id IN NUMBER
127 , p_time_zone_id IN NUMBER
128 , p_incident_location_type IN VARCHAR2
129 , p_incident_location_id IN NUMBER
130 , p_primary_contact_party_id IN NUMBER
131 , p_primary_contact_point_id IN NUMBER
132 , p_incident_id IN NUMBER
133 , p_default_coverage_template_id IN NUMBER
134 , x_return_status OUT NOCOPY VARCHAR2
135 , x_contract_id OUT NOCOPY NUMBER
136 , x_contract_number OUT NOCOPY VARCHAR2
137 , x_contract_service_id OUT NOCOPY NUMBER
138 , x_exp_resolution_date OUT NOCOPY DATE
139 , x_obligation_date OUT NOCOPY DATE
140 )
141 IS
142 px_inp_rec OKS_ENTITLEMENTS_PUB.get_contin_rec;
143 l_inp_rec OKS_COV_ENT_PUB.gdrt_inp_rec_type;
144 l_react_rec OKS_COV_ENT_PUB.rcn_rsn_rec_type;
145 l_resolve_rec OKS_COV_ENT_PUB.rcn_rsn_rec_type;
146 l_ent_contracts OKS_ENTITLEMENTS_PUB.get_contop_tbl;
147 Li_TableIdx BINARY_INTEGER;
148 l_msg_count NUMBER;
149 l_msg_data VARCHAR2(2000);
150 lx_timezone_id NUMBER;
151 lx_timezone_name VARCHAR2(80);
152 l_server_timezone_id NUMBER;
153 l_log_module VARCHAR2(255);
154 BEGIN
155 l_log_module := 'cs.plsql.' || 'CS_SERVICEREQUEST_PVT.get_default_contract' || '.';
156 px_inp_rec.contract_number := NULL;
157 px_inp_rec.contract_number_modifier := NULL;
158 px_inp_rec.service_line_id := NULL;
159 px_inp_rec.party_id := p_customer_id;
160 px_inp_rec.site_id := p_install_site_use_id;
161 px_inp_rec.cust_acct_id := p_account_id;
162 px_inp_rec.system_id := p_system_id;
163 px_inp_rec.item_id := p_inventory_item_id;
164 px_inp_rec.product_id := p_customer_product_id;
165 px_inp_rec.request_date := p_request_date;
166 px_inp_rec.incident_date := p_incident_occurred_date;
167 px_inp_rec.severity_id := p_severity_id;
168 px_inp_rec.time_zone_id := p_time_zone_id;
169 px_inp_rec.business_process_id := p_business_process_id;
170 px_inp_rec.calc_resptime_flag := 'Y';
171 px_inp_rec.validate_flag := 'Y';
172 px_inp_rec.sort_key := 'RSN';
173 px_inp_rec.dates_in_input_tz := 'N';
174
175 CS_TZ_GET_DETAILS_PVT.customer_preferred_time_zone
176 ( p_incident_id => p_incident_id
177 , p_task_id => NULL
178 , p_resource_id => NULL
179 , p_incident_location_id => p_incident_location_id
180 , p_incident_location_type => p_incident_location_type
181 , p_contact_party_id => p_primary_contact_party_id
182 , p_contact_phone_id => p_primary_contact_point_id
183 , p_customer_id => p_customer_id
184 , x_timezone_id => lx_timezone_id
185 , x_timezone_name => lx_timezone_name
186 );
187
188
189 IF lx_timezone_id IS NOT NULL
190 THEN
191 px_inp_rec.time_zone_id := lx_timezone_id;
192 ELSE
193 px_inp_rec.time_zone_id := p_time_zone_id;
194 END IF ;
195
196 --------------------Call to Get contracts Starts Here--------------------------
197 IF ((px_inp_rec.business_process_id IS NULL) OR
198 (px_inp_rec.severity_id IS NULL) OR
199 (px_inp_rec.time_zone_id IS NULL) )
200 THEN
201 FND_MESSAGE.SET_NAME ('CS','CS_SR_DEF_SLA_INSUFF_PARAMS');
202 FND_MSG_PUB.ADD_DETAIL (p_message_type=>FND_MSG_PUB.G_INFORMATION_MSG);
203 --FND_MSG_PUB.Count_And_Get (p_count => x_msg_count, p_data => x_msg_data);
204 ELSE
205 OKS_ENTITLEMENTS_PUB.get_contracts
206 (p_api_version => 1.0,
207 p_init_msg_list => fnd_api.g_false ,
208 p_inp_rec => px_inp_rec,
209 x_return_status => x_return_status,
210 x_msg_count => l_msg_count,
211 x_msg_data => l_msg_data,
212 x_ent_contracts => l_ent_contracts);
213 IF (x_return_status = 'S' AND l_ent_contracts.count > 0)
214 THEN
215 Li_TableIdx := l_ent_contracts.FIRST ;
216 x_contract_id := l_ent_contracts(Li_TableIdx).contract_id ;
217 x_contract_number := l_ent_contracts(Li_TableIdx).contract_number ;
218 x_contract_service_id := l_ent_contracts(Li_TableIdx).service_line_id ;
219 x_exp_resolution_date := l_ent_contracts(Li_TableIdx).exp_resolution_time;
220 x_obligation_date := l_ent_contracts(Li_TableIdx).exp_reaction_time ;
221 ELSE
222 x_contract_id := null ;
223 x_contract_number := null ;
224 x_contract_service_id := null ;
225 x_exp_resolution_date := null ;
226 x_obligation_date := null ;
227
228 FND_MESSAGE.set_name('CS','CS_SR_UNABLE_DEF_CONTR');
229 FND_MSG_PUB.add_detail(p_message_type=>FND_MSG_PUB.G_INFORMATION_MSG);
230 -- in case of update API, this param is always passed as NULL
231 -- so this will not execute for update API
232 IF p_default_coverage_template_id is NOT NULL
233 THEN
234 l_inp_rec.Coverage_template_id := p_default_coverage_template_id ;
235 l_inp_rec.Business_process_id := p_business_process_id;
236 l_inp_rec.request_date := p_request_date ;
237 l_inp_rec.Severity_id := p_severity_id;
238 l_inp_rec.Time_zone_id := lx_timezone_id;
239 l_inp_rec.dates_in_input_tz := 'N';
240 OKS_COV_ENT_PUB.Get_default_react_resolve_by
241 ( p_api_version =>1.0
242 , p_init_msg_list => FND_API.G_FALSE
243 , p_inp_rec => l_inp_rec
244 , x_return_status => x_return_status
245 , x_msg_count => l_msg_count
246 , x_msg_data => l_msg_data
247 , x_react_rec => l_react_rec
248 , x_resolve_rec => l_resolve_rec
249 );
250 IF l_react_rec.by_date_end IS NOT NULL AND
251 l_resolve_rec.by_date_end IS NOT NULL AND
252 l_react_rec.by_date_end <> FND_API.G_MISS_DATE AND
253 l_resolve_rec.by_date_end <> FND_API.G_MISS_DATE
254 THEN
255 x_obligation_date := l_react_rec.by_date_end;
256 x_exp_resolution_date := l_resolve_rec.by_date_end;
257 --
258 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
259 THEN
260 FND_LOG.String
261 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
262 , 'The defaulted value of parameter exp_resolution_date :' || x_exp_resolution_date
263 );
264 FND_LOG.String
265 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
266 , 'The defaulted value of parameter obligation_date :' || x_obligation_date
267 );
268 END IF;
269 END IF; -- Returned value of dates are not null
270 END IF; -- if p_default_coverage is not null
271 END IF; -- else return status = 'S'
272 END IF; -- all required param are available
273 ---------------------Call to Get contracts end Here-----------------------------
274 END get_default_contract;
275 -- -----------------------------------------------------------------------------
276 -- PROCEDURE : vldt_sr_rec PRIVATE
277 -- PARAMETERS: p_sr_rec Service Requesr Record after processing for
278 -- G_miss values
279 -- : p_sr_rec_inp Service Requesr Record as input to API
280 -- : p_sr_related_data This record hold SR related values such as
281 -- status flags, workflow flag, business
282 -- process id etc.
283 -- : p_mode it can 2 values 'CREATE' or 'UPDATE'
284 -- indicating SR creation or update
285 -- : p_request_id SR identifier
286 -- : p_object_version_number SR object version
287 -- : p_last_updated_by User Id
288 -- : p_validation_level Validation level passed to SR API
289 -- : p_default_contract_sla_ind Default contract SLA indicator
290 -- : p_auto_assign Auto assignment flag passed to API
291 -- : p_old_xxxx these parameters hold old value of
292 -- corresponding SR attributes
293 -- : x_return_status Indicates success or failure
294 -- encountered by the procedure
295 -- COMMENT : This procedure validates following attributes
296 -- 1. incident location
297 -- 2. incident owner
298 -- 3. Service contract
299 -- This procedure derives follwing attribute
300 -- 1. incident country
301 -- 2. resource type
302 -- 3. service contract if p_default_contract_sla_ind is passed as Y
303 -- 4. incident owner if p_auto_assign is passed as 'Y'
304 -- 5. incident owner group if p_auto_assign is passed as 'Y'
305 -- 6. Determines coverage if contract is available to SR
306 --
307 -- PRE-COND : All input parameters are processed for g_miss values i.e SR Rec
308 -- should not have any G_MISS values
309 -- :
310 -- EXCEPTIONS: None
311 -- Modification History:
312 -- Date Name Desc
313 -- ------- -------- ------------------------------------------------------------
314 -- 12/14/05 smisra Created
315 -- Bug 4386870. Added call to validate_inc_location_id
316 -- 12/23/05 smisra Bug 4894942, 4892782
317 -- Added following calls
318 -- 1. Validate contract service id
319 -- 2. Call to default contract
320 -- 3. Call to determine coverage type based on contract
321 -- service identifier
322 -- 4. Service request auto assignment
323 -- 12/30/05 smisra Bug 4773215
324 -- Added two parameters:
325 -- 1. p_old_site_id and
326 -- 2. p_old_resource_type
327 -- Added validation of resource id. This will set resource
328 -- type and site id based on resource
329 -- 11/14/08 Ranjan Bug 7561640
330 -- in vldt_sr_rec it is overiding resource type value with party site
331 -- id
332 -- ------- -------- ------------------------------------------------------------
333 PROCEDURE vldt_sr_rec
334 ( p_sr_rec IN OUT NOCOPY service_request_rec_type
335 , p_sr_rec_inp IN service_request_rec_type
336 , p_sr_related_data IN RELATED_DATA_TYPE
337 , p_mode IN VARCHAR2 DEFAULT NULL
338 , p_request_id IN NUMBER DEFAULT NULL
339 , p_object_version_number IN NUMBER DEFAULT NULL
340 , p_last_updated_by IN NUMBER
341 , p_validation_level IN NUMBER DEFAULT NULL
342 , p_default_contract_sla_ind IN VARCHAR2
343 , p_default_coverage_template_id IN NUMBER DEFAULT NULL
344 , p_auto_assign IN VARCHAR2
345 , p_old_incident_location_id IN NUMBER DEFAULT NULL
346 , p_old_incident_location_type IN VARCHAR2 DEFAULT NULL
347 , p_old_incident_country IN VARCHAR2 DEFAULT NULL
348 , p_old_incident_owner_id IN NUMBER DEFAULT NULL
349 , p_old_owner_group_id IN NUMBER DEFAULT NULL
350 , p_old_resource_type IN VARCHAR2 DEFAULT NULL
351 , p_old_site_id IN NUMBER DEFAULT NULL
352 , p_old_obligation_date IN DATE DEFAULT NULL
353 , p_old_expected_resolution_date IN DATE DEFAULT NULL
354 , p_old_contract_id IN NUMBER DEFAULT NULL
355 , p_old_contract_service_id IN NUMBER DEFAULT NULL
356 , p_old_install_site_id IN NUMBER DEFAULT NULL
357 , p_old_system_id IN NUMBER DEFAULT NULL
358 , p_old_account_id IN NUMBER DEFAULT NULL
359 , p_old_inventory_item_id IN NUMBER DEFAULT NULL
360 , p_old_customer_product_id IN NUMBER DEFAULT NULL
361 , p_old_incident_type_id IN NUMBER DEFAULT NULL
362 , p_old_time_zone_id IN NUMBER DEFAULT NULL
363 , p_old_incident_severity_id IN NUMBER DEFAULT NULL
364 , x_contract_number IN OUT NOCOPY VARCHAR2
365 , x_return_status OUT NOCOPY VARCHAR2
366 ) IS
367 l_return_status VARCHAR2(1);
368 l_contract_service_id_valid VARCHAR2(1);
369 l_api_name VARCHAR2(80);
370 l_log_module VARCHAR2(255) ;
371 l_contract_defaulted VARCHAR2(1);
372 l_msg_count NUMBER;
373 l_msg_data VARCHAR2(2000);
374 l_auto_assign_level fnd_profile_option_values.profile_option_value % TYPE;
375 l_asgn_owner_id cs_incidents_all_b.incident_owner_id % TYPE;
376 l_asgn_resource_type cs_incidents_all_b.resource_type % TYPE;
377 l_asgn_owner_group_id cs_incidents_all_b.owner_group_id % TYPE;
378 l_asgn_owner_type cs_incidents_all_b.resource_type % TYPE;
379 l_territory_id NUMBER;
380 l_orig_group_type_null varchar2(1) := 'N';
381 l_owner_id CS_INCIDENTS_ALL_B.incident_owner_id % TYPE;
382 l_owner_name jtf_rs_resource_extns_tl.resource_name % TYPE;
383 BEGIN
384 l_api_name := 'CS_SERVICEREQUEST_PVT.vldt_sr_rec';
385 l_log_module := 'cs.plsql.' || l_api_name || '.';
386 l_contract_service_id_valid := 'Y';
387 l_contract_defaulted := 'N';
388 x_return_status := FND_API.G_RET_STS_SUCCESS;
389
390 IF p_validation_level = FND_API.G_VALID_LEVEL_FULL
391 THEN
392 --
393 -- incident location validation
394 --
395 IF p_sr_rec.incident_location_id IS NOT NULL
396 THEN
397 IF p_sr_rec.incident_location_id <> NVL(p_old_incident_location_id,-9) OR
398 NVL(p_sr_rec.incident_location_type,'X') <> NVL(p_old_incident_location_type,'Y') OR
399 p_old_incident_country IS NULL
400 THEN
401 CS_ServiceRequest_UTIL.Validate_Inc_Location_Id
402 ( p_api_name => l_api_name
403 , p_parameter_name => 'p_incident_location_id'
404 , p_incident_location_type => p_sr_rec.incident_location_type
405 , p_incident_location_id => p_sr_rec.incident_location_id
406 , x_incident_country => p_sr_rec.incident_country
407 , x_return_status => x_return_status
408 );
409 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
410 RETURN;
411 END IF;
412 END IF; -- check on change in other related parameters
413 END IF; -- null check on incident location
414 --
415 -- Incident Owner Validation
416 --
417 IF p_sr_rec.owner_id IS NULL
418 THEN
419 p_sr_rec.resource_type := NULL;
420 p_sr_rec.site_id := NULL;
421 ELSE
422 -- if new owner is same as old owner then set resource type as old resource type
423 IF p_sr_rec.owner_id = p_old_incident_owner_id
424 THEN
425 p_sr_rec.resource_type := p_old_resource_type;
426 -- fix for Bug 7561640
427 p_sr_rec.site_id := p_old_site_id;
428 -- end fix for Bug 7561640
429 END IF;
430 -- Validate owner id and set resource type if it is not null
431 IF p_sr_rec.owner_id <> NVL(p_old_incident_owner_id, -1) OR
432 p_sr_rec.type_id <> NVL(p_old_incident_type_id , -9) OR
433 NVL(p_sr_rec.owner_group_id,-1) <> NVL(p_old_owner_group_id , -1) OR
434 NVL(p_sr_rec.resource_type ,'Y')<> NVL(p_old_resource_type ,'x')
435 THEN
436 CS_SERVICEREQUEST_UTIL.validate_owner
437 ( p_api_name => NULL
438 , p_parameter_name => 'owner id'
439 , p_owner_id => p_sr_rec.owner_id
440 , p_group_type => p_sr_rec.group_type
441 , p_owner_group_id => p_sr_rec.owner_group_id
442 , p_org_id => NULL -- not used in validation
443 , p_incident_type_id => p_sr_rec.type_id
444 , p_mode => p_mode
445 , x_owner_name => l_owner_name
446 , x_owner_id => l_owner_id
447 , x_resource_type => p_sr_rec.resource_type
448 , x_support_site_id => p_sr_rec.site_id
449 , x_return_status => l_return_status
450 );
451 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
452 THEN
453 x_return_status := FND_API.G_RET_STS_ERROR;
454 RETURN;
455 END IF;
456 IF p_mode = 'CREATE'
457 THEN
458 p_sr_rec.owner_id := l_owner_id;
459 END IF;
460 END IF;
461 END IF;
462 --
463 -- Contract Service Id Validation
464 --
465 IF p_sr_rec.contract_service_id IS NOT NULL
466 THEN
467 IF p_sr_rec.contract_service_id <> NVL(p_old_contract_service_id,-9) OR
468 NVL(p_sr_rec.type_id ,-9) <> NVL(p_old_incident_type_id ,-9) OR
469 NVL(p_sr_rec.system_id ,-9) <> NVL(p_old_system_id ,-9) OR
470 NVL(p_sr_rec.account_id ,-9) <> NVL(p_old_account_id ,-9) OR
471 NVL(p_sr_rec.contract_id ,-9) <> NVL(p_old_contract_id ,-9) OR
472 NVL(p_sr_rec.install_site_id ,-9) <> NVL(p_old_install_site_id ,-9) OR
473 NVL(p_sr_rec.inventory_item_id ,-9) <> NVL(p_old_inventory_item_id ,-9) OR
474 NVL(p_sr_rec.customer_product_id,-9) <> NVL(p_old_customer_product_id,-9)
475 THEN
476 CS_SERVICEREQUEST_UTIL.Validate_Contract_Service_Id
477 ( p_api_name => l_api_name
478 , p_parameter_name => 'p_contract_service_id'
479 , p_contract_service_id => p_sr_rec.contract_service_id
480 , x_contract_id => p_sr_rec.contract_id
481 , x_contract_number => x_contract_number
482 , x_return_status => l_return_status
483 );
484 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
485 THEN
486 l_contract_service_id_valid := 'N';
487 ELSE
488 CS_SERVICEREQUEST_UTIL.contracts_cross_val
489 ( p_parameter_name => 'contract_service_id'
490 , p_contract_service_id => p_sr_rec.contract_service_id
491 , p_busiproc_id => p_sr_related_data.business_process_id
492 , p_request_date => p_sr_rec.request_date
493 , p_inventory_item_id => p_sr_rec.inventory_item_id
494 , p_inv_org_id => p_sr_rec.inventory_org_id
495 , p_install_site_id => p_sr_rec.install_site_id
496 , p_customer_product_id => p_sr_rec.customer_product_id
497 , p_account_id => p_sr_rec.account_id
498 , p_customer_id => p_sr_rec.customer_id
499 , p_system_id => p_sr_rec.system_id
500 , x_return_status => l_return_status
501 );
502 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
503 THEN
504 l_contract_service_id_valid := 'N';
505 p_sr_rec.contract_id := NULL;
506 x_contract_number := NULL;
507 END IF;
508 END IF; -- end of else after validate_contract_service_id procedure
509 END IF; -- Some of contract related attributes changes
510 END IF; -- Check for contract service id is not null
511 --
512 --
513 --
514 END IF; -- check on validation level parameter
515 --
516 -- Get Default contract
517 --
518 IF (p_default_contract_sla_ind = 'Y')
519 THEN
520 IF p_sr_rec_inp.obligation_date = FND_API.G_MISS_DATE AND
521 p_sr_rec_inp.exp_resolution_date = FND_API.G_MISS_DATE AND
522 p_sr_rec_inp.contract_id = FND_API.G_MISS_NUM AND
523 p_sr_rec_inp.contract_service_id = FND_API.G_MISS_NUM AND
524 ( p_mode = 'CREATE' OR
525 (l_contract_service_id_valid = 'N' OR
526 (p_old_obligation_date IS NULL AND
527 p_old_expected_resolution_date IS NULL AND
528 p_old_contract_id IS NULL AND
529 p_old_contract_service_id IS NULL
530 ) OR
531 ( p_old_contract_service_id IS NULL AND
532 (NVL(p_sr_rec.install_site_id,-9) <> NVL(p_old_install_site_id,-9) OR
533 NVL(p_sr_rec.system_id,-9) <> NVL(p_old_system_id,-9) OR
534 NVL(p_sr_rec.account_id,-9) <> NVL(p_old_account_id,-9) OR
535 NVL(p_sr_rec.inventory_item_id,-9) <> NVL(p_old_inventory_item_id,-9) OR
536 NVL(p_sr_rec.customer_product_id,-9) <> NVL(p_old_customer_product_id,-9) OR
537 NVL(p_sr_rec.type_id,-9) <> NVL(p_old_incident_type_id,-9) OR
538 NVL(p_sr_rec.time_zone_id,-9) <> NVL(p_old_time_zone_id,-9) OR
539 NVL(p_sr_rec.severity_id,-9) <> NVL(p_old_incident_severity_id,-9)
540 )
541 )
542 )
543 )
544 THEN
545 l_contract_defaulted := 'Y';
546 CS_SERVICEREQUEST_PVT.get_default_contract
547 ( p_business_process_id => p_sr_related_data.business_process_id
548 , p_customer_id => p_sr_rec.customer_id
549 , p_install_site_use_id => p_sr_rec.install_site_use_id
550 , p_account_id => p_sr_rec.account_id
551 , p_system_id => p_sr_rec.system_id
552 , p_inventory_item_id => p_sr_rec.inventory_item_id
553 , p_customer_product_id => p_sr_rec.customer_product_id
554 , p_request_date => p_sr_rec.request_date
555 , p_incident_occurred_date => p_sr_rec.incident_occurred_date
556 , p_severity_id => p_sr_rec.severity_id
557 , p_time_zone_id => p_sr_rec.time_zone_id
558 , p_incident_location_type => p_sr_rec.incident_location_type
559 , p_incident_location_id => p_sr_rec.incident_location_id
560 , p_primary_contact_party_id => p_sr_related_data.primary_party_id
561 , p_primary_contact_point_id => p_sr_related_data.primary_contact_point_id
562 , p_incident_id => p_request_id
563 , p_default_coverage_template_id => p_default_coverage_template_id
564 , x_return_status => x_return_status
565 , x_contract_id => p_sr_rec.contract_id
566 , x_contract_number => x_contract_number
567 , x_contract_service_id => p_sr_rec.contract_service_id
568 , x_exp_resolution_date => p_sr_rec.exp_resolution_date
569 , x_obligation_date => p_sr_rec.obligation_date
570 ) ;
571 IF ( x_return_status <> FND_API.G_RET_STS_SUCCESS )
572 THEN
573 RAISE FND_API.G_EXC_ERROR;
574 END IF;
575 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
576 THEN
577 FND_LOG.String
578 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
579 , 'The defaulted value of parameter contra_id :' || p_sr_rec.contract_id
580 );
581 FND_LOG.String
582 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
583 , 'The defaulted value of parameter contract_number :' || x_contract_number
584 );
585 FND_LOG.String
586 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
587 , 'The defaulted value of parameter contract_service_id :' || p_sr_rec.contract_service_id
588 );
589 FND_LOG.String
590 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
591 , 'The defaulted value of parameter exp_resolution_date :' || p_sr_rec.exp_resolution_date
592 );
593 FND_LOG.String
594 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
595 , 'The defaulted value of parameter obligation_date :' || p_sr_rec.obligation_date
596 );
597 END IF; -- check of FND_LOG.level_procedure
598 IF p_old_contract_service_id IS NOT NULL AND
599 NVL(p_sr_rec.contract_service_id,-99) <> p_old_contract_service_id
600 THEN
601 FND_MESSAGE.SET_NAME('CS','CS_SR_CONTRACT_ASSIGN_CHANGED');
602 FND_MSG_PUB.ADD_DETAIL(p_message_type=>FND_MSG_PUB.G_INFORMATION_MSG);
603 END IF ;
604 END IF; -- contract service or related attributes are null
605 -- move the above part to get_default_contract
606 END IF; -- if default contrct sla ind is 'Y'
607 IF l_contract_service_id_valid <> 'Y' AND
608 l_contract_defaulted <> 'Y'
609 THEN
610 FND_MESSAGE.set_name ('CS', 'CS_SR_CONTRACT_INVALID');
611 FND_MESSAGE.set_token('API_NAME', 'CS_SERVICEREQUEST_UTIL.contracts_cross_val' );
612 FND_MSG_PUB.add;
613 RAISE FND_API.G_EXC_ERROR;
614 END IF;
615 -- End of Default contract SLA processing
616 --
617 -- Get Coverage Type
618 --
619 IF p_sr_rec.contract_service_id IS NOT NULL
620 THEN
621 IF p_validation_level > FND_API.G_VALID_LEVEL_NONE OR
622 (p_validation_level = FND_API.G_VALID_LEVEL_NONE AND
623 p_sr_rec.coverage_type IS NULL)
624 THEN
625 OKS_ENTITLEMENTS_PUB.Get_Coverage_Type
626 ( p_api_version => 2.0
627 , p_init_msg_list => FND_API.G_FALSE
628 , p_contract_line_id => p_sr_rec.contract_service_id
629 , x_return_status => l_return_status
630 , x_msg_count => l_msg_count
631 , x_msg_data => l_msg_data
632 , x_coverage_type => coverage_type_rec
633 );
634 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
635 THEN
636 RAISE FND_API.G_EXC_ERROR;
637 END IF;
638 IF coverage_type_rec.code IS NOT NULL AND
639 coverage_type_rec.code <> FND_API.G_MISS_CHAR
640 THEN
641 p_sr_rec.coverage_type := coverage_type_rec.code ;
642 END IF ;
643 END IF ;
644 END IF;
645 --
646 -- Start of owner assignment to service request
647 --
648 IF p_auto_assign NOT IN ('Y','N','y','n')
649 THEN
650 FND_MESSAGE.Set_Name('CS', 'CS_SR_INVALID_AUTOASSIGN_PARAM');
651 FND_MESSAGE.Set_Token('API_NAME', l_api_name);
652 FND_MSG_PUB.ADD;
653 END IF;
654 IF p_sr_rec.owner_id IS NULL AND
655 LOWER(p_auto_assign) = 'y' AND
656 NVL(p_sr_related_data.old_disallow_request_update,'N') = 'N'
657 THEN
658 l_auto_assign_level := fnd_profile.value('CS_SR_OWNER_AUTO_ASSIGN_LEVEL');
659 -- For bug 3702091 - AM API should not be called even if the Auto Assignment is ON
660 -- and the Assignment level is Group and Owner is passed
661 IF ((l_auto_assign_level = 'INDIVIDUAL' AND NVL(p_sr_related_data.old_disallow_owner_update,'N') = 'N') OR
662 (l_auto_assign_level = 'GROUP' AND p_sr_rec.owner_group_id is null))
663 THEN
664 p_sr_rec.load_balance := 'Y';
665 p_sr_rec.assign_owner := 'Y';
666 IF p_sr_rec.group_type IS NULL
667 THEN
668 p_sr_rec.group_type := 'RS_GROUP';
669 l_orig_group_type_null := 'Y';
670 END IF;
671 CS_Assign_Resource_PKG.Assign_ServiceRequest_Main
672 ( p_api_name => 'Assign_ServiceRequest_Main'
673 , p_api_version => 1.0
674 , p_init_msg_list => fnd_api.g_false
675 , p_commit => fnd_api.g_false
676 , p_incident_id => p_request_id
677 , p_object_version_number => p_object_version_number
678 , p_last_updated_by => p_last_updated_by
679 , p_service_request_rec => p_sr_rec
680 , x_owner_id => l_asgn_owner_id
681 , x_owner_type => l_asgn_resource_type
682 , x_territory_id => l_territory_id
683 , x_return_status => l_return_status
684 , x_msg_count => l_msg_count
685 , x_msg_data => l_msg_data
686 , x_owner_group_id => l_asgn_owner_group_id
687 );
688 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
689 THEN
690 FND_MSG_PUB.Count_And_Get
691 ( p_count => l_msg_count
692 , p_data => l_msg_data
693 );
694 IF (l_orig_group_type_null = 'Y') then
695 p_sr_rec.group_type := NULL;
696 END IF;
697 ELSE
698 IF l_asgn_owner_group_id IS NOT NULL AND
699 NVL(p_sr_rec.owner_group_id,-1) <> l_asgn_owner_group_id
700 THEN
701 p_sr_rec.owner_group_id := l_asgn_owner_group_id;
702 IF p_sr_rec.group_type IS NULL
703 THEN
704 p_sr_rec.group_type := 'RS_GROUP';
705 -- this is needed otherwise combination of group id and group type will
706 -- becomes invalid 12/9/03 smisra
707 END IF;
708 END IF;
709 IF l_asgn_owner_id IS NOT NULL AND
710 NVL(p_sr_rec.owner_id,-1) <> l_asgn_owner_id
711 THEN
712 p_sr_rec.owner_id := l_asgn_owner_id;
713 p_sr_rec.resource_type := l_asgn_resource_type;
714 END IF;
715 -- Add information message if AM API does not return anything
716 IF l_asgn_owner_group_id IS NULL AND l_asgn_owner_id IS NULL
717 THEN
718 FND_MESSAGE.Set_Name('CS', 'CS_SR_AM_API_RETURNED_NULL');
719 FND_MESSAGE.Set_Token('API_NAME', l_api_name);
720 FND_MSG_PUB.ADD;
721 END IF;
722 p_sr_rec.territory_id := l_territory_id;
723 END IF; -- AM API returned with success
724 END IF; -- is call to assign_servicerequest needed?
725 END IF; -- if p_auto_assign is 'Y'
726 --
727 --
728 --
729 EXCEPTION
730 WHEN FND_API.G_EXC_ERROR THEN
731 x_return_status := FND_API.G_RET_STS_ERROR;
732 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
733 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
734 WHEN OTHERS THEN
735 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
736 FND_MESSAGE.set_name ('CS', 'CS_API_SR_UNKNOWN_ERROR');
737 FND_MESSAGE.set_token
738 ('P_TEXT'
739 , 'CS_SERVICEREQUEST_UTIL.vldt_sr_rec'||'-'||SQLERRM
740 );
741 FND_MSG_PUB.ADD;
742 END vldt_sr_rec;
743 --============================================================================
744 -- PROCEDURE : set_time_zone PRIVATE
745 -- PARAMETERS: p_contact_party_id Contact party
746 -- : p_contact_point_type it could PHONE or EMAIL
747 -- : p_contact_point_id primary key to hz_contact_points
748 -- : p_incident_id primary key to incidents table
749 -- COMMENT : This procedure will determine timezone based on primary contact's
750 -- : phone or identifying address and update incidents table
751 -- : If no timezone is found then incidents table is not updated
752 -- PRE-COND : contact party and contact point type, contact point id and incident
753 -- : id must be valid
754 -- EXCEPTIONS: None
755 --============================================================================
756 PROCEDURE set_time_zone(p_contact_party_id NUMBER,
757 p_contact_point_type VARCHAR2,
758 p_contact_point_id NUMBER,
759 p_incident_id NUMBER) IS
760 CURSOR c_phone_timezone IS
761 SELECT
762 timezone_id
763 FROM
764 hz_contact_points
765 WHERE contact_point_id = p_contact_point_id;
766
767 CURSOR c_addr_timezone IS
768 SELECT
769 loc.timezone_id
770 FROM
771 hz_party_sites site
772 , hz_locations loc
773 WHERE site.location_id = loc.location_id
774 AND site.party_id = p_contact_party_id
775 AND site.identifying_address_flag = 'Y'
776 AND site.status = 'A';
777 l_timezone_id NUMBER;
778 BEGIN
779 l_timezone_id := null;
780 IF (p_contact_point_type = 'PHONE') THEN
781 OPEN c_phone_timezone;
782 FETCH c_phone_timezone INTO l_timezone_id;
783 IF (c_phone_timezone % NOTFOUND)
784 THEN
785 l_timezone_id := null;
786 END IF;
787 CLOSE c_phone_timezone;
788 END IF;
789 --
790 -- either primary contact point type is not a phone or no timezone is
791 -- associated with primary phone. So get it from primary contact's
792 -- identifying address.`
793 --
794 IF (l_timezone_id IS NULL)
795 THEN
796 OPEN c_addr_timezone;
797 FETCH c_addr_timezone INTO l_timezone_id;
798 IF (c_addr_timezone % NOTFOUND)
799 THEN
800 l_timezone_id := null;
801 END IF;
802 CLOSE c_addr_timezone;
803 END IF;
804 --
805 -- update incidents table only if timezone is found
806 --
807 IF (l_timezone_id IS NOT NULL)
808 THEN
809 UPDATE CS_INCIDENTS_ALL_B
810 SET time_zone_id = l_timezone_id
811 WHERE incident_id = p_incident_id;
812 END IF;
813
814 EXCEPTION
815 WHEN OTHERS THEN
816 NULL;
817 END set_time_zone;
818 --
819 -- This procedure is defined only in body
820 -- if x_new_value is g_miss_char then x_new_value is set to p_old_value
821 PROCEDURE handle_missing_value(x_new_value in out nocopy varchar2,
822 p_old_value in varchar2);
823 -- Added dj
824 -- Local procedure to get the business usage of the responsibility that is
825 -- attempting to create/update the SR.
826 PROCEDURE GET_BUSINESS_USAGE (
827 p_responsibility_id IN NUMBER,
828 p_application_id IN NUMBER,
829 x_business_usage OUT NOCOPY VARCHAR2 )
830 IS
831 BEGIN
832 select business_usage
833 into x_business_usage
834 from cs_service_responsibility
835 where responsibility_id = p_responsibility_id
836 and application_id = p_application_id;
837
838 EXCEPTION
839 when others then
840 x_business_usage := NULL;
841 END GET_BUSINESS_USAGE;
842
843 -- Local procedure to get the attribute that indicates if security is enabled
844 -- for self service responsibilities
845 PROCEDURE GET_SS_SEC_ENABLED (
846 x_ss_sr_type_restrict OUT NOCOPY VARCHAR2 )
847 IS
848 BEGIN
849 select ss_srtype_restrict
850 into x_ss_sr_type_restrict
851 from cs_system_options;
852 EXCEPTION
853 when others then
854 x_ss_sr_type_restrict := NULL;
855 END GET_SS_SEC_ENABLED;
856
857 PROCEDURE Create_SR_Validation
858 ( p_api_name IN VARCHAR2,
859 p_service_request_rec IN service_request_rec_type,
860 p_contacts IN contacts_table,
861 p_resp_id IN NUMBER DEFAULT NULL,
862 p_resp_appl_id IN NUMBER DEFAULT NULL,
863 p_user_id IN NUMBER,
864 p_login_id IN NUMBER DEFAULT NULL,
865 p_org_id IN NUMBER DEFAULT NULL,
866 p_request_id IN NUMBER DEFAULT NULL,
867 p_request_number IN VARCHAR2 DEFAULT NULL,
868 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
869 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
870 x_msg_count OUT NOCOPY NUMBER,
871 x_msg_data OUT NOCOPY VARCHAR2,
872 x_return_status OUT NOCOPY VARCHAR2,
873 x_contra_id OUT NOCOPY NUMBER,
874 x_contract_number OUT NOCOPY VARCHAR2,
875 x_owner_assigned_flag OUT NOCOPY VARCHAR2,
876 x_req_id OUT NOCOPY NUMBER,
877 x_request_id OUT NOCOPY NUMBER,
878 x_req_num OUT NOCOPY VARCHAR2,
879 x_request_number OUT NOCOPY VARCHAR2,
880 x_autolaunch_wkf_flag OUT NOCOPY VARCHAR2,
881 x_abort_wkf_close_flag OUT NOCOPY VARCHAR2,
882 x_wkf_process_name OUT NOCOPY VARCHAR2,
883 x_audit_vals_rec OUT NOCOPY sr_audit_rec_type,
884 x_service_request_rec OUT NOCOPY service_request_rec_type,
885 p_cmro_flag IN VARCHAR2,
886 p_maintenance_flag IN VARCHAR2,
887 p_auto_assign IN VARCHAR2 := 'N'
888 );
889
890
891 PROCEDURE Update_SR_Validation
892 ( p_api_version IN VARCHAR2,
893 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
894 p_service_request_rec IN service_request_rec_type,
895 p_invocation_mode IN VARCHAR2 := 'NORMAL',
896 p_notes IN notes_table,
897 p_contacts IN contacts_table,
898 p_audit_comments IN VARCHAR2 DEFAULT NULL,
899 p_resp_id IN NUMBER DEFAULT NULL,
900 p_resp_appl_id IN NUMBER DEFAULT NULL,
901 p_request_id IN NUMBER,
902 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
903 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
904 p_last_updated_by IN NUMBER,
905 p_last_update_login IN NUMBER DEFAULT NULL,
906 p_last_update_date IN DATE,
907 p_object_version_number IN NUMBER,
908 x_return_status OUT NOCOPY VARCHAR2,
909 x_contra_id OUT NOCOPY NUMBER,
910 x_contract_number OUT NOCOPY VARCHAR2,
911 x_owner_assigned_flag OUT NOCOPY VARCHAR2,
912 x_msg_count OUT NOCOPY NUMBER,
913 x_msg_data OUT NOCOPY VARCHAR2,
914 x_audit_vals_rec OUT NOCOPY sr_audit_rec_type,
915 x_service_request_rec OUT NOCOPY service_request_rec_type,
916 x_autolaunch_wkf_flag OUT NOCOPY VARCHAR2,
917 x_abort_wkf_close_flag OUT NOCOPY VARCHAR2,
918 x_wkf_process_name OUT NOCOPY VARCHAR2,
919 x_workflow_process_id OUT NOCOPY NUMBER,
920 x_interaction_id OUT NOCOPY NUMBER,
921 p_update_desc_flex IN VARCHAR2 DEFAULT fnd_api.g_false,
922 p_called_by_workflow IN VARCHAR2 DEFAULT fnd_api.g_false,
923 p_workflow_process_id IN NUMBER DEFAULT NULL,
924 p_cmro_flag IN VARCHAR2,
925 p_maintenance_flag IN VARCHAR2,
926 p_auto_assign IN VARCHAR2 := 'N'
927 );
928
929 PROCEDURE Validate_ServiceRequest_Record
930 ( p_api_name IN VARCHAR2,
931 p_service_request_rec IN Request_Validation_Rec_Type,
932 p_request_date IN DATE := FND_API.G_MISS_DATE,
933 p_org_id IN NUMBER := NULL,
934 p_resp_appl_id IN NUMBER := NULL,
935 p_resp_id IN NUMBER := NULL,
936 p_user_id IN NUMBER := NULL,
937 p_operation IN VARCHAR2 := NULL,
938 p_close_flag OUT NOCOPY VARCHAR2,
939 p_disallow_request_update OUT NOCOPY VARCHAR2,
940 p_disallow_owner_update OUT NOCOPY VARCHAR2,
941 p_disallow_product_update OUT NOCOPY VARCHAR2,
942 p_employee_name OUT NOCOPY VARCHAR2,
943 p_inventory_item_id OUT NOCOPY NUMBER,
944 p_contract_id OUT NOCOPY NUMBER,
945 p_contract_number OUT NOCOPY VARCHAR2,
946 x_bill_to_site_id OUT NOCOPY NUMBER,
947 x_ship_to_site_id OUT NOCOPY NUMBER,
948 x_bill_to_site_use_id OUT NOCOPY NUMBER,
949 x_ship_to_site_use_id OUT NOCOPY NUMBER,
950 x_return_status OUT NOCOPY VARCHAR2,
951 x_group_name OUT NOCOPY VARCHAR2,
952 x_owner_name OUT NOCOPY VARCHAR2,
953 x_product_revision OUT NOCOPY VARCHAR2,
954 x_component_version OUT NOCOPY VARCHAR2,
955 x_subcomponent_version OUT NOCOPY VARCHAR2,
956 p_cmro_flag IN VARCHAR2,
957 p_maintenance_flag IN VARCHAR2,
958 p_sr_mode IN VARCHAR2
959 );
960
961
962 FUNCTION Get_Importance_Level(P_Severity_Id IN NUMBER) RETURN NUMBER;
963
964 FUNCTION Get_Old_Importance_level(p_incident_id IN NUMBER) RETURN NUMBER;
965
966 FUNCTION Get_Title(P_Object_Code IN VARCHAR2) RETURN VARCHAR2;
967
968 FUNCTION Get_Message(p_message_code IN VARCHAR2) RETURN VARCHAR2;
969
970 FUNCTION Get_Owner_id(p_incident_id IN NUMBER) RETURN NUMBER;
971
972 --------------------------------------------------------------------------
973 -- Procedure Log_SR_PVT_Parameters
974 -- Description:
975 -- This procedure used to log the parameters of service_request_type_rec,
976 -- Notes table and the Contacts table
977 -- This procedure is only going to be called from the Create_ServiceRequest
978 -- and Update_ServiceRequest procedure.
979 --------------------------------------------------------------------------
980
981 PROCEDURE Log_SR_PVT_Parameters
982 ( p_service_request_rec IN service_request_rec_type
983 ,p_notes IN notes_table
984 ,p_contacts IN contacts_table
985 );
986
987 ----------------anmukher--------------07/31/03
988 -- Overloaded procedure added for backward compatibility in 11.5.10
989 -- since several new OUT parameters have been added to the 11.5.9 signature
990 -- in the form of a new record type, sr_create_out_rec_type
991 PROCEDURE Create_ServiceRequest
992 ( p_api_version IN NUMBER,
993 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
994 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
995 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
996 x_return_status OUT NOCOPY VARCHAR2,
997 x_msg_count OUT NOCOPY NUMBER,
998 x_msg_data OUT NOCOPY VARCHAR2,
999 p_resp_appl_id IN NUMBER DEFAULT NULL,
1000 p_resp_id IN NUMBER DEFAULT NULL,
1001 p_user_id IN NUMBER,
1002 p_login_id IN NUMBER DEFAULT NULL,
1003 p_org_id IN NUMBER DEFAULT NULL,
1004 p_request_id IN NUMBER DEFAULT NULL,
1005 p_request_number IN VARCHAR2 DEFAULT NULL,
1006 p_invocation_mode IN VARCHAR2 := 'NORMAL',
1007 p_service_request_rec IN service_request_rec_type,
1008 p_notes IN notes_table,
1009 p_contacts IN contacts_table,
1010 -- Added for Assignment Manager 11.5.9 change
1011 p_auto_assign IN VARCHAR2 Default 'N',
1012 p_default_contract_sla_ind IN VARCHAR2 Default 'N',
1013 x_request_id OUT NOCOPY NUMBER,
1014 x_request_number OUT NOCOPY VARCHAR2,
1015 x_interaction_id OUT NOCOPY NUMBER,
1016 x_workflow_process_id OUT NOCOPY NUMBER,
1017 -- These 3 parameters are added for Assignment Manager 115.9 changes.
1018 x_individual_owner OUT NOCOPY NUMBER,
1019 x_group_owner OUT NOCOPY NUMBER,
1020 x_individual_type OUT NOCOPY VARCHAR2
1021 )
1022 IS
1023 l_api_version CONSTANT NUMBER := 3.0;
1024 l_api_name CONSTANT VARCHAR2(30) := 'Create_ServiceRequest';
1025 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
1026 l_return_status VARCHAR2(1);
1027 -- Added for making call to 11.5.10 signature of Create SR private API
1028 l_sr_create_out_rec sr_create_out_rec_type;
1029 BEGIN
1030 -- Standard start of API savepoint
1031 SAVEPOINT Create_ServiceRequest_PVT;
1032
1033 -- Standard call to check for call compatibility
1034 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
1035 G_PKG_NAME) THEN
1036 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1037 END IF;
1038
1039 -- Initialize message list if p_init_msg_list is set to TRUE
1040 IF FND_API.To_Boolean(p_init_msg_list) THEN
1041 FND_MSG_PUB.Initialize;
1042 END IF;
1043
1044 -- Initialize API return status to success
1045 x_return_status := FND_API.G_RET_STS_SUCCESS;
1046
1047 CS_ServiceRequest_PVT.Create_ServiceRequest
1048 ( p_api_version => 4.0,
1049 p_init_msg_list => fnd_api.g_false ,
1050 p_commit => p_commit,
1051 p_validation_level => p_validation_level,
1052 x_return_status => l_return_status,
1053 x_msg_count => x_msg_count,
1054 x_msg_data => x_msg_data,
1055 p_resp_appl_id => p_resp_appl_id,
1056 p_resp_id => p_resp_id,
1057 p_user_id => p_user_id,
1058 p_login_id => p_login_id,
1059 p_org_id => p_org_id,
1060 p_request_id => p_request_id,
1061 p_request_number => p_request_number,
1062 p_invocation_mode => p_invocation_mode,
1063 p_service_request_rec => p_service_request_rec,
1064 p_notes => p_notes,
1065 p_contacts => p_contacts,
1066 p_auto_assign => p_auto_assign,
1067 p_auto_generate_tasks => 'N',
1068 p_default_contract_sla_ind => p_default_contract_sla_ind,
1069 p_default_coverage_template_id => NULL,
1070 x_sr_create_out_rec => l_sr_create_out_rec
1071 );
1072
1073 x_return_status := l_return_status;
1074
1075 x_request_id := l_sr_create_out_rec.request_id;
1076 x_request_number := l_sr_create_out_rec.request_number;
1077 x_interaction_id := l_sr_create_out_rec.interaction_id;
1078 x_workflow_process_id := l_sr_create_out_rec.workflow_process_id;
1079 x_individual_owner := l_sr_create_out_rec.individual_owner;
1080 x_group_owner := l_sr_create_out_rec.group_owner;
1081 x_individual_type := l_sr_create_out_rec.individual_type;
1082
1083 IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
1084 RAISE FND_API.G_EXC_ERROR;
1085 ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
1086 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1087 END IF;
1088
1089 EXCEPTION
1090 WHEN FND_API.G_EXC_ERROR THEN
1091 ROLLBACK TO Create_ServiceRequest_PVT;
1092 x_return_status := FND_API.G_RET_STS_ERROR;
1093 FND_MSG_PUB.Count_And_Get
1094 ( p_count => x_msg_count,
1095 p_data => x_msg_data
1096 );
1097 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1098 ROLLBACK TO Create_ServiceRequest_PVT;
1099 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1100 FND_MSG_PUB.Count_And_Get
1101 ( p_count => x_msg_count,
1102 p_data => x_msg_data
1103 );
1104 WHEN OTHERS THEN
1105 ROLLBACK TO Create_ServiceRequest_PVT;
1106 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1107 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1108 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1109 END IF;
1110 FND_MSG_PUB.Count_And_Get
1111 ( p_count => x_msg_count,
1112 p_data => x_msg_data
1113 );
1114
1115 END Create_ServiceRequest;
1116
1117 --------------------------------------------------------------------------
1118 -- Create_ServiceRequest
1119 --------------------------------------------------------------------------
1120 -- Modification History:
1121 -- Date Name Desc
1122 ---------- -------- ------------------------------------------------------------
1123 -- 04/29/05 smisra removed contact point logic and replacd it with procedures
1124 -- cs_srcontact_pkg.process to validate contact points and
1125 -- cs_srcontact_pkg.create_update to insert or update
1126 -- service request contact points
1127 -- 05/09/05 smisra Added defaulting of org_id before call to
1128 -- creat_sr_validation.
1129 -- modified insert to cs_incidents_all_b and passed values for
1130 -- columns org_id and maint_organization_id
1131 -- 05/27/05 smisra Bug 4227769
1132 -- Removed owner and group_owner columns from insert into
1133 -- cs_incidents_all_tl table.
1134 -- 06/07/05 smisra Release 12 changes
1135 -- Raised error msg when maint_organization_id is passed for
1136 -- Non EAM service requests
1137 -- Raised error msg when maint_organization_id is NOT passed
1138 -- for EAM SRs with customer product
1139 -- 07/11/05 smisra Release 12 changes
1140 -- Called CS_TZ_GET_DETAILS_PVT.customer_preferred_time_zone
1141 -- to get customer preferred time zone. This time zone is
1142 -- passed to contract API
1143 -- Modified call to cs_srcontact_pkg.process and received two
1144 -- new parameters primary contact id and primary contact point
1145 -- id
1146 -- Moved contact point creation after SR audit creation so
1147 -- that SR audit has audit for SR creation first then child
1148 -- audit for contacts
1149 -- 07/21/05 smisra Added code to set expected resolution and obligation dates
1150 -- in audit record just before call to create audit rec
1151 -- procedure. This was needed because call to get contract may
1152 -- set these dates.
1153 -- 07/26/05 smisra Added code to set expected resolution and obligation dates
1154 -- modified create_servicerequest procedure and moved
1155 -- check on value of maint_organization inside if
1156 -- condition of p_validation_level so that this check
1157 -- is not made when PVT API is called with validation
1158 -- level NONE.
1159 -- 08/06/05 smisra correct multi org OU name
1160 -- 08/03/05 smisra Contract Time zone changes
1161 -- passed incident_occurred_date, time_zone_id and
1162 -- dates_in_input_tz to contract record.
1163 -- Raised error if item_serial_number is passed to this proc
1164 -- 08/16/05 smisra set last_update_program_code in audit record to
1165 -- creation_program_code value
1166 -- 08/17/05 smisra changed org id profile name from CS_SR_DEFAULT_MULTI_ORG_OU
1167 -- to CS_SR_ORG_ID
1168 -- 10/03/05 smisra moved create SR audit and create contact points call before
1169 -- raising business events.
1170 -- 11/16/05 smisra Set coverage_type of audit record using SR Rec column
1171 -- 12/14/05 smisra Bug 4386870. Called vldt_sr_rec after create_sr_validation
1172 -- set incident_country, incident_location_id and
1173 -- incident_locatiomn_type attribute of audit record just-
1174 -- before call to create audit
1175 -- 12/23/05 smisra Bug 4894942, 4892782
1176 -- 1. Called get_incident_type_details if def contr sla is Y
1177 -- because contract defaulting needs business process id
1178 -- 2. Passed additional parameters to vldt_sr_rec call
1179 -- 3. Removed the code to get coverage type. This code is
1180 -- moved to vldt_sr_rec
1181 -- 4. Removed the code to default contract service id, Now
1182 -- this code is part of vldt_sr_rec.
1183 -- 5. Removed the code to get SLA dates. Now this code is part
1184 -- of get_default_contract procedure.
1185 -- 6. Added auditing of following attributes just before call
1186 -- to create audit
1187 -- a. resource_type
1188 -- b. group_type
1189 -- c. incident_owner_id
1190 -- d. group_owner_id
1191 -- e. owner_assigned_time
1192 -- f. territory_id
1193 -- 12/30/05 smisra Bug 4869065
1194 -- Set site_id cols of audit record just before call to
1195 -- create audit
1196 --------------------------------------------------------------------------------
1197 PROCEDURE Create_ServiceRequest
1198 ( p_api_version IN NUMBER,
1199 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
1200 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
1201 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
1202 x_return_status OUT NOCOPY VARCHAR2,
1203 x_msg_count OUT NOCOPY NUMBER,
1204 x_msg_data OUT NOCOPY VARCHAR2,
1205 p_resp_appl_id IN NUMBER DEFAULT NULL,
1206 p_resp_id IN NUMBER DEFAULT NULL,
1207 p_user_id IN NUMBER,
1208 p_login_id IN NUMBER DEFAULT NULL,
1209 p_org_id IN NUMBER DEFAULT NULL,
1210 p_request_id IN NUMBER DEFAULT NULL,
1211 p_request_number IN VARCHAR2 DEFAULT NULL,
1212 p_invocation_mode IN VARCHAR2 := 'NORMAL',
1213 p_service_request_rec IN service_request_rec_type,
1214 p_notes IN notes_table,
1215 p_contacts IN contacts_table ,
1216 -- Added for Assignment Manager 11.5.9 change
1217 p_auto_assign IN VARCHAR2 DEFAULT 'N',
1218 --------------anmukher----------------------07/31/03
1219 -- Added for 11.5.10 projects (AutoTask, Miscellaneous ERs)
1220 p_auto_generate_tasks IN VARCHAR2 Default 'N',
1221 p_default_contract_sla_ind IN VARCHAR2 Default 'N',
1222 p_default_coverage_template_id IN NUMBER Default NULL,
1223 x_sr_create_out_rec OUT NOCOPY sr_create_out_rec_type
1224 ---------------anmukher----------------------08/07/03
1225 -- The following OUT parameters have been added to the record type sr_create_out_rec_type
1226 -- and have therefore been commented out. This will allow avoidance of future overloading
1227 -- if a new OUT parameter were to be needed, since it can be added to the same record type.
1228 -- x_request_id OUT NOCOPY NUMBER,
1229 -- x_request_number OUT NOCOPY VARCHAR2,
1230 -- x_interaction_id OUT NOCOPY NUMBER,
1231 -- x_workflow_process_id OUT NOCOPY NUMBER,
1232 -- These 3 parameters are added for Assignment Manager 115.9 changes.
1233 -- x_individual_owner OUT NOCOPY NUMBER,
1234 -- x_group_owner OUT NOCOPY NUMBER,
1235 -- x_individual_type OUT NOCOPY VARCHAR2
1236 )
1237 IS
1238 l_api_name CONSTANT VARCHAR2(30) := 'Create_ServiceRequest';
1239 -- changed the version from 3.0 to 4.0 anmukher aug 11 2003
1240 l_api_version CONSTANT NUMBER := 4.0;
1241 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
1242 l_log_module CONSTANT VARCHAR2(255) := 'cs.plsql.' || l_api_name_full || '.';
1243 l_return_status VARCHAR2(1);
1244 --- AUDIT
1245 l_audit_vals_rec sr_audit_rec_type;
1246 l_service_request_val_rec Request_Validation_Rec_Type;
1247 l_service_request_rec service_request_rec_type DEFAULT p_service_request_rec;
1248 x_service_request_rec service_request_rec_type DEFAULT p_service_request_rec;
1249 l_transaction_type CONSTANT VARCHAR2(61) := G_PKG_NAME||'_'||l_api_name;
1250 l_message_revision NUMBER;
1251 l_maintenance_mode VARCHAR2(30);
1252 l_sr_contact_point_id NUMBER DEFAULT NULL;
1253 l_contacts contacts_table := p_contacts;
1254 p_update_desc_flex VARCHAR2(1);
1255 p_object_version_number NUMBER;
1256 l_audit_id NUMBER;
1257 l_enqueue_number VARCHAR2(64);
1258 -- Added for automatic assignment
1259 l_owner_assign_forms VARCHAR2(1);
1260 l_owner_assign_html VARCHAR2(1);
1261 l_load_balance_forms VARCHAR2(1);
1262 l_load_balance_html VARCHAR2(1);
1263 l_temp_owner_id NUMBER;
1264 l_temp_owner_type VARCHAR2(30);
1265 l_object_version_number NUMBER;
1266 l_jtf_note_id NUMBER ;
1267 l_owner_assigned_flag VARCHAR2(1);
1268 l_employee_name VARCHAR(240);
1269 l_contra_id NUMBER;
1270 l_contract_number VARCHAR2(120);
1271 l_request_id NUMBER := p_request_id;
1272 l_request_number VARCHAR2(64) := p_request_number;
1273 l_req_id NUMBER;
1274 l_req_num VARCHAR2(64);
1275 l_temp_id NUMBER;
1276 l_temp_num VARCHAR2(64);
1277
1278 l_note_index BINARY_INTEGER;
1279 l_note_id NUMBER;
1280 l_note_context_id NUMBER;
1281 l_notes_detail VARCHAR2(32767);
1282 l_contact_index BINARY_INTEGER;
1283
1284 l_autolaunch_workflow_flag VARCHAR2(1);
1285 l_abort_workflow_close_flag VARCHAR2(1);
1286 l_workflow_process_name VARCHAR2(30);
1287 l_workflow_process_id NUMBER;
1288
1289 l_org_id NUMBER;
1290
1291 l_interaction_id NUMBER;
1292
1293 l_bind_data_id NUMBER;
1294
1295 l_primary_contact_found VARCHAR2(1) := 'N' ;
1296 l_contacts_passed VARCHAR2(1) := 'N';
1297
1298 -- For Workflow Hook
1299 l_workflow_item_key NUMBER;
1300
1301 l_test NUMBER;
1302
1303 -- for UWQ message
1304 l_msg_id NUMBER;
1305 l_msg_count NUMBER;
1306 l_msg_data VARCHAR2(2000);
1307
1308 --Fixed bug#2802393, changed length from 255 to 2500
1309 l_uwq_body VARCHAR2(2500);
1310 l_imp_level NUMBER;
1311 --Fixed bug#2802393, changed length from 30 to 80
1312 l_title VARCHAR2(80);
1313 l_send_uwq_notification BOOLEAN := FALSE;
1314 --Fixed bug#2802393, changed length from 40 to 2000
1315 l_uwq_body1 VARCHAR2(2000);
1316 p_uwq_msg_notification VARCHAR2(30) :='CS_SR_UWQ_NOTIFICATION';
1317
1318 -- l_coverage_type_rec coverage_type_rec; ---- PKESANI
1319 Auto_Assign_Excep EXCEPTION;
1320 invalid_install_site EXCEPTION;
1321 -- Added for enh. 2655115
1322 l_status_flag VARCHAR2(1);
1323
1324 -- Added for enh. 2690787
1325 l_primary_contact NUMBER;
1326
1327 -- Added to be used as OUT parameters in the call to the Business Events wrapper
1328 -- API.
1329 lx_return_status VARCHAR2(3);
1330 lx_msg_count NUMBER(15);
1331 lx_msg_data VARCHAR2(2000);
1332
1333 -- for cmro-eam; Local variable to store the eam/cmro type flags that
1334 -- will be used to populate the sr record type variable that is passed to the
1335 -- user hooks
1336 l_maintenance_flag VARCHAR2(3):= l_service_request_rec.new_type_maintenance_flag;
1337 l_cmro_flag VARCHAR2(3):= l_service_request_rec.new_type_CMRO_flag;
1338 -- Changes for usability changes enh, 11.5.10 project
1339 l_responded_flag VARCHAR2(1);
1340 l_resolved_flag VARCHAR2(1);
1341
1342 -- Added to be used as OUT parameter for calling CS_AutoGen_Task_PVT.Auto_Generate_Tasks API
1343 l_auto_task_gen_rec CS_AutoGen_Task_PVT.auto_task_gen_rec_type;
1344 l_task_template_group_rec JTF_TASK_INST_TEMPLATES_PUB.task_template_group_info;
1345 l_task_template_table JTF_TASK_INST_TEMPLATES_PUB.task_template_info_tbl;
1346 -- Added for Misc ER :Owner auto assignment changes
1347 l_work_item_id NUMBER;
1348
1349 --Added for calling Auditing project of 11.5.10
1350 lx_audit_id NUMBER;
1351
1352 -- Added for 11.5.10 Misc ER : Default SLA (iSupport changes)
1353 px_inp_rec OKS_ENTITLEMENTS_PUB.get_contin_rec;
1354 l_inp_rec OKS_COV_ENT_PUB.gdrt_inp_rec_type;
1355 l_react_rec OKS_COV_ENT_PUB.rcn_rsn_rec_type;
1356 l_resolve_rec OKS_COV_ENT_PUB.rcn_rsn_rec_type;
1357 l_ent_contracts OKS_ENTITLEMENTS_PUB.get_contop_tbl;
1358 Li_TableIdx BINARY_INTEGER;
1359
1360 -- Added for API changes for unassigned_indicator
1361 l_unassigned_indicator NUMBER := 0 ;
1362
1363 -- Local variable to store business usage for security validation
1364 l_business_usage VARCHAR2(30);
1365
1366 -- Local variable to store attribute if security is enabled for self service resps.
1367 l_ss_sr_type_restrict VARCHAR2(10);
1368
1369 -- local variable to get org_id of the SR
1370 l_inc_org_id NUMBER ;
1371
1372 -- local variable for validate owner
1373 lx_owner_name VARCHAR2(240);
1374 lx_owner_id NUMBER;
1375 x_msg_index_out NUMBER;
1376 l_auto_assign_level fnd_profile_option_values.profile_option_value % type;
1377
1378 -- Local variable to store the request_id, to be passed to IEU procedure.
1379 q_request_id NUMBER;
1380 l_note_status VARCHAR2(3);
1381 l_old_contacts contacts_table;
1382 l_processed_contacts contacts_table;
1383 l_sr_related_data RELATED_DATA_TYPE;
1384
1385 lx_timezone_id NUMBER;
1386 lx_timezone_name VARCHAR2(80);
1387 l_primary_contact_party_id NUMBER := NULL;
1388 l_primary_contact_point_id NUMBER := NULL;
1389
1390 BEGIN
1391
1392 -- Standard start of API savepoint
1393 SAVEPOINT Create_ServiceRequest_PVT;
1394
1395 -- Standard call to check for call compatibility
1396 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
1397 G_PKG_NAME) THEN
1398 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1399 END IF;
1400
1401 -- Initialize message list if p_init_msg_list is set to TRUE
1402 IF FND_API.To_Boolean(p_init_msg_list) THEN
1403 FND_MSG_PUB.Initialize;
1404 END IF;
1405
1406 IF ( l_service_request_rec.initialize_flag IS NULL OR
1407 l_service_request_rec.initialize_flag <> G_INITIALIZED) THEN
1408 RAISE FND_API.G_EXC_ERROR;
1409 END IF;
1410
1411 ----------------------- FND Logging -----------------------------------
1412 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
1413 THEN
1414 FND_LOG.String
1415 ( FND_LOG.level_procedure , L_LOG_MODULE || 'start'
1416 , 'Inside ' || L_API_NAME_FULL || ', called with parameters below:'
1417 );
1418 FND_LOG.String
1419 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1420 , 'p_api_version:' || p_api_version
1421 );
1422 FND_LOG.String
1423 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1424 , 'p_init_msg_list:' || p_init_msg_list
1425 );
1426 FND_LOG.String
1427 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1428 , 'p_commit:' || p_commit
1429 );
1430 FND_LOG.String
1431 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1432 , 'p_resp_appl_id:' || p_resp_appl_id
1433 );
1434 FND_LOG.String
1435 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1436 , 'p_resp_id:' || p_resp_id
1437 );
1438 FND_LOG.String
1439 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1440 , 'p_user_id:' || p_user_id
1441 );
1442 FND_LOG.String
1443 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1444 , 'p_login_id:' || p_login_id
1445 );
1446 FND_LOG.String
1447 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1448 , 'p_org_id:' || p_org_id
1449 );
1450 FND_LOG.String
1451 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1452 , 'p_request_id:' || p_request_id
1453 );
1454 FND_LOG.String
1455 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1456 , 'p_request_number:' || p_request_number
1457 );
1458 FND_LOG.String
1459 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1460 , 'p_validation_level:' || p_validation_level
1461 );
1462 FND_LOG.String
1463 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1464 , 'p_invocation_mode:' || p_invocation_mode
1465 );
1466 FND_LOG.String
1467 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1468 , 'p_auto_assign:' || p_auto_assign
1469 );
1470 FND_LOG.String
1471 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1472 , 'p_auto_generate_tasks:' || p_auto_generate_tasks
1473 );
1474 FND_LOG.String
1475 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1476 , 'p_default_contract_sla_ind:' || p_default_contract_sla_ind
1477 );
1478 FND_LOG.String
1479 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1480 , 'p_default_coverage_template_id:' || p_default_coverage_template_id
1481 );
1482
1483 -- --------------------------------------------------------------------------
1484 -- This procedure Logs the record paramters of SR and NOTES, CONTACTS tables.
1485 -- --------------------------------------------------------------------------
1486 Log_SR_PVT_Parameters
1487 ( p_service_request_rec => p_service_request_rec
1488 , p_notes => p_notes
1489 , p_contacts => p_contacts
1490 );
1491
1492 END IF;
1493
1494
1495 IF l_service_request_rec.item_serial_number <> FND_API.G_MISS_CHAR
1496 THEN
1497 FND_MESSAGE.set_name ('CS', 'CS_SR_ITEM_SERIAL_OBSOLETE');
1498 FND_MESSAGE.set_token
1499 ( 'API_NAME'
1500 , 'CS_SERVICEREQUEST_PVT.create_servicerequest'
1501 );
1502 FND_MSG_PUB.ADD_DETAIL
1503 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.ITEM_SERIAL_NUMBER'
1504 );
1505 RAISE FND_API.G_EXC_ERROR;
1506 END IF;
1507
1508 -- Initialize API return status to success
1509 x_return_status := FND_API.G_RET_STS_SUCCESS;
1510
1511
1512 if ( p_validation_level > FND_API.G_VALID_LEVEL_NONE ) then
1513 -- First step is to validate if the current responsibility has access to the
1514 -- SR type being created. Invoke the VALIDATE_TYPE procedure that has the
1515 -- logic to check for security access
1516
1517 -- Get the business usage of the responsibility that is attempting to create
1518 -- the SR.
1519 get_business_usage (
1520 p_responsibility_id => p_resp_id,
1521 p_application_id => fnd_global.resp_appl_id,
1522 x_business_usage => l_business_usage );
1523
1524 -- Get indicator of self service security enabled or not
1525 if ( l_business_usage = 'SELF_SERVICE' ) then
1526 get_ss_sec_enabled (
1527 x_ss_sr_type_restrict => l_ss_sr_type_restrict );
1528 end if;
1529
1530 -- For bug 3370562 - pass resp_id an appl_id
1531 -- validate security in create
1532 cs_servicerequest_util.validate_type (
1533 p_parameter_name => NULL,
1534 p_type_id => p_service_request_rec.type_id,
1535 p_subtype => G_SR_SUBTYPE,
1536 p_status_id => p_service_request_rec.status_id,
1537 p_resp_id => p_resp_id,
1538 p_resp_appl_id => NVL(p_resp_appl_id,fnd_global.resp_appl_id),
1539 p_business_usage => l_business_usage,
1540 p_ss_srtype_restrict => l_ss_sr_type_restrict,
1541 p_operation => 'CREATE',
1542 x_return_status => lx_return_status,
1543 x_cmro_flag => l_cmro_flag,
1544 x_maintenance_flag => l_maintenance_flag );
1545
1546 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) then
1547 -- security violation; responsibility does not have access to SR Type
1548 -- being created. Stop and raise error.
1549 RAISE FND_API.G_EXC_ERROR;
1550 end if;
1551
1552 IF NVL(l_maintenance_flag,'N') <> 'Y'
1553 THEN
1554 IF p_service_request_rec.maint_organization_id <> FND_API.G_MISS_NUM
1555 THEN
1556 FND_MESSAGE.set_name ('CS', 'CS_SR_MAINT_ORG_NOT_ALLOWED');
1557 FND_MESSAGE.set_token
1558 ( 'API_NAME'
1559 , 'CS_SERVICEREQUEST_PVT.create_servicerequest'
1560 );
1561 FND_MSG_PUB.ADD_DETAIL
1562 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.MAINT_ORGANIZATION_ID'
1563 );
1564 RAISE FND_API.G_EXC_ERROR;
1565 END IF;
1566 ELSE -- maintenance flag is 'Y'
1567 IF (p_service_request_rec.customer_product_id IS NOT NULL AND
1568 p_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM)
1569 THEN
1570 IF p_service_request_rec.maint_organization_id = FND_API.G_MISS_NUM
1571 THEN
1572 CS_ServiceRequest_UTIL.Add_Missing_Param_Msg(l_api_name_full, 'Maint_organization_id');
1573 RAISE FND_API.G_EXC_ERROR;
1574 ELSIF (p_service_request_rec.maint_organization_id IS NULL) THEN
1575 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'Maint_organization_id');
1576 RAISE FND_API.G_EXC_ERROR;
1577 END IF;
1578 END IF;
1579 END IF;
1580 end if; -- if ( p_validation_level > FND_API.G_VALID_LEVEL_NONE ) then
1581
1582 -- Initialize the value of the parameter from profile cs_sr_restrict_ib
1583 -- by shijain 4th dec 2002
1584
1585 g_restrict_ib:= fnd_profile.value('CS_SR_RESTRICT_IB');
1586
1587 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
1588 THEN
1589 FND_LOG.String
1590 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1591 , 'The Value of profile CS_SR_RESTRICT_IB :' || g_restrict_ib
1592 );
1593 END IF;
1594 -- At present the call below in needed only for defaulting contract
1595 -- if type attributes are needed for some other purpose then the if condition
1596 -- can be modified accordingly
1597 IF p_default_contract_sla_ind = 'Y'
1598 THEN
1599 CS_SERVICEREQUEST_PVT.get_incident_type_details
1600 ( p_incident_type_id => p_service_request_rec.type_id
1601 , x_business_process_id => l_sr_related_data.business_process_id
1602 , x_autolaunch_workflow_flag => l_sr_related_data.autolaunch_workflow_flag
1603 , x_abort_workflow_close_flag => l_sr_related_data.abort_workflow_close_flag
1604 , x_workflow => l_sr_related_data.workflow
1605 , x_return_status => l_return_status
1606 );
1607 IF l_return_status = FND_API.G_RET_STS_ERROR
1608 THEN
1609 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
1610 ( p_token_an => l_api_name_full
1611 , p_token_v => TO_CHAR(p_service_request_rec.type_id)
1612 , p_token_p => 'p_type_id'
1613 , p_table_name => G_TABLE_NAME
1614 , p_column_name => 'INCIDENT_TYPE_ID'
1615 );
1616 RAISE FND_API.G_EXC_ERROR;
1617 END IF;
1618
1619 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
1620 THEN
1621 FND_LOG.String
1622 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1623 , 'The defaulted value of parameter business_process_id :'
1624 || l_sr_related_data.business_process_id
1625 );
1626 END IF;
1627 END IF;
1628
1629 --
1630 -- Make the preprocessing call to the user hooks
1631 --
1632 -- Pre call to the Customer Type User Hook
1633 --
1634 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
1635 'Create_ServiceRequest',
1636 'B', 'C') THEN
1637
1638 -- hardcoded the version 2.0 shijain nov 27 2002
1639
1640 cs_servicerequest_cuhk.Create_ServiceRequest_Pre(
1641 p_api_version => 2.0,
1642 p_init_msg_list => fnd_api.g_false ,
1643 p_commit => p_commit,
1644 p_validation_level => p_validation_level,
1645 x_return_status => l_return_status,
1646 x_msg_count => x_msg_count ,
1647 x_msg_data => x_msg_data,
1648 p_resp_appl_id => p_resp_appl_id,
1649 p_resp_id => p_resp_id,
1650 p_user_id => p_user_id,
1651 p_login_id => p_login_id,
1652 p_org_id => p_org_id,
1653 p_request_id => l_request_id,
1654 p_request_number => l_request_number,
1655 p_invocation_mode => p_invocation_mode,
1656 p_service_request_rec => l_service_request_rec,
1657 p_notes => p_notes,
1658 p_contacts => p_contacts,
1659 -- Changed out parameter references to out rec references
1660 x_request_id => x_sr_create_out_rec.request_id,
1661 x_request_number => x_sr_create_out_rec.request_number,
1662 x_interaction_id => x_sr_create_out_rec.interaction_id,
1663 x_workflow_process_id => x_sr_create_out_rec.workflow_process_id);
1664
1665 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1666 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1667 END IF;
1668 END IF;
1669
1670 -- Pre call to the Vertical Type User Hook
1671 --
1672 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
1673 'Create_ServiceRequest',
1674 'B', 'V') THEN
1675
1676 -- hardcoded the version 2.0 shijain nov 27 2002
1677
1678 cs_servicerequest_vuhk.Create_ServiceRequest_Pre(
1679 p_api_version => 2.0,
1680 p_init_msg_list => fnd_api.g_false ,
1681 p_commit => p_commit,
1682 p_validation_level => p_validation_level,
1683 x_return_status => l_return_status,
1684 x_msg_count => x_msg_count ,
1685 x_msg_data => x_msg_data,
1686 p_resp_appl_id => p_resp_appl_id,
1687 p_resp_id => p_resp_id,
1688 p_user_id => p_user_id,
1689 p_login_id => p_login_id,
1690 p_org_id => p_org_id,
1691 p_request_id => l_request_id,
1692 p_request_number => l_request_number,
1693 p_service_request_rec => l_service_request_rec,
1694 p_notes => p_notes,
1695 p_contacts => p_contacts,
1696 -- Changed out parameter references to out rec references
1697 x_request_id => x_sr_create_out_rec.request_id,
1698 x_request_number => x_sr_create_out_rec.request_number,
1699 x_interaction_id => x_sr_create_out_rec.interaction_id,
1700 x_workflow_process_id => x_sr_create_out_rec.workflow_process_id);
1701
1702 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1703 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1704 END IF;
1705 END IF;
1706
1707 -- Pre call to the Internal Type User Hook
1708 --
1709 -- Code to populate the global record type with the passed record type
1710 --
1711 -- internal_user_hooks_rec.customer_id := l_old_ServiceRequest_rec.customer_id ;
1712 -- internal_user_hooks_rec.request_id := p_request_id ;
1713
1714 -- Mobile FS team usually has packages registered for execution
1715 -- So, if the API returns an unexpected error, please check
1716 -- JTF_HOOKS_DATA for the Mobile FS packges and check if they are invalid
1717
1718 cs_servicerequest_iuhk.Create_ServiceRequest_Pre( x_return_status=>l_return_status);
1719
1720 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1721 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1722 END IF;
1723 IF p_org_id IS NULL
1724 THEN
1725 l_org_id := to_number(FND_PROFILE.value('CS_SR_ORG_ID'));
1726
1727 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
1728 THEN
1729 FND_LOG.String
1730 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1731 , 'The Value of profile CS_SR_ORG_ID :' || l_org_id
1732 );
1733 END IF;
1734
1735 ELSE
1736 l_org_id := p_org_id;
1737 END IF;
1738 CS_ServiceRequest_PVT.Create_SR_Validation
1739 ( p_api_name => l_api_name_full,
1740 p_service_request_rec => p_service_request_rec,
1741 p_contacts => p_contacts,
1742 p_resp_id => p_resp_id,
1743 p_resp_appl_id => p_resp_appl_id,
1744 p_user_id => p_user_id,
1745 p_login_id => p_login_id,
1746 p_org_id => l_org_id,
1747 p_request_id => p_request_id,
1748 p_request_number => p_request_number,
1749 p_validation_level => p_validation_level,
1750 p_commit => p_commit,
1751 x_msg_count => x_msg_count,
1752 x_msg_data => x_msg_data,
1753 x_return_status => l_return_status,
1754 x_contra_id => l_contra_id,
1755 x_contract_number => l_contract_number,
1756 x_owner_assigned_flag => l_owner_assigned_flag,
1757 x_req_id => l_req_id,
1758 x_request_id => l_request_id,
1759 x_req_num => l_req_num,
1760 x_request_number => l_request_number,
1761 x_autolaunch_wkf_flag => l_autolaunch_workflow_flag,
1762 x_abort_wkf_close_flag=> l_abort_workflow_close_flag,
1763 x_wkf_process_name => l_workflow_process_name,
1764 x_audit_vals_rec => l_audit_vals_rec,
1765 x_service_request_rec => l_service_request_rec,
1766 -- for cmro
1767 p_cmro_flag => l_cmro_flag,
1768 p_maintenance_flag => l_maintenance_flag,
1769 p_auto_assign => p_auto_assign
1770 );
1771
1772 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1773 RAISE FND_API.G_EXC_ERROR;
1774 END IF;
1775
1776 -- for cmro_eam
1777
1778 l_service_request_rec.New_type_CMRO_flag := l_cmro_flag;
1779 l_service_request_rec.New_type_Maintenance_flag := l_maintenance_flag;
1780
1781 -- end for cmro
1782
1783
1784
1785 /***************************************************************
1786 This is a tempopary solution for Depot Repair team to get the site_use_id
1787 if the site_id is passed from the SR form and the validation level is none
1788 **********************************************/
1789
1790 IF ( p_validation_level = FND_API.G_VALID_LEVEL_NONE ) THEN
1791 IF ( p_service_request_rec.bill_to_site_id <> FND_API.G_MISS_NUM AND
1792 p_service_request_rec.bill_to_site_id IS NOT NULL ) THEN
1793
1794 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
1795 ( p_api_name => 'Get bill to site use id',
1796 p_parameter_name => 'Bill_To Site ',
1797 p_bill_to_site_id => p_service_request_rec.bill_to_site_id,
1798 p_bill_to_party_id => p_service_request_rec.bill_to_party_id,
1799 p_site_use_type => 'BILL_TO',
1800 x_site_use_id => l_service_request_rec.bill_to_site_use_id,
1801 x_return_status => l_return_status
1802 );
1803 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1804 RAISE FND_API.G_EXC_ERROR;
1805 END IF;
1806 END IF;
1807
1808 IF ( p_service_request_rec.ship_to_site_id <> FND_API.G_MISS_NUM AND
1809 p_service_request_rec.ship_to_site_id IS NOT NULL ) THEN
1810
1811 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
1812 ( p_api_name => 'Get ship to site use id',
1813 p_parameter_name => 'Ship_To Site ',
1814 p_bill_to_site_id => p_service_request_rec.ship_to_site_id,
1815 p_bill_to_party_id => p_service_request_rec.ship_to_party_id,
1816 p_site_use_type => 'SHIP_TO',
1817 x_site_use_id => l_service_request_rec.ship_to_site_use_id,
1818 x_return_status => l_return_status
1819 );
1820 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
1821 RAISE FND_API.G_EXC_ERROR;
1822 END IF;
1823 END IF;
1824
1825 IF ( p_service_request_rec.install_site_id <> FND_API.G_MISS_NUM) THEN
1826 l_service_request_rec.install_site_use_id:=
1827 p_service_request_rec.install_site_id;
1828 END IF;
1829 END IF;
1830 -- For BUG # 2933250 check to see if install_site_id and install_site_use_id are same . -- pkesani
1831
1832 IF (p_service_request_rec.install_site_id <> FND_API.G_MISS_NUM) AND
1833 (p_service_request_rec.install_site_use_id <> FND_API.G_MISS_NUM) THEN
1834 IF ( p_service_request_rec.install_site_id <> p_service_request_rec.install_site_use_id) THEN
1835 RAISE invalid_install_site;
1836 END IF;
1837 END IF;
1838
1839
1840 /********************************************************************
1841 Changes for depot repair finished, need to remove all this for 115.10
1842 ***********************************************************************/
1843
1844 ----- Validate owner id .
1845 --- If the passed owner_id is not valid , NULL will be assigned to
1846 --- incident_owner_id column in the DB.
1847
1848
1849 -- UWQ pop up in service request
1850 -- while creating an SR from Teleservice
1851 l_imp_level := Get_Importance_Level(p_service_request_rec.severity_id);
1852 --select the l_title from jtf_objects_vl
1853 l_title := Get_Title('SR');
1854 -- Assign the value of request_id to the local variable that will be passed to the
1855 -- IEU procedure .
1856 IF l_request_id IS NULL THEN
1857 q_request_id := l_req_id ;
1858 ELSE
1859 q_request_id := l_request_id;
1860 END IF;
1861
1862 l_uwq_body1 := Get_Message(p_uwq_msg_notification);
1863
1864 l_uwq_body := l_title ||' '|| l_req_num ||' '|| l_uwq_body1 ||' '||TO_CHAR(SYSDATE,'MM/DD/YYYY HH24:MI:SS'); --with time;
1865
1866 IF (l_service_request_rec.last_update_channel in ('PHONE', 'AGENT') AND
1867 l_imp_level =1 AND
1868 l_service_request_rec.owner_id IS NOT NULL AND
1869 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM) OR
1870 (l_service_request_rec.last_update_channel = 'WEB' AND
1871 (l_imp_level =1 OR l_imp_level =2) AND
1872 l_service_request_rec.owner_id IS NOT NULL AND
1873 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM) THEN
1874 l_send_uwq_notification := TRUE;
1875 END IF;
1876
1877 IF l_send_uwq_notification THEN
1878 IEU_MSG_PRODUCER_PUB.Send_Plain_text_Msg (
1879 p_api_version => 1.0,
1880 p_init_msg_list => fnd_api.g_false,
1881 p_commit => fnd_api.g_false,
1882 p_application_id => 170,
1883 p_resource_id => l_service_request_rec.owner_id,
1884 p_resource_type => l_service_request_rec.resource_type,
1885 p_title => l_title,
1886 p_body => l_uwq_body,
1887 p_workitem_obj_code=> 'SR',
1888 p_workitem_pk_id => q_request_id,
1889 x_message_id => l_msg_id,
1890 x_return_status => l_return_status,
1891 x_msg_count => l_msg_count,
1892 x_msg_data => l_msg_data );
1893 END IF;
1894
1895 /* Added call to get_status_flag for enh 2655115, to get the status flag
1896 based on the closed flag by shijain date 27th nov 2002*/
1897
1898 -- for bug 3050727 - commented out as the flag is updated in the create_Sr_validation
1899 -- l_status_flag:= get_status_flag ( l_service_request_rec.status_id);
1900
1901 /* this code is moved in create_sr_validate. it's presence after create_sr_validation
1902 stops stamping of incident_resolved_date and inc_responded_by_date to audit rec
1903 smisra 12/31/2003
1904 SELECT responded_flag,resolved_flag
1905 INTO l_responded_flag,l_resolved_flag
1906 FROM cs_incident_statuses_vl
1907 WHERE incident_status_id=l_service_request_rec.status_id ;
1908
1909 IF ((l_responded_flag='Y') OR (l_resolved_flag ='Y')) THEN
1910 IF((l_responded_flag='Y' ) AND (l_service_request_rec.inc_responded_by_date is NULL OR
1911 l_service_request_rec.inc_responded_by_date= FND_API.G_MISS_DATE ))
1912 THEN
1913 l_service_request_rec.inc_responded_by_date := SYSDATE;
1914
1915 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
1916 THEN
1917 FND_LOG.String
1918 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1919 , 'The defaulted value of parameter inc_responded_by_date :'
1920 || l_service_request_rec.inc_responded_by_date
1921 );
1922 END IF;
1923 END IF;
1924
1925 IF((l_resolved_flag ='Y' ) AND (l_service_request_rec.incident_resolved_date is NULL
1926 OR l_service_request_rec.incident_resolved_date = FND_API.G_MISS_DATE ))
1927 THEN
1928 l_service_request_rec.incident_resolved_date := SYSDATE;
1929
1930 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
1931 THEN
1932 FND_LOG.String
1933 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
1934 , 'The defaulted value of parameter incident_resolved_date :'
1935 || l_service_request_rec.incident_resolved_date
1936 );
1937 END IF;
1938 END IF;
1939 END IF;
1940 */
1941 /* end of usability changes*/
1942 -- Validate service request contacts
1943 CS_SRCONTACT_PKG.process
1944 ( p_mode => 'CREATE'
1945 , p_incident_id => NULL
1946 , p_caller_type => l_service_request_rec.caller_type
1947 , p_customer_id => l_service_request_rec.customer_id
1948 , p_validation_mode => p_validation_level
1949 , p_contact_tbl => p_contacts
1950 , x_contact_tbl => l_processed_contacts
1951 , x_old_contact_tbl => l_old_contacts
1952 , x_primary_party_id => l_sr_related_data.primary_party_id
1953 , x_primary_contact_point_id => l_sr_related_data.primary_contact_point_id
1954 , x_return_status => l_return_status
1955 );
1956 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
1957 THEN
1958 RAISE FND_API.G_EXC_ERROR;
1959 END IF;
1960 -- End of SR contact validation
1961 vldt_sr_rec
1962 ( p_sr_rec => l_service_request_rec
1963 , p_sr_rec_inp => p_service_request_rec
1964 , p_sr_related_data => l_sr_related_data
1965 , p_mode => 'CREATE'
1966 , p_request_id => NULL
1967 , p_object_version_number => NULL
1968 , p_last_updated_by => p_user_id
1969 , p_validation_level => p_validation_level
1970 , p_default_contract_sla_ind => p_default_contract_sla_ind
1971 , p_default_coverage_template_id => p_default_coverage_template_id
1972 , p_auto_assign => p_auto_assign
1973 , x_contract_number => l_contract_number
1974 , x_return_status => l_return_status
1975 );
1976 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
1977 THEN
1978 RAISE FND_API.G_EXC_ERROR;
1979 END IF;
1980 l_contra_id := l_service_request_rec.contract_id;
1981
1982
1983 -- Code Changes for setting unassigned_indicator
1984 -- 12/3/03 smisra. as l_service_request_rec will have owner, group info
1985 -- returned by Assignment manager API, so using l_ser.. instead of p_service..
1986 IF (l_service_request_rec.owner_id <> FND_API.G_MISS_NUM AND
1987 l_service_request_rec.owner_id IS NOT NULL ) AND
1988 (l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM AND
1989 l_service_request_rec.owner_group_id IS NOT NULL ) THEN
1990 l_unassigned_indicator := 3 ;
1991 ELSIF (l_service_request_rec.owner_id <> FND_API.G_MISS_NUM AND
1992 l_service_request_rec.owner_id IS NOT NULL ) AND
1993 (l_service_request_rec.owner_group_id = FND_API.G_MISS_NUM OR
1994 l_service_request_rec.owner_group_id IS NULL ) THEN
1995 l_unassigned_indicator := 1 ;
1996 ELSIF (l_service_request_rec.owner_id = FND_API.G_MISS_NUM OR
1997 l_service_request_rec.owner_id IS NULL ) AND
1998 (l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM AND
1999 l_service_request_rec.owner_group_id IS NOT NULL ) THEN
2000 l_unassigned_indicator := 2 ;
2001 ELSE
2002 l_unassigned_indicator := 0 ;
2003 END IF;
2004 -- Start of change , Sanjana Rao, bug 6955756
2005 IF (l_service_request_rec.owner_id <> FND_API.G_MISS_NUM AND
2006 l_service_request_rec.owner_id IS NOT NULL )
2007 THEN
2008 l_service_request_rec.owner_assigned_time := SYSDATE;
2009 END IF;
2010 --- End of change , Sanjana Rao , bug 6955756
2011
2012 x_sr_create_out_rec.individual_owner := l_service_request_rec.owner_id;
2013 x_sr_create_out_rec.individual_type := l_service_request_rec.resource_type;
2014 x_sr_create_out_rec.group_owner := l_service_request_rec.owner_group_id;
2015 -- March 23 2000, customer_number is not to be stored in cs_incidents_all_b
2016 -- If passed to teh api, it is used to retrieve the id from customer table
2017 -- l_service_request_rec.customer_number, /*CUSTOMER_NUMBER*/
2018
2019
2020
2021 --
2022 -- Insert into _B table
2023 --
2024 INSERT INTO cs_incidents_all_b
2025 ( incident_id,
2026 last_update_date,
2027 last_updated_by,
2028 creation_date,
2029 created_by,
2030 last_update_login,
2031 incident_number,
2032 incident_status_id,
2033 incident_type_id,
2034 incident_urgency_id,
2035 incident_severity_id,
2036 incident_owner_id,
2037 resource_type,
2038 -- resource_subtype_id, -- For BUG 2748584
2039 inventory_item_id,
2040 caller_type,
2041 customer_id,
2042 account_id,
2043 employee_id,
2044 current_serial_number,
2045 expected_resolution_date,
2046 actual_resolution_date,
2047 customer_product_id,
2048 bill_to_site_use_id,
2049 bill_to_contact_id,
2050 ship_to_site_use_id,
2051 ship_to_contact_id,
2052 install_site_use_id,
2053 incident_attribute_1,
2054 incident_attribute_2,
2055 incident_attribute_3,
2056 incident_attribute_4,
2057 incident_attribute_5,
2058 incident_attribute_6,
2059 incident_attribute_7,
2060 incident_attribute_8,
2061 incident_attribute_9,
2062 incident_attribute_10,
2063 incident_attribute_11,
2064 incident_attribute_12,
2065 incident_attribute_13,
2066 incident_attribute_14,
2067 incident_attribute_15,
2068 incident_context,
2069 external_attribute_1,
2070 external_attribute_2,
2071 external_attribute_3,
2072 external_attribute_4,
2073 external_attribute_5,
2074 external_attribute_6,
2075 external_attribute_7,
2076 external_attribute_8,
2077 external_attribute_9,
2078 external_attribute_10,
2079 external_attribute_11,
2080 external_attribute_12,
2081 external_attribute_13,
2082 external_attribute_14,
2083 external_attribute_15,
2084 external_context,
2085 resolution_code,
2086 incident_date,
2087 problem_code,
2088 original_order_number,
2089 purchase_order_num,
2090 close_date,
2091 publish_flag,
2092 obligation_date,
2093 qa_collection_id,
2094 contract_service_id,
2095 contract_id,
2096 contract_number,
2097 project_number,
2098 customer_po_number,
2099 customer_ticket_number,
2100 time_zone_id,
2101 time_difference,
2102 platform_id,
2103 platform_version,
2104 platform_version_id,
2105 db_version,
2106 cp_component_id,
2107 cp_component_version_id,
2108 cp_subcomponent_id,
2109 cp_subcomponent_version_id,
2110 cp_revision_id,
2111 inv_item_revision,
2112 inv_component_id,
2113 inv_component_version,
2114 inv_subcomponent_id,
2115 inv_subcomponent_version,
2116 site_id,
2117 customer_site_id,
2118 territory_id,
2119 inv_organization_id,
2120 object_version_number,
2121 -----Added for enhancement 11.5.6
2122 cust_pref_lang_id,
2123 tier,
2124 tier_version,
2125 operating_system,
2126 operating_system_version,
2127 DATABASE,
2128 category_id,
2129 group_type,
2130 owner_group_id,
2131 group_territory_id,
2132 owner_assigned_time,
2133 owner_assigned_flag,
2134 --- Added for the unassigned_ind enh.
2135 unassigned_indicator,
2136 inv_platform_org_id,
2137 product_revision,
2138 component_version,
2139 subcomponent_version,
2140 comm_pref_code,
2141 cust_pref_lang_code,
2142 last_update_channel,
2143 category_set_id,
2144 external_reference,
2145 system_id,
2146 error_code,
2147 incident_occurred_date,
2148 incident_resolved_date,
2149 inc_responded_by_date,
2150 incident_location_id ,
2151 incident_address ,
2152 incident_city,
2153 incident_state,
2154 incident_country,
2155 incident_province ,
2156 incident_postal_code ,
2157 incident_county,
2158 sr_creation_channel ,
2159 -- Added for ER# 2320056
2160 coverage_type ,
2161 -- Added For ER# 2433831
2162 bill_to_account_id ,
2163 ship_to_account_id ,
2164 -- Added for ER# 2463321
2165 customer_phone_id,
2166 customer_email_id,
2167 -- Added for source changes for 1159 by shijain oct 11 2002
2168 creation_program_code,
2169 last_update_program_code,
2170 bill_to_party_id,
2171 ship_to_party_id,
2172 bill_to_site_id,
2173 ship_to_site_id,
2174 program_id ,
2175 program_application_id ,
2176 request_id ,
2177 program_login_id ,
2178 -- Added for enh 2655115
2179 status_flag,
2180 -- Added address field by shijain dec5th 2002
2181 incident_point_of_interest ,
2182 incident_cross_street ,
2183 incident_direction_qualifier ,
2184 incident_distance_qualifier ,
2185 incident_distance_qual_uom ,
2186 incident_address2 ,
2187 incident_address3 ,
2188 incident_address4 ,
2189 incident_address_style ,
2190 incident_addr_lines_phonetic ,
2191 incident_po_box_number ,
2192 incident_house_number ,
2193 incident_street_suffix ,
2194 incident_street ,
2195 incident_street_number ,
2196 incident_floor,
2197 incident_suite ,
2198 incident_postal_plus4_code ,
2199 incident_position ,
2200 incident_location_directions,
2201 incident_location_description ,
2202 install_site_id,
2203 -- for cmro_eam
2204 owning_department_id,
2205 -- Added for MIsc ERs project of 11.5.10 --anmukher --08/26/03
2206 incident_location_type,
2207 -- Added for Auditing project of 11.5.10 --anmukher --09/03/03
2208 incident_last_modified_date ,
2209 maint_organization_id,
2210 org_id
2211 )
2212 VALUES
2213 ( DECODE(l_request_id,NULL,l_req_id,l_request_id), /* INCIDENT_ID */
2214 l_service_request_rec.last_update_date, /* LAST_UPDATE_DATE */
2215 l_service_request_rec.last_updated_by, /* LAST_UPDATED_BY */
2216 l_service_request_rec.creation_date, /* CREATION_DATE */
2217 l_service_request_rec.created_by, /* CREATED_BY */
2218 l_service_request_rec.last_update_login, /* LAST_UPDATE_LOGIN */
2219 DECODE(l_request_number,NULL,l_req_num,l_request_number), /* INCIDENT_NUMBER */
2220 l_service_request_rec.status_id, /* INCIDENT_STATUS_ID */
2221 l_service_request_rec.type_id, /* INCIDENT_TYPE_ID */
2222 l_service_request_rec.urgency_id, /* INCIDENT_URGENCY_ID */
2223 l_service_request_rec.severity_id, /* INCIDENT_SEVERITY_ID */
2224 l_service_request_rec.owner_id, /* INCIDENT_OWNER_ID */
2225 l_service_request_rec.resource_type, /* RESOURCE_TYPE */
2226 -- l_service_request_rec.resource_subtype_id, /* RESOURCE_SUBTYPE_ID */ For BUG 2748584
2227 l_service_request_rec.inventory_item_id, /* INVENTORY_ITEM_ID */
2228 l_service_request_rec.caller_type, /* CALLER_TYPE */
2229 -- removed decode for 11.5.6 enhancement
2230 l_service_request_rec.customer_id, /* CUSTOMER_ID */
2231 l_service_request_rec.account_id, /* ACCOUNT_ID */
2232 l_service_request_rec.employee_id, /* EMPLOYEE_ID */
2233 l_service_request_rec.current_serial_number, /* CURRENT_SERIAL_NUMBER */
2234 l_service_request_rec.exp_resolution_date, /* EXPECTED_RESOLUTION_DATE */
2235 l_service_request_rec.act_resolution_date, /* ACTUAL_RESOLUTION_DATE */
2236 l_service_request_rec.customer_product_id, /* CUSTOMER_PRODUCT_ID */
2237 l_service_request_rec.bill_to_site_use_id, /* BILL_TO_SITE_USE_ID */
2238 l_service_request_rec.bill_to_contact_id, /* BILL_TO_CONTACT_ID */
2239 l_service_request_rec.ship_to_site_use_id, /* SHIP_TO_SITE_USE_ID */
2240 l_service_request_rec.ship_to_contact_id, /* SHIP_TO_CONTACT_ID */
2241 l_service_request_rec.install_site_use_id, /* INSTALL_SITE_USE_ID */
2242 l_service_request_rec.request_attribute_1, /* INCIDENT_ATTRIBUTE_1 */
2243 l_service_request_rec.request_attribute_2, /* INCIDENT_ATTRIBUTE_2 */
2244 l_service_request_rec.request_attribute_3, /* INCIDENT_ATTRIBUTE_3 */
2245 l_service_request_rec.request_attribute_4, /* INCIDENT_ATTRIBUTE_4 */
2246 l_service_request_rec.request_attribute_5, /* INCIDENT_ATTRIBUTE_5 */
2247 l_service_request_rec.request_attribute_6, /* INCIDENT_ATTRIBUTE_6 */
2248 l_service_request_rec.request_attribute_7, /* INCIDENT_ATTRIBUTE_7 */
2249 l_service_request_rec.request_attribute_8, /* INCIDENT_ATTRIBUTE_8 */
2250 l_service_request_rec.request_attribute_9, /* INCIDENT_ATTRIBUTE_9 */
2251 l_service_request_rec.request_attribute_10, /* INCIDENT_ATTRIBUTE_10 */
2252 l_service_request_rec.request_attribute_11, /* INCIDENT_ATTRIBUTE_11 */
2253 l_service_request_rec.request_attribute_12, /* INCIDENT_ATTRIBUTE_12 */
2254 l_service_request_rec.request_attribute_13, /* INCIDENT_ATTRIBUTE_13 */
2255 l_service_request_rec.request_attribute_14, /* INCIDENT_ATTRIBUTE_14 */
2256 l_service_request_rec.request_attribute_15, /* INCIDENT_ATTRIBUTE_15 */
2257 l_service_request_rec.request_context, /* INCIDENT_CONTEXT */
2258 l_service_request_rec.external_attribute_1, /* EXTERNAL_ATTRIBUTE_1 */
2259 l_service_request_rec.external_attribute_2, /* EXTERNAL_ATTRIBUTE_2 */
2260 l_service_request_rec.external_attribute_3, /* EXTERNAL_ATTRIBUTE_3 */
2261 l_service_request_rec.external_attribute_4, /* EXTERNAL_ATTRIBUTE_4 */
2262 l_service_request_rec.external_attribute_5, /* EXTERNAL_ATTRIBUTE_5 */
2263 l_service_request_rec.external_attribute_6, /* EXTERNAL_ATTRIBUTE_6 */
2264 l_service_request_rec.external_attribute_7, /* EXTERNAL_ATTRIBUTE_7 */
2265 l_service_request_rec.external_attribute_8, /* EXTERNAL_ATTRIBUTE_8 */
2266 l_service_request_rec.external_attribute_9, /* EXTERNAL_ATTRIBUTE_9 */
2267 l_service_request_rec.external_attribute_10, /* EXTERNAL_ATTRIBUTE_10 */
2268 l_service_request_rec.external_attribute_11, /* EXTERNAL_ATTRIBUTE_11 */
2269 l_service_request_rec.external_attribute_12, /* EXTERNAL_ATTRIBUTE_12 */
2270 l_service_request_rec.external_attribute_13, /* EXTERNAL_ATTRIBUTE_13 */
2271 l_service_request_rec.external_attribute_14, /* EXTERNAL_ATTRIBUTE_14 */
2272 l_service_request_rec.external_attribute_15, /* EXTERNAL_ATTRIBUTE_15 */
2273 l_service_request_rec.external_context, /* EXTERNAL_CONTEXT */
2274 UPPER(l_service_request_rec.resolution_code), /* RESOLUTION_CODE */
2275 l_service_request_rec.request_date, /* INCIDENT_DATE */
2276 UPPER(l_service_request_rec.problem_code), /* PROBLEM_CODE */
2277 l_service_request_rec.original_order_number, /* ORIGINAL_ORDER_NUMBER */
2278 l_service_request_rec.purchase_order_num, /* PURCHASE_ORDER_NUM */
2279 l_service_request_rec.closed_date, /* CLOSE_DATE */
2280 l_service_request_rec.publish_flag, /* PUBLISH_FLAG */
2281 l_service_request_rec.obligation_date,
2282 l_service_request_rec.qa_collection_plan_id,
2283 l_service_request_rec.contract_service_id,
2284 l_contra_id,
2285 l_contract_number,
2286 l_service_request_rec.project_number,
2287 l_service_request_rec.cust_po_number,
2288 l_service_request_rec.cust_ticket_number,
2289 l_service_request_rec.time_zone_id,
2290 l_service_request_rec.time_difference,
2291 l_service_request_rec.platform_id,
2292 l_service_request_rec.platform_version,
2293 l_service_request_rec.platform_version_id,
2294 l_service_request_rec.db_version,
2295 l_service_request_rec.cp_component_id,
2296 l_service_request_rec.cp_component_version_id,
2297 l_service_request_rec.cp_subcomponent_id,
2298 l_service_request_rec.cp_subcomponent_version_id,
2299 l_service_request_rec.cp_revision_id,
2300 l_service_request_rec.inv_item_revision,
2301 l_service_request_rec.inv_component_id,
2302 l_service_request_rec.inv_component_version,
2303 l_service_request_rec.inv_subcomponent_id,
2304 l_service_request_rec.inv_subcomponent_version,
2305 l_service_request_rec.site_id,
2306 l_service_request_rec.customer_site_id,
2307 l_service_request_rec.territory_id,
2308 l_service_request_rec.inventory_org_id,
2309 1,
2310 --- Added for enhancement 11.5.6
2311 l_service_request_rec.cust_pref_lang_id,
2312 l_service_request_rec.tier,
2313 l_service_request_rec.tier_version,
2314 l_service_request_rec.operating_system,
2315 l_service_request_rec.operating_system_version,
2316 l_service_request_rec.DATABASE,
2317 l_service_request_rec.category_id,
2318 l_service_request_rec.group_type,
2319 l_service_request_rec.owner_group_id,
2320 l_service_request_rec.group_territory_id,
2321 l_service_request_rec.owner_assigned_time,
2322 l_service_request_rec.owner_assigned_flag,
2323 l_unassigned_indicator,
2324 l_service_request_rec.inv_platform_org_id,
2325 l_service_request_rec.product_revision,
2326 l_service_request_rec.component_version,
2327 l_service_request_rec.subcomponent_version,
2328 l_service_request_rec.comm_pref_code,
2329 l_service_request_rec.cust_pref_lang_code,
2330 l_service_request_rec.last_update_channel,
2331 l_service_request_rec.category_set_id,
2332 l_service_request_rec.external_reference,
2333 l_service_request_rec.system_id,
2334 l_service_request_rec.error_code,
2335 l_service_request_rec.incident_occurred_date,
2336 l_service_request_rec.incident_resolved_date,
2337 l_service_request_rec.inc_responded_by_date,
2338 l_service_request_rec.incident_location_id ,
2339 l_service_request_rec.incident_address ,
2340 l_service_request_rec.incident_city,
2341 l_service_request_rec.incident_state,
2342 l_service_request_rec.incident_country,
2343 l_service_request_rec.incident_province ,
2344 l_service_request_rec.incident_postal_code ,
2345 l_service_request_rec.incident_county,
2346 l_service_request_rec.sr_creation_channel ,
2347 -- Added for ER# 2320056
2348 l_service_request_rec.coverage_type,
2349 -- Added For ER# 2433831
2350 l_service_request_rec.bill_to_account_id ,
2351 l_service_request_rec.ship_to_account_id ,
2352 -- Added for ER# 2463321
2353 l_service_request_rec.customer_phone_id,
2354 l_service_request_rec.customer_email_id,
2355 -- Added for source changes for 1159 by shijain oct 11 2002
2356 l_service_request_rec.creation_program_code,
2357 l_service_request_rec.creation_program_code,
2358 l_service_request_rec.bill_to_party_id,
2359 l_service_request_rec.ship_to_party_id,
2360 l_service_request_rec.bill_to_site_id,
2361 l_service_request_rec.ship_to_site_id,
2362 l_service_request_rec.program_id ,
2363 l_service_request_rec.program_application_id ,
2364 l_service_request_rec.conc_request_id ,
2365 l_service_request_rec.program_login_id ,
2366 -- Added for enh. 2655115
2367 --l_status_flag ,
2368 --for bug 3050727
2369 l_service_request_rec.status_flag,
2370 l_service_request_rec.incident_point_of_interest,
2371 l_service_request_rec.incident_cross_street,
2372 l_service_request_rec.incident_direction_qualifier,
2373 l_service_request_rec.incident_distance_qualifier,
2374 l_service_request_rec.incident_distance_qual_uom,
2375 l_service_request_rec.incident_address2,
2376 l_service_request_rec.incident_address3,
2377 l_service_request_rec.incident_address4,
2378 l_service_request_rec.incident_address_style,
2379 l_service_request_rec.incident_addr_lines_phonetic,
2380 l_service_request_rec.incident_po_box_number,
2381 l_service_request_rec.incident_house_number,
2382 l_service_request_rec.incident_street_suffix,
2383 l_service_request_rec.incident_street,
2384 l_service_request_rec.incident_street_number,
2385 l_service_request_rec.incident_floor,
2386 l_service_request_rec.incident_suite,
2387 l_service_request_rec.incident_postal_plus4_code,
2388 l_service_request_rec.incident_position,
2389 l_service_request_rec.incident_location_directions,
2390 l_service_request_rec.incident_location_description,
2391 l_service_request_rec.install_site_id,
2392 --for cmro_eam
2393 l_service_request_rec.owning_dept_id,
2394 -- Added for Misc ERs project of 11.5.10 --anmukher --08/26/03
2395 l_service_request_rec.incident_location_type,
2396 -- Added for Auditing project of 11.5.10 --anmukher --09/03/03
2397 l_service_request_rec.last_update_date , /* INCIDENT_LAST_MODIFIED_DATE */
2398 l_service_request_rec.maint_organization_id,
2399 l_org_id
2400
2401 ) RETURNING INCIDENT_ID, INCIDENT_NUMBER, ORG_ID INTO l_request_id, l_request_number, l_inc_org_id;
2402
2403 --
2404 -- Insert into _TL table
2405 --
2406 INSERT INTO cs_incidents_all_tl (
2407 incident_id,
2408 creation_date,
2409 created_by,
2410 last_update_date,
2411 last_updated_by,
2412 last_update_login,
2413 summary,
2414 resolution_summary ,
2415 LANGUAGE,
2416 source_lang,
2417 text_index
2418 ) SELECT
2419 l_request_id,
2420 l_service_request_rec.creation_date,
2421 l_service_request_rec.created_by,
2422 l_service_request_rec.last_update_date,
2423 l_service_request_rec.last_updated_by,
2424 l_service_request_rec.last_update_login,
2425 l_service_request_rec.summary,
2426 l_service_request_rec.resolution_summary ,
2427 L.LANGUAGE_CODE,
2428 USERENV('LANG'),
2429 'A'
2430 FROM FND_LANGUAGES L
2431 WHERE l.installed_flag IN ('I', 'B')
2432 AND NOT EXISTS
2433 (SELECT NULL
2434 FROM cs_incidents_all_tl t
2435 WHERE t.incident_id = l_request_id
2436 AND t.LANGUAGE = l.language_code
2437 );
2438
2439 -- ----------------------------------------------------------------------
2440 -- Reindex if ConText Option is enabled and summary, problem description
2441 -- or resolution description is inserted.
2442 -- Reindex even if the service request is not published (bug 841260).
2443 -- ----------------------------------------------------------------------
2444
2445 -- Added for Auditing project of 11.5.10 --anmukher --09/15/03
2446 -- Assignments are made here (and not immediately before calling Create_Audit_record)
2447 -- in order to ensure that the audit rec is fully populated
2448 -- before CS_SR_AUDIT_CHILD API is called after contact point creation.
2449
2450 l_audit_vals_rec.incident_number := l_request_number;
2451
2452 IF (l_contra_id <> FND_API.G_MISS_NUM) AND
2453 (l_contra_id IS NOT NULL) THEN
2454 l_audit_vals_rec.CONTRACT_ID := l_contra_id;
2455 END IF;
2456
2457 IF (l_service_request_rec.contract_service_id <> FND_API.G_MISS_NUM) AND
2458 (l_service_request_rec.contract_service_id IS NOT NULL) THEN
2459 l_audit_vals_rec.CONTRACT_SERVICE_ID := l_service_request_rec.contract_service_id ;
2460 END IF;
2461
2462 IF (l_contract_number <> FND_API.G_MISS_CHAR) AND
2463 (l_contract_number IS NOT NULL) THEN
2464 l_audit_vals_rec.CONTRACT_NUMBER := l_contract_number;
2465 END IF;
2466
2467 IF (l_unassigned_indicator <> FND_API.G_MISS_NUM) AND
2468 (l_unassigned_indicator IS NOT NULL) THEN
2469 l_audit_vals_rec.UNASSIGNED_INDICATOR := l_unassigned_indicator;
2470 END IF;
2471 -- At this point l_servicerequest_rec has been processed for g_miss values
2472 -- so no need to check for g_miss. directly assign the value to audit rec.
2473 l_audit_vals_rec.coverage_type := l_service_request_rec.coverage_type;
2474
2475
2476 -- This record creation should not take place if caller_type is CALLER_EMP
2477 -- For Caller type Employee, should not create any contacts
2478 /* updating value of the primary_contact_id in the cs_incidents_all_b table
2479 after we insert record in cs_hz_sr_contact_points, so that
2480 sr_contact_point_id can be inserted as primary_contact_id by shijain
2481 for enh. 2690787
2482
2483 l_primary_contact:= get_primary_contact(l_request_id);
2484
2485 IF l_primary_contact is not null THEN
2486
2487 UPDATE cs_incidents_all_b
2488 SET primary_contact_id = l_primary_contact
2489 WHERE incident_id = l_request_id;
2490
2491 END IF;
2492 */
2493
2494 -- END IF; -- caller type check
2495 /****************Delete Above code***************************************/
2496
2497 -- ------------------------------------------------------
2498 -- Insert a record into the audit table
2499 -- ------------------------------------------------------
2500
2501 --Added for Auditing project of 11.5.10 --anmukher --09/03/03
2502 l_audit_vals_rec.updated_entity_code := 'SR_HEADER';
2503 l_audit_vals_rec.updated_entity_id := l_request_id;
2504 l_audit_vals_rec.entity_activity_code := 'C';
2505 l_audit_vals_rec.incident_last_modified_date := l_service_request_rec.last_update_date ;
2506 -- R12 changes
2507 l_audit_vals_rec.org_id := l_org_id;
2508 l_audit_vals_rec.old_org_id := null ;
2509 l_audit_vals_rec.maint_organization_id := l_service_request_rec.maint_organization_id ;
2510 l_audit_vals_rec.old_maint_organization_id := null ;
2511 l_audit_vals_rec.last_update_program_code := l_service_request_rec.creation_program_code ;
2512 --
2513 IF l_service_request_rec.exp_resolution_date IS NULL
2514 THEN
2515 l_audit_vals_rec.CHANGE_RESOLUTION_FLAG := 'N';
2516 ELSE
2517 l_audit_vals_rec.CHANGE_RESOLUTION_FLAG := 'Y';
2518 l_audit_vals_rec.EXPECTED_RESOLUTION_DATE := l_service_request_rec.exp_resolution_date;
2519 END IF;
2520
2521 IF l_service_request_rec.obligation_date IS NULL
2522 THEN
2523 l_audit_vals_rec.CHANGE_OBLIGATION_FLAG := 'N';
2524 ELSE
2525 l_audit_vals_rec.CHANGE_OBLIGATION_FLAG := 'Y';
2526 l_audit_vals_rec.obligation_date := l_service_request_rec.obligation_date;
2527 END IF;
2528 l_audit_vals_rec.incident_country := l_service_request_rec.incident_country;
2529 l_audit_vals_rec.incident_location_id := l_service_request_rec.incident_location_id;
2530 l_audit_vals_rec.incident_location_type := l_service_request_rec.incident_location_type;
2531 -- Owner and Group Related Columns
2532 IF l_service_request_rec.owner_id IS NULL
2533 THEN
2534 l_audit_vals_rec.change_incident_owner_flag := 'N';
2535 ELSE
2536 l_audit_vals_rec.change_incident_owner_FLAG := 'Y';
2537 l_audit_vals_rec.incident_owner_id := l_service_request_rec.owner_id;
2538
2539 --commented by Sanjana Rao, bug 6955756
2540 -- l_service_request_rec.owner_assigned_time := SYSDATE;
2541 END IF;
2542
2543 IF l_service_request_rec.OWNER_ASSIGNED_TIME IS NULL
2544 THEN
2545 l_audit_vals_rec.CHANGE_ASSIGNED_TIME_FLAG := 'N';
2546 ELSE
2547 l_audit_vals_rec.CHANGE_ASSIGNED_TIME_FLAG := 'Y';
2548 l_audit_vals_rec.OWNER_ASSIGNED_TIME := l_service_request_rec.OWNER_ASSIGNED_TIME;
2549 END IF;
2550
2551 IF l_service_request_rec.OWNER_GROUP_ID IS NULL
2552 THEN
2553 l_audit_vals_rec.CHANGE_GROUP_FLAG := 'N';
2554 ELSE
2555 l_audit_vals_rec.CHANGE_GROUP_FLAG := 'Y';
2556 l_audit_vals_rec.GROUP_ID := l_service_request_rec.OWNER_GROUP_ID;
2557 END IF;
2558
2559 IF l_service_request_rec.group_type IS NULL
2560 THEN
2561 l_audit_vals_rec.CHANGE_GROUP_TYPE_FLAG := 'N';
2562 ELSE
2563 l_audit_vals_rec.CHANGE_GROUP_TYPE_FLAG := 'Y';
2564 l_audit_vals_rec.group_type := l_service_request_rec.group_type;
2565 END IF;
2566
2567 IF l_service_request_rec.RESOURCE_TYPE IS NULL
2568 THEN
2569 l_audit_vals_rec.CHANGE_RESOURCE_TYPE_FLAG := 'N';
2570 ELSE
2571 l_audit_vals_rec.CHANGE_RESOURCE_TYPE_FLAG := 'Y';
2572 l_audit_vals_rec.RESOURCE_TYPE := l_service_request_rec.RESOURCE_TYPE;
2573 END IF;
2574
2575 IF l_service_request_rec.territory_id IS NULL
2576 THEN
2577 l_audit_vals_rec.CHANGE_TERRITORY_ID_FLAG := 'N';
2578 ELSE
2579 l_audit_vals_rec.CHANGE_TERRITORY_ID_FLAG := 'Y';
2580 l_audit_vals_rec.territory_id := l_service_request_rec.territory_id;
2581 END IF;
2582
2583 IF l_service_request_rec.site_id IS NULL
2584 THEN
2585 l_audit_vals_rec.CHANGE_SITE_FLAG := 'N';
2586 ELSE
2587 l_audit_vals_rec.CHANGE_SITE_FLAG := 'Y';
2588 l_audit_vals_rec.site_id := l_service_request_rec.site_id;
2589 END IF;
2590
2591 CS_ServiceRequest_PVT.Create_Audit_Record (
2592 p_api_version => 2.0,
2593 x_return_status => l_return_status,
2594 x_msg_count => x_msg_count,
2595 x_msg_data => x_msg_data,
2596 p_request_id => l_request_id,
2597 p_audit_id => l_audit_id,
2598 p_audit_vals_rec => l_audit_vals_rec,
2599 p_user_id => l_service_request_rec.last_updated_by,
2600 p_login_id => l_service_request_rec.last_update_login,
2601 p_last_update_date => l_service_request_rec.last_update_date,
2602 p_creation_date => l_service_request_rec.last_update_date,
2603 x_audit_id => l_audit_id
2604 );
2605
2606 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2607 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2608 END IF;
2609 CS_SRCONTACT_PKG.create_update
2610 ( p_incident_id => l_request_id
2611 , p_invocation_mode => p_invocation_mode
2612 , p_sr_update_date => l_service_request_rec.last_update_date
2613 , p_sr_updated_by => l_service_request_rec.last_updated_by
2614 , p_sr_update_login => l_service_request_rec.last_update_login
2615 , p_contact_tbl => l_processed_contacts
2616 , p_old_contact_tbl => l_old_contacts
2617 , x_return_status => l_return_status
2618 );
2619 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
2620 THEN
2621 RAISE FND_API.G_EXC_ERROR;
2622 END IF;
2623
2624 ----- AUDIT
2625
2626 -- Call to Enqueuer API if it is in Maintenance Mode
2627 -- added b'coz l_req_num will always be null,when request_number is passed
2628 l_enqueue_number := NVL(l_request_number,l_req_num);
2629
2630 FND_PROFILE.get('APPS_MAINTENANCE_MODE', l_maintenance_mode);
2631
2632 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
2633 THEN
2634 FND_LOG.String
2635 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
2636 , 'The Value of profile APPS_MAINTENANCE_MODE :' || l_maintenance_mode
2637 );
2638 END IF;
2639
2640
2641 IF (l_maintenance_mode = 'MAINT' AND
2642 p_invocation_mode <> 'REPLAY' ) THEN
2643
2644 -- hardcoded the version 2.0 shijain nov 27 2002
2645
2646 CS_ServiceRequest_ENQUEUE_PKG.EnqueueSR(
2647 p_init_msg_list => fnd_api.g_false ,
2648 p_api_version => 2.0,
2649 p_commit => p_commit,
2650 p_validation_level => p_validation_level,
2651 x_return_status => l_return_status,
2652 x_msg_count => x_msg_count,
2653 x_msg_data => x_msg_data,
2654 p_request_id => l_req_id,
2655 p_request_number => l_enqueue_number,
2656 p_audit_id => l_audit_id,
2657 p_resp_appl_id => p_resp_appl_id,
2658 p_resp_id => p_resp_id,
2659 p_user_id => p_user_id,
2660 p_login_id => p_login_id,
2661 p_org_id => p_org_id,
2662 p_update_desc_flex => p_update_desc_flex,
2663 p_object_version_number => p_object_version_number,
2664 p_transaction_type => l_transaction_type,
2665 p_message_rev => l_message_revision,
2666 p_servicerequest => l_service_request_rec,
2667 p_contacts => l_contacts
2668 );
2669
2670 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2671 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2672 END IF;
2673 END IF;
2674
2675 --
2676 -- Create entries in JTF_NOTES from p_notes
2677 --
2678 l_note_index := p_notes.FIRST;
2679 WHILE l_note_index IS NOT NULL LOOP
2680 /* Create JTF_NOTES */
2681 --l_notes_detail := DBMS_LOB.SUBSTR(p_notes(l_note_index).note_detail);
2682
2683 IF ((p_notes(l_note_index).note IS NOT NULL) AND
2684 (p_notes(l_note_index).note <> FND_API.G_MISS_CHAR)) THEN
2685
2686 l_note_status := null ;
2687
2688 IF ((p_notes(l_note_index).note_status IS NULL) OR
2689 (p_notes(l_note_index).note_status = FND_API.G_MISS_CHAR)) THEN
2690 l_note_status := 'E';
2691 ELSE
2692 l_note_status := p_notes(l_note_index).note_status ;
2693 END IF ;
2694
2695 jtf_notes_pub.create_note(
2696 p_api_version => 1.0,
2697 p_init_msg_list => FND_API.G_FALSE,
2698 p_commit => FND_API.G_FALSE,
2699 x_return_status => x_return_status,
2700 x_msg_count => x_msg_count,
2701 x_msg_data => x_msg_data,
2702 p_source_object_id => l_request_id,
2703 p_source_object_code => 'SR',
2704 p_notes => p_notes(l_note_index).note,
2705 p_notes_detail => p_notes(l_note_index).note_detail,
2706 p_note_type => p_notes(l_note_index).note_type,
2707 p_note_status => l_note_status,
2708 p_entered_by => p_user_id,
2709 p_entered_date => SYSDATE,
2710 p_created_by => p_user_id,
2711 p_creation_date => SYSDATE,
2712 p_last_updated_by => p_user_id,
2713 p_last_update_date => SYSDATE,
2714 x_jtf_note_id => l_note_id
2715 );
2716
2717 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2718 RAISE FND_API.G_EXC_ERROR;
2719 END IF;
2720
2721 END IF;
2722
2723
2724 IF ((p_notes(l_note_index).note_context_type_01 IS NOT NULL) AND
2725 (p_notes(l_note_index).note_context_type_01 <> FND_API.G_MISS_CHAR) AND
2726 (p_notes(l_note_index).note_context_type_id_01 IS NOT NULL) AND
2727 (p_notes(l_note_index).note_context_type_id_01 <> FND_API.G_MISS_NUM)) THEN
2728
2729 jtf_notes_pub.create_note_context(
2730 x_return_status => x_return_status,
2731 p_creation_date => SYSDATE,
2732 p_last_updated_by => p_user_id,
2733 p_last_update_date => SYSDATE,
2734 p_jtf_note_id => l_note_id,
2735 p_note_context_type => p_notes(l_note_index).note_context_type_01,
2736 p_note_context_type_id => p_notes(l_note_index).note_context_type_id_01,
2737 x_note_context_id => l_note_context_id
2738 );
2739
2740 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2741 RAISE FND_API.G_EXC_ERROR;
2742 END IF;
2743 END IF;
2744
2745
2746 IF ((p_notes(l_note_index).note_context_type_02 IS NOT NULL) AND
2747 (p_notes(l_note_index).note_context_type_02 <> FND_API.G_MISS_CHAR) AND
2748 (p_notes(l_note_index).note_context_type_id_02 IS NOT NULL) AND
2749 (p_notes(l_note_index).note_context_type_id_02 <> FND_API.G_MISS_NUM))THEN
2750
2751
2752 jtf_notes_pub.create_note_context(
2753 x_return_status => x_return_status,
2754 p_creation_date => SYSDATE,
2755 p_last_updated_by => p_user_id,
2756 p_last_update_date => SYSDATE,
2757 p_jtf_note_id => l_note_id,
2758 p_note_context_type => p_notes(l_note_index).note_context_type_02,
2759 p_note_context_type_id => p_notes(l_note_index).note_context_type_id_02,
2760 x_note_context_id => l_note_context_id
2761
2762 );
2763 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2764 RAISE FND_API.G_EXC_ERROR;
2765 END IF;
2766 END IF;
2767
2768
2769 IF ((p_notes(l_note_index).note_context_type_03 IS NOT NULL) AND
2770 (p_notes(l_note_index).note_context_type_03 <> FND_API.G_MISS_CHAR) AND
2771 (p_notes(l_note_index).note_context_type_id_03 IS NOT NULL) AND
2772 (p_notes(l_note_index).note_context_type_id_03 <> FND_API.G_MISS_NUM)) THEN
2773
2774
2775 jtf_notes_pub.create_note_context(
2776 x_return_status => x_return_status,
2777 p_creation_date => SYSDATE,
2778 p_last_updated_by => p_user_id,
2779 p_last_update_date => SYSDATE,
2780 p_jtf_note_id => l_note_id,
2781 p_note_context_type => p_notes(l_note_index).note_context_type_03,
2782 p_note_context_type_id => p_notes(l_note_index).note_context_type_id_03,
2783 x_note_context_id => l_note_context_id
2784 );
2785
2786 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2787 RAISE FND_API.G_EXC_ERROR;
2788 END IF;
2789 END IF;
2790
2791 l_note_index := p_notes.NEXT(l_note_index);
2792 END LOOP;
2793
2794
2795 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #8');
2796 -- Launching the workflow (HOOK)
2797 IF (JTF_USR_HKS.Ok_To_Execute('CS_ServiceRequest_PVT', 'Create_ServiceRequest',
2798 'W', 'W')) THEN
2799
2800 IF (cs_servicerequest_cuhk.Ok_To_Launch_Workflow(p_request_id => l_request_id,
2801 p_service_request_rec=>l_service_request_rec)) THEN
2802
2803 l_bind_data_id := JTF_USR_HKS.Get_bind_data_id ;
2804 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'USER_ID', p_user_id, 'W', 'T');
2805 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'RESP_ID', p_resp_id, 'W', 'T');
2806 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'RESP_APPL_ID', p_resp_appl_id, 'W', 'T');
2807 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_ID', l_request_id, 'W', 'T');
2808 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_DATE', l_service_request_rec.request_date, 'W', 'T');
2809 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_TYPE', l_service_request_rec.type_id, 'W', 'T');
2810 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_STATUS', l_service_request_rec.status_id, 'W', 'T');
2811 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_SEVERITY', l_service_request_rec.severity_id, 'W', 'T');
2812 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_URGENCY', l_service_request_rec.urgency_id, 'W', 'T');
2813 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'OWNER_ID', l_service_request_rec.owner_id, 'W', 'T');
2814 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_SUMMARY', l_service_request_rec.summary, 'W', 'T');
2815 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_CUSTOMER', l_service_request_rec.customer_id, 'W', 'T');
2816 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'INVENTORY_ITEM_ID', l_service_request_rec.inventory_item_id, 'W', 'T');
2817 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'CUSTOMER_PRODUCT_ID', l_service_request_rec.customer_product_id, 'W', 'T');
2818 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'PROBLEM_CODE', l_service_request_rec.problem_code, 'W', 'T');
2819 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'EXPECTED_RESOLUTION_DATE', l_service_request_rec.exp_resolution_date, 'W', 'T');
2820
2821 -- Before the call to WorkFlow Hook, generate a unique item key using the workflow sequence
2822 SELECT cs_wf_process_id_s.NEXTVAL INTO l_workflow_item_key FROM dual;
2823
2824 JTF_USR_HKS.WrkflowLaunch(p_wf_item_name => 'SERVEREQ',
2825 p_wf_item_process_name => 'CALL_SUPPORT',
2826 p_wf_item_key => 'SR' || TO_CHAR(l_workflow_item_key),
2827 p_bind_data_id => l_bind_data_id,
2828 x_return_code => l_return_status);
2829
2830 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2831 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2832 END IF;
2833
2834 END IF ;
2835 END IF ;
2836
2837 --
2838 -- Make the post processing call to the user hooks
2839 --
2840 -- Post call to the Customer Type User Hook
2841 --
2842 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
2843 'Create_ServiceRequest',
2844 'A', 'C') THEN
2845
2846 -- hardcoded the version 2.0 shijain nov 27 2002
2847
2848 cs_servicerequest_cuhk.Create_ServiceRequest_Post(
2849 p_api_version => 2.0,
2850 p_init_msg_list => fnd_api.g_false ,
2851 p_commit => p_commit,
2852 p_validation_level => p_validation_level,
2853 x_return_status => l_return_status,
2854 x_msg_count => x_msg_count ,
2855 x_msg_data => x_msg_data,
2856 p_resp_appl_id => p_resp_appl_id,
2857 p_resp_id => p_resp_id,
2858 p_user_id => p_user_id,
2859 p_login_id => p_login_id,
2860 p_org_id => p_org_id,
2861 p_request_id => l_request_id,
2862 p_request_number => l_request_number,
2863 p_invocation_mode => p_invocation_mode,
2864 p_service_request_rec => l_service_request_rec,
2865 p_notes => p_notes,
2866 p_contacts => p_contacts,
2867 -- Changed out parameter references to out rec references
2868 x_request_id => x_sr_create_out_rec.request_id,
2869 x_request_number => x_sr_create_out_rec.request_number,
2870 x_interaction_id => x_sr_create_out_rec.interaction_id,
2871 x_workflow_process_id => x_sr_create_out_rec.workflow_process_id);
2872
2873
2874 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2875 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2876 END IF;
2877 END IF;
2878
2879
2880 -- Post call to the Vertical Type User Hook
2881 --
2882 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
2883 'Create_ServiceRequest',
2884 'A', 'V') THEN
2885
2886 -- hardcoded the version 2.0 shijain nov 27 2002
2887
2888 cs_servicerequest_vuhk.Create_ServiceRequest_Post(
2889 p_api_version => 2.0,
2890 p_init_msg_list => fnd_api.g_false ,
2891 p_commit => p_commit,
2892 p_validation_level => p_validation_level,
2893 x_return_status => l_return_status,
2894 x_msg_count => x_msg_count ,
2895 x_msg_data => x_msg_data,
2896 p_resp_appl_id => p_resp_appl_id,
2897 p_resp_id => p_resp_id,
2898 p_user_id => p_user_id,
2899 p_login_id => p_login_id,
2900 p_org_id => p_org_id,
2901 p_request_id => l_request_id,
2902 p_request_number => l_request_number,
2903 p_service_request_rec => l_service_request_rec,
2904 p_notes => p_notes,
2905 p_contacts => p_contacts,
2906 -- Changed out parameter references to out rec references
2907 x_request_id => x_sr_create_out_rec.request_id,
2908 x_request_number => x_sr_create_out_rec.request_number,
2909 x_interaction_id => x_sr_create_out_rec.interaction_id,
2910 x_workflow_process_id => x_sr_create_out_rec.workflow_process_id);
2911
2912
2913 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2914 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2915 END IF;
2916 END IF;
2917
2918
2919
2920 -- Post call to the internal Type User Hook
2921 --
2922 -- Fix to bug # 2986971
2923 -- Code to populate the global record type. These globals can be used by the internal
2924 -- user hooks procedures registered to be executed by the Create SR Private proc.
2925
2926 user_hooks_rec.customer_id := l_service_request_rec.customer_id ;
2927 user_hooks_rec.request_id := l_request_id ;
2928
2929 -- for cmro_eam
2930 -- set additional paramters for cmro_eam
2931 -- status_flag,pls_type_cmro_flag,new_type_cmro_flag,customer_product_id,
2932 -- status_id,exp_resolution_date
2933
2934 user_hooks_rec.status_flag := l_service_request_rec.status_flag;
2935 user_hooks_rec.old_type_cmro_flag := NULL;
2936 user_hooks_rec.new_type_cmro_flag := l_service_request_rec.New_type_CMRO_flag;
2937 user_hooks_rec.customer_product_id := l_service_request_rec.customer_product_id;
2938 user_hooks_rec.status_id := l_service_request_rec.status_id;
2939 user_hooks_rec.exp_resolution_date := l_service_request_rec.exp_resolution_date;
2940
2941 -- end for cmro_eam
2942
2943 cs_servicerequest_iuhk.Create_ServiceRequest_Post( x_return_status=>l_return_status);
2944
2945 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2946 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2947 END IF;
2948
2949 -- ----------------------------------------------------------------------
2950 -- Insert interaction record
2951 -- ----------------------------------------------------------------------
2952 IF (l_service_request_rec.parent_interaction_id IS NULL) THEN
2953 /* CREATE INTERACTION */ /* l_interaction_id := */
2954 NULL;
2955 END IF;
2956
2957 -- Changed out parameter references to out rec references
2958 x_sr_create_out_rec.interaction_id := l_interaction_id;
2959
2960 --
2961 -- Create INTERACTION_ACTIVITY
2962 --
2963
2964 --
2965 -- Set OUT values
2966 --
2967 -- Changed out parameter references to out rec references
2968 x_sr_create_out_rec.request_id := l_request_id;
2969 x_sr_create_out_rec.request_number := l_request_number;
2970
2971 -- Standard call for message generation
2972 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
2973 'Create_ServiceRequest',
2974 'M', 'M') THEN
2975
2976 IF (cs_servicerequest_cuhk.Ok_To_Generate_Msg(p_request_id => l_request_id,
2977 p_service_request_rec=>l_service_request_rec)) THEN
2978
2979 l_bind_data_id := JTF_USR_HKS.Get_bind_data_id;
2980
2981 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'incident_id', l_request_id, 'S', 'N');
2982
2983 JTF_USR_HKS.generate_message(p_prod_code => 'CS',
2984 p_bus_obj_code => 'SR',
2985 p_action_code => 'I',
2986 p_bind_data_id => l_bind_data_id,
2987 x_return_code => l_return_status);
2988
2989
2990 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2991 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2992 END IF;
2993 END IF;
2994 END IF;
2995
2996 --- Added for HA Enhancement
2997
2998 IF (p_invocation_mode <> 'REPLAY' ) THEN
2999 -- Raise BES Event that the SR is created. Before business events, a WF process
3000 -- was kicked off if the following conditions were met:
3001 -- if l_autolaunch_wf_flag = 'Y' AND resource_type = 'RS_EMPLOYEE' AND
3002 -- owner_id IS NOT NULL. After the introduction of business event, the SR API
3003 -- calls the CS BES wrapper API and this wrapper API raises the needed business
3004 -- events, in this case - SR Created, after checking the required conditions.
3005
3006 CS_WF_EVENT_PKG.RAISE_SERVICEREQUEST_EVENT(
3007 -- These 4 parameters added for bug #2798269
3008 p_api_version => p_api_version,
3009 p_init_msg_list => fnd_api.g_false ,
3010 p_commit => p_commit,
3011 p_validation_level => p_validation_level,
3012 p_event_code => 'CREATE_SERVICE_REQUEST',
3013 p_incident_number => l_request_number,
3014 p_user_id => p_user_id,
3015 p_resp_id => p_resp_id,
3016 p_resp_appl_id => p_resp_appl_id,
3017 p_old_sr_rec => NULL,
3018 p_new_sr_rec => l_service_request_rec, -- using l_ser...coz this is the
3019 -- rec. type used in the insert.
3020 p_contacts_table => p_contacts,
3021 p_link_rec => NULL, -- using default value
3022 p_wf_process_id => NULL, -- using default value
3023 p_owner_id => NULL, -- using default value
3024 p_wf_manual_launch => 'N' , -- using default value
3025 x_wf_process_id => l_workflow_process_id,
3026 x_return_status => lx_return_status,
3027 x_msg_count => lx_msg_count,
3028 x_msg_data => lx_msg_data );
3029
3030 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
3031 -- do nothing in this API. The BES wrapper API will have to trap this
3032 -- situation and send a notification to the SR owner that the BES has
3033 -- not been raised. If the BES API return back a failure status, it
3034 -- means only that the BES raise event has failed, and has nothing to
3035 -- do with the creation of the SR.
3036 null;
3037 end if;
3038 END IF; -- IF (p_invocation_mode <> 'REPLAY' )
3039 -- Changed out parameter reference to out rec reference
3040 x_sr_create_out_rec.workflow_process_id := l_workflow_process_id ;
3041
3042 /*resetting the parameter value shijain 4th dec 2002*/
3043 g_restrict_ib:=NULL;
3044
3045 -- Standard call to get message count and if count is 1, get message info
3046 FND_MSG_PUB.Count_And_Get
3047 ( p_count => x_msg_count,
3048 p_data => x_msg_data
3049 );
3050
3051
3052 -- Moved before calling the assignment manager
3053 -- *****************************************************************/
3054
3055 /******************** Commit moved for bug 2857350*****************************/
3056
3057 -- Assign the incident id and the incident number for the new service request to the Out Rec attributes --anmukher -- 08/25/03
3058 x_sr_create_out_rec.request_id := l_request_id;
3059 x_sr_create_out_rec.request_number := l_request_number;
3060
3061 -- Added for Auto Task Generation Project of 11.5.10 -- anmukher --08/25/03
3062 -- Check if Auto Generate Tasks parameters is set ON
3063
3064 -- For bug 3535918 - remove case sensitivity and add ignore message
3065
3066 If (p_auto_generate_tasks = 'Y' OR p_auto_generate_tasks = 'y') Then
3067
3068 -- Check if the Service Request has been closed at the time of creation
3069 If l_service_request_rec.status_flag = 'C' Then
3070 x_sr_create_out_rec.auto_task_gen_attempted := FALSE;
3071 Else
3072 -- Service Request is Open and Auto Generate Task parameter is On, So call the Auto Generate Tasks API
3073 CS_AutoGen_Task_PVT.Auto_Generate_Tasks
3074 ( p_api_version => 1.0,
3075 p_init_msg_list => fnd_api.g_false ,
3076 p_commit => p_commit,
3077 p_validation_level => p_validation_level,
3078 p_incident_id => l_request_id ,
3079 p_service_request_rec => l_service_request_rec,
3080 p_task_template_group_owner => null,-- l_service_request_rec.owner_group_id,
3081 p_task_tmpl_group_owner_type => null,-- l_service_request_rec.owner_type,
3082 p_task_template_group_rec => l_task_template_group_rec,
3083 p_task_template_table => l_task_template_table,
3084 x_auto_task_gen_rec => l_auto_task_gen_rec,
3085 x_return_status => l_return_status,
3086 x_msg_count => x_msg_count,
3087 x_msg_data => x_msg_data
3088 );
3089 End If; -- If l_service_request_rec.status_flag = 'C'
3090
3091 If l_return_status = FND_API.G_RET_STS_SUCCESS Then
3092 x_sr_create_out_rec.auto_task_gen_status := FND_API.G_RET_STS_SUCCESS;
3093 x_sr_create_out_rec.auto_task_gen_attempted := l_auto_task_gen_rec.auto_task_gen_attempted;
3094 x_sr_create_out_rec.field_service_task_created := l_auto_task_gen_rec.field_service_task_created;
3095 Else
3096 x_sr_create_out_rec.auto_task_gen_status := FND_API.G_RET_STS_ERROR ;
3097 x_sr_create_out_rec.auto_task_gen_attempted := TRUE;
3098
3099 /* Commented out since the service request should be created even if creation of task fails. -- spusegao
3100 Rolling back the partial task creation, if any , is handled in Auto_Task_Generate API.
3101
3102 IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
3103 RAISE FND_API.G_EXC_ERROR;
3104 ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3105 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3106 END IF;
3107 */
3108 End If; -- If l_return_status = FND_API.G_RET_STS_SUCCESS
3109
3110 Else
3111 x_sr_create_out_rec.auto_task_gen_attempted := FALSE;
3112
3113 IF (p_auto_generate_tasks <> 'N' AND p_auto_generate_tasks <> 'n') THEN
3114 FND_MESSAGE.Set_Name('CS', 'CS_SR_INVALID_AUTOTASK_PARAM');
3115 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
3116 FND_MSG_PUB.ADD;
3117 END IF;
3118
3119 End If; -- If p_auto_generate_tasks = 'Y'
3120
3121
3122 -- Added this call for Misc ER: Owner auto assignment changes
3123
3124
3125 CS_SR_WORKITEM_PVT.Create_Workitem(
3126 p_api_version => 1.0,
3127 p_init_msg_list => fnd_api.g_false ,
3128 p_commit => p_commit,
3129 p_incident_id => l_request_id,
3130 p_incident_number => l_request_number ,
3131 p_sr_rec => l_service_request_rec,
3132 p_user_id => l_service_request_rec.last_updated_by,
3133 p_resp_appl_id => p_resp_appl_id ,
3134 p_login_id => l_service_request_rec.last_update_login,
3135 x_work_item_id => l_work_item_id,
3136 x_return_status => l_return_status,
3137 x_msg_count => x_msg_count,
3138 x_msg_data => x_msg_data) ;
3139
3140 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3141 FND_MSG_PUB.Count_And_Get
3142 ( p_count => x_msg_count,
3143 p_data => x_msg_data
3144 );
3145 END IF;
3146
3147 -- Standard check of p_commit
3148 IF FND_API.To_Boolean(p_commit) THEN
3149 COMMIT WORK;
3150 END IF;
3151
3152 EXCEPTION
3153 WHEN FND_API.G_EXC_ERROR THEN
3154 ROLLBACK TO Create_ServiceRequest_PVT;
3155 x_return_status := FND_API.G_RET_STS_ERROR;
3156 FND_MSG_PUB.Count_And_Get
3157 ( p_count => x_msg_count,
3158 p_data => x_msg_data
3159 );
3160 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3161 ROLLBACK TO Create_ServiceRequest_PVT;
3162 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3163 FND_MSG_PUB.Count_And_Get
3164 ( p_count => x_msg_count,
3165 p_data => x_msg_data
3166 );
3167 WHEN Auto_Assign_Excep THEN
3168 x_return_status := FND_API.G_RET_STS_SUCCESS;
3169 FND_MSG_PUB.Count_And_Get
3170 ( p_count => x_msg_count,
3171 p_data => x_msg_data
3172 );
3173 --- For BUG # 2933250
3174 WHEN invalid_install_site THEN
3175 ROLLBACK TO Create_ServiceRequest_PVT;
3176 x_return_status := FND_API.G_RET_STS_ERROR;
3177 FND_MESSAGE.SET_NAME('CS','CS_SR_INVALID_INSTALL_SITE');
3178 FND_MSG_PUB.ADD;
3179 FND_MSG_PUB.Count_And_Get
3180 ( p_count => x_msg_count,
3181 p_data => x_msg_data
3182 );
3183 WHEN OTHERS THEN
3184 ROLLBACK TO Create_ServiceRequest_PVT;
3185 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3186 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
3187 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
3188 END IF;
3189 FND_MSG_PUB.Count_And_Get
3190 ( p_count => x_msg_count,
3191 p_data => x_msg_data
3192 );
3193
3194 END Create_ServiceRequest;
3195
3196
3197 ----------------anmukher---------------08/11/2003
3198 -- Added overloaded SR Update API for backward compatibility with 11.5.9
3199 -- This will call the 11.5.10 version of the API
3200 PROCEDURE Update_ServiceRequest
3201 ( p_api_version IN NUMBER,
3202 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
3203 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
3204 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
3205 x_return_status OUT NOCOPY VARCHAR2,
3206 x_msg_count OUT NOCOPY NUMBER,
3207 x_msg_data OUT NOCOPY VARCHAR2,
3208 p_request_id IN NUMBER,
3209 p_audit_id IN NUMBER ,
3210 p_object_version_number IN NUMBER,
3211 p_resp_appl_id IN NUMBER DEFAULT NULL,
3212 p_resp_id IN NUMBER DEFAULT NULL,
3213 p_last_updated_by IN NUMBER,
3214 p_last_update_login IN NUMBER DEFAULT NULL,
3215 p_last_update_date IN DATE,
3216 p_service_request_rec IN service_request_rec_type,
3217 p_invocation_mode IN VARCHAR2 := 'NORMAL',
3218 p_update_desc_flex IN VARCHAR2 DEFAULT fnd_api.g_false,
3219 p_notes IN notes_table,
3220 p_contacts IN contacts_table,
3221 p_audit_comments IN VARCHAR2 DEFAULT NULL,
3222 p_called_by_workflow IN VARCHAR2 DEFAULT fnd_api.g_false,
3223 p_workflow_process_id IN NUMBER DEFAULT NULL,
3224 p_default_contract_sla_ind IN VARCHAR2 Default 'N',
3225 x_workflow_process_id OUT NOCOPY NUMBER,
3226 x_interaction_id OUT NOCOPY NUMBER
3227 )
3228 IS
3229
3230 l_api_version CONSTANT NUMBER := 3.0;
3231 l_api_version_back CONSTANT NUMBER := 2.0;
3232 l_api_name CONSTANT VARCHAR2(30) := 'Update_ServiceRequest';
3233 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
3234 l_return_status VARCHAR2(1);
3235 l_msg_count NUMBER;
3236 l_msg_data VARCHAR2(2000);
3237
3238 l_sr_update_out_rec sr_update_out_rec_type;
3239
3240 BEGIN
3241 -- Standard start of API savepoint
3242 SAVEPOINT Update_ServiceRequest_PVT;
3243
3244 -- Standard call to check for call compatibility
3245 -- Added the and condition for backward compatibility project, now
3246 -- both the version 2.0 and 3.0 are valid as this procedure can be called
3247 -- from both 1158 or 1159 env.
3248 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
3249 G_PKG_NAME)
3250 AND NOT FND_API.Compatible_API_Call(l_api_version_back, p_api_version, l_api_name,
3251 G_PKG_NAME) THEN
3252 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3253 END IF;
3254
3255 -- This check is not needed here. It is included in version 4.0 of the API, which this API calls by anmukher 08/12/03
3256 -- IF (l_service_request_rec.initialize_flag IS NULL OR l_service_request_rec.initialize_flag <> G_INITIALIZED) THEN
3257 -- RAISE FND_API.G_EXC_ERROR;
3258 -- END IF;
3259
3260 -- Initialize message list if p_init_msg_list is set to TRUE
3261 IF FND_API.To_Boolean(p_init_msg_list) THEN
3262 FND_MSG_PUB.Initialize;
3263 END IF;
3264
3265 -- Initialize API return status to success
3266 x_return_status := FND_API.G_RET_STS_SUCCESS;
3267
3268 -- Call 11.5.10 version of the Update SR API
3269 CS_ServiceRequest_PVT.Update_ServiceRequest
3270 ( p_api_version => 4.0,
3271 p_init_msg_list => FND_API.G_FALSE,
3272 p_commit => p_commit,
3273 p_validation_level => p_validation_level,
3274 x_return_status => x_return_status,
3275 x_msg_count => x_msg_count,
3276 x_msg_data => x_msg_data,
3277 p_request_id => p_request_id,
3278 p_audit_id => p_audit_id,
3279 p_object_version_number => p_object_version_number,
3280 p_resp_appl_id => p_resp_appl_id,
3281 p_resp_id => p_resp_id,
3282 p_last_updated_by => p_last_updated_by,
3283 p_last_update_login => p_last_update_login,
3284 p_last_update_date => p_last_update_date,
3285 p_service_request_rec => p_service_request_rec,
3286 p_invocation_mode => p_invocation_mode,
3287 p_update_desc_flex => p_update_desc_flex,
3288 p_notes => p_notes,
3289 p_contacts => p_contacts,
3290 p_audit_comments => p_audit_comments,
3291 p_called_by_workflow => p_called_by_workflow,
3292 p_workflow_process_id => p_workflow_process_id,
3293 p_auto_assign => 'N',
3294 p_validate_sr_closure => 'N',
3295 p_auto_close_child_entities => 'N',
3296 p_default_contract_sla_ind => p_default_contract_sla_ind,
3297 x_sr_update_out_rec => l_sr_update_out_rec
3298 );
3299
3300 -- Assign values returned by the called API to the OUT parameters
3301 x_workflow_process_id := l_sr_update_out_rec.workflow_process_id;
3302 x_interaction_id := l_sr_update_out_rec.interaction_id;
3303
3304 IF (x_return_status = FND_API.G_RET_STS_ERROR) THEN
3305 raise FND_API.G_EXC_ERROR;
3306 ELSIF (x_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
3307 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3308 END IF;
3309
3310 EXCEPTION
3311 WHEN FND_API.G_EXC_ERROR THEN
3312 ROLLBACK TO Update_ServiceRequest_PVT;
3313 --IF (l_ServiceRequest_csr%ISOPEN) THEN
3314 -- CLOSE l_ServiceRequest_csr;
3315 -- END IF;
3316 x_return_status := FND_API.G_RET_STS_ERROR;
3317 FND_MSG_PUB.Count_And_Get
3318 ( p_count => x_msg_count,
3319 p_data => x_msg_data
3320 );
3321
3322 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3323 ROLLBACK TO Update_ServiceRequest_PVT;
3324 -- IF (l_ServiceRequest_csr%ISOPEN) THEN
3325 -- CLOSE l_ServiceRequest_csr;
3326 -- END IF;
3327 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3328 FND_MSG_PUB.Count_And_Get
3329 ( p_count => x_msg_count,
3330 p_data => x_msg_data
3331 );
3332
3333 WHEN OTHERS THEN
3334 ROLLBACK TO Update_ServiceRequest_PVT;
3335 -- IF (l_ServiceRequest_csr%ISOPEN) THEN
3336 -- CLOSE l_ServiceRequest_csr;
3337 -- END IF;
3338 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3339 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
3340 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
3341 END IF;
3342 FND_MSG_PUB.Count_And_Get
3343 ( p_count => x_msg_count,
3344 p_data => x_msg_data
3345 );
3346
3347 END Update_ServiceRequest;
3348
3349
3350 --------------------------------------------------------------------------
3351 -- Update_ServiceRequest
3352 --------------------------------------------------------------------------
3353 -- p_org_id IN NUMBER DEFAULT NULL,
3354
3355 -- Modification History
3356 -- Date Name Desc
3357 -- -------- -------- -----------------------------------------------------------
3358 -- 03/04/05 smisra Reopened Bug 3958329.
3359 -- Modified IF condition for calling get_default_contract
3360 -- procedure and added one more condition to call
3361 -- get_default_contract. Now contract defaulting will happen
3362 -- when contract related attributes change and existing
3363 -- contract service id is NULL.
3364 -- 04/29/05 smisra removed contact point logic and replacd it with procedures
3365 -- cs_srcontact_pkg.process to validate contact points and
3366 -- cs_srcontact_pkg.create_update to insert or update
3367 -- service request contact points
3368 -- 05/09/05 smisra updated maint_organization_id col from SR Rec record.
3369 -- set maint_organization_id and inventory_item_id cols of
3370 -- audit record.
3371 -- 05/27/05 smisra Bug 4227769
3372 -- Removed owner and group_owner columns from update to
3373 -- cs_incidents_all_tl table.
3374 -- 06/07/05 smisra Release 12 changes
3375 -- Raised error msg when maint_organization_id is passed for
3376 -- Non EAM service requests
3377 -- Raised error msg when maint_organization_id is NOT passed
3378 -- for EAM SRs with customer product
3379 -- 07/11/05 smisra Release 12 ERES changes
3380 -- called CS_SERVICEREQUEST_UTIL.get_status_details to
3381 -- details of old status and new status.
3382 -- if request updated is not allowed and new status has
3383 -- intermediate status id then do the following
3384 -- 1. Warn user that only status will be updated
3385 -- 2. intialize SR record
3386 -- 3. set status_id and last_updated_by from input SR record
3387 -- p_servicerequest_rec
3388 -- If new status has intermediate status then set variable
3389 -- l_start_eres_flag ot Y
3390 -- if new status has pending approval flag as 'Y' then raise
3391 -- error because SR cannot be updated to an status needing
3392 -- approval
3393 -- Added new parameters to procedure
3394 -- CS_SERVICEREQUEST_PVT.get_default_contract call
3395 -- Moved SR Audit creation after ERES processing
3396 -- If SR status needs approval then Call ERES apporval
3397 -- CS_ERES_INT_PKG.start_approval_process procedure.
3398 -- if this procedure return NO_ACTION then do the following
3399 -- 1. validate target status
3400 -- 2. get response, resolution and close dates
3401 -- 3. get status_flag
3402 -- 4. update SR with target status, response, resolution,
3403 -- close date, status flag
3404 -- 5. if target status is a closed status the
3405 -- a. call CS_SR_STATUS_PROPAGATION_PKG.CLOSE_SR_CHILDREN
3406 -- to close SR child entities
3407 -- b. abort any open workflow if new type allows
3408 -- Moved raise business event after ERES approval processing
3409 -- 08/01/05 smisra passed intermediate status id instead of target status
3410 -- to ERES call
3411 -- 08/03/05 smisra Raised error if item_serial_number is passed to this proc
3412 -- passed incident_occurred_date to get_default_contract
3413 -- 08/29/05 smisra Called task_restrict_close_cross_val procedure for
3414 -- Service request needing ERES procesing.
3415 -- 10/05/05 smisra Added a call to update_task_address.
3416 -- This procedure is called when validation level is FULL and
3417 -- incident location id or type is changed
3418 -- 10/11/05 smisra Bug 4666784
3419 -- called validate_sr_closure and close_sr_children only
3420 -- if old close flag is 'N' and new close flag is 'Y'
3421 -- 10/14/05 smisra fixed Bug 4674131
3422 -- moved update_task_address under condition
3423 -- l_only_status_updated <> 'Y' so that task address update
3424 -- does not happen when only status is changed
3425 -- 12/14/05 smisra Bug 4386870. Called vldt_sr_rec after update_sr_validation
3426 -- set incident_country, incident_location_id and
3427 -- incident_locatiomn_type attribute of audit record just-
3428 -- before call to create audit
3429 -- 12/23/05 smisra Bug 4894942
3430 -- 1. Passed additional parameters to vldt_sr_rec call
3431 -- 2. Removed the code to default contract service id, Now
3432 -- this code is part of vldt_sr_rec.
3433 -- 3. Removed the code to get coverage type. This code is
3434 -- moved to vldt_sr_rec
3435 -- 4. Added auditing of following attributes just before call
3436 -- to create audit
3437 -- a. resource_type
3438 -- b. group_type
3439 -- c. incident_owner_id
3440 -- d. group_owner_id
3441 -- e. owner_assigned_time
3442 -- f. territory_id
3443 -- 12/30/05 smisra Bug 4869065
3444 -- Set site_id cols of audit record just before call to
3445 -- create audit
3446 -- 03/01/05 spusegao Modified to allow service request status update using SR Update api for ERES call back procedure.
3447 --------------------------------------------------------------------------------
3448 PROCEDURE Update_ServiceRequest
3449 ( p_api_version IN NUMBER,
3450 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
3451 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
3452 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
3453 x_return_status OUT NOCOPY VARCHAR2,
3454 x_msg_count OUT NOCOPY NUMBER,
3455 x_msg_data OUT NOCOPY VARCHAR2,
3456 p_request_id IN NUMBER,
3457 p_audit_id IN NUMBER ,
3458 p_object_version_number IN NUMBER,
3459 p_resp_appl_id IN NUMBER DEFAULT NULL,
3460 p_resp_id IN NUMBER DEFAULT NULL,
3461 p_last_updated_by IN NUMBER,
3462 p_last_update_login IN NUMBER DEFAULT NULL,
3463 p_last_update_date IN DATE,
3464 p_service_request_rec IN service_request_rec_type,
3465 p_invocation_mode IN VARCHAR2 := 'NORMAL',
3466 p_update_desc_flex IN VARCHAR2 DEFAULT fnd_api.g_false,
3467 p_notes IN notes_table,
3468 p_contacts IN contacts_table,
3469 p_audit_comments IN VARCHAR2 DEFAULT NULL,
3470 p_called_by_workflow IN VARCHAR2 DEFAULT fnd_api.g_false,
3471 p_workflow_process_id IN NUMBER DEFAULT NULL,
3472 -- Commented out since these are now part of the out rec type --anmukher--08/08/03
3473 -- x_workflow_process_id OUT NOCOPY NUMBER,
3474 -- x_interaction_id OUT NOCOPY NUMBER
3475 ----------------anmukher--------------------08/05/03
3476 -- Added for 11.5.10 projects
3477 p_auto_assign IN VARCHAR2 Default 'N',
3478 p_validate_sr_closure IN VARCHAR2 Default 'N',
3479 p_auto_close_child_entities IN VARCHAR2 Default 'N',
3480 p_default_contract_sla_ind IN VARCHAR2 Default 'N',
3481 x_sr_update_out_rec OUT NOCOPY sr_update_out_rec_type
3482 )
3483 IS
3484 l_api_name CONSTANT VARCHAR2(30) := 'Update_ServiceRequest';
3485
3486 -- changed the version from 3.0 to 4.0 anmukher aug 11 2003
3487
3488 l_api_version CONSTANT NUMBER := 4.0;
3489 l_api_version_back CONSTANT NUMBER := 3.0;
3490 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
3491 l_log_module CONSTANT VARCHAR2(255) := 'cs.plsql.' || l_api_name_full || '.';
3492 l_return_status VARCHAR2(1);
3493 l_cp_inventory_item_id NUMBER;
3494 l_close_flag VARCHAR2(1);
3495 l_service_request_rec service_request_rec_type DEFAULT p_service_request_rec;
3496 l_sr_rec_temp service_request_rec_type DEFAULT p_service_request_rec;
3497 l_transaction_type CONSTANT VARCHAR2(61) := G_PKG_NAME||'_'||l_api_name;
3498 l_message_revision NUMBER;
3499 l_maintenance_mode VARCHAR2(30);
3500 p_request_number VARCHAR2(30) DEFAULT NULL;
3501 p_user_id NUMBER DEFAULT NULL;
3502 p_login_id NUMBER DEFAULT NULL;
3503 p_org_id NUMBER DEFAULT NULL;
3504 l_contacts contacts_table ;
3505 l_update_flag VARCHAR2(1);
3506 l_dummy NUMBER;
3507 l_audit_id NUMBER;
3508
3509 l_jtf_note_id NUMBER ;
3510 l_owner_assigned_flag VARCHAR2(1);
3511
3512 l_bind_data_id NUMBER;
3513 l_contra_id NUMBER;
3514 l_contract_number VARCHAR2(120) ;
3515
3516 l_msg_id NUMBER;
3517 l_msg_count NUMBER;
3518 l_msg_data VARCHAR2(2000);
3519
3520 -- Added for enh. 2655115
3521 l_status_flag VARCHAR2(1);
3522 -- changes for 11.5.10 usability enhancement
3523 l_old_responded_flag VARCHAR2(1);
3524 l_old_resolved_flag VARCHAR2(1);
3525 l_new_responded_flag VARCHAR2(1);
3526 l_new_resolved_flag VARCHAR2(1);
3527 l_res_close_flag VARCHAR2(1);
3528 --Fixed bug#2802393, changed length from 255 to 2500
3529 l_uwq_body VARCHAR2(2500);
3530 l_imp_level NUMBER;
3531 l_imp_level_old NUMBER;
3532 --Fixed bug#2802393, changed length from 30 to 80
3533 l_title VARCHAR2(80);
3534 l_send_uwq_notification BOOLEAN := FALSE;
3535 l_uwq_body2 VARCHAR2(2000);
3536 p_uwq_msg_notification VARCHAR2(30) := 'CS_SR_UWQ_NOTIFICATION';
3537 p_uwq_upd_notification VARCHAR2(30) := 'CS_SR_UWQ_UPDATION';
3538 l_old_owner_id NUMBER;
3539 -- l_coverage_type_rec coverage_type_rec; ----pkesani
3540 lv_primary_flag VARCHAR2(3) ;
3541
3542 SR_Lock_Row EXCEPTION;
3543 invalid_install_site EXCEPTION;
3544
3545 PRAGMA EXCEPTION_INIT( SR_Lock_Row, -54 );
3546
3547 /* **************** This cursor is no longer needed as the
3548 l_old_ServiceRequest_rec is now changed to type sr_oldvalues_rec_type .
3549
3550 Replacing the select list of columns with a select * so that the
3551 subtype defined in the spec can be used to pass the old SR values as
3552 a parameter to other procedures
3553
3554 * *****************/
3555 -- This rec type was changed to sr_oldvalues_rec_type as the
3556 -- workitem API (Misc ER owner Auto Assginment )needed a record type
3557 -- with old values , also the API validations needed the oldvalues_rec .
3558
3559 CURSOR L_SERVICEREQUEST_CSR IS
3560 SELECT *
3561 from cs_incidents_all_vl
3562 where incident_id = p_request_id
3563 for update nowait;
3564
3565 L_OLD_SERVICEREQUEST_REC SR_OLDVALUES_REC_TYPE;
3566
3567 -- out rec for servicerequest_cross_val
3568
3569 l_sr_cross_val_out_rec CS_ServiceRequest_UTIL.sr_cross_val_out_rec_type;
3570
3571 -- Validation record
3572 l_sr_validation_rec request_validation_rec_type;
3573
3574 l_audit_vals_rec sr_audit_rec_type;
3575
3576 -- Some temp variables
3577 l_update_desc_flex VARCHAR2(1) := p_update_desc_flex;
3578 l_type_id_temp NUMBER;
3579 l_only_status_update_flag VARCHAR2(1) := 'N';
3580 l_inventory_org_id NUMBER;
3581 l_closed_flag_temp VARCHAR2(1);
3582 l_status_validated BOOLEAN:= FALSE;
3583 l_contact_phone_num VARCHAR2(36);
3584 l_contact_fax_num VARCHAR2(36);
3585 l_employee_name VARCHAR2(240);
3586
3587 l_note_index BINARY_INTEGER;
3588 l_contact_index BINARY_INTEGER;
3589 l_note_id NUMBER;
3590 l_note_context_id NUMBER;
3591 l_notes_detail VARCHAR2(32767);
3592 l_interaction_id NUMBER;
3593
3594 l_bill_to_customer_id NUMBER;
3595 l_bill_to_location_id NUMBER;
3596 l_ship_to_customer_id NUMBER;
3597 l_ship_to_location_id NUMBER;
3598 l_install_customer_id NUMBER;
3599 l_install_location_id NUMBER;
3600
3601 l_org_id NUMBER;
3602
3603 l_contract_id NUMBER;
3604 l_project_number VARCHAR2(120);
3605
3606 l_primary_contact_found VARCHAR2(1) := 'N';
3607 l_contacts_passed VARCHAR2(1) := 'N' ;
3608
3609 l_old_close_flag VARCHAR2(1) ;
3610 l_new_close_flag VARCHAR2(1) ;
3611
3612 -- For Workflow Hook
3613 l_workflow_item_key NUMBER;
3614
3615 l_autolaunch_workflow_flag VARCHAR2(1);
3616 l_abort_workflow_close_flag VARCHAR2(1);
3617
3618 l_disallow_request_update VARCHAR2(1);
3619 l_disallow_owner_update VARCHAR2(1);
3620 l_disallow_product_update VARCHAR2(1);
3621
3622 l_sr_contact_point_id NUMBER;
3623 p_sr_contact_point_id NUMBER;
3624
3625 l_party_id_update VARCHAR2(1);
3626 l_contact_point_id_update VARCHAR2(1);
3627 l_contact_point_type_update VARCHAR2(1);
3628 l_contact_type_update VARCHAR2(1);
3629 l_primary_flag_update VARCHAR2(1) ;
3630
3631 l_old_party_id NUMBER;
3632 l_old_contact_point_id NUMBER;
3633 l_old_contact_point_type VARCHAR2(30);
3634 l_old_contact_type VARCHAR2(30);
3635 l_old_primary_flag VARCHAR2(1) ;
3636
3637 l_primary_contact_point_id NUMBER;
3638 l_saved_primary_contact_id NUMBER;
3639 l_saved_contact_point_id NUMBER ;
3640
3641 l_primary_contact_change VARCHAR2(1) := 'N';
3642
3643 l_count NUMBER;
3644
3645 ---Added so that workflow can call Update SR API instead of Calling Create Audit API
3646 ----bug 1485825
3647 l_wf_process_itemkey VARCHAR2(30);
3648 l_workflow_process_name VARCHAR2(30);
3649 l_workflow_process_id NUMBER;
3650 DestUpdated EXCEPTION;
3651 NoUpdate EXCEPTION;
3652 TargUpdated EXCEPTION;
3653
3654 -- Added for enh. 2690787
3655 l_primary_contact NUMBER;
3656
3657 -- Added to be used as OUT parameters in the call to the Business Events wrapper
3658 -- API.
3659 lx_return_status VARCHAR2(3);
3660 lx_msg_count NUMBER(15);
3661 lx_msg_data VARCHAR2(2000);
3662
3663 -- The BES wraper requires the old and new values of the updated SR to be passed
3664 -- as service_request_rec_type data types. The new values are accepted as an IN
3665 -- parameter, but there is'nt an equivalent rec type for the old values.
3666 -- This rec type will be populated only with attributes that can potentially be
3667 -- used to raise Business events. eg. Staus, Urgency, Owner, etc.
3668 l_old_sr_rec service_request_rec_type;
3669
3670 -- for cmro-eam; Local variable to store the old and new eam/cmro type flags that
3671 -- will be used to populate the sr record type variable that is passed to the
3672 -- user hooks
3673
3674 l_old_maintenance_flag VARCHAR2(3) := l_service_request_rec.old_type_maintenance_flag;
3675 l_new_maintenance_flag VARCHAR2(3) := l_service_request_rec.new_type_maintenance_flag;
3676
3677 l_old_cmro_flag VARCHAR2(3) := l_service_request_rec.old_type_CMRO_flag;
3678 l_new_cmro_flag VARCHAR2(3) := l_service_request_rec.new_type_CMRO_flag;
3679
3680 --Added for 11.5.10 Auditing project
3681 lx_audit_id NUMBER;
3682
3683 -- Added for API changes for unassigned_indicator
3684 l_unassigned_indicator NUMBER := 0 ;
3685
3686 -- Local variable to store business usage for security validation
3687 l_business_usage VARCHAR2(30);
3688
3689 -- Local variable to store attribute if security is enabled for self service resps.
3690 l_ss_sr_type_restrict VARCHAR2(10);
3691
3692 -- bug 3077818
3693
3694 l_primary_flag VARCHAR2(3) := 'N';
3695 l_note_status VARCHAR2(3) ;
3696 l_timezone_id NUMBER ;
3697
3698 l_primary_flag_temp VARCHAR2(1) ;
3699 l_contact_point_id_temp NUMBER ;
3700 l_contact_party_id_temp NUMBER ;
3701 l_contact_point_type_temp VARCHAR2(30) ;
3702 l_contact_type_temp VARCHAR2(30) ;
3703 l_business_process_id NUMBER;
3704 l_contract_service_id_valid VARCHAR2(1);
3705 l_old_contacts contacts_table;
3706 l_processed_contacts contacts_table;
3707
3708 l_start_eres_flag VARCHAR2(1);
3709 l_approval_status VARCHAR2(80);
3710 l_sr_related_data RELATED_DATA_TYPE;
3711 l_primary_contact_party_id cs_hz_sr_contact_points.party_id % TYPE;
3712 l_last_updated_by_temp NUMBER;
3713 BEGIN
3714
3715 -- Standard start of API savepoint
3716 SAVEPOINT Update_ServiceRequest_PVT;
3717
3718 -- Standard call to check for call compatibility
3719 -- Added the and condition for backward compatibility project, now
3720 -- both the version 2.0 and 3.0 are valid as this procedure can be called
3721 -- from both 1158 or 1159 env.
3722 -- The previous version, 3.0, is supported by the overloaded procedure. This API can be
3723 -- called only with ver 4.0
3724 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
3725 G_PKG_NAME) THEN
3726 -- AND NOT FND_API.Compatible_API_Call(l_api_version_back, p_api_version, l_api_name,
3727 -- G_PKG_NAME)
3728 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3729 END IF;
3730
3731 IF ( l_service_request_rec.initialize_flag IS NULL OR
3732 l_service_request_rec.initialize_flag <> G_INITIALIZED ) THEN
3733 RAISE FND_API.G_EXC_ERROR;
3734 END IF;
3735
3736 -- Initialize message list if p_init_msg_list is set to TRUE
3737 IF FND_API.To_Boolean(p_init_msg_list) THEN
3738 FND_MSG_PUB.Initialize;
3739 END IF;
3740
3741 -- Initialize API return status to success
3742 x_return_status := FND_API.G_RET_STS_SUCCESS;
3743
3744 ----------------------- FND Logging -----------------------------------
3745 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
3746 THEN
3747 FND_LOG.String
3748 ( FND_LOG.level_procedure , L_LOG_MODULE || 'start'
3749 , 'Inside ' || L_API_NAME_FULL || ', called with parameters below:'
3750 );
3751 FND_LOG.String
3752 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3753 , 'p_api_version:' || p_api_version
3754 );
3755 FND_LOG.String
3756 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3757 , 'p_init_msg_list:' || p_init_msg_list
3758 );
3759 FND_LOG.String
3760 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3761 , 'p_commit:' || p_commit
3762 );
3763 FND_LOG.String
3764 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3765 , 'p_validation_level:' || p_validation_level
3766 );
3767 FND_LOG.String
3768 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3769 , 'p_resp_appl_id:' || p_resp_appl_id
3770 );
3771 FND_LOG.String
3772 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3773 , 'p_resp_id:' || p_resp_id
3774 );
3775 FND_LOG.String
3776 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3777 , 'P_audit_comments:' || P_audit_comments
3778 );
3779 FND_LOG.String
3780 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3781 , 'P_object_version_number:' || P_object_version_number
3782 );
3783 FND_LOG.String
3784 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3785 , 'P_Last_updated_by:' || P_Last_updated_by
3786 );
3787 FND_LOG.String
3788 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3789 , 'P_Last_update_login:' || P_Last_update_login
3790 );
3791 FND_LOG.String
3792 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3793 , 'P_Last_update_date:' || P_Last_update_date
3794 );
3795 FND_LOG.String
3796 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3797 , 'p_request_id:' || p_request_id
3798 );
3799 FND_LOG.String
3800 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3801 , 'p_request_number:' || p_request_number
3802 );
3803 FND_LOG.String
3804 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3805 , 'p_auto_assign:' || p_auto_assign
3806 );
3807 FND_LOG.String
3808 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3809 , 'P_Called_by_workflow:' || P_Called_by_workflow
3810 );
3811 FND_LOG.String
3812 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3813 , 'P_Workflow_process_id:' || P_Workflow_process_id
3814 );
3815 FND_LOG.String
3816 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3817 , 'P_Validate_SR_Closure:' || P_Validate_SR_Closure
3818 );
3819 FND_LOG.String
3820 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3821 , 'P_Auto_Close_Child_Entities:' || P_Auto_Close_Child_Entities
3822 );
3823
3824 -- --------------------------------------------------------------------------
3825 -- This procedure Logs the record paramters of SR and NOTES, CONTACTS tables.
3826 -- --------------------------------------------------------------------------
3827 Log_SR_PVT_Parameters
3828 ( p_service_request_rec => p_service_request_rec
3829 , p_notes => p_notes
3830 , p_contacts => p_contacts
3831 );
3832
3833 END IF;
3834
3835 -- Initialize the value of the parameter from profile cs_sr_restrict_ib
3836 -- by shijain 4th dec 2002
3837
3838 g_restrict_ib:= fnd_profile.value('CS_SR_RESTRICT_IB');
3839
3840 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
3841 THEN
3842 FND_LOG.String
3843 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
3844 , 'The Value of profile CS_SR_RESTRICT_IB :' || g_restrict_ib
3845 );
3846 END IF;
3847
3848 BEGIN
3849
3850 SELECT object_version_number INTO l_dummy
3851 FROM cs_incidents_all_b
3852 WHERE incident_id = p_request_id;
3853
3854 EXCEPTION
3855 WHEN NO_DATA_FOUND THEN
3856 l_return_status := FND_API.G_RET_STS_ERROR;
3857 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
3858 (p_token_an => l_api_name_full,
3859 p_token_v => TO_CHAR(p_request_id),
3860 p_token_p => 'Request ID' ,
3861 p_table_name => G_TABLE_NAME,
3862 p_column_name => 'INCIDENT_ID');
3863 RAISE FND_API.G_EXC_ERROR;
3864 END ;
3865
3866
3867
3868 IF (l_dummy > p_object_version_number ) THEN
3869 RAISE DestUpdated;
3870 ELSIF (l_dummy < p_object_version_number ) THEN
3871 IF (p_invocation_mode = 'NORMAL')THEN
3872 RAISE NoUpdate;
3873 ELSIF (p_invocation_mode = 'REPLAY')THEN
3874 NULL;
3875 END IF;
3876 ELSE
3877 IF (p_invocation_mode = 'REPLAY') THEN
3878 RAISE TargUpdated;
3879 ELSIF (p_invocation_mode = 'NORMAL')THEN
3880 NULL;
3881 END IF;
3882
3883 END IF;
3884
3885 -- Check if mandatory parameter is passed
3886 IF (p_request_id IS NULL ) THEN
3887 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
3888 (p_token_an => l_api_name_full,
3889 p_token_np => 'SR Incident Id',
3890 p_table_name => G_TABLE_NAME,
3891 p_column_name => 'INCIDENT_ID' );
3892
3893 RAISE FND_API.G_EXC_ERROR;
3894 END IF;
3895
3896 IF (p_object_version_number IS NULL ) THEN
3897 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
3898 (p_token_an => l_api_name_full,
3899 p_token_np => 'SR Object Version Number',
3900 p_table_name => G_TABLE_NAME,
3901 p_column_name => 'OBJECT_VERSION_NUMBER');
3902
3903 RAISE FND_API.G_EXC_ERROR;
3904 END IF;
3905
3906 -- Check if user has passed null to mandatory parameters.
3907
3908 IF (l_service_request_rec.type_id IS NULL) THEN
3909 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
3910 (p_token_an => l_api_name_full,
3911 p_token_np => 'SR Type',
3912 p_table_name => G_TABLE_NAME,
3913 p_column_name => 'INCIDENT_TYPE_ID');
3914 RAISE FND_API.G_EXC_ERROR;
3915 END IF;
3916
3917 IF (l_service_request_rec.status_id IS NULL) THEN
3918 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
3919 (p_token_an => l_api_name_full,
3920 p_token_np => 'SR Status',
3921 p_table_name => G_TABLE_NAME,
3922 p_column_name => 'INCIDENT_STATUS_ID');
3923 RAISE FND_API.G_EXC_ERROR;
3924 END IF;
3925
3926 IF (l_service_request_rec.severity_id IS NULL) THEN
3927 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
3928 (p_token_an => l_api_name_full,
3929 p_token_np => 'SR Severity',
3930 p_table_name => G_TABLE_NAME,
3931 p_column_name => 'SEVERITY_ID');
3932
3933 RAISE FND_API.G_EXC_ERROR;
3934 END IF;
3935
3936 -- Request Date is a reqd field, so check if passed, else return error
3937 IF (l_service_request_rec.request_date IS NULL) THEN
3938 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
3939 (p_token_an => l_api_name_full,
3940 p_token_np => 'SR Request Date',
3941 p_table_name => G_TABLE_NAME,
3942 p_column_name => 'REQUEST_DATE');
3943 RAISE FND_API.G_EXC_ERROR;
3944 END IF;
3945
3946
3947 IF (l_service_request_rec.summary IS NULL) THEN
3948 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg (
3949 p_token_an => l_api_name_full,
3950 p_token_np => 'SR Summary',
3951 p_table_name => G_TABLE_NAME,
3952 p_column_name => 'SUMMARY');
3953 RAISE FND_API.G_EXC_ERROR;
3954 END IF;
3955
3956
3957 -- Fetch and lock the original values
3958 OPEN l_ServiceRequest_csr;
3959 FETCH l_ServiceRequest_csr INTO l_old_ServiceRequest_rec;
3960
3961 IF ( l_ServiceRequest_csr%NOTFOUND ) THEN
3962
3963 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
3964 ( p_token_an => l_api_name_full,
3965 p_token_v => TO_CHAR(p_request_id),
3966 p_token_p => 'p_request_id',
3967 p_table_name => G_TABLE_NAME,
3968 p_column_name => 'REQUEST_ID' );
3969
3970 RAISE FND_API.G_EXC_ERROR;
3971 END IF;
3972 -- check for item serial number. it must be null or G_miss_char
3973 IF l_service_request_rec.item_serial_number <> FND_API.G_MISS_CHAR
3974 THEN
3975 FND_MESSAGE.set_name ('CS', 'CS_SR_ITEM_SERIAL_OBSOLETE');
3976 FND_MESSAGE.set_token
3977 ( 'API_NAME'
3978 , 'CS_SERVICEREQUEST_PVT.update_servicerequest'
3979 );
3980 FND_MSG_PUB.ADD_DETAIL
3981 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.ITEM_SERIAL_NUMBER'
3982 );
3983 RAISE FND_API.G_EXC_ERROR;
3984 END IF;
3985 --
3986 IF l_service_request_rec.type_id = FND_API.G_MISS_NUM
3987 THEN
3988 l_service_request_rec.type_id := l_old_servicerequest_rec.incident_type_id;
3989 END IF;
3990 IF l_service_request_rec.status_id = FND_API.G_MISS_NUM
3991 THEN
3992 l_service_request_rec.status_id := l_old_servicerequest_rec.incident_status_id;
3993 END IF;
3994
3995 CS_SERVICEREQUEST_PVT.get_incident_type_details
3996 ( p_incident_type_id => l_service_request_rec.type_id
3997 , x_business_process_id => l_sr_related_data.business_process_id
3998 , x_autolaunch_workflow_flag => l_sr_related_data.autolaunch_workflow_flag
3999 , x_abort_workflow_close_flag => l_sr_related_data.abort_workflow_close_flag
4000 , x_workflow => l_sr_related_data.workflow
4001 , x_return_status => l_return_status
4002 );
4003 IF l_return_status = FND_API.G_RET_STS_ERROR
4004 THEN
4005 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
4006 ( p_token_an => l_api_name_full
4007 , p_token_v => TO_CHAR(l_service_request_rec.type_id)
4008 , p_token_p => 'p_type_id'
4009 , p_table_name => G_TABLE_NAME
4010 , p_column_name => 'INCIDENT_TYPE_ID'
4011 );
4012 RAISE FND_API.G_EXC_ERROR;
4013 END IF;
4014
4015 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
4016 THEN
4017 FND_LOG.String
4018 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4019 , 'The defaulted value of parameter business_process_id :'
4020 || l_sr_related_data.business_process_id
4021 );
4022 END IF;
4023
4024 -- 1. Perform the security check if validation level is > none
4025 -- 2. Perform the SR Type change check for EAM to non-EAM and vice versa
4026 -- 3. Check if the install site and site use are the same
4027
4028 IF ( p_validation_level > fnd_api.g_valid_level_none ) then
4029 -- dj api cleanup
4030 -- Validate if the current responsibility has access to the SR type being update.
4031 -- If the SR Type is itself being updated, then first validate if the responsibility
4032 -- has access to the old SR Type and then vaidate if the responsibility has accesss
4033 -- to the new SR Type as well.
4034 -- Invoke the VALIDATE_TYPE procedure that has the logic to check for security
4035 -- access
4036
4037 -- Get the business usage of the responsibility that is attempting to create
4038 -- the SR.
4039 get_business_usage (
4040 p_responsibility_id => p_resp_id,
4041 p_application_id => fnd_global.resp_appl_id,
4042 x_business_usage => l_business_usage );
4043
4044 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
4045 THEN
4046 FND_LOG.String
4047 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4048 , 'The defaulted value of parameter business_usage :' || l_business_usage
4049 );
4050 END IF;
4051
4052 -- Get indicator of self service security enabled or not
4053 if ( l_business_usage = 'SELF_SERVICE' ) then
4054 get_ss_sec_enabled (
4055 x_ss_sr_type_restrict => l_ss_sr_type_restrict );
4056 end if;
4057
4058
4059 -- For bug 3370562 - pass resp_id an appl_id
4060 -- validate security in update; first against old sr type
4061
4062 -- For bug 3474365 - pass different operation code for old sr type
4063 cs_servicerequest_util.validate_type (
4064 p_parameter_name => NULL,
4065 p_type_id => l_old_servicerequest_rec.incident_type_id,
4066 p_subtype => G_SR_SUBTYPE,
4067 p_status_id => p_service_request_rec.status_id, -- not used
4068 p_resp_id => p_resp_id,
4069 p_resp_appl_id => NVL(p_resp_appl_id, fnd_global.resp_appl_id),
4070 p_business_usage => l_business_usage,
4071 p_ss_srtype_restrict => l_ss_sr_type_restrict,
4072 p_operation => 'UPDATE_OLD',
4073 x_return_status => lx_return_status,
4074 x_cmro_flag => l_old_cmro_flag,
4075 x_maintenance_flag => l_old_maintenance_flag );
4076
4077 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) then
4078 -- security violation; responsibility does not have access to SR Type
4079 -- being created. Stop and raise error.
4080 RAISE FND_API.G_EXC_ERROR;
4081 end if;
4082
4083 -- For bug 3370562 - pass resp_id an appl_id
4084 -- if type has changed and is not the same as the existing type, then validate
4085 -- if the responsibility has access to the new SR Type
4086 IF ( p_service_request_rec.type_id <> FND_API.G_MISS_NUM AND
4087 p_service_request_rec.type_id <> l_old_ServiceRequest_rec.incident_type_id ) then
4088 cs_servicerequest_util.validate_type (
4089 p_parameter_name => NULL,
4090 p_type_id => p_service_request_rec.type_id,
4091 p_subtype => G_SR_SUBTYPE,
4092 p_status_id => p_service_request_rec.status_id, -- not used
4093 p_resp_id => p_resp_id,
4094 p_resp_appl_id => NVL(p_resp_appl_id, fnd_global.resp_appl_id),
4095 p_business_usage => l_business_usage,
4096 p_ss_srtype_restrict => l_ss_sr_type_restrict,
4097 p_operation => 'UPDATE',
4098 x_return_status => lx_return_status,
4099 x_cmro_flag => l_new_cmro_flag,
4100 x_maintenance_flag => l_new_maintenance_flag );
4101
4102 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) then
4103 -- security violation; responsibility does not have access to SR Type
4104 -- being created. Stop and raise error.
4105 RAISE FND_API.G_EXC_ERROR;
4106 end if;
4107
4108 -- if the type has changed, check if the change is EAM <-> non-EAM.
4109 cs_servicerequest_util.validate_type_change (
4110 p_old_eam_type_flag => l_old_maintenance_flag,
4111 p_new_eam_type_flag => l_new_maintenance_flag,
4112 x_return_status => lx_return_status );
4113
4114 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) then
4115 -- Type change is not allowed. Msg put on stack by val. proc
4116 RAISE FND_API.G_EXC_ERROR;
4117 end if;
4118
4119 ELSE -- the type has not changed; assign old flag values to the new flags
4120 l_new_cmro_flag := l_old_cmro_flag;
4121 l_new_maintenance_flag := l_old_maintenance_flag;
4122 END IF;
4123 IF NVL(l_new_maintenance_flag,'N') <> 'Y'
4124 THEN
4125 IF p_service_request_rec.maint_organization_id <> FND_API.G_MISS_NUM
4126 THEN
4127 FND_MESSAGE.set_name ('CS', 'CS_SR_MAINT_ORG_NOT_ALLOWED');
4128 FND_MESSAGE.set_token
4129 ( 'API_NAME'
4130 , 'CS_SERVICEREQUEST_PVT.update_servicerequest'
4131 );
4132 FND_MSG_PUB.ADD_DETAIL
4133 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.MAINT_ORGANIZATION_ID'
4134 );
4135 RAISE FND_API.G_EXC_ERROR;
4136 END IF;
4137 ELSE -- maintenance flag is 'Y'
4138 IF (p_service_request_rec.customer_product_id IS NOT NULL AND
4139 p_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM)
4140 THEN
4141 IF (p_service_request_rec.maint_organization_id = FND_API.G_MISS_NUM AND
4142 l_old_servicerequest_rec.maint_organization_id IS NULL)
4143 THEN
4144 CS_ServiceRequest_UTIL.Add_Missing_Param_Msg(l_api_name_full, 'Maint_organization_id');
4145 RAISE FND_API.G_EXC_ERROR;
4146 ELSIF (p_service_request_rec.maint_organization_id IS NULL) THEN
4147 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'Maint_organization_id');
4148 RAISE FND_API.G_EXC_ERROR;
4149 END IF;
4150 END IF;
4151 END IF;
4152
4153 --- For BUG # 2933250, check to see if install_site_id and install_site_use_id are same . -- pkesani
4154
4155 IF (l_service_request_rec.install_site_id = FND_API.G_MISS_NUM) THEN
4156 IF ( l_service_request_rec.install_site_use_id <> FND_API.G_MISS_NUM) THEN
4157 l_service_request_rec.install_site_id := l_service_request_rec.install_site_use_id;
4158 END IF;
4159 ELSIF (l_service_request_rec.install_site_id IS NOT NULL) THEN
4160 IF (l_service_request_rec.install_site_use_id = FND_API.G_MISS_NUM) THEN
4161 l_service_request_rec.install_site_use_id := l_service_request_rec.install_site_id;
4162 ELSIF (l_service_request_rec.install_site_use_id <> l_service_request_rec.install_site_id) THEN
4163 RAISE invalid_install_site;
4164 ELSIF (l_service_request_rec.install_site_use_id IS NULL) THEN
4165 RAISE invalid_install_site;
4166 END IF;
4167 ELSIF (l_service_request_rec.install_site_id IS NULL) THEN
4168 IF (l_service_request_rec.install_site_use_id = FND_API.G_MISS_NUM) THEN
4169 l_service_request_rec.install_site_use_id := l_service_request_rec.install_site_id;
4170 ELSIF (l_service_request_rec.install_site_use_id IS NOT NULL) THEN
4171 RAISE invalid_install_site;
4172 END IF;
4173 END IF;
4174
4175 IF (l_new_maintenance_flag = 'y' OR l_new_maintenance_flag = 'Y') THEN
4176 IF (l_service_request_rec.inventory_org_id IS NULL) THEN
4177 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(
4178 l_api_name_full, 'Inventory Org ID');
4179 RAISE FND_API.G_EXC_ERROR;
4180 END IF;
4181 END IF;
4182
4183 -- popluate the record for the user hooks
4184 l_service_request_rec.Old_type_CMRO_Flag := l_old_cmro_flag;
4185 l_service_request_rec.Old_type_Maintenance_Flag := l_old_maintenance_flag;
4186 l_service_request_rec.New_type_CMRO_flag := l_new_cmro_flag;
4187 l_service_request_rec.New_type_Maintenance_flag := l_new_maintenance_flag;
4188
4189 END IF; -- IF ( p_validation_level > fnd_api.g_valid_level_none )
4190
4191 l_sr_related_data.target_status_id := l_service_request_rec.status_id;
4192 CS_SERVICEREQUEST_UTIL.get_status_details
4193 ( p_status_id => l_old_servicerequest_rec.incident_status_id
4194 , x_close_flag => l_sr_related_data.old_close_flag
4195 , x_disallow_request_update => l_sr_related_data.old_disallow_request_update
4196 , x_disallow_agent_dispatch => l_sr_related_data.old_disallow_owner_update
4197 , x_disallow_product_update => l_sr_related_data.old_disallow_product_update
4198 , x_pending_approval_flag => l_sr_related_data.old_pending_approval_flag
4199 , x_intermediate_status_id => l_sr_related_data.old_intermediate_status_id
4200 , x_approval_action_status_id => l_sr_related_data.old_approval_action_status_id
4201 , x_rejection_action_status_id => l_sr_related_data.old_rejection_action_status_id
4202 , x_return_status => l_return_status
4203 );
4204 l_start_eres_flag := 'N';
4205 IF (l_service_request_rec.status_id <> FND_API.G_MISS_NUM AND
4206 l_service_request_rec.status_id <> l_old_servicerequest_rec.incident_status_id)
4207 THEN
4208 CS_SERVICEREQUEST_UTIL.get_status_details
4209 ( p_status_id => l_sr_related_data.target_status_id
4210 , x_close_flag => l_sr_related_data.close_flag
4211 , x_disallow_request_update => l_sr_related_data.disallow_request_update
4212 , x_disallow_agent_dispatch => l_sr_related_data.disallow_owner_update
4213 , x_disallow_product_update => l_sr_related_data.disallow_product_update
4214 , x_pending_approval_flag => l_sr_related_data.pending_approval_flag
4215 , x_intermediate_status_id => l_sr_related_data.intermediate_status_id
4216 , x_approval_action_status_id => l_sr_related_data.approval_action_status_id
4217 , x_rejection_action_status_id => l_sr_related_data.rejection_action_status_id
4218 , x_return_status => l_return_status
4219 );
4220
4221 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
4222 THEN
4223 FND_LOG.String
4224 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4225 , 'The defaulted value of parameter disallow_request_update :'
4226 || l_sr_related_data.disallow_request_update
4227 );
4228 FND_LOG.String
4229 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4230 , 'The defaulted value of parameter disallow_owner_update :'
4231 || l_sr_related_data.disallow_owner_update
4232 );
4233 FND_LOG.String
4234 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4235 , 'The defaulted value of parameter disallow_product_update :'
4236 || l_sr_related_data.disallow_product_update
4237 );
4238 FND_LOG.String
4239 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4240 , 'The defaulted value of parameter pending_approval_flag :'
4241 || l_sr_related_data.pending_approval_flag
4242 );
4243 FND_LOG.String
4244 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4245 , 'The defaulted value of parameter intermediate_status_id :'
4246 || l_sr_related_data.intermediate_status_id
4247 );
4248 FND_LOG.String
4249 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4250 , 'The defaulted value of parameter approval_action_status_id :'
4251 || l_sr_related_data.approval_action_status_id
4252 );
4253 FND_LOG.String
4254 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4255 , 'The defaulted value of parameter rejection_action_status_id :'
4256 || l_sr_related_data.rejection_action_status_id
4257 );
4258 END IF;
4259
4260 IF (l_sr_related_data.intermediate_status_id IS NOT NULL AND
4261 l_sr_related_data.intermediate_status_id <> l_old_servicerequest_rec.incident_status_id AND
4262 NVL(p_service_request_rec.last_update_program_code,'UNKOWN') <> 'ERES')
4263 THEN
4264 l_start_eres_flag := 'Y';
4265 l_service_request_rec.status_id := l_sr_related_data.intermediate_status_id;
4266 END IF;
4267
4268 IF (l_sr_related_data.pending_approval_flag = 'Y' AND
4269 NVL(p_service_request_rec.last_update_program_code,'UNKOWN') <> 'ERES')
4270 THEN
4271 FND_MESSAGE.set_name ('CS', 'CS_SR_INTERMEDIATE_STATUS');
4272 FND_MESSAGE.set_token
4273 ( 'API_NAME'
4274 , 'CS_SERVICEREQUEST_PVT.update_servicerequest'
4275 );
4276 FND_MESSAGE.set_token('STATUS_ID',l_sr_related_data.target_status_id);
4277 FND_MSG_PUB.ADD_DETAIL
4278 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.incident_status_id'
4279 );
4280 RAISE FND_API.G_EXC_ERROR;
4281 END IF; -- l_pending approval flag is Y
4282 ELSE -- status_id <> G_MISS and not equal to old value
4283 l_sr_related_data.close_flag := l_sr_related_data.old_close_flag;
4284 l_sr_related_data.target_status_id := l_old_servicerequest_rec.incident_status_id;
4285 l_sr_related_data.intermediate_status_id := l_sr_related_data.old_intermediate_status_id;
4286
4287 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
4288 THEN
4289 FND_LOG.String
4290 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4291 , 'The defaulted value of parameter intermediate_status_id :'
4292 || l_sr_related_data.intermediate_status_id
4293 );
4294 END IF;
4295 END IF;
4296 IF l_sr_related_data.old_disallow_request_update = 'Y' AND
4297 l_sr_related_data.intermediate_status_id IS NOT NULL AND
4298 NVL(p_service_request_rec.last_update_program_code,'UNKOWN') <> 'ERES'
4299 THEN
4300 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_ONLY_STATUS_UPDATED');
4301 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
4302 FND_MSG_PUB.Add_Detail
4303 ( p_message_type => fnd_msg_pub.G_WARNING_MSG
4304 , p_same_associated_columns => 'CS_INCIDENTS_ALL_B.INCIDENT_STATUS_ID'
4305 );
4306 IF l_old_servicerequest_rec.incident_status_id = l_service_request_rec.status_id
4307 THEN
4308 CS_ServiceRequest_UTIL.Add_Same_Val_Update_Msg
4309 ( p_token_an => 'CS_SERVICEREQUEST_PUB.update_servicerequest'
4310 , p_token_p => 'p_status_id'
4311 , p_table_name => G_TABLE_NAME
4312 , p_column_name => 'INCIDENT_STATUS_ID'
4313 );
4314 RETURN;
4315 ELSE
4316 l_last_updated_by_temp := l_service_request_rec.last_updated_by;
4317 CS_SERVICEREQUEST_PVT.initialize_rec(l_service_request_rec);
4318 -- we need to copy back intermediate status because this case will happen only if
4319 -- input status has intermediate status
4320 l_service_request_rec.status_id := l_sr_related_data.intermediate_status_id;
4321 l_service_request_rec.last_updated_by := p_service_request_rec.last_updated_by;
4322 END IF;
4323 END IF;
4324
4325 -- end of cmro_eam
4326
4327 -- Made changes for bug #2835847, if either last_update_date is passed
4328 -- in the parameter (p_last_updated_by or in the service request rec.
4329 -- last_updated_by, both will be considered.
4330
4331 IF (l_service_request_rec.last_updated_by IS NULL OR
4332 l_service_request_rec.last_updated_by = FND_API.G_MISS_NUM) THEN
4333 IF (p_last_updated_by IS NOT NULL AND
4334 p_last_updated_by <>FND_API.G_MISS_NUM) THEN
4335 l_service_request_rec.last_updated_by := p_last_updated_by;
4336 END IF;
4337 END IF;
4338
4339 -- Make the preprocessing call to the user hooks
4340 --
4341 -- Pre call to the Customer Type User Hook
4342 --
4343 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
4344 'Update_ServiceRequest',
4345 'B', 'C') THEN
4346
4347 -- hardcoded the version 2.0 shijain nov 27 2002
4348
4349 cs_servicerequest_cuhk.Update_ServiceRequest_Pre
4350 ( p_api_version => 2.0,
4351 p_init_msg_list => fnd_api.g_false ,
4352 p_commit => p_commit,
4353 p_validation_level => p_validation_level,
4354 x_return_status => l_return_status,
4355 x_msg_count => x_msg_count,
4356 x_msg_data => x_msg_data,
4357 p_request_id => p_request_id ,
4358 p_object_version_number => p_object_version_number,
4359 p_resp_appl_id => p_resp_appl_id,
4360 p_resp_id => p_resp_id,
4361 p_last_updated_by => p_last_updated_by,
4362 p_last_update_login => p_last_update_login,
4363 p_last_update_date => p_last_update_date,
4364 p_invocation_mode => p_invocation_mode,
4365 p_service_request_rec => l_service_request_rec,
4366 p_update_desc_flex => p_update_desc_flex,
4367 p_notes => p_notes,
4368 p_contacts => p_contacts,
4369 p_audit_comments => p_audit_comments,
4370 p_called_by_workflow => p_called_by_workflow,
4371 p_workflow_process_id => p_workflow_process_id,
4372 x_workflow_process_id => x_sr_update_out_rec.workflow_process_id,
4373 x_interaction_id => x_sr_update_out_rec.interaction_id);
4374
4375 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4376 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4377 END IF;
4378 END IF;
4379
4380 -- Pre call to the Vertical Type User Hook
4381 --
4382 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
4383 'Update_ServiceRequest',
4384 'B', 'V') THEN
4385
4386 -- hardcoded the version 2.0 shijain nov 27 2002
4387
4388 cs_servicerequest_vuhk.Update_ServiceRequest_Pre
4389 ( p_api_version => 2.0,
4390 p_init_msg_list => fnd_api.g_false ,
4391 p_commit => p_commit,
4392 p_validation_level => p_validation_level,
4393 x_return_status => l_return_status,
4394 x_msg_count => x_msg_count,
4395 x_msg_data => x_msg_data,
4396 p_request_id => p_request_id ,
4397 p_object_version_number => p_object_version_number,
4398 p_resp_appl_id => p_resp_appl_id,
4399 p_resp_id => p_resp_id,
4400 p_last_updated_by => p_last_updated_by,
4401 p_last_update_login => p_last_update_login,
4402 p_last_update_date => p_last_update_date,
4403 p_service_request_rec => l_service_request_rec,
4404 p_update_desc_flex => p_update_desc_flex,
4405 p_notes => p_notes,
4406 p_contacts => p_contacts,
4407 p_audit_comments => p_audit_comments,
4408 p_called_by_workflow => p_called_by_workflow,
4409 p_workflow_process_id => p_workflow_process_id,
4410 x_workflow_process_id => x_sr_update_out_rec.workflow_process_id,
4411 x_interaction_id => x_sr_update_out_rec.interaction_id);
4412
4413 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4414 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4415 END IF;
4416 END IF;
4417
4418 -- Pre call to the Internal Type User Hook
4419 --
4420
4421 --Code to populate the global record type with the passed record type
4422 --
4423 user_hooks_rec.customer_id := l_old_ServiceRequest_rec.customer_id ;
4424 user_hooks_rec.request_id := p_request_id ;
4425
4426 -- for cmro_eam
4427 -- set additional paramters for cmro_eam
4428 -- status_flag,old_type_cmro_flag,new_type_cmro_flag,customer_product_id,
4429 -- status_id,exp_resolution_date
4430
4431 if (l_service_request_rec.status_id = FND_API.G_MISS_NUM) then
4432 l_service_request_rec.status_id := l_old_ServiceRequest_rec.incident_status_id;
4433 end if;
4434
4435 if (l_service_request_rec.customer_product_id = FND_API.G_MISS_NUM) then
4436 l_service_request_rec.customer_product_id := l_old_ServiceRequest_rec.customer_product_id;
4437 end if;
4438
4439 if (l_service_request_rec.exp_resolution_date = FND_API.G_MISS_DATE) then
4440 l_service_request_rec.exp_resolution_date := l_old_ServiceRequest_rec.expected_resolution_date;
4441 end if;
4442
4443 user_hooks_rec.status_flag := get_status_flag(l_service_request_rec.status_id);
4444 user_hooks_rec.old_type_cmro_flag := l_service_request_rec.Old_type_CMRO_Flag;
4445 user_hooks_rec.new_type_cmro_flag := l_service_request_rec.New_type_CMRO_flag;
4446 user_hooks_rec.customer_product_id := l_service_request_rec.customer_product_id;
4447 user_hooks_rec.status_id := l_service_request_rec.status_id;
4448 user_hooks_rec.exp_resolution_date := l_service_request_rec.exp_resolution_date;
4449
4450 -- end for cmro_eam
4451
4452 cs_servicerequest_iuhk.Update_ServiceRequest_Pre(x_return_status=>l_return_status);
4453
4454 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4455 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4456 END IF;
4457
4458 -- hardcoded the version 2.0 shijain nov 27 2002
4459
4460 l_sr_rec_temp := l_service_request_rec;
4461
4462 Update_SR_Validation
4463 ( p_api_version => 2.0,
4464 p_init_msg_list => fnd_api.g_false ,
4465 --p_service_request_rec => p_service_request_rec,
4466 p_service_request_rec => l_sr_rec_temp,
4467 p_contacts => p_contacts,
4468 p_notes => p_notes,
4469 p_audit_comments => p_audit_comments,
4470 p_invocation_mode => p_invocation_mode,
4471 p_resp_id => p_resp_id,
4472 p_resp_appl_id => p_resp_appl_id,
4473 p_request_id => p_request_id,
4474 p_validation_level => p_validation_level,
4475 p_commit => p_commit,
4476 p_last_updated_by => p_last_updated_by,
4477 p_last_update_login => p_last_update_login,
4478 p_last_update_date => p_last_update_date,
4479 p_object_version_number => p_object_version_number,
4480 x_return_status => l_return_status,
4481 x_contra_id => l_contra_id,
4482 x_contract_number => l_contract_number,
4483 x_owner_assigned_flag => l_owner_assigned_flag,
4484 x_msg_count => x_msg_count,
4485 x_msg_data => x_msg_data,
4486 x_audit_vals_rec => l_audit_vals_rec,
4487 x_service_request_rec => l_service_request_rec,
4488 x_autolaunch_wkf_flag => l_autolaunch_workflow_flag,
4489 x_abort_wkf_close_flag => l_abort_workflow_close_flag,
4490 x_wkf_process_name => l_workflow_process_name,
4491 x_workflow_process_id => l_workflow_process_id,
4492 x_interaction_id => l_interaction_id,
4493 p_update_desc_flex => p_update_desc_flex,
4494 p_called_by_workflow => p_called_by_workflow,
4495 p_workflow_process_id => p_workflow_process_id,
4496 -- for cmro
4497 p_cmro_flag => l_new_cmro_flag,
4498 p_maintenance_flag => l_new_maintenance_flag,
4499 p_auto_assign => p_auto_assign
4500 );
4501
4502
4503 -- for cmro_eam
4504 l_service_request_rec.Old_type_CMRO_Flag := l_old_cmro_flag;
4505 l_service_request_rec.Old_type_Maintenance_Flag := l_old_maintenance_flag;
4506 l_service_request_rec.New_type_CMRO_flag := l_new_cmro_flag;
4507 l_service_request_rec.New_type_Maintenance_flag := l_new_maintenance_flag;
4508
4509 -- end of cmro_eam
4510
4511 IF (l_return_status = 'R' ) THEN
4512 l_only_status_update_flag := 'Y';
4513
4514 -- hardcoded the version 2.0 shijain nov 27 2002
4515 -- for bug # 3640344 - pkesani added the parameter p_closed_date.
4516 -- Give a message to user
4517 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
4518 THEN
4519 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_ONLY_STATUS_UPDATED');
4520 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
4521 FND_MSG_PUB.Add_Detail
4522 ( p_message_type => fnd_msg_pub.G_WARNING_MSG
4523 , p_same_associated_columns => 'T'
4524 );
4525 END IF;
4526
4527
4528 CS_Servicerequest_PVT.Update_Status
4529 ( p_api_version => 2.0,
4530 p_init_msg_list => fnd_api.g_false ,
4531 p_resp_id => p_resp_id,
4532 p_validation_level => fnd_api.g_valid_level_full,
4533 x_return_status => l_return_status,
4534 x_msg_count => x_msg_count,
4535 x_msg_data => x_msg_data,
4536 p_request_id => p_request_id,
4537 p_object_version_number => p_object_version_number,
4538 p_status_id => l_service_request_rec.status_id,
4539 p_closed_date => l_service_request_rec.closed_date,
4540 p_last_updated_by => l_service_request_rec.last_updated_by ,
4541 p_last_update_login => l_service_request_rec.last_update_login ,
4542 p_last_update_date => l_service_request_rec.last_update_date ,
4543 x_interaction_id => l_interaction_id
4544 );
4545
4546
4547 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4548 RAISE FND_API.G_EXC_ERROR;
4549 END IF;
4550
4551 ELSIF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4552 RAISE FND_API.G_EXC_ERROR;
4553 END IF;
4554
4555 IF (l_only_status_update_flag <> 'Y') THEN
4556
4557 vldt_sr_rec
4558 ( p_sr_rec => l_service_request_rec
4559 , p_sr_rec_inp => p_service_request_rec
4560 , p_sr_related_data => l_sr_related_data
4561 , p_mode => 'UPDATE'
4562 , p_validation_level => p_validation_level
4563 , p_request_id => p_request_id
4564 , p_object_version_number => p_object_version_number
4565 , p_last_updated_by => p_last_updated_by
4566 , p_default_contract_sla_ind => p_default_contract_sla_ind
4567 , p_auto_assign => p_auto_assign
4568 , p_old_incident_location_id => l_old_servicerequest_rec.incident_location_id
4569 , p_old_incident_location_type => l_old_servicerequest_rec.incident_location_type
4570 , p_old_incident_country => l_old_servicerequest_rec.incident_country
4571 , p_old_incident_owner_id => l_old_servicerequest_rec.incident_owner_id
4572 , p_old_owner_group_id => l_old_servicerequest_rec.owner_group_id
4573 , p_old_resource_type => l_old_servicerequest_rec.resource_type
4574 , p_old_site_id => l_old_servicerequest_rec.site_id
4575 , p_old_obligation_date => l_old_servicerequest_rec.obligation_date
4576 , p_old_expected_resolution_date => l_old_servicerequest_rec.expected_resolution_date
4577 , p_old_contract_id => l_old_servicerequest_rec.contract_id
4578 , p_old_contract_service_id => l_old_servicerequest_rec.contract_service_id
4579 , p_old_install_site_id => l_old_servicerequest_rec.install_site_id
4580 , p_old_system_id => l_old_servicerequest_rec.system_id
4581 , p_old_account_id => l_old_servicerequest_rec.account_id
4582 , p_old_inventory_item_id => l_old_servicerequest_rec.inventory_item_id
4583 , p_old_customer_product_id => l_old_servicerequest_rec.customer_product_id
4584 , p_old_incident_type_id => l_old_servicerequest_rec.incident_type_id
4585 , p_old_time_zone_id => l_old_servicerequest_rec.time_zone_id
4586 , p_old_incident_severity_id => l_old_servicerequest_rec.incident_severity_id
4587 , x_contract_number => l_contract_number
4588 , x_return_status => l_return_status
4589 );
4590 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
4591 THEN
4592 RAISE FND_API.G_EXC_ERROR;
4593 END IF;
4594 l_contra_id := l_service_request_rec.contract_id;
4595 -- API cleanup for 11.5.10
4596 -- Call the cross validation procedure if the validation level is
4597 -- more than none.
4598 -- The cross validation procedure executes all the data relationships
4599 -- that exist between the SR attributes. This was introduced in
4600 -- Release 11.5.10 as part of the API Cleanup projecT
4601 --
4602 l_contract_service_id_valid := 'Y';
4603 IF ( p_validation_level > FND_API.G_VALID_LEVEL_NONE ) THEN
4604 CS_ServiceRequest_UTIL.SERVICEREQUEST_CROSS_VAL (
4605 p_new_sr_rec => l_service_request_rec,
4606 p_old_sr_rec => l_old_ServiceRequest_rec,
4607 x_cross_val_out_rec => l_sr_cross_val_out_rec,
4608 x_return_status => l_return_status );
4609
4610 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4611 RAISE FND_API.G_EXC_ERROR;
4612 END IF;
4613
4614 -- Assigning the values from the out parameters to respective fields .
4615
4616 -- For bug 3340433 - populate directly as the out rec will have the current value
4617 /* IF (l_service_request_rec.customer_product_id IS NOT NULL) AND
4618 (l_sr_cross_val_out_rec.inventory_item_id <> l_old_ServiceRequest_rec.inventory_item_id) THEN
4619 l_service_request_rec.inventory_item_id := l_sr_cross_val_out_rec.inventory_item_id;
4620 END IF; */
4621
4622 l_service_request_rec.inventory_item_id := l_sr_cross_val_out_rec.inventory_item_id;
4623
4624 IF (l_sr_cross_val_out_rec.bill_to_site_id IS NOT NULL) then
4625 l_service_request_rec.bill_to_site_id := l_sr_cross_val_out_rec.bill_to_site_id;
4626 END IF;
4627 IF (l_sr_cross_val_out_rec.bill_to_site_use_id IS NOT NULL) then
4628 l_service_request_rec.bill_to_site_use_id := l_sr_cross_val_out_rec.bill_to_site_use_id;
4629 END IF;
4630 IF (l_sr_cross_val_out_rec.ship_to_site_id IS NOT NULL) then
4631 l_service_request_rec.ship_to_site_id := l_sr_cross_val_out_rec.ship_to_site_id;
4632 END IF;
4633 IF (l_sr_cross_val_out_rec.ship_to_site_use_id IS NOT NULL) then
4634 l_service_request_rec.ship_to_site_use_id := l_sr_cross_val_out_rec.ship_to_site_use_id;
4635 END IF;
4636 IF (l_sr_cross_val_out_rec.contract_id IS NOT NULL) then
4637 l_contra_id := l_sr_cross_val_out_rec.contract_id;
4638 END IF;
4639 IF (l_sr_cross_val_out_rec.contract_number IS NOT NULL) then
4640 l_contract_number := l_sr_cross_val_out_rec.contract_number;
4641 END IF;
4642 -- Product Revision
4643 l_service_request_rec.product_revision := l_sr_cross_val_out_rec.product_revision;
4644 IF (l_service_request_rec.product_revision = FND_API.G_MISS_CHAR) then
4645 l_service_request_rec.product_revision := null;
4646 END IF;
4647 IF (nvl(l_service_request_rec.product_revision,'-999') = nvl(l_old_ServiceRequest_rec.product_revision,'-999')) THEN
4648 l_audit_vals_rec.CHANGE_PRODUCT_REVISION_FLAG := 'N';
4649 l_audit_vals_rec.old_product_revision := l_old_ServiceRequest_rec.product_revision;
4650 l_auDit_vals_rec.product_revision := l_service_request_rec.product_revision;
4651 ELSE
4652 l_audit_vals_rec.CHANGE_PRODUCT_REVISION_FLAG := 'Y';
4653 l_audit_vals_rec.OLD_product_revision := l_old_ServiceRequest_rec.product_revision;
4654 l_audit_vals_rec.product_revision := l_service_request_rec.product_revision;
4655 END IF;
4656 -- Component Version
4657 l_service_request_rec.component_version := l_sr_cross_val_out_rec.component_version;
4658 IF (l_service_request_rec.component_version = FND_API.G_MISS_CHAR) then
4659 l_service_request_rec.component_version := null;
4660 END IF;
4661 IF (nvl(l_service_request_rec.component_version,'-999') = nvl(l_old_ServiceRequest_rec.component_version,'-999')) THEN
4662 l_audit_vals_rec.change_comp_ver_flag := 'N';
4663 l_audit_vals_rec.old_component_version := l_old_ServiceRequest_rec.component_version;
4664 l_auDit_vals_rec.component_version := l_service_request_rec.component_version;
4665 ELSE
4666 l_audit_vals_rec.CHANGE_COMP_VER_FLAG := 'Y';
4667 l_audit_vals_rec.OLD_component_version := l_old_ServiceRequest_rec.component_version;
4668 l_audit_vals_rec.component_version := l_service_request_rec.component_version;
4669 END IF;
4670 -- Subcomponent Version
4671 l_service_request_rec.subcomponent_version := l_sr_cross_val_out_rec.subcomponent_version;
4672 IF (l_service_request_rec.subcomponent_version = FND_API.G_MISS_CHAR) then
4673 l_service_request_rec.subcomponent_version := null;
4674 END IF;
4675 IF (nvl(l_service_request_rec.subcomponent_version,'-999') = nvl(l_old_ServiceRequest_rec.subcomponent_version,'-999')) THEN
4676 l_audit_vals_rec.change_subcomp_ver_flag := 'N';
4677 l_audit_vals_rec.old_subcomponent_version := l_old_ServiceRequest_rec.subcomponent_version;
4678 l_audit_vals_rec.subcomponent_version := l_service_request_rec.subcomponent_version;
4679 ELSE
4680 l_audit_vals_rec.CHANGE_SUBCOMP_VER_FLAG := 'Y';
4681 l_audit_vals_rec.OLD_subcomponent_version := l_old_ServiceRequest_rec.subcomponent_version;
4682 l_audit_vals_rec.subcomponent_version := l_service_request_rec.subcomponent_version;
4683 END IF;
4684 l_contract_service_id_valid := l_sr_cross_val_out_rec.contract_service_id_valid;
4685
4686 END IF; -- IF ( p_validation_level > FND_API.G_VALID_LEVEL_NONE )
4687 -- Validate service request contacts
4688 -- This procedure should always be called before get_default_contract
4689 -- because it needs primary contact info
4690 IF l_sr_related_data.old_disallow_request_update <> 'Y'
4691 THEN
4692 CS_SRCONTACT_PKG.process
4693 ( p_mode => 'UPDATE'
4694 , p_incident_id => p_request_id
4695 , p_caller_type => l_service_request_rec.caller_type
4696 , p_customer_id => l_service_request_rec.customer_id
4697 , p_validation_mode => p_validation_level
4698 , p_contact_tbl => p_contacts
4699 , x_contact_tbl => l_processed_contacts
4700 , x_old_contact_tbl => l_old_contacts
4701 , x_primary_party_id => l_sr_related_data.primary_party_id
4702 , x_primary_contact_point_id => l_sr_related_data.primary_contact_point_id
4703 , x_return_status => l_return_status
4704 );
4705 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
4706 THEN
4707 RAISE FND_API.G_EXC_ERROR;
4708 END IF;
4709 END IF; -- request update is allowed
4710 -- End of SR contact validation
4711 -- Logic to populate default contract based on default contract SLA indicator
4712 IF (l_contract_service_id_valid <> 'Y')
4713 THEN
4714 IF (p_default_contract_sla_ind <> 'Y' OR
4715 (p_service_request_rec.contract_service_id IS NOT NULL AND
4716 p_service_request_rec.contract_service_id <> FND_API.G_MISS_NUM)
4717 )
4718 THEN
4719 FND_MESSAGE.set_name ('CS', 'CS_SR_CONTRACT_INVALID');
4720 FND_MESSAGE.set_token('API_NAME', 'CS_SERVICEREQUEST_UTIL.contracts_cross_val' );
4721 FND_MSG_PUB.add;
4722 RAISE FND_API.G_EXC_ERROR;
4723 END IF;
4724 END IF;
4725
4726 /***************************************************************
4727 This is a tempopary solution for Depot Repair team to get the site_use_id
4728 if the site_id is passed from the SR form and the validation level is none
4729 **********************************************/
4730 IF ( p_validation_level = FND_API.G_VALID_LEVEL_NONE ) THEN
4731 IF ( nvl(p_service_request_rec.bill_to_site_id,-99) <> nvl(l_old_ServiceRequest_rec.bill_to_site_id,-99))
4732 AND p_service_request_rec.bill_to_site_id <> FND_API.G_MISS_NUM THEN
4733
4734 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
4735 ( p_api_name => 'Get bill to site use id',
4736 p_parameter_name => 'Bill_To Site ',
4737 p_bill_to_site_id => p_service_request_rec.bill_to_site_id,
4738 p_bill_to_party_id => p_service_request_rec.bill_to_party_id,
4739 p_site_use_type => 'BILL_TO',
4740 x_site_use_id => l_service_request_rec.bill_to_site_use_id,
4741 x_return_status => l_return_status
4742 );
4743 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4744 RAISE FND_API.G_EXC_ERROR;
4745 END IF;
4746
4747 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
4748 THEN
4749 FND_LOG.String
4750 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4751 , 'The defaulted value of parameter bill_to_site_use_id :'
4752 || l_service_request_rec.bill_to_site_use_id
4753 );
4754 END IF;
4755 ELSIF (p_service_request_rec.bill_to_site_id = FND_API.G_MISS_NUM) OR
4756 (NVL(p_service_request_rec.bill_to_site_id, -99) = NVL(l_old_ServiceRequest_rec.bill_to_site_id, -99)) THEN
4757 l_service_request_rec.bill_to_site_use_id := l_old_ServiceRequest_rec.bill_to_site_use_id;
4758 l_service_request_rec.bill_to_site_id := l_old_ServiceRequest_rec.bill_to_site_id;
4759 ELSIF (p_service_request_rec.bill_to_site_id IS NULL ) THEN
4760 l_service_request_rec.bill_to_site_use_id :=NULL;
4761 END IF;
4762
4763 IF ( nvl(p_service_request_rec.ship_to_site_id,-99) <> nvl(l_old_ServiceRequest_rec.ship_to_site_id,-99))
4764 AND p_service_request_rec.ship_to_site_id <> FND_API.G_MISS_NUM THEN
4765
4766 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
4767 ( p_api_name => 'Get ship to site use id',
4768 p_parameter_name => 'Ship_To Site ',
4769 p_bill_to_site_id => p_service_request_rec.ship_to_site_id,
4770 p_bill_to_party_id => p_service_request_rec.ship_to_party_id,
4771 p_site_use_type => 'SHIP_TO',
4772 x_site_use_id => l_service_request_rec.ship_to_site_use_id,
4773 x_return_status => l_return_status
4774 );
4775 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4776 RAISE FND_API.G_EXC_ERROR;
4777 END IF;
4778
4779 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
4780 THEN
4781 FND_LOG.String
4782 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
4783 , 'The defaulted value of parameter ship_to_site_use_id :'
4784 || l_service_request_rec.ship_to_site_use_id
4785 );
4786 END IF;
4787 ELSIF (p_service_request_rec.ship_to_site_id = FND_API.G_MISS_NUM) OR
4788 (NVL(p_service_request_rec.ship_to_site_id, -99) = NVL(l_old_ServiceRequest_rec.ship_to_site_id, -99)) THEN
4789 l_service_request_rec.ship_to_site_use_id := l_old_ServiceRequest_rec.ship_to_site_use_id;
4790 l_service_request_rec.ship_to_site_id := l_old_ServiceRequest_rec.ship_to_site_id;
4791 ELSIF (p_service_request_rec.ship_to_site_id IS NULL ) THEN
4792 l_service_request_rec.ship_to_site_use_id :=NULL;
4793 END IF;
4794
4795 IF (nvl(p_service_request_rec.install_site_id,-99)<> nvl(l_old_ServiceRequest_rec.install_site_id,-99))
4796 AND p_service_request_rec.install_site_id <> FND_API.G_MISS_NUM THEN
4797 l_service_request_rec.install_site_use_id:=
4798 p_service_request_rec.install_site_id;
4799 ELSIF (p_service_request_rec.install_site_id = FND_API.G_MISS_NUM) OR
4800 (NVL(p_service_request_rec.install_site_id, -99) = NVL(l_old_ServiceRequest_rec.install_site_id, -99)) THEN
4801 l_service_request_rec.install_site_use_id := l_old_ServiceRequest_rec.install_site_use_id;
4802 l_service_request_rec.install_site_id := l_old_ServiceRequest_rec.install_site_id;
4803 ELSIF (p_service_request_rec.install_site_id IS NULL ) THEN
4804 l_service_request_rec.install_site_use_id :=NULL;
4805 END IF;
4806 END IF;
4807
4808 /********************************************************************
4809 Changes for depot reapi finished, need to remove all this for 115.10
4810 ***********************************************************************/
4811
4812
4813 --------UWQ for 11.5.6 Enhancement --------
4814 -- at this point during update p_Service_request_rec may have g_miss_num for
4815 -- severity_id but l_service_request_rec will have valid value for severity_id
4816 -- as this would have been populated by update_sr_validation procedure
4817 -- so i am using l_service_request_rec instead of p_service_request_rec
4818 l_imp_level := Get_Importance_Level(l_service_request_rec.severity_id);
4819 l_imp_level_old := Get_Old_Importance_level(p_request_id);
4820 l_old_owner_id := Get_Owner_id(p_request_id);
4821
4822 --select the l_title from jtf_objects_vl
4823 l_title := Get_Title('SR');
4824
4825 IF (l_service_request_rec.last_update_channel in ('PHONE', 'AGENT') AND
4826 (l_imp_level_old <> 1 OR l_imp_level_old = 1) AND
4827 l_imp_level=1 AND
4828 l_service_request_rec.owner_id IS NOT NULL AND
4829 l_service_request_rec.owner_id <> l_old_owner_id AND
4830 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM) THEN
4831 l_uwq_body2 := Get_Message(p_uwq_msg_notification);
4832 l_send_uwq_notification := TRUE;
4833 ELSIF (l_service_request_rec.last_update_channel in ('PHONE', 'AGENT') AND
4834 l_imp_level_old <>1 AND
4835 l_imp_level=1 AND
4836 l_service_request_rec.owner_id IS NOT NULL AND
4837 l_service_request_rec.owner_id = l_old_owner_id AND
4838 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM)
4839 OR (l_service_request_rec.last_update_channel = 'WEB' AND
4840 (l_imp_level =1 OR l_imp_level =2) AND
4841 l_service_request_rec.owner_id IS NOT NULL AND
4842 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM)
4843 THEN
4844 l_uwq_body2 := Get_Message(p_uwq_upd_notification);
4845 l_send_uwq_notification := TRUE;
4846 END IF;
4847
4848 l_uwq_body := l_title ||' '|| l_old_ServiceRequest_rec.incident_number ||'
4849 '|| l_uwq_body2 ||' '||to_char(SYSDATE,'MM/DD/YYYY HH24:MI:SS'); --with time;
4850
4851 IF l_send_uwq_notification THEN
4852 IEU_MSG_PRODUCER_PUB.Send_Plain_text_Msg (
4853 p_api_version => 1.0,
4854 p_init_msg_list => fnd_api.g_false,
4855 p_commit => fnd_api.g_false,
4856 p_application_id => 170,
4857 p_resource_id => l_service_request_rec.owner_id,
4858 p_resource_type => l_service_request_rec.resource_type,
4859 p_title => l_title,
4860 p_body => l_uwq_body,
4861 p_workitem_obj_code=> 'SR',
4862 p_workitem_pk_id => p_request_id,
4863 x_message_id => l_msg_id,
4864 x_return_status => l_return_status,
4865 x_msg_count => l_msg_count,
4866 x_msg_data => l_msg_data );
4867 END IF;
4868
4869 /* Added call to get_status_flag for enh 2655115, to get the status flag
4870 based on the closed flag by shijain date 27th nov 2002 */
4871
4872 -- for the bug 3050727
4873 -- l_status_flag:= get_status_flag ( l_service_request_rec.status_id);
4874
4875
4876 --*************************************************
4877 --Adding this code,(12th July 2000) so that workflow can call Update Service Request
4878 --instead of calling this Create Audit api.
4879
4880 --Get the workflow process name associted to the service request type
4881 --IF called by workflow then do this :
4882
4883 /****************************************
4884 commenting out code; this is no longer needed as the WF will directly do
4885 an update on the SR's workflow_process_id and not call the SR Update API.
4886
4887 IF (FND_API.To_Boolean(p_called_by_workflow) = TRUE) THEN
4888 SELECT workflow INTO l_workflow_process_name
4889 FROM cs_incident_types_b
4890 WHERE incident_type_id = l_service_request_rec.type_id
4891 AND incident_subtype = G_SR_SUBTYPE
4892 AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(start_date_active, SYSDATE))
4893 AND TRUNC(NVL(end_date_active, SYSDATE));
4894 ---Build the workflow process item key.
4895 l_wf_process_itemkey := l_old_ServiceRequest_rec.incident_number || '-' || TO_CHAR(p_workflow_process_id) ;
4896
4897 -- Changed for audit l_change_flags_rec.new_workflow := FND_API.G_TRUE; --- check for audit
4898 l_audit_vals_rec.new_workflow_flag := 'Y'; --- check for audit
4899
4900 --Call Upadte SR without incrementing the object version number(only for lauch workflow)
4901 --Put this code because from the form side, if record was queried
4902 --with object version as 2 and then Launch workflow was called with
4903 --Update Sr then, if object version is incremented to 3 , then
4904 --cannot update any other attributes displayed on the Sr form, since
4905 --SR form had already locked the record with object version as 2.
4906
4907 UPDATE cs_incidents_all_b
4908 SET workflow_process_id = p_workflow_process_id
4909 WHERE ROWID = l_old_ServiceRequest_rec.ROW_ID ;
4910
4911 ELSE
4912 commenting out code; this is no longer needed as the WF will directly do
4913 an update on the SR's workflow_process_id and not call the SR Update API.
4914 ***********************************************/
4915
4916 -- Code Changes for 11.5.10 Auto Close SR project
4917 -- For bug 3332985
4918 IF l_sr_related_data.old_close_flag = 'N' AND
4919 l_sr_related_data.close_flag = 'Y'
4920 THEN
4921 -- it means an open service request is being close, so check if SR can be closed
4922 -- and then close all SR child entities
4923 --
4924 -- This validation happens irrespective of ERES flag
4925 IF ( p_validate_sr_closure = 'Y' OR p_validate_sr_closure = 'y') THEN
4926 CS_SR_STATUS_PROPAGATION_PKG.VALIDATE_SR_CLOSURE(
4927 p_api_version => p_api_version,
4928 p_init_msg_list => fnd_api.g_false ,
4929 p_commit => FND_API.G_FALSE,
4930 p_service_request_id => p_request_id,
4931 p_user_id => l_service_request_rec.last_updated_by,
4932 p_resp_appl_id => p_resp_appl_id,
4933 p_login_id => l_service_request_rec.last_update_login,
4934 x_return_status => l_return_status,
4935 x_msg_count => l_msg_count ,
4936 x_msg_data => l_msg_data);
4937
4938 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4939 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4940 END IF;
4941 END IF;
4942 IF l_start_eres_flag = 'N'
4943 THEN
4944 -- Child entities will be close only for Non ERES flow.
4945 -- For ERES flow child entities may get closed if ERES returns NO_ACTION
4946 -- or in separate transaction when ERES approval comes in.
4947 IF (p_auto_close_child_entities='Y' OR p_auto_close_child_entities='y') THEN
4948 CS_SR_STATUS_PROPAGATION_PKG.CLOSE_SR_CHILDREN
4949 ( p_api_version => p_api_version
4950 , p_init_msg_list => fnd_api.g_false
4951 , p_commit => FND_API.G_FALSE
4952 , p_validation_required => 'N'
4953 , p_action_required => 'Y'
4954 , p_service_request_id => p_request_id
4955 , p_user_id => l_service_request_rec.last_updated_by
4956 , p_resp_appl_id => p_resp_appl_id
4957 , p_login_id => l_service_request_rec.last_update_login
4958 , x_return_status => l_return_status
4959 , x_msg_count => l_msg_count
4960 , x_msg_data => l_msg_data
4961 );
4962 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
4963 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4964 END IF;
4965 END IF;
4966 END IF; -- l_start_eres_flag = 'N' condition
4967 END IF; -- if old_close_flag ='N' and close_flag = 'Y' condition
4968 -- This is to be executed only for ERES update. For non eres updates
4969 -- this procedure is called from servicerequest_cross_val procedure.
4970 IF l_start_eres_flag = 'Y'
4971 THEN
4972 CS_SERVICEREQUEST_UTIL.task_restrict_close_cross_val
4973 ( p_incident_id => p_request_id
4974 , p_status_id => l_sr_related_data.target_status_id
4975 , x_return_status => l_return_status
4976 );
4977 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
4978 THEN
4979 RAISE FND_API.G_EXC_ERROR;
4980 END IF;
4981 END IF;
4982 -- End of Code Changes for 11.5.10 Auto Close SR project
4983
4984 -- Replace old code with get_reacted_resolved_dates
4985 -- if eres is being processed i.e. l_start_eres_flag = 'Y' then that intermediate status
4986 -- cannot have resolved, responded flags as 'Y'. so no need to attempt to default
4987 -- resolved and responded by dates.
4988 IF l_start_eres_flag = 'N'
4989 THEN
4990 CS_SERVICEREQUEST_UTIL.get_reacted_resolved_dates
4991 ( p_incident_status_id => l_service_request_rec.status_id
4992 , p_old_incident_status_id => l_old_servicerequest_rec.incident_status_id
4993 , p_old_incident_resolved_date => l_old_servicerequest_rec.incident_resolved_date
4994 , p_old_inc_responded_by_date => l_old_servicerequest_rec.inc_responded_by_date
4995 , x_inc_responded_by_date => l_service_request_rec.inc_responded_by_date
4996 , x_incident_resolved_date => l_service_request_rec.incident_resolved_date
4997 , x_return_status => l_return_status
4998 );
4999 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
5000 THEN
5001 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5002 END IF;
5003 END IF; -- l_start_eres_flag = 'N'
5004
5005 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
5006 THEN
5007 FND_LOG.String
5008 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5009 , 'The defaulted value of parameter inc_responded_by_date :'
5010 || l_service_request_rec.inc_responded_by_date
5011 );
5012 FND_LOG.String
5013 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5014 , 'The defaulted value of parameter incident_resolved_date :'
5015 || l_service_request_rec.incident_resolved_date
5016 );
5017 END IF;
5018
5019 -- End of usability changes .
5020
5021
5022 -- Code Changes for setting unassigned_indicator
5023 /* l_service_request should be used not the p_service_request. if values are not changed
5024 then p_service rec will have g_miss_num only and it will cause wrong value for unassigned ind
5025 l_service rec will have the values going to database. so it is the correct rec to be used
5026 smisra 11/30/2004
5027 ********************************************************************************************/
5028 IF (l_service_request_rec.owner_id <> FND_API.G_MISS_NUM AND
5029 l_service_request_rec.owner_id IS NOT NULL ) AND
5030 (l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM AND
5031 l_service_request_rec.owner_group_id IS NOT NULL ) THEN
5032 l_unassigned_indicator := 3 ;
5033 ELSIF (l_service_request_rec.owner_id <> FND_API.G_MISS_NUM AND
5034 l_service_request_rec.owner_id IS NOT NULL ) AND
5035 (l_service_request_rec.owner_group_id = FND_API.G_MISS_NUM OR
5036 l_service_request_rec.owner_group_id IS NULL ) THEN
5037 l_unassigned_indicator := 1 ;
5038 ELSIF (l_service_request_rec.owner_id = FND_API.G_MISS_NUM OR
5039 l_service_request_rec.owner_id IS NULL ) AND
5040 (l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM AND
5041 l_service_request_rec.owner_group_id IS NOT NULL ) THEN
5042 l_unassigned_indicator := 2 ;
5043 ELSE
5044 l_unassigned_indicator := 0 ;
5045 END IF;
5046
5047 -- Fix to bug # 2520816.
5048 -- Setting the value for l_contra_id and l_contract_number to the existing values
5049 -- in the db, if they have not been passed to the update API, or have not been
5050 -- assigned values thru the 'validate_contract_id' and 'validate_contract_service_id'
5051 -- procedures.
5052 -- Start of changes by aneemuch, 16-Oct-2003
5053 -- To fix bug 3137011, Update_servicerequest api causes contracts column to null values
5054
5055 --if ( l_contra_id = FND_API.G_MISS_NUM ) THEN
5056 -- l_contra_id := l_old_servicerequest_rec.contract_id;
5057 --end if;
5058 --if ( l_contract_number = FND_API.G_MISS_CHAR ) THEN
5059 -- l_contract_number := l_old_servicerequest_rec.contract_number;
5060 --end if;
5061
5062 -- contracts : 3224828 - remove the call to validate_contract_Service_id
5063 -- These five lines are change due to default contract SLA in update
5064 --IF (( l_contra_id = FND_API.G_MISS_NUM ) OR (l_contra_id IS NULL)) THEN
5065 -- IF p_service_request_rec.contract_service_id = FND_API.G_MISS_NUM THEN
5066 -- l_contra_id := l_old_servicerequest_rec.contract_id;
5067 -- l_contract_number := l_old_servicerequest_rec.contract_number;
5068 -- ELSIF p_service_request_rec.contract_service_id is null THEN
5069
5070 IF (( l_contra_id = FND_API.G_MISS_NUM ) OR (l_contra_id IS NULL)) THEN
5071 IF l_service_request_rec.contract_service_id = l_old_servicerequest_rec.contract_service_id THEN
5072 l_contra_id := l_old_servicerequest_rec.contract_id;
5073 l_contract_number := l_old_servicerequest_rec.contract_number;
5074 ELSIF l_service_request_rec.contract_service_id is null THEN
5075 l_contra_id := null;
5076 l_contract_number := NULL;
5077 /* ELSE
5078 CS_ServiceRequest_UTIL.Validate_Contract_Service_Id(
5079 p_api_name => l_api_name,
5080 p_parameter_name => 'contract_service_id',
5081 p_contract_service_id => p_service_request_rec.contract_service_id,
5082 x_contract_id =>l_contra_id,
5083 x_contract_number =>l_contract_number,
5084 x_return_status => l_return_status);
5085
5086 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5087 x_return_status := FND_API.G_RET_STS_ERROR;
5088 RETURN;
5089 END IF; */
5090 END IF ;
5091 END IF;
5092 -- update contract attributes in audit
5093 l_audit_vals_rec.old_contract_number := l_old_ServiceRequest_rec.contract_number;
5094 l_audit_vals_rec.old_contract_id := l_old_ServiceRequest_rec.contract_id;
5095 l_audit_vals_rec.old_contract_service_id := l_old_ServiceRequest_rec.contract_service_id;
5096 l_audit_vals_rec.old_coverage_type := l_old_ServiceRequest_rec.coverage_type;
5097 -- New contract Values
5098 l_audit_vals_rec.contract_number := l_contract_number;
5099 l_audit_vals_rec.contract_id := l_contra_id;
5100 l_audit_vals_rec.contract_service_id := l_service_request_rec.contract_service_id;
5101 l_audit_vals_rec.coverage_type := l_service_request_rec.coverage_type;
5102 l_audit_vals_rec.maint_organization_id := l_service_request_rec.maint_organization_id;
5103 l_audit_vals_rec.old_maint_organization_id := l_old_servicerequest_rec.maint_organization_id;
5104 l_audit_vals_rec.inventory_item_id := l_service_request_rec.inventory_item_id;
5105 l_audit_vals_rec.old_inventory_item_id := l_old_servicerequest_rec.inventory_item_id;
5106
5107
5108 -- Assign owner, group to output record
5109 x_sr_update_out_rec.individual_owner := l_service_request_rec.owner_id;
5110 x_sr_update_out_rec.group_owner := l_service_request_rec.owner_group_id;
5111 x_sr_update_out_rec.individual_type := l_service_request_rec.resource_type;
5112
5113 -- end of changes by aneemuch, 16-Oct-2003
5114 -- Assign owner, group to output record
5115 x_sr_update_out_rec.individual_owner := l_service_request_rec.owner_id;
5116 x_sr_update_out_rec.group_owner := l_service_request_rec.owner_group_id;
5117 x_sr_update_out_rec.individual_type := l_service_request_rec.resource_type;
5118
5119 -- Start of change , Sanjana Rao , bug 6955756
5120 IF (l_service_request_rec.owner_id = FND_API.G_MISS_NUM) OR
5121 NVL(l_service_request_rec.owner_id,-99) = NVL(l_old_ServiceRequest_rec.incident_owner_id,-99)
5122 THEN
5123 IF (l_service_request_rec.owner_assigned_time = FND_API.G_MISS_DATE) OR
5124 (l_service_request_rec.owner_assigned_time IS NULL AND
5125 l_old_ServiceRequest_rec.owner_assigned_time IS NULL) OR
5126 (l_service_request_rec.owner_assigned_time = l_old_ServiceRequest_rec.owner_assigned_time)
5127 THEN
5128 l_service_request_rec.owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
5129
5130 END IF;
5131 ELSE
5132 IF (l_service_request_rec.owner_assigned_time = FND_API.G_MISS_DATE) OR
5133 (l_service_request_rec.owner_assigned_time IS NULL AND
5134 l_old_ServiceRequest_rec.owner_assigned_time IS NULL) OR
5135 (l_service_request_rec.owner_assigned_time = l_old_ServiceRequest_rec.owner_assigned_time)
5136 THEN
5137
5138 l_service_request_rec.owner_assigned_time := SYSDATE;
5139 END IF;
5140 END IF;
5141
5142 --End of change , Sanjana Rao, bug 6955756
5143
5144 ---Update for all cases.
5145 UPDATE cs_incidents_all_b
5146 SET incident_status_id = l_service_request_rec.status_id,
5147 incident_type_id = l_service_request_rec.type_id,
5148 incident_urgency_id = l_service_request_rec.urgency_id,
5149 incident_severity_id = l_service_request_rec.severity_id,
5150 incident_owner_id = l_service_request_rec.owner_id,
5151 resource_type = l_service_request_rec.resource_type,
5152 -- resource_subtype_id = l_service_request_rec.resource_subtype_id, For BUG 2748584
5153 inventory_item_id = l_service_request_rec.inventory_item_id,
5154 -- removed decode for 11.5.6 enhancement
5155 customer_id = l_service_request_rec.customer_id,
5156 account_id = l_service_request_rec.account_id,
5157 current_serial_number = l_service_request_rec.current_serial_number,
5158 expected_resolution_date = l_service_request_rec.exp_resolution_date,
5159 actual_resolution_date = l_service_request_rec.act_resolution_date,
5160 customer_product_id = l_service_request_rec.customer_product_id,
5161 bill_to_site_use_id = l_service_request_rec.bill_to_site_use_id,
5162 bill_to_contact_id = l_service_request_rec.bill_to_contact_id,
5163 ship_to_site_use_id = l_service_request_rec.ship_to_site_use_id,
5164 ship_to_contact_id = l_service_request_rec.ship_to_contact_id,
5165 install_site_use_id = l_service_request_rec.install_site_use_id,
5166 incident_attribute_1 = l_service_request_rec.request_attribute_1,
5167 incident_attribute_2 = l_service_request_rec.request_attribute_2,
5168 incident_attribute_3 = l_service_request_rec.request_attribute_3,
5169 incident_attribute_4 = l_service_request_rec.request_attribute_4,
5170 incident_attribute_5 = l_service_request_rec.request_attribute_5,
5171 incident_attribute_6 = l_service_request_rec.request_attribute_6,
5172 incident_attribute_7 = l_service_request_rec.request_attribute_7,
5173 incident_attribute_8 = l_service_request_rec.request_attribute_8,
5174 incident_attribute_9 = l_service_request_rec.request_attribute_9,
5175 incident_attribute_10 = l_service_request_rec.request_attribute_10,
5176 incident_attribute_11 = l_service_request_rec.request_attribute_11,
5177 incident_attribute_12 = l_service_request_rec.request_attribute_12,
5178 incident_attribute_13 = l_service_request_rec.request_attribute_13,
5179 incident_attribute_14 = l_service_request_rec.request_attribute_14,
5180 incident_attribute_15 = l_service_request_rec.request_attribute_15,
5181 incident_context = l_service_request_rec.request_context,
5182 external_attribute_1 = l_service_request_rec.external_attribute_1,
5183 external_attribute_2 = l_service_request_rec.external_attribute_2,
5184 external_attribute_3 = l_service_request_rec.external_attribute_3,
5185 external_attribute_4 = l_service_request_rec.external_attribute_4,
5186 external_attribute_5 = l_service_request_rec.external_attribute_5,
5187 external_attribute_6 = l_service_request_rec.external_attribute_6,
5188 external_attribute_7 = l_service_request_rec.external_attribute_7,
5189 external_attribute_8 = l_service_request_rec.external_attribute_8,
5190 external_attribute_9 = l_service_request_rec.external_attribute_9,
5191 external_attribute_10 = l_service_request_rec.external_attribute_10,
5192 external_attribute_11 = l_service_request_rec.external_attribute_11,
5193 external_attribute_12 = l_service_request_rec.external_attribute_12,
5194 external_attribute_13 = l_service_request_rec.external_attribute_13,
5195 external_attribute_14 = l_service_request_rec.external_attribute_14,
5196 external_attribute_15 = l_service_request_rec.external_attribute_15,
5197 external_context = l_service_request_rec.external_context,
5198 resolution_code = l_service_request_rec.resolution_code,
5199 problem_code = l_service_request_rec.problem_code,
5200 original_order_number = l_service_request_rec.original_order_number,
5201 purchase_order_num = l_service_request_rec.purchase_order_num,
5202 close_date = l_service_request_rec.closed_date,
5203 publish_flag = l_service_request_rec.publish_flag,
5204 obligation_date = l_service_request_rec.obligation_date,
5205 qa_collection_id = l_service_request_rec.qa_collection_plan_id,
5206 contract_service_id = l_service_request_rec.contract_service_id,
5207 contract_id = l_contra_id,
5208 contract_number = l_contract_number,
5209 project_number = l_service_request_rec.project_number,
5210 customer_po_number = l_service_request_rec.cust_po_number,
5211 customer_ticket_number = l_service_request_rec.cust_ticket_number,
5212 time_zone_id = l_service_request_rec.time_zone_id,
5213 time_difference = l_service_request_rec.time_difference,
5214 platform_id = l_service_request_rec.platform_id ,
5215 platform_version = l_service_request_rec.platform_version,
5216 platform_version_id = l_service_request_rec.platform_version_id,
5217 db_version = l_service_request_rec.db_version,
5218 cp_component_id = l_service_request_rec.cp_component_id,
5219 cp_component_version_id = l_service_request_rec.cp_component_version_id,
5220 cp_subcomponent_id = l_service_request_rec.cp_subcomponent_id,
5221 cp_subcomponent_version_id = l_service_request_rec.cp_subcomponent_version_id ,
5222 cp_revision_id = l_service_request_rec.cp_revision_id ,
5223 inv_item_revision = l_service_request_rec.inv_item_revision ,
5224 inv_component_id = l_service_request_rec.inv_component_id ,
5225 inv_component_version = l_service_request_rec.inv_component_version,
5226 inv_subcomponent_id = l_service_request_rec.inv_subcomponent_id ,
5227 inv_subcomponent_version = l_service_request_rec.inv_subcomponent_version,
5228 site_id = l_service_request_rec.site_id,
5229 customer_site_id = l_service_request_rec.customer_site_id,
5230 territory_id = l_service_request_rec.territory_id,
5231 -- Added for enhancements---11.5.6------jngeorge-----
5232 cust_pref_lang_id = l_service_request_rec.cust_pref_lang_id,
5233 comm_pref_code = l_service_request_rec.comm_pref_code,
5234 cust_pref_lang_code = l_service_request_rec.cust_pref_lang_code,
5235 last_update_channel = l_service_request_rec.last_update_channel,
5236 tier = l_service_request_rec.tier,
5237 tier_version = l_service_request_rec.tier_version,
5238 operating_system = l_service_request_rec.operating_system,
5239 operating_system_version = l_service_request_rec.operating_system_version,
5240 DATABASE = l_service_request_rec.DATABASE,
5241 category_id = l_service_request_rec.category_id,
5242 group_type = l_service_request_rec.group_type,
5243 owner_group_id = l_service_request_rec.owner_group_id,
5244 group_territory_id = l_service_request_rec.group_territory_id,
5245 owner_assigned_time = l_service_request_rec.owner_assigned_time,
5246 owner_assigned_flag = l_service_request_rec.owner_assigned_flag,
5247 unassigned_indicator = l_unassigned_indicator,
5248 inv_platform_org_id = l_service_request_rec.inv_platform_org_id,
5249 product_revision = l_service_request_rec.product_revision,
5250 component_version = l_service_request_rec.component_version,
5251 subcomponent_version = l_service_request_rec.subcomponent_version,
5252 category_set_id = l_service_request_rec.category_set_id,
5253 external_reference = l_service_request_rec.external_reference,
5254 system_id = l_service_request_rec.system_id,
5255 error_code = l_service_request_rec.error_code,
5256 incident_occurred_date = l_service_request_rec.incident_occurred_date,
5257 incident_resolved_date = l_service_request_rec.incident_resolved_date,
5258 inc_responded_by_date = l_service_request_rec.inc_responded_by_date,
5259 incident_location_id = l_service_request_rec.incident_location_id ,
5260 incident_address = l_service_request_rec.incident_address ,
5261 incident_city = l_service_request_rec.incident_city,
5262 incident_state = l_service_request_rec.incident_state,
5263 incident_country = l_service_request_rec.incident_country,
5264 incident_province = l_service_request_rec.incident_province ,
5265 incident_postal_code = l_service_request_rec.incident_postal_code ,
5266 incident_county = l_service_request_rec.incident_county,
5267 sr_creation_channel = l_service_request_rec.sr_creation_channel,
5268 -- Added for ER# 2320056
5269 coverage_type = l_service_request_rec.coverage_type,
5270 -- Added for ER#2433831
5271 bill_to_account_id = l_service_request_rec.bill_to_account_id,
5272 ship_to_account_id = l_service_request_rec.ship_to_account_id,
5273 -- Added for ER#2463321
5274 customer_phone_id = l_service_request_rec.customer_phone_id,
5275 customer_email_id = l_service_request_rec.customer_email_id,
5276 -- Added for source cahnges for 1159 shijain oct 11 2002
5277 last_update_program_code = l_service_request_rec.last_update_program_code,
5278 last_updated_by = l_service_request_rec.last_updated_by,
5279 last_update_login = l_service_request_rec.last_update_login,
5280 last_update_date = l_service_request_rec.last_update_date,
5281 bill_to_party_id = l_service_request_rec.bill_to_party_id,
5282 ship_to_party_id = l_service_request_rec.ship_to_party_id,
5283 -- Conc request related fields
5284 program_id = l_service_request_rec.program_id,
5285 program_application_id = l_service_request_rec.program_application_id,
5286 request_id = l_service_request_rec.conc_request_id,
5287 program_login_id = l_service_request_rec.program_login_id,
5288 -- Bill_to_site, ship_to_site
5289 bill_to_site_id = l_service_request_rec.bill_to_site_id,
5290 ship_to_site_id = l_service_request_rec.ship_to_site_id,
5291 -- Added for enh. 2655115
5292 -- for bug 3050727
5293 status_flag = l_service_request_rec.status_flag,
5294 object_version_number = p_object_version_number+1,
5295 -- Added these address columns by shijain 2002 5th dec
5296 incident_point_of_interest=l_service_request_rec.incident_point_of_interest,
5297 incident_cross_street=l_service_request_rec.incident_cross_street,
5298 incident_direction_qualifier=l_service_request_rec.incident_direction_qualifier,
5299 incident_distance_qualifier=l_service_request_rec.incident_distance_qualifier,
5300 incident_distance_qual_uom =l_service_request_rec.incident_distance_qual_uom,
5301 incident_address2 =l_service_request_rec.incident_address2 ,
5302 incident_address3=l_service_request_rec.incident_address3 ,
5303 incident_address4=l_service_request_rec.incident_address4 ,
5304 incident_address_style=l_service_request_rec.incident_address_style ,
5305 incident_addr_lines_phonetic =l_service_request_rec.incident_addr_lines_phonetic ,
5306 incident_po_box_number =l_service_request_rec.incident_po_box_number ,
5307 incident_house_number =l_service_request_rec.incident_house_number,
5308 incident_street_suffix =l_service_request_rec.incident_street_suffix,
5309 incident_street =l_service_request_rec.incident_street,
5310 incident_street_number =l_service_request_rec.incident_street_number,
5311 incident_floor=l_service_request_rec.incident_floor,
5312 incident_suite =l_service_request_rec.incident_suite ,
5313 incident_postal_plus4_code =l_service_request_rec.incident_postal_plus4_code,
5314 incident_position =l_service_request_rec.incident_position ,
5315 incident_location_directions=l_service_request_rec.incident_location_directions,
5316 incident_location_description =l_service_request_rec.incident_location_description ,
5317 install_site_id =l_service_request_rec.install_site_id ,
5318 inv_organization_id= l_service_request_rec.inventory_org_id,
5319 -- for cmro_eam
5320 owning_department_id = l_service_request_rec.owning_dept_id,
5321 --end for cmro_eam
5322 -- Added for Misc ERs project of 11.5.10 --anmukher --08/26/03
5323 incident_location_type = l_service_request_rec.incident_location_type,
5324 --Added for Auditing project of 11.5.10 --anmukher --09/05/03
5325 incident_last_modified_date = sysdate,
5326 maint_organization_id = l_service_request_rec.maint_organization_id
5327 WHERE ROWID = l_old_ServiceRequest_rec.ROW_ID ;
5328 --for performance reason
5329
5330 -- END IF;
5331
5332 -- Start of changes by aneemuch 28-Oct-2004
5333 -- Changes for interMedia index, need to update text_index column only when incident_type_id,
5334 -- inventory_item_id, or summary column has changed. This is required in order to rebuild index for that
5335 -- particular record when interMedia sync conc program is run.
5336
5337 IF l_service_request_rec.type_id <> l_old_servicerequest_rec.incident_type_id
5338 OR NVL(l_service_request_rec.inventory_item_id,-99) <> NVL(l_old_servicerequest_rec.inventory_item_id,-99)
5339 OR l_service_request_rec.summary <> l_old_servicerequest_rec.summary THEN
5340
5341 UPDATE cs_incidents_all_tl
5342 SET summary = l_service_request_rec.summary,
5343 resolution_summary = l_service_request_rec.resolution_summary,
5344 last_update_date = l_service_request_rec.last_update_date,
5345 last_updated_by = l_service_request_rec.last_updated_by,
5346 last_update_login = l_service_request_rec.last_update_login,
5347 source_lang = userenv('LANG'), --l_service_request_rec.LANGUAGE,
5348 text_index = 'A'
5349 WHERE incident_id = p_request_id
5350 AND userenv('LANG') IN (LANGUAGE, source_lang);
5351
5352 ELSE
5353
5354 UPDATE cs_incidents_all_tl
5355 SET summary = l_service_request_rec.summary,
5356 resolution_summary = l_service_request_rec.resolution_summary,
5357 last_update_date = l_service_request_rec.last_update_date,
5358 last_updated_by = l_service_request_rec.last_updated_by,
5359 last_update_login = l_service_request_rec.last_update_login,
5360 source_lang = userenv('LANG') --l_service_request_rec.LANGUAGE
5361 WHERE incident_id = p_request_id
5362 AND userenv('LANG') IN (LANGUAGE, source_lang);
5363 END IF;
5364
5365 -- For bug 3512696 - modified to point the source lang to be updated with userenv('LANG');
5366
5367 -- UPDATE cs_incidents_all_tl
5368 -- SET summary = l_service_request_rec.summary,
5369 -- resolution_summary = l_service_request_rec.resolution_summary,
5370 -- owner = l_service_request_rec.owner,
5371 -- group_owner = l_service_request_rec.group_owner,
5372 -- last_update_date = l_service_request_rec.last_update_date,
5373 -- last_updated_by = l_service_request_rec.last_updated_by,
5374 -- last_update_login = l_service_request_rec.last_update_login,
5375 -- source_lang = userenv('LANG') --l_service_request_rec.LANGUAGE
5376 -- WHERE incident_id = p_request_id
5377 -- AND userenv('LANG') IN (LANGUAGE, source_lang);
5378
5379 -- End of changes by aneemuch 28-Oct-2004
5380 -- Changes for interMedia index
5381
5382
5383 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5384 RAISE FND_API.G_EXC_ERROR;
5385 END IF;
5386
5387 -- Added for 11.5.10 Auditing project --anmukher --09/15/03
5388 -- Added these assignments here as these values are not available in Update_SR_Validation
5389
5390 /* These are not correct. if old value is null then else condition will get executed and
5391 wrong value will go to new value col in audit rec
5392 These are already set before update to cs_incidents_all_b table
5393 smisra: 29th nov 2004
5394 l_audit_vals_rec.OLD_CONTRACT_ID := l_old_ServiceRequest_rec.CONTRACT_ID;
5395 IF (l_contra_id <> FND_API.G_MISS_NUM) AND
5396 (l_contra_id <> l_old_ServiceRequest_rec.CONTRACT_ID) THEN
5397 l_audit_vals_rec.CONTRACT_ID := l_contra_id;
5398 ELSE
5399 l_audit_vals_rec.CONTRACT_ID := l_old_ServiceRequest_rec.CONTRACT_ID;
5400 END IF;
5401
5402 l_audit_vals_rec.OLD_CONTRACT_NUMBER := l_old_ServiceRequest_rec.CONTRACT_NUMBER;
5403 IF (l_contract_number <> FND_API.G_MISS_CHAR) AND
5404 (l_contract_number <> l_old_ServiceRequest_rec.CONTRACT_NUMBER) THEN
5405 l_audit_vals_rec.CONTRACT_NUMBER := l_contract_number;
5406 ELSE
5407 l_audit_vals_rec.CONTRACT_NUMBER := l_old_ServiceRequest_rec.CONTRACT_NUMBER;
5408 END IF;
5409 *******************************************/
5410
5411 l_audit_vals_rec.OLD_UNASSIGNED_INDICATOR := l_old_ServiceRequest_rec.UNASSIGNED_INDICATOR;
5412 IF (l_unassigned_indicator <> FND_API.G_MISS_NUM) AND
5413 (l_unassigned_indicator <> l_old_ServiceRequest_rec.unassigned_indicator) THEN
5414 l_audit_vals_rec.UNASSIGNED_INDICATOR := l_unassigned_indicator;
5415 ELSE
5416 l_audit_vals_rec.UNASSIGNED_INDICATOR := l_old_ServiceRequest_rec.UNASSIGNED_INDICATOR;
5417 END IF;
5418
5419
5420
5421 -- for the bug 3027154 - moved the create_audit_record inside the if condition
5422 -- END IF; /* only_status_update_flag check*/
5423
5424
5425 END IF; /* only_status_update_flag check */
5426
5427
5428 ---- Call to Enqueue API if it is in maintenance Mode
5429
5430 FND_PROFILE.get('APPS_MAINTENANCE_MODE', l_maintenance_mode);
5431
5432 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
5433 THEN
5434 FND_LOG.String
5435 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5436 , 'The Value of profile APPS_MAINTENANCE_MODE :' || l_maintenance_mode
5437 );
5438 END IF;
5439
5440 IF (l_maintenance_mode = 'MAINT' AND
5441 p_invocation_mode <> 'REPLAY') THEN
5442
5443 -- hardcoded the version 2.0 shijain nov 27 2002
5444
5445 CS_ServiceRequest_ENQUEUE_PKG.EnqueueSR(
5446 p_init_msg_list => fnd_api.g_false ,
5447 p_api_version => 2.0,
5448 p_commit => p_commit,
5449 p_validation_level => p_validation_level,
5450 x_return_status => l_return_status,
5451 x_msg_count => x_msg_count,
5452 x_msg_data => x_msg_data,
5453 p_request_id => p_request_id,
5454 p_request_number => l_old_ServiceRequest_rec.incident_number,
5455 p_audit_id => l_audit_id,
5456 p_resp_appl_id => p_resp_appl_id,
5457 p_resp_id => p_resp_id,
5458 p_user_id => p_user_id,
5459 p_login_id => p_login_id,
5460 p_org_id => p_org_id,
5461 p_update_desc_flex => p_update_desc_flex,
5462 p_object_version_number => p_object_version_number,
5463 p_transaction_type => l_transaction_type,
5464 p_message_rev => l_message_revision,
5465 p_servicerequest => l_service_request_rec,
5466 p_contacts => l_contacts
5467 );
5468
5469 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5470 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5471 END IF;
5472 END IF;
5473
5474 IF (l_only_status_update_flag <> 'Y') THEN
5475 --
5476 -- Create entries in JTF_NOTES from p_notes
5477 --
5478 l_note_index := p_notes.FIRST;
5479 WHILE l_note_index IS NOT NULL LOOP
5480 /* Create JTF_NOTES */
5481 --l_notes_detail := DBMS_LOB.SUBSTR(p_notes(l_note_index).note_detail);
5482
5483
5484 IF ((p_notes(l_note_index).note IS NOT NULL) AND
5485 (p_notes(l_note_index).note <> FND_API.G_MISS_CHAR)) THEN
5486
5487 l_note_status := null ;
5488
5489 IF ((p_notes(l_note_index).note_status IS NULL) OR
5490 (p_notes(l_note_index).note_status = FND_API.G_MISS_CHAR)) THEN
5491 l_note_status := 'E';
5492 ELSE
5493 l_note_status := p_notes(l_note_index).note_status ;
5494 END IF ;
5495
5496 jtf_notes_pub.create_note(
5497 p_api_version => 1.0,
5498 p_init_msg_list => FND_API.G_FALSE,
5499 p_commit => FND_API.G_FALSE,
5500 x_return_status => x_return_status,
5501 x_msg_count => x_msg_count,
5502 x_msg_data => x_msg_data,
5503 p_source_object_id => p_request_id,
5504 p_source_object_code => 'SR',
5505 p_notes => p_notes(l_note_index).note,
5506 p_notes_detail => p_notes(l_note_index).note_detail,
5507 p_note_type => p_notes(l_note_index).note_type,
5508 p_note_status => l_note_status,
5509 p_entered_by => p_last_updated_by,
5510 p_entered_date => p_last_update_date,
5511 p_created_by => p_last_updated_by,
5512 p_creation_date => p_last_update_date,
5513 p_last_updated_by => p_last_updated_by,
5514 p_last_update_date => p_last_update_date,
5515 x_jtf_note_id => l_note_id
5516 );
5517
5518 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5519 RAISE FND_API.G_EXC_ERROR;
5520 END IF;
5521
5522 END IF;
5523
5524 IF ((p_notes(l_note_index).note_context_type_01 IS NOT NULL) AND
5525 (p_notes(l_note_index).note_context_type_01 <> FND_API.G_MISS_CHAR) AND
5526 (p_notes(l_note_index).note_context_type_id_01 IS NOT NULL) AND
5527 (p_notes(l_note_index).note_context_type_id_01 <> FND_API.G_MISS_NUM)) THEN
5528
5529
5530 jtf_notes_pub.create_note_context(
5531 x_return_status => x_return_status,
5532 p_creation_date => p_last_update_date, ----SYSDATE,
5533 p_last_updated_by => p_last_updated_by,
5534 p_last_update_date => p_last_update_date, ------SYSDATE,
5535 p_jtf_note_id => l_note_id,
5536 p_note_context_type => p_notes(l_note_index).note_context_type_01,
5537 p_note_context_type_id => p_notes(l_note_index).note_context_type_id_01,
5538 x_note_context_id => l_note_context_id
5539 );
5540
5541 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
5542 THEN
5543 FND_LOG.String
5544 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5545 , 'The defaulted value of parameter note_context_id :' || l_note_context_id
5546 );
5547 END IF;
5548 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5549 RAISE FND_API.G_EXC_ERROR;
5550 END IF;
5551 END IF;
5552
5553 IF ((p_notes(l_note_index).note_context_type_02 IS NOT NULL) AND
5554 (p_notes(l_note_index).note_context_type_02 <> FND_API.G_MISS_CHAR) AND
5555 (p_notes(l_note_index).note_context_type_id_02 IS NOT NULL) AND
5556 (p_notes(l_note_index).note_context_type_id_02 <> FND_API.G_MISS_NUM)) THEN
5557
5558
5559 jtf_notes_pub.create_note_context(
5560 x_return_status => x_return_status,
5561 p_creation_date => p_last_update_date,
5562 p_last_updated_by => p_last_updated_by,
5563 p_last_update_date => p_last_update_date,
5564 p_jtf_note_id => l_note_id,
5565 p_note_context_type => p_notes(l_note_index).note_context_type_02,
5566 p_note_context_type_id => p_notes(l_note_index).note_context_type_id_02,
5567 x_note_context_id => l_note_context_id
5568 );
5569
5570 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
5571 THEN
5572 FND_LOG.String
5573 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5574 , 'The defaulted value of parameter note_context_id :' || l_note_context_id
5575 );
5576 END IF;
5577 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5578 RAISE FND_API.G_EXC_ERROR;
5579 END IF;
5580 END IF;
5581
5582 IF ((p_notes(l_note_index).note_context_type_03 IS NOT NULL) AND
5583 (p_notes(l_note_index).note_context_type_03 <> FND_API.G_MISS_CHAR) AND
5584 (p_notes(l_note_index).note_context_type_id_03 IS NOT NULL) AND
5585 (p_notes(l_note_index).note_context_type_id_03 <> FND_API.G_MISS_NUM)) THEN
5586
5587 jtf_notes_pub.create_note_context(
5588 x_return_status => x_return_status,
5589 p_creation_date => p_last_update_date,
5590 p_last_updated_by => p_last_updated_by,
5591 p_last_update_date => p_last_update_date,
5592 p_jtf_note_id => l_note_id,
5593 p_note_context_type => p_notes(l_note_index).note_context_type_03,
5594 p_note_context_type_id => p_notes(l_note_index).note_context_type_id_03,
5595 x_note_context_id => l_note_context_id
5596 );
5597
5598 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
5599 THEN
5600 FND_LOG.String
5601 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5602 , 'The defaulted value of parameter note_context_id :' || l_note_context_id
5603 );
5604 END IF;
5605 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
5606 RAISE FND_API.G_EXC_ERROR;
5607 END IF;
5608 END IF;
5609 l_note_index := p_notes.NEXT(l_note_index);
5610 END LOOP;
5611
5612 -- Launching the workflow (HOOK)
5613 IF (JTF_USR_HKS.Ok_To_Execute('CS_ServiceRequest_PVT', 'Update_ServiceRequest',
5614 'W', 'W')) THEN
5615
5616 IF (cs_servicerequest_cuhk.Ok_To_Launch_Workflow
5617 (p_request_id => p_request_id,
5618 p_service_request_rec=>l_service_request_rec)) THEN
5619
5620 l_bind_data_id := JTF_USR_HKS.Get_bind_data_id ;
5621 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'USER_ID', p_last_updated_by, 'W', 'T');
5622 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'RESP_ID', p_resp_id, 'W', 'T');
5623 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'RESP_APPL_ID', p_resp_appl_id, 'W', 'T');
5624 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_ID', p_request_id, 'W', 'T');
5625 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_DATE', l_old_servicerequest_rec.incident_date, 'W', 'T');
5626 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_TYPE', l_service_request_rec.type_id, 'W', 'T');
5627 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_STATUS', l_service_request_rec.status_id, 'W', 'T');
5628 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_SEVERITY', l_service_request_rec.severity_id, 'W', 'T');
5629 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_URGENCY', l_service_request_rec.urgency_id, 'W', 'T');
5630 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'OWNER_ID', l_service_request_rec.owner_id, 'W', 'T');
5631 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_SUMMARY', l_service_request_rec.summary, 'W', 'T');
5632 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'REQUEST_CUSTOMER', l_service_request_rec.customer_id, 'W', 'T');
5633 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'INVENTORY_ITEM_ID', l_service_request_rec.inventory_item_id, 'W', 'T');
5634 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'CUSTOMER_PRODUCT_ID', l_service_request_rec.customer_product_id, 'W', 'T');
5635 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'PROBLEM_CODE', l_service_request_rec.problem_code, 'W', 'T');
5636 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'EXPECTED_RESOLUTION_DATE', l_service_request_rec.exp_resolution_date, 'W', 'T');
5637
5638
5639 -- Before the call to WorkFlow Hook, generate a unique item key using the workflow sequence
5640 SELECT cs_wf_process_id_s.NEXTVAL INTO l_workflow_item_key FROM dual;
5641
5642 JTF_USR_HKS.WrkflowLaunch(p_wf_item_name => 'SERVEREQ',
5643 p_wf_item_process_name => 'CALL_SUPPORT',
5644 p_wf_item_key => 'SR' || TO_CHAR(l_workflow_item_key),
5645 p_bind_data_id => l_bind_data_id,
5646 x_return_code => l_return_status);
5647
5648 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5649 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5650 END IF;
5651
5652 END IF ;
5653 END IF ;
5654 END IF; /* only status update flag check */
5655
5656
5657 --
5658 -- Make the post processing call to the user hooks
5659 --
5660 -- Post call to the Customer Type User Hook
5661 --
5662 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
5663 'Update_ServiceRequest',
5664 'A', 'C') THEN
5665
5666 -- hardcoded the version 2.0 shijain nov 27 2002
5667
5668 cs_servicerequest_cuhk.Update_ServiceRequest_Post
5669 ( p_api_version => 2.0,
5670 p_init_msg_list => fnd_api.g_false ,
5671 p_commit => p_commit,
5672 p_validation_level => p_validation_level,
5673 x_return_status => l_return_status,
5674 x_msg_count => x_msg_count,
5675 x_msg_data => x_msg_data,
5676 p_request_id => p_request_id ,
5677 p_object_version_number => p_object_version_number,
5678 p_resp_appl_id => p_resp_appl_id,
5679 p_resp_id => p_resp_id,
5680 p_last_updated_by => p_last_updated_by,
5681 p_last_update_login => p_last_update_login,
5682 p_last_update_date => p_last_update_date,
5683 p_invocation_mode => p_invocation_mode,
5684 p_service_request_rec => l_service_request_rec,
5685 p_update_desc_flex => p_update_desc_flex,
5686 p_notes => p_notes,
5687 p_contacts => p_contacts,
5688 p_audit_comments => p_audit_comments,
5689 p_called_by_workflow => p_called_by_workflow,
5690 p_workflow_process_id => p_workflow_process_id,
5691 x_workflow_process_id => x_sr_update_out_rec.workflow_process_id,
5692 x_interaction_id => x_sr_update_out_rec.interaction_id);
5693
5694 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5695 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5696 END IF;
5697 END IF;
5698
5699 -- Post call to the Vertical Type User Hook
5700 --
5701 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
5702 'Update_ServiceRequest',
5703 'A', 'V') THEN
5704
5705 -- hardcoded the version 2.0 shijain nov 27 2002
5706
5707 cs_servicerequest_vuhk.Update_ServiceRequest_Post
5708 ( p_api_version => 2.0,
5709 p_init_msg_list => fnd_api.g_false ,
5710 p_commit => p_commit,
5711 p_validation_level => p_validation_level,
5712 x_return_status => l_return_status,
5713 x_msg_count => x_msg_count,
5714 x_msg_data => x_msg_data,
5715 p_request_id => p_request_id ,
5716 p_object_version_number => p_object_version_number,
5717 p_resp_appl_id => p_resp_appl_id,
5718 p_resp_id => p_resp_id,
5719 p_last_updated_by => p_last_updated_by,
5720 p_last_update_login => p_last_update_login,
5721 p_last_update_date => p_last_update_date,
5722 p_service_request_rec => l_service_request_rec,
5723 p_update_desc_flex => p_update_desc_flex,
5724 p_notes => p_notes,
5725 p_contacts => p_contacts,
5726 p_audit_comments => p_audit_comments,
5727 p_called_by_workflow => p_called_by_workflow,
5728 p_workflow_process_id => p_workflow_process_id,
5729 x_workflow_process_id => x_sr_update_out_rec.workflow_process_id,
5730 x_interaction_id => x_sr_update_out_rec.interaction_id);
5731
5732 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5733 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5734 END IF;
5735 END IF;
5736
5737 -- Post call to the Internal Type User Hook
5738 --
5739
5740 cs_servicerequest_iuhk.Update_ServiceRequest_Post( x_return_status=>l_return_status);
5741
5742 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5743 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5744 END IF;
5745
5746 IF (l_only_status_update_flag <> 'Y') THEN
5747 -- ------------------------------------------------------
5748 -- Insert a record into the calls table if the caller is
5749 -- not a workflow process
5750 -- ------------------------------------------------------
5751 IF NOT FND_API.To_Boolean(p_called_by_workflow) THEN
5752 IF (l_service_request_rec.parent_interaction_id IS NULL) THEN
5753 /* CREATE INTERACTION */ /* l_interaction_id := */
5754 NULL;
5755 END IF;
5756 x_sr_update_out_rec.interaction_id := l_interaction_id;
5757
5758 --
5759 -- Create INTERACTION_ACTIVITY
5760 --
5761
5762 IF (l_return_status = fnd_api.g_ret_sts_error) THEN
5763 RAISE fnd_api.g_exc_error;
5764 ELSIF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5765 RAISE fnd_api.g_exc_unexpected_error;
5766 END IF;
5767 END IF; /* called by workflow */
5768 END IF; /* only status update flag check */
5769
5770
5771 -- Standard call for message generation
5772 IF jtf_usr_hks.Ok_To_Execute('CS_ServiceRequest_PVT',
5773 'Create_ServiceRequest',
5774 'M', 'M') THEN
5775
5776 IF (cs_servicerequest_cuhk.Ok_To_Generate_Msg(p_request_id => p_request_id,
5777 p_service_request_rec=>l_service_request_rec)) THEN
5778
5779 l_bind_data_id := JTF_USR_HKS.Get_bind_data_id;
5780
5781 JTF_USR_HKS.Load_bind_data(l_bind_data_id, 'incident_id', p_request_id, 'S', 'N');
5782
5783 JTF_USR_HKS.generate_message(p_prod_code => 'CS',
5784 p_bus_obj_code => 'SR',
5785 p_action_code => 'U',
5786 p_bind_data_id => l_bind_data_id,
5787 x_return_code => l_return_status);
5788
5789
5790 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5791 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5792 END IF;
5793 END IF;
5794 END IF;
5795
5796 /***************************************************
5797 commented for bug 2857350, moved after calling the business events
5798
5799 -- Standard check of p_commit
5800 IF FND_API.To_Boolean(p_commit) THEN
5801 COMMIT WORK;
5802 END IF;
5803 comments ended for bug 2857350
5804 ***********************************************************/
5805
5806
5807 -- END IF; -- IF (l_dummy > p_object_version_number )
5808
5809
5810 -- Added this call for Misc ER: Owner auto assignment changes
5811
5812 IF (l_only_status_update_flag <> 'Y')
5813 THEN
5814 IF l_start_eres_flag = 'Y'
5815 THEN
5816 CS_ERES_INT_PKG.start_approval_process
5817 ( p_incident_id => p_request_id
5818 , p_incident_type_id => l_service_request_rec.type_id
5819 , p_incident_status_id => l_sr_related_data.intermediate_status_id
5820 , p_qa_collection_id => l_service_request_rec.qa_collection_plan_id
5821 , x_approval_status => l_approval_status
5822 , x_return_status => x_return_status
5823 , x_msg_count => x_msg_count
5824 , x_msg_data => x_msg_data
5825 );
5826 IF x_return_status <> FND_API.G_RET_STS_SUCCESS
5827 THEN
5828 RAISE FND_API.G_EXC_ERROR;
5829 END IF;
5830 IF l_approval_status = 'NO_ACTION'
5831 THEN
5832 -- validated orginal target status
5833 CS_ServiceRequest_UTIL.Validate_Updated_Status
5834 ( p_api_name => 'CS_SERVICEREQUEST_PVT.update_servicerequest'
5835 , p_parameter_name => 'p_status_id'
5836 , p_resp_id => p_resp_id
5837 , p_new_status_id => l_sr_related_data.target_status_id
5838 , p_old_status_id => l_old_servicerequest_rec.incident_status_id
5839 , p_subtype => G_SR_SUBTYPE
5840 , p_type_id => l_service_request_rec.type_id
5841 , p_old_type_id => l_old_servicerequest_rec.incident_type_id
5842 , p_close_flag => l_sr_related_data.close_flag
5843 , p_disallow_request_update => l_sr_related_data.disallow_request_update
5844 , p_disallow_owner_update => l_sr_related_data.disallow_owner_update
5845 , p_disallow_product_update => l_sr_related_data.disallow_product_update
5846 , x_return_status => l_return_status
5847 );
5848 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5849 x_return_status := FND_API.G_RET_STS_ERROR;
5850 RAISE FND_API.G_EXC_ERROR;
5851 END IF;
5852 -- target status is valid at this point.
5853 --
5854 -- Now get responded and resolved dates
5855 CS_SERVICEREQUEST_UTIL.get_reacted_resolved_dates
5856 ( p_incident_status_id => l_sr_related_data.target_status_id
5857 , p_old_incident_status_id => l_old_servicerequest_rec.incident_status_id
5858 , p_old_incident_resolved_date => l_old_servicerequest_rec.incident_resolved_date
5859 , p_old_inc_responded_by_date => l_old_servicerequest_rec.inc_responded_by_date
5860 , x_inc_responded_by_date => l_service_request_rec.inc_responded_by_date
5861 , x_incident_resolved_date => l_service_request_rec.incident_resolved_date
5862 , x_return_status => l_return_status
5863 );
5864 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
5865 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5866 END IF;
5867 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
5868 THEN
5869 FND_LOG.String
5870 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5871 , 'The defaulted value of parameter inc_responded_by_date :'
5872 || l_service_request_rec.inc_responded_by_date
5873 );
5874 FND_LOG.String
5875 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
5876 , 'The defaulted value of parameter incident_resolved_date :'
5877 || l_service_request_rec.incident_resolved_date
5878 );
5879 END IF;
5880 IF NVL(l_sr_related_data.close_flag,'N') = 'Y'
5881 THEN
5882 l_service_request_rec.status_flag := 'C';
5883 IF l_service_request_rec.closed_date IS NULL
5884 THEN
5885 l_service_request_rec.closed_date := NVL(l_old_servicerequest_rec.close_date,SYSDATE);
5886 END IF;
5887 ELSE
5888 l_service_request_rec.status_flag := 'O' ;
5889 l_service_request_rec.closed_date := NULL;
5890 END IF;
5891 -- Now update service request record with new value for
5892 -- 1. new status
5893 -- 2. incident responded date
5894 -- 3. incident resolved date
5895 -- 4. Close date
5896 l_service_request_rec.status_id := l_sr_related_data.target_status_id;
5897 UPDATE cs_incidents_all_b
5898 SET incident_status_id = l_service_request_rec.status_id
5899 , inc_responded_by_date = l_service_request_rec.inc_responded_by_date
5900 , incident_resolved_date = l_service_request_rec.incident_resolved_date
5901 , status_flag = l_service_request_rec.status_flag
5902 , close_date = l_service_request_rec.closed_date
5903 WHERE incident_id = p_request_id;
5904 -- if close flag for target status is Y then close SR child entities and workflow
5905 END IF; -- l_approval_status = NO_ACTION
5906 END IF; -- l_start_eres_flag = 'Y'
5907 x_sr_update_out_rec.status_id := l_service_request_rec.status_id;
5908 x_sr_update_out_rec.close_date := l_service_request_rec.closed_date;
5909 x_sr_update_out_rec.resolved_on_date := l_service_request_rec.incident_resolved_date;
5910 x_sr_update_out_rec.responded_on_date := l_service_request_rec.inc_responded_by_date;
5911 -- Create audit record
5912 l_audit_vals_rec.entity_activity_code := 'U';
5913 l_audit_vals_rec.updated_entity_code := 'SR_HEADER';
5914 l_audit_vals_rec.updated_entity_id := p_request_id;
5915 l_audit_vals_rec.incident_last_modified_date := l_service_request_rec.last_update_date ;
5916 l_audit_vals_rec.incident_status_id := l_service_request_rec.status_id ;
5917 --
5918 l_audit_vals_rec.incident_resolved_date := l_service_request_rec.incident_resolved_date;
5919 l_audit_vals_rec.old_incident_resolved_date := l_old_ServiceRequest_rec.incident_resolved_date;
5920 --
5921 l_audit_vals_rec.inc_responded_by_date := l_service_request_rec.inc_responded_by_date;
5922 l_audit_vals_rec.old_inc_responded_by_date := l_old_ServiceRequest_rec.inc_responded_by_date;
5923 --
5924 l_audit_vals_rec.close_date := l_service_request_rec.closed_date ;
5925 l_audit_vals_rec.old_close_date := l_old_ServiceRequest_rec.close_date ;
5926 --
5927 l_audit_vals_rec.status_flag := l_service_request_rec.status_flag ;
5928 l_audit_vals_rec.old_status_flag := l_old_ServiceRequest_rec.status_flag ;
5929 IF l_service_request_rec.status_flag = l_old_servicerequest_rec.status_flag
5930 THEN
5931 l_audit_vals_rec.change_status_flag := 'N';
5932 ELSE
5933 l_audit_vals_rec.change_status_flag := 'Y';
5934 END IF;
5935 l_audit_vals_rec.incident_country := l_service_request_rec.incident_country ;
5936 l_audit_vals_rec.old_incident_country := l_old_servicerequest_rec.incident_country ;
5937 --
5938 l_audit_vals_rec.incident_location_id := l_service_request_rec.incident_location_id ;
5939 l_audit_vals_rec.old_incident_location_id := l_old_servicerequest_rec.incident_location_id ;
5940 --
5941 l_audit_vals_rec.incident_location_type := l_service_request_rec.incident_location_type ;
5942 l_audit_vals_rec.old_incident_location_type := l_old_servicerequest_rec.incident_location_type;
5943 --
5944 IF NVL(l_service_request_rec.owner_id,-99) = NVL(l_old_ServiceRequest_rec.incident_owner_id,-99)
5945 THEN
5946 IF (l_service_request_rec.owner_assigned_time = FND_API.G_MISS_DATE) OR
5947 (l_service_request_rec.owner_assigned_time IS NULL AND
5948 l_old_ServiceRequest_rec.owner_assigned_time IS NULL) OR
5949 (l_service_request_rec.owner_assigned_time = l_old_ServiceRequest_rec.owner_assigned_time)
5950 THEN
5951 --commented by Sanjana Rao, bug 6955756
5952 -- l_service_request_rec.owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
5953 -- For audit record
5954 l_audit_vals_rec.change_assigned_time_flag := 'N';
5955 l_audit_vals_rec.old_owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
5956 --2993526
5957 l_audit_vals_rec.owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
5958 ELSE
5959 -- For audit record
5960 l_audit_vals_rec.change_ASSIGNED_TIME_FLAG := 'Y';
5961 l_audit_vals_rec.OLD_OWNER_ASSIGNED_TIME := l_old_ServiceRequest_rec.owner_assigned_time;
5962 --2993526 ... passed value should be stamped
5963 l_audit_vals_rec.OWNER_ASSIGNED_TIME := l_service_request_rec.owner_assigned_time;
5964 END IF;
5965 -- for audit record added by shijain
5966 l_audit_vals_rec.change_incident_owner_flag := 'N';
5967 ELSE
5968 IF (l_service_request_rec.owner_assigned_time = FND_API.G_MISS_DATE) OR
5969 (l_service_request_rec.owner_assigned_time IS NULL AND
5970 l_old_ServiceRequest_rec.owner_assigned_time IS NULL) OR
5971 (l_service_request_rec.owner_assigned_time = l_old_ServiceRequest_rec.owner_assigned_time)
5972 THEN
5973 --2993526
5974
5975 --commented by Sanjana Rao, bug 6955756
5976 -- l_service_request_rec.owner_assigned_time := SYSDATE;
5977
5978 -- For audit record
5979
5980 l_audit_vals_rec.change_assigned_time_flag := 'Y' ;
5981 l_audit_vals_rec.old_owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
5982 l_audit_vals_rec.owner_assigned_time := SYSDATE;
5983 ELSE
5984 --2993526
5985 -- For audit record
5986 l_audit_vals_rec.change_ASSIGNED_TIME_FLAG := 'Y';
5987 l_audit_vals_rec.OLD_OWNER_ASSIGNED_TIME := l_old_ServiceRequest_rec.owner_assigned_time;
5988 --2993526
5989 l_audit_vals_rec.OWNER_ASSIGNED_TIME := l_service_request_rec.owner_assigned_time;
5990 END IF;
5991 -- For audit record
5992 l_audit_vals_rec.CHANGE_INCIDENT_OWNER_FLAG := 'Y';
5993 END IF;
5994 l_audit_vals_rec.OLD_INCIDENT_OWNER_ID := l_old_ServiceRequest_rec.incident_owner_id;
5995 l_audit_vals_rec.INCIDENT_OWNER_ID := l_service_request_rec.owner_id;
5996
5997 -- end for 2993526
5998 --- Added code for bug# 1966184
5999 IF NVL(l_service_request_rec.group_type,-99) = NVL(l_old_ServiceRequest_rec.group_type,-99)
6000 THEN
6001 l_audit_vals_rec.change_group_type_flag := 'N';
6002 ELSE
6003 l_audit_vals_rec.change_group_type_FLAG := 'Y';
6004 END IF;
6005 l_audit_vals_rec.OLD_group_type := l_old_ServiceRequest_rec.group_type;
6006 l_audit_vals_rec.group_type := l_service_request_rec.group_type;
6007 -- Audit Resource Type
6008 IF NVL(l_service_request_rec.resource_type,-99) = NVL(l_old_ServiceRequest_rec.resource_type,-99)
6009 THEN
6010 l_audit_vals_rec.change_resource_type_flag := 'N';
6011 ELSE
6012 l_audit_vals_rec.change_resource_type_FLAG := 'Y';
6013 END IF;
6014 l_audit_vals_rec.old_resource_type := l_old_ServiceRequest_rec.resource_type;
6015 l_audit_vals_rec.resource_type := l_service_request_rec.resource_type;
6016
6017 -----Added for enhancements 11.5.6-------jngeorge-----08/03/01
6018 ----Added code for bug# 1966169
6019 IF NVL(l_service_request_rec.owner_group_id,-99) = NVL(l_old_ServiceRequest_rec.owner_group_id,-99)
6020 THEN
6021 l_audit_vals_rec.change_group_flag := 'N';
6022 ELSE
6023 ---- Added for Enh# 2216664
6024 -- For audit record
6025 l_audit_vals_rec.change_group_FLAG := 'Y';
6026 END IF;
6027 l_audit_vals_rec.old_group_id := l_old_ServiceRequest_rec.owner_group_id;
6028 l_audit_vals_rec.group_id := l_service_request_rec.owner_group_id;
6029 --
6030 -- Territory Audit
6031 --
6032 IF NVL(l_service_request_rec.territory_id,-99) = NVL(l_old_ServiceRequest_rec.territory_id,-99)
6033 THEN
6034 l_audit_vals_rec.change_territory_id_flag := 'N';
6035 ELSE
6036 ---- Added for Enh# 2216664
6037 -- For audit record
6038 l_audit_vals_rec.change_territory_id_FLAG := 'Y';
6039 END IF;
6040 l_audit_vals_rec.old_territory_id := l_old_ServiceRequest_rec.territory_id;
6041 l_audit_vals_rec.territory_id := l_service_request_rec.territory_id;
6042 --End of audit changes for Group, owner and Group Type
6043 -- Added for Auditing project of 11.5.10 --anmukher --09/05/03 l_old_ServiceRequest_rec
6044 --
6045 IF NVL(l_service_request_rec.site_id,-99) = NVL(l_old_ServiceRequest_rec.site_id,-99)
6046 THEN
6047 l_audit_vals_rec.change_site_flag := 'N';
6048 ELSE
6049 l_audit_vals_rec.change_site_FLAG := 'Y';
6050 END IF;
6051 l_audit_vals_rec.old_site_id := l_old_ServiceRequest_rec.site_id;
6052 l_audit_vals_rec.site_id := l_service_request_rec.site_id;
6053
6054 CS_ServiceRequest_PVT.Create_Audit_Record
6055 ( p_api_version => 2.0
6056 , x_return_status => l_return_status
6057 , x_msg_count => x_msg_count
6058 , x_msg_data => x_msg_data
6059 , p_request_id => p_request_id
6060 , p_audit_id => p_audit_id
6061 , p_audit_vals_rec => l_audit_vals_rec
6062 , p_user_id => l_service_request_rec.last_updated_by
6063 , p_wf_process_name => l_workflow_process_name
6064 , p_wf_process_itemkey => l_wf_process_itemkey
6065 , p_login_id => l_service_request_rec.last_update_login
6066 , p_last_update_date => l_service_request_rec.last_update_date
6067 , p_creation_date => l_service_request_rec.last_update_date
6068 , p_comments => p_audit_comments
6069 , x_audit_id => l_audit_id
6070 );
6071 --
6072 -- Create entries in CS_HZ_SR_CONTACT_POINTS from p_contacts
6073 CS_SRCONTACT_PKG.create_update
6074 ( p_incident_id => p_request_id
6075 , p_invocation_mode => p_invocation_mode
6076 , p_sr_update_date => l_service_request_rec.last_update_date
6077 , p_sr_updated_by => l_service_request_rec.last_updated_by
6078 , p_sr_update_login => l_service_request_rec.last_update_login
6079 , p_contact_tbl => l_processed_contacts
6080 , p_old_contact_tbl => l_old_contacts
6081 , x_return_status => l_return_status
6082 );
6083 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
6084 THEN
6085 RAISE FND_API.G_EXC_ERROR;
6086 END IF;
6087 --
6088 IF l_start_eres_flag = 'Y' AND
6089 l_approval_status = 'NO_ACTION'
6090 THEN
6091 IF NVL(l_sr_related_data.close_flag,'N') = 'Y'
6092 THEN
6093 -- Close workflow processing
6094 -- check if old status was closed on Not
6095 CS_SERVICEREQUEST_UTIL.get_status_details
6096 ( p_status_id => l_old_servicerequest_rec.incident_status_id
6097 , x_close_flag => l_sr_related_data.old_close_flag
6098 , x_disallow_request_update => l_sr_related_data.old_disallow_request_update
6099 , x_disallow_agent_dispatch => l_sr_related_data.old_disallow_owner_update
6100 , x_disallow_product_update => l_sr_related_data.old_disallow_product_update
6101 , x_pending_approval_flag => l_sr_related_data.old_pending_approval_flag
6102 , x_intermediate_status_id => l_sr_related_data.old_intermediate_status_id
6103 , x_approval_action_status_id => l_sr_related_data.old_approval_action_status_id
6104 , x_rejection_action_status_id => l_sr_related_data.old_rejection_action_status_id
6105 , x_return_status => l_return_status
6106 );
6107 --
6108 IF l_sr_related_data.old_close_flag <> 'Y' AND
6109 l_sr_related_data.abort_workflow_close_flag = 'Y' AND
6110 CS_Workflow_PKG.Is_Servereq_Item_Active
6111 ( p_request_number => l_old_ServiceRequest_rec.incident_number
6112 , p_wf_process_id => l_old_ServiceRequest_rec.workflow_process_id
6113 ) = 'Y'
6114 THEN
6115 CS_Workflow_PKG.Abort_Servereq_Workflow
6116 (p_request_number => l_old_ServiceRequest_rec.incident_number,
6117 p_wf_process_id => l_old_ServiceRequest_rec.workflow_process_id,
6118 p_user_id => p_last_updated_by);
6119 END IF;
6120 IF ( p_validate_sr_closure = 'Y' OR p_validate_sr_closure = 'y') THEN
6121 CS_SR_STATUS_PROPAGATION_PKG.VALIDATE_SR_CLOSURE
6122 ( p_api_version => p_api_version
6123 , p_init_msg_list => fnd_api.g_false
6124 , p_commit => p_commit
6125 , p_service_request_id => p_request_id
6126 , p_user_id => l_service_request_rec.last_updated_by
6127 , p_resp_appl_id => p_resp_appl_id
6128 , p_login_id => l_service_request_rec.last_update_login
6129 , x_return_status => l_return_status
6130 , x_msg_count => l_msg_count
6131 , x_msg_data => l_msg_data
6132 );
6133 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
6134 THEN
6135 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6136 ELSIF (p_auto_close_child_entities='Y' OR p_auto_close_child_entities='y')
6137 THEN
6138 CS_SR_STATUS_PROPAGATION_PKG.CLOSE_SR_CHILDREN
6139 ( p_api_version => p_api_version
6140 , p_init_msg_list => fnd_api.g_false
6141 , p_commit => p_commit
6142 , p_validation_required =>'N'
6143 , p_action_required => 'Y'
6144 , p_service_request_id => p_request_id
6145 , p_user_id => l_service_request_rec.last_updated_by
6146 , p_resp_appl_id => p_resp_appl_id
6147 , p_login_id => l_service_request_rec.last_update_login
6148 , x_return_status => l_return_status
6149 , x_msg_count => l_msg_count
6150 , x_msg_data => l_msg_data
6151 );
6152 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
6153 THEN
6154 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6155 END IF;
6156 END IF; -- for auto_close-child = 'Y'
6157 END IF; ------ p_validate_sr_closeure = 'Y'
6158 END IF; -------- l_sr_related_data.close_flag = 'Y'
6159 END IF; -- l_start_eres_flag = 'Y'
6160 --
6161 -- Change task address is incident address is changed.
6162
6163 IF p_validation_level > FND_API.G_VALID_LEVEL_NONE
6164 THEN
6165
6166 IF NVL(l_service_request_rec.incident_location_id,-1) <>
6167 NVL(l_old_servicerequest_rec.incident_location_id,-1) OR
6168 NVL(l_service_request_rec.incident_location_type,'-') <>
6169 NVL(l_old_servicerequest_rec.incident_location_type,'-')
6170 THEN
6171
6172 CS_ServiceRequest_UTIL.Verify_LocUpdate_For_FSTasks
6173 (p_incident_id => p_request_id,
6174 x_return_status => x_return_status );
6175
6176
6177 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
6178 RAISE FND_API.G_EXC_ERROR;
6179 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
6180 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6181 END IF ;
6182
6183 CS_servicerequest_util.update_task_address
6184 ( p_incident_id => p_request_id
6185 , p_location_type => l_service_request_rec.incident_location_type
6186 , p_location_id => l_service_request_rec.incident_location_id
6187 , x_return_status => x_return_status
6188 );
6189 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
6190 RAISE FND_API.G_EXC_ERROR;
6191 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
6192 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6193 END IF;
6194 END IF;
6195 END IF;
6196 END IF; -- l_only_status_update_flag <> 'Y'
6197 --- Added for HA Enhancement
6198
6199 IF (p_invocation_mode <> 'REPLAY') THEN
6200 --AND (FND_API.To_Boolean(p_called_by_workflow) = FALSE) THEN
6201 -- Raise BES Event that the SR is updated. Before business events, a WF process
6202 -- was kicked off if the following conditions were met: if l_autolaunch_wf_flag
6203 -- is 'Y' AND resource_type = 'RS_EMPLOYEE' AND owner_id IS NOT NULL and the
6204 -- status of the SR is not 'CLOSE' and there is'nt an active WF tied to this SR.
6205 -- After the introduction of business event, the SR API calls the CS BES wrapper
6206 -- API and this wrapper API raises the needed business events, in this case -
6207 -- SR Updated, after checking the required conditions.
6208 -- The wrapper API will also check if a Contact was added or the SR was re-assigned
6209 -- and raise those evens as well if true.
6210
6211 -- Initialize and populate the old rec type with the SR Old values.
6212
6213 initialize_rec ( p_sr_record => l_old_sr_rec );
6214
6215 l_old_sr_rec.type_id := l_old_servicerequest_rec.incident_type_id;
6216 l_old_sr_rec.status_id := l_old_servicerequest_rec.incident_status_id;
6217 l_old_sr_rec.severity_id := l_old_servicerequest_rec.incident_severity_id;
6218 l_old_sr_rec.urgency_id := l_old_servicerequest_rec.incident_urgency_id;
6219 l_old_sr_rec.owner_id := l_old_servicerequest_rec.incident_owner_id;
6220 l_old_sr_rec.owner_group_id := l_old_servicerequest_rec.owner_group_id;
6221 l_old_sr_rec.customer_id := l_old_servicerequest_rec.customer_id;
6222 l_old_sr_rec.customer_product_id := l_old_servicerequest_rec.customer_product_id;
6223 l_old_sr_rec.inventory_item_id := l_old_servicerequest_rec.inventory_item_id;
6224 l_old_sr_rec.problem_code := l_old_servicerequest_rec.problem_code;
6225 --Added summary as a fix for bug#2809232
6226 l_old_sr_rec.summary := l_old_servicerequest_rec.summary;
6227 l_old_sr_rec.exp_resolution_date := l_old_servicerequest_rec.expected_resolution_date;
6228 l_old_sr_rec.install_site_id := l_old_servicerequest_rec.install_site_id;
6229 l_old_sr_rec.bill_to_site_id := l_old_servicerequest_rec.bill_to_site_id;
6230 l_old_sr_rec.bill_to_contact_id := l_old_servicerequest_rec.bill_to_contact_id;
6231 l_old_sr_rec.ship_to_site_id := l_old_servicerequest_rec.ship_to_site_id;
6232 l_old_sr_rec.ship_to_contact_id := l_old_servicerequest_rec.ship_to_contact_id;
6233 l_old_sr_rec.resolution_code := l_old_servicerequest_rec.resolution_code;
6234 l_old_sr_rec.contract_service_id := l_old_servicerequest_rec.contract_service_id;
6235 l_old_sr_rec.sr_creation_channel := l_old_servicerequest_rec.sr_creation_channel;
6236 l_old_sr_rec.last_update_channel := l_old_servicerequest_rec.last_update_channel;
6237 l_old_sr_rec.last_update_program_code := l_old_servicerequest_rec.last_update_program_code;
6238
6239 -- added wf process id to be passed to the BES event, so that it does'nt raise another
6240 -- event if there is a wf process id already that is active.
6241
6242
6243 CS_WF_EVENT_PKG.RAISE_SERVICEREQUEST_EVENT(
6244 -- These 4 parameters added for bug #2798269
6245 p_api_version => p_api_version,
6246 p_init_msg_list => fnd_api.g_false ,
6247 p_commit => p_commit,
6248 p_validation_level => p_validation_level,
6249 p_event_code => 'UPDATE_SERVICE_REQUEST',
6250 p_incident_number => l_old_ServiceRequest_rec.incident_number,
6251 p_user_id => l_service_request_rec.last_updated_by,
6252 p_resp_id => p_resp_id,
6253 p_resp_appl_id => p_resp_appl_id,
6254 p_old_sr_rec => l_old_sr_rec,
6255 p_new_sr_rec => l_service_request_rec, -- using l_ser...coz this is the
6256 -- rec. type used in the insert.
6257 p_contacts_table => p_contacts,
6258 p_link_rec => NULL, -- using default value
6259 p_wf_process_id => p_workflow_process_id, -- value of the WF
6260 -- process id if the update API is invoked from a WF.
6261 p_owner_id => NULL, -- using default value
6262 p_wf_manual_launch => 'N' , -- using default value
6263 x_wf_process_id => l_workflow_process_id,
6264 x_return_status => lx_return_status,
6265 x_msg_count => lx_msg_count,
6266 x_msg_data => lx_msg_data );
6267
6268 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
6269 -- do nothing in this API. The BES wrapper API will have to trap this
6270 -- situation and send a notification to the SR owner that the BES has
6271 -- not been raised. If the BES API return back a failure status, it
6272 -- means only that the BES raise event has failed, and has nothing to
6273 -- do with the update of the SR.
6274 null;
6275 end if;
6276 x_sr_update_out_rec.workflow_process_id := l_workflow_process_id ;
6277 END IF; -- IF (p_invocation_mode <> 'REPLAY')
6278 --
6279 -- end of Raise service request events.
6280 --
6281 CS_SR_WORKITEM_PVT.Update_Workitem(
6282 p_api_version => 1.0,
6283 p_init_msg_list => fnd_api.g_false ,
6284 p_commit => p_commit ,
6285 p_incident_id => p_request_id,
6286 p_old_sr_rec => l_old_ServiceRequest_rec,
6287 p_new_sr_rec => l_service_request_rec,
6288 p_user_id => l_service_request_rec.last_updated_by,
6289 p_resp_appl_id => p_resp_appl_id ,
6290 x_return_status => l_return_status,
6291 x_msg_count => x_msg_count,
6292 x_msg_data => x_msg_data);
6293
6294 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6295 FND_MSG_PUB.Count_And_Get
6296 ( p_count => x_msg_count,
6297 p_data => x_msg_data
6298 );
6299 END IF;
6300
6301 CLOSE l_ServiceRequest_csr;
6302 /**************Commit moved for bug 2857350**************************/
6303 -- Standard check of p_commit
6304 IF FND_API.To_Boolean(p_commit) THEN
6305 COMMIT WORK;
6306 END IF;
6307
6308 /*resetting the parameter value shijain 4th dec 2002*/
6309 g_restrict_ib:=NULL;
6310
6311 -- Standard call to get message count and if count is 1, get message info
6312 FND_MSG_PUB.Count_And_Get (
6313 p_count => x_msg_count,
6314 p_data => x_msg_data );
6315
6316 EXCEPTION
6317 WHEN FND_API.G_EXC_ERROR THEN
6318 ROLLBACK TO Update_ServiceRequest_PVT;
6319 IF (l_ServiceRequest_csr%ISOPEN) THEN
6320 CLOSE l_ServiceRequest_csr;
6321 END IF;
6322 x_return_status := FND_API.G_RET_STS_ERROR;
6323 FND_MSG_PUB.Count_And_Get
6324 ( p_count => x_msg_count,
6325 p_data => x_msg_data
6326 );
6327
6328 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
6329 ROLLBACK TO Update_ServiceRequest_PVT;
6330 IF (l_ServiceRequest_csr%ISOPEN) THEN
6331 CLOSE l_ServiceRequest_csr;
6332 END IF;
6333 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6334 FND_MSG_PUB.Count_And_Get
6335 ( p_count => x_msg_count,
6336 p_data => x_msg_data
6337 );
6338
6339 WHEN DestUpdated THEN
6340 IF (l_ServiceRequest_csr%ISOPEN) THEN
6341 CLOSE l_ServiceRequest_csr;
6342 END IF;
6343 IF (p_invocation_mode = 'REPLAY' ) THEN
6344 x_return_status := FND_API.G_RET_STS_SUCCESS;
6345 ELSE
6346 x_return_status := FND_API.G_RET_STS_ERROR;
6347 END IF;
6348 FND_MESSAGE.SET_NAME('CS','CS_SR_DESTINATION_UPDATED');
6349 FND_MSG_PUB.ADD;
6350 FND_MSG_PUB.Count_And_Get
6351 ( p_count => x_msg_count,
6352 p_data => x_msg_data
6353 );
6354
6355 WHEN NoUpdate THEN
6356 IF (l_ServiceRequest_csr%ISOPEN) THEN
6357 CLOSE l_ServiceRequest_csr;
6358 END IF;
6359 x_return_status := FND_API.G_RET_STS_ERROR;
6360 FND_MESSAGE.SET_NAME('CS','CS_SR_LESSER_OBJ_VERSION');
6361 FND_MSG_PUB.ADD;
6362 FND_MSG_PUB.Count_And_Get
6363 ( p_count => x_msg_count,
6364 p_data => x_msg_data
6365 );
6366
6367 WHEN TargUpdated THEN
6368 IF (l_ServiceRequest_csr%ISOPEN) THEN
6369 CLOSE l_ServiceRequest_csr;
6370 END IF;
6371 x_return_status := FND_API.G_RET_STS_SUCCESS;
6372 FND_MESSAGE.SET_NAME('CS','CS_SR_HA_NO_REPLAY');
6373 FND_MSG_PUB.ADD;
6374 FND_MSG_PUB.Count_And_Get
6375 ( p_count => x_msg_count,
6376 p_data => x_msg_data
6377 );
6378
6379 WHEN SR_Lock_Row THEN
6380 IF (l_ServiceRequest_csr%ISOPEN) THEN
6381 CLOSE l_ServiceRequest_csr;
6382 END IF;
6383 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6384 FND_MESSAGE.SET_NAME('FND','FORM_RECORD_CHANGED');
6385 FND_MSG_PUB.ADD;
6386 FND_MSG_PUB.Count_And_Get
6387 ( p_count => x_msg_count,
6388 p_data => x_msg_data
6389 );
6390
6391 --- For BUG # 2933250
6392 WHEN invalid_install_site THEN
6393 ROLLBACK TO Update_ServiceRequest_PVT;
6394 x_return_status := FND_API.G_RET_STS_ERROR;
6395 FND_MESSAGE.SET_NAME('CS','CS_SR_INVALID_INSTALL_SITE');
6396 FND_MSG_PUB.ADD;
6397 FND_MSG_PUB.Count_And_Get
6398 ( p_count => x_msg_count,
6399 p_data => x_msg_data
6400 );
6401
6402 WHEN OTHERS THEN
6403 ROLLBACK TO Update_ServiceRequest_PVT;
6404 IF (l_ServiceRequest_csr%ISOPEN) THEN
6405 CLOSE l_ServiceRequest_csr;
6406 END IF;
6407 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6408 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
6409 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
6410 END IF;
6411 FND_MSG_PUB.Count_And_Get
6412 ( p_count => x_msg_count,
6413 p_data => x_msg_data
6414 );
6415
6416
6417 END Update_ServiceRequest;
6418
6419
6420 -- -------------------------------------------------------------------
6421 -- Update_Status
6422 -- -------------------------------------------------------------------
6423
6424 --p_org_id IN NUMBER DEFAULT NULL,
6425
6426 -- -------- -------- -----------------------------------------------------------
6427 -- Modification History
6428 -- Date Name Desc
6429 -- -------- -------- -----------------------------------------------------------
6430 -- 07/11/05 smisra Rel 12.0 ERES changes
6431 -- call get_status_details procedure for parameter p_status_id
6432 -- if this status has intermediated status id as NOT NULL then
6433 -- called update_servicerequest procedure. This is needed
6434 -- for ERES processing and avoiding duplicate coding in this
6435 -- procedure.
6436 -- 07/15/05 smisra Bug 4489746 modified sql statement for cs_incident_types_b
6437 -- and removed condition on start and end active dates so that
6438 -- API does not give error for those types that become end
6439 -- dated
6440 -- Passed UPDATE_OLD to validate_type call because we need to
6441 -- just check user's access to SR
6442 -- 07/21/05 smisra Bug 3215462
6443 -- Add a call to CS_WF_EVENT_PKG.RAISE_SERVICEREQUEST_EVENT
6444 -- 10/11/05 smisra Bug 4666784
6445 -- called validate_sr_closure and close_sr_children only
6446 -- if close flag associated with status is 'Y'
6447 -- 10/14/05 smisra fixed Bug 4674131
6448 -- based on status id flags set response and resolved dates
6449 -- 04/25/06 spusegao Modofied to check if the existing SR status is an intermediate status with
6450 -- disallow_request_update flag = 'Y'. If yes then disallow any update to
6451 -- the service request.
6452 -- -------- -------- -----------------------------------------------------------
6453 PROCEDURE Update_Status
6454 ( p_api_version IN NUMBER,
6455 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
6456 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
6457 p_resp_id IN NUMBER,
6458 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
6459 x_return_status OUT NOCOPY VARCHAR2,
6460 x_msg_count OUT NOCOPY NUMBER,
6461 x_msg_data OUT NOCOPY VARCHAR2,
6462 p_request_id IN NUMBER,
6463 p_object_version_number IN NUMBER,
6464 p_status_id IN NUMBER,
6465 p_closed_date IN DATE DEFAULT fnd_api.g_miss_date,
6466 p_last_updated_by IN NUMBER,
6467 p_last_update_login IN NUMBER DEFAULT NULL,
6468 p_last_update_date IN DATE,
6469 p_audit_comments IN VARCHAR2 DEFAULT NULL,
6470 p_called_by_workflow IN VARCHAR2 DEFAULT fnd_api.g_false,
6471 p_workflow_process_id IN NUMBER DEFAULT NULL,
6472 p_comments IN VARCHAR2 DEFAULT NULL,
6473 p_public_comment_flag IN VARCHAR2 DEFAULT fnd_api.g_false,
6474 p_parent_interaction_id IN NUMBER DEFAULT NULL,
6475 p_validate_sr_closure IN VARCHAR2 Default 'N',
6476 p_auto_close_child_entities IN VARCHAR2 Default 'N',
6477 x_interaction_id OUT NOCOPY NUMBER
6478 )
6479 IS
6480 l_api_name CONSTANT VARCHAR2(30) := 'Update_Status';
6481 l_api_version CONSTANT NUMBER := 2.0;
6482 l_api_name_full CONSTANT VARCHAR2(62) := G_PKG_NAME||'.'||l_api_name;
6483 l_log_module CONSTANT VARCHAR2(255) := 'cs.plsql.' || l_api_name_full || '.';
6484 l_return_status VARCHAR2(1);
6485 l_orig_status_id NUMBER;
6486 l_closed_flag VARCHAR2(1);
6487 l_orig_closed_date DATE ;
6488 l_disallow_request_update VARCHAR2(1);
6489 l_disallow_owner_update VARCHAR2(1);
6490 l_disallow_product_update VARCHAR2(1);
6491 l_audit_id NUMBER;
6492 l_creation_date DATE;
6493
6494 l_closed_date DATE;
6495 l_audit_vals_rec sr_audit_rec_type;
6496
6497 l_autolaunch_workflow_flag VARCHAR2(1);
6498 l_abort_workflow_close_flag VARCHAR2(1);
6499 l_workflow_process_name VARCHAR2(30);
6500 l_workflow_process_id NUMBER;
6501
6502 -- Added for enh. 2655115
6503 l_status_flag VARCHAR2(1);
6504
6505 --Fixed bug#2775580, getting all the columns in the cursor.
6506
6507 /* ****************
6508 l_old_ServiceRequest_rec is now changed to type sr_oldvalues_rec_type .
6509
6510 Replacing the select list of columns with a select * so that the
6511 subtype defined in the spec can be used to pass the old SR values as
6512 a parameter to other procedures
6513
6514 * *****************/
6515
6516 CURSOR L_SERVICEREQUEST_CSR IS
6517 SELECT *
6518 from cs_incidents_all_vl
6519 where incident_id = p_request_id
6520 and object_version_number = p_object_version_number
6521 for update nowait;
6522
6523 -- The rec type was changed to sr_oldvalues_rec_type as the
6524 -- workitem API (Misc ER owner Auto Assginment )needed a record type
6525 -- with old values , also the API validations needed the oldvalues_rec .
6526
6527 l_ServiceRequest_rec sr_oldvalues_rec_type;
6528 l_new_sr_rec service_request_rec_type;
6529 l_old_sr_rec service_request_rec_type;
6530
6531 -- Local variable to store business usage for security validation
6532 l_business_usage VARCHAR2(30);
6533
6534 -- Local variable to store attribute if security is enabled for self service resps.
6535 l_ss_sr_type_restrict VARCHAR2(10);
6536
6537 -- Local variable to get the return status of validate type for security check
6538 lx_return_status VARCHAR2(3);
6539
6540 l_old_cmro_flag VARCHAR2(3);
6541 l_old_maintenance_flag VARCHAR2(3);
6542
6543 -- Added for Auditing --anmukher --10/15/03
6544 lx_audit_id NUMBER;
6545
6546 l_sr_related_data RELATED_DATA_TYPE;
6547 l_sr_update_out_rec sr_update_out_rec_type;
6548 l_notes notes_table;
6549 l_contacts contacts_table;
6550 l_inc_responded_by_date DATE;
6551 l_incident_resolved_date DATE;
6552 BEGIN
6553
6554 -- ---------------------------------------
6555 -- Standard API stuff
6556 -- ---------------------------------------
6557
6558 -- Establish save point
6559 SAVEPOINT Update_Status_PVT;
6560
6561 -- Check version number
6562 IF NOT FND_API.Compatible_API_Call( l_api_version,
6563 p_api_version,
6564 l_api_name,
6565 G_PKG_NAME ) THEN
6566 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
6567 END IF;
6568
6569 -- Initialize message list if requested
6570 IF FND_API.to_Boolean( p_init_msg_list ) THEN
6571 FND_MSG_PUB.initialize;
6572 END IF;
6573
6574 ----------------------- FND Logging -----------------------------------
6575 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
6576 THEN
6577 FND_LOG.String
6578 ( FND_LOG.level_procedure , L_LOG_MODULE || 'start'
6579 , 'Inside ' || L_API_NAME_FULL || ', called with parameters below:'
6580 );
6581 FND_LOG.String
6582 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6583 , 'p_api_version:' || p_api_version
6584 );
6585 FND_LOG.String
6586 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6587 , 'p_init_msg_list:' || p_init_msg_list
6588 );
6589 FND_LOG.String
6590 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6591 , 'p_commit:' || p_commit
6592 );
6593 FND_LOG.String
6594 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6595 , 'p_validation_level:' || p_validation_level
6596 );
6597 FND_LOG.String
6598 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6599 , 'p_last_updated_by:' || p_last_updated_by
6600 );
6601 FND_LOG.String
6602 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6603 , 'p_resp_id:' || p_resp_id
6604 );
6605 FND_LOG.String
6606 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6607 , 'P_audit_comments:' || P_audit_comments
6608 );
6609 FND_LOG.String
6610 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6611 , 'P_object_version_number:' || P_object_version_number
6612 );
6613 FND_LOG.String
6614 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6615 , 'p_last_update_login:' || p_last_update_login
6616 );
6617 FND_LOG.String
6618 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6619 , 'p_last_update_date:' || p_last_update_date
6620 );
6621 FND_LOG.String
6622 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6623 , 'P_status_id:' || P_status_id
6624 );
6625 FND_LOG.String
6626 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6627 , 'p_parent_interaction_id:' || p_parent_interaction_id
6628 );
6629 FND_LOG.String
6630 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6631 , 'P_Closed_date:' || P_Closed_date
6632 );
6633 FND_LOG.String
6634 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6635 , 'p_request_id:' || p_request_id
6636 );
6637 FND_LOG.String
6638 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6639 , 'p_comments:' || p_comments
6640 );
6641 FND_LOG.String
6642 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6643 , 'P_Public_Comment_Flag:' || P_Public_Comment_Flag
6644 );
6645 FND_LOG.String
6646 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6647 , 'P_Called_by_workflow:' || P_Called_by_workflow
6648 );
6649 FND_LOG.String
6650 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6651 , 'P_Workflow_process_id:' || P_Workflow_process_id
6652 );
6653 FND_LOG.String
6654 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6655 , 'P_Validate_SR_Closure:' || P_Validate_SR_Closure
6656 );
6657 FND_LOG.String
6658 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
6659 , 'P_Auto_Close_Child_Entities:' || P_Auto_Close_Child_Entities
6660 );
6661
6662 END IF;
6663
6664 -- Initialize the New Audit Record ******
6665 Initialize_audit_rec(
6666 p_sr_audit_record => l_audit_vals_rec) ;
6667
6668 -- Initialize return status to SUCCESS
6669 x_return_status := FND_API.G_RET_STS_SUCCESS;
6670
6671 -- Initialize the new record and assign the required values for
6672 -- workitem call
6673
6674 initialize_rec ( p_sr_record => l_new_sr_rec );
6675 initialize_rec ( p_sr_record => l_old_sr_rec );
6676
6677 l_new_sr_rec.status_id := p_status_id ;
6678 l_new_sr_rec.closed_date:= p_closed_date;
6679 l_new_sr_rec.public_comment_flag := p_public_comment_flag;
6680 l_new_sr_rec.parent_interaction_id:= p_parent_interaction_id;
6681
6682 -- ----------------------------------------
6683 -- Open cursor for update
6684 -- ----------------------------------------
6685 OPEN l_ServiceRequest_csr;
6686 FETCH l_ServiceRequest_csr INTO l_ServiceRequest_rec;
6687 IF (l_ServiceRequest_csr%NOTFOUND) THEN
6688
6689 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
6690 ( p_token_an => l_api_name_full,
6691 p_token_v => TO_CHAR(p_request_id),
6692 p_token_p => 'p_request_id',
6693 p_table_name => G_TABLE_NAME,
6694 p_column_name => 'REQUEST_ID');
6695
6696 RAISE FND_API.G_EXC_ERROR;
6697
6698 END IF;
6699 -- --------------------------------------------------------
6700 -- If the new status is the same as old, there's no need
6701 -- to continue
6702 -- --------------------------------------------------------
6703 -- for bug 3640344 - pkesani
6704 IF (p_status_id = l_ServiceRequest_rec.incident_status_id
6705 OR p_status_id = FND_API.G_MISS_NUM) THEN
6706
6707 -- abhgauta - Fix for Bug 6042520
6708 -- Display the Warning that SR Status has not changed, only if SR Status's Disallow Update is unchecked
6709
6710 IF (l_sr_related_data.disallow_request_update <> 'Y') THEN
6711
6712 CS_ServiceRequest_UTIL.Add_Same_Val_Update_Msg
6713 ( p_token_an => l_api_name_full,
6714 p_token_p => 'p_status_id' ,
6715 p_table_name => G_TABLE_NAME,
6716 p_column_name => 'INCIDENT_STATUS_ID');
6717
6718 CLOSE l_ServiceRequest_csr;
6719 RETURN;
6720 END IF;
6721 END IF;
6722
6723 -- -------------------------------------
6724 -- Perform validation when necessary
6725 -- -------------------------------------
6726 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
6727
6728 CS_ServiceRequest_UTIL.Validate_Who_Info(
6729 p_api_name => l_api_name_full,
6730 p_parameter_name_usr => 'p_last_updated_by',
6731 p_parameter_name_login => 'p_last_update_login',
6732 p_user_id => p_last_updated_by,
6733 p_login_id => p_last_update_login,
6734 x_return_status => l_return_status);
6735
6736 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6737 RAISE FND_API.G_EXC_ERROR;
6738 END IF;
6739
6740 -- Service security validation
6741 -- Validate if the current responsibility has access to the SR type being update.
6742 -- Invoke the VALIDATE_TYPE procedure that has the logic to check for security
6743 -- access
6744
6745 -- Get the business usage of the responsibility that is attempting to create
6746 -- the SR.
6747 get_business_usage (
6748 p_responsibility_id => p_resp_id,
6749 p_application_id => fnd_global.resp_appl_id,
6750 x_business_usage => l_business_usage );
6751
6752 -- Get indicator of self service security enabled or not
6753 if ( l_business_usage = 'SELF_SERVICE' ) then
6754 get_ss_sec_enabled (
6755 x_ss_sr_type_restrict => l_ss_sr_type_restrict );
6756 end if;
6757
6758 -- For bug 3370562 - pass resp_id an appl_id
6759 -- validate security in update; first against old sr type
6760 cs_servicerequest_util.validate_type (
6761 p_parameter_name => NULL,
6762 p_type_id => l_servicerequest_rec.incident_type_id,
6763 p_subtype => G_SR_SUBTYPE,
6764 p_status_id => l_servicerequest_rec.incident_status_id, -- not used
6765 p_resp_id => p_resp_id,
6766 p_resp_appl_id => fnd_global.resp_appl_id,
6767 p_business_usage => l_business_usage,
6768 p_ss_srtype_restrict => l_ss_sr_type_restrict,
6769 p_operation => 'UPDATE_OLD',
6770 x_return_status => lx_return_status,
6771 x_cmro_flag => l_old_cmro_flag,
6772 x_maintenance_flag => l_old_maintenance_flag );
6773
6774 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) then
6775 -- security violation; responsibility does not have access to SR Type
6776 -- being created. Stop and raise error.
6777 RAISE FND_API.G_EXC_ERROR;
6778 end if;
6779 END IF; -- IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
6780
6781 -- Get the details of the existing status of SR
6782
6783 CS_SERVICEREQUEST_UTIL.get_status_details
6784 ( p_status_id => l_servicerequest_rec.incident_status_id
6785 , x_close_flag => l_sr_related_data.old_close_flag
6786 , x_disallow_request_update => l_sr_related_data.old_disallow_request_update
6787 , x_disallow_agent_dispatch => l_sr_related_data.old_disallow_owner_update
6788 , x_disallow_product_update => l_sr_related_data.old_disallow_product_update
6789 , x_pending_approval_flag => l_sr_related_data.old_pending_approval_flag
6790 , x_intermediate_status_id => l_sr_related_data.old_intermediate_status_id
6791 , x_approval_action_status_id => l_sr_related_data.old_approval_action_status_id
6792 , x_rejection_action_status_id => l_sr_related_data.old_rejection_action_status_id
6793 , x_return_status => l_return_status);
6794
6795 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
6796
6797 IF (l_sr_related_data.old_pending_approval_flag = 'Y') AND
6798 (l_sr_related_data.old_disallow_request_update = 'Y') THEN
6799 FND_MESSAGE.set_name('CS','CS_ERES_SR_FROZEN_STATUS');
6800 FND_MSG_PUB.ADD;
6801 --FND_MESSAGE.set_name('CS','CS_SR_INTERMEDIATE_STATUS');
6802 --FND_MESSAGE.set_token('API_NAME','CS_SERVICEREQUEST_PVT.update_status');
6803 --FND_MESSAGE.set_token('STATUS_ID',l_servicerequest_rec.incident_status_id);
6804 --FND_MSG_PUB.ADD_DETAIL(p_associated_column1=>'CS_INCIDENTS_ALL_B.incident_status_id');
6805 RAISE FND_API.G_EXC_ERROR;
6806 END IF; -- l_pending approval flag is Y
6807 END IF; -- if after get_status_details call
6808
6809 -- Get the details of the new status
6810 CS_SERVICEREQUEST_UTIL.get_status_details
6811 ( p_status_id => p_status_id
6812 , x_close_flag => l_sr_related_data.close_flag
6813 , x_disallow_request_update => l_sr_related_data.disallow_request_update
6814 , x_disallow_agent_dispatch => l_sr_related_data.disallow_owner_update
6815 , x_disallow_product_update => l_sr_related_data.disallow_product_update
6816 , x_pending_approval_flag => l_sr_related_data.pending_approval_flag
6817 , x_intermediate_status_id => l_sr_related_data.intermediate_status_id
6818 , x_approval_action_status_id => l_sr_related_data.approval_action_status_id
6819 , x_rejection_action_status_id => l_sr_related_data.rejection_action_status_id
6820 , x_return_status => l_return_status
6821 );
6822 IF l_return_status = FND_API.G_RET_STS_SUCCESS
6823 THEN
6824 /*
6825 IF l_sr_related_data.pending_approval_flag = 'Y' THEN
6826 FND_MESSAGE.set_name ('CS', 'CS_SR_INTERMEDIATE_STATUS');
6827 FND_MESSAGE.set_token
6828 ( 'API_NAME'
6829 , 'CS_SERVICEREQUEST_PVT.update_status'
6830 );
6831 FND_MESSAGE.set_token('STATUS_ID',p_status_id);
6832 FND_MSG_PUB.ADD_DETAIL
6833 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.incident_status_id'
6834 );
6835 RAISE FND_API.G_EXC_ERROR;
6836 END IF; -- l_pending approval flag is Y
6837 */
6838 IF l_sr_related_data.intermediate_status_id IS NOT NULL
6839 THEN
6840
6841 CS_ServiceRequest_PVT.Update_ServiceRequest
6842 ( p_api_version => 4.0
6843 , p_init_msg_list => p_init_msg_list
6844 , p_commit => p_commit
6845 , p_validation_level => p_validation_level
6846 , x_return_status => x_return_status
6847 , x_msg_count => x_msg_count
6848 , x_msg_data => x_msg_data
6849 , p_request_id => p_request_id
6850 , p_audit_id => NULL
6851 , p_object_version_number => p_object_version_number
6852 , p_resp_id => p_resp_id
6853 , p_last_updated_by => p_last_updated_by
6854 , p_last_update_login => p_last_update_login
6855 , p_last_update_date => p_last_update_date
6856 , p_service_request_rec => l_new_sr_rec
6857 , p_notes => l_notes
6858 , p_contacts => l_contacts
6859 , p_called_by_workflow => p_called_by_workflow
6860 , p_workflow_process_id => p_workflow_process_id
6861 , p_validate_sr_closure => p_validate_sr_closure
6862 , p_auto_close_child_entities => p_auto_close_child_entities
6863 , x_sr_update_out_rec => l_sr_update_out_rec
6864 );
6865
6866 RETURN;
6867 END IF; -- intermediated status id is not null
6868 END IF; -- if after get_status_details call
6869 -- ------------------------------------------------------------------
6870 -- We ALWAYS have to validate the status because we don't know if the
6871 -- status is a "closed" status, and we need this information in order
6872 -- to set the closed_date variable accordingly
6873 -- ------------------------------------------------------------------
6874 CS_ServiceRequest_UTIL.Validate_Updated_Status(
6875 p_api_name => l_api_name_full,
6876 p_parameter_name => 'p_status_id',
6877 p_resp_id => p_resp_id ,
6878 p_new_status_id => p_status_id,
6879 p_old_status_id => l_ServiceRequest_rec.incident_status_id,
6880 p_subtype => G_SR_SUBTYPE,
6881 p_type_id => l_ServiceRequest_rec.incident_type_id,
6882 p_old_type_id => l_ServiceRequest_rec.incident_type_id,
6883 p_close_flag => l_closed_flag,
6884 p_disallow_request_update => l_disallow_request_update,
6885 p_disallow_owner_update => l_disallow_owner_update,
6886 p_disallow_product_update => l_disallow_product_update,
6887 x_return_status => l_return_status );
6888
6889 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6890 RAISE FND_API.G_EXC_ERROR;
6891 END IF;
6892
6893 -- ------------------------------------------------------------------
6894 -- Cannot close the request by setting the status to a "closed"
6895 -- status when there is an active workflow process in progress.
6896 -- Unless this API itself was called from a workflow process.
6897 -- ------------------------------------------------------------------
6898 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
6899
6900 --Get the abort workflow on close flag from cs_incident_types
6901
6902 BEGIN
6903 -- Initialize the return status.
6904 l_return_status := FND_API.G_RET_STS_SUCCESS;
6905
6906 -- Verify the type ID against the database.
6907
6908 SELECT autolaunch_workflow_flag,
6909 abort_workflow_close_flag,
6910 workflow
6911 INTO l_autolaunch_workflow_flag,
6912 l_abort_workflow_close_flag,
6913 l_workflow_process_name
6914 FROM cs_incident_types_b
6915 WHERE incident_type_id = l_ServiceRequest_rec.incident_type_id
6916 AND incident_subtype = G_SR_SUBTYPE
6917 ;
6918
6919 EXCEPTION
6920
6921 WHEN NO_DATA_FOUND THEN
6922 l_return_status := FND_API.G_RET_STS_ERROR;
6923 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
6924 ( p_token_an => l_api_name_full,
6925 p_token_v => TO_CHAR(l_ServiceRequest_rec.incident_type_id),
6926 p_token_p => 'p_type_id' ,
6927 p_table_name => G_TABLE_NAME,
6928 p_column_name => 'INCIDENT_TYPE_ID');
6929
6930 RAISE FND_API.G_EXC_ERROR;
6931 END ;
6932
6933 --Call Abort workflow, if the status is being changed to CLOSE and the abort workflow on close
6934 IF (l_abort_workflow_close_flag = 'Y') AND (l_closed_flag = 'Y') THEN
6935
6936 IF (CS_Workflow_PKG.Is_Servereq_Item_Active
6937 (p_request_number => l_ServiceRequest_rec.incident_number,
6938 p_wf_process_id => l_ServiceRequest_rec.workflow_process_id ) = 'Y') THEN
6939
6940 CS_Workflow_PUB.Cancel_Servereq_Workflow
6941 ( p_api_version => 1.0,
6942 p_return_status => l_return_status,
6943 p_msg_count => x_msg_count,
6944 p_msg_data => x_msg_data,
6945 p_request_number => l_ServiceRequest_rec.incident_number,
6946 p_wf_process_id => l_ServiceRequest_rec.workflow_process_id,
6947 p_user_id => p_last_updated_by
6948 );
6949 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6950 RAISE FND_API.G_EXC_ERROR;
6951 END IF;
6952 END IF;
6953 END IF;
6954
6955 END IF;
6956
6957 -- ------------------------------------------------------------------
6958 -- Validate and set the closed date. If the status is not a closed
6959 -- status, set the closed date to NULL (and give a warning if the
6960 -- closed date was passed in). If the status is a closed status,
6961 -- then validate the closed date if it was passed in. If not,
6962 -- default sysdate into the closed date.
6963 -- ------------------------------------------------------------------
6964 -- for bug 3640344 - pkesani
6965
6966 IF (l_closed_flag = 'Y') THEN
6967 IF (p_closed_date = FND_API.G_MISS_DATE OR p_closed_date IS NULL) THEN
6968 IF (l_ServiceRequest_rec.close_date IS NULL) THEN
6969 l_closed_date := SYSDATE;
6970 ELSE
6971 l_closed_date := l_ServiceRequest_rec.close_date;
6972 END IF;
6973 ELSE
6974 l_closed_date := p_closed_date;
6975 IF (p_closed_date IS NOT NULL) THEN
6976
6977 CS_ServiceRequest_UTIL.Validate_Closed_Date(
6978 p_api_name => G_PKG_NAME||'.'||l_api_name,
6979 p_parameter_name => 'p_closed_date',
6980 p_closed_date => l_closed_date,
6981 p_request_date => l_ServiceRequest_rec.incident_date,
6982 x_return_status => l_return_status );
6983
6984 END IF;
6985 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
6986 RAISE FND_API.G_EXC_ERROR;
6987 END IF;
6988 END IF;
6989 ELSE
6990 l_closed_date := NULL;
6991
6992 IF (p_closed_date = FND_API.G_MISS_DATE) OR
6993 (p_closed_date IS NULL) THEN
6994 NULL;
6995 ELSE
6996 CS_ServiceRequest_UTIL.Add_Param_Ignored_MSg
6997 ( p_token_an => l_api_name_full,
6998 p_token_ip => 'p_closed_date',
6999 p_table_name => G_TABLE_NAME,
7000 p_column_name => 'CLOSED_DATE');
7001 END IF;
7002 END IF;
7003
7004
7005 --- If the status is updated to close status then,check to see if the
7006 --- SR has any open tasks with restrict flag set to 'Y', If yes, return
7007 --- error ( bug # 3512003).
7008
7009 IF (l_closed_flag = 'Y') THEN
7010 CS_ServiceRequest_UTIL.TASK_RESTRICT_CLOSE_CROSS_VAL (
7011 p_incident_id => p_request_id,
7012 p_status_id => p_status_id,
7013 x_return_status => l_return_status );
7014
7015 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7016 RAISE FND_API.G_EXC_ERROR;
7017 END IF;
7018
7019
7020 -- ----------------------------------------------
7021 -- Code Changes for 11.5.10 Auto Close SR project
7022 -- Restrict closure if SR children cant be closed.
7023 -- ----------------------------------------------
7024
7025 -- For bug 3332985
7026 IF ( p_validate_sr_closure = 'Y' OR p_validate_sr_closure = 'y') THEN
7027 CS_SR_STATUS_PROPAGATION_PKG.VALIDATE_SR_CLOSURE(
7028 p_api_version => p_api_version,
7029 p_init_msg_list => fnd_api.g_false ,
7030 p_commit => p_commit,
7031 p_service_request_id => p_request_id,
7032 p_user_id => p_last_updated_by,
7033 p_resp_appl_id => p_resp_id,
7034 p_login_id => p_last_update_login,
7035 x_return_status => l_return_status,
7036 x_msg_count => x_msg_count ,
7037 x_msg_data => x_msg_data);
7038
7039 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7040 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7041 ELSIF(l_return_status = FND_API.G_RET_STS_SUCCESS) THEN
7042 IF (p_auto_close_child_entities='Y' OR p_auto_close_child_entities='y') THEN
7043
7044 CS_SR_STATUS_PROPAGATION_PKG.CLOSE_SR_CHILDREN(
7045 p_api_version => p_api_version,
7046 p_init_msg_list => fnd_api.g_false ,
7047 p_commit => p_commit,
7048 p_validation_required =>'N',
7049 p_action_required => 'Y',
7050 p_service_request_id => p_request_id,
7051 p_user_id => p_last_updated_by,
7052 p_resp_appl_id => p_resp_id,
7053 p_login_id => p_last_update_login,
7054 x_return_status => l_return_status,
7055 x_msg_count => x_msg_count ,
7056 x_msg_data => x_msg_data);
7057 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7058 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7059 END IF;
7060 END IF;
7061 END IF;
7062 END IF;
7063 END IF;
7064
7065 CS_SERVICEREQUEST_UTIL.get_reacted_resolved_dates
7066 ( p_incident_status_id => p_status_id
7067 , p_old_incident_status_id => l_servicerequest_rec.incident_status_id
7068 , p_old_incident_resolved_date => l_servicerequest_rec.incident_resolved_date
7069 , p_old_inc_responded_by_date => l_servicerequest_rec.inc_responded_by_date
7070 , x_inc_responded_by_date => l_inc_responded_by_date
7071 , x_incident_resolved_date => l_incident_resolved_date
7072 , x_return_status => l_return_status
7073 );
7074 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
7075 THEN
7076 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7077 END IF;
7078 -- ----------------------------------------------
7079 -- Update the status and insert the audit record
7080 -- ----------------------------------------------
7081
7082 l_orig_status_id := l_ServiceRequest_rec.incident_status_id;
7083 l_orig_closed_date := l_ServiceRequest_rec.close_date ;
7084
7085 /* Added call to get_status_flag for enh 2655115, to get the status flag
7086 based on the closed flag by shijain date 27th nov 2002*/
7087
7088 l_status_flag:= get_status_flag ( p_status_id);
7089
7090 -- Update CS_INCIDENTS table
7091 -- for the bug 3027154 - wrong date in the SR Log
7092 UPDATE cs_incidents_all_b
7093 SET incident_status_id = p_status_id,
7094 close_date = l_closed_date,
7095 inc_responded_by_date = l_inc_responded_by_date,
7096 incident_resolved_date= l_incident_resolved_date,
7097 last_updated_by = p_last_updated_by,
7098 last_update_date = SYSDATE,
7099 last_update_login = p_last_update_login,
7100 -- Added for enh. 2655115
7101 status_flag = l_status_flag,
7102 object_version_number = p_object_version_number+1
7103 --Fixed bug#2775580,changed the where clause from current of to
7104 --checking the incident_id
7105 WHERE incident_id = p_request_id;
7106
7107 CLOSE l_ServiceRequest_csr;
7108
7109 -- ------------------------------------------------------
7110 -- Insert a record into the audit table
7111 -- ------------------------------------------------------
7112
7113 --Fixed bug#2775580,added these statements to populate values in all the
7114 --columns with changed flag as N, except status_id and status_flag which are
7115 --the only columns which will be changed by calling this procedure.
7116
7117 -- Commented out this code since call to SR Child Audit API has been added
7118 -- for audit record creation
7119 -- anmukher --10/15/03
7120 -- Removed the commented code which was used for the audit record assignment while calling the old audit api call.
7121 -- spusegao -- 03/23/2004
7122
7123 CS_SR_CHILD_AUDIT_PKG.CS_SR_AUDIT_CHILD
7124 (P_incident_id => p_request_id,
7125 P_updated_entity_code => 'SR_HEADER',
7126 p_updated_entity_id => p_request_id,
7127 p_entity_update_date => SYSDATE,
7128 p_entity_activity_code => 'U' ,
7129 p_status_id => p_status_id,
7130 p_old_status_id => l_orig_status_id,
7131 p_closed_date => l_closed_date,
7132 p_old_closed_date => l_orig_closed_date,
7133 p_owner_status_upd_flag => 'STATUS',
7134 p_user_id => p_last_updated_by,
7135 p_old_inc_responded_by_date => l_servicerequest_rec.inc_responded_by_date,
7136 p_old_incident_resolved_date=> l_servicerequest_rec.incident_resolved_date,
7137 x_audit_id => lx_audit_id,
7138 x_return_status => lx_return_status,
7139 x_msg_count => x_msg_count ,
7140 x_msg_data => x_msg_data );
7141
7142 IF (lx_return_status = FND_API.G_RET_STS_ERROR) THEN
7143 RAISE FND_API.G_EXC_ERROR;
7144 ELSIF (lx_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
7145 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7146 END IF;
7147
7148 -- ------------------------------------------------------
7149 -- Insert a record into the calls table if the caller is
7150 -- not a workflow process
7151 -- ------------------------------------------------------
7152 IF NOT FND_API.To_Boolean(p_called_by_workflow) THEN
7153 IF (l_return_status = fnd_api.g_ret_sts_error) THEN
7154 RAISE fnd_api.g_exc_error;
7155 ELSIF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
7156 RAISE fnd_api.g_exc_unexpected_error;
7157 END IF;
7158 END IF; /* called by workflow */
7159
7160 l_old_sr_rec.type_id := l_servicerequest_rec.incident_type_id;
7161 l_old_sr_rec.status_id := l_servicerequest_rec.incident_status_id;
7162 l_old_sr_rec.severity_id := l_servicerequest_rec.incident_severity_id;
7163 l_old_sr_rec.urgency_id := l_servicerequest_rec.incident_urgency_id;
7164 l_old_sr_rec.owner_id := l_servicerequest_rec.incident_owner_id;
7165 l_old_sr_rec.owner_group_id := l_servicerequest_rec.owner_group_id;
7166 l_old_sr_rec.customer_id := l_servicerequest_rec.customer_id;
7167 l_old_sr_rec.customer_product_id := l_servicerequest_rec.customer_product_id;
7168 l_old_sr_rec.inventory_item_id := l_servicerequest_rec.inventory_item_id;
7169 l_old_sr_rec.problem_code := l_servicerequest_rec.problem_code;
7170 l_old_sr_rec.summary := l_servicerequest_rec.summary;
7171 l_old_sr_rec.exp_resolution_date := l_servicerequest_rec.expected_resolution_date;
7172 l_old_sr_rec.install_site_id := l_servicerequest_rec.install_site_id;
7173 l_old_sr_rec.bill_to_site_id := l_servicerequest_rec.bill_to_site_id;
7174 l_old_sr_rec.bill_to_contact_id := l_servicerequest_rec.bill_to_contact_id;
7175 l_old_sr_rec.ship_to_site_id := l_servicerequest_rec.ship_to_site_id;
7176 l_old_sr_rec.ship_to_contact_id := l_servicerequest_rec.ship_to_contact_id;
7177 l_old_sr_rec.resolution_code := l_servicerequest_rec.resolution_code;
7178 l_old_sr_rec.contract_service_id := l_servicerequest_rec.contract_service_id;
7179 l_old_sr_rec.sr_creation_channel := l_servicerequest_rec.sr_creation_channel;
7180 l_old_sr_rec.last_update_channel := l_servicerequest_rec.last_update_channel;
7181 l_old_sr_rec.last_update_program_code := l_servicerequest_rec.last_update_program_code;
7182
7183 l_new_sr_rec := l_old_sr_rec ;
7184 l_new_sr_rec.status_id := p_status_id ;
7185 l_new_sr_rec.closed_date:= l_closed_date;
7186
7187 CS_WF_EVENT_PKG.RAISE_SERVICEREQUEST_EVENT(
7188 p_api_version => p_api_version,
7189 p_init_msg_list => fnd_api.g_false ,
7190 p_commit => p_commit,
7191 p_validation_level => p_validation_level,
7192 p_event_code => 'UPDATE_SERVICE_REQUEST',
7193 p_incident_number => l_ServiceRequest_rec.incident_number,
7194 p_user_id => p_last_updated_by,
7195 p_resp_id => p_resp_id,
7196 p_resp_appl_id => NULL,
7197 p_old_sr_rec => l_old_sr_rec,
7198 p_new_sr_rec => l_new_sr_rec,
7199 p_contacts_table => l_contacts,
7200 p_link_rec => NULL, -- using default value
7201 p_wf_process_id => p_workflow_process_id,
7202 p_owner_id => NULL, -- using default value
7203 p_wf_manual_launch => 'N' , -- using default value
7204 x_wf_process_id => l_workflow_process_id,
7205 x_return_status => lx_return_status,
7206 x_msg_count => x_msg_count,
7207 x_msg_data => x_msg_data );
7208
7209 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
7210 -- do nothing in this API. The BES wrapper API will have to trap this
7211 -- situation and send a notification to the SR owner that the BES has
7212 -- not been raised. If the BES API return back a failure status, it
7213 -- means only that the BES raise event has failed, and has nothing to
7214 -- do with the update of the SR.
7215 null;
7216 end if;
7217 -- Added this call for Misc ER: Owner auto assignment changes
7218
7219 CS_SR_WORKITEM_PVT.Update_Workitem(
7220 p_api_version => 1.0,
7221 p_init_msg_list => fnd_api.g_false ,
7222 p_commit => p_commit ,
7223 p_incident_id => p_request_id,
7224 p_old_sr_rec => l_ServiceRequest_rec,
7225 p_new_sr_rec => l_new_sr_rec,
7226 p_user_id => p_last_updated_by,
7227 p_resp_appl_id => p_resp_id ,
7228 x_return_status => l_return_status,
7229 x_msg_count => x_msg_count,
7230 x_msg_data => x_msg_data);
7231
7232 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7233 FND_MSG_PUB.Count_And_Get
7234 ( p_count => x_msg_count,
7235 p_data => x_msg_data
7236 );
7237 END IF;
7238
7239 IF FND_API.To_Boolean( p_commit ) THEN
7240 COMMIT WORK;
7241 END IF;
7242
7243 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
7244 p_data => x_msg_data );
7245
7246 EXCEPTION
7247 WHEN FND_API.G_EXC_ERROR THEN
7248 ROLLBACK TO Update_Status_PVT;
7249 IF (l_ServiceRequest_csr%ISOPEN) THEN
7250 CLOSE l_ServiceRequest_csr;
7251 END IF;
7252 x_return_status := FND_API.G_RET_STS_ERROR;
7253 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
7254 p_data => x_msg_data );
7255
7256 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
7257 ROLLBACK TO Update_Status_PVT;
7258 IF (l_ServiceRequest_csr%ISOPEN) THEN
7259 CLOSE l_ServiceRequest_csr;
7260 END IF;
7261 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7262 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
7263 p_data => x_msg_data );
7264
7265 WHEN OTHERS THEN
7266 ROLLBACK TO Update_Status_PVT;
7267 IF (l_ServiceRequest_csr%ISOPEN) THEN
7268 CLOSE l_ServiceRequest_csr;
7269 END IF;
7270 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
7271 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
7272 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,
7273 l_api_name );
7274 END IF;
7275 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
7276 p_data => x_msg_data );
7277
7278 END Update_Status;
7279
7280 -- -----------------------------------------------------------------------------
7281 -- Modification History
7282 -- Date Name Desc
7283 -- -------- --------- ----------------------------------------------------------
7284 -- 03/25/05 smisra Bug 4028675
7285 -- Modified this procedure to determine unassigned indicator
7286 -- and updated SR table with the same
7287 -- 05/27/05 smisra Bug 4227769
7288 -- removed update to cs_incidents_all_tl table because it
7289 -- was updating only obsolete columns owner and group owner.
7290 -- 07/11/05 smisra called get_status_detail for SR status and if disallow
7291 -- request update is Y then raise error
7292 -- 07/11/05 smisra Bug 4489746
7293 -- Passed UPDATE_OLD to validate_type call because we need to
7294 -- just check user's access to SR
7295 -- 07/20/05 smisra if parameter p_owner_group_id is passed as g_miss_num,
7296 -- then g_miss_num is updated into database. to aviod this,
7297 -- added a new variable l_owner_group_id. set this using
7298 -- p_owner_group_id, if p_owner_group_id is g_miss_num then
7299 -- set l_owner_group_id as value from Sr record.
7300 -- Used l_owner_group_id in owner validation and further
7301 -- processing.
7302 -- 07/21/05 smisra Bug 3215462
7303 -- Add a call to CS_WF_EVENT_PKG.RAISE_SERVICEREQUEST_EVENT
7304 -- 12/30/05 smisra Bug 4773215
7305 -- Passed x_resource_type and x_support_site_id to
7306 -- validate owner call
7307 -- Updated incident table with derived value of resource type
7308 -- Passed derived value of resource type to audit procedure
7309 -- -----------------------------------------------------------------------------
7310 PROCEDURE Update_Owner
7311 ( p_api_version IN NUMBER,
7312 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
7313 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
7314 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
7315 x_return_status OUT NOCOPY VARCHAR2,
7316 x_msg_count OUT NOCOPY NUMBER,
7317 x_msg_data OUT NOCOPY VARCHAR2,
7318 p_request_id IN NUMBER,
7319 p_object_version_number IN NUMBER,
7320 p_resp_id IN NUMBER DEFAULT NULL,
7321 p_resp_appl_id IN NUMBER DEFAULT NULL,
7322 p_owner_id IN NUMBER,
7323 p_owner_group_id IN NUMBER,
7324 p_resource_type IN VARCHAR2,
7325 p_last_updated_by IN NUMBER,
7326 p_last_update_login IN NUMBER DEFAULT NULL,
7327 p_last_update_date IN DATE,
7328 p_audit_comments IN VARCHAR2 DEFAULT NULL,
7329 p_called_by_workflow IN VARCHAR2 DEFAULT fnd_api.g_false,
7330 p_workflow_process_id IN NUMBER DEFAULT NULL,
7331 p_comments IN VARCHAR2 DEFAULT NULL,
7332 p_public_comment_flag IN VARCHAR2 DEFAULT fnd_api.g_false,
7333 p_parent_interaction_id IN NUMBER DEFAULT NULL,
7334 x_interaction_id OUT NOCOPY NUMBER
7335 )
7336 IS
7337 l_api_name CONSTANT VARCHAR2(30) := 'Update_Owner';
7338 l_api_version CONSTANT NUMBER := 2.0;
7339 l_api_name_full CONSTANT VARCHAR2(62) := G_PKG_NAME||'.'||l_api_name;
7340 l_log_module CONSTANT VARCHAR2(255) := 'cs.plsql.' || l_api_name_full || '.';
7341 l_return_status VARCHAR2(1);
7342 l_orig_owner_id NUMBER;
7343 l_orig_owner_group_id NUMBER;
7344 l_orig_group_type VARCHAR2(30);
7345 l_orig_resource_type VARCHAR2(30);
7346 l_audit_vals_rec sr_audit_rec_type;
7347 l_msg_id NUMBER;
7348 l_msg_count NUMBER;
7349 l_msg_data VARCHAR2(2000);
7350
7351 p_audit_id NUMBER;
7352
7353 -- Added for bug 2725543
7354 l_group_name VARCHAR2(60);
7355
7356 /* ****************
7357 l_old_ServiceRequest_rec is now changed to type sr_oldvalues_rec_type .
7358
7359 Replacing the select list of columns with a select * so that the
7360 subtype defined in the spec can be used to pass the old SR values as
7361 a parameter to other procedures
7362
7363 * *****************/
7364
7365 CURSOR L_SERVICEREQUEST_CSR IS
7366 SELECT *
7367 from cs_incidents_all_vl
7368 where incident_id = p_request_id
7369 and object_version_number = p_object_version_number
7370 for update of incident_owner_id nowait;
7371
7372 -- This rec type was changed to sr_oldvalues_rec_type as the
7373 -- workitem API (Misc ER owner Auto Assginment )needed a record type
7374 -- with old values , also the API validations needed the oldvalues_rec .
7375
7376 -- l_ServiceRequest_rec l_ServiceRequest_csr%ROWTYPE;
7377 l_ServiceRequest_rec sr_oldvalues_rec_type;
7378 l_new_sr_rec service_request_rec_type;
7379 l_old_sr_rec service_request_rec_type;
7380
7381 l_owner_name VARCHAR2(240);
7382 l_owner_id NUMBER;
7383 l_org_id NUMBER;
7384 l_audit_id NUMBER;
7385
7386 -- Local variable to store business usage for security validation
7387 l_business_usage VARCHAR2(30);
7388
7389 -- Local variable to store attribute if security is enabled for self service resps.
7390 l_ss_sr_type_restrict VARCHAR2(10);
7391
7392 -- Local variable to get the return status of validate type for security check
7393 lx_return_status VARCHAR2(3);
7394
7395 l_old_cmro_flag VARCHAR2(3);
7396 l_old_maintenance_flag VARCHAR2(3);
7397
7398 -- Added for Auditing --anmukher --10/15/03
7399 lx_audit_id NUMBER;
7400 l_unasgn_ind NUMBER;
7401 l_sr_related_data RELATED_DATA_TYPE;
7402 l_owner_group_id jtf_rs_groups_b.group_id % TYPE;
7403 l_workflow_process_id NUMBER;
7404 l_contacts contacts_table;
7405 l_resource_type cs_incidents_all_b.resource_type % TYPE;
7406 l_support_site_id cs_incidents_all_b.site_id % TYPE;
7407
7408 BEGIN
7409
7410 -- ---------------------------------------
7411 -- Standard API stuff
7412 -- ---------------------------------------
7413 -- Establish savepoint
7414 SAVEPOINT Update_Owner_PVT;
7415
7416 -- Check version number
7417 IF NOT FND_API.Compatible_API_Call( l_api_version,
7418 p_api_version,
7419 l_api_name,
7420 G_PKG_NAME )
7421 THEN
7422 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7423 END IF;
7424
7425 -- Initialize message list if requested
7426 IF FND_API.to_Boolean( p_init_msg_list ) THEN
7427 FND_MSG_PUB.initialize;
7428 END IF;
7429
7430 -- Initialize return status to SUCCESS
7431 x_return_status := FND_API.G_RET_STS_SUCCESS;
7432
7433 ----------------------- FND Logging -----------------------------------
7434 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
7435 THEN
7436 FND_LOG.String
7437 ( FND_LOG.level_procedure , L_LOG_MODULE || 'start'
7438 , 'Inside ' || L_API_NAME_FULL || ', called with parameters below:'
7439 );
7440 FND_LOG.String
7441 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7442 , 'p_api_version:' || p_api_version
7443 );
7444 FND_LOG.String
7445 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7446 , 'p_init_msg_list:' || p_init_msg_list
7447 );
7448 FND_LOG.String
7449 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7450 , 'p_commit:' || p_commit
7451 );
7452 FND_LOG.String
7453 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7454 , 'p_validation_level:' || p_validation_level
7455 );
7456 FND_LOG.String
7457 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7458 , 'p_resp_appl_id:' || p_resp_appl_id
7459 );
7460 FND_LOG.String
7461 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7462 , 'p_resp_id:' || p_resp_id
7463 );
7464 FND_LOG.String
7465 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7466 , 'P_audit_comments:' || P_audit_comments
7467 );
7468 FND_LOG.String
7469 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7470 , 'P_object_version_number:' || P_object_version_number
7471 );
7472 FND_LOG.String
7473 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7474 , 'p_last_updated_by:' || p_last_updated_by
7475 );
7476 FND_LOG.String
7477 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7478 , 'p_last_update_login:' || p_last_update_login
7479 );
7480 FND_LOG.String
7481 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7482 , 'p_last_update_date:' || p_last_update_date
7483 );
7484 FND_LOG.String
7485 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7486 , 'P_owner_id:' || P_owner_id
7487 );
7488 FND_LOG.String
7489 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7490 , 'P_owner_group_id:' || P_owner_group_id
7491 );
7492 FND_LOG.String
7493 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7494 , 'P_Resource_Type:' || P_Resource_Type
7495 );
7496 FND_LOG.String
7497 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7498 , 'p_request_id:' || p_request_id
7499 );
7500 FND_LOG.String
7501 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7502 , 'p_parent_interaction_id:' || p_parent_interaction_id
7503 );
7504 FND_LOG.String
7505 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7506 , 'P_Public_Comment_Flag:' || P_Public_Comment_Flag
7507 );
7508 FND_LOG.String
7509 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7510 , 'P_Called_by_workflow:' || P_Called_by_workflow
7511 );
7512 FND_LOG.String
7513 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7514 , 'P_Workflow_process_id:' || P_Workflow_process_id
7515 );
7516 FND_LOG.String
7517 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7518 , 'P_audit_comments:' || P_audit_comments
7519 );
7520 FND_LOG.String
7521 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
7522 , 'P_Comments:' || P_Comments
7523 );
7524
7525 END IF;
7526
7527 -- Initialize the New Audit Record ******
7528 Initialize_audit_rec(
7529 p_sr_audit_record => l_audit_vals_rec) ;
7530 -- Initialize the new record and assign the required values for
7531 -- workitem call
7532
7533 initialize_rec ( p_sr_record => l_new_sr_rec );
7534
7535 l_new_sr_rec.owner_id := p_owner_id ;
7536 l_new_sr_rec.resource_type := p_resource_type;
7537 l_new_sr_rec.public_comment_flag := p_public_comment_flag;
7538 l_new_sr_rec.parent_interaction_id:= p_parent_interaction_id;
7539
7540
7541 -- ----------------------------------------
7542 -- Open cursor for update
7543 -- ----------------------------------------
7544 -- Fetch the record for update
7545 OPEN l_ServiceRequest_csr;
7546 FETCH l_ServiceRequest_csr INTO l_ServiceRequest_rec;
7547 IF (l_ServiceRequest_csr%NOTFOUND) THEN
7548
7549 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg(
7550 p_token_an => l_api_name_full,
7551 p_token_v => TO_CHAR(p_request_id),
7552 p_token_p => 'p_request_id',
7553 p_table_name => G_TABLE_NAME,
7554 p_column_name => 'REQUEST_ID' );
7555
7556 RAISE FND_API.G_EXC_ERROR;
7557 END IF;
7558
7559 IF p_owner_group_id = FND_API.G_MISS_NUM
7560 THEN
7561 l_owner_group_id := l_servicerequest_rec.owner_group_id;
7562 ELSE
7563 l_owner_group_id := p_owner_group_id;
7564 END IF;
7565 l_new_sr_rec.owner_group_id:= l_owner_group_id;
7566 -- --------------------------------------------------------
7567 -- If the new owner is the same as old, there's no need
7568 -- to continue
7569 -- --------------------------------------------------------
7570 IF ((p_owner_id = l_ServiceRequest_rec.incident_owner_id) AND
7571 (l_owner_group_id = l_ServiceRequest_rec.owner_group_id) ) THEN
7572
7573 CS_ServiceRequest_UTIL.Add_Same_Val_Update_Msg(
7574 p_token_an => l_api_name_full,
7575 p_token_p => 'p_owner_id/p_owner_group_id',
7576 p_table_name => G_TABLE_NAME,
7577 p_column_name => 'OWNER_GROUP_ID');
7578
7579 CLOSE l_ServiceRequest_csr;
7580 RETURN;
7581 END IF;
7582
7583 -- -------------------------------------
7584 -- Perform validation when necessary
7585 -- -------------------------------------
7586 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
7587 CS_ServiceRequest_UTIL.Validate_Who_Info(
7588 p_api_name => l_api_name_full,
7589 p_parameter_name_usr => 'p_last_updated_by',
7590 p_parameter_name_login => 'p_last_update_login',
7591 p_user_id => p_last_updated_by,
7592 p_login_id => p_last_update_login,
7593 x_return_status => l_return_status );
7594
7595 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7596
7597 RAISE FND_API.G_EXC_ERROR;
7598 END IF;
7599
7600 -- Service security validation
7601 -- Validate if the current responsibility has access to the SR being update.
7602 -- Invoke the VALIDATE_TYPE procedure that has the logic to check for security
7603 -- access
7604
7605 -- Get the business usage of the responsibility that is attempting to create
7606 -- the SR.
7607 get_business_usage (
7608 p_responsibility_id => p_resp_id,
7609 p_application_id => fnd_global.resp_appl_id,
7610 x_business_usage => l_business_usage );
7611
7612 -- Get indicator of self service security enabled or not
7613 if ( l_business_usage = 'SELF_SERVICE' ) then
7614 get_ss_sec_enabled (
7615 x_ss_sr_type_restrict => l_ss_sr_type_restrict );
7616 end if;
7617
7618 -- For bug 3370562 - pass resp_id an appl_id
7619 -- validate security in update; first against old sr type
7620 cs_servicerequest_util.validate_type (
7621 p_parameter_name => NULL,
7622 p_type_id => l_servicerequest_rec.incident_type_id,
7623 p_subtype => G_SR_SUBTYPE,
7624 p_status_id => l_servicerequest_rec.incident_status_id, -- not used
7625 p_resp_id => p_resp_id,
7626 p_resp_appl_id => fnd_global.resp_appl_id,
7627 p_business_usage => l_business_usage,
7628 p_ss_srtype_restrict => l_ss_sr_type_restrict,
7629 p_operation => 'UPDATE_OLD',
7630 x_return_status => lx_return_status,
7631 x_cmro_flag => l_old_cmro_flag,
7632 x_maintenance_flag => l_old_maintenance_flag );
7633
7634 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) then
7635 -- security violation; responsibility does not have access to SR Type
7636 -- being created. Stop and raise error.
7637 RAISE FND_API.G_EXC_ERROR;
7638 end if;
7639 CS_SERVICEREQUEST_UTIL.get_status_details
7640 ( p_status_id => l_servicerequest_rec.incident_status_id
7641 , x_close_flag => l_sr_related_data.close_flag
7642 , x_disallow_request_update => l_sr_related_data.disallow_request_update
7643 , x_disallow_agent_dispatch => l_sr_related_data.disallow_owner_update
7644 , x_disallow_product_update => l_sr_related_data.disallow_product_update
7645 , x_pending_approval_flag => l_sr_related_data.pending_approval_flag
7646 , x_intermediate_status_id => l_sr_related_data.intermediate_status_id
7647 , x_approval_action_status_id => l_sr_related_data.approval_action_status_id
7648 , x_rejection_action_status_id => l_sr_related_data.rejection_action_status_id
7649 , x_return_status => l_return_status
7650 );
7651 IF l_sr_related_data.disallow_request_update = 'Y'
7652 THEN
7653 FND_MESSAGE.set_name('CS', 'CS_API_SR_ONLY_STATUS_UPDATED');
7654 FND_MESSAGE.set_token('API_NAME', l_api_name_full);
7655 FND_MSG_PUB.add_detail
7656 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.INCIDENT_OWNER_ID'
7657 );
7658 RAISE FND_API.G_EXC_ERROR;
7659 END IF;
7660
7661 --
7662 -- Can't update the owner when there's an active workflow process
7663 --
7664 IF (l_ServiceRequest_rec.workflow_process_id IS NOT NULL) AND
7665 CS_Workflow_PKG.Is_Servereq_Item_Active
7666 ( p_request_number => l_ServiceRequest_rec.incident_number,
7667 p_wf_process_id => l_ServiceRequest_rec.workflow_process_id)
7668 = 'Y'
7669 AND ((FND_API.To_Boolean(p_called_by_workflow) = FALSE)
7670 OR (l_ServiceRequest_rec.incident_owner_id IS NOT NULL
7671 AND p_owner_id IS NULL)
7672 OR (l_ServiceRequest_rec.owner_group_id <> l_owner_group_id)
7673 OR (NOT (l_ServiceRequest_rec.workflow_process_id=p_workflow_process_id)))
7674 THEN
7675 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
7676 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_OWNER_READONLY');
7677 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
7678 FND_MSG_PUB.ADD;
7679 END IF;
7680 RAISE FND_API.G_EXC_ERROR;
7681 END IF;
7682
7683 --Commented this code after moving it to CS_SR_AUDIT_CHILD API
7684 --in CS_SR_CHILD_AUDIT package. This API will be calling the Child
7685 -- Audit API henceforth for audit record creation.
7686 -- anmukher --10/16/03
7687 /* Made changes by shijain for bug 2747616*/
7688 /*
7689 l_orig_owner_id := l_ServiceRequest_rec.incident_owner_id;
7690 l_orig_owner_group_id := l_ServiceRequest_rec.owner_group_id;
7691 l_orig_group_type := l_ServiceRequest_rec.group_type;
7692 l_orig_resource_type := l_ServiceRequest_rec.resource_type;
7693
7694 IF ((p_owner_id IS NOT NULL
7695 AND l_orig_owner_id IS NULL)
7696 OR (p_owner_id IS NULL
7697 AND l_orig_owner_id IS NOT NULL)
7698 OR (p_owner_id IS NOT NULL
7699 AND l_orig_owner_id IS NOT NULL
7700 AND p_owner_id <> l_orig_owner_id)) THEN
7701
7702 l_audit_vals_rec.CHANGE_INCIDENT_OWNER_FLAG := 'Y';
7703 l_audit_vals_rec.OLD_INCIDENT_OWNER_ID := l_orig_owner_id;
7704 l_audit_vals_rec.INCIDENT_OWNER_ID := p_owner_id;
7705 ELSE
7706 l_audit_vals_rec.CHANGE_INCIDENT_OWNER_FLAG := 'N';
7707 l_audit_vals_rec.OLD_INCIDENT_OWNER_ID := l_orig_owner_id;
7708 l_audit_vals_rec.INCIDENT_OWNER_ID := l_orig_owner_id;
7709 END IF;
7710
7711 IF ((p_owner_group_id IS NOT NULL
7712 AND l_orig_owner_group_id IS NULL)
7713 OR (p_owner_group_id IS NULL
7714 AND l_orig_owner_group_id IS NOT NULL)
7715 OR (p_owner_group_id IS NOT NULL
7716 AND l_orig_owner_group_id IS NOT NULL
7717 AND p_owner_group_id <> l_orig_owner_group_id)) THEN
7718
7719 l_audit_vals_rec.change_group_flag := 'Y';
7720 l_audit_vals_rec.old_group_id := l_orig_owner_group_id ;
7721 l_audit_vals_rec.group_id := p_owner_group_id ;
7722 ELSE
7723 l_audit_vals_rec.change_group_flag := 'N';
7724 l_audit_vals_rec.old_group_id := l_orig_owner_group_id ;
7725 l_audit_vals_rec.group_id := l_orig_owner_group_id ;
7726 END IF;
7727
7728 IF (p_owner_group_id IS NOT NULL AND p_owner_group_id<>FND_API.G_MISS_NUM)
7729 THEN
7730 l_audit_vals_rec.group_type:='RS_GROUP';
7731 ELSE
7732 l_audit_vals_rec.group_type:=NULL;
7733 END IF;
7734
7735 IF ((l_audit_vals_rec.group_type IS NOT NULL
7736 AND l_audit_vals_rec.old_group_type IS NULL)
7737 OR (l_audit_vals_rec.group_type IS NULL
7738 AND l_audit_vals_rec.old_group_type IS NOT NULL))
7739 THEN
7740 l_audit_vals_rec.change_group_type_flag := 'Y';
7741 l_audit_vals_rec.old_group_type := l_orig_group_type ;
7742 ELSE
7743 l_audit_vals_rec.change_group_type_flag := 'N';
7744 l_audit_vals_rec.old_group_type := l_orig_group_type ;
7745 l_audit_vals_rec.group_type := l_orig_group_type ;
7746 END IF;
7747
7748 IF ((p_resource_type IS NOT NULL
7749 AND l_orig_resource_type IS NULL)
7750 OR (p_resource_type IS NULL
7751 AND l_orig_resource_type IS NOT NULL)
7752 OR (p_resource_type IS NOT NULL
7753 AND l_orig_resource_type IS NOT NULL
7754 AND p_resource_type <> l_orig_resource_type)) THEN
7755
7756 l_audit_vals_rec.change_resource_type_flag := 'Y';
7757 l_audit_vals_rec.old_resource_type := l_orig_resource_type ;
7758 l_audit_vals_rec.resource_type := p_resource_type ;
7759 ELSE
7760 l_audit_vals_rec.change_resource_type_flag := 'N';
7761 l_audit_vals_rec.old_resource_type := l_orig_resource_type ;
7762 l_audit_vals_rec.resource_type := l_orig_resource_type ;
7763 END IF;
7764 */
7765
7766 -- Added for bug 2725543
7767 IF (p_owner_group_id <> FND_API.G_MISS_NUM) THEN
7768 CS_ServiceRequest_UTIL.Validate_Group_Id
7769 ( p_api_name => l_api_name_full,
7770 p_parameter_name => 'p_owner_group_id',
7771 p_group_type => 'RS_GROUP',
7772 p_owner_group_id => p_owner_group_id,
7773 x_group_name => l_group_name,
7774 x_return_status => l_return_status
7775 );
7776
7777 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7778 RAISE FND_API.G_EXC_ERROR;
7779 END IF;
7780 END IF;
7781
7782 CS_ServiceRequest_UTIL.Validate_Owner
7783 ( p_api_name => l_api_name_full
7784 , p_parameter_name => 'p_owner_id'
7785 , p_owner_id => p_owner_id
7786 , p_group_type => 'RS_GROUP'
7787 , p_owner_group_id => l_owner_group_id
7788 , p_org_id => l_org_id
7789 , p_incident_type_id => l_ServiceRequest_rec.incident_type_id -- new for 11.5.10
7790 , x_owner_name => l_owner_name
7791 , x_owner_id => l_owner_id
7792 , x_resource_type => l_resource_type
7793 , x_support_site_id => l_support_site_id
7794 , x_return_status => l_return_status
7795 );
7796
7797 IF (l_owner_id IS NULL)
7798 THEN
7799 RAISE FND_API.G_EXC_ERROR;
7800 END IF;
7801
7802 END IF;
7803
7804 -- Get unassigned_indicator
7805 l_unasgn_ind := CS_SERVICEREQUEST_UTIL.get_unassigned_indicator(p_owner_id, l_owner_group_id);
7806 -- ----------------------------------------------
7807 -- Update the owner and insert the audit record
7808 -- ----------------------------------------------
7809 -- Update CS_INCIDENTS table
7810
7811 UPDATE cs_incidents_all_b
7812 SET incident_owner_id = p_owner_id,
7813 owner_group_id = l_owner_group_id,
7814 resource_type = l_resource_type,
7815 last_updated_by = p_last_updated_by,
7816 last_update_date = p_last_update_date,
7817 last_update_login = p_last_update_login,
7818 unassigned_indicator = l_unasgn_ind,
7819 object_version_number = p_object_version_number+1
7820 WHERE incident_id = p_request_id ;
7821
7822 CLOSE l_ServiceRequest_csr;
7823 -- ------------------------------------------------------
7824 -- Insert a record into the audit table --- check for audit
7825 -- ------------------------------------------------------
7826 --added this code on dec 14th, so that workflow can call this api
7827 --and the audit will work accordingly
7828 --Since this is update owner, all the other atributes will not be updated,
7829 --hence just use the values sitting in the db as the current values for log.
7830 --Put this field value in the audit table, dont set flag
7831
7832 -- Commented out this code since a call to CS_SR_AUDIT_CHILD API is being added
7833 -- anmukher -- 10/15/03
7834 -- Removed the commented code used to populate the audit record structure which was used by the old call to
7835 -- the audit API. This call is replaced by the new call to the new child audit API.
7836
7837 -- Added call to Child Audit API for audit record creation
7838 --anmukher --10/15/03
7839
7840 l_orig_owner_id := l_ServiceRequest_rec.incident_owner_id;
7841 l_orig_owner_group_id := l_ServiceRequest_rec.owner_group_id;
7842 l_orig_resource_type := l_ServiceRequest_rec.resource_type ;
7843
7844 CS_SR_CHILD_AUDIT_PKG.CS_SR_AUDIT_CHILD
7845 (P_incident_id => p_request_id,
7846 P_updated_entity_code => 'SR_HEADER',
7847 p_updated_entity_id => p_request_id,
7848 p_entity_update_date => p_last_update_date, -- sysdate
7849 p_entity_activity_code => 'U' ,
7850 p_owner_id => p_owner_id,
7851 p_old_owner_id => l_orig_owner_id,
7852 p_owner_group_id => l_owner_group_id,
7853 p_old_owner_group_id => l_orig_owner_group_id,
7854 p_resource_type => l_resource_type,
7855 p_old_resource_type => l_orig_resource_type,
7856 p_owner_status_upd_flag => 'OWNER',
7857 p_useR_id => p_last_updated_by,
7858 x_audit_id => lx_audit_id,
7859 x_return_status => lx_return_status,
7860 x_msg_count => x_msg_count ,
7861 x_msg_data => x_msg_data );
7862
7863 IF (lx_return_status = FND_API.G_RET_STS_ERROR) THEN
7864 RAISE FND_API.G_EXC_ERROR;
7865 ELSIF (lx_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
7866 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7867 END IF;
7868
7869 -- ------------------------------------------------------
7870 -- Insert a record into the calls table if the caller is
7871 -- not a workflow process
7872 -- ------------------------------------------------------
7873 IF NOT FND_API.To_Boolean(p_called_by_workflow) THEN
7874 IF (p_parent_interaction_id IS NULL) THEN
7875 /* CREATE INTERACTION */ /* l_interaction_id := */
7876 NULL;
7877 END IF;
7878
7879 --
7880 -- Create INTERACTION_ACTIVITY
7881 --
7882
7883 IF (l_return_status = fnd_api.g_ret_sts_error) THEN
7884 RAISE fnd_api.g_exc_error;
7885 ELSIF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
7886 RAISE fnd_api.g_exc_unexpected_error;
7887 END IF;
7888 END IF; /* called by workflow */
7889
7890 l_old_sr_rec.type_id := l_servicerequest_rec.incident_type_id;
7891 l_old_sr_rec.status_id := l_servicerequest_rec.incident_status_id;
7892 l_old_sr_rec.severity_id := l_servicerequest_rec.incident_severity_id;
7893 l_old_sr_rec.urgency_id := l_servicerequest_rec.incident_urgency_id;
7894 l_old_sr_rec.owner_id := l_servicerequest_rec.incident_owner_id;
7895 l_old_sr_rec.owner_group_id := l_servicerequest_rec.owner_group_id;
7896 l_old_sr_rec.customer_id := l_servicerequest_rec.customer_id;
7897 l_old_sr_rec.customer_product_id := l_servicerequest_rec.customer_product_id;
7898 l_old_sr_rec.inventory_item_id := l_servicerequest_rec.inventory_item_id;
7899 l_old_sr_rec.problem_code := l_servicerequest_rec.problem_code;
7900 l_old_sr_rec.summary := l_servicerequest_rec.summary;
7901 l_old_sr_rec.exp_resolution_date := l_servicerequest_rec.expected_resolution_date;
7902 l_old_sr_rec.install_site_id := l_servicerequest_rec.install_site_id;
7903 l_old_sr_rec.bill_to_site_id := l_servicerequest_rec.bill_to_site_id;
7904 l_old_sr_rec.bill_to_contact_id := l_servicerequest_rec.bill_to_contact_id;
7905 l_old_sr_rec.ship_to_site_id := l_servicerequest_rec.ship_to_site_id;
7906 l_old_sr_rec.ship_to_contact_id := l_servicerequest_rec.ship_to_contact_id;
7907 l_old_sr_rec.resolution_code := l_servicerequest_rec.resolution_code;
7908 l_old_sr_rec.contract_service_id := l_servicerequest_rec.contract_service_id;
7909 l_old_sr_rec.sr_creation_channel := l_servicerequest_rec.sr_creation_channel;
7910 l_old_sr_rec.last_update_channel := l_servicerequest_rec.last_update_channel;
7911 l_old_sr_rec.last_update_program_code := l_servicerequest_rec.last_update_program_code;
7912
7913 l_new_sr_rec := l_old_sr_rec ;
7914 l_new_sr_rec.owner_id := p_owner_id ;
7915 l_new_sr_rec.resource_type := p_resource_type ;
7916 l_new_sr_rec.owner_group_id := l_owner_group_id;
7917
7918 CS_WF_EVENT_PKG.RAISE_SERVICEREQUEST_EVENT(
7919 p_api_version => p_api_version,
7920 p_init_msg_list => fnd_api.g_false ,
7921 p_commit => p_commit,
7922 p_validation_level => p_validation_level,
7923 p_event_code => 'UPDATE_SERVICE_REQUEST',
7924 p_incident_number => l_ServiceRequest_rec.incident_number,
7925 p_user_id => p_last_updated_by,
7926 p_resp_id => p_resp_id,
7927 p_resp_appl_id => p_resp_appl_id,
7928 p_old_sr_rec => l_old_sr_rec,
7929 p_new_sr_rec => l_new_sr_rec,
7930 p_contacts_table => l_contacts,
7931 p_link_rec => NULL, -- using default value
7932 p_wf_process_id => p_workflow_process_id,
7933 p_owner_id => NULL, -- using default value
7934 p_wf_manual_launch => 'N' , -- using default value
7935 x_wf_process_id => l_workflow_process_id,
7936 x_return_status => lx_return_status,
7937 x_msg_count => x_msg_count,
7938 x_msg_data => x_msg_data );
7939
7940 if ( lx_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
7941 -- do nothing in this API. The BES wrapper API will have to trap this
7942 -- situation and send a notification to the SR owner that the BES has
7943 -- not been raised. If the BES API return back a failure status, it
7944 -- means only that the BES raise event has failed, and has nothing to
7945 -- do with the update of the SR.
7946 null;
7947 end if;
7948
7949 -- Added this call for Misc ER: Owner auto assignment changes
7950
7951 CS_SR_WORKITEM_PVT.Update_Workitem(
7952 p_api_version => 1.0,
7953 p_init_msg_list => fnd_api.g_false ,
7954 p_commit => p_commit ,
7955 p_incident_id => p_request_id,
7956 p_old_sr_rec => l_ServiceRequest_rec,
7957 p_new_sr_rec => l_new_sr_rec,
7958 p_user_id => p_last_updated_by,
7959 p_resp_appl_id => p_resp_id ,
7960 x_return_status => l_return_status,
7961 x_msg_count => x_msg_count,
7962 x_msg_data => x_msg_data);
7963
7964 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
7965 FND_MSG_PUB.Count_And_Get
7966 ( p_count => x_msg_count,
7967 p_data => x_msg_data
7968 );
7969 END IF;
7970
7971
7972 IF FND_API.To_Boolean( p_commit ) THEN
7973 COMMIT WORK;
7974 END IF;
7975
7976 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
7977 p_data => x_msg_data );
7978
7979 EXCEPTION
7980 WHEN FND_API.G_EXC_ERROR THEN
7981 ROLLBACK TO Update_Owner_PVT;
7982
7983 IF (l_ServiceRequest_csr%ISOPEN) THEN
7984 CLOSE l_ServiceRequest_csr;
7985 END IF;
7986
7987 x_return_status := FND_API.G_RET_STS_ERROR;
7988
7989 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
7990 p_data => x_msg_data );
7991
7992 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
7993 ROLLBACK TO Update_Owner_PVT;
7994
7995 IF (l_ServiceRequest_csr%ISOPEN) THEN
7996 CLOSE l_ServiceRequest_csr;
7997 END IF;
7998
7999 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8000
8001 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8002 p_data => x_msg_data );
8003
8004 WHEN OTHERS THEN
8005 ROLLBACK TO Update_Owner_PVT;
8006
8007 IF (l_ServiceRequest_csr%ISOPEN) THEN
8008 CLOSE l_ServiceRequest_csr;
8009 END IF;
8010
8011 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8012
8013 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
8014 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name );
8015 END IF;
8016
8017 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8018 p_data => x_msg_data );
8019
8020 END Update_Owner;
8021
8022 -- -------------------------------------------------------------------
8023 -- Create_Audit_Record
8024 -- -------------------------------------------------------------------
8025 PROCEDURE Create_Audit_Record (
8026 p_api_version IN NUMBER,
8027 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE,
8028 p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE,
8029 x_return_status OUT NOCOPY VARCHAR2,
8030 x_msg_count OUT NOCOPY NUMBER,
8031 x_msg_data OUT NOCOPY VARCHAR2,
8032 p_request_id IN NUMBER,
8033 p_audit_id IN NUMBER,
8034 p_audit_vals_rec IN sr_audit_rec_type,
8035 p_action_id IN NUMBER DEFAULT FND_API.G_MISS_NUM,
8036 p_wf_process_name IN VARCHAR2 DEFAULT FND_API.G_MISS_CHAR,
8037 p_wf_process_itemkey IN VARCHAR2 DEFAULT FND_API.G_MISS_CHAR,
8038 p_user_id IN NUMBER,
8039 p_login_id IN NUMBER DEFAULT NULL,
8040 p_last_update_date IN DATE,
8041 p_creation_date IN DATE,
8042 p_comments IN VARCHAR2 DEFAULT NULL,
8043 x_audit_id OUT NOCOPY NUMBER
8044 ) IS
8045 l_api_name CONSTANT VARCHAR2(30) := 'Create_Audit_Record';
8046 l_api_version CONSTANT NUMBER := 2.0;
8047 l_audit_id NUMBER;
8048 l_incident_audit_id NUMBER;
8049 l_audit_vals_rec sr_audit_rec_type := p_audit_vals_rec;
8050
8051 BEGIN
8052 -- Establish savepoint
8053 SAVEPOINT Create_Audit_Record_PVT;
8054
8055 -- Check version number
8056 IF NOT FND_API.Compatible_API_Call( l_api_version,
8057 p_api_version,
8058 l_api_name,
8059 G_PKG_NAME ) THEN
8060 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
8061 END IF;
8062
8063 -- Initialize message list if requested
8064 IF FND_API.to_Boolean( p_init_msg_list ) THEN
8065 FND_MSG_PUB.initialize;
8066 END IF;
8067
8068 -- Initialize return status to SUCCESS
8069 x_return_status := FND_API.G_RET_STS_SUCCESS;
8070
8071 -- Added code for bug# 1874546------jngeorge ------07/18/01
8072 -- Check if owner has changed
8073 IF (p_audit_vals_rec.change_incident_owner_flag = 'Y' ) THEN
8074 IF (l_audit_vals_rec.old_resource_type = l_audit_vals_rec.resource_type ) THEN
8075 l_audit_vals_rec.change_resource_type_flag :='N';
8076 END IF;
8077 END IF;
8078
8079 IF (p_audit_vals_rec.create_manual_action = 'Y') THEN
8080 IF (p_action_id <> FND_API.G_MISS_NUM) THEN
8081 l_audit_vals_rec.action_id := p_action_id;
8082 END IF;
8083 END IF;
8084
8085 -- Check for new workflow
8086 IF (p_audit_vals_rec.new_workflow_flag = 'Y') THEN
8087 IF (p_wf_process_name <> FND_API.G_MISS_CHAR) THEN
8088 l_audit_vals_rec.workflow_process_name := p_wf_process_name;
8089 END IF;
8090
8091 IF (p_wf_process_itemkey <> FND_API.G_MISS_CHAR) THEN
8092 l_audit_vals_rec.workflow_process_itemkey := p_wf_process_itemkey;
8093 END IF;
8094 END IF;
8095
8096 --------Added code for bug# 1874546------jngeorge ------07/18/01
8097 IF (p_audit_vals_rec.change_resource_type_flag = 'Y') AND
8098 (p_audit_vals_rec.old_resource_type <> p_audit_vals_rec.resource_type) THEN
8099 l_audit_vals_rec.old_resource_type := p_audit_Vals_rec.old_resource_type;
8100 l_audit_vals_rec.resource_type := p_audit_Vals_rec.resource_type;
8101 ELSE
8102 IF (p_audit_vals_rec.change_incident_owner_flag = 'N' ) THEN
8103 l_audit_vals_rec.resource_type := p_audit_Vals_rec.resource_type;
8104 END IF;
8105 END IF;
8106
8107 IF (p_audit_id IS NOT NULL AND
8108 p_audit_id <> FND_API.G_MISS_NUM) THEN
8109 l_audit_id := p_audit_id;
8110 ELSE
8111 SELECT cs_incidents_audit_s1.NEXTVAL INTO l_audit_id FROM dual;
8112 x_audit_id := l_audit_id;
8113 END IF;
8114
8115 INSERT INTO cs_incidents_audit_b (
8116 incident_audit_id ,
8117 incident_id ,
8118 last_update_date ,
8119 last_updated_by ,
8120 creation_date ,
8121 created_by ,
8122 last_update_login ,
8123 creation_time ,
8124 incident_status_id ,
8125 old_incident_status_id ,
8126 change_incident_status_flag ,
8127 incident_type_id ,
8128 old_incident_type_id ,
8129 change_incident_type_flag ,
8130 incident_urgency_id ,
8131 old_incident_urgency_id ,
8132 change_incident_urgency_flag ,
8133 incident_severity_id ,
8134 old_incident_severity_id ,
8135 change_incident_severity_flag,
8136 incident_owner_id ,
8137 old_incident_owner_id ,
8138 change_incident_owner_flag ,
8139 create_manual_action ,
8140 action_id ,
8141 expected_resolution_date ,
8142 old_expected_resolution_date ,
8143 change_resolution_flag ,
8144 new_workflow_flag ,
8145 workflow_process_name ,
8146 workflow_process_itemkey ,
8147 group_id,
8148 old_group_id,
8149 change_group_flag,
8150 group_type,
8151 old_group_type,
8152 change_group_type_flag,
8153 inv_platform_org_id,
8154 old_inv_platform_org_id,
8155 change_platform_org_id_flag,
8156 owner_assigned_time,
8157 old_owner_assigned_time,
8158 change_assigned_time_flag,
8159 obligation_date,
8160 old_obligation_date,
8161 change_obligation_flag,
8162 site_id,
8163 old_site_id,
8164 change_site_flag,
8165 bill_to_contact_id,
8166 old_bill_to_contact_id,
8167 change_bill_to_flag,
8168 ship_to_contact_id,
8169 old_ship_to_contact_id,
8170 change_ship_to_flag,
8171 close_date,
8172 old_close_date,
8173 change_close_date_flag,
8174 customer_product_id,
8175 old_customer_product_id,
8176 change_customer_product_flag,
8177 platform_id,
8178 old_platform_id,
8179 change_platform_id_flag,
8180 product_revision,
8181 old_product_revision,
8182 change_product_revision_flag,
8183 component_version,
8184 old_component_version,
8185 change_comp_ver_flag,
8186 subcomponent_version,
8187 old_subcomponent_version,
8188 change_subcomp_ver_flag,
8189 cp_component_id,
8190 old_cp_component_id,
8191 change_cp_component_id_flag,
8192 cp_component_version_id,
8193 old_cp_component_version_id,
8194 change_cp_comp_ver_id_flag,
8195 cp_subcomponent_id,
8196 old_cp_subcomponent_id,
8197 change_cp_subcomponent_id_flag,
8198 cp_subcomponent_version_id,
8199 old_cp_subcomponent_version_id,
8200 change_cp_subcomp_ver_id_flag,
8201 cp_revision_id,
8202 old_cp_revision_id,
8203 change_cp_revision_id_flag,
8204 inv_item_revision,
8205 old_inv_item_revision,
8206 change_inv_item_revision,
8207 inv_component_id,
8208 old_inv_component_id,
8209 change_inv_component_id,
8210 inv_component_version,
8211 old_inv_component_version,
8212 change_inv_component_version,
8213 inv_subcomponent_id,
8214 old_inv_subcomponent_id,
8215 change_inv_subcomponent_id,
8216 inv_subcomponent_version,
8217 old_inv_subcomponent_version,
8218 change_inv_subcomp_version,
8219 territory_id,
8220 old_territory_id,
8221 change_territory_id_flag,
8222 resource_type,
8223 old_resource_type,
8224 change_resource_type_flag,
8225 object_version_number,
8226 audit_field,
8227 inventory_item_id ,
8228 old_inventory_item_id,
8229 change_inventory_item_flag,
8230 inv_organization_id,
8231 old_inv_organization_id,
8232 change_inv_organization_flag,
8233 status_flag ,
8234 old_status_flag ,
8235 change_status_flag ,
8236 incident_date,
8237 old_incident_date,
8238 change_incident_date_flag,
8239 platform_version_id,
8240 old_platform_version_id,
8241 change_plat_ver_id_flag,
8242 language_id,
8243 old_language_id,
8244 change_language_id_flag,
8245 -- primary_contact_id ,
8246 -- change_primary_contact_flag ,
8247 -- old_primary_contact_id,
8248 -- Added new audit columns for 11.5.10 Auditing project --anmukher --09/10/03
8249 UPGRADE_FLAG_FOR_CREATE ,
8250 OLD_INCIDENT_NUMBER ,
8251 INCIDENT_NUMBER ,
8252 OLD_CUSTOMER_ID ,
8253 CUSTOMER_ID ,
8254 OLD_BILL_TO_SITE_USE_ID ,
8255 BILL_TO_SITE_USE_ID ,
8256 OLD_EMPLOYEE_ID ,
8257 EMPLOYEE_ID ,
8258 OLD_SHIP_TO_SITE_USE_ID ,
8259 SHIP_TO_SITE_USE_ID ,
8260 OLD_PROBLEM_CODE ,
8261 PROBLEM_CODE ,
8262 OLD_ACTUAL_RESOLUTION_DATE ,
8263 ACTUAL_RESOLUTION_DATE ,
8264 OLD_INSTALL_SITE_USE_ID ,
8265 INSTALL_SITE_USE_ID ,
8266 OLD_CURRENT_SERIAL_NUMBER ,
8267 CURRENT_SERIAL_NUMBER ,
8268 OLD_SYSTEM_ID ,
8269 SYSTEM_ID ,
8270 OLD_INCIDENT_ATTRIBUTE_1 ,
8271 INCIDENT_ATTRIBUTE_1 ,
8272 OLD_INCIDENT_ATTRIBUTE_2 ,
8273 INCIDENT_ATTRIBUTE_2 ,
8274 OLD_INCIDENT_ATTRIBUTE_3 ,
8275 INCIDENT_ATTRIBUTE_3 ,
8276 OLD_INCIDENT_ATTRIBUTE_4 ,
8277 INCIDENT_ATTRIBUTE_4 ,
8278 OLD_INCIDENT_ATTRIBUTE_5 ,
8279 INCIDENT_ATTRIBUTE_5 ,
8280 OLD_INCIDENT_ATTRIBUTE_6 ,
8281 INCIDENT_ATTRIBUTE_6 ,
8282 OLD_INCIDENT_ATTRIBUTE_7 ,
8283 INCIDENT_ATTRIBUTE_7 ,
8284 OLD_INCIDENT_ATTRIBUTE_8 ,
8285 INCIDENT_ATTRIBUTE_8 ,
8286 OLD_INCIDENT_ATTRIBUTE_9 ,
8287 INCIDENT_ATTRIBUTE_9 ,
8288 OLD_INCIDENT_ATTRIBUTE_10 ,
8289 INCIDENT_ATTRIBUTE_10 ,
8290 OLD_INCIDENT_ATTRIBUTE_11 ,
8291 INCIDENT_ATTRIBUTE_11 ,
8292 OLD_INCIDENT_ATTRIBUTE_12 ,
8293 INCIDENT_ATTRIBUTE_12 ,
8294 OLD_INCIDENT_ATTRIBUTE_13 ,
8295 INCIDENT_ATTRIBUTE_13 ,
8296 OLD_INCIDENT_ATTRIBUTE_14 ,
8297 INCIDENT_ATTRIBUTE_14 ,
8298 OLD_INCIDENT_ATTRIBUTE_15 ,
8299 INCIDENT_ATTRIBUTE_15 ,
8300 OLD_INCIDENT_CONTEXT ,
8301 INCIDENT_CONTEXT ,
8302 OLD_RESOLUTION_CODE ,
8303 RESOLUTION_CODE ,
8304 OLD_ORIGINAL_ORDER_NUMBER ,
8305 ORIGINAL_ORDER_NUMBER ,
8306 OLD_ORG_ID ,
8307 ORG_ID ,
8308 OLD_PURCHASE_ORDER_NUMBER ,
8309 PURCHASE_ORDER_NUMBER ,
8310 OLD_PUBLISH_FLAG ,
8311 PUBLISH_FLAG ,
8312 OLD_QA_COLLECTION_ID ,
8313 QA_COLLECTION_ID ,
8314 OLD_CONTRACT_ID ,
8315 CONTRACT_ID ,
8316 OLD_CONTRACT_NUMBER ,
8317 CONTRACT_NUMBER ,
8318 OLD_CONTRACT_SERVICE_ID ,
8319 CONTRACT_SERVICE_ID ,
8320 OLD_TIME_ZONE_ID ,
8321 TIME_ZONE_ID ,
8322 OLD_ACCOUNT_ID ,
8323 ACCOUNT_ID ,
8324 OLD_TIME_DIFFERENCE ,
8325 TIME_DIFFERENCE ,
8326 OLD_CUSTOMER_PO_NUMBER ,
8327 CUSTOMER_PO_NUMBER ,
8328 OLD_CUSTOMER_TICKET_NUMBER ,
8329 CUSTOMER_TICKET_NUMBER ,
8330 OLD_CUSTOMER_SITE_ID ,
8331 CUSTOMER_SITE_ID ,
8332 OLD_CALLER_TYPE ,
8333 CALLER_TYPE ,
8334 -- OLD_OBJECT_VERSION_NUMBER ,
8335 OLD_SECURITY_GROUP_ID ,
8336 OLD_ORIG_SYSTEM_REFERENCE ,
8337 ORIG_SYSTEM_REFERENCE ,
8338 OLD_ORIG_SYSTEM_REFERENCE_ID ,
8339 ORIG_SYSTEM_REFERENCE_ID ,
8340 REQUEST_ID ,
8341 PROGRAM_APPLICATION_ID ,
8342 PROGRAM_ID ,
8343 PROGRAM_UPDATE_DATE ,
8344 OLD_PROJECT_NUMBER ,
8345 PROJECT_NUMBER ,
8346 OLD_PLATFORM_VERSION ,
8347 PLATFORM_VERSION ,
8348 OLD_DB_VERSION ,
8349 DB_VERSION ,
8350 OLD_CUST_PREF_LANG_ID ,
8351 CUST_PREF_LANG_ID ,
8352 OLD_TIER ,
8353 TIER ,
8354 OLD_CATEGORY_ID ,
8355 CATEGORY_ID ,
8356 OLD_OPERATING_SYSTEM ,
8357 OPERATING_SYSTEM ,
8358 OLD_OPERATING_SYSTEM_VERSION ,
8359 OPERATING_SYSTEM_VERSION ,
8360 OLD_DATABASE ,
8361 DATABASE ,
8362 OLD_GROUP_TERRITORY_ID ,
8363 GROUP_TERRITORY_ID ,
8364 OLD_COMM_PREF_CODE ,
8365 COMM_PREF_CODE ,
8366 OLD_LAST_UPDATE_CHANNEL ,
8367 LAST_UPDATE_CHANNEL ,
8368 OLD_CUST_PREF_LANG_CODE ,
8369 CUST_PREF_LANG_CODE ,
8370 OLD_ERROR_CODE ,
8371 ERROR_CODE ,
8372 OLD_CATEGORY_SET_ID ,
8373 CATEGORY_SET_ID ,
8374 OLD_EXTERNAL_REFERENCE ,
8375 EXTERNAL_REFERENCE ,
8376 OLD_INCIDENT_OCCURRED_DATE ,
8377 INCIDENT_OCCURRED_DATE ,
8378 OLD_INCIDENT_RESOLVED_DATE ,
8379 INCIDENT_RESOLVED_DATE ,
8380 OLD_INC_RESPONDED_BY_DATE ,
8381 INC_RESPONDED_BY_DATE ,
8382 OLD_INCIDENT_LOCATION_ID ,
8383 INCIDENT_LOCATION_ID ,
8384 OLD_INCIDENT_ADDRESS ,
8385 INCIDENT_ADDRESS ,
8386 OLD_INCIDENT_CITY ,
8387 INCIDENT_CITY ,
8388 OLD_INCIDENT_STATE ,
8389 INCIDENT_STATE ,
8390 OLD_INCIDENT_COUNTRY ,
8391 INCIDENT_COUNTRY ,
8392 OLD_INCIDENT_PROVINCE ,
8393 INCIDENT_PROVINCE ,
8394 OLD_INCIDENT_POSTAL_CODE ,
8395 INCIDENT_POSTAL_CODE ,
8396 OLD_INCIDENT_COUNTY ,
8397 INCIDENT_COUNTY ,
8398 OLD_SR_CREATION_CHANNEL ,
8399 SR_CREATION_CHANNEL ,
8400 OLD_DEF_DEFECT_ID ,
8401 DEF_DEFECT_ID ,
8402 OLD_DEF_DEFECT_ID2 ,
8403 DEF_DEFECT_ID2 ,
8404 OLD_EXTERNAL_ATTRIBUTE_1 ,
8405 EXTERNAL_ATTRIBUTE_1 ,
8406 OLD_EXTERNAL_ATTRIBUTE_2 ,
8407 EXTERNAL_ATTRIBUTE_2 ,
8408 OLD_EXTERNAL_ATTRIBUTE_3 ,
8409 EXTERNAL_ATTRIBUTE_3 ,
8410 OLD_EXTERNAL_ATTRIBUTE_4 ,
8411 EXTERNAL_ATTRIBUTE_4 ,
8412 OLD_EXTERNAL_ATTRIBUTE_5 ,
8413 EXTERNAL_ATTRIBUTE_5 ,
8414 OLD_EXTERNAL_ATTRIBUTE_6 ,
8415 EXTERNAL_ATTRIBUTE_6 ,
8416 OLD_EXTERNAL_ATTRIBUTE_7 ,
8417 EXTERNAL_ATTRIBUTE_7 ,
8418 OLD_EXTERNAL_ATTRIBUTE_8 ,
8419 EXTERNAL_ATTRIBUTE_8 ,
8420 OLD_EXTERNAL_ATTRIBUTE_9 ,
8421 EXTERNAL_ATTRIBUTE_9 ,
8422 OLD_EXTERNAL_ATTRIBUTE_10 ,
8423 EXTERNAL_ATTRIBUTE_10 ,
8424 OLD_EXTERNAL_ATTRIBUTE_11 ,
8425 EXTERNAL_ATTRIBUTE_11 ,
8426 OLD_EXTERNAL_ATTRIBUTE_12 ,
8427 EXTERNAL_ATTRIBUTE_12 ,
8428 OLD_EXTERNAL_ATTRIBUTE_13 ,
8429 EXTERNAL_ATTRIBUTE_13 ,
8430 OLD_EXTERNAL_ATTRIBUTE_14 ,
8431 EXTERNAL_ATTRIBUTE_14 ,
8432 OLD_EXTERNAL_ATTRIBUTE_15 ,
8433 EXTERNAL_ATTRIBUTE_15 ,
8434 OLD_EXTERNAL_CONTEXT ,
8435 EXTERNAL_CONTEXT ,
8436 OLD_LAST_UPDATE_PROGRAM_CODE ,
8437 LAST_UPDATE_PROGRAM_CODE ,
8438 OLD_CREATION_PROGRAM_CODE ,
8439 CREATION_PROGRAM_CODE ,
8440 OLD_COVERAGE_TYPE ,
8441 COVERAGE_TYPE ,
8442 OLD_BILL_TO_ACCOUNT_ID ,
8443 BILL_TO_ACCOUNT_ID ,
8444 OLD_SHIP_TO_ACCOUNT_ID ,
8445 SHIP_TO_ACCOUNT_ID ,
8446 OLD_CUSTOMER_EMAIL_ID ,
8447 CUSTOMER_EMAIL_ID ,
8448 OLD_CUSTOMER_PHONE_ID ,
8449 CUSTOMER_PHONE_ID ,
8450 OLD_BILL_TO_PARTY_ID ,
8451 BILL_TO_PARTY_ID ,
8452 OLD_SHIP_TO_PARTY_ID ,
8453 SHIP_TO_PARTY_ID ,
8454 OLD_BILL_TO_SITE_ID ,
8455 BILL_TO_SITE_ID ,
8456 OLD_SHIP_TO_SITE_ID ,
8457 SHIP_TO_SITE_ID ,
8458 OLD_PROGRAM_LOGIN_ID ,
8459 PROGRAM_LOGIN_ID ,
8460 OLD_INCIDENT_POINT_OF_INTEREST ,
8461 INCIDENT_POINT_OF_INTEREST ,
8462 OLD_INCIDENT_CROSS_STREET ,
8463 INCIDENT_CROSS_STREET ,
8464 OLD_INCIDENT_DIRECTION_QUALIF ,
8465 INCIDENT_DIRECTION_QUALIF ,
8466 OLD_INCIDENT_DISTANCE_QUALIF ,
8467 INCIDENT_DISTANCE_QUALIF ,
8468 OLD_INCIDENT_DISTANCE_QUAL_UOM ,
8469 INCIDENT_DISTANCE_QUAL_UOM ,
8470 OLD_INCIDENT_ADDRESS2 ,
8471 INCIDENT_ADDRESS2 ,
8472 OLD_INCIDENT_ADDRESS3 ,
8473 INCIDENT_ADDRESS3 ,
8474 OLD_INCIDENT_ADDRESS4 ,
8475 INCIDENT_ADDRESS4 ,
8476 OLD_INCIDENT_ADDRESS_STYLE ,
8477 INCIDENT_ADDRESS_STYLE ,
8478 OLD_INCIDENT_ADDR_LNS_PHONETIC ,
8479 INCIDENT_ADDR_LNS_PHONETIC ,
8480 OLD_INCIDENT_PO_BOX_NUMBER ,
8481 INCIDENT_PO_BOX_NUMBER ,
8482 OLD_INCIDENT_HOUSE_NUMBER ,
8483 INCIDENT_HOUSE_NUMBER ,
8484 OLD_INCIDENT_STREET_SUFFIX ,
8485 INCIDENT_STREET_SUFFIX ,
8486 OLD_INCIDENT_STREET ,
8487 INCIDENT_STREET ,
8488 OLD_INCIDENT_STREET_NUMBER ,
8489 INCIDENT_STREET_NUMBER ,
8490 OLD_INCIDENT_FLOOR ,
8491 INCIDENT_FLOOR ,
8492 OLD_INCIDENT_SUITE ,
8493 INCIDENT_SUITE ,
8494 OLD_INCIDENT_POSTAL_PLUS4_CODE ,
8495 INCIDENT_POSTAL_PLUS4_CODE ,
8496 OLD_INCIDENT_POSITION ,
8497 INCIDENT_POSITION ,
8498 OLD_INCIDENT_LOC_DIRECTIONS ,
8499 INCIDENT_LOC_DIRECTIONS ,
8500 OLD_INCIDENT_LOC_DESCRIPTION ,
8501 INCIDENT_LOC_DESCRIPTION ,
8502 OLD_INSTALL_SITE_ID ,
8503 INSTALL_SITE_ID ,
8504 INCIDENT_LAST_MODIFIED_DATE ,
8505 UPDATED_ENTITY_CODE ,
8506 UPDATED_ENTITY_ID ,
8507 ENTITY_ACTIVITY_CODE ,
8508 OLD_TIER_VERSION ,
8509 TIER_VERSION ,
8510 --anmukher --09/12/03
8511 OLD_INC_OBJECT_VERSION_NUMBER ,
8512 INC_OBJECT_VERSION_NUMBER ,
8513 OLD_INC_REQUEST_ID ,
8514 INC_REQUEST_ID ,
8515 OLD_INC_PROGRAM_APPLICATION_ID ,
8516 INC_PROGRAM_APPLICATION_ID ,
8517 OLD_INC_PROGRAM_ID ,
8518 INC_PROGRAM_ID ,
8519 OLD_INC_PROGRAM_UPDATE_DATE ,
8520 INC_PROGRAM_UPDATE_DATE ,
8521 OLD_OWNING_DEPARTMENT_ID ,
8522 OWNING_DEPARTMENT_ID ,
8523 OLD_INCIDENT_LOCATION_TYPE ,
8524 INCIDENT_LOCATION_TYPE ,
8525 OLD_UNASSIGNED_INDICATOR ,
8526 UNASSIGNED_INDICATOR ,
8527 OLD_MAINT_ORGANIZATION_ID ,
8528 MAINT_ORGANIZATION_ID
8529 )
8530 VALUES(
8531 l_audit_id,
8532 p_request_id,
8533 p_last_update_date,
8534 p_user_id,
8535 p_last_update_date,
8536 p_user_id,
8537 P_login_id,
8538 TO_CHAR(p_creation_date,'HH24:MI:SS'),
8539 l_audit_vals_rec.incident_status_id ,
8540 l_audit_vals_rec.old_incident_status_id ,
8541 l_audit_vals_rec.change_incident_status_flag ,
8542 l_audit_vals_rec.incident_type_id ,
8543 l_audit_vals_rec.old_incident_type_id ,
8544 l_audit_vals_rec.change_incident_type_flag ,
8545 l_audit_vals_rec.incident_urgency_id ,
8546 l_audit_vals_rec.old_incident_urgency_id ,
8547 l_audit_vals_rec.change_incident_urgency_flag ,
8548 l_audit_vals_rec.incident_severity_id ,
8549 l_audit_vals_rec.old_incident_severity_id ,
8550 l_audit_vals_rec.change_incident_severity_flag,
8551 l_audit_vals_rec.incident_owner_id ,
8552 l_audit_vals_rec.old_incident_owner_id ,
8553 l_audit_vals_rec.change_incident_owner_flag ,
8554 l_audit_vals_rec.create_manual_action ,
8555 l_audit_vals_rec.action_id ,
8556 l_audit_vals_rec.expected_resolution_date ,
8557 l_audit_vals_rec.old_expected_resolution_date ,
8558 l_audit_vals_rec.change_resolution_flag ,
8559 l_audit_vals_rec.new_workflow_flag ,
8560 l_audit_vals_rec.workflow_process_name ,
8561 l_audit_vals_rec.workflow_process_itemkey ,
8562 l_audit_vals_rec.group_id,
8563 l_audit_vals_rec.old_group_id,
8564 l_audit_vals_rec.change_group_flag,
8565 l_audit_vals_rec.group_type,
8566 l_audit_vals_rec.old_group_type,
8567 l_audit_vals_rec.change_group_type_flag,
8568 l_audit_vals_rec.inv_platform_org_id,
8569 l_audit_vals_rec.old_inv_platform_org_id,
8570 l_audit_vals_rec.change_platform_org_id_flag,
8571 l_audit_vals_rec.owner_assigned_time,
8572 l_audit_vals_rec.old_owner_assigned_time,
8573 l_audit_vals_rec.change_assigned_time_flag,
8574 l_audit_vals_rec.obligation_date,
8575 l_audit_vals_rec.old_obligation_date,
8576 l_audit_vals_rec.change_obligation_flag,
8577 l_audit_vals_rec.site_id,
8578 l_audit_vals_rec.old_site_id,
8579 l_audit_vals_rec.change_site_flag,
8580 l_audit_vals_rec.bill_to_contact_id,
8581 l_audit_vals_rec.old_bill_to_contact_id,
8582 l_audit_vals_rec.change_bill_to_flag,
8583 l_audit_vals_rec.ship_to_contact_id,
8584 l_audit_vals_rec.old_ship_to_contact_id,
8585 l_audit_vals_rec.change_ship_to_flag,
8586 l_audit_vals_rec.close_date,
8587 l_audit_vals_rec.old_close_date,
8588 l_audit_vals_rec.change_close_date_flag,
8589 l_audit_vals_rec.customer_product_id,
8590 l_audit_vals_rec.old_customer_product_id,
8591 l_audit_vals_rec.change_customer_product_flag,
8592 l_audit_vals_rec.platform_id,
8593 l_audit_vals_rec.old_platform_id,
8594 l_audit_vals_rec.change_platform_id_flag,
8595 l_audit_vals_rec.product_revision,
8596 l_audit_vals_rec.old_product_revision,
8597 l_audit_vals_rec.change_product_revision_flag,
8598 l_audit_vals_rec.component_version, -- cp component versions
8599 l_audit_vals_rec.old_component_version,
8600 l_audit_vals_rec.change_comp_ver_flag,
8601 l_audit_vals_rec.subcomponent_version,
8602 l_audit_vals_rec.old_subcomponent_version,
8603 l_audit_vals_rec.change_subcomp_ver_flag,
8604 l_audit_vals_rec.cp_component_id,
8605 l_audit_vals_rec.old_cp_component_id,
8606 l_audit_vals_rec.change_cp_component_id_flag,
8607 l_audit_vals_rec.cp_component_version_id,
8608 l_audit_vals_rec.old_cp_component_version_id,
8609 l_audit_vals_rec.change_cp_comp_ver_id_flag,
8610 l_audit_vals_rec.cp_subcomponent_id,
8611 l_audit_vals_rec.old_cp_subcomponent_id,
8612 l_audit_vals_rec.change_cp_subcomponent_id_flag,
8613 l_audit_vals_rec.cp_subcomponent_version_id,
8614 l_audit_vals_rec.old_cp_subcomponent_version_id,
8615 l_audit_vals_rec.change_cp_subcomp_ver_id_flag,
8616 l_audit_vals_rec.cp_revision_id,
8617 l_audit_vals_rec.old_cp_revision_id,
8618 l_audit_vals_rec.change_cp_revision_id_flag,
8619 l_audit_vals_rec.inv_item_revision,
8620 l_audit_vals_rec.old_inv_item_revision,
8621 l_audit_vals_rec.change_inv_item_revision,
8622 l_audit_vals_rec.inv_component_id,
8623 l_audit_vals_rec.old_inv_component_id,
8624 l_audit_vals_rec.change_inv_component_id,
8625 l_audit_vals_rec.inv_component_version,
8626 l_audit_vals_rec.old_inv_component_version,
8627 l_audit_vals_rec.change_inv_component_version,
8628 l_audit_vals_rec.inv_subcomponent_id,
8629 l_audit_vals_rec.old_inv_subcomponent_id,
8630 l_audit_vals_rec.change_inv_subcomponent_id,
8631 l_audit_vals_rec.inv_subcomponent_version,
8632 l_audit_vals_rec.old_inv_subcomponent_version,
8633 l_audit_vals_rec.change_inv_subcomp_version,
8634 l_audit_vals_rec.territory_id,
8635 l_audit_vals_rec.old_territory_id,
8636 l_audit_vals_rec.change_territory_id_flag,
8637 l_audit_vals_rec.resource_type,
8638 l_audit_vals_rec.old_resource_type,
8639 l_audit_vals_rec.change_resource_type_flag,
8640 1,
8641 '',
8642 l_audit_vals_rec.inventory_item_id ,
8643 l_audit_vals_rec.old_inventory_item_id,
8644 l_audit_vals_rec.change_inventory_item_flag,
8645 l_audit_vals_rec.inv_organization_id,
8646 l_audit_vals_rec.old_inv_organization_id,
8647 l_audit_vals_rec.change_inv_organization_flag,
8648 l_audit_vals_rec.status_flag,
8649 l_audit_vals_rec.old_status_flag,
8650 l_audit_vals_rec.change_status_flag,
8651 l_audit_vals_rec.incident_date,
8652 l_audit_vals_rec.old_incident_date,
8653 l_audit_vals_rec.change_incident_date_flag,
8654 l_audit_vals_rec.platform_version_id,
8655 l_audit_vals_rec.old_platform_version_id,
8656 l_audit_vals_rec.change_plat_ver_id_flag,
8657 l_audit_vals_rec.language_id,
8658 l_audit_vals_rec.old_language_id,
8659 l_audit_vals_rec.change_language_id_flag,
8660 --l_audit_vals_rec.primary_contact_id,
8661 --l_audit_vals_rec.change_primary_contact_flag,
8662 --l_audit_vals_rec.old_primary_contact_id,
8663 -- Added new audit columns for 11.5.10 Auditing project --anmukher --09/10/03
8664 l_audit_vals_rec.UPGRADE_FLAG_FOR_CREATE ,
8665 l_audit_vals_rec.OLD_INCIDENT_NUMBER ,
8666 l_audit_vals_rec.INCIDENT_NUMBER ,
8667 l_audit_vals_rec.OLD_CUSTOMER_ID ,
8668 l_audit_vals_rec.CUSTOMER_ID ,
8669 l_audit_vals_rec.OLD_BILL_TO_SITE_USE_ID ,
8670 l_audit_vals_rec.BILL_TO_SITE_USE_ID ,
8671 l_audit_vals_rec.OLD_EMPLOYEE_ID ,
8672 l_audit_vals_rec.EMPLOYEE_ID ,
8673 l_audit_vals_rec.OLD_SHIP_TO_SITE_USE_ID ,
8674 l_audit_vals_rec.SHIP_TO_SITE_USE_ID ,
8675 l_audit_vals_rec.OLD_PROBLEM_CODE ,
8676 l_audit_vals_rec.PROBLEM_CODE ,
8677 l_audit_vals_rec.OLD_ACTUAL_RESOLUTION_DATE ,
8678 l_audit_vals_rec.ACTUAL_RESOLUTION_DATE ,
8679 l_audit_vals_rec.OLD_INSTALL_SITE_USE_ID ,
8680 l_audit_vals_rec.INSTALL_SITE_USE_ID ,
8681 l_audit_vals_rec.OLD_CURRENT_SERIAL_NUMBER ,
8682 l_audit_vals_rec.CURRENT_SERIAL_NUMBER ,
8683 l_audit_vals_rec.OLD_SYSTEM_ID ,
8684 l_audit_vals_rec.SYSTEM_ID ,
8685 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_1 ,
8686 l_audit_vals_rec.INCIDENT_ATTRIBUTE_1 ,
8687 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_2 ,
8688 l_audit_vals_rec.INCIDENT_ATTRIBUTE_2 ,
8689 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_3 ,
8690 l_audit_vals_rec.INCIDENT_ATTRIBUTE_3 ,
8691 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_4 ,
8692 l_audit_vals_rec.INCIDENT_ATTRIBUTE_4 ,
8693 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_5 ,
8694 l_audit_vals_rec.INCIDENT_ATTRIBUTE_5 ,
8695 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_6 ,
8696 l_audit_vals_rec.INCIDENT_ATTRIBUTE_6 ,
8697 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_7 ,
8698 l_audit_vals_rec.INCIDENT_ATTRIBUTE_7 ,
8699 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_8 ,
8700 l_audit_vals_rec.INCIDENT_ATTRIBUTE_8 ,
8701 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_9 ,
8702 l_audit_vals_rec.INCIDENT_ATTRIBUTE_9 ,
8703 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_10 ,
8704 l_audit_vals_rec.INCIDENT_ATTRIBUTE_10 ,
8705 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_11 ,
8706 l_audit_vals_rec.INCIDENT_ATTRIBUTE_11 ,
8707 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_12 ,
8708 l_audit_vals_rec.INCIDENT_ATTRIBUTE_12 ,
8709 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_13 ,
8710 l_audit_vals_rec.INCIDENT_ATTRIBUTE_13 ,
8711 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_14 ,
8712 l_audit_vals_rec.INCIDENT_ATTRIBUTE_14 ,
8713 l_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_15 ,
8714 l_audit_vals_rec.INCIDENT_ATTRIBUTE_15 ,
8715 l_audit_vals_rec.OLD_INCIDENT_CONTEXT ,
8716 l_audit_vals_rec.INCIDENT_CONTEXT ,
8717 l_audit_vals_rec.OLD_RESOLUTION_CODE ,
8718 l_audit_vals_rec.RESOLUTION_CODE ,
8719 l_audit_vals_rec.OLD_ORIGINAL_ORDER_NUMBER ,
8720 l_audit_vals_rec.ORIGINAL_ORDER_NUMBER ,
8721 l_audit_vals_rec.OLD_ORG_ID ,
8722 l_audit_vals_rec.ORG_ID ,
8723 l_audit_vals_rec.OLD_PURCHASE_ORDER_NUMBER ,
8724 l_audit_vals_rec.PURCHASE_ORDER_NUMBER ,
8725 l_audit_vals_rec.OLD_PUBLISH_FLAG ,
8726 l_audit_vals_rec.PUBLISH_FLAG ,
8727 l_audit_vals_rec.OLD_QA_COLLECTION_ID ,
8728 l_audit_vals_rec.QA_COLLECTION_ID ,
8729 l_audit_vals_rec.OLD_CONTRACT_ID ,
8730 l_audit_vals_rec.CONTRACT_ID ,
8731 l_audit_vals_rec.OLD_CONTRACT_NUMBER ,
8732 l_audit_vals_rec.CONTRACT_NUMBER ,
8733 l_audit_vals_rec.OLD_CONTRACT_SERVICE_ID ,
8734 l_audit_vals_rec.CONTRACT_SERVICE_ID ,
8735 l_audit_vals_rec.OLD_TIME_ZONE_ID ,
8736 l_audit_vals_rec.TIME_ZONE_ID ,
8737 l_audit_vals_rec.OLD_ACCOUNT_ID ,
8738 l_audit_vals_rec.ACCOUNT_ID ,
8739 l_audit_vals_rec.OLD_TIME_DIFFERENCE ,
8740 l_audit_vals_rec.TIME_DIFFERENCE ,
8741 l_audit_vals_rec.OLD_CUSTOMER_PO_NUMBER ,
8742 l_audit_vals_rec.CUSTOMER_PO_NUMBER ,
8743 l_audit_vals_rec.OLD_CUSTOMER_TICKET_NUMBER ,
8744 l_audit_vals_rec.CUSTOMER_TICKET_NUMBER ,
8745 l_audit_vals_rec.OLD_CUSTOMER_SITE_ID ,
8746 l_audit_vals_rec.CUSTOMER_SITE_ID ,
8747 l_audit_vals_rec.OLD_CALLER_TYPE ,
8748 l_audit_vals_rec.CALLER_TYPE ,
8749 -- l_audit_vals_rec.OLD_OBJECT_VERSION_NUMBER ,
8750 l_audit_vals_rec.OLD_SECURITY_GROUP_ID ,
8751 l_audit_vals_rec.OLD_ORIG_SYSTEM_REFERENCE ,
8752 l_audit_vals_rec.ORIG_SYSTEM_REFERENCE ,
8753 l_audit_vals_rec.OLD_ORIG_SYSTEM_REFERENCE_ID ,
8754 l_audit_vals_rec.ORIG_SYSTEM_REFERENCE_ID ,
8755 l_audit_vals_rec.REQUEST_ID ,
8756 l_audit_vals_rec.PROGRAM_APPLICATION_ID ,
8757 l_audit_vals_rec.PROGRAM_ID ,
8758 l_audit_vals_rec.PROGRAM_UPDATE_DATE ,
8759 l_audit_vals_rec.OLD_PROJECT_NUMBER ,
8760 l_audit_vals_rec.PROJECT_NUMBER ,
8761 l_audit_vals_rec.OLD_PLATFORM_VERSION ,
8762 l_audit_vals_rec.PLATFORM_VERSION ,
8763 l_audit_vals_rec.OLD_DB_VERSION ,
8764 l_audit_vals_rec.DB_VERSION ,
8765 l_audit_vals_rec.OLD_CUST_PREF_LANG_ID ,
8766 l_audit_vals_rec.CUST_PREF_LANG_ID ,
8767 l_audit_vals_rec.OLD_TIER ,
8768 l_audit_vals_rec.TIER ,
8769 l_audit_vals_rec.OLD_CATEGORY_ID ,
8770 l_audit_vals_rec.CATEGORY_ID ,
8771 l_audit_vals_rec.OLD_OPERATING_SYSTEM ,
8772 l_audit_vals_rec.OPERATING_SYSTEM ,
8773 l_audit_vals_rec.OLD_OPERATING_SYSTEM_VERSION ,
8774 l_audit_vals_rec.OPERATING_SYSTEM_VERSION ,
8775 l_audit_vals_rec.OLD_DATABASE ,
8776 l_audit_vals_rec.DATABASE ,
8777 l_audit_vals_rec.OLD_GROUP_TERRITORY_ID ,
8778 l_audit_vals_rec.GROUP_TERRITORY_ID ,
8779 l_audit_vals_rec.OLD_COMM_PREF_CODE ,
8780 l_audit_vals_rec.COMM_PREF_CODE ,
8781 l_audit_vals_rec.OLD_LAST_UPDATE_CHANNEL ,
8782 l_audit_vals_rec.LAST_UPDATE_CHANNEL ,
8783 l_audit_vals_rec.OLD_CUST_PREF_LANG_CODE ,
8784 l_audit_vals_rec.CUST_PREF_LANG_CODE ,
8785 l_audit_vals_rec.OLD_ERROR_CODE ,
8786 l_audit_vals_rec.ERROR_CODE ,
8787 l_audit_vals_rec.OLD_CATEGORY_SET_ID ,
8788 l_audit_vals_rec.CATEGORY_SET_ID ,
8789 l_audit_vals_rec.OLD_EXTERNAL_REFERENCE ,
8790 l_audit_vals_rec.EXTERNAL_REFERENCE ,
8791 l_audit_vals_rec.OLD_INCIDENT_OCCURRED_DATE ,
8792 l_audit_vals_rec.INCIDENT_OCCURRED_DATE ,
8793 l_audit_vals_rec.OLD_INCIDENT_RESOLVED_DATE ,
8794 l_audit_vals_rec.INCIDENT_RESOLVED_DATE ,
8795 l_audit_vals_rec.OLD_INC_RESPONDED_BY_DATE ,
8796 l_audit_vals_rec.INC_RESPONDED_BY_DATE ,
8797 l_audit_vals_rec.OLD_INCIDENT_LOCATION_ID ,
8798 l_audit_vals_rec.INCIDENT_LOCATION_ID ,
8799 l_audit_vals_rec.OLD_INCIDENT_ADDRESS ,
8800 l_audit_vals_rec.INCIDENT_ADDRESS ,
8801 l_audit_vals_rec.OLD_INCIDENT_CITY ,
8802 l_audit_vals_rec.INCIDENT_CITY ,
8803 l_audit_vals_rec.OLD_INCIDENT_STATE ,
8804 l_audit_vals_rec.INCIDENT_STATE ,
8805 l_audit_vals_rec.OLD_INCIDENT_COUNTRY ,
8806 l_audit_vals_rec.INCIDENT_COUNTRY ,
8807 l_audit_vals_rec.OLD_INCIDENT_PROVINCE ,
8808 l_audit_vals_rec.INCIDENT_PROVINCE ,
8809 l_audit_vals_rec.OLD_INCIDENT_POSTAL_CODE ,
8810 l_audit_vals_rec.INCIDENT_POSTAL_CODE ,
8811 l_audit_vals_rec.OLD_INCIDENT_COUNTY ,
8812 l_audit_vals_rec.INCIDENT_COUNTY ,
8813 l_audit_vals_rec.OLD_SR_CREATION_CHANNEL ,
8814 l_audit_vals_rec.SR_CREATION_CHANNEL ,
8815 l_audit_vals_rec.OLD_DEF_DEFECT_ID ,
8816 l_audit_vals_rec.DEF_DEFECT_ID ,
8817 l_audit_vals_rec.OLD_DEF_DEFECT_ID2 ,
8818 l_audit_vals_rec.DEF_DEFECT_ID2 ,
8819 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_1 ,
8820 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_1 ,
8821 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_2 ,
8822 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_2 ,
8823 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_3 ,
8824 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_3 ,
8825 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_4 ,
8826 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_4 ,
8827 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_5 ,
8828 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_5 ,
8829 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_6 ,
8830 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_6 ,
8831 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_7 ,
8832 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_7 ,
8833 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_8 ,
8834 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_8 ,
8835 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_9 ,
8836 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_9 ,
8837 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_10 ,
8838 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_10 ,
8839 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_11 ,
8840 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_11 ,
8841 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_12 ,
8842 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_12 ,
8843 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_13 ,
8844 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_13 ,
8845 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_14 ,
8846 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_14 ,
8847 l_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_15 ,
8848 l_audit_vals_rec.EXTERNAL_ATTRIBUTE_15 ,
8849 l_audit_vals_rec.OLD_EXTERNAL_CONTEXT ,
8850 l_audit_vals_rec.EXTERNAL_CONTEXT ,
8851 l_audit_vals_rec.OLD_LAST_UPDATE_PROGRAM_CODE ,
8852 l_audit_vals_rec.LAST_UPDATE_PROGRAM_CODE ,
8853 l_audit_vals_rec.OLD_CREATION_PROGRAM_CODE ,
8854 l_audit_vals_rec.CREATION_PROGRAM_CODE ,
8855 l_audit_vals_rec.OLD_COVERAGE_TYPE ,
8856 l_audit_vals_rec.COVERAGE_TYPE ,
8857 l_audit_vals_rec.OLD_BILL_TO_ACCOUNT_ID ,
8858 l_audit_vals_rec.BILL_TO_ACCOUNT_ID ,
8859 l_audit_vals_rec.OLD_SHIP_TO_ACCOUNT_ID ,
8860 l_audit_vals_rec.SHIP_TO_ACCOUNT_ID ,
8861 l_audit_vals_rec.OLD_CUSTOMER_EMAIL_ID ,
8862 l_audit_vals_rec.CUSTOMER_EMAIL_ID ,
8863 l_audit_vals_rec.OLD_CUSTOMER_PHONE_ID ,
8864 l_audit_vals_rec.CUSTOMER_PHONE_ID ,
8865 l_audit_vals_rec.OLD_BILL_TO_PARTY_ID ,
8866 l_audit_vals_rec.BILL_TO_PARTY_ID ,
8867 l_audit_vals_rec.OLD_SHIP_TO_PARTY_ID ,
8868 l_audit_vals_rec.SHIP_TO_PARTY_ID ,
8869 l_audit_vals_rec.OLD_BILL_TO_SITE_ID ,
8870 l_audit_vals_rec.BILL_TO_SITE_ID ,
8871 l_audit_vals_rec.OLD_SHIP_TO_SITE_ID ,
8872 l_audit_vals_rec.SHIP_TO_SITE_ID ,
8873 l_audit_vals_rec.OLD_PROGRAM_LOGIN_ID ,
8874 l_audit_vals_rec.PROGRAM_LOGIN_ID ,
8875 l_audit_vals_rec.OLD_INCIDENT_POINT_OF_INTEREST ,
8876 l_audit_vals_rec.INCIDENT_POINT_OF_INTEREST ,
8877 l_audit_vals_rec.OLD_INCIDENT_CROSS_STREET ,
8878 l_audit_vals_rec.INCIDENT_CROSS_STREET ,
8879 l_audit_vals_rec.OLD_INCIDENT_DIRECTION_QUALIF ,
8880 l_audit_vals_rec.INCIDENT_DIRECTION_QUALIF ,
8881 l_audit_vals_rec.OLD_INCIDENT_DISTANCE_QUALIF ,
8882 l_audit_vals_rec.INCIDENT_DISTANCE_QUALIF ,
8883 l_audit_vals_rec.OLD_INCIDENT_DISTANCE_QUAL_UOM ,
8884 l_audit_vals_rec.INCIDENT_DISTANCE_QUAL_UOM ,
8885 l_audit_vals_rec.OLD_INCIDENT_ADDRESS2 ,
8886 l_audit_vals_rec.INCIDENT_ADDRESS2 ,
8887 l_audit_vals_rec.OLD_INCIDENT_ADDRESS3 ,
8888 l_audit_vals_rec.INCIDENT_ADDRESS3 ,
8889 l_audit_vals_rec.OLD_INCIDENT_ADDRESS4 ,
8890 l_audit_vals_rec.INCIDENT_ADDRESS4 ,
8891 l_audit_vals_rec.OLD_INCIDENT_ADDRESS_STYLE ,
8892 l_audit_vals_rec.INCIDENT_ADDRESS_STYLE ,
8893 l_audit_vals_rec.OLD_INCIDENT_ADDR_LNS_PHONETIC ,
8894 l_audit_vals_rec.INCIDENT_ADDR_LNS_PHONETIC ,
8895 l_audit_vals_rec.OLD_INCIDENT_PO_BOX_NUMBER ,
8896 l_audit_vals_rec.INCIDENT_PO_BOX_NUMBER ,
8897 l_audit_vals_rec.OLD_INCIDENT_HOUSE_NUMBER ,
8898 l_audit_vals_rec.INCIDENT_HOUSE_NUMBER ,
8899 l_audit_vals_rec.OLD_INCIDENT_STREET_SUFFIX ,
8900 l_audit_vals_rec.INCIDENT_STREET_SUFFIX ,
8901 l_audit_vals_rec.OLD_INCIDENT_STREET ,
8902 l_audit_vals_rec.INCIDENT_STREET ,
8903 l_audit_vals_rec.OLD_INCIDENT_STREET_NUMBER ,
8904 l_audit_vals_rec.INCIDENT_STREET_NUMBER ,
8905 l_audit_vals_rec.OLD_INCIDENT_FLOOR ,
8906 l_audit_vals_rec.INCIDENT_FLOOR ,
8907 l_audit_vals_rec.OLD_INCIDENT_SUITE ,
8908 l_audit_vals_rec.INCIDENT_SUITE ,
8909 l_audit_vals_rec.OLD_INCIDENT_POSTAL_PLUS4_CODE ,
8910 l_audit_vals_rec.INCIDENT_POSTAL_PLUS4_CODE ,
8911 l_audit_vals_rec.OLD_INCIDENT_POSITION ,
8912 l_audit_vals_rec.INCIDENT_POSITION ,
8913 l_audit_vals_rec.OLD_INCIDENT_LOC_DIRECTIONS ,
8914 l_audit_vals_rec.INCIDENT_LOC_DIRECTIONS ,
8915 l_audit_vals_rec.OLD_INCIDENT_LOC_DESCRIPTION ,
8916 l_audit_vals_rec.INCIDENT_LOC_DESCRIPTION ,
8917 l_audit_vals_rec.OLD_INSTALL_SITE_ID ,
8918 l_audit_vals_rec.INSTALL_SITE_ID ,
8919 l_audit_vals_rec.INCIDENT_LAST_MODIFIED_DATE ,
8920 l_audit_vals_rec.UPDATED_ENTITY_CODE ,
8921 l_audit_vals_rec.UPDATED_ENTITY_ID ,
8922 l_audit_vals_rec.ENTITY_ACTIVITY_CODE ,
8923 l_audit_vals_rec.OLD_TIER_VERSION ,
8924 l_audit_vals_rec.TIER_VERSION ,
8925 --anmukher --09/12/03
8926 l_audit_vals_rec.OLD_INC_OBJECT_VERSION_NUMBER ,
8927 l_audit_vals_rec.INC_OBJECT_VERSION_NUMBER ,
8928 l_audit_vals_rec.OLD_INC_REQUEST_ID ,
8929 l_audit_vals_rec.INC_REQUEST_ID ,
8930 l_audit_vals_rec.OLD_INC_PROGRAM_APPLICATION_ID ,
8931 l_audit_vals_rec.INC_PROGRAM_APPLICATION_ID ,
8932 l_audit_vals_rec.OLD_INC_PROGRAM_ID ,
8933 l_audit_vals_rec.INC_PROGRAM_ID ,
8934 l_audit_vals_rec.OLD_INC_PROGRAM_UPDATE_DATE ,
8935 l_audit_vals_rec.INC_PROGRAM_UPDATE_DATE ,
8936 l_audit_vals_rec.OLD_OWNING_DEPARTMENT_ID ,
8937 l_audit_vals_rec.OWNING_DEPARTMENT_ID ,
8938 l_audit_vals_rec.OLD_INCIDENT_LOCATION_TYPE ,
8939 l_audit_vals_rec.INCIDENT_LOCATION_TYPE ,
8940 l_audit_vals_rec.OLD_UNASSIGNED_INDICATOR ,
8941 l_audit_vals_rec.UNASSIGNED_INDICATOR ,
8942 l_audit_vals_rec.OLD_MAINT_ORGANIZATION_ID ,
8943 l_audit_vals_rec.MAINT_ORGANIZATION_ID
8944 )
8945 RETURNING incident_audit_id INTO l_Incident_Audit_Id;
8946
8947 INSERT INTO cs_incidents_audit_tl (
8948 incident_audit_id,
8949 incident_id,
8950 LANGUAGE,
8951 source_lang,
8952 last_update_date,
8953 last_updated_by,
8954 creation_date,
8955 created_by,
8956 change_description
8957 ) SELECT
8958 l_incident_audit_id,
8959 p_request_id,
8960 L.LANGUAGE_CODE,
8961 USERENV('LANG'),
8962 SYSDATE,
8963 p_user_id,
8964 SYSDATE,
8965 p_user_id,
8966 p_comments
8967 FROM FND_LANGUAGES L
8968 WHERE l.installed_flag IN ('I', 'B')
8969 AND NOT EXISTS
8970 (SELECT NULL
8971 FROM cs_incidents_audit_tl t
8972 WHERE t.incident_audit_id = l_incident_audit_id
8973 AND t.LANGUAGE = l.language_code
8974 ) ;
8975
8976 IF FND_API.To_Boolean( p_commit ) THEN
8977 COMMIT WORK;
8978 END IF;
8979
8980 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8981 p_data => x_msg_data );
8982
8983 EXCEPTION
8984 WHEN FND_API.G_EXC_ERROR THEN
8985 ROLLBACK TO Create_Audit_Record_PVT;
8986 x_return_status := FND_API.G_RET_STS_ERROR;
8987 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8988 p_data => x_msg_data );
8989
8990 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
8991 ROLLBACK TO Create_Audit_Record_PVT;
8992 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8993 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8994 p_data => x_msg_data );
8995
8996 WHEN OTHERS THEN
8997 ROLLBACK TO Create_Audit_Record_PVT;
8998 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8999 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
9000 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, l_api_name );
9001 END IF;
9002 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
9003 p_data => x_msg_data );
9004
9005 END Create_Audit_Record;
9006 --------------------------------------------------------------------------
9007 -- Validate_ServiceRequest_Record
9008 --------------------------------------------------------------------------
9009
9010 -- Modification History
9011 -- Date Name Desc
9012 -- ------- -------- -----------------------------------------------------------
9013 -- 02/28/05 smisra Bug 4083288 passed category_set_id to
9014 -- validate_category_id procedure.
9015 -- 03/25/05 smisra Bug 4239975 Modified call to validate_current_serial_number
9016 -- Now it is called only if both customer product and current
9017 -- serial number are not null and not G_MISS_XXX
9018 -- 05/05/05 smisra Added validation for maint_organization_id
9019 -- 06/07/05 smisra Added p_maint_organization_id to util.validate_product call
9020 -- Removed p_maintenance_flag parameter from
9021 -- validate_inventory_org call
9022 -- 07/20/05 smisra bug 3900208
9023 -- changed the value of parameter p_parameter_name to
9024 -- p_product_revision from component_version so that error
9025 -- message is appropriate.
9026 -- 08/01/05 smisra EAM-IB01AUG
9027 -- passed addtional parameter p_inv_org_master_org_flag to
9028 -- validate_maint_organization_id,
9029 -- validate_customer_product_id and validate_inventory_org_id
9030 -- 08/03/05 smisra Passed maint_organization_id to validate_owning_dept
9031 -- procedure
9032 -- Passed l_inv_org_master_org_flag to validate_product
9033 -- 08/11/05 smisra Called validate_owning_dept only in Create Mode. in updated
9034 -- more it is called from servicerequest_cross_val
9035 -- 12/14/05 smisra removed call to validate_inc_location_id. Now it is called
9036 -- from vltd_sr_rec
9037 -- 12/23/05 smisra Bug 4894942
9038 -- Removed call to validate_contract_service_id and
9039 -- contracts_cross_val. This code is now executed from
9040 -- vldt_sr_rec
9041 -- 12/30/05 smisra Bug 4773215
9042 -- Removed call to validate resource type and site_id because
9043 -- these are now derived based on resource id
9044 -- 06/06/06 spusegao Bug # 4773215
9045 -- Modified the check for value in profile option CS_PUBLISH_FLAG_UPDATE
9046 -- This check will not allow creation of service request only if the profile
9047 -- option is set to NULL.
9048 -- 06/13/06 spusegao Modified fix big 5278488
9049 -- 1. Reverted the changes made in Validate_ServiceRequest_Record.
9050 -- 07/11/06 spusegao Modified to fix bug # 5361090.
9051 -- Added call to Validate_Platform_id procedure to validate platform_id.
9052 -- 09/20/06 spusegao Modified to not validate the publish_flag in the CREATE p_sr_mode.
9053 --------------------------------------------------------------------------------
9054 PROCEDURE Validate_ServiceRequest_Record
9055 ( p_api_name IN VARCHAR2,
9056 p_service_request_rec IN Request_Validation_Rec_Type,
9057 p_request_date IN DATE := FND_API.G_MISS_DATE,
9058 p_org_id IN NUMBER := NULL,
9059 p_resp_appl_id IN NUMBER := NULL,
9060 p_resp_id IN NUMBER := NULL,
9061 p_user_id IN NUMBER := NULL,
9062 p_operation IN VARCHAR2 := NULL,
9063 p_close_flag OUT NOCOPY VARCHAR2,
9064 p_disallow_request_update OUT NOCOPY VARCHAR2,
9065 p_disallow_owner_update OUT NOCOPY VARCHAR2,
9066 p_disallow_product_update OUT NOCOPY VARCHAR2,
9067 p_employee_name OUT NOCOPY VARCHAR2,
9068 p_inventory_item_id OUT NOCOPY NUMBER,
9069 p_contract_id OUT NOCOPY NUMBER,
9070 p_contract_number OUT NOCOPY VARCHAR2,
9071 x_bill_to_site_id OUT NOCOPY NUMBER,
9072 x_ship_to_site_id OUT NOCOPY NUMBER,
9073 x_bill_to_site_use_id OUT NOCOPY NUMBER,
9074 x_ship_to_site_use_id OUT NOCOPY NUMBER,
9075 x_return_status OUT NOCOPY VARCHAR2,
9076 x_group_name OUT NOCOPY VARCHAR2,
9077 x_owner_name OUT NOCOPY VARCHAR2,
9078 x_product_revision OUT NOCOPY VARCHAR2,
9079 x_component_version OUT NOCOPY VARCHAR2,
9080 x_subcomponent_version OUT NOCOPY VARCHAR2,
9081 -- for cmro
9082 p_cmro_flag IN VARCHAR2,
9083 p_maintenance_flag IN VARCHAR2,
9084 p_sr_mode IN VARCHAR2
9085 )
9086 IS
9087 l_return_status VARCHAR2(1);
9088 l_can_update VARCHAR2(1);
9089 l_cp_customer_id NUMBER := NULL;
9090 l_customer_id NUMBER ;
9091 l_bill_to_customer_id NUMBER := NULL;
9092 l_ship_to_customer_id NUMBER := NULL;
9093 l_install_customer_id NUMBER := NULL;
9094 l_owner_name VARCHAR2(240); -- dummy variable
9095 l_contract_number VARCHAR2(120);
9096 l_contract_id NUMBER := NULL;
9097 l_contra_id NUMBER := NULL;
9098 l_customer_type VARCHAR2(30);
9099 x_owner_id NUMBER;
9100 lx_cmro_flag VARCHAR2(10); -- new for 11.5.10
9101 lx_maintenance_flag VARCHAR2(10); -- new for 11.5.10
9102 -- contracts : 3224828 for 11.5.10
9103 l_busi_proc_id NUMBER;
9104 lx_return_status VARCHAR2(3);
9105 l_old_type_id NUMBER;
9106
9107 l_maint_organization_id cs_incidents_all_b.maint_organization_id % TYPE;
9108 l_inv_org_master_org_flag VARCHAR2(1);
9109 l_serial_controlled_flag VARCHAR2(3);
9110
9111 BEGIN
9112
9113 -- Initialize return status to success
9114 x_return_status := FND_API.G_RET_STS_SUCCESS;
9115
9116 --Assign value to l_customer_id based on caller type
9117
9118 IF (p_service_request_rec.caller_type = 'ORGANIZATION') THEN
9119 l_customer_id := p_service_request_rec.customer_id ;
9120 ELSIF (p_service_request_rec.caller_type = 'PERSON' ) THEN
9121 l_customer_id := p_service_request_rec.customer_id ;--Added for Bug 2167129
9122 END IF;
9123
9124 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(p_api_name, 'step val sr rec #1');
9125 -- Validate all non-missing attributes
9126
9127 /***** dj api cleanup
9128 -- commenting out call to validate type as this is done as the first step in
9129 -- both the create and update procedures
9130 IF FND_API.To_Boolean(p_service_request_rec.validate_type) THEN
9131 IF FND_API.To_Boolean(p_service_request_rec.status_id_change) THEN
9132 -- dj api cleanup
9133 CS_ServiceRequest_UTIL.Validate_Type (
9134 p_parameter_name => 'p_type_id',
9135 p_type_id => p_service_request_rec.type_id,
9136 p_subtype => G_SR_SUBTYPE,
9137 P_status_id => p_service_request_rec.updated_status_id,
9138 p_resp_id => p_resp_id,
9139 p_resp_appl_id => NVL(p_resp_appl_id,fnd_global.resp_appl_id) -- new for 11.5.10
9140 p_business_usage => NULL, -- new for 11.5.10
9141 p_ss_srtype_restrict => NULL, -- new for 11.5.10
9142 p_operation => p_operation,
9143 x_return_status => l_return_status,
9144 x_cmro_flag => lx_cmro_flag, -- new for 11.5.10
9145 x_maintenance_flag => lx_maintenance_flag ); -- new for 11.5.10
9146
9147 ELSE
9148 CS_ServiceRequest_UTIL.Validate_Type (
9149 p_parameter_name => 'p_type_id',
9150 p_type_id => p_service_request_rec.type_id,
9151 p_subtype => G_SR_SUBTYPE,
9152 P_status_id => p_service_request_rec.status_id,
9153 p_resp_id => p_resp_id,
9154 p_resp_appl_id => NVL(p_resp_appl_id,fnd_global.resp_appl_id) -- new for 11.5.10
9155 p_business_usage => NULL, -- new for 11.5.10
9156 p_ss_srtype_restrict => NULL, -- new for 11.5.10
9157 p_operation => p_operation,
9158 x_return_status => l_return_status,
9159 x_cmro_flag => lx_cmro_flag, -- new for 11.5.10
9160 x_maintenance_flag => lx_maintenance_flag ); -- new for 11.5.10
9161 END IF;
9162
9163 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9164 x_return_status := FND_API.G_RET_STS_ERROR;
9165 RETURN;
9166 END IF;
9167
9168 END IF;
9169
9170 end comment of type ********/
9171
9172 IF FND_API.To_Boolean(p_service_request_rec.validate_status) THEN
9173 CS_ServiceRequest_UTIL.Validate_Status
9174 ( p_api_name => p_api_name,
9175 p_parameter_name => 'p_status_id',
9176 p_status_id => p_service_request_rec.status_id,
9177 p_subtype => G_SR_SUBTYPE,
9178 p_type_id => p_service_request_rec.type_id,
9179 p_resp_id => p_resp_id,
9180 p_close_flag => p_close_flag,
9181 p_operation => p_sr_mode,
9182 x_return_status => l_return_status
9183 );
9184 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9185 x_return_status := FND_API.G_RET_STS_ERROR;
9186 RETURN;
9187 END IF;
9188 END IF;
9189
9190 IF FND_API.To_Boolean(p_service_request_rec.validate_updated_status) THEN
9191
9192 IF p_service_request_rec.old_type_id <> FND_API.G_MISS_NUM AND
9193 p_service_request_rec.old_type_id IS NOT NULL THEN
9194 l_old_type_id := p_service_request_rec.old_type_id;
9195 ELSE
9196 l_old_type_id := p_service_request_rec.type_id;
9197 END IF ;
9198
9199 CS_ServiceRequest_UTIL.Validate_Updated_Status
9200 ( p_api_name => p_api_name,
9201 p_parameter_name => 'p_status_id',
9202 p_resp_id => p_resp_id ,
9203 p_new_status_id => p_service_request_rec.updated_status_id,
9204 p_old_status_id => p_service_request_rec.status_id,
9205 p_subtype => G_SR_SUBTYPE,
9206 p_type_id => p_service_request_rec.type_id,
9207 p_old_type_id => l_old_type_id,
9208 p_close_flag => p_close_flag,
9209 p_disallow_request_update => p_disallow_request_update,
9210 p_disallow_owner_update => p_disallow_owner_update,
9211 p_disallow_product_update => p_disallow_product_update,
9212 x_return_status => l_return_status
9213 );
9214 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9215 x_return_status := FND_API.G_RET_STS_ERROR;
9216 RETURN;
9217 END IF;
9218 END IF;
9219
9220 -- CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(p_api_name, 'step val sr rec #3');
9221
9222 IF (p_service_request_rec.severity_id <> FND_API.G_MISS_NUM) THEN
9223
9224 CS_ServiceRequest_UTIL.Validate_Severity
9225 ( p_api_name => p_api_name,
9226 p_parameter_name => 'p_severity_id',
9227 p_severity_id => p_service_request_rec.severity_id,
9228 p_subtype => G_SR_SUBTYPE,
9229 x_return_status => l_return_status
9230 );
9231 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9232 x_return_status := FND_API.G_RET_STS_ERROR;
9233 RETURN;
9234 END IF;
9235 END IF;
9236
9237 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(p_api_name, 'step val sr rec #4');
9238
9239 IF (p_service_request_rec.urgency_id <> FND_API.G_MISS_NUM) THEN
9240
9241 CS_ServiceRequest_UTIL.Validate_Urgency
9242 ( p_api_name => p_api_name,
9243 p_parameter_name => 'p_urgency_id',
9244 p_urgency_id => p_service_request_rec.urgency_id,
9245 x_return_status => l_return_status
9246 );
9247 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9248 x_return_status := FND_API.G_RET_STS_ERROR;
9249 RETURN;
9250 END IF;
9251 END IF;
9252
9253 -- For bug 3635269
9254 -- Validate SR_CREATION_CHANNEL
9255
9256 IF (p_service_request_rec.sr_creation_channel <> FND_API.G_MISS_CHAR ) THEN
9257
9258 CS_ServiceRequest_UTIL.Validate_SR_Channel(
9259 p_api_name => p_api_name,
9260 p_parameter_name => 'p_sr_creation_channel',
9261 p_sr_creation_channel => p_service_request_rec.sr_creation_channel,
9262 x_return_status => l_return_status);
9263
9264 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9265 x_return_status := FND_API.G_RET_STS_ERROR;
9266 RETURN;
9267 END IF;
9268 END IF;
9269
9270 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(p_api_name, 'step val sr rec #6');
9271
9272 IF (p_service_request_rec.publish_flag <> FND_API.G_MISS_CHAR) AND
9273 p_sr_mode <> 'CREATE' THEN
9274
9275 FND_PROFILE.Get('INC_PUBLISH_FLAG_UPDATE', l_can_update) ;
9276
9277 IF ((l_can_update = 'N' ) OR (l_can_update IS NULL)) THEN
9278 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
9279 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_CANT_CHANGE_PUBLISH');
9280 FND_MESSAGE.Set_Token('API_NAME', p_api_name);
9281 FND_MSG_PUB.ADD;
9282 END IF;
9283 x_return_status := FND_API.G_RET_STS_ERROR;
9284 RETURN;
9285 END IF;
9286 END IF;
9287
9288 IF FND_API.To_Boolean(p_service_request_rec.validate_customer) THEN
9289
9290 CS_ServiceRequest_UTIL.Validate_Customer
9291 ( p_api_name => p_api_name,
9292 p_parameter_name => 'p_customer_id',
9293 p_caller_type => p_service_request_rec.caller_type, --Bug 3666089
9294 p_customer_id => p_service_request_rec.customer_id,
9295 x_return_status => l_return_status
9296 );
9297
9298 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9299 x_return_status := FND_API.G_RET_STS_ERROR;
9300 RETURN;
9301 END IF;
9302 END IF;
9303
9304 IF (p_service_request_rec.contact_id <> FND_API.G_MISS_NUM) THEN
9305 CS_ServiceRequest_UTIL.Validate_Customer_Contact
9306 ( p_api_name => p_api_name,
9307 p_parameter_name => 'p_contact_id',
9308 p_customer_contact_id => p_service_request_rec.contact_id,
9309 p_customer_id => p_service_request_rec.customer_id,
9310 p_org_id => p_org_id,
9311 p_customer_type => p_service_request_rec.caller_type,
9312 x_return_status => l_return_status
9313 );
9314 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9315 x_return_status := FND_API.G_RET_STS_ERROR;
9316 RETURN;
9317 END IF;
9318 END IF;
9319
9320 IF FND_API.To_Boolean(p_service_request_rec.validate_employee) THEN
9321 CS_ServiceRequest_UTIL.Validate_Employee
9322 ( p_api_name => p_api_name,
9323 p_parameter_name => 'p_employee_id',
9324 p_employee_id => p_service_request_rec.employee_id,
9325 p_org_id => p_org_id,
9326 p_employee_name => p_employee_name,
9327 x_return_status => l_return_status
9328 );
9329 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9330 x_return_status := FND_API.G_RET_STS_ERROR;
9331 RETURN;
9332 END IF;
9333
9334 -- If employee_id is passed, use the CP owning customer to verify the
9335 -- RMA, bill to site, and ship to site information.
9336
9337 -- l_cp_customer_id has null value in this case..
9338 l_customer_id := l_cp_customer_id ;
9339
9340 END IF;
9341
9342 -- For bug 2743507 , moving the call to validate inv org id before
9343 -- the validation of inv item id.
9344
9345 IF (p_service_request_rec.inventory_org_id <> FND_API.G_MISS_NUM) THEN
9346 CS_ServiceRequest_UTIL.Validate_Inventory_Org
9347 ( p_api_name => p_api_name,
9348 p_parameter_name => 'Inventory Organization',
9349 p_inv_org_id => p_service_request_rec.inventory_org_id,
9350 x_inv_org_master_org_flag => l_inv_org_master_org_flag,
9351 x_return_status => l_return_status
9352 );
9353 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9354 x_return_status := FND_API.G_RET_STS_ERROR;
9355 RETURN;
9356 END IF;
9357 END IF;
9358
9359 -- validate maintenance organization id
9360 IF (p_service_request_rec.maint_organization_id <> FND_API.G_MISS_NUM AND
9361 p_service_request_rec.maint_organization_id IS NOT NULL )
9362 THEN
9363 CS_SERVICEREQUEST_UTIL.validate_maint_organization_id
9364 ( p_maint_organization_id => p_service_request_rec.maint_organization_id
9365 , p_inventory_org_id => p_service_request_rec.inventory_org_id
9366 , p_inv_org_master_org_flag => l_inv_org_master_org_flag
9367 , x_return_status => l_return_status
9368 );
9369 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9370 x_return_status := FND_API.G_RET_STS_ERROR;
9371 RETURN;
9372 END IF ;
9373 END IF ;
9374 --
9375
9376 IF (p_service_request_rec.inventory_item_id <> FND_API.G_MISS_NUM)
9377 AND (p_sr_mode = 'CREATE') THEN
9378 IF ((p_service_request_rec.inventory_org_id = FND_API.G_MISS_NUM) OR
9379 (p_service_request_rec.inventory_org_id IS NULL)) THEN
9380
9381 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
9382 ( p_token_an => p_api_name,
9383 p_token_np => 'p_inventory_org_id',
9384 p_table_name => G_TABLE_NAME,
9385 p_column_name => 'INV_ORGANIZATION_ID');
9386
9387 x_return_status := FND_API.G_RET_STS_ERROR;
9388 RETURN;
9389 END IF;
9390 CS_ServiceRequest_UTIL.Validate_Product
9391 ( p_api_name => p_api_name,
9392 p_parameter_name => 'p_inventory_item_id',
9393 p_inventory_item_id => p_service_request_rec.inventory_item_id,
9394 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9395 x_return_status => l_return_status,
9396 p_maintenance_flag => p_maintenance_flag,
9397 p_maint_organization_id => p_service_request_rec.maint_organization_id,
9398 p_inv_org_master_org_flag => l_inv_org_master_org_flag
9399 );
9400 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9401 x_return_status := FND_API.G_RET_STS_ERROR;
9402 RETURN;
9403 END IF;
9404 END IF;
9405
9406 /* For bug 3340433
9407 Moved validate_customer_product before other validations that
9408 uses inventory item id */
9409
9410
9411
9412 p_inventory_item_id := p_service_request_rec.inventory_item_id;
9413
9414 IF (p_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM)
9415 AND (p_sr_mode = 'CREATE') THEN
9416 IF ((p_service_request_rec.inventory_org_id = FND_API.G_MISS_NUM) OR
9417 (p_service_request_rec.inventory_org_id IS NULL)) THEN
9418
9419 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
9420 ( p_token_an => p_api_name,
9421 p_token_np => 'p_inventory_org_id',
9422 p_table_name => G_TABLE_NAME,
9423 p_column_name => 'INV_ORGANIZATION_ID');
9424
9425 x_return_status := FND_API.G_RET_STS_ERROR;
9426 RETURN;
9427 END IF;
9428 IF p_service_request_rec.maint_organization_id = FND_API.G_MISS_NUM
9429 THEN
9430 l_maint_organization_id := NULL;
9431 ELSE
9432 l_maint_organization_id := p_service_request_rec.maint_organization_id;
9433 ENd IF;
9434 CS_ServiceRequest_UTIL.Validate_Customer_Product_id
9435 (p_customer_product_id => p_service_request_rec.customer_product_id,
9436 p_customer_id => p_service_request_rec.customer_id,
9437 p_inventory_item_id => p_inventory_item_id,
9438 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9439 p_maint_organization_id=> l_maint_organization_id,
9440 p_inv_org_master_org_flag => l_inv_org_master_org_flag,
9441 x_return_status => l_return_status
9442 );
9443
9444 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9445 x_return_status := FND_API.G_RET_STS_ERROR;
9446 RETURN;
9447 END IF;
9448
9449 -- For bug 3340433
9450 IF (nvl(p_service_request_rec.inventory_item_id,-99) <> FND_API.G_MISS_NUM) then
9451 If (p_service_request_rec.inventory_item_id <> p_inventory_item_id) then
9452 --Raise an ignore message;
9453 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
9454 p_token_an => p_api_name,
9455 p_token_ip => 'p_inventory_item_id' );
9456 End if;
9457 END IF;
9458
9459 END IF;
9460
9461 /* For bug 3340433
9462 Passing p_inventory_item_id intead of
9463 p_service_request_rec.inventory_item_id */
9464
9465 -- if customer product is NULL then current serial can be free format. 3/25/05 smisra
9466 IF (p_service_request_rec.current_serial_number <> FND_API.G_MISS_CHAR) AND
9467 (p_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM)
9468 AND (p_sr_mode = 'CREATE') THEN
9469
9470 CS_ServiceRequest_UTIL.Validate_Current_Serial
9471 ( p_api_name => p_api_name,
9472 p_parameter_name => 'p_current_serial_number',
9473 p_inventory_item_id => p_inventory_item_id,
9474 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9475 p_customer_product_id => p_service_request_rec.customer_product_id,
9476 p_customer_id => p_service_request_rec.customer_id,
9477 p_current_serial_number => p_service_request_rec.current_serial_number,
9478 x_return_status => l_return_status
9479 );
9480 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9481 x_return_status := FND_API.G_RET_STS_ERROR;
9482 RETURN;
9483 END IF;
9484 END IF;
9485
9486
9487 -- for cmro_eam
9488
9489 IF p_service_request_rec.owning_dept_id <> FND_API.G_MISS_NUM AND
9490 p_sr_mode = 'CREATE'
9491 THEN
9492 CS_ServiceRequest_UTIL.Validate_Owning_department
9493 ( p_api_name => p_api_name
9494 , p_parameter_name => 'Owning Department'
9495 , p_inv_org_id => p_service_request_rec.maint_organization_id
9496 , p_owning_dept_id => p_service_request_rec.owning_dept_id
9497 , p_maintenance_flag => p_maintenance_flag
9498 , x_return_status => l_return_status
9499 );
9500 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
9501 THEN
9502 x_return_status := FND_API.G_RET_STS_ERROR;
9503 RETURN;
9504 END IF;
9505 END IF;
9506
9507 -- end of cmro_eam
9508
9509 IF (p_service_request_rec.problem_code <> FND_API.G_MISS_CHAR)
9510 AND (p_sr_mode = 'CREATE') THEN
9511
9512 CS_ServiceRequest_UTIL.Validate_Problem_Code
9513 ( p_api_name => p_api_name,
9514 p_parameter_name => 'p_problem_code',
9515 p_problem_code => p_service_request_rec.problem_code,
9516 p_incident_type_id => p_service_request_rec.type_id,
9517 p_inventory_item_id => p_inventory_item_id,
9518 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9519 p_category_id => p_service_request_rec.category_id,
9520 x_return_status => l_return_status
9521 );
9522 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9523 x_return_status := FND_API.G_RET_STS_ERROR;
9524 RETURN;
9525 END IF;
9526 END IF;
9527
9528 -----------Added for enhancement ---11.5.6----jngeorge-----07/20/01
9529 -----------Validation is required for Cust_Pref_Lang_Id,Comm_Pref_Code and
9530 -----------Category_Id.
9531
9532 IF (p_service_request_rec.cust_pref_lang_code <> FND_API.G_MISS_CHAR) THEN
9533 CS_ServiceRequest_UTIL.Validate_Cust_Pref_Lang_Code
9534 ( p_api_name => p_api_name,
9535 p_parameter_name => 'p_cust_pref_lang_code',
9536 p_cust_pref_lang_code => p_service_request_rec.cust_pref_lang_code,
9537 x_return_status => l_return_status
9538 );
9539 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9540 x_return_status := FND_API.G_RET_STS_ERROR;
9541 RETURN;
9542 END IF;
9543 END IF;
9544
9545 IF (p_service_request_rec.category_set_id <> FND_API.G_MISS_NUM)
9546 AND (p_sr_mode = 'CREATE') THEN
9547 CS_ServiceRequest_UTIL.Validate_Category_Set_Id
9548 ( p_api_name => p_api_name,
9549 p_parameter_name => 'p_category_set_id',
9550 p_category_id => p_service_request_rec.category_id,
9551 p_category_set_id => p_service_request_rec.category_set_id,
9552 p_inventory_item_id => p_inventory_item_id,
9553 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9554 x_return_status => l_return_status
9555 );
9556 /* added inv org id parameter for Bug 2661668/2648017 */
9557 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9558 x_return_status := FND_API.G_RET_STS_ERROR;
9559 RETURN;
9560 END IF;
9561 END IF;
9562
9563 IF (p_service_request_rec.external_reference <> FND_API.G_MISS_CHAR)
9564 AND (p_sr_mode = 'CREATE') THEN
9565 -- For bug 3746983
9566 CS_ServiceRequest_UTIL.Validate_External_Reference
9567 ( p_api_name => p_api_name,
9568 p_parameter_name => 'p_external_reference',
9569 p_external_reference => p_service_request_rec.external_reference,
9570 p_customer_product_id => p_service_request_rec.customer_product_id,
9571 p_inventory_item_id => p_inventory_item_id,
9572 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9573 p_customer_id => p_service_request_rec.customer_id,
9574 x_return_status => l_return_status
9575 );
9576 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9577 x_return_status := FND_API.G_RET_STS_ERROR;
9578 RETURN;
9579 END IF;
9580 END IF;
9581
9582 IF (p_service_request_rec.system_id <> FND_API.G_MISS_NUM) THEN
9583 CS_ServiceRequest_UTIL.Validate_System_Id
9584 ( p_api_name => p_api_name,
9585 p_parameter_name => 'p_system_id',
9586 p_system_id => p_service_request_rec.system_id,
9587 x_return_status => l_return_status
9588 );
9589 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9590 x_return_status := FND_API.G_RET_STS_ERROR;
9591 RETURN;
9592 END IF;
9593 END IF;
9594
9595 IF (p_service_request_rec.comm_pref_code <> FND_API.G_MISS_CHAR) THEN
9596 CS_ServiceRequest_UTIL.Validate_Comm_Pref_Code
9597 ( p_api_name => p_api_name,
9598 p_parameter_name => 'p_comm_pref_code',
9599 p_comm_pref_code => p_service_request_rec.comm_pref_code,
9600 x_return_status => l_return_status
9601 );
9602 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9603 x_return_status := FND_API.G_RET_STS_ERROR;
9604 RETURN;
9605 END IF;
9606 END IF;
9607
9608 IF (p_service_request_rec.category_id <> FND_API.G_MISS_NUM AND
9609 (p_service_request_rec.category_set_id = FND_API.G_MISS_NUM OR
9610 p_service_request_rec.category_set_id IS NULL) )
9611 AND (p_sr_mode = 'CREATE') THEN
9612 CS_ServiceRequest_UTIL.Validate_Category_Id
9613 ( p_api_name => p_api_name,
9614 p_parameter_name => 'p_category_id',
9615 p_category_id => p_service_request_rec.category_id,
9616 p_category_set_id=> p_service_request_rec.category_set_id,
9617 x_return_status => l_return_status
9618 );
9619 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9620 x_return_status := FND_API.G_RET_STS_ERROR;
9621 RETURN;
9622 END IF;
9623 END IF;
9624
9625 IF (p_service_request_rec.group_type <> FND_API.G_MISS_CHAR) THEN
9626 CS_ServiceRequest_UTIL.Validate_Group_Type
9627 ( p_api_name => p_api_name,
9628 p_parameter_name => 'p_group_type',
9629 p_group_type => p_service_request_rec.group_type,
9630 --p_resource_type => p_service_request_rec.resource_type,
9631 x_return_status => l_return_status
9632 );
9633
9634 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9635 x_return_status := FND_API.G_RET_STS_ERROR;
9636 RETURN;
9637 END IF;
9638 END IF;
9639
9640 IF (p_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM) THEN
9641 CS_ServiceRequest_UTIL.Validate_Group_Id
9642 ( p_api_name => p_api_name,
9643 p_parameter_name => 'p_owner_group_id',
9644 p_group_type => p_service_request_rec.group_type,
9645 p_owner_group_id => p_service_request_rec.owner_group_id,
9646 x_group_name => x_group_name,
9647 x_return_status => l_return_status
9648 );
9649
9650 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9651 x_return_status := FND_API.G_RET_STS_ERROR;
9652 RETURN;
9653 END IF;
9654 END IF;
9655
9656 IF (p_service_request_rec.exp_resolution_date <> FND_API.G_MISS_DATE) THEN
9657 CS_ServiceRequest_UTIL.Validate_Exp_Resolution_Date
9658 ( p_api_name => p_api_name,
9659 p_parameter_name => 'p_exp_resolution_date',
9660 p_exp_resolution_date => p_service_request_rec.exp_resolution_date,
9661 p_request_date => p_request_date,
9662 x_return_status => l_return_status
9663 );
9664 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9665 x_return_status := FND_API.G_RET_STS_ERROR;
9666 RETURN;
9667 END IF;
9668 END IF;
9669
9670 -- IF FND_API.To_Boolean(p_service_request_rec.validate_bill_to_party) THEN
9671 -- Added one more parameter as customer_type to get the bill_to_customer_type
9672 -- which will be used in validate_bill_to_ship_to_ct
9673 -- Getting the value of l_customer_type from header caller_type
9674 -- done by shijain
9675
9676 l_customer_type:= p_service_request_rec.caller_type;
9677
9678 IF (p_service_request_rec.bill_to_party_id <> FND_API.G_MISS_NUM) THEN
9679 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Party
9680 ( p_api_name => p_api_name,
9681 p_parameter_name => 'Bill_To Party',
9682 p_bill_to_party_id => p_service_request_rec.bill_to_party_id,
9683 p_customer_id => p_service_request_rec.customer_id,
9684 x_customer_type => l_customer_type,
9685 x_return_status => l_return_status
9686 );
9687 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9688 x_return_status := FND_API.G_RET_STS_ERROR;
9689 RETURN;
9690 END IF;
9691 END IF;
9692
9693 /******************************************************************
9694 Commented now but should be uncommented for 11.5.10
9695 IF (FND_API.To_Boolean(p_service_request_rec.validate_bill_to_site) OR
9696 (p_service_request_rec.bill_to_site_id <> FND_API.G_MISS_NUM)) THEN
9697
9698 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
9699 ( p_api_name => p_api_name,
9700 p_parameter_name => 'Bill_To Site ',
9701 p_bill_to_site_id => p_service_request_rec.bill_to_site_id,
9702 p_bill_to_party_id => p_service_request_rec.bill_to_party_id,
9703 p_site_use_type => 'BILL_TO',
9704 x_site_use_id => x_site_use_id,
9705 x_return_status => l_return_status
9706 );
9707 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9708 x_return_status := FND_API.G_RET_STS_ERROR;
9709 RETURN;
9710 END IF;
9711 END IF;
9712 Commented now but should be uncommented for 11.5.10
9713 *****************************************************************/
9714
9715 IF (p_service_request_rec.bill_to_Contact_id <> FND_API.G_MISS_NUM)
9716 AND (p_sr_mode = 'CREATE') THEN
9717 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Ct
9718 ( p_api_name => p_api_name,
9719 p_parameter_name => 'Bill_To Contact',
9720 p_bill_to_contact_id => p_service_request_rec.bill_to_contact_id,
9721 p_bill_to_party_id => p_service_request_rec.bill_to_party_id ,
9722 p_customer_type => l_customer_type ,
9723 x_return_status => l_return_status
9724 );
9725 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9726 x_return_status := FND_API.G_RET_STS_ERROR;
9727 RETURN;
9728 END IF;
9729 END IF;
9730
9731 -- Validate the Ship_To_Party - Use the validate_bill_to_party procedure
9732 -- IF FND_API.To_Boolean(p_service_request_rec.validate_bill_to_party) THEN
9733 -- Added one more parameter as customer_type to get the bill_to_customer_type
9734 -- which will be used in validate_bill_to_ship_to_ct
9735 -- Getting the value of l_customer_type from header caller_type
9736 -- done by shijain
9737
9738 l_customer_type:= p_service_request_rec.caller_type;
9739
9740 IF (p_service_request_rec.ship_to_party_id <> FND_API.G_MISS_NUM) THEN
9741 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Party
9742 ( p_api_name => p_api_name,
9743 p_parameter_name => 'Ship_To Party',
9744 p_bill_to_party_id => p_service_request_rec.ship_to_party_id,
9745 p_customer_id => p_service_request_rec.customer_id,
9746 x_customer_type => l_customer_type,
9747 x_return_status => l_return_status
9748 );
9749 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9750 x_return_status := FND_API.G_RET_STS_ERROR;
9751 RETURN;
9752 END IF;
9753 END IF;
9754
9755 /******************************************************************
9756 Should be uncommented for 115.10
9757 -- Validate the Ship_To_Site - Use the validate_bill_to_site procedure itself
9758
9759 IF (FND_API.To_Boolean(p_service_request_rec.validate_ship_to_site) OR
9760 (p_service_request_rec.ship_to_site_id <> FND_API.G_MISS_NUM)) THEN
9761
9762 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
9763 ( p_api_name => p_api_name,
9764 p_parameter_name => 'Ship_To Site ',
9765 p_bill_to_site_id => p_service_request_rec.ship_to_site_id,
9766 p_bill_to_party_id => p_service_request_rec.ship_to_party_id,
9767 p_site_use_type => 'SHIP_TO',
9768 x_site_use_id => x_site_use_id,
9769 x_return_status => l_return_status
9770 );
9771 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9772 x_return_status := FND_API.G_RET_STS_ERROR;
9773 RETURN;
9774 END IF;
9775 END IF;
9776 Should be uncommented for 11.5.10
9777 ********************************************************************/
9778
9779 -- Validate the Ship_To_Contact - Use the validate_bill_to_Contact procedure itself
9780
9781 IF (p_service_request_rec.ship_to_Contact_id <> FND_API.G_MISS_NUM)
9782 AND (p_sr_mode = 'CREATE') THEN
9783 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Ct
9784 ( p_api_name => p_api_name,
9785 p_parameter_name => 'Ship_To Contact',
9786 p_bill_to_contact_id => p_service_request_rec.ship_to_contact_id,
9787 p_bill_to_party_id => p_service_request_rec.ship_to_party_id ,
9788 p_customer_type => l_customer_type ,
9789 x_return_status => l_return_status
9790 );
9791 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9792 x_return_status := FND_API.G_RET_STS_ERROR;
9793 RETURN;
9794 END IF;
9795 END IF;
9796
9797 --Code added to validate install site
9798 --IF FND_API.To_Boolean(p_service_request_rec.validate_install_site) THEN
9799 IF ( p_service_request_rec.install_site_id <> FND_API.G_MISS_NUM AND
9800 p_service_request_rec.install_site_id IS NOT NULL) THEN
9801 CS_ServiceRequest_UTIL.Validate_Install_Site (
9802 p_parameter_name => 'Install Site',
9803 p_install_site_id => p_service_request_rec.install_site_id,
9804 p_customer_id => l_customer_id,
9805 x_return_status => l_return_status
9806 );
9807 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9808 x_return_status := FND_API.G_RET_STS_ERROR;
9809 RETURN;
9810 END IF;
9811 END IF;
9812
9813 IF ( p_service_request_rec.install_site_use_id <> FND_API.G_MISS_NUM AND
9814 p_service_request_rec.install_site_use_id IS NOT NULL) THEN
9815 CS_ServiceRequest_UTIL.Validate_Install_Site (
9816 p_parameter_name => 'Install Site Use',
9817 p_install_site_id => p_service_request_rec.install_site_use_id,
9818 p_customer_id => l_customer_id,
9819 x_return_status => l_return_status
9820 );
9821 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9822 x_return_status := FND_API.G_RET_STS_ERROR;
9823 RETURN;
9824 END IF;
9825 END IF;
9826
9827 IF ( ( p_service_request_rec.ship_to_site_id <> FND_API.G_MISS_NUM AND
9828 p_service_request_rec.ship_to_site_id IS NOT NULL ) AND
9829 ( p_service_request_rec.ship_to_site_use_id <> FND_API.G_MISS_NUM AND
9830 p_service_request_rec.ship_to_site_use_id IS NOT NULL ) AND
9831 ( p_sr_mode = 'CREATE') ) THEN
9832
9833 CS_ServiceRequest_UTIL.Validate_Site_Site_Use
9834 ( p_api_name => p_api_name,
9835 p_parameter_name => 'Ship_To Site and/or Site Use ',
9836 p_site_id => p_service_request_rec.ship_to_site_id,
9837 p_site_use_id => p_service_request_rec.ship_to_site_use_id,
9838 p_party_id => p_service_request_rec.ship_to_party_id,
9839 p_site_use_type => 'SHIP_TO',
9840 x_return_status => l_return_status
9841 );
9842 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9843 x_return_status := FND_API.G_RET_STS_ERROR;
9844 RETURN;
9845 END IF;
9846 ELSIF ( ( p_service_request_rec.ship_to_site_use_id <> FND_API.G_MISS_NUM AND
9847 p_service_request_rec.ship_to_site_use_id IS NOT NULL ) AND
9848 ( p_service_request_rec.ship_to_site_id IS NULL OR
9849 p_service_request_rec.ship_to_site_id = FND_API.G_MISS_NUM ) AND
9850 ( p_sr_mode = 'CREATE') ) THEN
9851
9852 CS_ServiceRequest_UTIL.Validate_Bill_Ship_Site_Use
9853 ( p_api_name => p_api_name,
9854 p_parameter_name => 'Ship_To Site Use ',
9855 p_site_use_id => p_service_request_rec.ship_to_site_use_id,
9856 p_party_id => p_service_request_rec.ship_to_party_id,
9857 p_site_use_type => 'SHIP_TO',
9858 x_site_id => x_ship_to_site_id,
9859 x_return_status => l_return_status
9860 );
9861 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9862 x_return_status := FND_API.G_RET_STS_ERROR;
9863 RETURN;
9864 END IF;
9865 ELSIF ( ( p_service_request_rec.ship_to_site_id <> FND_API.G_MISS_NUM AND
9866 p_service_request_rec.ship_to_site_id IS NOT NULL ) AND
9867 ( p_service_request_rec.ship_to_site_use_id IS NULL OR
9868 p_service_request_rec.ship_to_site_use_id = FND_API.G_MISS_NUM ) AND
9869 ( p_sr_mode = 'CREATE') ) THEN
9870
9871 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
9872 ( p_api_name => p_api_name,
9873 p_parameter_name => 'Ship_To Site ',
9874 p_bill_to_site_id => p_service_request_rec.ship_to_site_id,
9875 p_bill_to_party_id => p_service_request_rec.ship_to_party_id,
9876 p_site_use_type => 'SHIP_TO',
9877 x_site_use_id => x_ship_to_site_use_id,
9878 x_return_status => l_return_status
9879 );
9880 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9881 x_return_status := FND_API.G_RET_STS_ERROR;
9882 RETURN;
9883 END IF;
9884 END IF;
9885
9886
9887 IF ( ( p_service_request_rec.bill_to_site_id <> FND_API.G_MISS_NUM AND
9888 p_service_request_rec.bill_to_site_id IS NOT NULL ) AND
9889 ( p_service_request_rec.bill_to_site_use_id <> FND_API.G_MISS_NUM AND
9890 p_service_request_rec.bill_to_site_use_id IS NOT NULL ) AND
9891 ( p_sr_mode = 'CREATE') ) THEN
9892
9893 CS_ServiceRequest_UTIL.Validate_Site_Site_Use
9894 ( p_api_name => p_api_name,
9895 p_parameter_name => 'Bill_to Site and/or Site Use ',
9896 p_site_id => p_service_request_rec.bill_to_site_id,
9897 p_site_use_id => p_service_request_rec.bill_to_site_use_id,
9898 p_party_id => p_service_request_rec.bill_to_party_id,
9899 p_site_use_type => 'BILL_TO',
9900 x_return_status => l_return_status
9901 );
9902 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9903 x_return_status := FND_API.G_RET_STS_ERROR;
9904 RETURN;
9905 END IF;
9906 ELSIF ( ( p_service_request_rec.bill_to_site_use_id <> FND_API.G_MISS_NUM AND
9907 p_service_request_rec.bill_to_site_use_id IS NOT NULL ) AND
9908 ( p_service_request_rec.bill_to_site_id IS NULL OR
9909 p_service_request_rec.bill_to_site_id = FND_API.G_MISS_NUM ) AND
9910 ( p_sr_mode = 'CREATE') ) THEN
9911
9912 CS_ServiceRequest_UTIL.Validate_Bill_Ship_Site_Use
9913 ( p_api_name => p_api_name,
9914 p_parameter_name => 'Bill_to Site Use ',
9915 p_site_use_id => p_service_request_rec.bill_to_site_use_id,
9916 p_party_id => p_service_request_rec.bill_to_party_id,
9917 p_site_use_type => 'BILL_TO',
9918 x_site_id => x_bill_to_site_id,
9919 x_return_status => l_return_status
9920 );
9921 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9922 x_return_status := FND_API.G_RET_STS_ERROR;
9923 RETURN;
9924 END IF;
9925
9926 ELSIF ( ( p_service_request_rec.bill_to_site_id <> FND_API.G_MISS_NUM AND
9927 p_service_request_rec.bill_to_site_id IS NOT NULL ) AND
9928 ( p_service_request_rec.bill_to_site_use_id IS NULL OR
9929 p_service_request_rec.bill_to_site_use_id = FND_API.G_MISS_NUM ) AND
9930 ( p_sr_mode = 'CREATE') ) THEN
9931 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Site
9932 ( p_api_name => p_api_name,
9933 p_parameter_name => 'Bill_to Site ',
9934 p_bill_to_site_id => p_service_request_rec.bill_to_site_id,
9935 p_bill_to_party_id => p_service_request_rec.bill_to_party_id,
9936 p_site_use_type => 'BILL_TO',
9937 x_site_use_id => x_bill_to_site_use_id,
9938 x_return_status => l_return_status
9939 );
9940 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9941 x_return_status := FND_API.G_RET_STS_ERROR;
9942 RETURN;
9943 END IF;
9944 END IF;
9945
9946 IF (p_service_request_rec.resolution_code <> FND_API.G_MISS_CHAR)
9947 AND (p_sr_mode = 'CREATE') THEN
9948
9949 cs_servicerequest_util.resolution_code_cross_val (
9950 p_parameter_name => 'p_resolution_code',
9951 p_resolution_code => p_service_request_rec.resolution_code,
9952 p_problem_code => p_service_request_rec.problem_code,
9953 p_incident_type_id => p_service_request_rec.type_id,
9954 p_category_id => p_service_request_rec.category_id,
9955 p_inventory_item_id => p_inventory_item_id,
9956 p_inventory_org_id => p_service_request_rec.inventory_org_id,
9957 x_return_status => l_return_status );
9958
9959 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9960 x_return_status := FND_API.G_RET_STS_ERROR;
9961 RETURN;
9962 END IF;
9963 END IF;
9964
9965 IF (p_service_request_rec.act_resolution_date <> FND_API.G_MISS_DATE) THEN
9966 CS_ServiceRequest_UTIL.Validate_Act_Resolution_Date
9967 ( p_api_name => p_api_name,
9968 p_parameter_name => 'p_act_resolution_date',
9969 p_act_resolution_date => p_service_request_rec.act_resolution_date,
9970 p_request_date => p_request_date,
9971 x_return_status => l_return_status
9972 );
9973 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
9974 x_return_status := FND_API.G_RET_STS_ERROR;
9975 RETURN;
9976 END IF;
9977 END IF;
9978
9979 IF (p_service_request_rec.current_contact_time_diff <> FND_API.G_MISS_NUM) THEN
9980 IF ((p_service_request_rec.current_contact_time_diff < -24) OR
9981 (p_service_request_rec.current_contact_time_diff > 24)) THEN
9982
9983 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
9984 ( p_token_an => 'p_api_name',
9985 p_token_v => TO_CHAR(p_service_request_rec.current_contact_time_diff),
9986 p_token_p => 'p_contact_time_diff',
9987 p_table_name => G_TABLE_NAME ,
9988 p_column_name => 'CURRENT_CONTACT_TIME_DIFF');
9989
9990 x_return_status := FND_API.G_RET_STS_ERROR;
9991 RETURN;
9992 END IF;
9993 END IF;
9994
9995 IF (p_service_request_rec.rep_by_time_difference <> FND_API.G_MISS_NUM) THEN
9996 IF ((p_service_request_rec.rep_by_time_difference < -24) OR
9997 (p_service_request_rec.rep_by_time_difference > 24)) THEN
9998
9999 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
10000 ( p_token_an => 'p_api_name',
10001 p_token_v => TO_CHAR(p_service_request_rec.rep_by_time_difference),
10002 p_token_p => 'p_represented_by_time_diff',
10003 p_table_name => G_TABLE_NAME ,
10004 p_column_name => 'REP_BY_TIME_DIFFERENCE' );
10005
10006 x_return_status := FND_API.G_RET_STS_ERROR;
10007 RETURN;
10008 END IF;
10009 END IF;
10010
10011 --
10012 -- Validate contract id 04/16/01
10013 --
10014 IF (p_service_request_rec.contract_id <> FND_API.G_MISS_NUM) AND
10015 (p_service_request_rec.contract_id IS NOT NULL) AND
10016 (p_service_request_rec.contract_service_id IS NULL OR
10017 p_service_request_rec.contract_service_id = FND_API.G_MISS_NUM) THEN
10018
10019 CS_ServiceRequest_UTIL.Validate_Contract_Id(
10020 p_api_name => p_api_name,
10021 p_parameter_name => 'p_contract_id',
10022 p_contract_id => p_service_request_rec.contract_id,
10023 x_contract_number => p_contract_number,
10024 x_return_status => l_return_status);
10025
10026 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10027 x_return_status := FND_API.G_RET_STS_ERROR;
10028 RETURN;
10029 END IF;
10030
10031 IF (p_service_request_rec.contract_id IS NOT NULL) AND
10032 (p_service_request_rec.contract_id <> FND_API.G_MISS_NUM) THEN
10033 p_contract_id := p_service_request_rec.contract_id;
10034 END IF;
10035 END IF;
10036
10037
10038 --04/16/01
10039 --
10040 -- Validate Account Id
10041 --
10042 IF (p_service_request_rec.account_id <> FND_API.G_MISS_NUM AND
10043 p_service_request_rec.account_id IS NOT NULL) THEN
10044
10045 IF (p_service_request_rec.caller_type = 'ORGANIZATION') THEN
10046
10047 --p_org_id => p_org_id,
10048
10049 CS_ServiceRequest_UTIL.Validate_Account_Id(
10050 p_api_name => p_api_name,
10051 p_parameter_name => 'p_account_id',
10052 p_account_id => p_service_request_rec.account_id,
10053 p_customer_id => p_service_request_rec.customer_id,
10054 x_return_status => l_return_status);
10055
10056 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10057 x_return_status := FND_API.G_RET_STS_ERROR;
10058 RETURN;
10059 END IF;
10060 ELSIF (p_service_request_rec.caller_type = 'PERSON') THEN
10061
10062 CS_ServiceRequest_UTIL.Validate_Account_Id(
10063 p_api_name => p_api_name,
10064 p_parameter_name => 'p_account_id',
10065 p_account_id => p_service_request_rec.account_id,
10066 p_customer_id => p_service_request_rec.customer_id,
10067 x_return_status => l_return_status);
10068
10069 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10070 x_return_status := FND_API.G_RET_STS_ERROR;
10071 RETURN;
10072 END IF;
10073 ELSE
10074 NULL;
10075 END IF;
10076 END IF;
10077
10078 --
10079 -- Validate Platform Id
10080 --
10081
10082 IF (p_service_request_rec.platform_id <> FND_API.G_MISS_NUM AND
10083 p_service_request_rec.platform_id IS NOT NULL) THEN
10084
10085 CS_ServiceRequest_UTIL.Validate_Platform_Id(
10086 p_api_name => p_api_name,
10087 p_parameter_name => 'p_platform_id',
10088 p_platform_id => p_service_request_rec.platform_id,
10089 p_organization_id => p_service_request_rec.inv_platform_org_id,
10090 x_serial_controlled_flag => l_serial_controlled_flag,
10091 x_return_status => l_return_status);
10092
10093 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10094 x_return_status := FND_API.G_RET_STS_ERROR;
10095 RETURN;
10096 END IF;
10097 END IF;
10098
10099 IF (NVL(l_serial_controlled_flag,'N') = 'Y' AND
10100 (p_service_request_rec.platform_version <> FND_API.G_MISS_CHAR AND
10101 p_service_request_rec.platform_version is NOT NULL)
10102 ) OR
10103 (
10104 p_service_request_rec.platform_version_id <> FND_API.G_MISS_NUM AND
10105 p_service_request_rec.platform_version_id is NOT NULL AND
10106 p_service_request_rec.platform_version <> FND_API.G_MISS_CHAR AND
10107 p_service_request_rec.platform_version is NOT NULL
10108 )THEN
10109 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
10110 ( p_token_an => p_api_name,
10111 p_token_v => p_service_request_rec.platform_version,
10112 p_token_p => 'p_platform_version',
10113 p_table_name => G_TABLE_NAME ,
10114 p_column_name => 'PLATFORM_VERSION');
10115
10116 FND_MSG_PUB.Add;
10117 x_return_status := FND_API.G_RET_STS_ERROR;
10118 RETURN;
10119 END IF;
10120 --
10121 -- Validate Platform Version Id
10122 --
10123 IF (p_service_request_rec.platform_id <> FND_API.G_MISS_NUM AND
10124 p_service_request_rec.platform_id IS NOT NULL) AND
10125 (p_service_request_rec.platform_version_id <> FND_API.G_MISS_NUM AND
10126 p_service_request_rec.platform_version_id IS NOT NULL) THEN
10127
10128 CS_ServiceRequest_UTIL.Validate_Platform_Version_Id(
10129 p_api_name => p_api_name,
10130 p_parameter_name => 'p_platform_Version_id',
10131 p_platform_id => p_service_request_rec.platform_id,
10132 p_organization_id => p_service_request_rec.inv_platform_org_id,
10133 p_platform_version_id => p_service_request_rec.platform_Version_id,
10134 x_return_status => l_return_status);
10135
10136 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10137 x_return_status := FND_API.G_RET_STS_ERROR;
10138 RETURN;
10139 END IF;
10140 END IF;
10141
10142
10143
10144 -- Validate Territory Id
10145 --
10146 IF (p_service_request_rec.territory_id <> FND_API.G_MISS_NUM AND
10147 p_service_request_rec.territory_id IS NOT NULL) THEN
10148
10149 CS_ServiceRequest_UTIL.Validate_Territory_Id(
10150 p_api_name => p_api_name,
10151 p_parameter_name => 'p_territory_id',
10152 p_territory_id => p_service_request_rec.territory_id,
10153 p_owner_id => p_service_request_rec.owner_id,
10154 x_return_status => l_return_status);
10155
10156 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10157 x_return_status := FND_API.G_RET_STS_ERROR;
10158 RETURN;
10159 END IF;
10160 END IF;
10161
10162 --Validate all the CP Fields only if customer_product_id is specified. If not, then
10163 --validate the Inv Fields.
10164
10165 IF (p_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM AND
10166 p_service_request_rec.customer_product_id IS NOT NULL) THEN
10167
10168 IF (p_service_request_rec.cp_component_id <> FND_API.G_MISS_NUM AND
10169 p_service_request_rec.cp_component_id IS NOT NULL)
10170 AND (p_sr_mode = 'CREATE') THEN
10171
10172 CS_ServiceRequest_UTIL.Validate_CP_Comp_Id(
10173 p_api_name => p_api_name,
10174 p_parameter_name => 'p_cp_component_id',
10175 p_cp_component_id => p_service_request_rec.cp_component_id,
10176 p_customer_product_id => p_service_request_rec.customer_product_id,
10177 p_org_id => p_org_id,
10178 x_return_status => l_return_status);
10179
10180 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10181 x_return_status := FND_API.G_RET_STS_ERROR;
10182 RETURN;
10183 END IF;
10184
10185 IF (p_service_request_rec.inv_component_id <> FND_API.G_MISS_NUM AND
10186 p_service_request_rec.inv_component_id IS NOT NULL) THEN
10187
10188 CS_ServiceRequest_UTIL.INV_COMPONENT_CROSS_VAL (
10189 p_parameter_name => 'Inventory component',
10190 p_cp_component_id => p_service_request_rec.cp_component_id,
10191 p_inv_component_id => p_service_request_rec.inv_component_id,
10192 x_return_status => l_return_status );
10193
10194 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10195 x_return_status := FND_API.G_RET_STS_ERROR;
10196 RETURN;
10197 END IF;
10198
10199 END IF;
10200
10201
10202 END IF;
10203
10204
10205 --
10206 -- Validate Product Revision
10207 --
10208 x_product_revision := p_service_request_rec.product_revision;
10209 --IF (p_service_request_rec.product_revision <> FND_API.G_MISS_CHAR)
10210 IF (p_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM AND
10211 p_service_request_rec.customer_product_id IS NOT NULL)
10212 AND (p_sr_mode = 'CREATE') THEN
10213
10214 CS_ServiceRequest_UTIL.Validate_Product_Version(
10215 p_parameter_name => 'p_product_revision',
10216 p_product_version => x_product_revision,
10217 p_instance_id => p_service_request_rec.customer_product_id,
10218 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10219 x_return_status => l_return_status);
10220 /***
10221 CS_ServiceRequest_UTIL.Validate_Product_Revision(
10222 p_api_name => p_api_name,
10223 p_parameter_name => 'p_product_revision',
10224 p_product_revision => p_service_request_rec.product_revision,
10225 p_customer_product_id => p_service_request_rec.customer_product_id,
10226 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10227 p_inventory_item_id => p_inventory_item_id,
10228 x_return_status => l_return_status);
10229 ******************************************/
10230
10231 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10232 x_return_status := FND_API.G_RET_STS_ERROR;
10233 RETURN;
10234 END IF;
10235 END IF;
10236 -- END IF;
10237
10238 --
10239 -- Validate CP Component Version
10240 --
10241 --IF (p_service_request_rec.component_version <> FND_API.G_MISS_CHAR AND
10242 -- p_service_request_rec.component_version IS NOT NULL)
10243 -- AND (p_sr_mode = 'CREATE') THEN
10244
10245 -- -- For 3337848
10246 -- CS_ServiceRequest_UTIL.Validate_Component_Version(
10247 -- p_api_name => p_api_name,
10248 -- p_parameter_name => 'p_component_version',
10249 -- p_component_version => p_service_request_rec.component_version,
10250 -- p_cp_component_id => p_service_request_rec.cp_component_id,
10251 -- p_customer_product_id => p_service_request_rec.customer_product_id,
10252 -- p_inventory_org_id => p_service_request_rec.inventory_org_id,
10253 -- x_return_status => l_return_status);
10254
10255 -- IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10256 -- x_return_status := FND_API.G_RET_STS_ERROR;
10257 -- RETURN;
10258 -- END IF;
10259 -- END IF;
10260 x_component_version := p_service_request_rec.component_version;
10261 IF (p_service_request_rec.cp_component_id <> FND_API.G_MISS_NUM AND
10262 p_service_request_rec.cp_component_id IS NOT NULL)
10263 AND (p_sr_mode = 'CREATE') THEN
10264
10265 -- For 3337848
10266 CS_ServiceRequest_UTIL.Validate_Product_Version(
10267 p_parameter_name => 'p_component_version',
10268 p_product_version => x_component_version,
10269 p_instance_id => p_service_request_rec.cp_component_id,
10270 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10271 x_return_status => l_return_status);
10272
10273 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10274 x_return_status := FND_API.G_RET_STS_ERROR;
10275 RETURN;
10276 END IF;
10277 END IF;
10278
10279 -- Validate CP Sub Component Id
10280 --
10281 IF (p_service_request_rec.cp_subcomponent_id <> FND_API.G_MISS_NUM AND
10282 p_service_request_rec.cp_subcomponent_id IS NOT NULL)
10283 AND (p_sr_mode = 'CREATE') THEN
10284
10285 CS_ServiceRequest_UTIL.Validate_CP_SubComp_Id(
10286 p_api_name => p_api_name,
10287 p_parameter_name => 'p_cp_subcomponent_id',
10288 p_cp_subcomponent_id => p_service_request_rec.cp_subcomponent_id,
10289 p_cp_component_id => p_service_request_rec.cp_component_id,
10290 p_customer_product_id => p_service_request_rec.customer_product_id,
10291 p_org_id => p_org_id,
10292 x_return_status => l_return_status);
10293
10294 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10295 x_return_status := FND_API.G_RET_STS_ERROR;
10296 RETURN;
10297 END IF;
10298
10299 -- For bug 3324210
10300 IF (p_service_request_rec.inv_subcomponent_id <> FND_API.G_MISS_NUM AND
10301 p_service_request_rec.inv_subcomponent_id IS NOT NULL) THEN
10302
10303 CS_ServiceRequest_UTIL.INV_SUBCOMPONENT_CROSS_VAL (
10304 p_parameter_name => 'inv subcomponent',
10305 p_inv_subcomponent_id => p_service_request_rec.inv_subcomponent_id,
10306 p_cp_subcomponent_id => p_service_request_rec.cp_subcomponent_id,
10307 x_return_status => l_return_status );
10308
10309
10310 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10311 x_return_status := FND_API.G_RET_STS_ERROR;
10312 RETURN;
10313 END IF;
10314
10315 END IF;
10316 END IF ;
10317
10318
10319 --
10320 -- Validate CP Subcomponent Version
10321 --
10322 --IF (p_service_request_rec.subcomponent_version <> FND_API.G_MISS_CHAR AND
10323 -- p_service_request_rec.subcomponent_version IS NOT NULL)
10324 -- AND (p_sr_mode = 'CREATE') THEN
10325
10326 -- For bug 3337848
10327 -- CS_ServiceRequest_UTIL.Validate_Subcomponent_Version(
10328 -- p_api_name => p_api_name,
10329 -- p_parameter_name => 'p_subcomponent_version',
10330 -- p_subcomponent_version => p_service_request_rec.subcomponent_version,
10331 -- p_cp_component_id => p_service_request_rec.cp_component_id,
10332 -- p_cp_subcomponent_id => p_service_request_rec.cp_subcomponent_id,
10333 -- p_customer_product_id => p_service_request_rec.customer_product_id,
10334 -- p_inventory_org_id => p_service_request_rec.inventory_org_id,
10335 -- x_return_status => l_return_status);
10336
10337 -- IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10338 -- x_return_status := FND_API.G_RET_STS_ERROR;
10339 -- RETURN;
10340 -- END IF;
10341
10342 --END IF;
10343 --END IF;
10344 x_subcomponent_version := p_service_request_rec.subcomponent_version;
10345 IF (p_service_request_rec.cp_subcomponent_id <> FND_API.G_MISS_NUM AND
10346 p_service_request_rec.cp_subcomponent_id IS NOT NULL)
10347 AND (p_sr_mode = 'CREATE') THEN
10348
10349 -- For bug 3337848
10350 CS_ServiceRequest_UTIL.Validate_Product_Version(
10351 p_parameter_name => 'p_subcomponent_version',
10352 p_product_version => x_subcomponent_version,
10353 p_instance_id => p_service_request_rec.cp_subcomponent_id,
10354 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10355 x_return_status => l_return_status);
10356
10357 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10358 x_return_status := FND_API.G_RET_STS_ERROR;
10359 RETURN;
10360 END IF;
10361
10362 END IF;
10363 -----------------------------------
10364
10365 ELSE
10366 -- customer_product_id is not specified, so validate the INV fields
10367
10368 -- Validate INV ITEM REVISION
10369 --
10370 IF (p_service_request_rec.inv_item_revision <> FND_API.G_MISS_CHAR )
10371 AND (p_sr_mode = 'CREATE') THEN
10372
10373 CS_ServiceRequest_UTIL.Validate_Inv_Item_Rev(
10374 p_api_name => p_api_name,
10375 p_parameter_name => 'p_inv_item_revision',
10376 p_inv_item_revision => p_service_request_rec.inv_item_revision,
10377 p_inventory_item_id => p_inventory_item_id,
10378 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10379 x_return_status => l_return_status );
10380
10381 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10382 x_return_status := FND_API.G_RET_STS_ERROR;
10383 RETURN;
10384 END IF;
10385 END IF;
10386
10387 ---- Validate INV COMP ID
10388 --
10389
10390 IF (p_service_request_rec.inv_component_id <> FND_API.G_MISS_NUM AND
10391 p_service_request_rec.inv_component_id IS NOT NULL)
10392 AND (p_sr_mode = 'CREATE') THEN
10393
10394 CS_ServiceRequest_UTIL.Validate_Inv_Comp_Id(
10395 p_api_name => p_api_name,
10396 p_parameter_name => 'p_inv_component_id',
10397 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10398 p_inv_component_id => p_service_request_rec.inv_component_id,
10399 p_inventory_item_id => p_inventory_item_id,
10400 x_return_status => l_return_status );
10401
10402 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10403 x_return_status := FND_API.G_RET_STS_ERROR;
10404 RETURN;
10405 END IF;
10406 END IF;
10407
10408 -- Validate INV COMP VER
10409 --
10410 IF (p_service_request_rec.inv_component_version <> FND_API.G_MISS_CHAR AND
10411 p_service_request_rec.inv_component_version IS NOT NULL)
10412 AND (p_sr_mode = 'CREATE') THEN
10413
10414 CS_ServiceRequest_UTIL.Validate_Inv_Comp_Ver(
10415 p_api_name => p_api_name,
10416 p_parameter_name => 'p_inv_component_version',
10417 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10418 p_inv_component_id => p_service_request_rec.inv_component_id,
10419 p_inv_component_version => p_service_request_rec.inv_component_version,
10420 x_return_status => l_return_status );
10421
10422 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10423 x_return_status := FND_API.G_RET_STS_ERROR;
10424 RETURN;
10425 END IF;
10426 END IF;
10427
10428
10429 -- Validate INV SUBCOMP ID
10430 --
10431 IF (p_sr_mode = 'CREATE' AND
10432 p_service_request_rec.inv_subcomponent_id <> FND_API.G_MISS_NUM AND
10433 p_service_request_rec.inv_subcomponent_id IS NOT NULL) THEN
10434
10435 CS_ServiceRequest_UTIL.Validate_Inv_SubComp_Id(
10436 p_api_name => p_api_name,
10437 p_parameter_name => 'p_inv_subcomponent_id',
10438 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10439 p_inv_subcomponent_id => p_service_request_rec.inv_subcomponent_id,
10440 p_inv_component_id =>p_service_request_rec.inv_component_id,
10441 x_return_status => l_return_status );
10442
10443 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10444 x_return_status := FND_API.G_RET_STS_ERROR;
10445 RETURN;
10446 END IF;
10447
10448 END IF;
10449
10450 -- Validate INV SUBCOMP VER
10451 --
10452 IF (p_service_request_rec.inv_subcomponent_version <> FND_API.G_MISS_CHAR AND
10453 p_service_request_rec.inv_subcomponent_version IS NOT NULL)
10454 AND (p_sr_mode = 'CREATE') THEN
10455
10456 CS_ServiceRequest_UTIL.Validate_Inv_SubComp_Ver(
10457 p_api_name => p_api_name,
10458 p_parameter_name => 'p_inv_subcomponent_version',
10459 p_inventory_org_id => p_service_request_rec.inventory_org_id,
10460 p_inv_subcomponent_id =>p_service_request_rec.inv_subcomponent_id,
10461 p_inv_subcomponent_version => p_service_request_rec.inv_subcomponent_version,
10462 x_return_status => l_return_status );
10463
10464 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10465 x_return_status := FND_API.G_RET_STS_ERROR;
10466 RETURN;
10467 END IF;
10468 END IF;
10469
10470 END IF; /* IF customer_product_id is specified condition*/
10471
10472 -- Added for Enh# 1830701
10473 -- Validate INC REPORTED DATE
10474 --
10475 IF (p_request_date <> FND_API.G_MISS_DATE AND
10476 p_request_date IS NOT NULL) AND
10477 (p_service_request_rec.incident_occurred_date <> FND_API.G_MISS_DATE AND
10478 p_service_request_rec.incident_occurred_date IS NOT NULL) THEN
10479
10480 CS_ServiceRequest_UTIL.Validate_Inc_Reported_Date(
10481 p_api_name => p_api_name,
10482 p_parameter_name => 'p_incident_date',
10483 p_request_date => p_request_date,
10484 p_inc_occurred_date => p_service_request_rec.incident_occurred_date,
10485 x_return_status => l_return_status );
10486
10487 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10488 x_return_status := FND_API.G_RET_STS_ERROR;
10489 RETURN;
10490 END IF;
10491 END IF;
10492
10493 -- Validate INC OCCURRED DATE
10494 --
10495 IF (p_service_request_rec.incident_occurred_date <> FND_API.G_MISS_DATE AND
10496 p_service_request_rec.incident_occurred_date IS NOT NULL) AND
10497 (p_request_date <> FND_API.G_MISS_DATE AND
10498 p_request_date IS NOT NULL) THEN
10499
10500 CS_ServiceRequest_UTIL.Validate_Inc_Occurred_Date(
10501 p_api_name => p_api_name,
10502 p_parameter_name => 'p_incident_occurred_date',
10503 p_inc_occurred_date => p_service_request_rec.incident_occurred_date,
10504 p_request_date => p_request_date,
10505 x_return_status => l_return_status );
10506
10507 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10508 x_return_status := FND_API.G_RET_STS_ERROR;
10509 RETURN;
10510 END IF;
10511 END IF;
10512
10513 -- Validate INC RESOLVED DATE
10514 --
10515 IF (p_service_request_rec.incident_resolved_date <> FND_API.G_MISS_DATE AND
10516 p_service_request_rec.incident_resolved_date IS NOT NULL) THEN
10517
10518 CS_ServiceRequest_UTIL.Validate_Inc_Resolved_Date(
10519 p_api_name => p_api_name,
10520 p_parameter_name => 'p_incident_resolved_date',
10521 p_inc_resolved_date => p_service_request_rec.incident_resolved_date,
10522 p_request_date => p_request_date,
10523 x_return_status => l_return_status );
10524
10525 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10526 x_return_status := FND_API.G_RET_STS_ERROR;
10527 RETURN;
10528 END IF;
10529 END IF;
10530
10531 -- Validate INC RESPONDED BY DATE
10532 --
10533 IF (p_service_request_rec.inc_responded_by_date <> FND_API.G_MISS_DATE AND
10534 p_service_request_rec.inc_responded_by_date IS NOT NULL) THEN
10535
10536 CS_ServiceRequest_UTIL.Validate_Inc_Responded_Date(
10537 p_api_name => p_api_name,
10538 p_parameter_name => 'p_inc_responded_by_date',
10539 p_inc_responded_by_date => p_service_request_rec.inc_responded_by_date,
10540 p_request_date => p_request_date,
10541 x_return_status => l_return_status );
10542
10543 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10544 x_return_status := FND_API.G_RET_STS_ERROR;
10545 RETURN;
10546 END IF;
10547 END IF;
10548
10549 -- Added for Enh# 222054
10550 -- Validate INCIDENT LOCATION ID
10551 -- KP Incident Locaton should be valid for the customer product, if it's passed.
10552 -- 9/19 changes
10553
10554 /* Bug 4386870 smisra 12/13/05
10555 this code is moved to vldt_sr_rec procedure
10556 IF (p_service_request_rec.incident_location_id <> FND_API.G_MISS_NUM AND
10557 p_service_request_rec.incident_location_id IS NOT NULL)
10558 THEN
10559 CS_ServiceRequest_UTIL.Validate_Inc_Location_Id(
10560 p_api_name => p_api_name,
10561 p_parameter_name => 'p_incident_location_id',
10562 p_incident_location_type => p_service_request_rec.incident_location_type,
10563 p_incident_location_id => p_service_request_rec.incident_location_id,
10564 x_return_status => l_return_status );
10565
10566 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10567 x_return_status := FND_API.G_RET_STS_ERROR;
10568 RETURN;
10569 END IF;
10570 END IF;
10571 */
10572
10573 -- Validate INCIDENT COUNTRY
10574 --
10575 IF (p_service_request_rec.incident_country <> FND_API.G_MISS_CHAR AND
10576 p_service_request_rec.incident_country IS NOT NULL) THEN
10577
10578 CS_ServiceRequest_UTIL.Validate_Incident_Country(
10579 p_api_name => p_api_name,
10580 p_parameter_name => 'p_incident_country',
10581 p_incident_country => p_service_request_rec.incident_country,
10582 x_return_status => l_return_status );
10583
10584 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10585 x_return_status := FND_API.G_RET_STS_ERROR;
10586 RETURN;
10587 END IF;
10588 END IF;
10589
10590 -- Added For ER# 2433831
10591 -- Validate Bill To Account
10592
10593 IF (p_service_request_rec.bill_to_account_id <> FND_API.G_MISS_NUM AND
10594 p_service_request_rec.bill_to_account_id IS NOT NULL)
10595 AND (p_sr_mode = 'CREATE') THEN
10596
10597 CS_ServiceRequest_UTIL.Validate_Bill_To_Ship_To_Acct
10598 ( p_api_name => p_api_name,
10599 p_parameter_name => 'Bill_To Account',
10600 p_account_id => p_service_request_rec.bill_to_account_id,
10601 p_party_id => p_service_request_rec.bill_to_party_id,
10602 x_return_status => l_return_status);
10603
10604 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10605 x_return_status := FND_API.G_RET_STS_ERROR;
10606 RETURN;
10607 END IF ;
10608 END IF ;
10609
10610 -- Added For ER# 2433831
10611 -- Validate Ship To Account
10612
10613 -- Use the Same Procedure bill_to_account_id
10614 IF (p_service_request_rec.ship_to_account_id <> FND_API.G_MISS_NUM AND
10615 p_service_request_rec.ship_to_account_id IS NOT NULL)
10616 AND (p_sr_mode = 'CREATE') THEN
10617
10618 CS_ServiceRequest_UTIL.Validate_bill_To_Ship_To_Acct
10619 ( p_api_name => p_api_name,
10620 p_parameter_name => 'Ship_To Account',
10621 p_account_id => p_service_request_rec.ship_to_account_id,
10622 p_party_id => p_service_request_rec.ship_to_party_id,
10623 x_return_status => l_return_status);
10624
10625 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10626 x_return_status := FND_API.G_RET_STS_ERROR;
10627 RETURN;
10628 END IF ;
10629 END IF ;
10630
10631 -- Added for ER# 2463321
10632 -- Validate Customer's Non Primary Phone Id
10633
10634 IF (p_service_request_rec.customer_phone_id <> FND_API.G_MISS_NUM AND
10635 p_service_request_rec.customer_phone_id IS NOT NULL ) THEN
10636
10637 CS_ServiceRequest_UTIL.Validate_Per_Contact_Point_Id
10638 ( p_api_name => p_api_name,
10639 p_parameter_name => 'p_contact_point_id',
10640 p_contact_point_type => 'PHONE',
10641 p_contact_point_id => p_service_request_rec.customer_phone_id,
10642 p_party_id => l_customer_id ,
10643 x_return_status => l_return_status );
10644
10645 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10646 x_return_status := FND_API.G_RET_STS_ERROR;
10647 RETURN;
10648 END IF ;
10649
10650 END IF ;
10651
10652 -- Added for ER# 2463321
10653 -- Validate Customer's Non Primary Email Id
10654
10655 IF (p_service_request_rec.customer_email_id <> FND_API.G_MISS_NUM AND
10656 p_service_request_rec.customer_email_id IS NOT NULL ) THEN
10657
10658 CS_ServiceRequest_UTIL.Validate_Per_Contact_Point_Id
10659 ( p_api_name => p_api_name,
10660 p_parameter_name => 'p_contact_point_id',
10661 p_contact_point_type => 'EMAIL',
10662 p_contact_point_id => p_service_request_rec.customer_email_id,
10663 p_party_id => l_customer_id ,
10664 x_return_status => l_return_status );
10665
10666 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
10667 x_return_status := FND_API.G_RET_STS_ERROR;
10668 RETURN;
10669 END IF ;
10670
10671 END IF ;
10672
10673 END Validate_ServiceRequest_Record;
10674
10675 -- -----------------------------------------------------------------------------
10676 -- Modification History
10677 -- Date Name Desc
10678 -- -------- --------- ----------------------------------------------------------
10679 -- 02/28/05 smisra Bug 4083288 Defaulted category_set_id if it is not
10680 -- passed and category id is passed.
10681 -- 05/05/05 smisra Rel 12 changes. Replaced validation of p_org_id based on
10682 -- profile 'ORG_ID' with new validation based on
10683 -- hr_all_operating_units.
10684 -- copied maint_organization_id col to validation record.
10685 -- 05/13/05 smisra Removed the code that set customer product related
10686 -- parameters to null for EAM SRs
10687 -- 05/27/05 smisra Bug 4227769
10688 -- removed the code that sets obsolete col group_owner and
10689 -- owner (_tl table columns)
10690 -- 07/15/05 smisra Bug 4489746
10691 -- removed start and end active dates from query on
10692 -- cs_incident_types. Validate type will take care of
10693 -- date effectivity check.
10694 -- 07/15/05 smisra Bug 4398562
10695 -- moved the code that sets group_type and
10696 -- change_group_type_flag after call to SR auto assignment
10697 -- 07/15/05 smisra Bug 3875584
10698 -- passed p_mode='CREATE' to validate_owner procedure. This
10699 -- of p_mode will force validate_owner procedure to give
10700 -- warning in case of invalid owner.
10701 -- 07/21/05 smisra moved the code that sets expected resolution and
10702 -- obligation dates in audit record from this procedure
10703 -- to create service request just before call to
10704 -- create audit rec procedure.
10705 -- This was needed because call to get contract may
10706 -- set these dates.
10707 -- 11/16/05 smisra Removed assignment of coverage_type to audit record
10708 -- coverage type may be determined based on contract service
10709 -- id in create service request procedure after call to
10710 -- create_sr_validation. Now this assignment is done in
10711 -- create_servicerequest just before the call to
10712 -- create_audit.
10713 -- 12/14/05 smisra set incident_country to null if incident_location_id is
10714 -- passed
10715 -- moved the code setting incident_country, inc_location_id
10716 -- and incident_location_type attribute of audit record to
10717 -- create_servicerequest just before call to create audit
10718 -- 12/23/05 smisra bug 4894942
10719 -- Removed call to Assignment manager API. now it is called
10720 -- from vldt_sr_rec
10721 -- Removed the code to set following audit record attribute
10722 -- a. resource_type
10723 -- b. group_type
10724 -- c. incident_owner_id
10725 -- d. group_owner_id
10726 -- e. owner_assigned_time
10727 -- f. territory_id
10728 -- These attribute are now set in create_servicerequest
10729 -- procedure just before the call to create audit
10730 -- 12/30/05 smisra Bug 4773215, 4869065
10731 -- Removed the call to validate resource id.
10732 -- Now this validation will be performed from vldt_sr_rec
10733 -- Moved the code to set site cols of audit record to
10734 -- create_servicerequest procedure just before call to
10735 -- create audit
10736 -- 04/18/06 spusegao Modified to validate service_request_rec.created_by and
10737 -- service_request_rec.last_updateD_by parameter values.
10738 -- 06/13/06 spusegao Modified ver 120.36 to fix big 5278488
10739 -- 1. Modified Create_SR_Validation to default the publish_flag
10740 -- to 'N' if not passed.
10741 -- 09/14/06 spusegao Modified version 120.42 to comment out following code line
10742 -- --l_service_request_val_rec.publish_flag := l_service_request_rec.publish_flag;
10743 -- For bug # 5517017.
10744 -- 04/24/07 romehrot Bug Fix : 5501340 Added the code to pass the system_id
10745 -- -----------------------------------------------------------------------------
10746 PROCEDURE Create_SR_Validation(
10747 p_api_name IN VARCHAR2,
10748 p_service_request_rec IN service_request_rec_type,
10749 p_contacts IN contacts_table,
10750 p_resp_id IN NUMBER DEFAULT NULL,
10751 p_resp_appl_id IN NUMBER DEFAULT NULL,
10752 p_user_id IN NUMBER,
10753 p_login_id IN NUMBER DEFAULT NULL,
10754 p_org_id IN NUMBER DEFAULT NULL,
10755 p_request_id IN NUMBER DEFAULT NULL,
10756 p_request_number IN VARCHAR2 DEFAULT NULL,
10757 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
10758 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
10759 x_msg_count OUT NOCOPY NUMBER,
10760 x_msg_data OUT NOCOPY VARCHAR2,
10761 x_return_status OUT NOCOPY VARCHAR2,
10762 x_contra_id OUT NOCOPY NUMBER,
10763 x_contract_number OUT NOCOPY VARCHAR2,
10764 x_owner_assigned_flag OUT NOCOPY VARCHAR2,
10765 x_req_id OUT NOCOPY NUMBER,
10766 x_request_id OUT NOCOPY NUMBER,
10767 x_req_num OUT NOCOPY VARCHAR2,
10768 x_request_number OUT NOCOPY VARCHAR2,
10769 x_autolaunch_wkf_flag OUT NOCOPY VARCHAR2,
10770 x_abort_wkf_close_flag OUT NOCOPY VARCHAR2,
10771 x_wkf_process_name OUT NOCOPY VARCHAR2,
10772 x_audit_vals_rec OUT NOCOPY sr_audit_rec_type,
10773 x_service_request_rec OUT NOCOPY service_request_rec_type,
10774 -- for cmro
10775 p_cmro_flag IN VARCHAR2,
10776 p_maintenance_flag IN VARCHAR2,
10777 p_auto_assign IN VARCHAR2 := 'N'
10778 ) AS
10779
10780 l_api_name CONSTANT VARCHAR2(30) := 'Create_SR_Validation';
10781 l_api_version CONSTANT NUMBER := 2.0;
10782 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
10783 l_return_status VARCHAR2(1);
10784 l_service_request_val_rec Request_Validation_Rec_Type;
10785 l_service_request_rec service_request_rec_type DEFAULT p_service_request_rec;
10786 --
10787 l_close_flag VARCHAR2(1);
10788 l_autolaunch_workflow_flag VARCHAR2(1);
10789 l_abort_workflow_close_flag VARCHAR2(1);
10790 l_workflow_process_name VARCHAR2(30);
10791
10792 l_workflow_process_id NUMBER;
10793 l_contra_id NUMBER;
10794
10795 l_cp_item_id NUMBER;
10796 l_inventory_org_id NUMBER ;
10797
10798 l_request_id NUMBER := p_request_id;
10799 l_request_number VARCHAR2(64) := p_request_number;
10800 l_req_id NUMBER;
10801 l_req_num VARCHAR2(64);
10802 l_temp_id NUMBER;
10803 l_temp_num VARCHAR2(64);
10804 l_sysdate DATE := SYSDATE;
10805
10806 --
10807 l_note_index BINARY_INTEGER;
10808 l_note_id NUMBER;
10809 l_note_context_id NUMBER;
10810 l_notes_detail VARCHAR2(32767);
10811 l_contact_index BINARY_INTEGER;
10812
10813 l_jtf_note_id NUMBER ;
10814
10815 l_interaction_id NUMBER;
10816 l_employee_name VARCHAR2(240);
10817 l_bill_to_customer_id NUMBER;
10818 l_bill_to_location_id NUMBER;
10819 l_ship_to_customer_id NUMBER;
10820 l_ship_to_location_id NUMBER;
10821 l_install_customer_id NUMBER;
10822 l_install_location_id NUMBER;
10823
10824 l_primary_contact_id NUMBER := NULL;
10825
10826 l_bind_data_id NUMBER;
10827
10828 l_primary_contact_found VARCHAR2(1) := 'N' ;
10829 l_contacts_passed VARCHAR2(1) := 'N';
10830 l_owner_assigned_flag VARCHAR2(1) := 'N';
10831
10832 l_disallow_request_update VARCHAR2(1);
10833 l_disallow_owner_update VARCHAR2(1);
10834 l_disallow_product_update VARCHAR2(1);
10835
10836 -- For Workflow Hook
10837 l_workflow_item_key NUMBER;
10838
10839 l_test NUMBER;
10840
10841 l_org_id NUMBER;
10842
10843 l_profile_org_id NUMBER ;
10844
10845 l_msg_id NUMBER;
10846 l_msg_count NUMBER;
10847 l_msg_data VARCHAR2(2000);
10848 --Fixed bug#2802393, changed length from 40 to 2000
10849 l_uwq_body1 VARCHAR2(2000) := 'has been assigned to you on';
10850 l_uwq_body2 VARCHAR2(120) := TO_CHAR(SYSDATE,'MM-DD-YYYY');
10851 l_uwq_body3 VARCHAR2(120) := TO_CHAR(SYSDATE,'HH24:MI');
10852 --Fixed bug#2802393, changed length from 255 to 2500
10853 l_uwq_body VARCHAR2(2500);
10854
10855 l_contract_number VARCHAR2(120) ;
10856 l_contract_id NUMBER;
10857 l_group_name VARCHAR2(60);
10858 l_owner_name VARCHAR2(360);
10859 l_owner_id jtf_rs_resource_extns.resource_id % TYPE;
10860 l_operation VARCHAR2(300):='created';
10861 l_bill_to_site_id NUMBER;
10862 l_ship_to_site_id NUMBER;
10863 l_bill_to_site_use_id NUMBER;
10864 l_ship_to_site_use_id NUMBER;
10865 l_auto_assign_level fnd_profile_option_values.profile_option_value % type;
10866 l_asgn_owner_id cs_incidents_all_b.incident_owner_id % type;
10867 l_asgn_group_id cs_incidents_all_b.owner_group_id % type;
10868 l_asgn_owner_type cs_incidents_all_b.resource_type % type;
10869 l_territory_id number;
10870 l_orig_group_type_null varchar2(1) := 'N';
10871 l_responded_flag cs_incident_statuses_b.responded_flag % type;
10872 l_resolved_flag cs_incident_statuses_b.resolved_flag % type;
10873 BEGIN
10874
10875 -- Initialize the New Auit Record
10876 Initialize_audit_rec(
10877 p_sr_audit_record => x_audit_vals_rec) ;
10878
10879 --
10880 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #1');
10881
10882 -- Check if the mandatory parameters are specified. If not, return error.
10883
10884 IF (l_service_request_rec.type_id = FND_API.G_MISS_NUM OR
10885 l_service_request_rec.type_id IS NULL) THEN
10886
10887 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
10888 (p_token_an => l_api_name_full,
10889 p_token_np => 'SR Type',
10890 p_table_name => G_TABLE_NAME,
10891 p_column_name => 'INCIDENT_TYPE_ID');
10892
10893 RAISE FND_API.G_EXC_ERROR;
10894 END IF;
10895
10896
10897 IF (l_service_request_rec.status_id = FND_API.G_MISS_NUM OR
10898 l_service_request_rec.status_id IS NULL) THEN
10899
10900 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
10901 (p_token_an => l_api_name_full,
10902 p_token_np => 'SR Status',
10903 p_table_name => G_TABLE_NAME,
10904 p_column_name => 'INCIDENT_STATUS_ID');
10905
10906 RAISE FND_API.G_EXC_ERROR;
10907 END IF;
10908
10909
10910 IF (l_service_request_rec.severity_id = FND_API.G_MISS_NUM OR
10911 l_service_request_rec.severity_id IS NULL) THEN
10912
10913 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
10914 (p_token_an => l_api_name_full,
10915 p_token_np => 'SR Severity',
10916 p_table_name => G_TABLE_NAME,
10917 p_column_name => 'SEVERITY_ID');
10918
10919 RAISE FND_API.G_EXC_ERROR;
10920 END IF;
10921
10922 -- Request Date is a reqd field, so check if passed, else return error
10923 IF (l_service_request_rec.request_date = FND_API.G_MISS_DATE OR
10924 l_service_request_rec.request_date IS NULL) THEN
10925
10926 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
10927 (p_token_an => l_api_name_full,
10928 p_token_np => 'SR Request Date',
10929 p_table_name => G_TABLE_NAME,
10930 p_column_name => 'REQUEST_DATE');
10931
10932 RAISE FND_API.G_EXC_ERROR;
10933 END IF;
10934
10935 -- Summary is a reqd field, so check if passed, else return error
10936 IF (l_service_request_rec.summary = FND_API.G_MISS_CHAR OR
10937 l_service_request_rec.summary IS NULL) THEN
10938
10939 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
10940 (p_token_an => l_api_name_full,
10941 p_token_np => 'SR Summary',
10942 p_table_name => G_TABLE_NAME,
10943 p_column_name => 'SUMMARY');
10944
10945 RAISE FND_API.G_EXC_ERROR;
10946 END IF;
10947
10948 -- for cmro_eam
10949
10950 IF (p_maintenance_flag = 'Y' OR p_maintenance_flag = 'y') THEN
10951 IF (l_service_request_rec.inventory_org_id = FND_API.G_MISS_NUM) THEN
10952 CS_ServiceRequest_UTIL.Add_Missing_Param_Msg(l_api_name_full, 'Inventory Org ID');
10953 RAISE FND_API.G_EXC_ERROR;
10954 ELSIF (l_service_request_rec.inventory_org_id IS NULL) THEN
10955 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'Inventory Org ID');
10956 RAISE FND_API.G_EXC_ERROR;
10957 END IF;
10958 END IF;
10959 -- end of cmro_eam
10960
10961 -- Added all the 8 checks for bug#2800884
10962 -- bill_to_party_id is a reqd field if bill_to_account_id
10963 -- is passed, so check if passed, else return error
10964 IF ((l_service_request_rec.bill_to_account_id <> FND_API.G_MISS_NUM AND
10965 l_service_request_rec.bill_to_account_id IS NOT NULL))
10966 THEN
10967 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM OR
10968 l_service_request_rec.bill_to_party_id IS NULL) THEN
10969
10970 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
10971 fnd_message.set_token ('CHILD_PARAM','bill_to_account_id');
10972 fnd_message.set_token ('PARENT_PARAM','bill_to_party_id');
10973 fnd_msg_pub.ADD;
10974
10975 RAISE FND_API.G_EXC_ERROR;
10976 END IF;
10977 END IF;
10978
10979 -- bill_to_party_id is a reqd field if bill_to_contact_id is passed,so check
10980 -- if passed, else return error
10981 IF ((l_service_request_rec.bill_to_contact_id <> FND_API.G_MISS_NUM AND
10982 l_service_request_rec.bill_to_contact_id IS NOT NULL))
10983 THEN
10984 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM OR
10985 l_service_request_rec.bill_to_party_id IS NULL) THEN
10986
10987 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
10988 fnd_message.set_token ('CHILD_PARAM','bill_to_contact_id');
10989 fnd_message.set_token ('PARENT_PARAM','bill_to_party_id');
10990 fnd_msg_pub.ADD;
10991
10992 RAISE FND_API.G_EXC_ERROR;
10993 END IF;
10994 END IF;
10995
10996 -- bill_to_party_id is a reqd field if bill_to_site_id is passed, so check
10997 -- if passed, else return error
10998 IF ((l_service_request_rec.bill_to_site_id <> FND_API.G_MISS_NUM AND
10999 l_service_request_rec.bill_to_site_id IS NOT NULL))
11000 THEN
11001 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM OR
11002 l_service_request_rec.bill_to_party_id IS NULL) THEN
11003
11004 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
11005 fnd_message.set_token ('CHILD_PARAM','bill_to_site_id');
11006 fnd_message.set_token ('PARENT_PARAM','bill_to_party_id');
11007 fnd_msg_pub.ADD;
11008
11009 RAISE FND_API.G_EXC_ERROR;
11010 END IF;
11011 END IF;
11012
11013 -- bill_to_party_id is a reqd field if bill_to_site_use_id is passed,
11014 -- so check if passed, else return error
11015 IF ((l_service_request_rec.bill_to_site_use_id <> FND_API.G_MISS_NUM AND
11016 l_service_request_rec.bill_to_site_use_id IS NOT NULL))
11017 THEN
11018 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM OR
11019 l_service_request_rec.bill_to_party_id IS NULL) THEN
11020
11021 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
11022 fnd_message.set_token ('CHILD_PARAM','bill_to_site_use_id');
11023 fnd_message.set_token ('PARENT_PARAM','bill_to_party_id');
11024 fnd_msg_pub.ADD;
11025
11026 RAISE FND_API.G_EXC_ERROR;
11027 END IF;
11028 END IF;
11029
11030 -- ship_to_party_id is a reqd field if ship_to_account_id
11031 -- is passed, so check if passed, else return error
11032 IF ((l_service_request_rec.ship_to_account_id <> FND_API.G_MISS_NUM AND
11033 l_service_request_rec.ship_to_account_id IS NOT NULL))
11034 THEN
11035 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM OR
11036 l_service_request_rec.ship_to_party_id IS NULL) THEN
11037
11038 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
11039 fnd_message.set_token ('CHILD_PARAM','ship_to_account_id');
11040 fnd_message.set_token ('PARENT_PARAM','ship_to_party_id');
11041 fnd_msg_pub.ADD;
11042
11043 RAISE FND_API.G_EXC_ERROR;
11044 END IF;
11045 END IF;
11046
11047 -- ship_to_party_id is a reqd field if ship_to_contact_id is passed,so check
11048 -- if passed, else return error
11049 IF ((l_service_request_rec.ship_to_contact_id <> FND_API.G_MISS_NUM AND
11050 l_service_request_rec.ship_to_contact_id IS NOT NULL))
11051 THEN
11052 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM OR
11053 l_service_request_rec.ship_to_party_id IS NULL) THEN
11054
11055 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
11056 fnd_message.set_token ('CHILD_PARAM','ship_to_contact_id');
11057 fnd_message.set_token ('PARENT_PARAM','ship_to_party_id');
11058 fnd_msg_pub.ADD;
11059
11060 RAISE FND_API.G_EXC_ERROR;
11061 END IF;
11062 END IF;
11063
11064 -- ship_to_party_id is a reqd field if ship_to_site_id is passed, so check
11065 -- if passed, else return error
11066 IF ((l_service_request_rec.ship_to_site_id <> FND_API.G_MISS_NUM AND
11067 l_service_request_rec.ship_to_site_id IS NOT NULL))
11068 THEN
11069 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM OR
11070 l_service_request_rec.ship_to_party_id IS NULL) THEN
11071
11072 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
11073 fnd_message.set_token ('CHILD_PARAM','ship_to_site_id');
11074 fnd_message.set_token ('PARENT_PARAM','ship_to_party_id');
11075 fnd_msg_pub.ADD;
11076
11077 RAISE FND_API.G_EXC_ERROR;
11078 END IF;
11079 END IF;
11080
11081 -- ship_to_party_id is a reqd field if ship_to_site_use_id is passed,
11082 -- so check if passed, else return error
11083 IF ((l_service_request_rec.ship_to_site_use_id <> FND_API.G_MISS_NUM AND
11084 l_service_request_rec.ship_to_site_use_id IS NOT NULL))
11085 THEN
11086 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM OR
11087 l_service_request_rec.ship_to_party_id IS NULL) THEN
11088
11089 fnd_message.set_name ('CS', 'CS_SR_PARENT_CHILD_CHECK');
11090 fnd_message.set_token ('CHILD_PARAM','ship_to_site_use_id');
11091 fnd_message.set_token ('PARENT_PARAM','ship_to_party_id');
11092 fnd_msg_pub.ADD;
11093
11094 RAISE FND_API.G_EXC_ERROR;
11095 END IF;
11096 END IF;
11097
11098 -- Added this code for source changes for 11.5.9 by shijain dated oct 11 2002
11099 -- this code is to check if the creation_program_code is passed and is not
11100 -- null as this is a mandatory parameter.
11101
11102 IF (l_service_request_rec.creation_program_code = FND_API.G_MISS_CHAR OR
11103 l_service_request_rec.creation_program_code IS NULL) THEN
11104
11105 /*Commented this code for backward compatibility, that if someone
11106 passes a creation program code as NULL or G_MISS_CHAR, we are supporting
11107 it now and defaulting it to UNKNOWN
11108 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
11109 (p_token_an => l_api_name_full,
11110 p_token_np => 'SR Creation Program Code',
11111 p_table_name => G_TABLE_NAME,
11112 p_column_name => 'CREATION_PROGRAM_CODE');
11113
11114 RAISE FND_API.G_EXC_ERROR;
11115 */
11116 l_service_request_rec.creation_program_code:='UNKNOWN';
11117 END IF;
11118
11119 /* Commented it for bug 2725543,getting the group_name and resource_name
11120 from the validation procedures itself.
11121 -- Added for Enh# 2216664
11122 -- Added If conditions for Bug# 2297626
11123 -- For populating the owner in TL table
11124 IF (l_service_request_rec.owner_id IS NOT NULL AND
11125 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM) THEN
11126
11127 SELECT resource_name
11128 INTO l_service_request_rec.owner
11129 FROM jtf_rs_resource_extns_tl
11130 WHERE resource_id = l_service_request_rec.owner_id
11131 AND LANGUAGE = USERENV('LANG');
11132 END IF;
11133
11134 -- For populating the group_owner in TL table
11135 IF (l_service_request_rec.owner_group_id IS NOT NULL AND
11136 l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM) THEN
11137 IF l_service_request_rec.group_type = 'RS_GROUP' THEN
11138
11139 SELECT group_name INTO l_service_request_rec.group_owner
11140 FROM jtf_rs_groups_tl
11141 WHERE group_id =l_service_request_rec.owner_group_id
11142 AND LANGUAGE = USERENV('LANG');
11143
11144 ELSIF (l_service_request_rec.group_type = 'RS_TEAM') THEN
11145
11146 SELECT team_name INTO l_service_request_rec.group_owner
11147 FROM jtf_rs_teams_tl
11148 WHERE team_id =l_service_request_rec.owner_group_id
11149 AND LANGUAGE = USERENV('LANG');
11150
11151 END IF;
11152 END IF;
11153 */
11154
11155 -- Check if any records are passed in the contacts table.
11156 -- If so, get the primary contact id.
11157 -- Only one record with primary flag set to Y must be passed.
11158
11159 l_contact_index := p_contacts.FIRST;
11160
11161 -- Flag to indicate records have been passed
11162 IF (l_contact_index IS NULL) THEN
11163 l_contacts_passed := 'N';
11164 ELSE
11165 l_contacts_passed := 'Y';
11166 END IF;
11167
11168 IF (l_service_request_rec.caller_type = 'ORGANIZATION') THEN
11169 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
11170 --
11171 -- customer_id/company_number is mandatory
11172 -- customer_firstname etc. ignored
11173 --
11174 IF ((l_service_request_rec.customer_id = FND_API.G_MISS_NUM OR
11175 l_service_request_rec.customer_id IS NULL )AND
11176 (l_service_request_rec.customer_number = FND_API.G_MISS_CHAR OR
11177 l_service_request_rec.customer_number IS NULL)) THEN
11178
11179 --AND(l_service_request_rec.customer_company_name = FND_API.G_MISS_CHAR OR
11180 -- l_service_request_rec.customer_company_name IS NULL)
11181
11182 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
11183 (p_token_an => l_api_name_full,
11184 p_token_np => 'SR Customer',
11185 p_table_name => null,
11186 p_column_name => 'CUSTOMER_COMPANY_NAME');
11187
11188 RAISE FND_API.G_EXC_ERROR;
11189 END IF;
11190
11191 IF (l_service_request_rec.customer_id <> FND_API.G_MISS_NUM AND
11192 l_service_request_rec.customer_id IS NOT NULL ) THEN
11193
11194 l_service_request_val_rec.validate_customer := FND_API.G_TRUE;
11195 l_service_request_val_rec.customer_id := l_service_request_rec.customer_id;
11196 x_service_request_rec.customer_id := l_service_request_rec.customer_id;
11197
11198 ELSE
11199 --Customer Id is not passed, but customer number may be passed
11200 --Retrieve the customer_id from the customer_number
11201 CS_ServiceRequest_UTIL.Convert_Customer_To_ID(
11202 p_api_name=>l_api_name,
11203 p_parameter_name_nb=>'l_service_request_rec.customer_number',
11204 p_parameter_name_n=> 'Customer_Name',
11205 p_customer_number=>l_service_request_rec.customer_number,
11206 -- Made changes for bug#2859360, getting the value of
11207 -- customer id in l_service_request_rec.customer_id
11208 p_customer_id => l_service_request_rec.customer_id,
11209 x_return_status => l_return_status);
11210
11211 --Check return status
11212 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11213 RAISE FND_API.G_EXC_ERROR;
11214 END IF;
11215
11216 l_service_request_val_rec.validate_customer := FND_API.G_TRUE;
11217 -- Made changes for bug#2859360, uncommented this call
11218 l_service_request_val_rec.customer_id := l_service_request_rec.customer_id;
11219 END IF;
11220
11221 --Need the first flag cause contacts table is made mandatory now, when caller type is ORG
11222 --If records are passed in the contacts table, at least one record with primary flag
11223 --set to Y must be passed
11224
11225 -- Check if the table is passed with records.
11226
11227 END IF;
11228
11229 ELSIF (l_service_request_rec.caller_type = 'PERSON') THEN
11230 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
11231 --
11232 -- customer ignored
11233 -- at least one contact with primary flag=Y should be specified in the contacts table.
11234
11235 -- END IF;
11236 -- raise error if customer_id is not passed . bug #3299567
11237 IF ((l_service_request_rec.customer_id = FND_API.G_MISS_NUM OR
11238 l_service_request_rec.customer_id IS NULL )) THEN
11239
11240 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'SR Customer');
11241 RAISE FND_API.G_EXC_ERROR;
11242
11243 END IF;
11244
11245 END IF;
11246
11247
11248 ELSE
11249 -- caller type passed is not valid
11250
11251 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
11252 ( p_token_an => l_api_name_full,
11253 p_token_v => l_service_request_rec.caller_type,
11254 p_token_p => 'p_caller_type',
11255 p_table_name => G_TABLE_NAME ,
11256 p_column_name => 'CALLER_TYPE' );
11257
11258 RAISE FND_API.G_EXC_ERROR;
11259 END IF;
11260
11261 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2');
11262 --
11263 /*11.5.10 Misc ER added logic to handle usability related changes*/
11264
11265 -- For bug 3512501 - added begin..exception
11266 begin
11267 SELECT responded_flag,resolved_flag
11268 INTO l_responded_flag,l_resolved_flag
11269 FROM cs_incident_statuses_vl
11270 WHERE incident_status_id=l_service_request_rec.status_id ;
11271 exception
11272 when no_data_found then
11273 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg( p_token_an => l_api_name_full,
11274 p_token_v => TO_CHAR(l_service_request_rec.status_id),
11275 p_token_p => 'p_status_id',
11276 p_table_name => G_TABLE_NAME,
11277 p_column_name => 'INCIDENT_STATUS_ID' );
11278 RAISE FND_API.G_EXC_ERROR;
11279 end;
11280
11281 IF ((l_responded_flag='Y') OR (l_resolved_flag ='Y')) THEN
11282 IF((l_responded_flag='Y' ) AND (l_service_request_rec.inc_responded_by_date is NULL OR
11283 l_service_request_rec.inc_responded_by_date= FND_API.G_MISS_DATE ))THEN
11284 l_service_request_rec.inc_responded_by_date := SYSDATE;
11285 END IF;
11286
11287 IF((l_resolved_flag ='Y' ) AND (l_service_request_rec.incident_resolved_date is NULL
11288 OR l_service_request_rec.incident_resolved_date = FND_API.G_MISS_DATE ))THEN
11289 l_service_request_rec.incident_resolved_date := SYSDATE;
11290 END IF;
11291 END IF;
11292
11293 -- ----------------------------------------------------------------------
11294 -- Apply business-rule validation to all required and passed parameters
11295 -- if validation level is set.
11296 -- ----------------------------------------------------------------------
11297 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
11298 --
11299 -- Check for uniqueness of request_id/request_number
11300 --
11301 IF (p_request_id IS NOT NULL) THEN
11302
11303 -- Check if the request id passed is unique
11304 DECLARE
11305 l_test NUMBER;
11306 BEGIN
11307 SELECT incident_id
11308 INTO l_test
11309 FROM cs_incidents_all_b
11310 WHERE incident_id = p_request_id;
11311
11312 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
11313 ( p_token_an => l_api_name_full,
11314 p_token_v => p_request_id,
11315 p_token_p => 'p_request_id' ,
11316 p_table_name => G_TABLE_NAME ,
11317 p_column_name => 'INCIDENT_ID');
11318
11319 RAISE FND_API.G_EXC_ERROR;
11320 EXCEPTION
11321 WHEN NO_DATA_FOUND THEN
11322 NULL;
11323 WHEN OTHERS THEN
11324 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
11325 END;
11326
11327 END IF;
11328
11329
11330 IF (p_request_number IS NOT NULL) THEN
11331
11332 --Check if the request number passed is unique
11333 DECLARE
11334 l_test VARCHAR2(250);
11335 BEGIN
11336 SELECT incident_number
11337 INTO l_test
11338 FROM cs_incidents_all_b
11339 WHERE incident_number = p_request_number;
11340
11341 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
11342 ( p_token_an => l_api_name_full,
11343 p_token_v => p_request_number,
11344 p_token_p => 'p_request_number',
11345 p_table_name => G_TABLE_NAME,
11346 p_column_name => 'INCIDENT_NUMBER' );
11347
11348 RAISE FND_API.G_EXC_ERROR;
11349 EXCEPTION
11350 WHEN NO_DATA_FOUND THEN
11351 NULL;
11352 WHEN OTHERS THEN
11353 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
11354 END;
11355
11356
11357 END IF;
11358
11359 -- replaced validation of org_id with the procedure call below and set local variable
11360 -- to p_org_id
11361 IF p_org_id IS NOT NULL
11362 THEN
11363 CS_SERVICEREQUEST_UTIL.validate_org_id
11364 ( p_org_id => p_org_id
11365 , x_return_status => l_return_status
11366 );
11367 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS)
11368 THEN
11369 RAISE FND_API.G_EXC_ERROR;
11370 END IF;
11371 END IF;
11372 l_org_id := p_org_id;
11373
11374
11375 --
11376 -- Validate the user and login id's
11377 --
11378 CS_ServiceRequest_UTIL.Validate_Who_Info
11379 ( p_api_name => l_api_name_full,
11380 p_parameter_name_usr => 'p_user_id',
11381 p_parameter_name_login => 'p_login_id',
11382 p_user_id => p_user_id,
11383 p_login_id => p_login_id,
11384 x_return_status => l_return_status);
11385 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11386 RAISE FND_API.G_EXC_ERROR;
11387 END IF;
11388
11389 -- Validate the created_by added for bug #5153581
11390 --
11391 IF l_service_request_rec.created_by IS NOT NULL AND
11392 l_service_request_rec.created_by <> FND_API.G_Miss_NUM THEN
11393
11394 CS_ServiceRequest_UTIL.Validate_Who_Info
11395 ( p_api_name => l_api_name_full,
11396 p_parameter_name_usr => 'p_created_by',
11397 p_parameter_name_login => NULL,
11398 p_user_id => l_service_request_rec.created_by,
11399 p_login_id => NULL,
11400 x_return_status => l_return_status);
11401
11402 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11403 RAISE FND_API.G_EXC_ERROR;
11404 END IF;
11405
11406 END IF ;
11407
11408 -- Validate the updated_by added for bug #5153581
11409 --
11410 IF l_service_request_rec.last_updated_by IS NOT NULL AND
11411 l_service_request_rec.last_updated_by <> FND_API.G_Miss_NUM THEN
11412
11413 CS_ServiceRequest_UTIL.Validate_Who_Info
11414 ( p_api_name => l_api_name_full,
11415 p_parameter_name_usr => 'p_last_updated_by',
11416 p_parameter_name_login => NULL,
11417 p_user_id => l_service_request_rec.last_updated_by,
11418 p_login_id => NULL,
11419 x_return_status => l_return_status);
11420
11421 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11422 RAISE FND_API.G_EXC_ERROR;
11423 END IF;
11424
11425 END IF ;
11426
11427 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2.1');
11428
11429
11430 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2.2');
11431
11432 --
11433 -- Type, status, severity, resource_type, owner and publish flag are always validated
11434 -- Urgency, problem code, expected resolution date, resolution code, and
11435 -- actual resolution date are validated if passed (not NULL)
11436 --
11437 l_service_request_val_rec.validate_type := FND_API.G_TRUE;
11438 l_service_request_val_rec.validate_status := FND_API.G_TRUE;
11439 l_service_request_val_rec.type_id := l_service_request_rec.type_id;
11440 l_service_request_val_rec.status_id := l_service_request_rec.status_id;
11441 l_service_request_val_rec.severity_id := l_service_request_rec.severity_id;
11442 --l_service_request_val_rec.resource_type := l_service_request_rec.resource_type;
11443 --l_service_request_val_rec.owner_id := l_service_request_rec.owner_id;
11444 --l_service_request_val_rec.publish_flag := l_service_request_rec.publish_flag;
11445
11446 IF (l_service_request_rec.urgency_id IS NOT NULL
11447 AND l_service_request_rec.urgency_id <> FND_API.G_MISS_NUM) THEN
11448 l_service_request_val_rec.urgency_id := l_service_request_rec.urgency_id;
11449 END IF;
11450
11451 IF (l_service_request_rec.resource_type IS NOT NULL
11452 AND l_service_request_rec.resource_type <> FND_API.G_MISS_CHAR) THEN
11453 l_service_request_val_rec.resource_type := l_service_request_rec.resource_type;
11454 END IF;
11455
11456 ---
11457 IF (l_service_request_rec.owner_id IS NOT NULL
11458 AND l_service_request_rec.owner_id <> FND_API.G_MISS_NUM) THEN
11459 l_service_request_val_rec.owner_id := l_service_request_rec.owner_id;
11460 END IF;
11461
11462 IF (l_service_request_rec.customer_id <> FND_API.G_MISS_NUM AND
11463 l_service_request_rec.customer_id IS NOT NULL )THEN
11464 l_service_request_val_rec.validate_customer := FND_API.G_TRUE;
11465 l_service_request_val_rec.customer_id := l_service_request_rec.customer_id;
11466 END IF;
11467
11468 IF (l_service_request_rec.problem_code IS NOT NULL
11469 AND l_service_request_rec.problem_code <> FND_API.G_MISS_CHAR) THEN
11470 l_service_request_val_rec.problem_code := l_service_request_rec.problem_code;
11471 END IF;
11472
11473 ---Added for bug 5278488 (FP For Bug # 5192499) spusegao 06/13/06
11474
11475 If ( l_service_request_rec.publish_flag = FND_API.G_MISS_CHAR) Then
11476 l_service_request_rec.publish_flag := 'N' ;
11477 l_service_request_val_rec.publish_flag := FND_API.G_MISS_CHAR ;
11478 End If ;
11479
11480 -----Added for enhancement 1803588--11.5.6 ---jngeorge ----07/20/01
11481 IF (l_service_request_rec.cust_pref_lang_id IS NOT NULL
11482 AND l_service_request_rec.cust_pref_lang_id <> FND_API.G_MISS_NUM) THEN
11483 l_service_request_val_rec.cust_pref_lang_id := l_service_request_rec.cust_pref_lang_id;
11484 END IF;
11485
11486 -----Added for enhancement 1806657--11.5.6 ---jngeorge ----07/20/01
11487 IF (l_service_request_rec.comm_pref_code IS NOT NULL
11488 AND l_service_request_rec.comm_pref_code <> FND_API.G_MISS_CHAR) THEN
11489 l_service_request_val_rec.comm_pref_code := l_service_request_rec.comm_pref_code;
11490 END IF;
11491
11492 ---------
11493 IF (l_service_request_rec.exp_resolution_date IS NOT NULL
11494 AND l_service_request_rec.exp_resolution_date <> FND_API.G_MISS_DATE) THEN
11495 l_service_request_val_rec.exp_resolution_date := l_service_request_rec.exp_resolution_date;
11496 END IF;
11497
11498 IF (l_service_request_rec.resolution_code IS NOT NULL
11499 AND l_service_request_rec.resolution_code <> FND_API.G_MISS_CHAR) THEN
11500 l_service_request_val_rec.resolution_code := l_service_request_rec.resolution_code;
11501 END IF;
11502
11503 IF (l_service_request_rec.act_resolution_date IS NOT NULL
11504 AND l_service_request_rec.act_resolution_date <> FND_API.G_MISS_DATE) THEN
11505 l_service_request_val_rec.act_resolution_date := l_service_request_rec.act_resolution_date;
11506 END IF;
11507
11508 --- Added for Enh# 1830701
11509 l_service_request_val_rec.request_date := l_service_request_rec.request_date;
11510
11511 IF (l_service_request_rec.incident_occurred_date IS NOT NULL
11512 AND l_service_request_rec.incident_occurred_date <> FND_API.G_MISS_DATE) THEN
11513 l_service_request_val_rec.incident_occurred_date := l_service_request_rec.incident_occurred_date;
11514 END IF;
11515
11516 IF (l_service_request_rec.incident_resolved_date IS NOT NULL
11517 AND l_service_request_rec.incident_resolved_date <> FND_API.G_MISS_DATE) THEN
11518 l_service_request_val_rec.incident_resolved_date := l_service_request_rec.incident_resolved_date;
11519 END IF;
11520
11521 IF (l_service_request_rec.inc_responded_by_date IS NOT NULL
11522 AND l_service_request_rec.inc_responded_by_date <> FND_API.G_MISS_DATE) THEN
11523 l_service_request_val_rec.inc_responded_by_date := l_service_request_rec.inc_responded_by_date;
11524 END IF;
11525
11526 --- Added for Enh# 1830701
11527 IF (l_service_request_rec.incident_location_id IS NOT NULL
11528 AND l_service_request_rec.incident_location_id <> FND_API.G_MISS_NUM) THEN
11529 l_service_request_val_rec.incident_location_id := l_service_request_rec.incident_location_id;
11530 -- Bug 4386870 12/12/05 smisra
11531 -- if incident location is passed then ignore passed value of incident country
11532 -- incident country will be derived based on location
11533 l_service_request_rec.incident_country := null;
11534 ELSE
11535 -- Bug 3420335
11536 -- if location id is null then location type too should be null.
11537 l_service_request_rec.incident_location_type := null;
11538 END IF;
11539
11540 IF (l_service_request_rec.incident_country IS NOT NULL
11541 AND l_service_request_rec.incident_country <> FND_API.G_MISS_CHAR) THEN
11542 l_service_request_val_rec.incident_country := l_service_request_rec.incident_country;
11543 END IF;
11544
11545 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2.3');
11546
11547 IF (nvl(l_service_request_rec.bill_to_site_id,-99) <> FND_API.G_MISS_NUM) THEN
11548 l_service_request_val_rec.validate_bill_to_site := FND_API.G_TRUE;
11549 l_service_request_val_rec.bill_to_site_id := l_service_request_rec.bill_to_site_id;
11550 END IF;
11551
11552 IF (nvl(l_service_request_rec.bill_to_site_use_id, -99) <> FND_API.G_MISS_NUM) THEN
11553 l_service_request_val_rec.bill_to_site_use_id := l_service_request_rec.bill_to_site_use_id;
11554 END IF;
11555
11556 IF (nvl(l_service_request_rec.bill_to_contact_id, -99) <> FND_API.G_MISS_NUM) THEN
11557 l_service_request_val_rec.bill_to_contact_id := l_service_request_rec.bill_to_contact_id;
11558 END IF;
11559
11560 IF (nvl(l_service_request_rec.bill_to_party_id, -99) <> FND_API.G_MISS_NUM) THEN
11561 l_service_request_val_rec.bill_to_party_id := l_service_request_rec.bill_to_party_id;
11562 END IF;
11563
11564 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2.4');
11565
11566 IF (nvl(l_service_request_rec.ship_to_site_id, -99) <> FND_API.G_MISS_NUM) THEN
11567 l_service_request_val_rec.validate_ship_to_site := FND_API.G_TRUE;
11568 l_service_request_val_rec.ship_to_site_id := l_service_request_rec.ship_to_site_id;
11569 END IF;
11570
11571 IF (nvl(l_service_request_rec.ship_to_site_use_id, -99) <> FND_API.G_MISS_NUM) THEN
11572 l_service_request_val_rec.ship_to_site_use_id := l_service_request_rec.ship_to_site_use_id;
11573 END IF;
11574
11575 IF (nvl(l_service_request_rec.ship_to_contact_id,-99) <> FND_API.G_MISS_NUM) THEN
11576 l_service_request_val_rec.ship_to_contact_id := l_service_request_rec.ship_to_contact_id;
11577 END IF;
11578
11579
11580 IF (nvl(l_service_request_rec.ship_to_party_id,-99) <> FND_API.G_MISS_NUM) THEN
11581 l_service_request_val_rec.ship_to_party_id := l_service_request_rec.ship_to_party_id;
11582 END IF;
11583
11584 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2.5');
11585
11586 IF ( l_service_request_rec.install_site_id <> FND_API.G_MISS_NUM ) THEN
11587 l_service_request_val_rec.validate_install_site := FND_API.G_TRUE;
11588 l_service_request_val_rec.install_site_id := l_service_request_rec.install_site_id;
11589 ELSE
11590 l_service_request_val_rec.install_site_id := null;
11591 END IF;
11592
11593 IF ( l_service_request_rec.install_site_use_id <> FND_API.G_MISS_NUM) THEN
11594 l_service_request_val_rec.validate_install_site := FND_API.G_TRUE;
11595 l_service_request_val_rec.install_site_use_id := l_service_request_rec.install_site_use_id;
11596 END IF;
11597
11598 ---************************
11599 --Assign all the fields to be validated
11600 IF (l_service_request_rec.contract_service_id <> FND_API.G_MISS_NUM AND
11601 l_service_request_rec.contract_service_id IS NOT NULL) THEN
11602 l_service_request_val_rec.contract_service_id := l_service_request_rec.contract_service_id;
11603 END IF;
11604
11605 IF (l_service_request_rec.contract_id <> FND_API.G_MISS_NUM AND
11606 l_service_request_rec.contract_id IS NOT NULL) THEN
11607 l_service_request_val_rec.contract_id := l_service_request_rec.contract_id;
11608 END IF;
11609
11610 IF (l_service_request_rec.project_number <> FND_API.G_MISS_CHAR AND
11611 l_service_request_rec.project_number IS NOT NULL) THEN
11612 l_service_request_val_rec.project_number := l_service_request_rec.project_number;
11613 END IF;
11614
11615 --Caller_type and primary_contact_id is needed for account_id validation
11616 l_service_request_val_rec.caller_type := l_service_request_rec.caller_type;
11617 l_service_request_val_rec.primary_contact_id := l_primary_contact_id;
11618
11619 IF (l_service_request_rec.account_id <> FND_API.G_MISS_NUM AND
11620 l_service_request_rec.account_id IS NOT NULL) THEN
11621 l_service_request_val_rec.account_id := l_service_request_rec.account_id;
11622 ELSE
11623 l_service_request_val_rec.account_id := null;
11624
11625 END IF;
11626
11627 IF (l_service_request_rec.platform_id <> FND_API.G_MISS_NUM AND
11628 l_service_request_rec.platform_id IS NOT NULL) THEN
11629 l_service_request_val_rec.platform_id := l_service_request_rec.platform_id;
11630 END IF;
11631
11632 IF (l_service_request_rec.platform_version_id <> FND_API.G_MISS_NUM AND
11633 l_service_request_rec.platform_version_id IS NOT NULL) THEN
11634 l_service_request_val_rec.platform_version_id := l_service_request_rec.platform_version_id;
11635 END IF;
11636
11637 IF (l_service_request_rec.inv_platform_org_id <> FND_API.G_MISS_NUM AND
11638 l_service_request_rec.inv_platform_org_id IS NOT NULL) THEN
11639 l_service_request_val_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
11640 END IF;
11641
11642 IF (l_service_request_rec.platform_version <> FND_API.G_MISS_CHAR AND
11643 l_service_request_rec.platform_version IS NOT NULL) THEN
11644 l_service_request_val_rec.platform_version := l_service_request_rec.platform_version;
11645 END IF;
11646
11647 IF (l_service_request_rec.territory_id <> FND_API.G_MISS_NUM AND
11648 l_service_request_rec.territory_id IS NOT NULL) THEN
11649 l_service_request_val_rec.territory_id := l_service_request_rec.territory_id;
11650 END IF;
11651
11652
11653 IF (l_service_request_rec.site_id <> FND_API.G_MISS_NUM AND
11654 l_service_request_rec.site_id IS NOT NULL) THEN
11655 l_service_request_val_rec.site_id := l_service_request_rec.site_id;
11656 END IF;
11657
11658 IF (l_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM AND
11659 l_service_request_rec.customer_product_id IS NOT NULL) THEN
11660 l_service_request_val_rec.customer_product_id := l_service_request_rec.customer_product_id ;
11661 ELSE
11662 l_service_request_val_rec.customer_product_id := null ;
11663 END IF;
11664
11665 /* Start : 5501340 */
11666 IF (l_service_request_rec.system_id <> FND_API.G_MISS_NUM AND
11667 l_service_request_rec.system_id IS NOT NULL) THEN
11668 l_service_request_val_rec.system_id := l_service_request_rec.system_id ;
11669 ELSE
11670 l_service_request_val_rec.system_id := null ;
11671 END IF;
11672 /* End : 5501340 */
11673
11674 IF (l_service_request_rec.current_serial_number <> FND_API.G_MISS_CHAR AND
11675 l_service_request_rec.current_serial_number IS NOT NULL) THEN
11676 l_service_request_val_rec.current_serial_number := l_service_request_rec.current_serial_number ;
11677 END IF;
11678
11679
11680 IF (l_service_request_rec.group_territory_id <> FND_API.G_MISS_NUM AND
11681 l_service_request_rec.group_territory_id IS NOT NULL) THEN
11682 l_service_request_val_rec.group_territory_id := l_service_request_rec.group_territory_id ;
11683 END IF;
11684 -----------Added for Enhancements 11.5.6----------
11685
11686 -- IF (l_service_request_rec.product_revision <> FND_API.G_MISS_CHAR AND
11687 -- l_service_request_rec.product_revision IS NOT NULL) THEN
11688 l_service_request_val_rec.product_revision := l_service_request_rec.product_revision ;
11689 -- END IF;
11690
11691 -- IF (l_service_request_rec.component_version <> FND_API.G_MISS_CHAR AND
11692 -- l_service_request_rec.component_version IS NOT NULL) THEN
11693 l_service_request_val_rec.component_version := l_service_request_rec.component_version ;
11694 --END IF;
11695
11696 -- IF (l_service_request_rec.subcomponent_version <> FND_API.G_MISS_CHAR AND
11697 -- l_service_request_rec.subcomponent_version IS NOT NULL) THEN
11698 l_service_request_val_rec.subcomponent_version := l_service_request_rec.subcomponent_version ;
11699 --END IF;
11700 -----------------------------------------
11701
11702 -- If inventory org id is passed in, assign it to the validate rec
11703 IF (l_service_request_rec.inventory_org_id <> FND_API.G_MISS_NUM AND
11704 l_service_request_rec.inventory_org_id IS NOT NULL) THEN
11705 l_service_request_val_rec.inventory_org_id := l_service_request_rec.inventory_org_id ;
11706 ELSE
11707 l_service_request_val_rec.inventory_org_id := null ;
11708 END IF;
11709
11710 -- If inventory item id is passed in, assign it to the validate rec
11711 IF (l_service_request_rec.inventory_item_id <> FND_API.G_MISS_NUM AND
11712 l_service_request_rec.inventory_item_id IS NOT NULL) THEN
11713 l_service_request_val_rec.inventory_item_id := l_service_request_rec.inventory_item_id ;
11714 ELSE
11715 l_service_request_val_rec.inventory_item_id := null;
11716 END IF;
11717
11718 IF (l_service_request_rec.cp_component_id <> FND_API.G_MISS_NUM AND
11719 l_service_request_rec.cp_component_id IS NOT NULL) THEN
11720 l_service_request_val_rec.cp_component_id := l_service_request_rec.cp_component_id ;
11721 END IF;
11722
11723 IF (l_service_request_rec.cp_component_version_id <> FND_API.G_MISS_NUM AND
11724 l_service_request_rec.cp_component_version_id IS NOT NULL) THEN
11725 l_service_request_val_rec.cp_component_version_id := l_service_request_rec.cp_component_version_id ;
11726 END IF;
11727
11728 IF (l_service_request_rec.cp_subcomponent_id <> FND_API.G_MISS_NUM AND
11729 l_service_request_rec.cp_subcomponent_id IS NOT NULL) THEN
11730 l_service_request_val_rec.cp_subcomponent_id := l_service_request_rec.cp_subcomponent_id ;
11731 END IF;
11732
11733 IF (l_service_request_rec.cp_subcomponent_version_id <> FND_API.G_MISS_NUM AND
11734 l_service_request_rec.cp_subcomponent_version_id IS NOT NULL) THEN
11735 l_service_request_val_rec.cp_subcomponent_version_id := l_service_request_rec.cp_subcomponent_version_id ;
11736 END IF;
11737
11738
11739 IF (l_service_request_rec.cp_revision_id <> FND_API.G_MISS_NUM AND
11740 l_service_request_rec.cp_revision_id IS NOT NULL) THEN
11741 l_service_request_val_rec.cp_revision_id := l_service_request_rec.cp_revision_id ;
11742 END IF;
11743
11744 IF (l_service_request_rec.inv_item_revision <> FND_API.G_MISS_CHAR AND
11745 l_service_request_rec.inv_item_revision IS NOT NULL) THEN
11746 l_service_request_val_rec.inv_item_revision := l_service_request_rec.inv_item_revision ;
11747 END IF;
11748
11749 IF (l_service_request_rec.inv_component_id <> FND_API.G_MISS_NUM AND
11750 l_service_request_rec.inv_component_id IS NOT NULL) THEN
11751 l_service_request_val_rec.inv_component_id := l_service_request_rec.inv_component_id ;
11752 END IF;
11753
11754 IF (l_service_request_rec.inv_component_version <> FND_API.G_MISS_CHAR AND
11755 l_service_request_rec.inv_component_version IS NOT NULL) THEN
11756 l_service_request_val_rec.inv_component_version := l_service_request_rec.inv_component_version ;
11757 END IF;
11758
11759 IF (l_service_request_rec.inv_subcomponent_id <> FND_API.G_MISS_NUM AND
11760 l_service_request_rec.inv_subcomponent_id IS NOT NULL) THEN
11761 l_service_request_val_rec.inv_subcomponent_id := l_service_request_rec.inv_subcomponent_id ;
11762 END IF;
11763
11764 IF (l_service_request_rec.inv_subcomponent_version <> FND_API.G_MISS_CHAR AND
11765
11766 l_service_request_rec.inv_subcomponent_version IS NOT NULL) THEN
11767 l_service_request_val_rec.inv_subcomponent_version := l_service_request_rec.inv_subcomponent_version ;
11768 END IF;
11769
11770 -- Added bill_to_account_id - ER# 2433831
11771
11772 IF (l_service_request_rec.bill_to_account_id <> FND_API.G_MISS_NUM AND
11773 l_service_request_rec.bill_to_account_id IS NOT NULL) THEN
11774 l_service_request_val_rec.bill_to_account_id := l_service_request_rec.bill_to_account_id ;
11775 END IF;
11776
11777 -- Added ship_to_account_id - ER# 2433831
11778
11779 IF (l_service_request_rec.ship_to_account_id <> FND_API.G_MISS_NUM AND
11780 l_service_request_rec.ship_to_account_id IS NOT NULL) THEN
11781 l_service_request_val_rec.ship_to_account_id := l_service_request_rec.ship_to_account_id ;
11782 END IF;
11783
11784 -- Added customer_phone_id - ER# 2463321
11785
11786 IF (l_service_request_rec.customer_phone_id <> FND_API.G_MISS_NUM AND
11787 l_service_request_rec.customer_phone_id IS NOT NULL) THEN
11788 l_service_request_val_rec.customer_phone_id := l_service_request_rec.customer_phone_id ;
11789 END IF;
11790
11791 -- Added customer_email_id - ER# 2463321
11792
11793 IF (l_service_request_rec.customer_email_id <> FND_API.G_MISS_NUM AND
11794 l_service_request_rec.customer_email_id IS NOT NULL) THEN
11795 l_service_request_val_rec.customer_email_id := l_service_request_rec.customer_email_id ;
11796 END IF;
11797
11798 --Made changes for bug #2786844
11799 IF (l_service_request_rec.external_reference <> FND_API.G_MISS_CHAR AND
11800 l_service_request_rec.external_reference IS NOT NULL) THEN
11801 l_service_request_val_rec.external_reference := l_service_request_rec.external_reference ;
11802 END IF;
11803
11804 -- for cmro_eam
11805 IF (l_service_request_rec.owning_dept_id <> FND_API.G_MISS_NUM AND
11806 l_service_request_rec.owning_dept_id IS NOT NULL) THEN
11807 l_service_request_val_rec.owning_dept_id := l_service_request_rec.owning_dept_id ;
11808 END IF;
11809
11810 -- end of cmro_eam
11811
11812 -- Added incident location type for Misc ERs project of 11.5.10 --anmukher --08/25/03
11813 IF (l_service_request_rec.incident_location_type IS NOT NULL
11814 AND l_service_request_rec.incident_location_type <> FND_API.G_MISS_CHAR) THEN
11815 l_service_request_val_rec.incident_location_type := l_service_request_rec.incident_location_type;
11816 END IF;
11817
11818 -- Added to fix issue in bug # 3288806.
11819 IF ((l_service_request_rec.category_id IS NOT NULL) AND (l_service_request_rec.category_id <> FND_API.G_MISS_NUM)) THEN
11820 l_service_request_val_rec.category_id := l_service_request_rec.category_id ;
11821 IF (l_service_request_rec.category_set_id = FND_API.G_MISS_NUM) THEN
11822 l_service_request_rec.category_set_id := FND_PROFILE.value('CS_SR_DEFAULT_CATEGORY_SET');
11823 END IF;
11824 l_service_request_val_rec.category_set_id := l_service_request_rec.category_set_id ;
11825 END IF ;
11826
11827 -- Added to fix issue in bug # 3288806.
11828 IF ((l_service_request_rec.category_set_id IS NOT NULL) AND (l_service_request_rec.category_set_id <> FND_API.G_MISS_NUM)) THEN
11829 l_service_request_val_rec.category_set_id := l_service_request_rec.category_set_id ;
11830 END IF ;
11831 IF (l_service_request_rec.group_type <> FND_API.G_MISS_CHAR AND
11832 l_service_request_rec.group_type IS NOT NULL) THEN
11833 l_service_request_val_rec.group_type := l_service_request_rec.group_type;
11834 END IF;
11835
11836 IF (l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM AND
11837 l_service_request_rec.owner_group_id IS NOT NULL) THEN
11838 l_service_request_val_rec.owner_group_id := l_service_request_rec.owner_group_id ;
11839 END IF;
11840
11841 -- Added for bug 3635269
11842
11843 IF (l_service_request_rec.sr_creation_channel <> FND_API.G_MISS_CHAR AND
11844 l_service_request_rec.sr_creation_channel IS NOT NULL) THEN
11845 l_service_request_val_rec.sr_creation_channel := l_service_request_rec.sr_creation_channel ;
11846 END IF;
11847
11848 -- <bug5224245>
11849 IF (l_service_request_rec.system_id <> FND_API.G_MISS_NUM AND
11850 l_service_request_rec.system_id IS NOT NULL) THEN
11851 l_service_request_val_rec.system_id := l_service_request_rec.system_id;
11852 END IF;
11853 -- </bug5224245>
11854
11855 -- there is no need to check if maint_org is equal to FND_API.G_MISS_NUM or not.
11856 -- val rec always have it's value as G_MISS_NUM. so it might replace G_MISS_NUM
11857 -- with G_MISS_NUM. No need to check for NULL too because validate_SR_record
11858 -- checks for null value too before calling any validation
11859 l_service_request_val_rec.maint_organization_id :=
11860 l_service_request_rec.maint_organization_id;
11861
11862 -- --------------------------------------------------------------------
11863 -- Validate all non-missing attributes by calling the utility procedure.
11864 -- --------------------------------------------------------------------
11865 Validate_ServiceRequest_Record
11866 ( p_api_name => l_api_name_full,
11867 p_service_request_rec => l_service_request_val_rec,
11868 p_request_date => l_service_request_rec.request_date,
11869 p_org_id => l_org_id,
11870 p_resp_appl_id => p_resp_appl_id,
11871 p_resp_id => p_resp_id,
11872 p_user_id => p_user_id,
11873 p_operation => l_operation,
11874 p_close_flag => l_close_flag,
11875 p_disallow_request_update => l_disallow_request_update,
11876 p_disallow_owner_update => l_disallow_owner_update,
11877 p_disallow_product_update => l_disallow_product_update,
11878 p_employee_name => l_employee_name,
11879 p_inventory_item_id => l_cp_item_id,
11880 p_contract_id => x_contra_id,
11881 p_contract_number => x_contract_number,
11882 x_bill_to_site_id => l_bill_to_site_id,
11883 x_ship_to_site_id => l_ship_to_site_id,
11884 x_bill_to_site_use_id => l_bill_to_site_use_id,
11885 x_ship_to_site_use_id => l_ship_to_site_use_id,
11886 x_return_status => x_return_status,
11887 x_group_name => l_group_name,
11888 x_owner_name => l_owner_name,
11889 x_product_revision => l_service_request_rec.product_revision ,
11890 x_component_version => l_service_request_rec.component_version,
11891 x_subcomponent_version => l_service_request_rec.subcomponent_version,
11892 -- cmro_eam
11893 p_cmro_flag => p_cmro_flag,
11894 p_maintenance_flag => p_maintenance_flag,
11895 p_sr_mode => 'CREATE'
11896 );
11897
11898 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11899 RAISE FND_API.G_EXC_ERROR;
11900 END IF;
11901
11902 -- Done the changes for bug 2725543
11903
11904 IF l_ship_to_site_id <> FND_API.G_MISS_NUM THEN
11905 l_service_request_rec.ship_to_site_id := l_ship_to_site_id;
11906 END IF;
11907 IF l_ship_to_site_use_id <> FND_API.G_MISS_NUM THEN
11908 l_service_request_rec.ship_to_site_use_id := l_ship_to_site_use_id;
11909 END IF;
11910
11911 IF l_bill_to_site_id <> FND_API.G_MISS_NUM THEN
11912 l_service_request_rec.bill_to_site_id := l_bill_to_site_id;
11913 END IF;
11914 IF l_bill_to_site_use_id <> FND_API.G_MISS_NUM THEN
11915 l_service_request_rec.bill_to_site_use_id := l_bill_to_site_use_id;
11916 END IF;
11917
11918 --cs_sERviceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #2.7');
11919
11920 --
11921 -- If customer product ID is passed in and validated, use the inventory
11922 -- item ID retrieved from the CS_CUSTOMER_PRODUCTS_ALL table.
11923 --
11924 -- If customer_product_id is specified then the inventory item id
11925 -- specified in the record type is always overwritten by the inventory item
11926 -- id value in the
11927 -- CS_CUSTOMER_PRODUCTS_ALL for that customer_product_id
11928 IF (l_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM) THEN
11929 l_service_request_rec.inventory_item_id := l_cp_item_id;
11930 END IF;
11931
11932
11933 -- --------------------------------------------------------------------
11934 -- Validate the closed date if the status is a "closed" status, meaning
11935 -- that if the CLOSE_FLAG of the status is 'Y'. If not, ignore the
11936 -- closed date. If it is a closed status, and the close date is not
11937 -- passed in, use the system date as the default close date.
11938 -- --------------------------------------------------------------------
11939 IF (l_close_flag = 'Y') THEN
11940 IF ((l_service_request_rec.closed_date = FND_API.G_MISS_DATE) OR
11941 (l_service_request_rec.closed_date IS NULL)) THEN
11942 l_service_request_rec.closed_date := SYSDATE;
11943 ELSIF (l_service_request_rec.closed_date IS NOT NULL) THEN
11944
11945 CS_ServiceRequest_UTIL.Validate_Closed_Date
11946 ( p_api_name => l_api_name_full,
11947 p_parameter_name => 'p_closed_date',
11948 p_closed_date => l_service_request_rec.closed_date,
11949 p_request_date => l_service_request_rec.request_date,
11950 x_return_status => l_return_status
11951 );
11952 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11953 RAISE FND_API.G_EXC_ERROR;
11954 END IF;
11955 END IF;
11956 ELSE
11957 IF ((l_service_request_rec.closed_date <> FND_API.G_MISS_DATE) AND
11958 (l_service_request_rec.closed_date IS NOT NULL)) THEN
11959
11960 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg
11961 (p_token_an => l_api_name_full,
11962 p_token_ip => 'p_closed_date',
11963 p_table_name => G_TABLE_NAME,
11964 p_column_name => 'CLOSED_DATE');
11965 END IF;
11966 l_service_request_rec.closed_date := NULL;
11967 END IF;
11968
11969 -- Validate SR_CREATION_CHANNEL
11970 -- For bug 3635269
11971 /* IF (l_service_request_rec.sr_creation_channel <> FND_API.G_MISS_CHAR AND
11972 l_service_request_rec.sr_creation_channel IS NOT NULL) THEN
11973
11974 CS_ServiceRequest_UTIL.Validate_SR_Channel(
11975 p_api_name => l_api_name_full,
11976 p_parameter_name => 'p_sr_creation_channel',
11977 p_sr_creation_channel => l_service_request_rec.sr_creation_channel,
11978 x_return_status => l_return_status);
11979
11980 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
11981 RAISE FND_API.G_EXC_ERROR;
11982 END IF;
11983 END IF; */
11984
11985
11986
11987 END IF; /* IF p_validation_level >= FND_API.G_VALID_LEVEL_NONE THEN */
11988
11989 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #3');
11990
11991 --
11992 -- The request_id needs to be generated here because it is needed when
11993 -- inserting records into CS_HZ_SR_CONTACT_POINTS
11994 -- This generation is done here because the earlier check to see if
11995 -- request id is unique is done only if validation level is set.
11996 --Commenting this because , selecting from dual is not supported anymore
11997 --because of performance reasons.
11998
11999 --CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg(l_api_name_full, 'step #4');
12000
12001 -- -------------------------------------------------------------
12002 -- Check if the passsed type_id has AutoLaunch Workflow flag set to 'Y'.
12003 -- If so, we need to call the workflow lauch API. We need to do this irrespective
12004 -- of the validation level set
12005 -- -------------------------------------------------------------
12006
12007 BEGIN
12008 -- Initialize the return status.
12009 l_return_status := FND_API.G_RET_STS_SUCCESS;
12010
12011 -- Verify the type ID against the database.
12012 -- Done here cause, these flags need to get their values
12013 SELECT autolaunch_workflow_flag, abort_workflow_close_flag, workflow
12014 INTO x_autolaunch_wkf_flag, x_abort_wkf_close_flag, x_wkf_process_name
12015 FROM cs_incident_types_b
12016 WHERE incident_type_id = l_service_request_rec.type_id
12017 AND incident_subtype = G_SR_SUBTYPE
12018 ;
12019
12020 EXCEPTION
12021
12022 WHEN NO_DATA_FOUND THEN
12023 l_return_status := FND_API.G_RET_STS_ERROR;
12024
12025 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
12026 ( p_token_an => l_api_name_full,
12027 p_token_v => TO_CHAR(l_service_request_rec.type_id),
12028 p_token_p => 'p_type_id',
12029 p_table_name => G_TABLE_NAME ,
12030 p_column_name => 'INCIDENT_TYPE_ID');
12031
12032 RAISE FND_API.G_EXC_ERROR;
12033
12034 END ;
12035
12036 -- for the bug 3050727
12037 l_service_request_rec.status_flag := get_status_flag(l_service_request_rec.status_id);
12038 --- AUDIT
12039
12040 IF (l_service_request_rec.urgency_id = FND_API.G_MISS_NUM) OR
12041 (l_service_request_rec.urgency_id IS NULL) THEN
12042 x_audit_vals_rec.change_incident_urgency_flag := 'N';
12043 ELSE
12044 x_audit_vals_rec.change_incident_urgency_FLAG := 'Y';
12045 x_audit_vals_rec.incident_urgency_id := l_service_request_rec.urgency_id;
12046 END IF;
12047
12048
12049 /* IF (l_service_request_rec.owner_group_id = FND_API.G_MISS_NUM) OR
12050 (l_service_request_rec.owner_group_id IS NULL) THEN
12051 x_audit_vals_rec.change_owner_group_id_flag := 'N';
12052 ELSE
12053 x_audit_vals_rec.change_owner_group_id_FLAG := 'Y';
12054 x_audit_vals_rec.owner_group_id := l_service_request_rec.owner_group_id;
12055 END IF;
12056 */
12057
12058 IF (l_service_request_rec.product_revision = FND_API.G_MISS_CHAR) OR
12059 (l_service_request_rec.product_revision IS NULL) THEN
12060 x_audit_vals_rec.change_product_revision_flag := 'N';
12061 ELSE
12062 x_audit_vals_rec.change_product_revision_FLAG := 'Y';
12063 x_audit_vals_rec.product_revision := l_service_request_rec.product_revision;
12064 END IF;
12065
12066 IF (l_service_request_rec.component_version = FND_API.G_MISS_CHAR) OR
12067 (l_service_request_rec.component_version IS NULL) THEN
12068 x_audit_vals_rec.CHANGE_COMP_VER_FLAG := 'N';
12069 ELSE
12070 x_audit_vals_rec.CHANGE_COMP_VER_FLAG := 'Y';
12071 x_audit_vals_rec.component_version := l_service_request_rec.component_version;
12072 END IF;
12073
12074 IF (l_service_request_rec.subcomponent_version = FND_API.G_MISS_CHAR) OR
12075 (l_service_request_rec.subcomponent_version IS NULL) THEN
12076 x_audit_vals_rec.CHANGE_SUBCOMP_VER_FLAG := 'N';
12077 ELSE
12078 x_audit_vals_rec.CHANGE_SUBCOMP_VER_FLAG := 'Y';
12079 x_audit_vals_rec.subcomponent_version := l_service_request_rec.subcomponent_version;
12080 END IF;
12081
12082 IF (l_service_request_rec.platform_id = FND_API.G_MISS_NUM) OR
12083 (l_service_request_rec.platform_id IS NULL) THEN
12084 x_audit_vals_rec.change_platform_id_flag := 'N';
12085 ELSE
12086 x_audit_vals_rec.change_platform_id_FLAG := 'Y';
12087 x_audit_vals_rec.platform_id := l_service_request_rec.platform_id;
12088 END IF;
12089
12090 IF (l_service_request_rec.customer_product_id = FND_API.G_MISS_NUM) OR
12091 (l_service_request_rec.customer_product_id IS NULL) THEN
12092 x_audit_vals_rec.CHANGE_CUSTOMER_PRODUCT_FLAG := 'N';
12093 ELSE
12094 x_audit_vals_rec.CHANGE_CUSTOMER_PRODUCT_FLAG := 'Y';
12095 x_audit_vals_rec.customer_product_id := l_service_request_rec.customer_product_id;
12096 END IF;
12097
12098 IF (l_service_request_rec.cp_component_id = FND_API.G_MISS_NUM) OR
12099 (l_service_request_rec.cp_component_id IS NULL) THEN
12100 x_audit_vals_rec.CHANGE_CP_COMPONENT_ID_FLAG := 'N';
12101 ELSE
12102 x_audit_vals_rec.CHANGE_CP_COMPONENT_ID_FLAG := 'Y';
12103 x_audit_vals_rec.cp_component_id := l_service_request_rec.cp_component_id;
12104 END IF;
12105
12106 IF (l_service_request_rec.cp_component_version_id = FND_API.G_MISS_NUM) OR
12107 (l_service_request_rec.cp_component_version_id IS NULL) THEN
12108 x_audit_vals_rec.CHANGE_CP_COMP_VER_ID_FLAG := 'N';
12109 ELSE
12110 x_audit_vals_rec.CHANGE_CP_COMP_VER_ID_FLAG := 'Y';
12111 x_audit_vals_rec.cp_component_version_id := l_service_request_rec.cp_component_version_id;
12112 END IF;
12113
12114 IF (l_service_request_rec.cp_subcomponent_id = FND_API.G_MISS_NUM) OR
12115 (l_service_request_rec.cp_subcomponent_id IS NULL) THEN
12116 x_audit_vals_rec.change_cp_subcomponent_id_flag := 'N';
12117 ELSE
12118 x_audit_vals_rec.change_cp_subcomponent_id_FLAG := 'Y';
12119 x_audit_vals_rec.cp_subcomponent_id := l_service_request_rec.cp_subcomponent_id;
12120 END IF;
12121
12122 IF (l_service_request_rec.cp_subcomponent_version_id = FND_API.G_MISS_NUM) OR
12123 (l_service_request_rec.cp_subcomponent_version_id IS NULL) THEN
12124 x_audit_vals_rec.CHANGE_CP_SUBCOMP_VER_ID_FLAG := 'N';
12125 ELSE
12126 x_audit_vals_rec.CHANGE_CP_SUBCOMP_VER_ID_FLAG := 'Y';
12127 x_audit_vals_rec.cp_subcomponent_version_id := l_service_request_rec.cp_subcomponent_version_id;
12128 END IF;
12129
12130 IF (l_service_request_rec.cp_revision_id = FND_API.G_MISS_NUM) OR
12131 (l_service_request_rec.cp_revision_id IS NULL) THEN
12132 x_audit_vals_rec.change_cp_revision_id_flag := 'N';
12133 ELSE
12134 x_audit_vals_rec.change_cp_revision_id_FLAG := 'Y';
12135 x_audit_vals_rec.cp_revision_id := l_service_request_rec.cp_revision_id;
12136 END IF;
12137
12138 IF (l_service_request_rec.inv_item_revision = FND_API.G_MISS_CHAR) OR
12139 (l_service_request_rec.inv_item_revision IS NULL) THEN
12140 x_audit_vals_rec.change_inv_item_revision := 'N';
12141 ELSE
12142 x_audit_vals_rec.change_inv_item_revision := 'Y';
12143 x_audit_vals_rec.inv_item_revision := l_service_request_rec.inv_item_revision;
12144 END IF;
12145
12146 IF (l_service_request_rec.inv_component_id = FND_API.G_MISS_NUM) OR
12147 (l_service_request_rec.inv_component_id IS NULL) THEN
12148 x_audit_vals_rec.change_inv_component_id := 'N';
12149 ELSE
12150 x_audit_vals_rec.change_inv_component_id := 'Y';
12151 x_audit_vals_rec.inv_component_id := l_service_request_rec.inv_component_id;
12152 END IF;
12153
12154 IF (l_service_request_rec.inv_component_version = FND_API.G_MISS_CHAR) OR
12155 (l_service_request_rec.inv_component_version IS NULL) THEN
12156 x_audit_vals_rec.change_inv_component_version := 'N';
12157 ELSE
12158 x_audit_vals_rec.change_inv_component_version := 'Y';
12159 x_audit_vals_rec.inv_component_version := l_service_request_rec.inv_component_version;
12160 END IF;
12161
12162 IF (l_service_request_rec.inv_subcomponent_id = FND_API.G_MISS_NUM) OR
12163 (l_service_request_rec.inv_subcomponent_id IS NULL) THEN
12164 x_audit_vals_rec.change_inv_subcomponent_id := 'N';
12165 ELSE
12166 x_audit_vals_rec.change_inv_subcomponent_id := 'Y';
12167 x_audit_vals_rec.inv_subcomponent_id := l_service_request_rec.inv_subcomponent_id;
12168 END IF;
12169
12170 IF (l_service_request_rec.inv_subcomponent_version = FND_API.G_MISS_CHAR) OR
12171 (l_service_request_rec.inv_subcomponent_version IS NULL) THEN
12172 x_audit_vals_rec.CHANGE_INV_SUBCOMP_VERSION := 'N';
12173 ELSE
12174 x_audit_vals_rec.CHANGE_INV_SUBCOMP_VERSION := 'Y';
12175 x_audit_vals_rec.inv_subcomponent_version := l_service_request_rec.inv_subcomponent_version;
12176 END IF;
12177
12178 IF (l_service_request_rec.inventory_item_id = FND_API.G_MISS_NUM) OR
12179 (l_service_request_rec.inventory_item_id IS NULL) THEN
12180 x_audit_vals_rec.CHANGE_INVENTORY_ITEM_FLAG := 'N';
12181 ELSE
12182 x_audit_vals_rec.CHANGE_INVENTORY_ITEM_FLAG := 'Y';
12183 x_audit_vals_rec.inventory_item_id := l_service_request_rec.inventory_item_id;
12184 END IF;
12185
12186 IF (l_service_request_rec.inv_platform_org_id = FND_API.G_MISS_NUM) OR
12187 (l_service_request_rec.inv_platform_org_id IS NULL) THEN
12188 x_audit_vals_rec.CHANGE_PLATFORM_ORG_ID_FLAG := 'N';
12189 ELSE
12190 x_audit_vals_rec.CHANGE_PLATFORM_ORG_ID_FLAG := 'Y';
12191 x_audit_vals_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
12192 END IF;
12193
12194 /* move to create_serevicerequest just before call to create audit rec 7/21/05 smisra
12195 This was need because these dates returned by get_contract were not stamped on audit rec
12196 IF (l_service_request_rec.exp_resolution_date = FND_API.G_MISS_DATE) OR
12197 (l_service_request_rec.exp_resolution_date IS NULL) THEN
12198 x_audit_vals_rec.CHANGE_RESOLUTION_FLAG := 'N';
12199 ELSE
12200 x_audit_vals_rec.CHANGE_RESOLUTION_FLAG := 'Y';
12201 x_audit_vals_rec.EXPECTED_RESOLUTION_DATE := l_service_request_rec.exp_resolution_date;
12202 END IF;
12203
12204 IF (l_service_request_rec.obligation_date = FND_API.G_MISS_DATE) OR
12205 (l_service_request_rec.obligation_date IS NULL) THEN
12206 x_audit_vals_rec.CHANGE_OBLIGATION_FLAG := 'N';
12207 ELSE
12208 x_audit_vals_rec.CHANGE_OBLIGATION_FLAG := 'Y';
12209 x_audit_vals_rec.obligation_date := l_service_request_rec.obligation_date;
12210 END IF;
12211 ************************************************************************************/
12212
12213 IF (l_service_request_rec.territory_id = FND_API.G_MISS_NUM) OR
12214 (l_service_request_rec.territory_id IS NULL) THEN
12215 x_audit_vals_rec.CHANGE_TERRITORY_ID_FLAG := 'N';
12216 ELSE
12217 x_audit_vals_rec.CHANGE_TERRITORY_ID_FLAG := 'Y';
12218 x_audit_vals_rec.territory_id := l_service_request_rec.territory_id;
12219 END IF;
12220
12221 IF (l_service_request_rec.bill_to_contact_id = FND_API.G_MISS_NUM ) OR
12222 (l_service_request_rec.bill_to_contact_id IS NULL) THEN
12223 x_audit_vals_rec.CHANGE_BILL_TO_FLAG := 'N';
12224 ELSE
12225 x_audit_vals_rec.CHANGE_BILL_TO_FLAG := 'Y';
12226 x_audit_vals_rec.bill_to_contact_id := l_service_request_rec.bill_to_contact_id;
12227 END IF;
12228
12229 IF (l_service_request_rec.ship_to_contact_id = FND_API.G_MISS_NUM ) OR
12230 (l_service_request_rec.ship_to_contact_id IS NULL) THEN
12231 x_audit_vals_rec.CHANGE_SHIP_TO_FLAG := 'N';
12232 ELSE
12233 x_audit_vals_rec.CHANGE_SHIP_TO_FLAG := 'Y';
12234 x_audit_vals_rec.ship_to_contact_id := l_service_request_rec.ship_to_contact_id;
12235 END IF;
12236
12237 IF (l_service_request_rec.status_id = FND_API.G_MISS_NUM) OR
12238 (l_service_request_rec.status_id IS NULL) THEN
12239 x_audit_vals_rec.change_incident_status_flag := 'N';
12240 ELSE
12241 x_audit_vals_rec.change_incident_status_flag := 'Y';
12242 x_audit_vals_rec.incident_status_id := l_service_request_rec.status_id;
12243 END IF;
12244
12245 -- Added following block of code to populate the close date audit columns on SR creation in close status.
12246 -- spusegao 04/05/2004
12247
12248 IF NVL(l_close_flag,'N') = 'Y' THEN
12249 x_audit_vals_rec.close_date := l_service_request_rec.closed_date ;
12250 x_audit_vals_rec.old_close_date := null;
12251 x_audit_vals_rec.change_close_date_flag := 'Y';
12252 ELSE
12253 x_audit_vals_rec.close_date := null;
12254 x_audit_vals_rec.old_close_date := null;
12255 x_audit_vals_rec.change_close_date_flag := 'N' ;
12256 END IF ;
12257
12258 IF (l_service_request_rec.TYPE_ID = FND_API.G_MISS_NUM) OR
12259 (l_service_request_rec.TYPE_ID IS NULL) THEN
12260 x_audit_vals_rec.CHANGE_INCIDENT_TYPE_FLAG := 'N';
12261 ELSE
12262 x_audit_vals_rec.CHANGE_INCIDENT_TYPE_FLAG := 'Y';
12263 x_audit_vals_rec.INCIDENT_TYPE_ID := l_service_request_rec.TYPE_ID;
12264 END IF;
12265
12266 IF (l_service_request_rec.SEVERITY_ID = FND_API.G_MISS_NUM) OR
12267 (l_service_request_rec.SEVERITY_ID IS NULL) THEN
12268 x_audit_vals_rec.CHANGE_INCIDENT_SEVERITY_FLAG := 'N';
12269 ELSE
12270 x_audit_vals_rec.CHANGE_INCIDENT_SEVERITY_FLAG := 'Y';
12271 x_audit_vals_rec.INCIDENT_SEVERITY_ID := l_service_request_rec.SEVERITY_ID ;
12272 END IF;
12273
12274 IF (l_service_request_rec.REQUEST_DATE = FND_API.G_MISS_DATE) OR
12275 (l_service_request_rec.REQUEST_DATE IS NULL) THEN
12276 x_audit_vals_rec.CHANGE_INCIDENT_DATE_FLAG := 'N';
12277 ELSE
12278 x_audit_vals_rec.CHANGE_INCIDENT_DATE_FLAG := 'Y';
12279 x_audit_vals_rec.INCIDENT_DATE := l_service_request_rec.REQUEST_DATE;
12280 END IF;
12281
12282 IF (l_service_request_rec.PLATFORM_VERSION_ID = FND_API.G_MISS_NUM) OR
12283 (l_service_request_rec.PLATFORM_VERSION_ID IS NULL) THEN
12284 x_audit_vals_rec.CHANGE_PLAT_VER_ID_FLAG := 'N';
12285 ELSE
12286 x_audit_vals_rec.CHANGE_PLAT_VER_ID_FLAG := 'Y';
12287 x_audit_vals_rec.PLATFORM_VERSION_ID := l_service_request_rec.PLATFORM_VERSION_ID;
12288 END IF;
12289
12290 IF (l_service_request_rec.LANGUAGE_ID = FND_API.G_MISS_NUM) OR
12291 (l_service_request_rec.LANGUAGE_ID IS NULL) THEN
12292 x_audit_vals_rec.CHANGE_LANGUAGE_ID_FLAG := 'N';
12293 ELSE
12294 x_audit_vals_rec.CHANGE_LANGUAGE_ID_FLAG := 'Y';
12295 x_audit_vals_rec.LANGUAGE_ID := l_service_request_rec.LANGUAGE_ID;
12296 END IF;
12297
12298
12299 IF (l_service_request_rec.inventory_org_id = FND_API.G_MISS_NUM) OR
12300 (l_service_request_rec.inventory_org_id IS NULL) THEN
12301 x_audit_vals_rec.CHANGE_INV_ORGANIZATION_FLAG := 'N';
12302 ELSE
12303 x_audit_vals_rec.CHANGE_INV_ORGANIZATION_FLAG := 'Y';
12304 x_audit_vals_rec.INV_ORGANIZATION_ID := l_service_request_rec.inventory_org_id;
12305 END IF;
12306
12307 IF (l_service_request_rec.STATUS_FLAG = FND_API.G_MISS_CHAR) OR
12308 (l_service_request_rec.STATUS_FLAG IS NULL) THEN
12309 x_audit_vals_rec.CHANGE_STATUS_FLAG := 'N';
12310 ELSE
12311 x_audit_vals_rec.CHANGE_STATUS_FLAG := 'Y';
12312 x_audit_vals_rec.STATUS_FLAG := l_service_request_rec.STATUS_FLAG;
12313 END IF;
12314
12315 --- BUG 3640344 - pkesani
12316
12317 IF (l_service_request_rec.closed_date = FND_API.G_MISS_DATE) OR
12318 (l_service_request_rec.closed_date IS NULL) THEN
12319 x_audit_vals_rec.CHANGE_CLOSE_DATE_FLAG := 'N';
12320 ELSE
12321 x_audit_vals_rec.CHANGE_CLOSE_DATE_FLAG := 'Y';
12322 x_audit_vals_rec.CLOSE_DATE := l_service_request_rec.closed_date;
12323 END IF;
12324
12325 IF (l_service_request_rec.PRIMARY_CONTACT_ID = FND_API.G_MISS_NUM) OR
12326 (l_service_request_rec.PRIMARY_CONTACT_ID IS NULL) THEN
12327 x_audit_vals_rec.CHANGE_PRIMARY_CONTACT_FLAG := 'N';
12328 ELSE
12329 x_audit_vals_rec.CHANGE_PRIMARY_CONTACT_FLAG := 'Y';
12330 x_audit_vals_rec.PRIMARY_CONTACT_ID := l_service_request_rec.PRIMARY_CONTACT_ID;
12331 END IF;
12332
12333 -- Added for Auditing project of 11.5.10 --anmukher --09/03/03
12334
12335 IF (l_service_request_rec.CUSTOMER_ID <> FND_API.G_MISS_NUM) AND
12336 (l_service_request_rec.CUSTOMER_ID IS NOT NULL) THEN
12337 x_audit_vals_rec.CUSTOMER_ID := l_service_request_rec.CUSTOMER_ID;
12338 END IF;
12339
12340 IF (l_service_request_rec.BILL_TO_SITE_USE_ID <> FND_API.G_MISS_NUM) AND
12341 (l_service_request_rec.BILL_TO_SITE_USE_ID IS NOT NULL) THEN
12342 x_audit_vals_rec.BILL_TO_SITE_USE_ID := l_service_request_rec.BILL_TO_SITE_USE_ID;
12343 END IF;
12344
12345 IF (l_service_request_rec.EMPLOYEE_ID <> FND_API.G_MISS_NUM) AND
12346 (l_service_request_rec.EMPLOYEE_ID IS NOT NULL) THEN
12347 x_audit_vals_rec.EMPLOYEE_ID := l_service_request_rec.EMPLOYEE_ID;
12348 END IF;
12349
12350 IF (l_service_request_rec.SHIP_TO_SITE_USE_ID <> FND_API.G_MISS_NUM) AND
12351 (l_service_request_rec.SHIP_TO_SITE_USE_ID IS NOT NULL) THEN
12352 x_audit_vals_rec.SHIP_TO_SITE_USE_ID := l_service_request_rec.SHIP_TO_SITE_USE_ID;
12353 END IF;
12354
12355 IF (l_service_request_rec.PROBLEM_CODE <> FND_API.G_MISS_CHAR) AND
12356 (l_service_request_rec.PROBLEM_CODE IS NOT NULL) THEN
12357 x_audit_vals_rec.PROBLEM_CODE := l_service_request_rec.PROBLEM_CODE;
12358 END IF;
12359
12360 IF (l_service_request_rec.ACT_RESOLUTION_DATE <> FND_API.G_MISS_DATE) AND
12361 (l_service_request_rec.ACT_RESOLUTION_DATE IS NOT NULL) THEN
12362 x_audit_vals_rec.ACTUAL_RESOLUTION_DATE := l_service_request_rec.ACT_RESOLUTION_DATE;
12363 END IF;
12364
12365 IF (l_service_request_rec.INSTALL_SITE_USE_ID <> FND_API.G_MISS_NUM) AND
12366 (l_service_request_rec.INSTALL_SITE_USE_ID IS NOT NULL) THEN
12367 x_audit_vals_rec.INSTALL_SITE_USE_ID := l_service_request_rec.INSTALL_SITE_USE_ID;
12368 END IF;
12369
12370 IF (l_service_request_rec.CURRENT_SERIAL_NUMBER <> FND_API.G_MISS_CHAR) AND
12371 (l_service_request_rec.CURRENT_SERIAL_NUMBER IS NOT NULL) THEN
12372 x_audit_vals_rec.CURRENT_SERIAL_NUMBER := l_service_request_rec.CURRENT_SERIAL_NUMBER;
12373 END IF;
12374
12375 IF (l_service_request_rec.SYSTEM_ID <> FND_API.G_MISS_NUM) AND
12376 (l_service_request_rec.SYSTEM_ID IS NOT NULL) THEN
12377 x_audit_vals_rec.SYSTEM_ID := l_service_request_rec.SYSTEM_ID;
12378 END IF;
12379
12380 --01/23/04 request and external context were not processed for g_miss_char
12381 IF (l_service_request_rec.REQUEST_ATTRIBUTE_1 <> FND_API.G_MISS_CHAR) AND
12382 (l_service_request_rec.REQUEST_ATTRIBUTE_1 IS NOT NULL) THEN
12383 x_audit_vals_rec.INCIDENT_ATTRIBUTE_1 := l_service_request_rec.REQUEST_ATTRIBUTE_1;
12384 END IF;
12385
12386 IF (l_service_request_rec.REQUEST_ATTRIBUTE_2 <> FND_API.G_MISS_CHAR) AND
12387 (l_service_request_rec.REQUEST_ATTRIBUTE_2 IS NOT NULL) THEN
12388 x_audit_vals_rec.INCIDENT_ATTRIBUTE_2 := l_service_request_rec.REQUEST_ATTRIBUTE_2;
12389 END IF;
12390
12391 IF (l_service_request_rec.REQUEST_ATTRIBUTE_3 <> FND_API.G_MISS_CHAR) AND
12392 (l_service_request_rec.REQUEST_ATTRIBUTE_3 IS NOT NULL) THEN
12393 x_audit_vals_rec.INCIDENT_ATTRIBUTE_3 := l_service_request_rec.REQUEST_ATTRIBUTE_3;
12394 END IF;
12395
12396 IF (l_service_request_rec.REQUEST_ATTRIBUTE_4 <> FND_API.G_MISS_CHAR) AND
12397 (l_service_request_rec.REQUEST_ATTRIBUTE_4 IS NOT NULL) THEN
12398 x_audit_vals_rec.INCIDENT_ATTRIBUTE_4 := l_service_request_rec.REQUEST_ATTRIBUTE_4;
12399 END IF;
12400
12401 IF (l_service_request_rec.REQUEST_ATTRIBUTE_5 <> FND_API.G_MISS_CHAR) AND
12402 (l_service_request_rec.REQUEST_ATTRIBUTE_5 IS NOT NULL) THEN
12403 x_audit_vals_rec.INCIDENT_ATTRIBUTE_5 := l_service_request_rec.REQUEST_ATTRIBUTE_5;
12404 END IF;
12405
12406 IF (l_service_request_rec.REQUEST_ATTRIBUTE_6 <> FND_API.G_MISS_CHAR) AND
12407 (l_service_request_rec.REQUEST_ATTRIBUTE_6 IS NOT NULL) THEN
12408 x_audit_vals_rec.INCIDENT_ATTRIBUTE_6 := l_service_request_rec.REQUEST_ATTRIBUTE_6;
12409 END IF;
12410
12411 IF (l_service_request_rec.REQUEST_ATTRIBUTE_7 <> FND_API.G_MISS_CHAR) AND
12412 (l_service_request_rec.REQUEST_ATTRIBUTE_7 IS NOT NULL) THEN
12413 x_audit_vals_rec.INCIDENT_ATTRIBUTE_7 := l_service_request_rec.REQUEST_ATTRIBUTE_7;
12414 END IF;
12415
12416 IF (l_service_request_rec.REQUEST_ATTRIBUTE_8 <> FND_API.G_MISS_CHAR) AND
12417 (l_service_request_rec.REQUEST_ATTRIBUTE_8 IS NOT NULL) THEN
12418 x_audit_vals_rec.INCIDENT_ATTRIBUTE_8 := l_service_request_rec.REQUEST_ATTRIBUTE_8;
12419 END IF;
12420
12421 IF (l_service_request_rec.REQUEST_ATTRIBUTE_9 <> FND_API.G_MISS_CHAR) AND
12422 (l_service_request_rec.REQUEST_ATTRIBUTE_9 IS NOT NULL) THEN
12423 x_audit_vals_rec.INCIDENT_ATTRIBUTE_9 := l_service_request_rec.REQUEST_ATTRIBUTE_9;
12424 END IF;
12425
12426 IF (l_service_request_rec.REQUEST_ATTRIBUTE_10 <> FND_API.G_MISS_CHAR) AND
12427 (l_service_request_rec.REQUEST_ATTRIBUTE_10 IS NOT NULL) THEN
12428 x_audit_vals_rec.INCIDENT_ATTRIBUTE_10 := l_service_request_rec.REQUEST_ATTRIBUTE_10;
12429 END IF;
12430
12431 IF (l_service_request_rec.REQUEST_ATTRIBUTE_11 <> FND_API.G_MISS_CHAR) AND
12432 (l_service_request_rec.REQUEST_ATTRIBUTE_11 IS NOT NULL) THEN
12433 x_audit_vals_rec.INCIDENT_ATTRIBUTE_11 := l_service_request_rec.REQUEST_ATTRIBUTE_11;
12434 END IF;
12435
12436 IF (l_service_request_rec.REQUEST_ATTRIBUTE_12 <> FND_API.G_MISS_CHAR) AND
12437 (l_service_request_rec.REQUEST_ATTRIBUTE_12 IS NOT NULL) THEN
12438 x_audit_vals_rec.INCIDENT_ATTRIBUTE_12 := l_service_request_rec.REQUEST_ATTRIBUTE_12;
12439 END IF;
12440
12441 IF (l_service_request_rec.REQUEST_ATTRIBUTE_13 <> FND_API.G_MISS_CHAR) AND
12442 (l_service_request_rec.REQUEST_ATTRIBUTE_13 IS NOT NULL) THEN
12443 x_audit_vals_rec.INCIDENT_ATTRIBUTE_13 := l_service_request_rec.REQUEST_ATTRIBUTE_13;
12444 END IF;
12445
12446 IF (l_service_request_rec.REQUEST_ATTRIBUTE_14 <> FND_API.G_MISS_CHAR) AND
12447 (l_service_request_rec.REQUEST_ATTRIBUTE_14 IS NOT NULL) THEN
12448 x_audit_vals_rec.INCIDENT_ATTRIBUTE_14 := l_service_request_rec.REQUEST_ATTRIBUTE_14;
12449 END IF;
12450
12451 IF (l_service_request_rec.REQUEST_ATTRIBUTE_15 <> FND_API.G_MISS_CHAR) AND
12452 (l_service_request_rec.REQUEST_ATTRIBUTE_15 IS NOT NULL) THEN
12453 x_audit_vals_rec.INCIDENT_ATTRIBUTE_15 := l_service_request_rec.REQUEST_ATTRIBUTE_15;
12454 END IF;
12455
12456 IF (l_service_request_rec.REQUEST_CONTEXT <> FND_API.G_MISS_CHAR) AND
12457 (l_service_request_rec.REQUEST_CONTEXT IS NOT NULL) THEN
12458 x_audit_vals_rec.INCIDENT_CONTEXT := l_service_request_rec.REQUEST_CONTEXT;
12459 END IF;
12460
12461 IF (l_service_request_rec.RESOLUTION_CODE <> FND_API.G_MISS_CHAR) AND
12462 (l_service_request_rec.RESOLUTION_CODE IS NOT NULL) THEN
12463 x_audit_vals_rec.RESOLUTION_CODE := l_service_request_rec.RESOLUTION_CODE;
12464 END IF;
12465
12466 IF (l_service_request_rec.ORIGINAL_ORDER_NUMBER <> FND_API.G_MISS_NUM) AND
12467 (l_service_request_rec.ORIGINAL_ORDER_NUMBER IS NOT NULL) THEN
12468 x_audit_vals_rec.ORIGINAL_ORDER_NUMBER := l_service_request_rec.ORIGINAL_ORDER_NUMBER;
12469 END IF;
12470
12471 /* Could not populate this column as no equivalent column was found in l_service_request_rec */
12472 /*
12473 IF (l_service_request_rec.ORIGINAL_ORDER_NUMBER <> FND_API.G_MISS_NUM) AND
12474 (l_service_request_rec.ORIGINAL_ORDER_NUMBER IS NOT NULL) THEN
12475 x_audit_vals_rec.ORG_ID := l_service_request_rec.ORIGINAL_ORDER_NUMBER;
12476 END IF;
12477 */
12478
12479 IF (l_service_request_rec.PURCHASE_ORDER_NUM <> FND_API.G_MISS_CHAR) AND
12480 (l_service_request_rec.PURCHASE_ORDER_NUM IS NOT NULL) THEN
12481 x_audit_vals_rec.PURCHASE_ORDER_NUMBER := l_service_request_rec.PURCHASE_ORDER_NUM;
12482 END IF;
12483
12484 IF (l_service_request_rec.PUBLISH_FLAG <> FND_API.G_MISS_CHAR) AND
12485 (l_service_request_rec.PUBLISH_FLAG IS NOT NULL) THEN
12486 x_audit_vals_rec.PUBLISH_FLAG := l_service_request_rec.PUBLISH_FLAG;
12487 END IF;
12488
12489 IF (l_service_request_rec.QA_COLLECTION_PLAN_ID <> FND_API.G_MISS_NUM) AND
12490 (l_service_request_rec.QA_COLLECTION_PLAN_ID IS NOT NULL) THEN
12491 x_audit_vals_rec.QA_COLLECTION_ID := l_service_request_rec.QA_COLLECTION_PLAN_ID;
12492 END IF;
12493
12494 IF (l_service_request_rec.CONTRACT_ID <> FND_API.G_MISS_NUM) AND
12495 (l_service_request_rec.CONTRACT_ID IS NOT NULL) THEN
12496 x_audit_vals_rec.CONTRACT_ID := l_service_request_rec.CONTRACT_ID;
12497 END IF;
12498
12499 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
12500 /*
12501 IF (l_service_request_rec.CONTRACT_ID <> FND_API.G_MISS_CHAR) AND
12502 (l_service_request_rec.CONTRACT_ID IS NOT NULL) THEN
12503 x_audit_vals_rec.CONTRACT_NUMBER := l_service_request_rec.CONTRACT_ID;
12504 END IF;
12505 */
12506
12507 IF (l_service_request_rec.CONTRACT_SERVICE_ID <> FND_API.G_MISS_NUM) AND
12508 (l_service_request_rec.CONTRACT_SERVICE_ID IS NOT NULL) THEN
12509 x_audit_vals_rec.CONTRACT_SERVICE_ID := l_service_request_rec.CONTRACT_SERVICE_ID;
12510 END IF;
12511
12512 IF (l_service_request_rec.TIME_ZONE_ID <> FND_API.G_MISS_NUM) AND
12513 (l_service_request_rec.TIME_ZONE_ID IS NOT NULL) THEN
12514 x_audit_vals_rec.TIME_ZONE_ID := l_service_request_rec.TIME_ZONE_ID;
12515 END IF;
12516
12517 IF (l_service_request_rec.ACCOUNT_ID <> FND_API.G_MISS_NUM) AND
12518 (l_service_request_rec.ACCOUNT_ID IS NOT NULL) THEN
12519 x_audit_vals_rec.ACCOUNT_ID := l_service_request_rec.ACCOUNT_ID;
12520 END IF;
12521
12522 IF (l_service_request_rec.TIME_DIFFERENCE <> FND_API.G_MISS_NUM) AND
12523 (l_service_request_rec.TIME_DIFFERENCE IS NOT NULL) THEN
12524 x_audit_vals_rec.TIME_DIFFERENCE := l_service_request_rec.TIME_DIFFERENCE;
12525 END IF;
12526
12527 IF (l_service_request_rec.CUST_PO_NUMBER <> FND_API.G_MISS_CHAR) AND
12528 (l_service_request_rec.CUST_PO_NUMBER IS NOT NULL) THEN
12529 x_audit_vals_rec.CUSTOMER_PO_NUMBER := l_service_request_rec.CUST_PO_NUMBER;
12530 END IF;
12531
12532 IF (l_service_request_rec.CUST_TICKET_NUMBER <> FND_API.G_MISS_CHAR) AND
12533 (l_service_request_rec.CUST_TICKET_NUMBER IS NOT NULL) THEN
12534 x_audit_vals_rec.CUSTOMER_TICKET_NUMBER := l_service_request_rec.CUST_TICKET_NUMBER;
12535 END IF;
12536
12537 IF (l_service_request_rec.CUSTOMER_SITE_ID <> FND_API.G_MISS_NUM) AND
12538 (l_service_request_rec.CUSTOMER_SITE_ID IS NOT NULL) THEN
12539 x_audit_vals_rec.CUSTOMER_SITE_ID := l_service_request_rec.CUSTOMER_SITE_ID;
12540 END IF;
12541
12542 IF (l_service_request_rec.CALLER_TYPE <> FND_API.G_MISS_CHAR) AND
12543 (l_service_request_rec.CALLER_TYPE IS NOT NULL) THEN
12544 x_audit_vals_rec.CALLER_TYPE := l_service_request_rec.CALLER_TYPE;
12545 END IF;
12546
12547 IF (l_service_request_rec.PROJECT_NUMBER <> FND_API.G_MISS_CHAR) AND
12548 (l_service_request_rec.PROJECT_NUMBER IS NOT NULL) THEN
12549 x_audit_vals_rec.PROJECT_NUMBER := l_service_request_rec.PROJECT_NUMBER;
12550 END IF;
12551
12552 IF (l_service_request_rec.PLATFORM_VERSION <> FND_API.G_MISS_CHAR) AND
12553 (l_service_request_rec.PLATFORM_VERSION IS NOT NULL) THEN
12554 x_audit_vals_rec.PLATFORM_VERSION := l_service_request_rec.PLATFORM_VERSION;
12555 END IF;
12556
12557 IF (l_service_request_rec.DB_VERSION <> FND_API.G_MISS_CHAR) AND
12558 (l_service_request_rec.DB_VERSION IS NOT NULL) THEN
12559 x_audit_vals_rec.DB_VERSION := l_service_request_rec.DB_VERSION;
12560 END IF;
12561
12562 IF (l_service_request_rec.DB_VERSION <> FND_API.G_MISS_CHAR) AND
12563 (l_service_request_rec.DB_VERSION IS NOT NULL) THEN
12564 x_audit_vals_rec.DB_VERSION := l_service_request_rec.DB_VERSION;
12565 END IF;
12566
12567 IF (l_service_request_rec.CUST_PREF_LANG_ID <> FND_API.G_MISS_NUM) AND
12568 (l_service_request_rec.CUST_PREF_LANG_ID IS NOT NULL) THEN
12569 x_audit_vals_rec.CUST_PREF_LANG_ID := l_service_request_rec.CUST_PREF_LANG_ID;
12570 END IF;
12571
12572 IF (l_service_request_rec.TIER <> FND_API.G_MISS_CHAR) AND
12573 (l_service_request_rec.TIER IS NOT NULL) THEN
12574 x_audit_vals_rec.TIER := l_service_request_rec.TIER;
12575 END IF;
12576
12577 IF (l_service_request_rec.CATEGORY_ID <> FND_API.G_MISS_NUM) AND
12578 (l_service_request_rec.CATEGORY_ID IS NOT NULL) THEN
12579 x_audit_vals_rec.CATEGORY_ID := l_service_request_rec.CATEGORY_ID;
12580 END IF;
12581
12582 IF (l_service_request_rec.OPERATING_SYSTEM <> FND_API.G_MISS_CHAR) AND
12583 (l_service_request_rec.OPERATING_SYSTEM IS NOT NULL) THEN
12584 x_audit_vals_rec.OPERATING_SYSTEM := l_service_request_rec.OPERATING_SYSTEM;
12585 END IF;
12586
12587 IF (l_service_request_rec.OPERATING_SYSTEM_VERSION <> FND_API.G_MISS_CHAR) AND
12588 (l_service_request_rec.OPERATING_SYSTEM_VERSION IS NOT NULL) THEN
12589 x_audit_vals_rec.OPERATING_SYSTEM_VERSION := l_service_request_rec.OPERATING_SYSTEM_VERSION;
12590 END IF;
12591
12592 IF (l_service_request_rec.DATABASE <> FND_API.G_MISS_CHAR) AND
12593 (l_service_request_rec.DATABASE IS NOT NULL) THEN
12594 x_audit_vals_rec.DATABASE := l_service_request_rec.DATABASE;
12595 END IF;
12596
12597 IF (l_service_request_rec.GROUP_TERRITORY_ID <> FND_API.G_MISS_NUM) AND
12598 (l_service_request_rec.GROUP_TERRITORY_ID IS NOT NULL) THEN
12599 x_audit_vals_rec.GROUP_TERRITORY_ID := l_service_request_rec.GROUP_TERRITORY_ID;
12600 END IF;
12601
12602 IF (l_service_request_rec.COMM_PREF_CODE <> FND_API.G_MISS_CHAR) AND
12603 (l_service_request_rec.COMM_PREF_CODE IS NOT NULL) THEN
12604 x_audit_vals_rec.COMM_PREF_CODE := l_service_request_rec.COMM_PREF_CODE;
12605 END IF;
12606
12607 IF (l_service_request_rec.LAST_UPDATE_CHANNEL <> FND_API.G_MISS_CHAR) AND
12608 (l_service_request_rec.LAST_UPDATE_CHANNEL IS NOT NULL) THEN
12609 x_audit_vals_rec.LAST_UPDATE_CHANNEL := l_service_request_rec.LAST_UPDATE_CHANNEL;
12610 END IF;
12611
12612 IF (l_service_request_rec.CUST_PREF_LANG_CODE <> FND_API.G_MISS_CHAR) AND
12613 (l_service_request_rec.CUST_PREF_LANG_CODE IS NOT NULL) THEN
12614 x_audit_vals_rec.CUST_PREF_LANG_CODE := l_service_request_rec.CUST_PREF_LANG_CODE;
12615 END IF;
12616
12617 IF (l_service_request_rec.ERROR_CODE <> FND_API.G_MISS_CHAR) AND
12618 (l_service_request_rec.ERROR_CODE IS NOT NULL) THEN
12619 x_audit_vals_rec.ERROR_CODE := l_service_request_rec.ERROR_CODE;
12620 END IF;
12621
12622 IF (l_service_request_rec.CATEGORY_SET_ID <> FND_API.G_MISS_NUM) AND
12623 (l_service_request_rec.CATEGORY_SET_ID IS NOT NULL) THEN
12624 x_audit_vals_rec.CATEGORY_SET_ID := l_service_request_rec.CATEGORY_SET_ID;
12625 END IF;
12626
12627 IF (l_service_request_rec.EXTERNAL_REFERENCE <> FND_API.G_MISS_CHAR) AND
12628 (l_service_request_rec.EXTERNAL_REFERENCE IS NOT NULL) THEN
12629 x_audit_vals_rec.EXTERNAL_REFERENCE := l_service_request_rec.EXTERNAL_REFERENCE;
12630 END IF;
12631
12632 IF (l_service_request_rec.INCIDENT_OCCURRED_DATE <> FND_API.G_MISS_DATE) AND
12633 (l_service_request_rec.INCIDENT_OCCURRED_DATE IS NOT NULL) THEN
12634 x_audit_vals_rec.INCIDENT_OCCURRED_DATE := l_service_request_rec.INCIDENT_OCCURRED_DATE;
12635 END IF;
12636
12637 IF (l_service_request_rec.INCIDENT_RESOLVED_DATE <> FND_API.G_MISS_DATE) AND
12638 (l_service_request_rec.INCIDENT_RESOLVED_DATE IS NOT NULL) THEN
12639 x_audit_vals_rec.INCIDENT_RESOLVED_DATE := l_service_request_rec.INCIDENT_RESOLVED_DATE;
12640 END IF;
12641
12642 IF (l_service_request_rec.INC_RESPONDED_BY_DATE <> FND_API.G_MISS_DATE) AND
12643 (l_service_request_rec.INC_RESPONDED_BY_DATE IS NOT NULL) THEN
12644 x_audit_vals_rec.INC_RESPONDED_BY_DATE := l_service_request_rec.INC_RESPONDED_BY_DATE;
12645 END IF;
12646
12647 /* 12/13/05 smisra
12648 moved to create_servicerequest just before call to create audit
12649 IF (l_service_request_rec.INCIDENT_LOCATION_ID <> FND_API.G_MISS_NUM) AND
12650 (l_service_request_rec.INCIDENT_LOCATION_ID IS NOT NULL) THEN
12651 x_audit_vals_rec.INCIDENT_LOCATION_ID := l_service_request_rec.INCIDENT_LOCATION_ID;
12652 END IF;
12653 ****/
12654
12655 IF (l_service_request_rec.INCIDENT_ADDRESS <> FND_API.G_MISS_CHAR) AND
12656 (l_service_request_rec.INCIDENT_ADDRESS IS NOT NULL) THEN
12657 x_audit_vals_rec.INCIDENT_ADDRESS := l_service_request_rec.INCIDENT_ADDRESS;
12658 END IF;
12659
12660 IF (l_service_request_rec.INCIDENT_CITY <> FND_API.G_MISS_CHAR) AND
12661 (l_service_request_rec.INCIDENT_CITY IS NOT NULL) THEN
12662 x_audit_vals_rec.INCIDENT_CITY := l_service_request_rec.INCIDENT_CITY;
12663 END IF;
12664
12665 IF (l_service_request_rec.INCIDENT_STATE <> FND_API.G_MISS_CHAR) AND
12666 (l_service_request_rec.INCIDENT_STATE IS NOT NULL) THEN
12667 x_audit_vals_rec.INCIDENT_STATE := l_service_request_rec.INCIDENT_STATE;
12668 END IF;
12669
12670 /* 12/13/05 smisra
12671 moved to create_servicerequest just before call to create audit
12672 IF (l_service_request_rec.INCIDENT_COUNTRY <> FND_API.G_MISS_CHAR) AND
12673 (l_service_request_rec.INCIDENT_COUNTRY IS NOT NULL) THEN
12674 x_audit_vals_rec.INCIDENT_COUNTRY := l_service_request_rec.INCIDENT_COUNTRY;
12675 END IF;
12676 ***/
12677
12678 IF (l_service_request_rec.INCIDENT_PROVINCE <> FND_API.G_MISS_CHAR) AND
12679 (l_service_request_rec.INCIDENT_PROVINCE IS NOT NULL) THEN
12680 x_audit_vals_rec.INCIDENT_PROVINCE := l_service_request_rec.INCIDENT_PROVINCE;
12681 END IF;
12682
12683 IF (l_service_request_rec.INCIDENT_POSTAL_CODE <> FND_API.G_MISS_CHAR) AND
12684 (l_service_request_rec.INCIDENT_POSTAL_CODE IS NOT NULL) THEN
12685 x_audit_vals_rec.INCIDENT_POSTAL_CODE := l_service_request_rec.INCIDENT_POSTAL_CODE;
12686 END IF;
12687
12688 IF (l_service_request_rec.INCIDENT_COUNTY <> FND_API.G_MISS_CHAR) AND
12689 (l_service_request_rec.INCIDENT_COUNTY IS NOT NULL) THEN
12690 x_audit_vals_rec.INCIDENT_COUNTY := l_service_request_rec.INCIDENT_COUNTY;
12691 END IF;
12692
12693 IF (l_service_request_rec.SR_CREATION_CHANNEL <> FND_API.G_MISS_CHAR) AND
12694 (l_service_request_rec.SR_CREATION_CHANNEL IS NOT NULL) THEN
12695 x_audit_vals_rec.SR_CREATION_CHANNEL := l_service_request_rec.SR_CREATION_CHANNEL;
12696 END IF;
12697
12698 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
12699 /*
12700 IF (l_service_request_rec. <> FND_API.G_MISS_NUM) AND
12701 (l_service_request_rec. IS NOT NULL) THEN
12702 x_audit_vals_rec.DEF_DEFECT_ID := l_service_request_rec.;
12703 END IF;
12704 */
12705
12706 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
12707 /*
12708 IF (l_service_request_rec. <> FND_API.G_MISS_NUM) AND
12709 (l_service_request_rec. IS NOT NULL) THEN
12710 x_audit_vals_rec.DEF_DEFECT_ID2 := l_service_request_rec.;
12711 END IF;
12712 */
12713
12714 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_1 <> FND_API.G_MISS_CHAR) AND
12715 (l_service_request_rec.EXTERNAL_ATTRIBUTE_1 IS NOT NULL) THEN
12716 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_1 := l_service_request_rec.EXTERNAL_ATTRIBUTE_1;
12717 END IF;
12718
12719 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_2 <> FND_API.G_MISS_CHAR) AND
12720 (l_service_request_rec.EXTERNAL_ATTRIBUTE_2 IS NOT NULL) THEN
12721 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_2 := l_service_request_rec.EXTERNAL_ATTRIBUTE_2;
12722 END IF;
12723
12724 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_3 <> FND_API.G_MISS_CHAR) AND
12725 (l_service_request_rec.EXTERNAL_ATTRIBUTE_3 IS NOT NULL) THEN
12726 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_3 := l_service_request_rec.EXTERNAL_ATTRIBUTE_3;
12727 END IF;
12728
12729 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_4 <> FND_API.G_MISS_CHAR) AND
12730 (l_service_request_rec.EXTERNAL_ATTRIBUTE_4 IS NOT NULL) THEN
12731 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_4 := l_service_request_rec.EXTERNAL_ATTRIBUTE_4;
12732 END IF;
12733
12734 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_5 <> FND_API.G_MISS_CHAR) AND
12735 (l_service_request_rec.EXTERNAL_ATTRIBUTE_5 IS NOT NULL) THEN
12736 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_5 := l_service_request_rec.EXTERNAL_ATTRIBUTE_5;
12737 END IF;
12738
12739 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_6 <> FND_API.G_MISS_CHAR) AND
12740 (l_service_request_rec.EXTERNAL_ATTRIBUTE_6 IS NOT NULL) THEN
12741 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_6 := l_service_request_rec.EXTERNAL_ATTRIBUTE_6;
12742 END IF;
12743
12744 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_7 <> FND_API.G_MISS_CHAR) AND
12745 (l_service_request_rec.EXTERNAL_ATTRIBUTE_7 IS NOT NULL) THEN
12746 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_7 := l_service_request_rec.EXTERNAL_ATTRIBUTE_7;
12747 END IF;
12748
12749 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_8 <> FND_API.G_MISS_CHAR) AND
12750 (l_service_request_rec.EXTERNAL_ATTRIBUTE_8 IS NOT NULL) THEN
12751 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_8 := l_service_request_rec.EXTERNAL_ATTRIBUTE_8;
12752 END IF;
12753
12754 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_9 <> FND_API.G_MISS_CHAR) AND
12755 (l_service_request_rec.EXTERNAL_ATTRIBUTE_9 IS NOT NULL) THEN
12756 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_9 := l_service_request_rec.EXTERNAL_ATTRIBUTE_9;
12757 END IF;
12758
12759 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_10 <> FND_API.G_MISS_CHAR) AND
12760 (l_service_request_rec.EXTERNAL_ATTRIBUTE_10 IS NOT NULL) THEN
12761 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_10 := l_service_request_rec.EXTERNAL_ATTRIBUTE_10;
12762 END IF;
12763
12764 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_11 <> FND_API.G_MISS_CHAR) AND
12765 (l_service_request_rec.EXTERNAL_ATTRIBUTE_11 IS NOT NULL) THEN
12766 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_11 := l_service_request_rec.EXTERNAL_ATTRIBUTE_11;
12767 END IF;
12768
12769 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_12 <> FND_API.G_MISS_CHAR) AND
12770 (l_service_request_rec.EXTERNAL_ATTRIBUTE_12 IS NOT NULL) THEN
12771 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_12 := l_service_request_rec.EXTERNAL_ATTRIBUTE_12;
12772 END IF;
12773
12774 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_13 <> FND_API.G_MISS_CHAR) AND
12775 (l_service_request_rec.EXTERNAL_ATTRIBUTE_13 IS NOT NULL) THEN
12776 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_13 := l_service_request_rec.EXTERNAL_ATTRIBUTE_13;
12777 END IF;
12778
12779 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_14 <> FND_API.G_MISS_CHAR) AND
12780 (l_service_request_rec.EXTERNAL_ATTRIBUTE_14 IS NOT NULL) THEN
12781 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_14 := l_service_request_rec.EXTERNAL_ATTRIBUTE_14;
12782 END IF;
12783
12784 IF (l_service_request_rec.EXTERNAL_ATTRIBUTE_15 <> FND_API.G_MISS_CHAR) AND
12785 (l_service_request_rec.EXTERNAL_ATTRIBUTE_15 IS NOT NULL) THEN
12786 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_15 := l_service_request_rec.EXTERNAL_ATTRIBUTE_15;
12787 END IF;
12788
12789 IF (l_service_request_rec.EXTERNAL_CONTEXT <> FND_API.G_MISS_CHAR) AND
12790 (l_service_request_rec.EXTERNAL_CONTEXT IS NOT NULL) THEN
12791 x_audit_vals_rec.EXTERNAL_CONTEXT := l_service_request_rec.EXTERNAL_CONTEXT;
12792 END IF;
12793
12794 IF (l_service_request_rec.LAST_UPDATE_PROGRAM_CODE <> FND_API.G_MISS_CHAR) AND
12795 (l_service_request_rec.LAST_UPDATE_PROGRAM_CODE IS NOT NULL) THEN
12796 x_audit_vals_rec.LAST_UPDATE_PROGRAM_CODE := l_service_request_rec.LAST_UPDATE_PROGRAM_CODE;
12797 END IF;
12798
12799 IF (l_service_request_rec.CREATION_PROGRAM_CODE <> FND_API.G_MISS_CHAR) AND
12800 (l_service_request_rec.CREATION_PROGRAM_CODE IS NOT NULL) THEN
12801 x_audit_vals_rec.CREATION_PROGRAM_CODE := l_service_request_rec.CREATION_PROGRAM_CODE;
12802 END IF;
12803
12804 /****
12805 16th Nov 2005 smisra:
12806 coverage type is determined based on contract service id after
12807 call to create SR Validation.
12808 so moving this code to just before audit creation call
12809 --
12810 IF (l_service_request_rec.COVERAGE_TYPE <> FND_API.G_MISS_CHAR) AND
12811 (l_service_request_rec.COVERAGE_TYPE IS NOT NULL) THEN
12812 x_audit_vals_rec.COVERAGE_TYPE := l_service_request_rec.COVERAGE_TYPE;
12813 END IF;
12814 *******************************************************************************/
12815
12816 IF (l_service_request_rec.BILL_TO_ACCOUNT_ID <> FND_API.G_MISS_NUM) AND
12817 (l_service_request_rec.BILL_TO_ACCOUNT_ID IS NOT NULL) THEN
12818 x_audit_vals_rec.BILL_TO_ACCOUNT_ID := l_service_request_rec.BILL_TO_ACCOUNT_ID;
12819 END IF;
12820
12821 IF (l_service_request_rec.SHIP_TO_ACCOUNT_ID <> FND_API.G_MISS_NUM) AND
12822 (l_service_request_rec.SHIP_TO_ACCOUNT_ID IS NOT NULL) THEN
12823 x_audit_vals_rec.SHIP_TO_ACCOUNT_ID := l_service_request_rec.SHIP_TO_ACCOUNT_ID;
12824 END IF;
12825
12826 IF (l_service_request_rec.CUSTOMER_EMAIL_ID <> FND_API.G_MISS_NUM) AND
12827 (l_service_request_rec.CUSTOMER_EMAIL_ID IS NOT NULL) THEN
12828 x_audit_vals_rec.CUSTOMER_EMAIL_ID := l_service_request_rec.CUSTOMER_EMAIL_ID;
12829 END IF;
12830
12831 IF (l_service_request_rec.CUSTOMER_PHONE_ID <> FND_API.G_MISS_NUM) AND
12832 (l_service_request_rec.CUSTOMER_PHONE_ID IS NOT NULL) THEN
12833 x_audit_vals_rec.CUSTOMER_PHONE_ID := l_service_request_rec.CUSTOMER_PHONE_ID;
12834 END IF;
12835
12836 IF (l_service_request_rec.BILL_TO_PARTY_ID <> FND_API.G_MISS_NUM) AND
12837 (l_service_request_rec.BILL_TO_PARTY_ID IS NOT NULL) THEN
12838 x_audit_vals_rec.BILL_TO_PARTY_ID := l_service_request_rec.BILL_TO_PARTY_ID;
12839 END IF;
12840
12841 IF (l_service_request_rec.SHIP_TO_PARTY_ID <> FND_API.G_MISS_NUM) AND
12842 (l_service_request_rec.SHIP_TO_PARTY_ID IS NOT NULL) THEN
12843 x_audit_vals_rec.SHIP_TO_PARTY_ID := l_service_request_rec.SHIP_TO_PARTY_ID;
12844 END IF;
12845
12846 IF (l_service_request_rec.BILL_TO_SITE_ID <> FND_API.G_MISS_NUM) AND
12847 (l_service_request_rec.BILL_TO_SITE_ID IS NOT NULL) THEN
12848 x_audit_vals_rec.BILL_TO_SITE_ID := l_service_request_rec.BILL_TO_SITE_ID;
12849 END IF;
12850
12851 IF (l_service_request_rec.SHIP_TO_SITE_ID <> FND_API.G_MISS_NUM) AND
12852 (l_service_request_rec.SHIP_TO_SITE_ID IS NOT NULL) THEN
12853 x_audit_vals_rec.SHIP_TO_SITE_ID := l_service_request_rec.SHIP_TO_SITE_ID;
12854 END IF;
12855
12856 IF (l_service_request_rec.PROGRAM_LOGIN_ID <> FND_API.G_MISS_NUM) AND
12857 (l_service_request_rec.PROGRAM_LOGIN_ID IS NOT NULL) THEN
12858 x_audit_vals_rec.PROGRAM_LOGIN_ID := l_service_request_rec.PROGRAM_LOGIN_ID;
12859 END IF;
12860
12861 IF (l_service_request_rec.INCIDENT_POINT_OF_INTEREST <> FND_API.G_MISS_CHAR) AND
12862 (l_service_request_rec.INCIDENT_POINT_OF_INTEREST IS NOT NULL) THEN
12863 x_audit_vals_rec.INCIDENT_POINT_OF_INTEREST := l_service_request_rec.INCIDENT_POINT_OF_INTEREST;
12864 END IF;
12865
12866 IF (l_service_request_rec.INCIDENT_CROSS_STREET <> FND_API.G_MISS_CHAR) AND
12867 (l_service_request_rec.INCIDENT_CROSS_STREET IS NOT NULL) THEN
12868 x_audit_vals_rec.INCIDENT_CROSS_STREET := l_service_request_rec.INCIDENT_CROSS_STREET;
12869 END IF;
12870
12871 IF (l_service_request_rec.incident_direction_qualifier <> FND_API.G_MISS_CHAR) AND
12872 (l_service_request_rec.incident_direction_qualifier IS NOT NULL) THEN
12873 x_audit_vals_rec.INCIDENT_DIRECTION_QUALIF := l_service_request_rec.incident_direction_qualifier;
12874 END IF;
12875
12876 IF (l_service_request_rec.incident_distance_qualifier <> FND_API.G_MISS_CHAR) AND
12877 (l_service_request_rec.incident_distance_qualifier IS NOT NULL) THEN
12878 x_audit_vals_rec.INCIDENT_DISTANCE_QUALIF := l_service_request_rec.incident_distance_qualifier;
12879 END IF;
12880
12881 IF (l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM <> FND_API.G_MISS_CHAR) AND
12882 (l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM IS NOT NULL) THEN
12883 x_audit_vals_rec.INCIDENT_DISTANCE_QUAL_UOM := l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM;
12884 END IF;
12885
12886 IF (l_service_request_rec.INCIDENT_ADDRESS2 <> FND_API.G_MISS_CHAR) AND
12887 (l_service_request_rec.INCIDENT_ADDRESS2 IS NOT NULL) THEN
12888 x_audit_vals_rec.INCIDENT_ADDRESS2 := l_service_request_rec.INCIDENT_ADDRESS2;
12889 END IF;
12890
12891 IF (l_service_request_rec.INCIDENT_ADDRESS3 <> FND_API.G_MISS_CHAR) AND
12892 (l_service_request_rec.INCIDENT_ADDRESS3 IS NOT NULL) THEN
12893 x_audit_vals_rec.INCIDENT_ADDRESS3 := l_service_request_rec.INCIDENT_ADDRESS3;
12894 END IF;
12895
12896 IF (l_service_request_rec.INCIDENT_ADDRESS4 <> FND_API.G_MISS_CHAR) AND
12897 (l_service_request_rec.INCIDENT_ADDRESS4 IS NOT NULL) THEN
12898 x_audit_vals_rec.INCIDENT_ADDRESS4 := l_service_request_rec.INCIDENT_ADDRESS4;
12899 END IF;
12900
12901 IF (l_service_request_rec.INCIDENT_ADDRESS_STYLE <> FND_API.G_MISS_CHAR) AND
12902 (l_service_request_rec.INCIDENT_ADDRESS_STYLE IS NOT NULL) THEN
12903 x_audit_vals_rec.INCIDENT_ADDRESS_STYLE := l_service_request_rec.INCIDENT_ADDRESS_STYLE;
12904 END IF;
12905
12906 IF (l_service_request_rec.incident_addr_lines_phonetic <> FND_API.G_MISS_CHAR) AND
12907 (l_service_request_rec.incident_addr_lines_phonetic IS NOT NULL) THEN
12908 x_audit_vals_rec.INCIDENT_ADDR_LNS_PHONETIC := l_service_request_rec.incident_addr_lines_phonetic;
12909 END IF;
12910
12911 IF (l_service_request_rec.INCIDENT_PO_BOX_NUMBER <> FND_API.G_MISS_CHAR) AND
12912 (l_service_request_rec.INCIDENT_PO_BOX_NUMBER IS NOT NULL) THEN
12913 x_audit_vals_rec.INCIDENT_PO_BOX_NUMBER := l_service_request_rec.INCIDENT_PO_BOX_NUMBER;
12914 END IF;
12915
12916 IF (l_service_request_rec.INCIDENT_HOUSE_NUMBER <> FND_API.G_MISS_CHAR) AND
12917 (l_service_request_rec.INCIDENT_HOUSE_NUMBER IS NOT NULL) THEN
12918 x_audit_vals_rec.INCIDENT_HOUSE_NUMBER := l_service_request_rec.INCIDENT_HOUSE_NUMBER;
12919 END IF;
12920
12921 IF (l_service_request_rec.INCIDENT_STREET_SUFFIX <> FND_API.G_MISS_CHAR) AND
12922 (l_service_request_rec.INCIDENT_STREET_SUFFIX IS NOT NULL) THEN
12923 x_audit_vals_rec.INCIDENT_STREET_SUFFIX := l_service_request_rec.INCIDENT_STREET_SUFFIX;
12924 END IF;
12925
12926 IF (l_service_request_rec.INCIDENT_STREET <> FND_API.G_MISS_CHAR) AND
12927 (l_service_request_rec.INCIDENT_STREET IS NOT NULL) THEN
12928 x_audit_vals_rec.INCIDENT_STREET := l_service_request_rec.INCIDENT_STREET;
12929 END IF;
12930
12931 IF (l_service_request_rec.INCIDENT_STREET_NUMBER <> FND_API.G_MISS_CHAR) AND
12932 (l_service_request_rec.INCIDENT_STREET_NUMBER IS NOT NULL) THEN
12933 x_audit_vals_rec.INCIDENT_STREET_NUMBER := l_service_request_rec.INCIDENT_STREET_NUMBER;
12934 END IF;
12935
12936 IF (l_service_request_rec.INCIDENT_FLOOR <> FND_API.G_MISS_CHAR) AND
12937 (l_service_request_rec.INCIDENT_FLOOR IS NOT NULL) THEN
12938 x_audit_vals_rec.INCIDENT_FLOOR := l_service_request_rec.INCIDENT_FLOOR;
12939 END IF;
12940
12941 IF (l_service_request_rec.INCIDENT_SUITE <> FND_API.G_MISS_CHAR) AND
12942 (l_service_request_rec.INCIDENT_SUITE IS NOT NULL) THEN
12943 x_audit_vals_rec.INCIDENT_SUITE := l_service_request_rec.INCIDENT_SUITE;
12944 END IF;
12945
12946 IF (l_service_request_rec.INCIDENT_POSTAL_PLUS4_CODE <> FND_API.G_MISS_CHAR) AND
12947 (l_service_request_rec.INCIDENT_POSTAL_PLUS4_CODE IS NOT NULL) THEN
12948 x_audit_vals_rec.INCIDENT_POSTAL_PLUS4_CODE := l_service_request_rec.INCIDENT_POSTAL_PLUS4_CODE;
12949 END IF;
12950
12951 IF (l_service_request_rec.INCIDENT_POSITION <> FND_API.G_MISS_CHAR) AND
12952 (l_service_request_rec.INCIDENT_POSITION IS NOT NULL) THEN
12953 x_audit_vals_rec.INCIDENT_POSITION := l_service_request_rec.INCIDENT_POSITION;
12954 END IF;
12955
12956 IF (l_service_request_rec.incident_location_directions <> FND_API.G_MISS_CHAR) AND
12957 (l_service_request_rec.incident_location_directions IS NOT NULL) THEN
12958 x_audit_vals_rec.INCIDENT_LOC_DIRECTIONS := l_service_request_rec.incident_location_directions;
12959 END IF;
12960
12961 IF (l_service_request_rec.incident_location_description <> FND_API.G_MISS_CHAR) AND
12962 (l_service_request_rec.incident_location_description IS NOT NULL) THEN
12963 x_audit_vals_rec.INCIDENT_LOC_DESCRIPTION := l_service_request_rec.incident_location_description;
12964 END IF;
12965
12966 IF (l_service_request_rec.INSTALL_SITE_ID <> FND_API.G_MISS_NUM) AND
12967 (l_service_request_rec.INSTALL_SITE_ID IS NOT NULL) THEN
12968 x_audit_vals_rec.INSTALL_SITE_ID := l_service_request_rec.INSTALL_SITE_ID;
12969 END IF;
12970
12971 IF (l_service_request_rec.TIER_VERSION <> FND_API.G_MISS_CHAR) AND
12972 (l_service_request_rec.TIER_VERSION IS NOT NULL) THEN
12973 x_audit_vals_rec.TIER_VERSION := l_service_request_rec.TIER_VERSION;
12974 END IF;
12975
12976
12977 --anmukher --09/12/03
12978
12979 x_audit_vals_rec.INC_OBJECT_VERSION_NUMBER := 1;
12980
12981 IF (l_service_request_rec.conc_request_id <> FND_API.G_MISS_NUM) AND
12982 (l_service_request_rec.conc_request_id IS NOT NULL) THEN
12983 x_audit_vals_rec.INC_REQUEST_ID := l_service_request_rec.conc_request_id;
12984 END IF;
12985
12986 IF (l_service_request_rec.program_application_id <> FND_API.G_MISS_NUM) AND
12987 (l_service_request_rec.program_application_id IS NOT NULL) THEN
12988 x_audit_vals_rec.INC_PROGRAM_APPLICATION_ID := l_service_request_rec.program_application_id;
12989 END IF;
12990
12991 IF (l_service_request_rec.program_id <> FND_API.G_MISS_NUM) AND
12992 (l_service_request_rec.program_id IS NOT NULL) THEN
12993 x_audit_vals_rec.INC_PROGRAM_ID := l_service_request_rec.program_id;
12994 END IF;
12995
12996 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
12997 /*
12998 IF (l_service_request_rec. <> FND_API.G_MISS_DATE) AND
12999 (l_service_request_rec. IS NOT NULL) THEN
13000 x_audit_vals_rec.INC_PROGRAM_UPDATE_DATE := l_service_request_rec.;
13001 END IF;
13002 */
13003
13004 IF (l_service_request_rec.owning_dept_id <> FND_API.G_MISS_NUM) AND
13005 (l_service_request_rec.owning_dept_id IS NOT NULL) THEN
13006 x_audit_vals_rec.OWNING_DEPARTMENT_ID := l_service_request_rec.owning_dept_id;
13007 END IF;
13008
13009 /* 12/13/05 smisra
13010 moved to create_servicerequest just before call to create audit
13011 IF (l_service_request_rec.incident_location_type <> FND_API.G_MISS_CHAR) AND
13012 (l_service_request_rec.incident_location_type IS NOT NULL) THEN
13013 x_audit_vals_rec.INCIDENT_LOCATION_TYPE := l_service_request_rec.incident_location_type;
13014 END IF;
13015 ******/
13016
13017 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
13018 /*
13019 IF (l_service_request_rec. <> FND_API.G_MISS_CHAR) AND
13020 (l_service_request_rec. IS NOT NULL) THEN
13021 x_audit_vals_rec.UNASSIGNED_INDICATOR := l_service_request_rec.;
13022 END IF;
13023 */
13024
13025
13026 ---- AUDIT
13027
13028 --All the ids should be assigned NULL value before insert into the database
13029 --This has to be done here cause the earlier checks are done only if
13030 --validation level is set.
13031
13032 IF (l_service_request_rec.urgency_id = FND_API.G_MISS_NUM) THEN
13033 l_service_request_rec.urgency_id := NULL;
13034 END IF;
13035
13036 IF (l_service_request_rec.employee_id IS NOT NULL ) THEN
13037 l_service_request_rec.employee_id := NULL;
13038 END IF;
13039
13040 IF (l_service_request_rec.owner_group_id = FND_API.G_MISS_NUM) THEN
13041 l_service_request_rec.owner_group_id := NULL;
13042 END IF;
13043
13044 ---- made null if not passed, since the mandatory check is no longer in use
13045 ---- Enhancements 11.5.6
13046 IF (l_service_request_rec.owner_id = FND_API.G_MISS_NUM) THEN
13047 l_service_request_rec.owner_id := NULL;
13048 END IF;
13049
13050 IF (l_service_request_rec.product_revision = FND_API.G_MISS_CHAR) THEN
13051 l_service_request_rec.product_revision := NULL;
13052 END IF;
13053
13054 IF (l_service_request_rec.component_version = FND_API.G_MISS_CHAR) THEN
13055 l_service_request_rec.component_version := NULL;
13056 END IF;
13057
13058 IF (l_service_request_rec.subcomponent_version = FND_API.G_MISS_CHAR) THEN
13059 l_service_request_rec.subcomponent_version := NULL;
13060 END IF;
13061 -----------
13062 IF (l_service_request_rec.platform_id = FND_API.G_MISS_NUM) THEN
13063 l_service_request_rec.platform_id := NULL;
13064 END IF;
13065
13066 IF (l_service_request_rec.platform_version = FND_API.G_MISS_CHAR) THEN
13067 l_service_request_rec.platform_version := NULL;
13068 END IF;
13069
13070 IF (l_service_request_rec.platform_version_id = FND_API.G_MISS_NUM) THEN
13071 l_service_request_rec.platform_version_id := NULL;
13072 END IF;
13073
13074 IF (l_service_request_rec.inv_platform_org_id = FND_API.G_MISS_NUM) THEN
13075 l_service_request_rec.inv_platform_org_id := NULL;
13076 END IF;
13077
13078 IF (l_service_request_rec.db_version = FND_API.G_MISS_CHAR) THEN
13079 l_service_request_rec.db_version := NULL;
13080 END IF;
13081
13082 IF (l_service_request_rec.customer_product_id = FND_API.G_MISS_NUM) THEN
13083 l_service_request_rec.customer_product_id := NULL;
13084 END IF;
13085
13086 IF (l_service_request_rec.cp_component_id = FND_API.G_MISS_NUM) THEN
13087 l_service_request_rec.cp_component_id := NULL;
13088 END IF;
13089
13090 IF (l_service_request_rec.cp_component_version_id = FND_API.G_MISS_NUM) THEN
13091 l_service_request_rec.cp_component_version_id := NULL;
13092 END IF;
13093
13094 IF (l_service_request_rec.cp_subcomponent_id = FND_API.G_MISS_NUM) THEN
13095 l_service_request_rec.cp_subcomponent_id := NULL;
13096 END IF;
13097
13098 IF (l_service_request_rec.cp_subcomponent_version_id = FND_API.G_MISS_NUM) THEN
13099 l_service_request_rec.cp_subcomponent_version_id := NULL;
13100 END IF;
13101
13102 IF (l_service_request_rec.cp_revision_id = FND_API.G_MISS_NUM) THEN
13103 l_service_request_rec.cp_revision_id := NULL;
13104 END IF;
13105
13106 IF (l_service_request_rec.inv_item_revision = FND_API.G_MISS_CHAR) THEN
13107 l_service_request_rec.inv_item_revision := NULL;
13108 END IF;
13109
13110 IF (l_service_request_rec.inv_component_id = FND_API.G_MISS_NUM) THEN
13111 l_service_request_rec.inv_component_id := NULL;
13112 END IF;
13113
13114 IF (l_service_request_rec.inv_component_version = FND_API.G_MISS_CHAR) THEN
13115 l_service_request_rec.inv_component_version := NULL;
13116 END IF;
13117
13118 IF (l_service_request_rec.inv_subcomponent_id = FND_API.G_MISS_NUM) THEN
13119 l_service_request_rec.inv_subcomponent_id := NULL;
13120 END IF;
13121
13122 IF (l_service_request_rec.inv_subcomponent_version = FND_API.G_MISS_CHAR) THEN
13123 l_service_request_rec.inv_subcomponent_version := NULL;
13124 END IF;
13125
13126
13127 IF (l_service_request_rec.inventory_item_id = FND_API.G_MISS_NUM) THEN
13128 l_service_request_rec.inventory_item_id := NULL;
13129 END IF;
13130
13131 IF (l_service_request_rec.inventory_org_id = FND_API.G_MISS_NUM) THEN
13132 l_service_request_rec.inventory_org_id := NULL;
13133 END IF;
13134
13135 IF (l_service_request_rec.current_serial_number = FND_API.G_MISS_CHAR) THEN
13136 l_service_request_rec.current_serial_number := NULL;
13137 END IF;
13138
13139 IF (l_service_request_rec.original_order_number = FND_API.G_MISS_NUM) THEN
13140 l_service_request_rec.original_order_number := NULL;
13141 END IF;
13142
13143
13144 IF (l_service_request_rec.purchase_order_num = FND_API.G_MISS_CHAR) THEN
13145 l_service_request_rec.purchase_order_num := NULL;
13146 END IF;
13147
13148 IF (l_service_request_rec.problem_code = FND_API.G_MISS_CHAR) THEN
13149 l_service_request_rec.problem_code := NULL;
13150 END IF;
13151
13152 -----------Added for enhancement 11.5.6 -----jngeorge-----07/20/01
13153 ----cust_pref_lang_id is customer preferred language
13154 ----tier and tier_versions
13155 ----operating_system and operating_system_version
13156 ----database
13157 ----category_id
13158 ----inv_platform_org_id
13159 ----comm_pref_code
13160
13161 IF (l_service_request_rec.cust_pref_lang_id = FND_API.G_MISS_NUM) THEN
13162 l_service_request_rec.cust_pref_lang_id := NULL;
13163 END IF;
13164
13165 IF (l_service_request_rec.last_update_channel = FND_API.G_MISS_CHAR) THEN
13166 l_service_request_rec.last_update_channel := NULL;
13167 END IF;
13168
13169 IF (l_service_request_rec.cust_pref_lang_code = FND_API.G_MISS_CHAR) THEN
13170 l_service_request_rec.cust_pref_lang_code := NULL;
13171 END IF;
13172
13173 IF (l_service_request_rec.comm_pref_code = FND_API.G_MISS_CHAR) THEN
13174 l_service_request_rec.comm_pref_code := NULL;
13175 END IF;
13176
13177 IF (l_service_request_rec.tier = FND_API.G_MISS_CHAR) THEN
13178 l_service_request_rec.tier := NULL;
13179 END IF;
13180
13181 IF (l_service_request_rec.tier_version = FND_API.G_MISS_CHAR) THEN
13182 l_service_request_rec.tier_version := NULL;
13183 END IF;
13184
13185 IF (l_service_request_rec.operating_system = FND_API.G_MISS_CHAR) THEN
13186 l_service_request_rec.operating_system := NULL;
13187 END IF;
13188
13189 IF (l_service_request_rec.operating_system_version = FND_API.G_MISS_CHAR) THEN
13190 l_service_request_rec.operating_system_version := NULL;
13191 END IF;
13192
13193 IF (l_service_request_rec.DATABASE = FND_API.G_MISS_CHAR) THEN
13194 l_service_request_rec.DATABASE := NULL;
13195 END IF;
13196
13197 IF (l_service_request_rec.category_id = FND_API.G_MISS_NUM) THEN
13198 l_service_request_rec.category_id := NULL;
13199 END IF;
13200
13201 IF (l_service_request_rec.category_set_id = FND_API.G_MISS_NUM) THEN
13202 l_service_request_rec.category_set_id := NULL;
13203 END IF;
13204
13205 IF (l_service_request_rec.external_reference = FND_API.G_MISS_CHAR) THEN
13206 l_service_request_rec.external_reference := NULL;
13207 END IF;
13208
13209 IF (l_service_request_rec.system_id = FND_API.G_MISS_NUM) THEN
13210 l_service_request_rec.system_id := NULL;
13211 END IF;
13212
13213 IF (l_service_request_rec.group_type = FND_API.G_MISS_CHAR) THEN
13214 l_service_request_rec.group_type := NULL;
13215 END IF;
13216
13217 IF (l_service_request_rec.group_territory_id = FND_API.G_MISS_NUM) THEN
13218 l_service_request_rec.group_territory_id := NULL;
13219 END IF;
13220
13221 IF (l_service_request_rec.inv_platform_org_id = FND_API.G_MISS_NUM) THEN
13222 l_service_request_rec.inv_platform_org_id := NULL;
13223 END IF;
13224
13225 --------------------------
13226
13227 IF (l_service_request_rec.exp_resolution_date = FND_API.G_MISS_DATE) THEN
13228 l_service_request_rec.exp_resolution_date := NULL;
13229 END IF;
13230
13231 IF (l_service_request_rec.resolution_code = FND_API.G_MISS_CHAR) THEN
13232 l_service_request_rec.resolution_code := NULL;
13233 END IF;
13234
13235 IF (l_service_request_rec.act_resolution_date = FND_API.G_MISS_DATE) THEN
13236 l_service_request_rec.act_resolution_date := NULL;
13237 END IF;
13238
13239 IF (l_service_request_rec.contract_service_id = FND_API.G_MISS_NUM) THEN
13240 l_service_request_rec.contract_service_id := NULL;
13241 END IF;
13242
13243 IF (l_service_request_rec.contract_id = FND_API.G_MISS_NUM) THEN
13244 l_service_request_rec.contract_id := NULL;
13245 END IF;
13246
13247 IF (l_service_request_rec.project_number = FND_API.G_MISS_CHAR) THEN
13248 l_service_request_rec.project_number := NULL;
13249 END IF;
13250
13251 IF (l_service_request_rec.qa_collection_plan_id = FND_API.G_MISS_NUM) THEN
13252 l_service_request_rec.qa_collection_plan_id := NULL;
13253 END IF;
13254
13255 IF (l_service_request_rec.account_id = FND_API.G_MISS_NUM) THEN
13256 l_service_request_rec.account_id := NULL;
13257 END IF;
13258
13259 IF (l_service_request_rec.resource_subtype_id = FND_API.G_MISS_NUM) THEN
13260 l_service_request_rec.resource_subtype_id := NULL;
13261 END IF;
13262
13263 IF (l_service_request_rec.cust_po_number = FND_API.G_MISS_CHAR) THEN
13264 l_service_request_rec.cust_po_number := NULL;
13265 END IF;
13266
13267 IF (l_service_request_rec.cust_ticket_number = FND_API.G_MISS_CHAR) THEN
13268 l_service_request_rec.cust_ticket_number := NULL;
13269 END IF;
13270
13271 IF (l_service_request_rec.sr_creation_channel = FND_API.G_MISS_CHAR) THEN
13272 l_service_request_rec.sr_creation_channel := NULL;
13273 END IF;
13274
13275 IF (l_service_request_rec.obligation_date = FND_API.G_MISS_DATE) THEN
13276 l_service_request_rec.obligation_date := NULL;
13277 END IF;
13278
13279 IF (l_service_request_rec.error_code = FND_API.G_MISS_CHAR) THEN
13280 l_service_request_rec.error_code := NULL;
13281 END IF;
13282
13283 IF (l_service_request_rec.resolution_summary = FND_API.G_MISS_CHAR) THEN
13284 l_service_request_rec.resolution_summary := NULL;
13285 END IF;
13286
13287 IF (l_service_request_rec.incident_address = FND_API.G_MISS_CHAR) THEN
13288 l_service_request_rec.incident_address := NULL;
13289 END IF;
13290
13291 IF (l_service_request_rec.incident_city = FND_API.G_MISS_CHAR) THEN
13292 l_service_request_rec.incident_city := NULL;
13293 END IF;
13294
13295 IF (l_service_request_rec.incident_state = FND_API.G_MISS_CHAR) THEN
13296 l_service_request_rec.incident_state := NULL;
13297 END IF;
13298
13299 IF (l_service_request_rec.incident_country = FND_API.G_MISS_CHAR) THEN
13300 l_service_request_rec.incident_country := NULL;
13301 END IF;
13302
13303 IF (l_service_request_rec.incident_province = FND_API.G_MISS_CHAR) THEN
13304 l_service_request_rec.incident_province := NULL;
13305 END IF;
13306
13307 IF (l_service_request_rec.incident_postal_code = FND_API.G_MISS_CHAR) THEN
13308 l_service_request_rec.incident_postal_code := NULL;
13309 END IF;
13310
13311 IF (l_service_request_rec.incident_county = FND_API.G_MISS_CHAR) THEN
13312 l_service_request_rec.incident_county := NULL;
13313 END IF;
13314
13315
13316 -- Added for Enh# 1830701
13317 IF (l_service_request_rec.incident_occurred_date = FND_API.G_MISS_DATE) THEN
13318 l_service_request_rec.incident_occurred_date := NULL;
13319 END IF;
13320
13321 IF (l_service_request_rec.incident_resolved_date = FND_API.G_MISS_DATE) THEN
13322 l_service_request_rec.incident_resolved_date := NULL;
13323 END IF;
13324
13325 IF (l_service_request_rec.inc_responded_by_date = FND_API.G_MISS_DATE) THEN
13326 l_service_request_rec.inc_responded_by_date := NULL;
13327 END IF;
13328
13329 -- Added for Enh# 1830701
13330 IF (l_service_request_rec.incident_location_id = FND_API.G_MISS_NUM) THEN
13331 l_service_request_rec.incident_location_id := NULL;
13332 END IF;
13333
13334 IF (l_service_request_rec.time_zone_id = FND_API.G_MISS_NUM) THEN
13335 l_service_request_rec.time_zone_id := NULL;
13336 END IF;
13337
13338 IF (l_service_request_rec.time_difference = FND_API.G_MISS_NUM) THEN
13339 l_service_request_rec.time_difference := NULL;
13340 END IF;
13341
13342 IF (l_service_request_rec.site_id = FND_API.G_MISS_NUM) THEN
13343 l_service_request_rec.site_id := NULL;
13344 END IF;
13345
13346 IF (l_service_request_rec.customer_site_id = FND_API.G_MISS_NUM) THEN
13347 l_service_request_rec.customer_site_id := NULL;
13348 END IF;
13349
13350 IF (l_service_request_rec.territory_id = FND_API.G_MISS_NUM) THEN
13351 l_service_request_rec.territory_id := NULL;
13352 END IF;
13353
13354 IF (l_service_request_rec.publish_flag = FND_API.G_MISS_CHAR) THEN
13355 l_service_request_rec.publish_flag := NULL;
13356 END IF;
13357
13358 IF (l_service_request_rec.verify_cp_flag = FND_API.G_MISS_CHAR) THEN
13359 l_service_request_rec.verify_cp_flag := NULL;
13360 END IF;
13361
13362 IF (l_service_request_rec.customer_id = FND_API.G_MISS_NUM ) THEN
13363 l_service_request_rec.customer_id := NULL;
13364 END IF;
13365
13366 IF (l_service_request_rec.customer_number = FND_API.G_MISS_CHAR ) THEN
13367 l_service_request_rec.customer_number := NULL;
13368 END IF;
13369
13370 IF (l_service_request_rec.bill_to_site_id = FND_API.G_MISS_NUM ) THEN
13371 l_service_request_rec.bill_to_site_id := NULL;
13372 END IF;
13373
13374 IF (l_service_request_rec.bill_to_site_use_id = FND_API.G_MISS_NUM ) THEN
13375 l_service_request_rec.bill_to_site_use_id := NULL;
13376 END IF;
13377
13378 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM ) THEN
13379 l_service_request_rec.bill_to_party_id := NULL;
13380 END IF;
13381
13382 IF (l_service_request_rec.ship_to_site_id = FND_API.G_MISS_NUM ) THEN
13383 l_service_request_rec.ship_to_site_id := NULL;
13384 END IF;
13385
13386 IF (l_service_request_rec.ship_to_site_use_id = FND_API.G_MISS_NUM ) THEN
13387 l_service_request_rec.ship_to_site_use_id := NULL;
13388 END IF;
13389
13390 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM ) THEN
13391 l_service_request_rec.ship_to_party_id := NULL;
13392 END IF;
13393
13394 IF (l_service_request_rec.install_site_id = FND_API.G_MISS_NUM ) THEN
13395 l_service_request_rec.install_site_id := NULL;
13396 END IF;
13397
13398 IF (l_service_request_rec.install_site_use_id = FND_API.G_MISS_NUM ) THEN
13399 l_service_request_rec.install_site_use_id := NULL;
13400 END IF;
13401
13402 /*Added to check if install site is passed then the install site use id should be populated and visa versa*/
13403 IF ( l_service_request_rec.install_site_id IS NULL AND
13404 l_service_request_rec.install_site_use_id IS NOT NULL) THEN
13405 l_service_request_rec.install_site_id := l_service_request_rec.install_site_use_id;
13406 END IF;
13407
13408 IF ( l_service_request_rec.install_site_use_id IS NULL AND
13409 l_service_request_rec.install_site_id IS NOT NULL) THEN
13410 l_service_request_rec.install_site_use_id := l_service_request_rec.install_site_id;
13411 END IF;
13412
13413 IF (l_service_request_rec.bill_to_contact_id = FND_API.G_MISS_NUM ) THEN
13414 l_service_request_rec.bill_to_contact_id := NULL;
13415 END IF;
13416
13417 IF (l_service_request_rec.ship_to_contact_id = FND_API.G_MISS_NUM ) THEN
13418 l_service_request_rec.ship_to_contact_id := NULL;
13419 END IF;
13420
13421 -------Bug Fix #1625002-------jngeorge--------05/29/01
13422 handle_missing_value(l_service_request_rec.request_context ,null);
13423 handle_missing_value(l_service_request_rec.external_context,null);
13424
13425 IF (l_service_request_rec.request_attribute_1 = FND_API.G_MISS_CHAR ) THEN
13426 l_service_request_rec.request_attribute_1 := NULL;
13427 END IF;
13428
13429 IF (l_service_request_rec.request_attribute_2 = FND_API.G_MISS_CHAR ) THEN
13430 l_service_request_rec.request_attribute_2 := NULL;
13431 END IF;
13432
13433 IF (l_service_request_rec.request_attribute_3 = FND_API.G_MISS_CHAR ) THEN
13434 l_service_request_rec.request_attribute_3 := NULL;
13435 END IF;
13436
13437 IF (l_service_request_rec.request_attribute_4 = FND_API.G_MISS_CHAR ) THEN
13438 l_service_request_rec.request_attribute_4 := NULL;
13439 END IF;
13440
13441 IF (l_service_request_rec.request_attribute_5 = FND_API.G_MISS_CHAR ) THEN
13442 l_service_request_rec.request_attribute_5 := NULL;
13443 END IF;
13444
13445 IF (l_service_request_rec.request_attribute_6 = FND_API.G_MISS_CHAR ) THEN
13446 l_service_request_rec.request_attribute_6 := NULL;
13447 END IF;
13448
13449 IF (l_service_request_rec.request_attribute_7 = FND_API.G_MISS_CHAR ) THEN
13450 l_service_request_rec.request_attribute_7 := NULL;
13451 END IF;
13452
13453 IF (l_service_request_rec.request_attribute_8 = FND_API.G_MISS_CHAR ) THEN
13454 l_service_request_rec.request_attribute_8 := NULL;
13455 END IF;
13456
13457 IF (l_service_request_rec.request_attribute_9 = FND_API.G_MISS_CHAR ) THEN
13458 l_service_request_rec.request_attribute_9 := NULL;
13459 END IF;
13460
13461 IF (l_service_request_rec.request_attribute_10 = FND_API.G_MISS_CHAR ) THEN
13462 l_service_request_rec.request_attribute_10 := NULL;
13463 END IF;
13464
13465 IF (l_service_request_rec.request_attribute_11 = FND_API.G_MISS_CHAR ) THEN
13466 l_service_request_rec.request_attribute_11 := NULL;
13467 END IF;
13468
13469 IF (l_service_request_rec.request_attribute_12 = FND_API.G_MISS_CHAR ) THEN
13470 l_service_request_rec.request_attribute_12 := NULL;
13471 END IF;
13472
13473 IF (l_service_request_rec.request_attribute_13 = FND_API.G_MISS_CHAR ) THEN
13474 l_service_request_rec.request_attribute_13 := NULL;
13475 END IF;
13476
13477 IF (l_service_request_rec.request_attribute_14 = FND_API.G_MISS_CHAR ) THEN
13478 l_service_request_rec.request_attribute_14 := NULL;
13479 END IF;
13480
13481 IF (l_service_request_rec.request_attribute_15 = FND_API.G_MISS_CHAR ) THEN
13482 l_service_request_rec.request_attribute_15 := NULL;
13483 END IF;
13484
13485 IF (l_service_request_rec.external_attribute_1 = FND_API.G_MISS_CHAR ) THEN
13486 l_service_request_rec.external_attribute_1 := NULL;
13487 END IF;
13488
13489 IF (l_service_request_rec.external_attribute_2 = FND_API.G_MISS_CHAR ) THEN
13490 l_service_request_rec.external_attribute_2 := NULL;
13491 END IF;
13492
13493 IF (l_service_request_rec.external_attribute_3 = FND_API.G_MISS_CHAR ) THEN
13494 l_service_request_rec.external_attribute_3 := NULL;
13495 END IF;
13496
13497 IF (l_service_request_rec.external_attribute_4 = FND_API.G_MISS_CHAR ) THEN
13498 l_service_request_rec.external_attribute_4 := NULL;
13499 END IF;
13500
13501 IF (l_service_request_rec.external_attribute_5 = FND_API.G_MISS_CHAR ) THEN
13502 l_service_request_rec.external_attribute_5 := NULL;
13503 END IF;
13504
13505 IF (l_service_request_rec.external_attribute_6 = FND_API.G_MISS_CHAR ) THEN
13506 l_service_request_rec.external_attribute_6 := NULL;
13507 END IF;
13508
13509 IF (l_service_request_rec.external_attribute_7 = FND_API.G_MISS_CHAR ) THEN
13510 l_service_request_rec.external_attribute_7 := NULL;
13511 END IF;
13512
13513 IF (l_service_request_rec.external_attribute_8 = FND_API.G_MISS_CHAR ) THEN
13514 l_service_request_rec.external_attribute_8 := NULL;
13515 END IF;
13516
13517 IF (l_service_request_rec.external_attribute_9 = FND_API.G_MISS_CHAR ) THEN
13518 l_service_request_rec.external_attribute_9 := NULL;
13519 END IF;
13520
13521 IF (l_service_request_rec.external_attribute_10 = FND_API.G_MISS_CHAR ) THEN
13522 l_service_request_rec.external_attribute_10 := NULL;
13523 END IF;
13524
13525 IF (l_service_request_rec.external_attribute_11 = FND_API.G_MISS_CHAR ) THEN
13526 l_service_request_rec.external_attribute_11 := NULL;
13527 END IF;
13528
13529 IF (l_service_request_rec.external_attribute_12 = FND_API.G_MISS_CHAR ) THEN
13530 l_service_request_rec.external_attribute_12 := NULL;
13531 END IF;
13532
13533 IF (l_service_request_rec.external_attribute_13 = FND_API.G_MISS_CHAR ) THEN
13534 l_service_request_rec.external_attribute_13 := NULL;
13535 END IF;
13536
13537 IF (l_service_request_rec.external_attribute_14 = FND_API.G_MISS_CHAR ) THEN
13538 l_service_request_rec.external_attribute_14 := NULL;
13539 END IF;
13540
13541 IF (l_service_request_rec.external_attribute_15 = FND_API.G_MISS_CHAR ) THEN
13542 l_service_request_rec.external_attribute_15 := NULL;
13543 END IF;
13544
13545 --- Added for HA, the WHO columns should be derived before inserting
13546 --- if passed null or has G_MISS values.
13547
13548 IF (l_service_request_rec.last_update_date = FND_API.G_MISS_DATE OR
13549 l_service_request_rec.last_update_date IS NULL ) THEN
13550 -- l_service_request_rec.last_update_date := SYSDATE;
13551 l_service_request_rec.last_update_date := l_sysdate;
13552 END IF;
13553
13554 IF (l_service_request_rec.last_updated_by = FND_API.G_MISS_NUM OR
13555 l_service_request_rec.last_updated_by IS NULL ) THEN
13556 l_service_request_rec.last_updated_by := p_user_id;
13557 END IF;
13558
13559 IF (l_service_request_rec.creation_date = FND_API.G_MISS_DATE OR
13560 l_service_request_rec.creation_date IS NULL ) THEN
13561 -- l_service_request_rec.creation_date := SYSDATE;
13562 l_service_request_rec.creation_date := l_sysdate;
13563 END IF;
13564
13565 IF (l_service_request_rec.created_by = FND_API.G_MISS_NUM OR
13566 l_service_request_rec.created_by IS NULL ) THEN
13567 l_service_request_rec.created_by := p_user_id;
13568 END IF;
13569
13570 IF (l_service_request_rec.last_update_login = FND_API.G_MISS_NUM OR
13571 l_service_request_rec.last_update_login IS NULL ) THEN
13572 l_service_request_rec.last_update_login := p_login_id;
13573 END IF;
13574
13575 IF (l_service_request_rec.owner_assigned_time = FND_API.G_MISS_DATE ) THEN
13576 l_service_request_rec.owner_assigned_time := NULL;
13577 END IF;
13578 --------------jngeorge-------05/29/01
13579
13580 -- Added For Coverage_type - ER# 2320056
13581
13582 IF (l_service_request_rec.Coverage_type= FND_API.G_MISS_CHAR ) THEN
13583 l_service_request_rec.Coverage_type := NULL;
13584 END IF;
13585
13586 -- If the contract service id is null then coverage type should be null
13587 -- Added this check for 1159 by shijain dec6th 2002
13588 IF (l_service_request_rec.contract_service_id = FND_API.G_MISS_NUM)
13589 OR (l_service_request_rec.contract_service_id IS NULL) THEN
13590 l_service_request_rec.coverage_type := NULL;
13591 END IF;
13592
13593 -- Added For bill_to_account_id - ER# 2433831
13594
13595 IF (l_service_request_rec.bill_to_account_id = FND_API.G_MISS_NUM ) THEN
13596 l_service_request_rec.bill_to_account_id := NULL;
13597 END IF;
13598
13599 -- Added For ship_to_account_id - ER# 2433831
13600
13601 IF (l_service_request_rec.ship_to_account_id = FND_API.G_MISS_NUM ) THEN
13602 l_service_request_rec.ship_to_account_id := NULL;
13603 END IF;
13604
13605 -- Added For customer_phone_id - ER# 2463321 ---
13606
13607 IF (l_service_request_rec.customer_phone_id = FND_API.G_MISS_NUM ) THEN
13608 l_service_request_rec.customer_phone_id := NULL;
13609 END IF;
13610
13611 -- Added For customer_email_id - ER# 2463321
13612 IF (l_service_request_rec.customer_email_id = FND_API.G_MISS_NUM ) THEN
13613 l_service_request_rec.customer_email_id := NULL;
13614 END IF;
13615
13616 IF (l_service_request_rec.program_id = FND_API.G_MISS_NUM ) THEN
13617 l_service_request_rec.program_id := NULL;
13618 END IF;
13619
13620 IF (l_service_request_rec.program_application_id = FND_API.G_MISS_NUM ) THEN
13621 l_service_request_rec.program_application_id := NULL;
13622 END IF;
13623
13624 IF (l_service_request_rec.conc_request_id = FND_API.G_MISS_NUM ) THEN
13625 l_service_request_rec.conc_request_id := NULL;
13626 END IF;
13627
13628 IF (l_service_request_rec.program_login_id = FND_API.G_MISS_NUM ) THEN
13629 l_service_request_rec.program_login_id := NULL;
13630 END IF;
13631
13632 -- Added for address fields related changes by shijain
13633
13634 IF (l_service_request_rec.incident_point_of_interest = FND_API.G_MISS_CHAR)
13635 THEN
13636 l_service_request_rec.incident_point_of_interest := NULL;
13637 END IF;
13638
13639 IF (l_service_request_rec.incident_cross_street = FND_API.G_MISS_CHAR) THEN
13640 l_service_request_rec.incident_cross_street := NULL;
13641 END IF;
13642
13643 IF (l_service_request_rec.incident_direction_qualifier = FND_API.G_MISS_CHAR)
13644 THEN
13645 l_service_request_rec.incident_direction_qualifier := NULL;
13646 END IF;
13647
13648 IF (l_service_request_rec.incident_distance_qualifier = FND_API.G_MISS_CHAR)
13649 THEN
13650 l_service_request_rec.incident_distance_qualifier := NULL;
13651 END IF;
13652
13653 IF (l_service_request_rec.incident_distance_qual_uom = FND_API.G_MISS_CHAR)
13654 THEN
13655 l_service_request_rec.incident_distance_qual_uom := NULL;
13656 END IF;
13657
13658 IF (l_service_request_rec.incident_address2 = FND_API.G_MISS_CHAR) THEN
13659 l_service_request_rec.incident_address2 := NULL;
13660 END IF;
13661
13662 IF (l_service_request_rec.incident_address3 = FND_API.G_MISS_CHAR) THEN
13663 l_service_request_rec.incident_address3 := NULL;
13664 END IF;
13665
13666 IF (l_service_request_rec.incident_address4 = FND_API.G_MISS_CHAR) THEN
13667 l_service_request_rec.incident_address4 := NULL;
13668 END IF;
13669
13670 IF (l_service_request_rec.incident_address_style = FND_API.G_MISS_CHAR)
13671 THEN
13672 l_service_request_rec.incident_address_style := NULL;
13673 END IF;
13674
13675 IF (l_service_request_rec.incident_addr_lines_phonetic = FND_API.G_MISS_CHAR)
13676 THEN
13677 l_service_request_rec.incident_addr_lines_phonetic := NULL;
13678 END IF;
13679
13680 IF (l_service_request_rec.incident_po_box_number = FND_API.G_MISS_CHAR)
13681 THEN
13682 l_service_request_rec.incident_po_box_number := NULL;
13683 END IF;
13684
13685 IF (l_service_request_rec.incident_house_number = FND_API.G_MISS_CHAR) THEN
13686 l_service_request_rec.incident_house_number := NULL;
13687 END IF;
13688
13689 IF (l_service_request_rec.incident_street_suffix = FND_API.G_MISS_CHAR)
13690 THEN
13691 l_service_request_rec.incident_street_suffix := NULL;
13692 END IF;
13693
13694 IF (l_service_request_rec.incident_street = FND_API.G_MISS_CHAR) THEN
13695 l_service_request_rec.incident_street := NULL;
13696 END IF;
13697
13698 IF (l_service_request_rec.incident_street_number = FND_API.G_MISS_CHAR)
13699 THEN
13700 l_service_request_rec.incident_street_number := NULL;
13701 END IF;
13702
13703 IF (l_service_request_rec.incident_floor = FND_API.G_MISS_CHAR) THEN
13704 l_service_request_rec.incident_floor := NULL;
13705 END IF;
13706
13707 IF (l_service_request_rec.incident_suite = FND_API.G_MISS_CHAR) THEN
13708 l_service_request_rec.incident_suite := NULL;
13709 END IF;
13710
13711 IF (l_service_request_rec.incident_postal_plus4_code = FND_API.G_MISS_CHAR)
13712 THEN
13713 l_service_request_rec.incident_postal_plus4_code := NULL;
13714 END IF;
13715
13716 IF (l_service_request_rec.incident_position = FND_API.G_MISS_CHAR) THEN
13717 l_service_request_rec.incident_position := NULL;
13718 END IF;
13719
13720 IF (l_service_request_rec.incident_location_directions = FND_API.G_MISS_CHAR)
13721 THEN
13722 l_service_request_rec.incident_location_directions := NULL;
13723 END IF;
13724
13725 IF (l_service_request_rec.incident_location_description= FND_API.G_MISS_CHAR)
13726 THEN
13727 l_service_request_rec.incident_location_description := NULL;
13728 END IF;
13729
13730 IF (l_service_request_rec.install_site_id = FND_API.G_MISS_NUM) THEN
13731 l_service_request_rec.install_site_id := NULL;
13732 END IF;
13733
13734 -- for cmro_eam
13735 IF (l_service_request_rec.owning_dept_id = FND_API.G_MISS_NUM) THEN
13736 l_service_request_rec.owning_dept_id := NULL;
13737 END IF;
13738
13739 IF (l_service_request_rec.owner_assigned_flag = FND_API.G_MISS_CHAR) THEN
13740 l_service_request_rec.owner_assigned_flag := NULL;
13741 END IF;
13742 IF (l_service_request_rec.resource_type = FND_API.G_MISS_CHAR) THEN
13743 l_service_request_rec.resource_type := NULL;
13744 END IF;
13745 IF (l_service_request_rec.maint_organization_id = FND_API.G_MISS_NUM) THEN
13746 l_service_request_rec.maint_organization_id := NULL;
13747 END IF;
13748
13749 -- for cmro_eam
13750
13751 -- ----------------------------------------------------------------------
13752 -- Perform the database operation. Generate the request ID and request
13753 -- number from the sequences, then insert the sequence numbers and passed
13754 -- in attributes into the CS_INCIDENTS_ALL table.
13755 -- ----------------------------------------------------------------------
13756
13757 /****
13758
13759 If request id is not passed as a parameter to the API, then find the
13760 next id/number from the sequence and check whether the generated number
13761 already exists in the database. If it exists continue to generate the
13762 id/number till a unique id/number is found
13763
13764 *******/
13765
13766 IF l_request_id IS NULL THEN
13767 LOOP
13768 SELECT cs_incidents_s.NEXTVAL INTO x_req_id FROM dual;
13769 BEGIN
13770 SELECT incident_id INTO l_temp_id FROM cs_incidents_all_b
13771 WHERE incident_id = x_req_id;
13772 EXCEPTION
13773 WHEN NO_DATA_FOUND THEN
13774 EXIT;
13775 WHEN OTHERS THEN
13776 EXIT;
13777 END;
13778 END LOOP;
13779 ELSE
13780 x_request_id := l_request_id;
13781 END IF;
13782
13783 IF l_request_number IS NULL THEN
13784 LOOP
13785 SELECT cs_incidents_number_s.NEXTVAL INTO x_req_num FROM dual;
13786 BEGIN
13787 SELECT incident_number INTO l_temp_num FROM cs_incidents_all_b
13788 WHERE incident_number = x_req_num;
13789 EXCEPTION
13790 WHEN NO_DATA_FOUND THEN
13791 EXIT;
13792 WHEN OTHERS THEN
13793 EXIT;
13794 END;
13795 END LOOP;
13796 ELSE
13797 x_request_number := l_request_number;
13798 END IF;
13799
13800 --------Added owner_assigned_flag for the enhancements--11.5.6--
13801 --------
13802 --------
13803
13804 IF (l_service_request_rec.owner_group_id IS NOT NULL AND
13805 l_service_request_rec.owner_id IS NOT NULL) OR
13806 (l_service_request_rec.owner_group_id IS NOT NULL AND
13807 l_service_request_rec.group_type = 'RS_TEAM') OR
13808 (l_service_request_rec.owner_group_id IS NOT NULL AND
13809 l_service_request_rec.group_type IS NULL) THEN
13810 l_service_request_rec.owner_assigned_flag := 'Y';
13811 ELSIF (l_service_request_rec.owner_group_id IS NULL) THEN
13812 l_service_request_rec.owner_assigned_flag := 'N';
13813 ELSE
13814 l_service_request_rec.owner_assigned_flag := 'N';
13815 END IF;
13816
13817 ---- Added this code because the form is clearing the group,
13818 ---- when group_type is not entered.
13819 IF (l_service_request_rec.owner_group_id IS NOT NULL AND
13820 l_service_request_rec.group_type IS NULL) THEN
13821 l_service_request_rec.owner_group_id := NULL;
13822 END IF;
13823
13824 --*************************************************
13825 --Added code to fix Bug# 1948054
13826
13827 -- dj
13828 -- changed = to >
13829 -- contracts : 3224828 changed to = to get the values
13830 -- for contract_id and contract_number
13831 IF (p_validation_level = FND_API.G_VALID_LEVEL_NONE) THEN
13832 --IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
13833 --
13834 -- Validate contract service id
13835 --
13836 IF (l_service_request_rec.contract_service_id <> FND_API.G_MISS_NUM AND
13837 l_service_request_rec.contract_service_id IS NOT NULL) THEN
13838
13839 CS_ServiceRequest_UTIL.Validate_Contract_Service_Id(
13840 p_api_name => l_api_name,
13841 p_parameter_name => 'p_contract_service_id',
13842 p_contract_service_id => l_service_request_rec.contract_service_id,
13843 x_contract_id =>x_contra_id,
13844 x_contract_number =>x_contract_number,
13845 x_return_status => x_return_status);
13846
13847 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
13848 x_return_status := FND_API.G_RET_STS_ERROR;
13849 RETURN;
13850 END IF;
13851
13852 END IF;
13853 --
13854 -- Validate contract id 04/16/01
13855 --
13856 IF (l_service_request_rec.contract_id <> FND_API.G_MISS_NUM) AND
13857 (l_service_request_rec.contract_id IS NOT NULL) AND
13858 (l_service_request_rec.contract_service_id IS NULL OR
13859 l_service_request_rec.contract_service_id <> FND_API.G_MISS_NUM) THEN
13860
13861 CS_ServiceRequest_UTIL.Validate_Contract_Id(
13862 p_api_name => l_api_name,
13863 p_parameter_name => 'p_contract_id',
13864 p_contract_id => l_service_request_rec.contract_id,
13865 x_contract_number => x_contract_number,
13866 x_return_status => l_return_status);
13867
13868 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
13869 x_return_status := FND_API.G_RET_STS_ERROR;
13870 RETURN;
13871 END IF;
13872
13873 x_contra_id := l_service_request_rec.contract_id;
13874
13875 END IF;
13876
13877
13878 END IF;
13879
13880 --
13881 -- Validate creation program code 10/11/02 shijain - This should be done everytime
13882 -- irrespective of validation level - since this does not come from an LOV
13883 --
13884
13885 IF (l_service_request_rec.creation_program_code <> FND_API.G_MISS_CHAR) AND
13886 (l_service_request_rec.creation_program_code IS NOT NULL) THEN
13887
13888 CS_ServiceRequest_UTIL.Validate_source_program_code(
13889 p_api_name => l_api_name,
13890 p_parameter_name => 'p_creation_program_code',
13891 p_source_program_code => l_service_request_rec.creation_program_code,
13892 x_return_status => l_return_status);
13893
13894 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
13895 x_return_status := FND_API.G_RET_STS_ERROR;
13896 RETURN;
13897 END IF;
13898 END IF;
13899
13900 -- Added for address by shijain 05 dec 2002
13901 IF (l_service_request_rec.INCIDENT_DIRECTION_QUALIFIER <> FND_API.G_MISS_CHAR) AND
13902 (l_service_request_rec.INCIDENT_DIRECTION_QUALIFIER IS NOT NULL) THEN
13903
13904 CS_ServiceRequest_UTIL.Validate_INC_DIRECTION_QUAL(
13905 p_api_name => l_api_name,
13906 p_parameter_name => 'p_INC_DIRECTION_QUAL',
13907 p_INC_DIRECTION_QUAL => l_service_request_rec.INCIDENT_DIRECTION_QUALIFIER,
13908 x_return_status => l_return_status);
13909
13910 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
13911 x_return_status := FND_API.G_RET_STS_ERROR;
13912 RETURN;
13913 END IF;
13914 END IF;
13915
13916 -- Added for address by shijain 05 dec 2002
13917 IF (l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM <> FND_API.G_MISS_CHAR) AND
13918 (l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM IS NOT NULL) THEN
13919
13920
13921 CS_ServiceRequest_UTIL.Validate_INC_DIST_QUAL_UOM(
13922 p_api_name => l_api_name,
13923 p_parameter_name => 'p_INC_DIST_QUAL_UOM',
13924 p_INC_DIST_QUAL_UOM => l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM,
13925 x_return_status => l_return_status);
13926
13927 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
13928 x_return_status := FND_API.G_RET_STS_ERROR;
13929 RETURN;
13930 END IF;
13931 END IF;
13932
13933
13934 -- Assigning the values to x_service_request_rec
13935 x_service_request_rec := l_service_request_rec;
13936
13937 EXCEPTION
13938 WHEN FND_API.G_EXC_ERROR THEN
13939 ROLLBACK TO Create_ServiceRequest_PVT;
13940 x_return_status := FND_API.G_RET_STS_ERROR;
13941 FND_MSG_PUB.Count_And_Get
13942 ( p_count => x_msg_count,
13943 p_data => x_msg_data
13944 );
13945 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
13946 ROLLBACK TO Create_ServiceRequest_PVT;
13947 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
13948 FND_MSG_PUB.Count_And_Get
13949 ( p_count => x_msg_count,
13950 p_data => x_msg_data
13951 );
13952 WHEN OTHERS THEN
13953 ROLLBACK TO Create_ServiceRequest_PVT;
13954 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
13955 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
13956 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
13957 END IF;
13958 FND_MSG_PUB.Count_And_Get
13959 ( p_count => x_msg_count,
13960 p_data => x_msg_data
13961 );
13962
13963 END Create_SR_Validation;
13964
13965 -- -----------------------------------------------------------------------------
13966 -- Modification History
13967 -- Date Name Desc
13968 -- -------- --------- ----------------------------------------------------------
13969 -- 02/28/05 smisra Bug 4083288 Defaulted category_set_id if it is not
13970 -- passed and category id is passed and existing value of
13971 -- category_set_id is null.
13972 -- 05/09/05 smisra set maint_organization_id from old value rec if passed
13973 -- value is G_MISS_NUM
13974 -- selected maint_organization_id column in
13975 -- l_servicerequest_csr
13976 -- 05/13/05 smisra Removed the code that set customer product related
13977 -- parameters to null for EAM SRs
13978 -- 05/27/05 smisra Bug 4227769
13979 -- removed the code that sets obsolete col group_owner and
13980 -- owner (_tl table columns)
13981 -- 06/07/05 smisra Bug 4381751
13982 -- Modified condition for auto assignment call and called it
13983 -- only if disallow owner update is 'N' for assignment level
13984 -- 'INDIVIDUAL'. Disallow owner update flag value will not
13985 -- have any impact for assignment level 'GROUP'
13986 -- 07/11/05 smisra ERES changes. Changed processing related to disallow
13987 -- request update as follows
13988 -- if status passed to this procedure has pending approval
13989 -- flag as 'Y' do not call update_status.
13990 -- update_status is not capable of ERES processing.
13991 -- If old status has pending approval flag as Y and last
13992 -- update program code is not ERES then raise error. Such SRs
13993 -- can be update only by ERES program.
13994 -- 07/15/05 smisra Bug 4489746
13995 -- removed start and end active dates from query on
13996 -- cs_incident_types. Validate type will take care of
13997 -- date effectivity check.
13998 -- 07/20/05 smisra replaced individual vars from get_status_details call with
13999 -- structure l_sr_related_data members
14000 --
14001 -- Removed queries on cs_incident_statuses_b table that were
14002 -- present inside comments. These queries are replaced with
14003 -- cs_servicerequest_util.get_status_details call
14004 --
14005 -- Modified condition for calling auto assignment and added
14006 -- one more condition of disallow_request_update flag of
14007 -- old status id. if this flag is Y then auto assignment
14008 -- is not called.
14009 -- 10/07/05 smisra Fixed byg 4653148
14010 -- Removed variable l_close_flag_temp because another
14011 -- variable with similar name already exists and is used
14012 -- widely. Replaced it with l_closed_flag_temp
14013 -- 12/14/05 smisra set incident_country to old value if incident_location_id
14014 -- is not changed and it is not null
14015 -- Copied incident_country to validation record only if
14016 -- incident location is null and country has some value
14017 -- moved the code setting incident_country, inc_location_id
14018 -- and incident_location_type attribute of audit record to
14019 -- create_servicerequest just before call to create audit
14020 -- 12/23/05 smisra bug 4894942
14021 -- Removed call to Assignment manager API. now it is called
14022 -- from vldt_sr_rec
14023 -- Removed the code to set following audit record attribute
14024 -- a. resource_type
14025 -- b. group_type
14026 -- c. incident_owner_id
14027 -- d. group_owner_id
14028 -- e. owner_assigned_time
14029 -- f. territory_id
14030 -- These attribute are now set in update_servicerequest
14031 -- procedure just before the call to create audit
14032 -- 12/30/05 smisra Bug 4869065
14033 -- Moved the code to set site cols of audit record to
14034 -- create_servicerequest procedure just before call to
14035 -- create audit
14036 -- 03/01/05 spusegao Modified to exempt from raising 'OnlyUpdStatus' exception
14037 -- ERES call back procedure i.e. when last_update_program_code = 'ERES'.
14038 --
14039 -- 04/18/06 spusegao Modified to validate p_last_updated_by and service_request_rec.last_updateD_by parameter values.
14040 -- -----------------------------------------------------------------------------
14041 PROCEDURE Update_SR_Validation(
14042 p_api_version IN VARCHAR2,
14043 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
14044 p_service_request_rec IN service_request_rec_type,
14045 p_invocation_mode IN VARCHAR2 := 'NORMAL',
14046 p_notes IN notes_table,
14047 p_contacts IN contacts_table,
14048 p_audit_comments IN VARCHAR2 DEFAULT NULL,
14049 p_resp_id IN NUMBER DEFAULT NULL,
14050 p_resp_appl_id IN NUMBER DEFAULT NULL,
14051 p_request_id IN NUMBER,
14052 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
14053 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
14054 p_last_updated_by IN NUMBER,
14055 p_last_update_login IN NUMBER DEFAULT NULL,
14056 p_last_update_date IN DATE,
14057 p_object_version_number IN NUMBER,
14058 x_return_status OUT NOCOPY VARCHAR2,
14059 x_contra_id OUT NOCOPY NUMBER,
14060 x_contract_number OUT NOCOPY VARCHAR2,
14061 x_owner_assigned_flag OUT NOCOPY VARCHAR2,
14062 x_msg_count OUT NOCOPY NUMBER,
14063 x_msg_data OUT NOCOPY VARCHAR2,
14064 x_audit_vals_rec OUT NOCOPY sr_audit_rec_type,
14065 x_service_request_rec OUT NOCOPY service_request_rec_type,
14066 x_autolaunch_wkf_flag OUT NOCOPY VARCHAR2,
14067 x_abort_wkf_close_flag OUT NOCOPY VARCHAR2,
14068 x_wkf_process_name OUT NOCOPY VARCHAR2,
14069 x_workflow_process_id OUT NOCOPY NUMBER,
14070 x_interaction_id OUT NOCOPY NUMBER,
14071 p_update_desc_flex IN VARCHAR2 DEFAULT fnd_api.g_false,
14072 p_called_by_workflow IN VARCHAR2 DEFAULT fnd_api.g_false,
14073 p_workflow_process_id IN NUMBER DEFAULT NULL,
14074 -- for cmro
14075 p_cmro_flag IN VARCHAR2,
14076 p_maintenance_flag IN VARCHAR2,
14077 p_auto_assign IN VARCHAR2 := 'N'
14078 )
14079
14080 IS
14081 l_api_name CONSTANT VARCHAR2(30) := 'Update_SR_Validation';
14082 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
14083 l_return_status VARCHAR2(1);
14084 l_cp_inventory_item_id NUMBER;
14085 l_close_flag VARCHAR2(1);
14086 l_service_request_rec service_request_rec_type DEFAULT p_service_request_rec;
14087 l_contra_id NUMBER;
14088 l_contract_number VARCHAR2(120) ;
14089
14090 l_group_name VARCHAR2(60);
14091 l_owner_name VARCHAR2(360);
14092 l_owner_id jtf_rs_resource_extns.resource_id % TYPE;
14093 l_operation VARCHAR2(300):= 'updated' ;
14094 l_temp_close_flag VARCHAR2(1);
14095
14096 OnlyUpdStatus EXCEPTION;
14097
14098 CURSOR l_ServiceRequest_csr IS
14099 SELECT
14100 B.ROWID ROW_ID,
14101 B.INCIDENT_ID ,
14102 B.LAST_UPDATE_DATE ,
14103 B.LAST_UPDATED_BY ,
14104 B.CREATION_DATE ,
14105 B.CREATED_BY ,
14106 B.LAST_UPDATE_LOGIN ,
14107 B.INCIDENT_NUMBER ,
14108 B.INCIDENT_DATE ,
14109 B.INCIDENT_STATUS_ID ,
14110 B.INCIDENT_TYPE_ID ,
14111 B.INCIDENT_URGENCY_ID ,
14112 B.INCIDENT_SEVERITY_ID ,
14113 B.INCIDENT_OWNER_ID ,
14114 B.RESOURCE_TYPE ,
14115 B.RESOURCE_SUBTYPE_ID ,
14116 B.INVENTORY_ITEM_ID ,
14117 B.CUSTOMER_ID ,
14118 B.CUSTOMER_NUMBER ,
14119 B.ACCOUNT_ID ,
14120 B.BILL_TO_SITE_USE_ID ,
14121 B.PURCHASE_ORDER_NUM ,
14122 B.EMPLOYEE_ID ,
14123 B.FILED_BY_EMPLOYEE_FLAG ,
14124 B.SHIP_TO_SITE_USE_ID ,
14125 B.PROBLEM_CODE ,
14126 B.EXPECTED_RESOLUTION_DATE ,
14127 B.ACTUAL_RESOLUTION_DATE ,
14128 B.CUSTOMER_PRODUCT_ID ,
14129 B.BILL_TO_CONTACT_ID ,
14130 B.SHIP_TO_CONTACT_ID ,
14131 B.CURRENT_SERIAL_NUMBER ,
14132 B.PRODUCT_REVISION ,
14133 B.COMPONENT_VERSION,
14134 B.SUBCOMPONENT_VERSION,
14135 B.INCIDENT_ATTRIBUTE_1 ,
14136 B.INCIDENT_ATTRIBUTE_2 ,
14137 B.INCIDENT_ATTRIBUTE_3 ,
14138 B.INCIDENT_ATTRIBUTE_4 ,
14139 B.INCIDENT_ATTRIBUTE_5 ,
14140 B.INCIDENT_ATTRIBUTE_6 ,
14141 B.INCIDENT_ATTRIBUTE_7 ,
14142 B.INCIDENT_ATTRIBUTE_8 ,
14143 B.INCIDENT_ATTRIBUTE_9 ,
14144 B.INCIDENT_ATTRIBUTE_10 ,
14145 B.INCIDENT_ATTRIBUTE_11 ,
14146 B.INCIDENT_ATTRIBUTE_12 ,
14147 B.INCIDENT_ATTRIBUTE_13 ,
14148 B.INCIDENT_ATTRIBUTE_14 ,
14149 B.INCIDENT_ATTRIBUTE_15 ,
14150 B.INCIDENT_CONTEXT ,
14151 B.EXTERNAL_ATTRIBUTE_1 ,
14152 B.EXTERNAL_ATTRIBUTE_2 ,
14153 B.EXTERNAL_ATTRIBUTE_3 ,
14154 B.EXTERNAL_ATTRIBUTE_4 ,
14155 B.EXTERNAL_ATTRIBUTE_5 ,
14156 B.EXTERNAL_ATTRIBUTE_6 ,
14157 B.EXTERNAL_ATTRIBUTE_7 ,
14158 B.EXTERNAL_ATTRIBUTE_8 ,
14159 B.EXTERNAL_ATTRIBUTE_9 ,
14160 B.EXTERNAL_ATTRIBUTE_10 ,
14161 B.EXTERNAL_ATTRIBUTE_11 ,
14162 B.EXTERNAL_ATTRIBUTE_12 ,
14163 B.EXTERNAL_ATTRIBUTE_13 ,
14164 B.EXTERNAL_ATTRIBUTE_14 ,
14165 B.EXTERNAL_ATTRIBUTE_15 ,
14166 B.EXTERNAL_CONTEXT ,
14167 B.RECORD_IS_VALID_FLAG ,
14168 B.RESOLUTION_CODE ,
14169 B.ORG_ID ,
14170 B.ORIGINAL_ORDER_NUMBER ,
14171 B.WORKFLOW_PROCESS_ID ,
14172 B.CLOSE_DATE ,
14173 B.PUBLISH_FLAG ,
14174 B.ESTIMATE_ID ,
14175 B.ESTIMATE_BUSINESS_GROUP_ID ,
14176 B.INTERFACED_TO_DEPOT_FLAG ,
14177 B.QA_COLLECTION_ID ,
14178 B.CONTRACT_SERVICE_ID ,
14179 B.CONTRACT_ID,
14180 B.CONTRACT_NUMBER,
14181 B.PROJECT_NUMBER,
14182 B.TIME_ZONE_ID ,
14183 B.TIME_DIFFERENCE ,
14184 B.CUSTOMER_PO_NUMBER ,
14185 B.OWNER_GROUP_ID ,
14186 B.CUSTOMER_TICKET_NUMBER ,
14187 B.OBLIGATION_DATE ,
14188 B.SITE_ID ,
14189 B.CUSTOMER_SITE_ID ,
14190 B.CALLER_TYPE ,
14191 B.PLATFORM_ID ,
14192 B.PLATFORM_VERSION,
14193 B.DB_VERSION,
14194 B.PLATFORM_VERSION_ID ,
14195 B.CP_COMPONENT_ID ,
14196 B.CP_COMPONENT_VERSION_ID ,
14197 B.CP_SUBCOMPONENT_ID ,
14198 B.CP_SUBCOMPONENT_VERSION_ID ,
14199 B.CP_REVISION_ID ,
14200 B.INV_ITEM_REVISION,
14201 B.INV_COMPONENT_ID,
14202 B.INV_COMPONENT_VERSION,
14203 B.INV_SUBCOMPONENT_ID,
14204 B.INV_SUBCOMPONENT_VERSION,
14205 B.LANGUAGE_ID,
14206 B.TERRITORY_ID,
14207 B.INV_ORGANIZATION_ID,
14208 B.OBJECT_VERSION_NUMBER ,
14209 -- Added for enhancement 11.5.6
14210 B.CUST_PREF_LANG_ID,
14211 B.TIER,
14212 B.TIER_VERSION,
14213 B.OPERATING_SYSTEM,
14214 B.OPERATING_SYSTEM_VERSION,
14215 B.DATABASE,
14216 B.CATEGORY_ID,
14217 B.GROUP_TYPE,
14218 B.GROUP_TERRITORY_ID,
14219 B.OWNER_ASSIGNED_TIME,
14220 B.OWNER_ASSIGNED_FLAG,
14221 B.INV_PLATFORM_ORG_ID,
14222 B.COMM_PREF_CODE,
14223 B.CUST_PREF_LANG_CODE,
14224 B.LAST_UPDATE_CHANNEL,
14225 B.CATEGORY_SET_ID,
14226 B.EXTERNAL_REFERENCE,
14227 B.SYSTEM_ID,
14228 B.ERROR_CODE,
14229 B.INCIDENT_ADDRESS,
14230 B.INCIDENT_CITY,
14231 B.INCIDENT_STATE,
14232 B.INCIDENT_COUNTRY,
14233 B.INCIDENT_PROVINCE,
14234 B.INCIDENT_POSTAL_CODE,
14235 B.INCIDENT_COUNTY,
14236 B.SR_CREATION_CHANNEL,
14237 TL.RESOLUTION_SUMMARY,
14238 -- Added for Enh# 1830701
14239 B.INCIDENT_OCCURRED_DATE,
14240 B.INCIDENT_RESOLVED_DATE,
14241 B.INC_RESPONDED_BY_DATE,
14242 -- Added for Enh# 222054
14243 B.INCIDENT_LOCATION_ID,
14244 -- Added for ER# 2320056
14245 B.COVERAGE_TYPE,
14246 -- Added for ER#2433831
14247 B.BILL_TO_ACCOUNT_ID,
14248 B.SHIP_TO_ACCOUNT_ID,
14249 -- Added for ER#2463321
14250 B.CUSTOMER_PHONE_ID,
14251 B.CUSTOMER_EMAIL_ID,
14252 -- Added for 11.5.9
14253 B.BILL_TO_SITE_ID,
14254 B.SHIP_TO_SITE_ID,
14255 B.BILL_TO_PARTY_ID,
14256 B.SHIP_TO_PARTY_ID,
14257 B.CREATION_PROGRAM_CODE,
14258 B.LAST_UPDATE_PROGRAM_CODE,
14259 B.PROGRAM_ID,
14260 B.PROGRAM_APPLICATION_ID,
14261 B.REQUEST_ID,
14262 B.PROGRAM_LOGIN_ID,
14263 -- Added for Enh# 2216664
14264 TL.OWNER,
14265 TL.GROUP_OWNER,
14266 TL.LANGUAGE ,
14267 TL.SOURCE_LANG ,
14268 TL.SUMMARY ,
14269 B.INSTALL_SITE_ID,
14270 B.INSTALL_SITE_USE_ID,
14271 --TL.SR_CREATION_CHANNEL
14272 B.STATUS_FLAG,
14273 -- Added address columns by shijain 26thdec 2002
14274 B.INCIDENT_POINT_OF_INTEREST ,
14275 B.INCIDENT_CROSS_STREET ,
14276 B.INCIDENT_DIRECTION_QUALIFIER ,
14277 B.INCIDENT_DISTANCE_QUALIFIER ,
14278 B.INCIDENT_DISTANCE_QUAL_UOM ,
14279 B.INCIDENT_ADDRESS2 ,
14280 B.INCIDENT_ADDRESS3 ,
14281 B.INCIDENT_ADDRESS4 ,
14282 B.INCIDENT_ADDRESS_STYLE ,
14283 B.INCIDENT_ADDR_LINES_PHONETIC ,
14284 B.INCIDENT_PO_BOX_NUMBER ,
14285 B.INCIDENT_HOUSE_NUMBER ,
14286 B.INCIDENT_STREET_SUFFIX ,
14287 B.INCIDENT_STREET ,
14288 B.INCIDENT_STREET_NUMBER ,
14289 B.INCIDENT_FLOOR,
14290 B.INCIDENT_SUITE ,
14291 B.INCIDENT_POSTAL_PLUS4_CODE ,
14292 B.INCIDENT_POSITION ,
14293 B.INCIDENT_LOCATION_DIRECTIONS,
14294 B.INCIDENT_LOCATION_DESCRIPTION,
14295 --for cmro_eam
14296 B.OWNING_DEPARTMENT_ID,
14297 --end of cmro_eam
14298 -- Added for Misc ERs project (11.5.10) --anmukher --08/26/03
14299 B.INCIDENT_LOCATION_TYPE ,
14300 --B.PRIMARY_CONTACT_ID
14301 B.maint_organization_id
14302 FROM cs_incidents_all_b b, cs_incidents_all_tl tl
14303 WHERE b.incident_id = p_request_id
14304 AND b.incident_id = tl.incident_id
14305 AND tl.LANGUAGE = DECODE(l_service_request_rec.LANGUAGE,
14306 FND_API.G_MISS_CHAR, USERENV('LANG'),
14307 NULL, USERENV('LANG'), l_service_request_rec.LANGUAGE)
14308 FOR UPDATE OF b.incident_id;
14309
14310 l_old_ServiceRequest_rec l_ServiceRequest_csr%ROWTYPE;
14311
14312 -- Validation record
14313 l_SR_Validation_rec Request_Validation_Rec_Type;
14314
14315 -- Some temp variables
14316 l_update_desc_flex VARCHAR2(1) := p_update_desc_flex;
14317 l_type_id_temp NUMBER;
14318 -- l_inventory_org_id NUMBER;
14319 l_closed_flag_temp VARCHAR2(1);
14320 l_status_validated BOOLEAN:= FALSE;
14321 l_employee_name VARCHAR2(240);
14322 l_contact_index BINARY_INTEGER;
14323 l_primary_contact_id NUMBER := NULL;
14324 l_org_id NUMBER;
14325 l_primary_contact_found VARCHAR2(1) := 'N';
14326 l_contacts_passed VARCHAR2(1) := 'N' ;
14327 l_old_close_flag VARCHAR2(1) ;
14328 l_new_close_flag VARCHAR2(1) ;
14329 -- For Workflow Hook
14330 l_workflow_item_key NUMBER;
14331 l_autolaunch_workflow_flag VARCHAR2(1);
14332 l_abort_workflow_close_flag VARCHAR2(1);
14333 l_disallow_request_update VARCHAR2(1);
14334 l_disallow_owner_update VARCHAR2(1);
14335 l_disallow_product_update VARCHAR2(1);
14336 l_party_id_update VARCHAR2(1);
14337 l_contact_point_id_update VARCHAR2(1);
14338 l_contact_point_type_update VARCHAR2(1);
14339 l_contact_type_update VARCHAR2(1);
14340 l_primary_flag_update VARCHAR2(1) ;
14341 l_old_party_id NUMBER;
14342 l_old_contact_point_id NUMBER;
14343 l_old_contact_point_type VARCHAR2(30);
14344 l_old_contact_type VARCHAR2(30);
14345 l_old_primary_flag VARCHAR2(1) ;
14346
14347 l_primary_contact_point_id NUMBER;
14348 l_saved_primary_contact_id NUMBER;
14349 l_saved_contact_point_id NUMBER ;
14350 l_primary_contact_change VARCHAR2(1) := 'N';
14351 l_count NUMBER;
14352
14353 ---Added so that workflow can call Update SR API instead of Calling Create Audit API
14354 ----bug 1485825
14355 l_wf_process_itemkey VARCHAR2(30);
14356 l_workflow_process_name VARCHAR2(30);
14357 l_workflow_process_id NUMBER;
14358
14359 l_bill_to_site_id NUMBER;
14360 l_ship_to_site_id NUMBER;
14361 l_bill_to_site_use_id NUMBER;
14362 l_ship_to_site_use_id NUMBER;
14363
14364 l_auto_assign_level fnd_profile_option_values.profile_option_value % type :=
14365 fnd_profile.value('CS_SR_OWNER_AUTO_ASSIGN_LEVEL');
14366 l_asgn_owner_id cs_incidents_all_b.incident_owner_id % type;
14367 l_asgn_resource_type cs_incidents_all_b.resource_type % type;
14368 l_asgn_owner_group_id cs_incidents_all_b.owner_group_id % type;
14369 l_territory_id number;
14370 l_call_asgn_resource varchar2(1) := 'n';
14371
14372 -- For bug 3333340
14373 p_passed_value VARCHAR2(3);
14374 l_update_desc_flex_int varchar2(1) := FND_API.G_FALSE;
14375 l_update_desc_flex_ext varchar2(1) := FND_API.G_FALSE;
14376 l_ff_name varchar2(30);
14377 l_dummy0 cs_incidents_all_b.product_revision % type;
14378 l_dummy1 cs_incidents_all_b.component_version % type;
14379 l_dummy2 cs_incidents_all_b.subcomponent_version % type;
14380
14381 l_pending_approval_flag cs_incident_statuses_b.pending_approval_flag % TYPE;
14382 l_intermediate_status_id cs_incident_statuses_b.intermediate_status_id % TYPE;
14383 l_approval_status_id cs_incident_statuses_b.approval_action_status_id % TYPE;
14384 l_rejection_status_id cs_incident_statuses_b.rejection_action_status_id % TYPE;
14385
14386 l_sr_related_data RELATED_DATA_TYPE;
14387 BEGIN
14388
14389 x_return_status := FND_API.G_RET_STS_SUCCESS;
14390
14391 -- Initialize the New Auit Record
14392 Initialize_audit_rec(
14393 p_sr_audit_record => x_audit_vals_rec) ;
14394
14395 -- Fetch and get the original values
14396 OPEN l_ServiceRequest_csr;
14397 FETCH l_ServiceRequest_csr INTO l_old_ServiceRequest_rec;
14398 IF (l_ServiceRequest_csr%NOTFOUND) THEN
14399
14400 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
14401 ( p_token_an => l_api_name_full,
14402 p_token_v => TO_CHAR(p_request_id),
14403 p_token_p => 'p_request_id',
14404 p_table_name => G_TABLE_NAME,
14405 p_column_name => 'INCIDENT_ID');
14406
14407 RAISE FND_API.G_EXC_ERROR;
14408 END IF;
14409
14410 -- Validate flex field segments
14411 -- Moved this code from cspsrb.pls on 01/23/04
14412 -- Reason for move: old values are not available in cspsrb.pls
14413 -- and all g_miss values are to be replaced by values in db
14414 --
14415 -- This check is already done in cspsrb.pls. But we need to do it here again
14416 -- because parameter p_update_desc_flex does not say whether internal FF is changed
14417 -- or external FF is changed. it says either one of them is changed.
14418 -- So to make sure that internal FF validation is executed only if any of
14419 -- internal segments are changed, we need to check these fields again and
14420 -- set l_update_desc_flex_int and execute FF validation beased on this variable instead
14421 -- of l_update_desc_flex
14422 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
14423 IF NOT (( l_service_request_rec.request_context = FND_API.G_MISS_CHAR) AND
14424 ( l_service_request_rec.request_attribute_1 = FND_API.G_MISS_CHAR) AND
14425 ( l_service_request_rec.request_attribute_2 = FND_API.G_MISS_CHAR) AND
14426 ( l_service_request_rec.request_attribute_3 = FND_API.G_MISS_CHAR) AND
14427 ( l_service_request_rec.request_attribute_4 = FND_API.G_MISS_CHAR) AND
14428 ( l_service_request_rec.request_attribute_5 = FND_API.G_MISS_CHAR) AND
14429 ( l_service_request_rec.request_attribute_6 = FND_API.G_MISS_CHAR) AND
14430 ( l_service_request_rec.request_attribute_7 = FND_API.G_MISS_CHAR) AND
14431 ( l_service_request_rec.request_attribute_8 = FND_API.G_MISS_CHAR) AND
14432 ( l_service_request_rec.request_attribute_9 = FND_API.G_MISS_CHAR) AND
14433 ( l_service_request_rec.request_attribute_10 = FND_API.G_MISS_CHAR) AND
14434 ( l_service_request_rec.request_attribute_11 = FND_API.G_MISS_CHAR) AND
14435 ( l_service_request_rec.request_attribute_12 = FND_API.G_MISS_CHAR) AND
14436 ( l_service_request_rec.request_attribute_13 = FND_API.G_MISS_CHAR) AND
14437 ( l_service_request_rec.request_attribute_14 = FND_API.G_MISS_CHAR) AND
14438 ( l_service_request_rec.request_attribute_15 = FND_API.G_MISS_CHAR) ) THEN
14439 l_update_desc_flex_int := FND_API.G_TRUE;
14440 END IF; -- to check if any flex field segment is updated
14441 END IF; -- to check validation level
14442
14443 -- if context is changed then all g_miss_char will be replaced by null
14444 -- if context is not changed then all g_miss_char will be replaced with old value in database
14445 -- This is doen to make API behaviour same as SR FORM
14446 -- 01/23/04 smisra
14447 --
14448 -- This portion is out of validation level check. Reason: in old code too copy of old value to SR rec
14449 -- was outside validation level check. 1/28/04
14450 handle_missing_value(l_service_request_rec.request_context ,l_old_servicerequest_rec.incident_context );
14451 if ((l_service_request_rec.request_context is null and l_old_servicerequest_rec.incident_context is null) or
14452 (l_service_request_rec.request_context = l_old_servicerequest_rec.incident_context)) then
14453 -- request context is not changed. so set all g_miss_char to old value from db
14454 handle_missing_value(l_service_request_rec.request_attribute_1 ,l_old_servicerequest_rec.incident_attribute_1 );
14455 handle_missing_value(l_service_request_rec.request_attribute_2 ,l_old_servicerequest_rec.incident_attribute_2 );
14456 handle_missing_value(l_service_request_rec.request_attribute_3 ,l_old_servicerequest_rec.incident_attribute_3 );
14457 handle_missing_value(l_service_request_rec.request_attribute_4 ,l_old_servicerequest_rec.incident_attribute_4 );
14458 handle_missing_value(l_service_request_rec.request_attribute_5 ,l_old_servicerequest_rec.incident_attribute_5 );
14459 handle_missing_value(l_service_request_rec.request_attribute_6 ,l_old_servicerequest_rec.incident_attribute_6 );
14460 handle_missing_value(l_service_request_rec.request_attribute_7 ,l_old_servicerequest_rec.incident_attribute_7 );
14461 handle_missing_value(l_service_request_rec.request_attribute_8 ,l_old_servicerequest_rec.incident_attribute_8 );
14462 handle_missing_value(l_service_request_rec.request_attribute_9 ,l_old_servicerequest_rec.incident_attribute_9 );
14463 handle_missing_value(l_service_request_rec.request_attribute_10,l_old_servicerequest_rec.incident_attribute_10);
14464 handle_missing_value(l_service_request_rec.request_attribute_11,l_old_servicerequest_rec.incident_attribute_11);
14465 handle_missing_value(l_service_request_rec.request_attribute_12,l_old_servicerequest_rec.incident_attribute_12);
14466 handle_missing_value(l_service_request_rec.request_attribute_13,l_old_servicerequest_rec.incident_attribute_13);
14467 handle_missing_value(l_service_request_rec.request_attribute_14,l_old_servicerequest_rec.incident_attribute_14);
14468 handle_missing_value(l_service_request_rec.request_attribute_15,l_old_servicerequest_rec.incident_attribute_15);
14469 else
14470 -- incident context is changed. so set all g_miss_char to null except global data segments
14471 l_ff_name := 'CS_INCIDENTS_ALL_B';
14472 set_attribute_value(l_service_request_rec.request_attribute_1,l_old_servicerequest_rec.incident_attribute_1,
14473 l_ff_name,'INCIDENT_ATTRIBUTE_1');
14474
14475 set_attribute_value(l_service_request_rec.request_attribute_2,l_old_servicerequest_rec.incident_attribute_2,
14476 l_ff_name,'INCIDENT_ATTRIBUTE_2');
14477
14478 set_attribute_value(l_service_request_rec.request_attribute_3,l_old_servicerequest_rec.incident_attribute_3,
14479 l_ff_name,'INCIDENT_ATTRIBUTE_3');
14480
14481 set_attribute_value(l_service_request_rec.request_attribute_4,l_old_servicerequest_rec.incident_attribute_4,
14482 l_ff_name,'INCIDENT_ATTRIBUTE_4');
14483
14484 set_attribute_value(l_service_request_rec.request_attribute_5,l_old_servicerequest_rec.incident_attribute_5,
14485 l_ff_name,'INCIDENT_ATTRIBUTE_5');
14486
14487 set_attribute_value(l_service_request_rec.request_attribute_6,l_old_servicerequest_rec.incident_attribute_6,
14488 l_ff_name,'INCIDENT_ATTRIBUTE_6');
14489
14490 set_attribute_value(l_service_request_rec.request_attribute_7,l_old_servicerequest_rec.incident_attribute_7,
14491 l_ff_name,'INCIDENT_ATTRIBUTE_7');
14492
14493 set_attribute_value(l_service_request_rec.request_attribute_8,l_old_servicerequest_rec.incident_attribute_8,
14494 l_ff_name,'INCIDENT_ATTRIBUTE_8');
14495
14496 set_attribute_value(l_service_request_rec.request_attribute_9,l_old_servicerequest_rec.incident_attribute_9,
14497 l_ff_name,'INCIDENT_ATTRIBUTE_9');
14498
14499 set_attribute_value(l_service_request_rec.request_attribute_10,l_old_servicerequest_rec.incident_attribute_10,
14500 l_ff_name,'INCIDENT_ATTRIBUTE_10');
14501
14502 set_attribute_value(l_service_request_rec.request_attribute_11,l_old_servicerequest_rec.incident_attribute_11,
14503 l_ff_name,'INCIDENT_ATTRIBUTE_11');
14504
14505 set_attribute_value(l_service_request_rec.request_attribute_12,l_old_servicerequest_rec.incident_attribute_12,
14506 l_ff_name,'INCIDENT_ATTRIBUTE_12');
14507
14508 set_attribute_value(l_service_request_rec.request_attribute_13,l_old_servicerequest_rec.incident_attribute_13,
14509 l_ff_name,'INCIDENT_ATTRIBUTE_13');
14510
14511 set_attribute_value(l_service_request_rec.request_attribute_14,l_old_servicerequest_rec.incident_attribute_14,
14512 l_ff_name,'INCIDENT_ATTRIBUTE_14');
14513
14514 set_attribute_value(l_service_request_rec.request_attribute_15,l_old_servicerequest_rec.incident_attribute_15,
14515 l_ff_name,'INCIDENT_ATTRIBUTE_15');
14516 end if;
14517
14518 IF ( l_update_desc_flex_int = FND_API.G_TRUE and
14519 p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
14520 Cs_Servicerequest_Util.Validate_Desc_Flex(
14521 p_api_name => l_api_name_full,
14522 p_application_short_name => 'CS',
14523 p_desc_flex_name => 'CS_INCIDENTS_ALL_B',
14524 p_desc_segment1 => l_service_request_rec.request_attribute_1,
14525 p_desc_segment2 => l_service_request_rec.request_attribute_2,
14526 p_desc_segment3 => l_service_request_rec.request_attribute_3,
14527 p_desc_segment4 => l_service_request_rec.request_attribute_4,
14528 p_desc_segment5 => l_service_request_rec.request_attribute_5,
14529 p_desc_segment6 => l_service_request_rec.request_attribute_6,
14530 p_desc_segment7 => l_service_request_rec.request_attribute_7,
14531 p_desc_segment8 => l_service_request_rec.request_attribute_8,
14532 p_desc_segment9 => l_service_request_rec.request_attribute_9,
14533 p_desc_segment10 => l_service_request_rec.request_attribute_10,
14534 p_desc_segment11 => l_service_request_rec.request_attribute_11,
14535 p_desc_segment12 => l_service_request_rec.request_attribute_12,
14536 p_desc_segment13 => l_service_request_rec.request_attribute_13,
14537 p_desc_segment14 => l_service_request_rec.request_attribute_14,
14538 p_desc_segment15 => l_service_request_rec.request_attribute_15,
14539 p_desc_context => l_service_request_rec.request_context,
14540 p_resp_appl_id => p_resp_appl_id,
14541 p_resp_id => p_resp_id,
14542 p_return_status => l_return_status );
14543
14544 IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
14545 raise FND_API.G_EXC_ERROR;
14546 ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
14547 raise FND_API.G_EXC_UNEXPECTED_ERROR;
14548 END IF;
14549 END IF;
14550
14551
14552 -- Externl Attributes
14553 -- whether value of flex field segment is changed or not, it is g_miss_char then it must be
14554 -- set to value from database. 11/25/2003 smisra
14555 -- End of Validate flex field segments
14556 --
14557 /******** Bug 5216510 spusegao **********/
14558 -- Validate flex field segments
14559 -- Moved this code from cspsrb.pls
14560 -- Reason for move: old values are not available in cspsrb.pls
14561 -- and all g_miss values are to be replaced by values in db
14562 --
14563 -- This check is already done in cspsrb.pls. But we need to do it here again
14564 -- because parameter p_update_desc_flex does not say whether internal FF is changed
14565 -- or external FF is changed. it says either one of them is changed.
14566 -- So to make sure that external FF validation is executed only if any of
14567 -- external segments are changed, we need to check these fields again and
14568 -- set l_update_desc_flex_ext and execute FF validation beased on this variable instead
14569 -- of l_update_desc_flex
14570 -- whether value of flex field segment is changed or not, it is g_miss_char then it must be
14571
14572 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
14573 IF NOT (( l_service_request_rec.external_context = FND_API.G_MISS_CHAR) AND
14574 ( l_service_request_rec.external_attribute_1 = FND_API.G_MISS_CHAR) AND
14575 ( l_service_request_rec.external_attribute_2 = FND_API.G_MISS_CHAR) AND
14576 ( l_service_request_rec.external_attribute_3 = FND_API.G_MISS_CHAR) AND
14577 ( l_service_request_rec.external_attribute_4 = FND_API.G_MISS_CHAR) AND
14578 ( l_service_request_rec.external_attribute_5 = FND_API.G_MISS_CHAR) AND
14579 ( l_service_request_rec.external_attribute_6 = FND_API.G_MISS_CHAR) AND
14580 ( l_service_request_rec.external_attribute_7 = FND_API.G_MISS_CHAR) AND
14581 ( l_service_request_rec.external_attribute_8 = FND_API.G_MISS_CHAR) AND
14582 ( l_service_request_rec.external_attribute_9 = FND_API.G_MISS_CHAR) AND
14583 ( l_service_request_rec.external_attribute_10 = FND_API.G_MISS_CHAR) AND
14584 ( l_service_request_rec.external_attribute_11 = FND_API.G_MISS_CHAR) AND
14585 ( l_service_request_rec.external_attribute_12 = FND_API.G_MISS_CHAR) AND
14586 ( l_service_request_rec.external_attribute_13 = FND_API.G_MISS_CHAR) AND
14587 ( l_service_request_rec.external_attribute_14 = FND_API.G_MISS_CHAR) AND
14588 ( l_service_request_rec.external_attribute_15 = FND_API.G_MISS_CHAR) ) THEN
14589 l_update_desc_flex_ext := FND_API.G_TRUE;
14590 END IF; -- to check if any flex field segment is updated
14591 END IF; -- to check validation level
14592
14593 -- if context is changed then all g_miss_char will be replaced by null
14594 -- if context is not changed then all g_miss_char will be replaced with old value in database
14595 -- This is doen to make API behaviour same as SR FORM
14596 --
14597 --
14598 -- This portion is out of validation level check. Reason: in old code too copy of old value to SR rec
14599 -- was outside validation level check. 1/28/04
14600
14601 handle_missing_value(l_service_request_rec.external_context,l_old_servicerequest_rec.external_context);
14602 if ((l_service_request_rec.external_context is null and l_old_servicerequest_rec.external_context is null) or
14603 (l_service_request_rec.external_context = l_old_servicerequest_rec.external_context)) then
14604 -- context is not changed. so set all g_miss_char to old value from db
14605 handle_missing_value(l_service_request_rec.external_attribute_1 ,l_old_servicerequest_rec.external_attribute_1);
14606 handle_missing_value(l_service_request_rec.external_attribute_2 ,l_old_servicerequest_rec.external_attribute_2);
14607 handle_missing_value(l_service_request_rec.external_attribute_3 ,l_old_servicerequest_rec.external_attribute_3);
14608 handle_missing_value(l_service_request_rec.external_attribute_4 ,l_old_servicerequest_rec.external_attribute_4 );
14609 handle_missing_value(l_service_request_rec.external_attribute_5 ,l_old_servicerequest_rec.external_attribute_5 );
14610 handle_missing_value(l_service_request_rec.external_attribute_6 ,l_old_servicerequest_rec.external_attribute_6 );
14611 handle_missing_value(l_service_request_rec.external_attribute_7 ,l_old_servicerequest_rec.external_attribute_7 );
14612 handle_missing_value(l_service_request_rec.external_attribute_8 ,l_old_servicerequest_rec.external_attribute_8 );
14613 handle_missing_value(l_service_request_rec.external_attribute_9 ,l_old_servicerequest_rec.external_attribute_9 );
14614 handle_missing_value(l_service_request_rec.external_attribute_10,l_old_servicerequest_rec.external_attribute_10);
14615 handle_missing_value(l_service_request_rec.external_attribute_11,l_old_servicerequest_rec.external_attribute_11);
14616 handle_missing_value(l_service_request_rec.external_attribute_12,l_old_servicerequest_rec.external_attribute_12);
14617 handle_missing_value(l_service_request_rec.external_attribute_13,l_old_servicerequest_rec.external_attribute_13);
14618 handle_missing_value(l_service_request_rec.external_attribute_14,l_old_servicerequest_rec.external_attribute_14);
14619 handle_missing_value(l_service_request_rec.external_attribute_15,l_old_servicerequest_rec.external_attribute_15);
14620 else
14621
14622 -- context is changed. so set all g_miss_char to null except global data segments
14623 l_ff_name := 'CS_INCIDENTS_ALL_B_EXT';
14624 set_attribute_value(l_service_request_rec.external_attribute_1,l_old_servicerequest_rec.external_attribute_1,
14625 l_ff_name,'EXTERNAL_ATTRIBUTE_1');
14626
14627 set_attribute_value(l_service_request_rec.external_attribute_2,l_old_servicerequest_rec.external_attribute_2,
14628 l_ff_name,'EXTERNAL_ATTRIBUTE_2');
14629
14630 set_attribute_value(l_service_request_rec.external_attribute_3,l_old_servicerequest_rec.external_attribute_3,
14631 l_ff_name,'EXTERNAL_ATTRIBUTE_3');
14632
14633 set_attribute_value(l_service_request_rec.external_attribute_4,l_old_servicerequest_rec.external_attribute_4,
14634 l_ff_name,'EXTERNAL_ATTRIBUTE_4');
14635
14636 set_attribute_value(l_service_request_rec.external_attribute_5,l_old_servicerequest_rec.external_attribute_5,
14637 l_ff_name,'EXTERNAL_ATTRIBUTE_5');
14638
14639 set_attribute_value(l_service_request_rec.external_attribute_6,l_old_servicerequest_rec.external_attribute_6,
14640 l_ff_name,'EXTERNAL_ATTRIBUTE_6');
14641
14642 set_attribute_value(l_service_request_rec.external_attribute_7,l_old_servicerequest_rec.external_attribute_7,
14643 l_ff_name,'EXTERNAL_ATTRIBUTE_7');
14644
14645 set_attribute_value(l_service_request_rec.external_attribute_8,l_old_servicerequest_rec.external_attribute_8,
14646 l_ff_name,'EXTERNAL_ATTRIBUTE_8');
14647
14648 set_attribute_value(l_service_request_rec.external_attribute_9,l_old_servicerequest_rec.external_attribute_9,
14649 l_ff_name,'EXTERNAL_ATTRIBUTE_9');
14650
14651 set_attribute_value(l_service_request_rec.external_attribute_10,l_old_servicerequest_rec.external_attribute_10,
14652 l_ff_name,'EXTERNAL_ATTRIBUTE_10');
14653
14654 set_attribute_value(l_service_request_rec.external_attribute_11,l_old_servicerequest_rec.external_attribute_11,
14655 l_ff_name,'EXTERNAL_ATTRIBUTE_11');
14656
14657 set_attribute_value(l_service_request_rec.external_attribute_12,l_old_servicerequest_rec.external_attribute_12,
14658 l_ff_name,'EXTERNAL_ATTRIBUTE_12');
14659
14660 set_attribute_value(l_service_request_rec.external_attribute_13,l_old_servicerequest_rec.external_attribute_13,
14661 l_ff_name,'EXTERNAL_ATTRIBUTE_13');
14662
14663 set_attribute_value(l_service_request_rec.external_attribute_14,l_old_servicerequest_rec.external_attribute_14,
14664 l_ff_name,'EXTERNAL_ATTRIBUTE_14');
14665
14666 set_attribute_value(l_service_request_rec.external_attribute_15,l_old_servicerequest_rec.external_attribute_15,
14667 l_ff_name,'EXTERNAL_ATTRIBUTE_15');
14668 end if;
14669
14670 IF ( l_update_desc_flex_ext = FND_API.G_TRUE and
14671 p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
14672 Cs_ServiceRequest_Util.Validate_external_Desc_Flex
14673 ( p_api_name => l_api_name_full,
14674 p_application_short_name => 'CS',
14675 p_ext_desc_flex_name => 'CS_INCIDENTS_ALL_B_EXT',
14676 p_ext_desc_segment1 => l_service_request_rec.external_attribute_1,
14677 p_ext_desc_segment2 => l_service_request_rec.external_attribute_2,
14678 p_ext_desc_segment3 => l_service_request_rec.external_attribute_3,
14679 p_ext_desc_segment4 => l_service_request_rec.external_attribute_4,
14680 p_ext_desc_segment5 => l_service_request_rec.external_attribute_5,
14681 p_ext_desc_segment6 => l_service_request_rec.external_attribute_6,
14682 p_ext_desc_segment7 => l_service_request_rec.external_attribute_7,
14683 p_ext_desc_segment8 => l_service_request_rec.external_attribute_8,
14684 p_ext_desc_segment9 => l_service_request_rec.external_attribute_9,
14685 p_ext_desc_segment10 => l_service_request_rec.external_attribute_10,
14686 p_ext_desc_segment11 => l_service_request_rec.external_attribute_11,
14687 p_ext_desc_segment12 => l_service_request_rec.external_attribute_12,
14688 p_ext_desc_segment13 => l_service_request_rec.external_attribute_13,
14689 p_ext_desc_segment14 => l_service_request_rec.external_attribute_14,
14690 p_ext_desc_segment15 => l_service_request_rec.external_attribute_15,
14691 p_ext_desc_context => l_service_request_rec.external_context,
14692 p_resp_appl_id => p_resp_appl_id,
14693 p_resp_id => p_resp_id,
14694 p_return_status => l_return_status
14695 );
14696
14697 IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
14698 raise FND_API.G_EXC_ERROR;
14699 ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
14700 raise FND_API.G_EXC_UNEXPECTED_ERROR;
14701 END IF;
14702 END IF;
14703
14704 /******** Bug 5216510 spusegao **********/
14705
14706 -- Since we dont care about the org_id parameter passed to the Update
14707 -- Service Request API, we use the
14708 -- org_id stored in the table
14709 -- Use this org_id for all the validations.
14710
14711 l_org_id := l_old_ServiceRequest_rec.org_id;
14712
14713 -- Since Caller type is not updatable.
14714 l_service_request_rec.caller_type := l_old_ServiceRequest_rec.caller_type;
14715
14716 -----------------------------------------------------------
14717 -- In B-B model, customer_id cannot be updated
14718 -- In B-C model, primary contact_id cannot be updated
14719 ---------------------------------------------------------------
14720 -- Check if any records are passed in the contacts table.
14721 -- If so, get the primary contact id.
14722 -- Only one record with primary flag set to Y must be passed.
14723
14724 l_contact_index := p_contacts.FIRST;
14725
14726 -- Flag to indicate records have been passed
14727 IF (l_contact_index IS NULL) THEN
14728 l_contacts_passed := 'N';
14729 ELSE
14730 l_contacts_passed := 'Y';
14731 END IF;
14732
14733 IF (l_service_request_rec.caller_type = 'ORGANIZATION') OR
14734 (l_service_request_rec.caller_type = 'PERSON') THEN
14735 --Customer_id is not updatable
14736 IF (l_service_request_rec.customer_id <> FND_API.G_MISS_NUM) OR
14737 l_service_request_rec.customer_id IS NULL THEN
14738 -- Check if one passed is same as old.
14739 IF (nvl(l_service_request_rec.customer_id,-99) <> nvl(l_old_servicerequest_rec.customer_id,-99) ) THEN
14740
14741 FND_MESSAGE.Set_Name('CS', 'CS_SR_PARAM_NOT_UPDATABLE');
14742 FND_MESSAGE.Set_Token('PARAM_NAME', 'Customer_id');
14743 FND_MSG_PUB.ADD;
14744 RAISE FND_API.G_EXC_ERROR;
14745 END IF; ---customer_id <> old customer_id
14746 ELSE
14747
14748 l_service_request_rec.customer_id := l_old_servicerequest_rec.customer_id ;
14749
14750 IF (l_service_request_rec.customer_number <> FND_API.G_MISS_CHAR)
14751 AND (l_service_request_rec.customer_number IS NOT NULL ) THEN
14752 IF (nvl(l_service_request_rec.customer_number,-99) <> nvl(l_old_servicerequest_rec.customer_number,-99) ) THEN
14753
14754 FND_MESSAGE.Set_Name('CS', 'CS_SR_PARAM_NOT_UPDATABLE');
14755 FND_MESSAGE.Set_Token('PARAM_NAME', 'Customer_number');
14756 FND_MSG_PUB.ADD;
14757 RAISE FND_API.G_EXC_ERROR;
14758 END IF; ---customer_number <> old customer_number
14759 END IF; -- customer number is passed
14760 END IF; ----G_MISS_NUM
14761 ELSE --caller type
14762 NULL;
14763 END IF ; ----caller type
14764
14765 --- Added for HA, the WHO columns should be derived before validating
14766 --- WHO columns
14767 --- if passed null or has G_MISS values.
14768
14769 IF (l_service_request_rec.created_by = FND_API.G_MISS_NUM OR
14770 l_service_request_rec.created_by IS NULL ) THEN
14771 l_service_request_rec.created_by := p_last_updated_by;
14772 END IF;
14773
14774 IF (l_service_request_rec.last_update_login = FND_API.G_MISS_NUM OR
14775 l_service_request_rec.last_update_login IS NULL ) THEN
14776 l_service_request_rec.last_update_login := p_last_update_login;
14777 END IF;
14778
14779 --
14780 -- We first deal with some special validation rules
14781 --
14782 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
14783 --
14784 -- Validate WHO information
14785 --
14786 CS_ServiceRequest_UTIL.Validate_Who_Info
14787 ( p_api_name => l_api_name_full,
14788 p_parameter_name_usr => 'p_last_updated_by',
14789 p_parameter_name_login => 'p_last_update_login',
14790 p_user_id => l_service_request_rec.last_updated_by,
14791 p_login_id => l_service_request_rec.last_update_login,
14792 x_return_status => l_return_status);
14793 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
14794 RAISE FND_API.G_EXC_ERROR;
14795 END IF;
14796
14797 -- Validate p_last_update_by information
14798
14799 IF p_last_updated_by IS NOT NULL AND
14800 p_last_updated_by <> FND_API.G_MISS_NUM THEN
14801
14802
14803 CS_ServiceRequest_UTIL.Validate_Who_Info
14804 ( p_api_name => l_api_name_full,
14805 p_parameter_name_usr => 'p_last_updated_by',
14806 p_parameter_name_login => null,
14807 p_user_id => p_last_updated_by,
14808 p_login_id => null,
14809 x_return_status => l_return_status);
14810
14811 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
14812 RAISE FND_API.G_EXC_ERROR;
14813 END IF;
14814 END IF ;
14815
14816 END IF ; -- p_validation level end if
14817
14818 --
14819 -- Can't update the request type or owner if there is
14820 -- an active workflow. Also, cannot close the service
14821 -- request (by setting the status) if there's an active
14822 -- workflow process in progress unless this procedure
14823 -- itself was called by a workflow process.
14824 --
14825 IF (l_old_ServiceRequest_rec.workflow_process_id IS NOT NULL) AND
14826 CS_Workflow_PKG.Is_Servereq_Item_Active
14827 ( p_request_number => l_old_ServiceRequest_rec.incident_number,
14828 p_wf_process_id => l_old_ServiceRequest_rec.workflow_process_id) = 'Y' AND
14829 ((FND_API.To_Boolean(p_called_by_workflow) = FALSE) OR
14830 (NOT (l_old_ServiceRequest_rec.workflow_process_id = p_workflow_process_id))) THEN
14831
14832 IF (l_service_request_rec.type_id <> FND_API.G_MISS_NUM) AND
14833 (l_service_request_rec.type_id <> l_old_ServiceRequest_rec.incident_type_id) THEN
14834
14835 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
14836 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_TYPE_READONLY');
14837 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
14838 FND_MSG_PUB.ADD;
14839 END IF;
14840 RAISE FND_API.G_EXC_ERROR;
14841 END IF;
14842
14843 IF (l_service_request_rec.owner_id <> FND_API.G_MISS_NUM AND
14844 l_service_request_rec.owner_id <> l_old_ServiceRequest_rec.incident_owner_id) OR
14845 (l_service_request_rec.owner_id IS NULL AND
14846 l_old_ServiceRequest_rec.incident_owner_id IS NOT NULL) OR
14847 (l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM AND
14848 l_service_request_rec.owner_group_id <> l_old_ServiceRequest_rec.owner_group_id) THEN
14849
14850 IF fnd_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
14851 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_OWNER_READONLY');
14852 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
14853 FND_MSG_PUB.ADD;
14854 END IF;
14855 RAISE FND_API.G_EXC_ERROR;
14856 END IF;
14857 END IF; -- Workflow condition
14858
14859 CS_SERVICEREQUEST_UTIL.get_status_details
14860 ( p_status_id => l_old_servicerequest_rec.incident_status_id
14861 , x_close_flag => l_sr_related_data.old_close_flag
14862 , x_disallow_request_update => l_sr_related_data.old_disallow_request_update
14863 , x_disallow_agent_dispatch => l_sr_related_data.old_disallow_owner_update
14864 , x_disallow_product_update => l_sr_related_data.old_disallow_product_update
14865 , x_pending_approval_flag => l_sr_related_data.old_pending_approval_flag
14866 , x_intermediate_status_id => l_sr_related_data.old_intermediate_status_id
14867 , x_approval_action_status_id => l_sr_related_data.old_approval_action_status_id
14868 , x_rejection_action_status_id => l_sr_related_data.old_rejection_action_status_id
14869 , x_return_status => l_return_status
14870 );
14871 l_old_close_flag := l_sr_related_data.old_close_flag;
14872 l_closed_flag_temp := l_old_close_flag;
14873 l_disallow_request_update := l_sr_related_data.old_disallow_request_update;
14874 IF (l_service_request_rec.status_id <> FND_API.G_MISS_NUM AND
14875 l_service_request_rec.status_id <> l_old_servicerequest_rec.incident_status_id)
14876 THEN
14877 IF (l_service_request_rec.type_id = FND_API.G_MISS_NUM) THEN
14878 l_type_id_temp := l_old_ServiceRequest_rec.incident_type_id;
14879 ELSE
14880 l_type_id_temp := l_service_request_rec.type_id;
14881 END IF;
14882
14883 --This part of the code should just check whether the status can be
14884 --updated.Also Aborting the workflow code is based on close flag from
14885 --CS_INCIDENTS_STATUSES and abort_workflow on close flag from
14886 --CS_INCIDENT_TYPES.
14887
14888 -- This functionality is based on the change in the SR status
14889 -- Check if we need to abort the workflow process if the service
14890 -- request is being closed. First we check if the
14891 -- abort_workflow_close_flag for the type_id passed is set to 'Y'
14892 -- then we check if the status of the SR has gone to close for the
14893 -- first time.
14894 -- Check what was the old value of close flag depending on old type id
14895 -- and old status id of SR
14896
14897 -- Get the old value of close flag
14898 -- added disallow_request_update, disallow_agent_dispatch, disallow_product_update to the SQL
14899 -- 3306908 - commented the date validation
14900
14901 IF (l_service_request_rec.last_updated_by = FND_API.G_MISS_NUM OR
14902 l_service_request_rec.last_updated_by IS NULL ) THEN
14903 l_service_request_rec.last_updated_by := p_last_updated_by;
14904 END IF;
14905
14906 CS_SERVICEREQUEST_UTIL.get_status_details
14907 ( p_status_id => l_service_request_rec.status_id
14908 , x_close_flag => l_sr_related_data.close_flag
14909 , x_disallow_request_update => l_sr_related_data.disallow_request_update
14910 , x_disallow_agent_dispatch => l_sr_related_data.disallow_owner_update
14911 , x_disallow_product_update => l_sr_related_data.disallow_product_update
14912 , x_pending_approval_flag => l_sr_related_data.pending_approval_flag
14913 , x_intermediate_status_id => l_sr_related_data.intermediate_status_id
14914 , x_approval_action_status_id => l_sr_related_data.approval_action_status_id
14915 , x_rejection_action_status_id => l_sr_related_data.rejection_action_status_id
14916 , x_return_status => l_return_status
14917 );
14918 IF l_return_status <> FND_API.G_RET_STS_SUCCESS
14919 THEN
14920 l_return_status := FND_API.G_RET_STS_ERROR;
14921 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
14922 ( p_token_an => l_api_name_full
14923 , p_token_v => TO_CHAR(l_service_request_rec.status_id)
14924 , p_token_p => 'p_status_id'
14925 , p_table_name => G_TABLE_NAME
14926 , p_column_name => 'INCIDENT_STATUS_ID'
14927 );
14928
14929 RAISE FND_API.G_EXC_ERROR;
14930 END IF;
14931 l_new_close_flag := l_sr_related_data.close_flag;
14932 l_closed_flag_temp := l_sr_related_data.close_flag;
14933
14934 -- -------------------------------------------------------------
14935 -- Check if the passsed type_id has Abort Workflow Close flag set to 'Y'.
14936 -- If so, get the workflow name asociated with that type_id
14937 -- Check the close flag from the status table.
14938 -- -------------------------------------------------------------
14939
14940 BEGIN
14941 -- Initialize the return status.
14942 l_return_status := FND_API.G_RET_STS_SUCCESS;
14943 -- Verify the type ID against the database.
14944 -- Suppose type is not updated and old type is end date and then cond on start and
14945 -- end dates will cause no dat found. old value of type id even if it is end dated
14946 -- should not cause any error.
14947 SELECT autolaunch_workflow_flag, abort_workflow_close_flag, workflow
14948 INTO x_autolaunch_wkf_flag, x_abort_wkf_close_flag, x_wkf_process_name
14949 FROM cs_incident_types
14950 WHERE incident_type_id = l_type_id_temp
14951 AND incident_subtype = G_SR_SUBTYPE
14952 ;
14953
14954 EXCEPTION
14955 WHEN NO_DATA_FOUND THEN
14956 l_return_status := FND_API.G_RET_STS_ERROR;
14957
14958 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
14959 ( p_token_an => l_api_name_full,
14960 p_token_v => TO_CHAR(l_type_id_temp),
14961 p_token_p => 'p_type_id',
14962 p_table_name => G_TABLE_NAME ,
14963 p_column_name => 'INCIDENT_TYPE_ID' );
14964
14965 RAISE FND_API.G_EXC_ERROR;
14966 END ;
14967
14968 -- Fix for 11.5.7 bug 2254288 . These variables are not being set properly.
14969 -- rmanabat 03/12/02
14970 l_abort_workflow_close_flag := x_abort_wkf_close_flag;
14971 l_autolaunch_workflow_flag := x_autolaunch_wkf_flag;
14972
14973 -- Call Abort workflow, if the status is being changed to CLOSE and the
14974 -- abort workflow on close flag is set to Y and there is an active
14975 -- workflow process in progress.
14976
14977 IF (l_abort_workflow_close_flag = 'Y') THEN
14978 IF (l_old_close_flag = 'N' OR l_old_close_flag IS NULL)
14979 AND (l_closed_flag_temp='Y')
14980 AND (CS_Workflow_PKG.Is_Servereq_Item_Active
14981 (p_request_number => l_old_ServiceRequest_rec.incident_number,
14982 p_wf_process_id => l_old_ServiceRequest_rec.workflow_process_id ) = 'Y')
14983 THEN
14984 CS_Workflow_PKG.Abort_Servereq_Workflow
14985 (p_request_number => l_old_ServiceRequest_rec.incident_number,
14986 p_wf_process_id => l_old_ServiceRequest_rec.workflow_process_id,
14987 p_user_id => p_last_updated_by);
14988 END IF;
14989 END IF;
14990 --l_status_validated := TRUE;
14991 -- for bug 3640344 - pkesani
14992 ELSE
14993 l_sr_related_data.close_flag := l_sr_related_data.old_close_flag;
14994 -- since SR status is not changed all new flag will be same as old flag
14995 l_sr_related_data.pending_approval_flag := l_sr_related_data.old_pending_approval_flag;
14996 END IF ; /* status id changed end if */
14997
14998 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
14999 -- If this flag is set to Y, update only status and return
15000 -- if last_update_program_code is g_miss_char then it is replaced with 'UNKNOWN'
15001 -- value from old record is not used for this attribute. so the condition below too
15002 -- does not check old value rec in case of g_miss_char.
15003 IF (l_sr_related_data.old_disallow_request_update = 'Y') THEN
15004 -- if disallow request update is ON and SR is in intermediate status
15005 -- then only ERES can update service request. if updating program in
15006 -- other than ERES then raise error and exit.
15007
15008 IF l_sr_related_data.old_pending_approval_flag = 'Y' AND
15009 NVL(l_service_requesT_rec.last_update_program_code,'UNKNOWN') <> 'ERES'
15010 THEN
15011 FND_MESSAGE.Set_Name('CS', 'CS_SR_APPROVAL_NEEDED');
15012 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
15013 FND_MSG_PUB.ADD_DETAIL
15014 ( p_associated_column1 => 'CS_INCIDENTS_ALL_B.INCIDENT_STATUS_ID'
15015 );
15016 RAISE FND_API.G_EXC_ERROR;
15017 END IF;
15018 -- if new status has pending approval flag then it means ERES update is in
15019 -- progress and do not call update_status because update_status calls
15020 -- update_servicerequest to process ERES updates
15021 IF l_sr_related_data.pending_approval_flag <> 'Y' AND
15022 NVL(l_service_requesT_rec.last_update_program_code,'UNKNOWN') <> 'ERES'
15023 THEN
15024 x_service_request_rec := l_service_request_rec;
15025 RAISE OnlyUpdStatus ;
15026 END IF;
15027 END IF;
15028
15029 IF (l_sr_related_data.old_disallow_owner_update = 'Y') THEN
15030
15031 -- Tell the user he cannot update owner and store old value in the field
15032 IF (NVL(l_service_request_rec.owner_id,-9) <> FND_API.G_MISS_NUM AND
15033 NVL(l_service_request_rec.owner_id,-9) <> NVL(l_old_servicerequest_rec.incident_owner_id,-9)) OR
15034 (NVL(l_service_request_rec.resource_type,'x') <> FND_API.G_MISS_CHAR AND
15035 NVL(l_service_request_rec.resource_type,'x') <> NVL(l_old_servicerequest_rec.resource_type,'x'))
15036 THEN
15037 --IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
15038 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_OWNER_NOT_UPDATED');
15039 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
15040 FND_MSG_PUB.ADD_DETAIL
15041 ( p_message_type=>FND_MSG_PUB.G_INFORMATION_MSG
15042 , p_associated_column1 => 'CS_INCIDENTS_ALL_B.incident_owner_id'
15043 );
15044 --END IF;
15045 END IF;
15046 l_service_request_rec.owner_id := l_old_ServiceRequest_rec.incident_owner_id;
15047 l_service_request_rec.resource_type := l_old_ServiceRequest_rec.resource_type;
15048
15049 END IF;
15050
15051
15052 IF (l_sr_related_data.old_disallow_product_update = 'Y') THEN
15053 -- Tell the user he cannot update product and related fields and store
15054 -- old value in the field.Check if install_base or not
15055 IF (l_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM) THEN
15056 l_service_request_rec.customer_product_id := l_old_ServiceRequest_rec.customer_product_id;
15057 l_service_request_rec.cp_component_id := l_old_servicerequest_rec.cp_component_id;
15058 l_service_request_rec.cp_component_version_id := l_old_servicerequest_rec.cp_component_version_id;
15059 l_service_request_rec.cp_subcomponent_id := l_old_servicerequest_rec.cp_subcomponent_id;
15060 l_service_request_rec.cp_subcomponent_version_id := l_old_servicerequest_rec.cp_subcomponent_version_id;
15061 l_service_request_rec.cp_revision_id := l_old_servicerequest_rec.cp_revision_id;
15062 l_service_request_rec.product_revision := l_old_servicerequest_rec.product_revision;
15063 l_service_request_rec.component_version := l_old_servicerequest_rec.component_version;
15064 l_service_request_rec.subcomponent_version := l_old_servicerequest_rec.subcomponent_version;
15065 ELSE
15066 -- Inv fields
15067 -- Below two fields will have value only if it is not installed base.
15068 l_service_request_rec.original_order_number := l_old_ServiceRequest_rec.original_order_number;
15069 l_service_request_rec.purchase_order_num := l_old_ServiceRequest_rec.purchase_order_num;
15070 l_service_request_rec.inv_item_revision := l_old_ServiceRequest_rec.inv_item_revision;
15071 l_service_request_rec.inv_component_id := l_old_ServiceRequest_rec.inv_component_id;
15072 l_service_request_rec.inv_component_version := l_old_ServiceRequest_rec.inv_component_version ;
15073 l_service_request_rec.inv_subcomponent_id := l_old_ServiceRequest_rec.inv_subcomponent_id ;
15074 l_service_request_rec.inv_subcomponent_version :=l_old_ServiceRequest_rec.inv_subcomponent_version ;
15075 END IF;
15076
15077 --These are fields which will have value irrespective of Installed base or not.
15078 l_service_request_rec.inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id;
15079 l_service_request_rec.current_serial_number :=l_old_ServiceRequest_rec.current_serial_number;
15080
15081 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
15082 FND_MESSAGE.Set_Name('CS', 'CS_API_SR_PRODUCT_NOT_UPDATED');
15083 FND_MESSAGE.Set_Token('API_NAME', l_api_name_full);
15084 FND_MSG_PUB.ADD;
15085 END IF;
15086 END IF;
15087 END IF; /* end of validation level check */
15088
15089 --
15090 -- For each column in the table, we have a corresponding local variable.
15091 -- These local variables will be used in the actual UPDATE SQL statement.
15092 -- If a column is being updated, we need to initialize the corresponding
15093 -- local variable to the value of the parameter that was passed in; otherwise,
15094 -- the the local variable should be set to the original value in the table.
15095 --
15096 -- In addition, if the column that is being updated requires validation, then
15097 -- we need to set the corresponding field in the validation record. For
15098 -- validation, we always store the values into the validation record, however,
15099 -- the validation routine is called depending on the value of the validation
15100 -- level parameter.
15101 --
15102 -- We also keep track of changes in the fields that are audited by setting
15103 -- the audit records when changes are detected
15104 --
15105 -- -----------------------------------------------------------------
15106 -- Check the header fields: type, status, severity, urgency, owner,
15107 -- publish flag and summary. All but summary need to be validated if
15108 -- the validation level is set.
15109 -- -----------------------------------------------------------------
15110
15111 IF (l_service_request_rec.type_id = FND_API.G_MISS_NUM) OR
15112 (nvl(l_service_request_rec.type_id,-99) = nvl(l_old_ServiceRequest_rec.incident_type_id,-99))
15113 THEN
15114 l_service_request_rec.type_id := l_old_ServiceRequest_rec.incident_type_id;
15115 -- For audit record added by shijain
15116 x_audit_vals_rec.change_incident_type_flag := 'N';
15117 x_audit_vals_rec.old_incident_type_id := l_old_ServiceRequest_rec.incident_type_id;
15118 x_audit_vals_rec.incident_type_id := l_service_request_rec.type_id;
15119 ELSE
15120 l_SR_Validation_rec.validate_type := FND_API.G_TRUE;
15121 l_SR_Validation_rec.type_id := l_service_request_rec.type_id;
15122 l_SR_Validation_rec.old_type_id := l_old_ServiceRequest_rec.incident_type_id;
15123
15124 -- Since the validation of type depends on the value of status,
15125 -- we need to also set the status_id field in the validation record.
15126 IF (l_service_request_rec.status_id = FND_API.G_MISS_NUM) OR
15127 (nvl(l_service_request_rec.status_id,-99) = nvl(l_old_ServiceRequest_rec.incident_status_id,-99))THEN
15128 l_SR_Validation_rec.status_id := l_old_ServiceRequest_rec.incident_status_id;
15129 l_SR_Validation_rec.validate_status := FND_API.G_TRUE;
15130 ELSE
15131 -- This needs to be done here, cause if both type and status change,
15132 -- then status_id will be overwritten by the old status id in the
15133 -- (status change) loop below.
15134
15135 l_SR_Validation_rec.updated_status_id := l_service_request_rec.status_id;
15136 l_SR_Validation_rec.validate_updated_status := FND_API.G_TRUE;
15137 -- This flag is needed cause we have to assign the appropriate status id
15138 -- to the Validate_Type Procedure
15139
15140 l_SR_Validation_rec.status_id_change := FND_API.G_TRUE;
15141
15142 END IF;
15143 -- For audit record
15144 x_audit_vals_rec.CHANGE_INCIDENT_TYPE_FLAG := 'Y';
15145 x_audit_vals_rec.OLD_INCIDENT_TYPE_ID := l_old_ServiceRequest_rec.incident_type_id;
15146 x_audit_vals_rec.INCIDENT_TYPE_ID := l_service_request_rec.type_id;
15147 END IF;
15148
15149 IF (l_service_request_rec.status_id = FND_API.G_MISS_NUM) OR
15150 (nvl(l_service_request_rec.status_id,-99) = nvl(l_old_ServiceRequest_rec.incident_status_id,-99)) THEN
15151 l_service_request_rec.status_id := l_old_ServiceRequest_rec.incident_status_id;
15152 -- For audit record added by shijain
15153 x_audit_vals_rec.change_incident_status_flag := 'N';
15154 x_audit_vals_rec.old_incident_status_id := l_old_ServiceRequest_rec.incident_status_id;
15155 x_audit_vals_rec.incident_status_id := l_service_request_rec.status_id;
15156 ELSE
15157 --IF (l_status_validated = FALSE) THEN
15158 l_SR_Validation_rec.validate_updated_status := FND_API.G_TRUE;
15159
15160 -- We need the old status id to validate the new status id. So, we assign
15161 -- the old status_id to the status_id attribute of the Validation Rec
15162 -- Type and the new status_id is assigned to the updated_status_id
15163 -- attribute of the Validation Rec Type
15164
15165 l_SR_Validation_rec.updated_status_id := l_service_request_rec.status_id;
15166 l_SR_Validation_rec.status_id := l_old_ServiceRequest_rec.incident_status_id;
15167 --
15168 -- Since the validation of status depends on the value of type,
15169 -- we need to also set the type_id field in the validation record.
15170 --
15171 l_SR_Validation_rec.type_id := l_service_request_rec.type_id;
15172 --END IF;
15173 -- For audit record
15174 x_audit_vals_rec.CHANGE_INCIDENT_STATUS_FLAG := 'Y';
15175 x_audit_vals_rec.OLD_INCIDENT_STATUS_ID := l_old_ServiceRequest_rec.incident_status_id;
15176 x_audit_vals_rec.INCIDENT_STATUS_ID := l_service_request_rec.status_id;
15177 END IF;
15178
15179 IF (l_service_request_rec.severity_id = FND_API.G_MISS_NUM) OR
15180 (nvl(l_service_request_rec.severity_id,-99) = nvl(l_old_ServiceRequest_rec.incident_severity_id,-99)) THEN
15181 l_service_request_rec.severity_id := l_old_ServiceRequest_rec.incident_severity_id;
15182 -- For audit record added by shijain
15183 x_audit_vals_rec.change_incident_severity_flag := 'N';
15184 x_audit_vals_rec.old_incident_severity_id := l_old_ServiceRequest_rec.incident_severity_id;
15185 x_audit_vals_rec.incident_severity_id := l_service_request_rec.severity_id;
15186 ELSE
15187 l_SR_Validation_rec.severity_id := l_service_request_rec.severity_id;
15188 -- For audit record
15189 x_audit_vals_rec.CHANGE_INCIDENT_SEVERITY_FLAG := 'Y';
15190 x_audit_vals_rec.OLD_INCIDENT_SEVERITY_ID := l_old_ServiceRequest_rec.incident_severity_id;
15191 x_audit_vals_rec.INCIDENT_SEVERITY_ID := l_service_request_rec.severity_id;
15192 END IF;
15193
15194 IF (l_service_request_rec.urgency_id = FND_API.G_MISS_NUM)
15195 OR
15196 (nvl(l_service_request_rec.urgency_id,-99) = nvl(l_old_ServiceRequest_rec.incident_urgency_id,-99))
15197 THEN
15198
15199 l_service_request_rec.urgency_id := l_old_ServiceRequest_rec.incident_urgency_id;
15200 -- For audit record added by shijain
15201 x_audit_vals_rec.change_incident_urgency_flag := 'N';
15202 x_audit_vals_rec.old_incident_urgency_id := l_old_ServiceRequest_rec.incident_urgency_id;
15203 x_audit_vals_rec.incident_urgency_id := l_service_request_rec.urgency_id;
15204 ELSE
15205 IF (l_service_request_rec.urgency_id IS NOT NULL) THEN
15206 l_SR_Validation_rec.urgency_id := l_service_request_rec.urgency_id;
15207 END IF;
15208 -- For audit record
15209 x_audit_vals_rec.CHANGE_INCIDENT_URGENCY_FLAG := 'Y';
15210 x_audit_vals_rec.OLD_INCIDENT_URGENCY_ID := l_old_ServiceRequest_rec.incident_urgency_id;
15211 x_audit_vals_rec.INCIDENT_URGENCY_ID := l_service_request_rec.urgency_id;
15212 END IF;
15213 -- Added NULL condition for Bug# 2181534
15214
15215 -- commented for 2993526
15216 /* IF (l_service_request_rec.owner_id = FND_API.G_MISS_NUM) OR
15217 (nvl(l_service_request_rec.owner_id,-99) = nvl(l_old_ServiceRequest_rec.incident_owner_id,-99))
15218 THEN
15219 l_service_request_rec.owner_id := l_old_ServiceRequest_rec.incident_owner_id;
15220 l_service_request_rec.owner := l_old_ServiceRequest_rec.owner;
15221
15222 -- for audit record added by shijain
15223 x_audit_vals_rec.change_incident_owner_flag := 'N';
15224 x_audit_vals_rec.old_incident_owner_id := l_old_ServiceRequest_rec.incident_owner_id;
15225 x_audit_vals_rec.incident_owner_id := l_service_request_rec.owner_id;
15226 x_audit_vals_rec.change_assigned_time_flag := 'N';
15227 x_audit_vals_rec.old_owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
15228 x_audit_vals_rec.owner_assigned_time := SYSDATE;
15229 ELSE
15230 l_SR_Validation_rec.owner_id := l_service_request_rec.owner_id;
15231 -- For audit record
15232 ---- Added for Enh# 2216664
15233 IF (l_service_request_rec.owner_id IS NOT NULL AND
15234 l_service_request_rec.owner_id <> FND_API.G_MISS_NUM) THEN
15235 -- for bug 2770831 added Begin End and Exception to handle NO_DATA_FOUND.
15236
15237 BEGIN
15238 SELECT resource_name INTO l_service_request_rec.owner
15239 FROM jtf_rs_resource_extns_tl
15240 WHERE resource_id = l_service_request_rec.owner_id
15241 AND LANGUAGE = USERENV('LANG');
15242 EXCEPTION
15243 WHEN NO_DATA_FOUND THEN
15244 l_return_status := FND_API.G_RET_STS_ERROR;
15245 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
15246 ( p_token_an => l_api_name_full,
15247 p_token_v => TO_CHAR(l_service_request_rec.owner_id),
15248 p_token_p => 'p_owner_id',
15249 p_table_name => G_TABLE_NAME ,
15250 p_column_name => 'INCIDENT_OWNER_ID' );
15251
15252 RAISE FND_API.G_EXC_ERROR;
15253 END;
15254 END IF;
15255 IF (l_service_request_rec.owner_id IS NULL) THEN
15256 l_service_request_rec.owner := NULL;
15257 END IF;
15258
15259 x_audit_vals_rec.CHANGE_INCIDENT_OWNER_FLAG := 'Y';
15260 x_audit_vals_rec.OLD_INCIDENT_OWNER_ID := l_old_ServiceRequest_rec.incident_owner_id;
15261 x_audit_vals_rec.INCIDENT_OWNER_ID := l_service_request_rec.owner_id;
15262 -----Added for Bug# 1874546-----jngeorge------07/18/01
15263 x_audit_vals_rec.change_RESOURCE_TYPE_FLAG := 'Y';
15264 x_audit_vals_rec.OLD_RESOURCE_TYPE := l_old_ServiceRequest_rec.resource_type;
15265 x_audit_vals_rec.RESOURCE_TYPE := l_service_request_rec.resource_type;
15266 x_audit_vals_rec.change_ASSIGNED_TIME_FLAG := 'Y';
15267 x_audit_vals_rec.OLD_OWNER_ASSIGNED_TIME := l_old_ServiceRequest_rec.owner_assigned_time;
15268 x_audit_vals_rec.OWNER_ASSIGNED_TIME := SYSDATE;
15269 END IF; */
15270
15271 --
15272 --2993526
15273 ---
15274 ---
15275 IF (l_service_request_rec.owner_id = FND_API.G_MISS_NUM) OR
15276 (nvl(l_service_request_rec.owner_id,-99) = nvl(l_old_ServiceRequest_rec.incident_owner_id,-99))
15277 THEN
15278 l_service_request_rec.owner_id := l_old_ServiceRequest_rec.incident_owner_id;
15279 ELSE
15280 l_SR_Validation_rec.owner_id := l_service_request_rec.owner_id;
15281 END IF;
15282 --
15283 -- Group Type
15284 -- if Group id passed and group type is not passed and old value is null then set group type from profile
15285 --
15286 IF (l_service_request_rec.group_type = FND_API.G_MISS_CHAR AND
15287 l_old_servicerequest_rec.group_type is null AND
15288 l_service_request_rec.owner_group_id <> FND_API.G_MISS_NUM) THEN
15289 l_service_request_rec.group_type := nvl( FND_PROFILE.value('CS_SR_DEFAULT_GROUP_TYPE'), 'RS_GROUP');
15290 END IF;
15291 IF (l_service_request_rec.group_type = FND_API.G_MISS_CHAR) OR
15292 (nvl(l_service_request_rec.group_type,'-99') = nvl(l_old_ServiceRequest_rec.group_type,'-99')) THEN
15293 l_service_request_rec.group_type := l_old_ServiceRequest_rec.group_type;
15294 ELSE
15295 l_SR_Validation_rec.group_type := l_service_request_rec.group_type;
15296 END IF;
15297 -- Owner Group ID
15298 IF (l_service_request_rec.owner_group_id = FND_API.G_MISS_NUM) OR
15299 (l_service_request_rec.owner_group_id IS NULL AND
15300 l_old_ServiceRequest_rec.owner_group_id IS NULL) OR
15301 (l_service_request_rec.owner_group_id = l_old_ServiceRequest_rec.owner_group_id) THEN
15302 l_service_request_rec.owner_group_id := l_old_ServiceRequest_rec.owner_group_id;
15303 ELSE
15304 l_SR_Validation_rec.owner_group_id := l_service_request_rec.owner_group_id;
15305 l_SR_Validation_rec.group_type := l_service_request_rec.group_type;
15306 END IF;
15307
15308 IF (l_service_request_rec.inv_platform_org_id = FND_API.G_MISS_NUM) OR
15309 (nvl(l_service_request_rec.inv_platform_org_id,-99) = nvl(l_old_ServiceRequest_rec.inv_platform_org_id,-99)) THEN
15310 l_service_request_rec.inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
15311 -- For audit record added by shijain
15312 x_audit_vals_rec.change_platform_org_id_flag := 'N';
15313 x_audit_vals_rec.old_inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
15314 x_audit_vals_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
15315 ELSE
15316 -- For audit record
15317 x_audit_vals_rec.change_platform_org_id_FLAG := 'Y';
15318 x_audit_vals_rec.OLD_inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
15319 x_audit_vals_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
15320 END IF;
15321
15322 IF ((l_service_request_rec.publish_flag = FND_API.G_MISS_CHAR) OR
15323 (l_service_request_rec.publish_flag = l_old_ServiceRequest_rec.publish_flag)) THEN
15324 l_service_request_rec.publish_flag := l_old_ServiceRequest_rec.publish_flag;
15325 ELSE
15326 l_SR_Validation_rec.publish_flag := l_service_request_rec.publish_flag;
15327 END IF;
15328
15329 IF (l_service_request_rec.summary = FND_API.G_MISS_CHAR) OR
15330 (l_service_request_rec.summary = l_old_ServiceRequest_rec.summary) THEN
15331 l_service_request_rec.summary := l_old_ServiceRequest_rec.summary;
15332 END IF;
15333
15334 ---- Added for Enh# 1830701
15335 IF (l_service_request_rec.incident_occurred_date = FND_API.G_MISS_DATE) OR
15336 (l_service_request_rec.incident_occurred_date = l_old_ServiceRequest_rec.incident_occurred_date) THEN
15337 l_service_request_rec.incident_occurred_date := l_old_ServiceRequest_rec.incident_occurred_date;
15338 ELSE
15339 l_SR_Validation_rec.incident_occurred_date := l_service_request_rec.incident_occurred_date;
15340 END IF;
15341
15342 IF (l_service_request_rec.incident_resolved_date = FND_API.G_MISS_DATE) OR
15343 (l_service_request_rec.incident_resolved_date = l_old_ServiceRequest_rec.incident_resolved_date) THEN
15344 l_service_request_rec.incident_resolved_date := l_old_ServiceRequest_rec.incident_resolved_date;
15345 ELSE
15346 l_SR_Validation_rec.incident_resolved_date := l_service_request_rec.incident_resolved_date;
15347 END IF;
15348
15349 IF (l_service_request_rec.inc_responded_by_date = FND_API.G_MISS_DATE) OR
15350 (l_service_request_rec.inc_responded_by_date = l_old_ServiceRequest_rec.inc_responded_by_date) THEN
15351 l_service_request_rec.inc_responded_by_date := l_old_ServiceRequest_rec.inc_responded_by_date;
15352 ELSE
15353 l_SR_Validation_rec.inc_responded_by_date := l_service_request_rec.inc_responded_by_date;
15354 END IF;
15355
15356 -- 12/13/2005 smisra bug 4386870
15357 -- if there is no change in incident location then country too should not change ecause it is
15358 -- derived from location
15359 IF l_service_request_rec.incident_location_id = l_old_servicerequest_rec.incident_location_id OR
15360 (l_service_request_rec.incident_location_id = FND_API.G_MISS_NUM AND
15361 l_old_servicerequest_rec.incident_location_id IS NOT NULL)
15362 THEN
15363 l_service_request_rec.incident_country := l_old_ServiceRequest_rec.incident_country;
15364 END IF;
15365 ---- Added for Enh# 222054
15366 -- Modified for Misc ERs project of 11.5.10 --anmukher --08/29/03
15367 IF (l_service_request_rec.incident_location_id = FND_API.G_MISS_NUM) OR
15368 (l_service_request_rec.incident_location_id = l_old_ServiceRequest_rec.incident_location_id
15369 AND l_service_request_rec.incident_location_type = l_old_ServiceRequest_rec.incident_location_type) THEN
15370 l_service_request_rec.incident_location_id := l_old_ServiceRequest_rec.incident_location_id;
15371 l_service_request_rec.incident_location_type := l_old_ServiceRequest_rec.incident_location_type;
15372 /* 12/13/05 smisra bug 4386870
15373 These is no need to copy location id and type
15374 to validation record vecause location validation is moved to vldt_sr_rec
15375 ELSE
15376 l_SR_Validation_rec.incident_location_id := l_service_request_rec.incident_location_id;
15377 l_SR_Validation_rec.incident_location_type := l_service_request_rec.incident_location_type;
15378 ***/
15379 END IF;
15380 IF (l_service_request_rec.incident_location_id is NULL OR
15381 (l_service_request_rec.incident_location_id = FND_API.G_MISS_NUM AND
15382 l_old_servicerequest_rec.incident_location_id IS NULL )) AND
15383 l_service_request_rec.incident_country <> FND_API.G_MISS_CHAR AND
15384 l_service_request_rec.incident_country <> NVL(l_old_servicerequest_rec.incident_country,'####')
15385 THEN
15386 l_SR_Validation_rec.incident_country := l_service_request_rec.incident_country;
15387 END IF;
15388 -- Bug 3420335
15389 -- if incident_location_id is being set to Null then location_type to be set to null
15390 IF (l_service_request_rec.incident_location_id is NULL) then
15391 l_service_request_rec.incident_location_type := NULL;
15392 END IF;
15393
15394 /*
15395 -- Added for Misc ERs project of 11.5.10 --anmukher --08/26/03
15396 IF (l_service_request_rec.incident_location_type = FND_API.G_MISS_CHAR) OR
15397 (l_service_request_rec.incident_location_type = l_old_ServiceRequest_rec.incident_location_type) THEN
15398 l_service_request_rec.incident_location_type := l_old_ServiceRequest_rec.incident_location_type;
15399 ELSE
15400 l_SR_Validation_rec.incident_location_type := l_service_request_rec.incident_location_type;
15401 END IF;
15402 */
15403
15404 IF (l_service_request_rec.customer_site_id = FND_API.G_MISS_NUM) OR
15405 (l_service_request_rec.customer_site_id = l_old_ServiceRequest_rec.customer_site_id) THEN
15406 l_service_request_rec.customer_site_id := l_old_ServiceRequest_rec.customer_site_id;
15407 END IF;
15408
15409 IF (l_service_request_rec.error_code = FND_API.G_MISS_CHAR) OR
15410 (l_service_request_rec.error_code = l_old_ServiceRequest_rec.error_code) THEN
15411 l_service_request_rec.error_code := l_old_ServiceRequest_rec.error_code;
15412 END IF;
15413
15414 IF (l_service_request_rec.incident_address = FND_API.G_MISS_CHAR) OR
15415 (l_service_request_rec.incident_address = l_old_ServiceRequest_rec.incident_address) THEN
15416 l_service_request_rec.incident_address := l_old_ServiceRequest_rec.incident_address;
15417 END IF;
15418
15419 IF (l_service_request_rec.incident_city = FND_API.G_MISS_CHAR) OR
15420 (l_service_request_rec.incident_city = l_old_ServiceRequest_rec.incident_city) THEN
15421 l_service_request_rec.incident_city := l_old_ServiceRequest_rec.incident_city;
15422 END IF;
15423
15424 IF (l_service_request_rec.incident_state = FND_API.G_MISS_CHAR) OR
15425 (l_service_request_rec.incident_state = l_old_ServiceRequest_rec.incident_state) THEN
15426 l_service_request_rec.incident_state := l_old_ServiceRequest_rec.incident_state;
15427 END IF;
15428
15429 IF (l_service_request_rec.incident_country = FND_API.G_MISS_CHAR) OR
15430 (l_service_request_rec.incident_country = l_old_ServiceRequest_rec.incident_country) THEN
15431 l_service_request_rec.incident_country := l_old_ServiceRequest_rec.incident_country;
15432 END IF;
15433
15434 IF (l_service_request_rec.incident_province = FND_API.G_MISS_CHAR) OR
15435 (l_service_request_rec.incident_province = l_old_ServiceRequest_rec.incident_province) THEN
15436 l_service_request_rec.incident_province := l_old_ServiceRequest_rec.incident_province;
15437 END IF;
15438
15439 IF (l_service_request_rec.incident_postal_code = FND_API.G_MISS_CHAR) OR
15440 (l_service_request_rec.incident_postal_code = l_old_ServiceRequest_rec.incident_postal_code) THEN
15441 l_service_request_rec.incident_postal_code := l_old_ServiceRequest_rec.incident_postal_code;
15442 END IF;
15443
15444 IF (l_service_request_rec.incident_county = FND_API.G_MISS_CHAR) OR
15445 (l_service_request_rec.incident_county = l_old_ServiceRequest_rec.incident_county) THEN
15446 l_service_request_rec.incident_county := l_old_ServiceRequest_rec.incident_county;
15447 END IF;
15448
15449 IF (l_service_request_rec.resolution_summary = FND_API.G_MISS_CHAR) OR
15450 (l_service_request_rec.resolution_summary = l_old_ServiceRequest_rec.resolution_summary) THEN
15451 l_service_request_rec.resolution_summary := l_old_ServiceRequest_rec.resolution_summary;
15452 END IF;
15453
15454 -- Added for address fields related changes by shijain
15455 IF (l_service_request_rec.incident_point_of_interest = FND_API.G_MISS_CHAR)
15456 OR
15457 (nvl(l_service_request_rec.incident_point_of_interest,-99) = nvl(l_old_ServiceRequest_rec.incident_point_of_interest,-99))
15458 THEN
15459 l_service_request_rec.incident_point_of_interest := l_old_ServiceRequest_rec.incident_point_of_interest;
15460 END IF;
15461
15462 IF (l_service_request_rec.incident_cross_street = FND_API.G_MISS_CHAR) OR
15463 (l_service_request_rec.incident_cross_street = l_old_ServiceRequest_rec.incident_cross_street)
15464 THEN
15465 l_service_request_rec.incident_cross_street := l_old_ServiceRequest_rec.incident_cross_street;
15466 END IF;
15467
15468 IF (l_service_request_rec.incident_direction_qualifier = FND_API.G_MISS_CHAR)
15469 OR
15470 (l_service_request_rec.incident_direction_qualifier = l_old_ServiceRequest_rec.incident_direction_qualifier)
15471 THEN
15472 l_service_request_rec.incident_direction_qualifier := l_old_ServiceRequest_rec.incident_direction_qualifier;
15473 END IF;
15474
15475 IF (l_service_request_rec.incident_distance_qualifier = FND_API.G_MISS_CHAR)
15476 OR
15477 (l_service_request_rec.incident_distance_qualifier = l_old_ServiceRequest_rec.incident_distance_qualifier )
15478 THEN
15479 l_service_request_rec.incident_distance_qualifier := l_old_ServiceRequest_rec.incident_distance_qualifier ;
15480 END IF;
15481
15482 IF (l_service_request_rec.incident_distance_qual_uom = FND_API.G_MISS_CHAR)
15483 OR
15484 (l_service_request_rec.incident_distance_qual_uom = l_old_ServiceRequest_rec.incident_distance_qual_uom )
15485 THEN
15486 l_service_request_rec.incident_distance_qual_uom := l_old_ServiceRequest_rec.incident_distance_qual_uom ;
15487 END IF;
15488
15489 IF (l_service_request_rec.incident_address2 = FND_API.G_MISS_CHAR) OR
15490 (l_service_request_rec.incident_address2 = l_old_ServiceRequest_rec.incident_address2 )
15491 THEN
15492 l_service_request_rec.incident_address2 := l_old_ServiceRequest_rec.incident_address2 ;
15493 END IF;
15494
15495 IF (l_service_request_rec.incident_address3 = FND_API.G_MISS_CHAR) OR
15496 (l_service_request_rec.incident_address3 = l_old_ServiceRequest_rec.incident_address3 )
15497 THEN
15498 l_service_request_rec.incident_address3 := l_old_ServiceRequest_rec.incident_address3 ;
15499 END IF;
15500
15501 IF (l_service_request_rec.incident_address4 = FND_API.G_MISS_CHAR) OR
15502 (l_service_request_rec.incident_address4 = l_old_ServiceRequest_rec.incident_address4 )
15503 THEN
15504 l_service_request_rec.incident_address4 := l_old_ServiceRequest_rec.incident_address4 ;
15505 END IF;
15506
15507 IF (l_service_request_rec.incident_address_style = FND_API.G_MISS_CHAR) OR
15508 (l_service_request_rec.incident_address_style = l_old_ServiceRequest_rec.incident_address_style )
15509 THEN
15510 l_service_request_rec.incident_address_style := l_old_ServiceRequest_rec.incident_address_style ;
15511 END IF;
15512
15513 IF (l_service_request_rec.incident_addr_lines_phonetic = FND_API.G_MISS_CHAR)
15514 OR
15515 (l_service_request_rec.incident_addr_lines_phonetic = l_old_ServiceRequest_rec.incident_addr_lines_phonetic )
15516 THEN
15517 l_service_request_rec.incident_addr_lines_phonetic := l_old_ServiceRequest_rec.incident_addr_lines_phonetic ;
15518 END IF;
15519
15520 IF (l_service_request_rec.incident_po_box_number = FND_API.G_MISS_CHAR) OR
15521 (l_service_request_rec.incident_po_box_number = l_old_ServiceRequest_rec.incident_po_box_number )
15522 THEN
15523 l_service_request_rec.incident_po_box_number := l_old_ServiceRequest_rec.incident_po_box_number ;
15524 END IF;
15525
15526 IF (l_service_request_rec.incident_house_number = FND_API.G_MISS_CHAR) OR
15527 (l_service_request_rec.incident_house_number = l_old_ServiceRequest_rec.incident_house_number ) THEN
15528 l_service_request_rec.incident_house_number := l_old_ServiceRequest_rec.incident_house_number ;
15529 END IF;
15530
15531 IF (l_service_request_rec.incident_street_suffix = FND_API.G_MISS_CHAR) OR
15532 (l_service_request_rec.incident_street_suffix = l_old_ServiceRequest_rec.incident_street_suffix)
15533 THEN
15534 l_service_request_rec.incident_street_suffix := l_old_ServiceRequest_rec.incident_street_suffix ;
15535 END IF;
15536
15537 IF (l_service_request_rec.incident_street = FND_API.G_MISS_CHAR) OR
15538 (l_service_request_rec.incident_street = l_old_ServiceRequest_rec.incident_street)
15539 THEN
15540 l_service_request_rec.incident_street := l_old_ServiceRequest_rec.incident_street;
15541 END IF;
15542
15543 IF (l_service_request_rec.incident_street_number = FND_API.G_MISS_CHAR) OR
15544 (l_service_request_rec.incident_street_number = l_old_ServiceRequest_rec.incident_street_number)
15545 THEN
15546 l_service_request_rec.incident_street_number := l_old_ServiceRequest_rec.incident_street_number;
15547 END IF;
15548
15549 IF (l_service_request_rec.incident_floor = FND_API.G_MISS_CHAR) OR
15550 (l_service_request_rec.incident_floor = l_old_ServiceRequest_rec.incident_floor)
15551 THEN
15552 l_service_request_rec.incident_floor := l_old_ServiceRequest_rec.incident_floor;
15553 END IF;
15554
15555 IF (l_service_request_rec.incident_suite = FND_API.G_MISS_CHAR) OR
15556 (l_service_request_rec.incident_suite = l_old_ServiceRequest_rec.incident_suite) THEN
15557 l_service_request_rec.incident_suite := l_old_ServiceRequest_rec.incident_suite;
15558 END IF;
15559
15560 IF (l_service_request_rec.incident_postal_plus4_code = FND_API.G_MISS_CHAR) OR
15561 (l_service_request_rec.incident_postal_plus4_code = l_old_ServiceRequest_rec.incident_postal_plus4_code)
15562 THEN
15563 l_service_request_rec.incident_postal_plus4_code:= l_old_ServiceRequest_rec.incident_postal_plus4_code;
15564 END IF;
15565
15566 IF (l_service_request_rec.incident_position = FND_API.G_MISS_CHAR) OR
15567 (l_service_request_rec.incident_position = l_old_ServiceRequest_rec.incident_position)
15568 THEN
15569 l_service_request_rec.incident_position := l_old_ServiceRequest_rec.incident_position;
15570 END IF;
15571
15572 IF (l_service_request_rec.incident_location_directions = FND_API.G_MISS_CHAR)
15573 OR
15574 (l_service_request_rec.incident_location_directions = l_old_ServiceRequest_rec.incident_location_directions)
15575 THEN
15576 l_service_request_rec.incident_location_directions:= l_old_ServiceRequest_rec.incident_location_directions;
15577 END IF;
15578
15579 IF (l_service_request_rec.incident_location_description = FND_API.G_MISS_CHAR)
15580 OR
15581 (l_service_request_rec.incident_location_description = l_old_ServiceRequest_rec.incident_location_description)
15582 THEN
15583 l_service_request_rec.incident_location_description := l_old_ServiceRequest_rec.incident_location_description;
15584 END IF;
15585
15586 IF (l_service_request_rec.install_site_id = FND_API.G_MISS_NUM) OR
15587 (l_service_request_rec.install_site_id = l_old_ServiceRequest_rec.INSTALL_SITE_ID)
15588 THEN
15589 l_service_request_rec.install_site_id := l_old_ServiceRequest_rec.INSTALL_SITE_ID;
15590 END IF;
15591
15592 IF (l_service_request_rec.owner_assigned_flag = FND_API.G_MISS_CHAR) OR
15593 (l_service_request_rec.owner_assigned_flag = l_old_ServiceRequest_rec.owner_assigned_flag )
15594 THEN
15595 l_service_request_rec.owner_assigned_flag := l_old_ServiceRequest_rec.owner_assigned_flag ;
15596 END IF;
15597 IF (l_service_request_rec.group_territory_id = FND_API.G_MISS_NUM) OR
15598 (l_service_request_rec.group_territory_id = l_old_ServiceRequest_rec.group_territory_id )
15599 THEN
15600 l_service_request_rec.group_territory_id := l_old_ServiceRequest_rec.group_territory_id ;
15601 END IF;
15602
15603 IF (l_service_request_rec.obligation_date = FND_API.G_MISS_DATE) OR
15604 (l_service_request_rec.obligation_date IS NULL AND
15605 l_old_ServiceRequest_rec.obligation_date IS NULL) OR
15606 (l_service_request_rec.obligation_date = l_old_ServiceRequest_rec.obligation_date) THEN
15607 l_service_request_rec.obligation_date := l_old_ServiceRequest_rec.obligation_date;
15608 -- For audit record added by shijain
15609 x_audit_vals_rec.change_obligation_flag := 'N';
15610 x_audit_vals_rec.old_obligation_date := l_old_ServiceRequest_rec.obligation_date;
15611 x_audit_vals_rec.obligation_date := l_service_request_rec.obligation_date;
15612 ELSE
15613 -- For audit record
15614 x_audit_vals_rec.change_obligation_FLAG := 'Y';
15615 x_audit_vals_rec.OLD_obligation_date := l_old_ServiceRequest_rec.obligation_date;
15616 x_audit_vals_rec.obligation_date := l_service_request_rec.obligation_date;
15617 END IF;
15618
15619
15620 IF (l_service_request_rec.inventory_item_id = FND_API.G_MISS_NUM) OR
15621 (nvl(l_service_request_rec.inventory_item_id,-99) = nvl(l_old_ServiceRequest_rec.inventory_item_id,-99))
15622 THEN
15623 l_service_request_rec.inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id;
15624
15625 -- For bug 2907824 we need the inventory_item_id for validation of dependent fields
15626 -- like inv_item_revision, so we set the old value from the DB to the Validation record.
15627 l_SR_Validation_rec.inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id;
15628
15629 -- For audit record added by shijain
15630 x_audit_vals_rec.change_inventory_item_flag := 'N';
15631 x_audit_vals_rec.old_inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id ;
15632 x_audit_vals_rec.inventory_item_id := l_service_request_rec.inventory_item_id ;
15633 ELSE
15634 -- For audit record
15635 x_audit_vals_rec.CHANGE_inventory_item_flag := 'Y';
15636 x_audit_vals_rec.OLD_inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id ;
15637 x_audit_vals_rec.inventory_item_id := l_service_request_rec.inventory_item_id ;
15638
15639 END IF;
15640
15641 -- For incident date audit record added by shijain
15642 IF (l_service_request_rec.request_date = FND_API.G_MISS_DATE) OR
15643 (l_service_request_rec.request_date IS NULL AND
15644 l_old_ServiceRequest_rec.incident_date IS NULL) OR
15645 (l_service_request_rec.request_date = l_old_ServiceRequest_rec.incident_date)
15646 THEN
15647 l_service_request_rec.request_date := l_old_ServiceRequest_rec.incident_date;
15648 -- For audit record
15649 x_audit_vals_rec.change_incident_date_flag := 'N';
15650 x_audit_vals_rec.old_incident_date := l_old_ServiceRequest_rec.incident_date ;
15651 x_audit_vals_rec.incident_date := l_service_request_rec.request_date ;
15652 ELSE
15653 -- For audit record
15654 x_audit_vals_rec.CHANGE_incident_date_flag := 'Y';
15655 x_audit_vals_rec.OLD_incident_date := l_old_ServiceRequest_rec.incident_date ;
15656 x_audit_vals_rec.incident_date := l_service_request_rec.request_date ;
15657 END IF;
15658
15659 -- 2993526
15660 -- For owner assigned time audit record added by shijain
15661 /*
15662 IF (l_service_request_rec.owner_assigned_time = FND_API.G_MISS_DATE) OR
15663 (l_service_request_rec.owner_assigned_time IS NULL AND
15664 l_old_ServiceRequest_rec.owner_assigned_time IS NULL) OR
15665 (l_service_request_rec.owner_assigned_time = l_old_ServiceRequest_rec.owner_assigned_time)
15666 THEN
15667 l_service_request_rec.owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
15668 -- For audit record
15669 x_audit_vals_rec.change_assigned_time_flag := 'N';
15670 x_audit_vals_rec.old_owner_assigned_time := l_old_ServiceRequest_rec.owner_assigned_time;
15671 x_audit_vals_rec.owner_assigned_time := SYSDATE;
15672 ELSE
15673 -- For audit record
15674 x_audit_vals_rec.change_ASSIGNED_TIME_FLAG := 'Y';
15675 x_audit_vals_rec.OLD_OWNER_ASSIGNED_TIME := l_old_ServiceRequest_rec.owner_assigned_time;
15676 x_audit_vals_rec.OWNER_ASSIGNED_TIME := SYSDATE;
15677
15678 END IF; */
15679
15680 IF (l_service_request_rec.current_serial_number = FND_API.G_MISS_CHAR) THEN
15681 l_service_request_rec.current_serial_number := l_old_ServiceRequest_rec.current_serial_number;
15682 END IF;
15683
15684 IF (l_service_request_rec.original_order_number = FND_API.G_MISS_NUM) THEN
15685 l_service_request_rec.original_order_number := l_old_ServiceRequest_rec.original_order_number;
15686 END IF;
15687
15688 IF (l_service_request_rec.purchase_order_num = FND_API.G_MISS_CHAR) THEN
15689 l_service_request_rec.purchase_order_num := l_old_ServiceRequest_rec.purchase_order_num;
15690 END IF;
15691
15692 IF (l_service_request_rec.qa_collection_plan_id = FND_API.G_MISS_NUM) THEN
15693 l_service_request_rec.qa_collection_plan_id := l_old_ServiceRequest_rec.qa_collection_id;
15694 END IF;
15695
15696 IF (l_service_request_rec.resource_subtype_id = FND_API.G_MISS_NUM) THEN
15697 l_service_request_rec.resource_subtype_id := l_old_ServiceRequest_rec.resource_subtype_id;
15698 END IF;
15699
15700 IF (l_service_request_rec.employee_id IS NOT NULL) THEN
15701 l_service_request_rec.employee_id := NULL;
15702 END IF;
15703
15704 IF (l_service_request_rec.cust_po_number = FND_API.G_MISS_CHAR) THEN
15705 l_service_request_rec.cust_po_number := l_old_ServiceRequest_rec.customer_po_number;
15706 END IF;
15707
15708 IF (l_service_request_rec.cust_ticket_number = FND_API.G_MISS_CHAR) THEN
15709 l_service_request_rec.cust_ticket_number := l_old_ServiceRequest_rec.customer_ticket_number;
15710 END IF;
15711
15712 IF (l_service_request_rec.sr_creation_channel = FND_API.G_MISS_CHAR) THEN
15713 l_service_request_rec.sr_creation_channel := l_old_ServiceRequest_rec.sr_creation_channel;
15714 END IF;
15715
15716 IF (l_service_request_rec.time_zone_id = FND_API.G_MISS_NUM) THEN
15717 l_service_request_rec.time_zone_id := l_old_ServiceRequest_rec.time_zone_id;
15718 END IF;
15719
15720 IF (l_service_request_rec.time_difference = FND_API.G_MISS_NUM) THEN
15721 l_service_request_rec.time_difference := l_old_ServiceRequest_rec.time_difference;
15722 END IF;
15723
15724 IF (l_service_request_rec.contract_service_id = FND_API.G_MISS_NUM) OR
15725 (l_service_request_rec.contract_service_id = l_old_ServiceRequest_rec.contract_service_id) THEN
15726 l_service_request_rec.contract_service_id := l_old_ServiceRequest_rec.contract_service_id;
15727 l_SR_Validation_rec.contract_service_id := l_old_serviceRequest_rec.contract_service_id;
15728 --need to copy value to validation rec as contract id validation depends on it.
15729 ELSE
15730 l_SR_Validation_rec.contract_service_id := l_service_request_rec.contract_service_id;
15731 END IF;
15732
15733 IF (l_service_request_rec.contract_id = FND_API.G_MISS_NUM) OR
15734 (l_service_request_rec.contract_id = l_old_ServiceRequest_rec.contract_id) THEN
15735 l_service_request_rec.contract_id := l_old_ServiceRequest_rec.contract_id;
15736 -- need to set o/p vars since these are used in update not the l_service_request_rec
15737 x_contra_id := l_old_ServiceRequest_rec.contract_id;
15738 x_contract_number := l_old_ServiceRequest_Rec.contract_number;
15739 ELSE
15740 l_SR_Validation_rec.contract_id := l_service_request_rec.contract_id;
15741 END IF;
15742
15743 IF (l_service_request_rec.project_number = FND_API.G_MISS_CHAR) OR
15744 (l_service_request_rec.project_number = l_old_ServiceRequest_rec.project_number) THEN
15745 l_service_request_rec.project_number := l_old_ServiceRequest_rec.project_number;
15746 ELSE
15747 l_SR_Validation_rec.project_number := l_service_request_rec.project_number;
15748 END IF;
15749
15750
15751 IF (l_service_request_rec.account_id = FND_API.G_MISS_NUM) OR
15752 (l_service_request_rec.account_id = l_old_ServiceRequest_rec.account_id) THEN
15753 l_service_request_rec.account_id := l_old_ServiceRequest_rec.account_id;
15754 --Added this here, cause user may have passed a new customer product id
15755 --but nay have not passed a new account id. The validation rec has to be
15756 --assigned this so that it does not have the MISS NUM value.
15757 -- l_SR_Validation_rec.account_id := l_service_request_rec.account_id;
15758 ELSE
15759 l_SR_Validation_rec.account_id := l_service_request_rec.account_id;
15760 END IF;
15761
15762 -- auditing is done after AM API Call
15763 IF (l_service_request_rec.resource_type = FND_API.G_MISS_CHAR) OR
15764 (nvl(l_service_request_rec.resource_type,'-99') = nvl(l_old_ServiceRequest_rec.resource_type,'-99')) THEN
15765 l_service_request_rec.resource_type := l_old_ServiceRequest_rec.resource_type;
15766 ELSE
15767 l_SR_Validation_rec.resource_type := l_service_request_rec.resource_type;
15768 END IF;
15769
15770 --For optional fields, the passed value may be FND, SAME AS OLD
15771 --or user may have passed a valid value or he may want to NULL that field.
15772
15773 IF (l_service_request_rec.platform_id = FND_API.G_MISS_NUM) OR
15774 (nvl(l_service_request_rec.platform_id,-99) = nvl(l_old_ServiceRequest_rec.platform_id,-99)) THEN
15775
15776 l_SR_Validation_rec.platform_id := l_old_ServiceRequest_rec.platform_id;
15777 l_service_request_rec.platform_id := l_old_ServiceRequest_rec.platform_id;
15778 -- Audit the change added by shijain
15779 x_audit_vals_rec.change_platform_id_flag := 'N';
15780 x_audit_vals_rec.old_platform_id := l_old_ServiceRequest_rec.platform_id;
15781 x_audit_vals_rec.platform_id := l_service_request_rec.platform_id;
15782 ELSE
15783 l_SR_Validation_rec.platform_id := l_service_request_rec.platform_id;
15784 -- Audit the change
15785 x_audit_vals_rec.change_platform_id_FLAG := 'Y';
15786 x_audit_vals_rec.OLD_platform_id := l_old_ServiceRequest_rec.platform_id;
15787 x_audit_vals_rec.platform_id := l_service_request_rec.platform_id;
15788
15789 END IF;
15790
15791 -- Added audit changes for platform version id added by shijain
15792 IF (l_service_request_rec.platform_version_id = FND_API.G_MISS_NUM) OR
15793 (nvl(l_service_request_rec.platform_version_id,-99) = nvl(l_old_ServiceRequest_rec.platform_version_id,-99)) THEN
15794 l_service_request_rec.platform_version_id:= l_old_ServiceRequest_rec.platform_version_id;
15795 -- Audit the change
15796 x_audit_vals_rec.change_plat_ver_id_flag := 'N';
15797 x_audit_vals_rec.old_platform_version_id := l_old_ServiceRequest_rec.platform_version_id;
15798 x_audit_vals_rec.platform_version_id := l_service_request_rec.platform_version_id;
15799 ELSE
15800 l_SR_Validation_rec.platform_version_id := l_service_request_rec.platform_version_id;
15801 -- Audit the change
15802 x_audit_vals_rec.change_plat_ver_id_FLAG := 'Y';
15803 x_audit_vals_rec.OLD_platform_version_id := l_old_ServiceRequest_rec.platform_version_id;
15804 x_audit_vals_rec.platform_version_id := l_service_request_rec.platform_version_id;
15805 END IF;
15806
15807 IF (l_service_request_rec.inv_platform_org_id = FND_API.G_MISS_NUM) OR
15808 (nvl(l_service_request_rec.inv_platform_org_id,-99) = nvl(l_old_ServiceRequest_rec.inv_platform_org_id,-99)) THEN
15809 l_SR_Validation_rec.inv_platform_org_id:= l_old_ServiceRequest_rec.inv_platform_org_id;
15810 -- Audit the change
15811 x_audit_vals_rec.change_platform_org_id_flag := 'N';
15812 x_audit_vals_rec.old_inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
15813 x_audit_vals_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
15814 ELSE
15815 l_SR_Validation_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
15816 -- Audit the change
15817 x_audit_vals_rec.change_platform_org_id_flag := 'Y';
15818 x_audit_vals_rec.OLD_inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
15819 x_audit_vals_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
15820 END IF;
15821
15822 IF (l_service_request_rec.platform_version = FND_API.G_MISS_CHAR) OR
15823 (nvl(l_service_request_rec.platform_version,'-99') = nvl(l_old_ServiceRequest_rec.platform_version,'-99')) THEN
15824 l_service_request_rec.platform_version:= l_old_ServiceRequest_rec.platform_version;
15825 -- Audit the change
15826 x_audit_vals_rec.old_platform_version := l_old_ServiceRequest_rec.platform_version;
15827 x_audit_vals_rec.platform_version := l_service_request_rec.platform_version;
15828 ELSE
15829 l_SR_Validation_rec.platform_version := l_service_request_rec.platform_version;
15830 -- Audit the change
15831 x_audit_vals_rec.OLD_platform_version := l_old_ServiceRequest_rec.platform_version;
15832 x_audit_vals_rec.platform_version := l_service_request_rec.platform_version;
15833 END IF;
15834
15835 -- Added audit changes for language id added by shijain
15836 IF (l_service_request_rec.language_id = FND_API.G_MISS_NUM) OR
15837 (nvl(l_service_request_rec.language_id,-99) = nvl(l_old_ServiceRequest_rec.language_id,-99))
15838 THEN
15839 l_service_request_rec.language_id:= l_old_ServiceRequest_rec.language_id;
15840 -- Audit the change
15841 x_audit_vals_rec.change_language_id_flag := 'N';
15842 x_audit_vals_rec.old_language_id := l_old_ServiceRequest_rec.language_id;
15843 x_audit_vals_rec.language_id := l_service_request_rec.language_id;
15844 ELSE
15845 l_SR_Validation_rec.language_id := l_service_request_rec.language_id;
15846 -- Audit the change
15847 x_audit_vals_rec.change_language_id_flag := 'Y';
15848 x_audit_vals_rec.old_language_id := l_old_ServiceRequest_rec.language_id;
15849 x_audit_vals_rec.language_id := l_service_request_rec.language_id;
15850 END IF;
15851
15852 IF (l_service_request_rec.platform_version = FND_API.G_MISS_CHAR) THEN
15853 l_service_request_rec.platform_version := l_old_ServiceRequest_rec.platform_version;
15854 END IF;
15855
15856 IF (l_service_request_rec.platform_version_id = FND_API.G_MISS_NUM) THEN
15857 l_service_request_rec.platform_version_id := l_old_ServiceRequest_rec.platform_version_id;
15858 END IF;
15859
15860 IF (l_service_request_rec.inv_platform_org_id = FND_API.G_MISS_NUM) THEN
15861 l_service_request_rec.inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
15862 END IF;
15863
15864 IF (l_service_request_rec.db_version = FND_API.G_MISS_CHAR) THEN
15865 l_service_request_rec.db_version := l_old_ServiceRequest_rec.db_version;
15866 END IF;
15867
15868 IF (l_service_request_rec.last_update_channel = FND_API.G_MISS_CHAR) THEN
15869 l_service_request_rec.last_update_channel := l_old_ServiceRequest_rec.last_update_channel;
15870 END IF;
15871
15872 -- Check if Territory id has been passed to the API
15873 IF (l_service_request_rec.territory_id = FND_API.G_MISS_NUM) OR
15874 (nvl(l_service_request_rec.territory_id,-99) = nvl(l_old_ServiceRequest_rec.territory_id,-99)) THEN
15875 l_service_request_rec.territory_id := l_old_ServiceRequest_rec.territory_id;
15876 -- Audit the change added by shijain
15877 x_audit_vals_rec.change_territory_id_flag := 'N';
15878 x_audit_vals_rec.old_territory_id := l_old_ServiceRequest_rec.territory_id;
15879 x_audit_vals_rec.territory_id := l_service_request_rec.territory_id;
15880 ELSE
15881 l_SR_Validation_rec.territory_id := l_service_request_rec.territory_id;
15882 -- Audit the change
15883 x_audit_vals_rec.change_territory_id_FLAG := 'Y';
15884 x_audit_vals_rec.OLD_territory_id := l_old_ServiceRequest_rec.territory_id;
15885 x_audit_vals_rec.territory_id := l_service_request_rec.territory_id;
15886 END IF;
15887
15888 IF (l_service_request_rec.cp_component_id = FND_API.G_MISS_NUM) OR
15889 (nvl(l_service_request_rec.cp_component_id,-99) = nvl(l_old_ServiceRequest_rec.cp_component_id,-99)) THEN
15890 l_service_request_rec.cp_component_id := l_old_ServiceRequest_rec.cp_component_id;
15891 -- Audit the change added by shijain
15892 x_audit_vals_rec.change_cp_component_id_flag := 'N';
15893 x_audit_vals_rec.old_cp_component_id := l_old_ServiceRequest_rec.cp_component_id;
15894 x_audit_vals_rec.cp_component_id := l_service_request_rec.cp_component_id;
15895 IF (l_service_request_rec.component_version = FND_API.G_MISS_CHAR) THEN
15896 l_service_request_rec.component_version := l_old_servicerequest_rec.component_version;
15897 END IF;
15898 ELSE
15899 l_SR_Validation_rec.cp_component_id := l_service_request_rec.cp_component_id;
15900 -- Audit the change
15901 x_audit_vals_rec.change_cp_compONENT_id_FLAG := 'Y';
15902 x_audit_vals_rec.OLD_cp_component_id := l_old_ServiceRequest_rec.cp_component_id;
15903 x_audit_vals_rec.cp_component_id := l_service_request_rec.cp_component_id;
15904 END IF;
15905 IF (l_service_request_rec.cp_component_id is NULL AND
15906 l_service_request_rec.component_version is NOT NULL AND
15907 l_service_request_rec.component_version <> FND_API.G_MISS_CHAR) THEN
15908 l_service_request_rec.component_version := null;
15909 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
15910 p_token_an => l_api_name_full,
15911 p_token_ip => 'p_component_version' );
15912 END IF;
15913
15914 -- Check if Component Version id has been passed to the API
15915 IF (l_service_request_rec.cp_component_version_id = FND_API.G_MISS_NUM) OR
15916 (nvl(l_service_request_rec.cp_component_version_id,-99) = nvl(l_old_ServiceRequest_rec.cp_component_version_id,-99)) THEN
15917 l_service_request_rec.cp_component_version_id := l_old_ServiceRequest_rec.cp_component_version_id;
15918 -- Audit the change added by shijain
15919 x_audit_vals_rec.change_cp_comp_ver_id_flag := 'N';
15920 x_audit_vals_rec.old_cp_component_version_id := l_old_ServiceRequest_rec.cp_component_version_id;
15921 x_audit_vals_rec.cp_component_version_id := l_service_request_rec.cp_component_version_id;
15922 ELSE
15923 l_SR_Validation_rec.cp_component_version_id := l_service_request_rec.cp_component_version_id;
15924 -- Audit the change
15925 x_audit_vals_rec.CHANGE_CP_COMP_VER_ID_FLAG := 'Y';
15926 x_audit_vals_rec.OLD_cp_component_version_id := l_old_ServiceRequest_rec.cp_component_version_id;
15927 x_audit_vals_rec.cp_component_version_id := l_service_request_rec.cp_component_version_id;
15928 END IF;
15929
15930 -- Check if SubComponent id has been passed to the API
15931 IF (l_service_request_rec.cp_subcomponent_id = FND_API.G_MISS_NUM) OR
15932 (nvl(l_service_request_rec.cp_subcomponent_id,-99) = nvl(l_old_ServiceRequest_rec.cp_subcomponent_id,-99)) THEN
15933 l_service_request_rec.cp_subcomponent_id := l_old_ServiceRequest_rec.cp_subcomponent_id;
15934 -- Audit the change added by shijain
15935 x_audit_vals_rec.change_cp_subcomponent_id_flag := 'N';
15936 x_audit_vals_rec.old_cp_subcomponent_id := l_old_ServiceRequest_rec.cp_subcomponent_id;
15937 x_audit_vals_rec.cp_subcomponent_id := l_service_request_rec.cp_subcomponent_id;
15938 IF (l_service_request_rec.subcomponent_version = FND_API.G_MISS_CHAR) THEN
15939 l_service_request_rec.subcomponent_version := l_old_servicerequest_rec.subcomponent_version;
15940 END IF;
15941 ELSE
15942 l_SR_Validation_rec.cp_subcomponent_id := l_service_request_rec.cp_subcomponent_id;
15943 -- Audit the change
15944 x_audit_vals_rec.change_cp_subcompONENT_id_FLAG := 'Y';
15945 x_audit_vals_rec.OLD_cp_subcomponent_id := l_old_ServiceRequest_rec.cp_subcomponent_id;
15946 x_audit_vals_rec.cp_subcomponent_id := l_service_request_rec.cp_subcomponent_id;
15947 END IF;
15948 IF (l_service_request_rec.cp_subcomponent_id is NULL AND
15949 l_service_request_rec.subcomponent_version is NOT NULL AND
15950 l_service_request_rec.subcomponent_version <> FND_API.G_MISS_CHAR ) THEN
15951 l_service_request_rec.subcomponent_version := null;
15952 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
15953 p_token_an => l_api_name_full,
15954 p_token_ip => 'p_subcomponent_version' );
15955 END IF;
15956
15957 -- Check if Component Version id has been passed to the API
15958 IF (l_service_request_rec.cp_subcomponent_version_id = FND_API.G_MISS_NUM) OR
15959 (nvl(l_service_request_rec.cp_subcomponent_version_id,-99) = nvl(l_old_ServiceRequest_rec.cp_subcomponent_version_id,-99)) THEN
15960 l_service_request_rec.cp_subcomponent_version_id := l_old_ServiceRequest_rec.cp_subcomponent_version_id;
15961 -- Audit the change added by shijain
15962 x_audit_vals_rec.change_cp_subcomp_ver_id_flag := 'N';
15963 x_audit_vals_rec.old_cp_subcomponent_version_id := l_old_ServiceRequest_rec.cp_subcomponent_version_id;
15964 x_audit_vals_rec.cp_subcomponent_version_id := l_service_request_rec.cp_subcomponent_version_id;
15965 ELSE
15966 l_SR_Validation_rec.cp_subcomponent_version_id := l_service_request_rec.cp_subcomponent_version_id;
15967 -- Audit the change
15968 x_audit_vals_rec.CHANGE_CP_SUBCOMP_VER_ID_FLAG := 'Y';
15969 x_audit_vals_rec.OLD_cp_subcomponent_version_id := l_old_ServiceRequest_rec.cp_subcomponent_version_id;
15970 x_audit_vals_rec.cp_subcomponent_version_id := l_service_request_rec.cp_subcomponent_version_id;
15971 END IF;
15972
15973 -- Check if CP Revision ID has been passed to the API
15974 IF (l_service_request_rec.cp_revision_id = FND_API.G_MISS_NUM) OR
15975 (nvl(l_service_request_rec.cp_revision_id,-99) = nvl(l_old_ServiceRequest_rec.cp_revision_id,-99)) THEN
15976 l_service_request_rec.cp_revision_id := l_old_ServiceRequest_rec.cp_revision_id;
15977 -- Audit the change added by shijain
15978 x_audit_vals_rec.change_cp_revision_id_flag := 'N';
15979 x_audit_vals_rec.old_cp_revision_id := l_old_ServiceRequest_rec.cp_revision_id;
15980 x_audit_vals_rec.cp_revision_id := l_service_request_rec.cp_revision_id;
15981 ELSE
15982 l_SR_Validation_rec.cp_revision_id := l_service_request_rec.cp_revision_id;
15983 -- Audit the change
15984 x_audit_vals_rec.change_cp_revISION_id_FLAG := 'Y';
15985 x_audit_vals_rec.OLD_cp_revision_id := l_old_ServiceRequest_rec.cp_revision_id;
15986 x_audit_vals_rec.cp_revision_id := l_service_request_rec.cp_revision_id;
15987 END IF;
15988
15989 /*** smisra 8/16/04 3815808 this will be done inside servicerequest_cross_val procedure
15990 -- Check if Product Revision has been passed to the API
15991 IF (l_service_request_rec.product_revision = FND_API.G_MISS_CHAR) OR
15992 (nvl(l_service_request_rec.product_revision,-99) = nvl(l_old_ServiceRequest_rec.product_revision,-99)) THEN
15993 l_service_request_rec.product_revision := l_old_ServiceRequest_rec.product_revision;
15994 -- Audit the change added by shijain
15995 x_audit_vals_rec.change_product_revision_flag := 'N';
15996 x_audit_vals_rec.old_product_revision := l_old_ServiceRequest_rec.product_revision;
15997 x_audit_vals_rec.product_revision := l_service_request_rec.product_revision;
15998 ELSE
15999 l_SR_Validation_rec.product_revision := l_service_request_rec.product_revision;
16000 -- Audit the change
16001 x_audit_vals_rec.change_proDUCT_revISION_FLAG := 'Y';
16002 x_audit_vals_rec.OLD_product_revision := l_old_ServiceRequest_rec.product_revision;
16003 x_audit_vals_rec.product_revision := l_service_request_rec.product_revision;
16004 END IF;
16005 *****/
16006 /*** smisra 5/4/04 3566783 this will be done inside servicerequest_cross_val procedure
16007 -- Check if Component Version has been passed to the API
16008 IF (l_service_request_rec.component_version = FND_API.G_MISS_CHAR) OR
16009 (nvl(l_service_request_rec.component_version,-99) = nvl(l_old_ServiceRequest_rec.component_version,-99)) THEN
16010 l_service_request_rec.component_version := l_old_ServiceRequest_rec.component_version;
16011 -- Audit the change added by shijain
16012 x_audit_vals_rec.change_comp_ver_flag := 'N';
16013 x_audit_vals_rec.old_component_version := l_old_ServiceRequest_rec.component_version;
16014 x_auDit_vals_rec.component_version := l_service_request_rec.component_version;
16015 ELSE
16016 l_SR_Validation_rec.component_version := l_service_request_rec.component_version;
16017 -- Audit the change
16018 x_audit_vals_rec.CHANGE_COMP_VER_FLAG := 'Y';
16019 x_audit_vals_rec.OLD_component_version := l_old_ServiceRequest_rec.component_version;
16020 x_audit_vals_rec.component_version := l_service_request_rec.component_version;
16021 END IF;
16022
16023 -- Check if Subcomponent Version has been passed to the API
16024 IF (l_service_request_rec.subcomponent_version = FND_API.G_MISS_CHAR) OR
16025 (nvl(l_service_request_rec.subcomponent_version,-99) = nvl(l_old_ServiceRequest_rec.subcomponent_version,-99)) THEN
16026 l_service_request_rec.subcomponent_version := l_old_ServiceRequest_rec.subcomponent_version;
16027 -- Audit the change added by shijain
16028 x_audit_vals_rec.change_subcomp_ver_flag := 'N';
16029 x_audit_vals_rec.old_subcomponent_version := l_old_ServiceRequest_rec.subcomponent_version;
16030 x_audit_vals_rec.subcomponent_version := l_service_request_rec.subcomponent_version;
16031 ELSE
16032 l_SR_Validation_rec.subcomponent_version := l_service_request_rec.subcomponent_version;
16033 -- Audit the change
16034 x_audit_vals_rec.CHANGE_SUBCOMP_VER_FLAG := 'Y';
16035 x_audit_vals_rec.OLD_subcomponent_version := l_old_ServiceRequest_rec.subcomponent_version;
16036 x_audit_vals_rec.subcomponent_version := l_service_request_rec.subcomponent_version;
16037 END IF;
16038 *****************************************************/
16039
16040 -- Check if Inv Item Revision has been passed to the API
16041 IF (l_service_request_rec.inv_item_revision = FND_API.G_MISS_CHAR) OR
16042 (nvl(l_service_request_rec.inv_item_revision,-99) = nvl(l_old_ServiceRequest_rec.inv_item_revision,-99)) THEN
16043 l_service_request_rec.inv_item_revision := l_old_ServiceRequest_rec.inv_item_revision;
16044 -- Audit the change added by shijain
16045 x_audit_vals_rec.change_inv_item_revision := 'N';
16046 x_audit_vals_rec.old_inv_item_revision := l_old_ServiceRequest_rec.inv_item_revision;
16047 x_audit_vals_rec.inv_item_revision := l_service_request_rec.inv_item_revision;
16048 ELSE
16049 l_SR_Validation_rec.inv_item_revision := l_service_request_rec.inv_item_revision;
16050 -- Audit the change
16051 x_audit_vals_rec.CHANGE_INV_ITEM_REVISION := 'Y';
16052 x_audit_vals_rec.OLD_inv_item_revision := l_old_ServiceRequest_rec.inv_item_revision;
16053 x_audit_vals_rec.inv_item_revision := l_service_request_rec.inv_item_revision;
16054 END IF;
16055
16056 -- inventory component and subcomponent for Bug# 2254523
16057 -- Check if INV COMPONENT ID has been passed to the API
16058 IF (l_service_request_rec.inv_component_id = FND_API.G_MISS_NUM) OR
16059 (l_service_request_rec.inv_component_id IS NULL AND
16060 l_old_ServiceRequest_rec.inv_component_id IS NULL) OR
16061 (l_service_request_rec.inv_component_id = l_old_ServiceRequest_rec.inv_component_id) THEN
16062 l_service_request_rec.inv_component_id := l_old_ServiceRequest_rec.inv_component_id;
16063 -- Audit the change added by shijain
16064 x_audit_vals_rec.change_inv_component_id := 'N';
16065 x_audit_vals_rec.old_inv_component_id := l_old_ServiceRequest_rec.inv_component_id;
16066 x_audit_vals_rec.inv_component_id := l_service_request_rec.inv_component_id;
16067 ELSE
16068 l_SR_Validation_rec.inv_component_id := l_service_request_rec.inv_component_id;
16069 -- Audit the change
16070 x_audit_vals_rec.CHANGE_INV_COMPONENT_ID := 'Y';
16071 x_audit_vals_rec.OLD_inv_component_id := l_old_ServiceRequest_rec.inv_component_id;
16072 x_audit_vals_rec.inv_component_id := l_service_request_rec.inv_component_id;
16073 END IF;
16074
16075 -- Check if INV COMPONENT VERSION has been passed to the API
16076 IF (l_service_request_rec.inv_component_version = FND_API.G_MISS_CHAR) OR
16077 (l_service_request_rec.inv_component_version IS NULL AND
16078 l_old_ServiceRequest_rec.inv_component_version IS NULL) OR
16079 (l_service_request_rec.inv_component_version = l_old_ServiceRequest_rec.inv_component_version) THEN
16080 l_service_request_rec.inv_component_version := l_old_ServiceRequest_rec.inv_component_version;
16081 -- Audit the change added by shijain
16082 x_audit_vals_rec.change_inv_component_version := 'N';
16083 x_audit_vals_rec.old_inv_component_version := l_old_ServiceRequest_rec.inv_component_version;
16084 x_audit_vals_rec.inv_component_version := l_service_request_rec.inv_component_version;
16085 ELSE
16086 l_SR_Validation_rec.inv_component_version := l_service_request_rec.inv_component_version;
16087 -- Audit the change
16088 x_audit_vals_rec.CHANGE_INV_COMPONENT_VERSION := 'Y';
16089 x_audit_vals_rec.OLD_inv_component_version:= l_old_ServiceRequest_rec.inv_component_version;
16090 x_audit_vals_rec.inv_component_version := l_service_request_rec.inv_component_version;
16091 END IF;
16092
16093 -- Check if INV SUB COMPONENT ID has been passed to the API
16094 IF (l_service_request_rec.inv_subcomponent_id = FND_API.G_MISS_NUM) OR
16095 (l_service_request_rec.inv_subcomponent_id IS NULL AND
16096 l_old_ServiceRequest_rec.inv_subcomponent_id IS NULL) OR
16097 (l_service_request_rec.inv_subcomponent_id = l_old_ServiceRequest_rec.inv_subcomponent_id) THEN
16098 l_service_request_rec.inv_subcomponent_id := l_old_ServiceRequest_rec.inv_subcomponent_id;
16099 -- Audit the change added by shijain
16100 x_audit_vals_rec.change_inv_subcomponent_id := 'N';
16101 x_audit_vals_rec.old_inv_subcomponent_id := l_old_ServiceRequest_rec.inv_subcomponent_id;
16102 x_audit_vals_rec.inv_subcomponent_id := l_service_request_rec.inv_subcomponent_id;
16103 ELSE
16104 l_SR_Validation_rec.inv_subcomponent_id := l_service_request_rec.inv_subcomponent_id;
16105 -- Audit the change
16106 x_audit_vals_rec.CHANGE_INV_SUBCOMPONENT_ID := 'Y';
16107 x_audit_vals_rec.OLD_inv_subcomponent_id := l_old_ServiceRequest_rec.inv_subcomponent_id;
16108 x_audit_vals_rec.inv_subcomponent_id := l_service_request_rec.inv_subcomponent_id;
16109 END IF;
16110
16111 -- Check if INV SUBCOMPONENT VERSION has been passed to the API
16112 IF (l_service_request_rec.inv_subcomponent_version = FND_API.G_MISS_CHAR) OR
16113 (l_service_request_rec.inv_subcomponent_version IS NULL AND
16114 l_old_ServiceRequest_rec.inv_subcomponent_version IS NULL) OR
16115 (l_service_request_rec.inv_subcomponent_version = l_old_ServiceRequest_rec.inv_subcomponent_version) THEN
16116 l_service_request_rec.inv_subcomponent_version := l_old_ServiceRequest_rec.inv_subcomponent_version;
16117 -- Audit the change added by shijain
16118 x_audit_vals_rec.change_inv_subcomp_version := 'N';
16119 x_audit_vals_rec.old_inv_subcomponent_version:= l_old_ServiceRequest_rec.inv_subcomponent_version;
16120 x_audit_vals_rec.inv_subcomponent_version := l_service_request_rec.inv_subcomponent_version;
16121 ELSE
16122 l_SR_Validation_rec.inv_subcomponent_version := l_service_request_rec.inv_subcomponent_version;
16123 -- Audit the change
16124 x_audit_vals_rec.change_inv_subcomp_verSION := 'Y';
16125 x_audit_vals_rec.OLD_inv_subcomponent_version:= l_old_ServiceRequest_rec.inv_subcomponent_version;
16126 x_audit_vals_rec.inv_subcomponent_version := l_service_request_rec.inv_subcomponent_version;
16127 END IF;
16128
16129 IF (l_service_request_rec.inventory_org_id = FND_API.G_MISS_NUM) OR
16130 (nvl(l_service_request_rec.inventory_org_id,-99) = nvl(l_old_ServiceRequest_rec.inv_organization_id,-99))
16131 THEN
16132 l_service_request_rec.inventory_org_id := l_old_ServiceRequest_rec.inv_organization_id ;
16133 -- For audit record added by shijain
16134 x_audit_vals_rec.change_inv_organization_flag := 'N';
16135 x_audit_vals_rec.old_inv_organization_id := l_old_ServiceRequest_rec.inv_organization_id ;
16136 x_audit_vals_rec.inv_organization_id := l_service_request_rec.inventory_org_id ;
16137 ELSE
16138 -- For audit record
16139 x_audit_vals_rec.CHANGE_inv_organization_flag := 'Y';
16140 x_audit_vals_rec.OLD_inv_organization_id := l_old_ServiceRequest_rec.inv_organization_id ;
16141 x_audit_vals_rec.inv_organization_id := l_service_request_rec.inventory_org_id ;
16142 END IF;
16143
16144 -- ----------------------------------------------------
16145 -- Added for enhancements for 11.5.6
16146 -- category_id, comm_pref_code and cust_pref_lang_id needs to be
16147 -- validated. tier,tier_version,operating_system,
16148 -- operating_system_version, database, inv_platform_org_id are not
16149 -- validated now.
16150 -- ----------------------------------------------------
16151
16152 IF (l_service_request_rec.cust_pref_lang_id = FND_API.G_MISS_NUM) THEN
16153 l_service_request_rec.cust_pref_lang_id := l_old_ServiceRequest_rec.cust_pref_lang_id;
16154 ELSE
16155 l_SR_Validation_rec.cust_pref_lang_id := l_service_request_rec.cust_pref_lang_id;
16156 END IF;
16157
16158 IF (l_service_request_rec.comm_pref_code = FND_API.G_MISS_CHAR) THEN
16159 l_service_request_rec.comm_pref_code := l_old_ServiceRequest_rec.comm_pref_code;
16160 ELSE
16161 l_SR_Validation_rec.comm_pref_code := l_service_request_rec.comm_pref_code;
16162 END IF;
16163
16164 IF (l_service_request_rec.cust_pref_lang_code = FND_API.G_MISS_CHAR) THEN
16165 l_service_request_rec.cust_pref_lang_code := l_old_ServiceRequest_rec.cust_pref_lang_code;
16166 END IF;
16167
16168 IF (l_service_request_rec.tier = FND_API.G_MISS_CHAR) THEN
16169 l_service_request_rec.tier := l_old_ServiceRequest_rec.tier;
16170 END IF;
16171
16172 IF (l_service_request_rec.tier_version = FND_API.G_MISS_CHAR) THEN
16173 l_service_request_rec.tier_version := l_old_ServiceRequest_rec.tier_version;
16174 END IF;
16175
16176 IF (l_service_request_rec.operating_system = FND_API.G_MISS_CHAR) THEN
16177 l_service_request_rec.operating_system := l_old_ServiceRequest_rec.operating_system;
16178 END IF;
16179
16180 IF (l_service_request_rec.operating_system_version = FND_API.G_MISS_CHAR) THEN
16181 l_service_request_rec.operating_system_version := l_old_ServiceRequest_rec.operating_system_version;
16182 END IF;
16183
16184 IF (l_service_request_rec.DATABASE = FND_API.G_MISS_CHAR) THEN
16185 l_service_request_rec.DATABASE := l_old_ServiceRequest_rec.DATABASE;
16186 END IF;
16187
16188 IF (l_service_request_rec.category_id = FND_API.G_MISS_NUM) THEN
16189 l_service_request_rec.category_id := l_old_ServiceRequest_rec.category_id;
16190 ELSE
16191 l_SR_Validation_rec.category_id := l_service_request_rec.category_id;
16192 IF (l_service_request_rec.category_id IS NOT NULL AND
16193 l_service_request_rec.category_set_id = FND_API.G_MISS_NUM AND
16194 l_old_servicerequest_rec.category_set_id IS NULL) THEN
16195 l_service_request_rec.category_set_id := FND_PROFILE.value('CS_SR_DEFAULT_CATEGORY_SET');
16196 END IF;
16197 END IF;
16198
16199 IF (l_service_request_rec.category_set_id = FND_API.G_MISS_NUM) THEN
16200 l_service_request_rec.category_set_id := l_old_ServiceRequest_rec.category_set_id;
16201 ELSE
16202 l_SR_Validation_rec.category_set_id := l_service_request_rec.category_set_id;
16203 END IF;
16204
16205 IF (l_service_request_rec.external_reference = FND_API.G_MISS_CHAR) THEN
16206 l_service_request_rec.external_reference := l_old_ServiceRequest_rec.external_reference;
16207 ELSE
16208 l_SR_Validation_rec.external_reference := l_service_request_rec.external_reference;
16209 l_SR_Validation_rec.customer_product_id := l_service_request_rec.customer_product_id;
16210 END IF;
16211
16212 IF (l_service_request_rec.system_id = FND_API.G_MISS_NUM) THEN
16213 l_service_request_rec.system_id := l_old_ServiceRequest_rec.system_id;
16214 ELSE
16215 l_SR_Validation_rec.system_id := l_service_request_rec.system_id;
16216 END IF;
16217
16218 -- ----------------------------------------------------
16219 -- Some other fields that might need validations:
16220 -- problem_code, expected_resolution_date,
16221 -- resolution_code, and actual resolution_date
16222 -- ----------------------------------------------------
16223 IF (l_service_request_rec.problem_code = FND_API.G_MISS_CHAR) THEN
16224 l_service_request_rec.problem_code := l_old_ServiceRequest_rec.problem_code;
16225 ELSE
16226 l_service_request_rec.problem_code := UPPER(l_service_request_rec.problem_code);
16227 IF (l_service_request_rec.problem_code IS NOT NULL) THEN
16228 l_SR_Validation_rec.problem_code := l_service_request_rec.problem_code;
16229 END IF;
16230 END IF;
16231
16232
16233 IF (l_service_request_rec.resolution_code = FND_API.G_MISS_CHAR) THEN
16234 l_service_request_rec.resolution_code := l_old_ServiceRequest_rec.resolution_code;
16235 ELSE
16236 l_service_request_rec.resolution_code := UPPER(l_service_request_rec.resolution_code);
16237 IF (l_service_request_rec.resolution_code IS NOT NULL) THEN
16238 l_SR_Validation_rec.resolution_code := l_service_request_rec.resolution_code;
16239 END IF;
16240 END IF;
16241
16242 -------Fix for Bug#1697139 --jngeorge--05/21/01
16243 ------Added two more conditions for Bug# 1874528 ----jngeorge---07/18/01
16244 IF (l_service_request_rec.exp_resolution_date = FND_API.G_MISS_DATE)OR
16245 (l_service_request_rec.exp_resolution_date IS NULL AND
16246 l_old_ServiceRequest_rec.expected_resolution_date IS NULL) OR
16247 (l_service_request_rec.exp_resolution_date = l_old_ServiceRequest_rec.expected_resolution_date) THEN
16248 l_service_request_rec.exp_resolution_date := l_old_ServiceRequest_rec.expected_resolution_date;
16249 --
16250 -- For audit record added by shijain
16251 --
16252 x_audit_vals_rec.change_resolution_flag := 'N';
16253 x_audit_vals_rec.old_expected_resolution_date := l_old_ServiceRequest_rec.expected_resolution_date;
16254 x_audit_vals_rec.expected_resolution_date := l_service_request_rec.exp_resolution_date;
16255
16256 ELSE
16257 IF (l_service_request_rec.exp_resolution_date IS NOT NULL) OR
16258 (l_service_request_rec.exp_resolution_date <> FND_API.G_MISS_DATE ) THEN
16259 l_SR_Validation_rec.exp_resolution_date := l_service_request_rec.exp_resolution_date;
16260 END IF;
16261 --
16262 -- For audit record
16263 --
16264 x_audit_vals_rec.change_RESOLUTION_FLAG := 'Y';
16265 x_audit_vals_rec.OLD_EXPECTED_RESOLUTION_DATE := l_old_ServiceRequest_rec.expected_resolution_date;
16266 x_audit_vals_rec.EXPECTED_RESOLUTION_DATE := l_service_request_rec.exp_resolution_date;
16267 END IF;
16268
16269 IF (l_service_request_rec.act_resolution_date = FND_API.G_MISS_DATE) THEN
16270 l_service_request_rec.act_resolution_date := l_old_ServiceRequest_rec.actual_resolution_date;
16271 ELSE
16272 IF (l_service_request_rec.act_resolution_date IS NOT NULL) THEN
16273 l_SR_Validation_rec.act_resolution_date := l_service_request_rec.act_resolution_date;
16274 END IF;
16275 END IF;
16276
16277 -- -----------------------------------------------------------
16278 -- Check to see if the descriptive flexfield is being updated
16279 -- -----------------------------------------------------------
16280 -- 11/25/03 smisra
16281 -- All attributes that are g_miss_char must be set to value in database
16282 -- whether flex fields are changed or not.
16283 -- So this code is moved immiediately after cursor to fetch values from database
16284 -- and if attribute value is g_miss_char, it is being set to value from database.
16285 --IF (FND_API.To_Boolean(l_update_desc_flex)) THEN
16286 --NULL;
16287 --ELSE
16288 --l_service_request_rec.request_attribute_1 := l_old_ServiceRequest_rec.incident_attribute_1;
16289 --l_service_request_rec.request_attribute_2 := l_old_ServiceRequest_rec.incident_attribute_2;
16290 --l_service_request_rec.request_attribute_3 := l_old_ServiceRequest_rec.incident_attribute_3;
16291 --l_service_request_rec.request_attribute_4 := l_old_ServiceRequest_rec.incident_attribute_4;
16292 --l_service_request_rec.request_attribute_5 := l_old_ServiceRequest_rec.incident_attribute_5;
16293 --l_service_request_rec.request_attribute_6 := l_old_ServiceRequest_rec.incident_attribute_6;
16294 --l_service_request_rec.request_attribute_7 := l_old_ServiceRequest_rec.incident_attribute_7;
16295 --l_service_request_rec.request_attribute_8 := l_old_ServiceRequest_rec.incident_attribute_8;
16296 --l_service_request_rec.request_attribute_9 := l_old_ServiceRequest_rec.incident_attribute_9;
16297 --l_service_request_rec.request_attribute_10 := l_old_ServiceRequest_rec.incident_attribute_10;
16298 --l_service_request_rec.request_attribute_11 := l_old_ServiceRequest_rec.incident_attribute_11;
16299 --l_service_request_rec.request_attribute_12 := l_old_ServiceRequest_rec.incident_attribute_12;
16300 --l_service_request_rec.request_attribute_13 := l_old_ServiceRequest_rec.incident_attribute_13;
16301 --l_service_request_rec.request_attribute_14 := l_old_ServiceRequest_rec.incident_attribute_14;
16302 --l_service_request_rec.request_attribute_15 := l_old_ServiceRequest_rec.incident_attribute_15;
16303 --l_service_request_rec.request_context := l_old_ServiceRequest_rec.incident_context;
16304 --l_service_request_rec.external_attribute_1 := l_old_ServiceRequest_rec.external_attribute_1;
16305 --l_service_request_rec.external_attribute_2 := l_old_ServiceRequest_rec.external_attribute_2;
16306 --l_service_request_rec.external_attribute_3 := l_old_ServiceRequest_rec.external_attribute_3;
16307 --l_service_request_rec.external_attribute_4 := l_old_ServiceRequest_rec.external_attribute_4;
16308 --l_service_request_rec.external_attribute_5 := l_old_ServiceRequest_rec.external_attribute_5;
16309 --l_service_request_rec.external_attribute_6 := l_old_ServiceRequest_rec.external_attribute_6;
16310 --l_service_request_rec.external_attribute_7 := l_old_ServiceRequest_rec.external_attribute_7;
16311 --l_service_request_rec.external_attribute_8 := l_old_ServiceRequest_rec.external_attribute_8;
16312 --l_service_request_rec.external_attribute_9 := l_old_ServiceRequest_rec.external_attribute_9;
16313 --l_service_request_rec.external_attribute_10 := l_old_ServiceRequest_rec.external_attribute_10;
16314 --l_service_request_rec.external_attribute_11 := l_old_ServiceRequest_rec.external_attribute_11;
16315 --l_service_request_rec.external_attribute_12 := l_old_ServiceRequest_rec.external_attribute_12;
16316 --l_service_request_rec.external_attribute_13 := l_old_ServiceRequest_rec.external_attribute_13;
16317 --l_service_request_rec.external_attribute_14 := l_old_ServiceRequest_rec.external_attribute_14;
16318 --l_service_request_rec.external_attribute_15 := l_old_ServiceRequest_rec.external_attribute_15;
16319 --l_service_request_rec.external_context := l_old_ServiceRequest_rec.external_context;
16320 --END IF;
16321
16322 /* IF (l_service_request_rec.verify_cp_flag = FND_API.G_MISS_CHAR) THEN
16323 --
16324 -- We don't actually store a flag in the table to indicate
16325 -- if Installed Base mode is used. We could tell this by
16326 -- checking to see if customer_product_id is NULL or not
16327 --
16328 IF (l_old_ServiceRequest_rec.customer_product_id IS NULL) THEN
16329 l_service_request_rec.verify_cp_flag := 'N';
16330 ELSE
16331 l_service_request_rec.verify_cp_flag := 'Y';
16332 END IF;
16333 -- 2757488
16334 ELSIF (l_service_request_rec.verify_cp_flag NOT IN ('Y','N')) THEN
16335 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
16336 ( p_token_an => l_api_name_full,
16337 p_token_v => l_service_request_rec.verify_cp_flag,
16338 p_token_p => 'verify_cp_flag',
16339 p_table_name => G_TABLE_NAME ,
16340 p_column_name => '');
16341 RAISE FND_API.G_EXC_ERROR;
16342 END IF; */
16343
16344
16345 -- For bug 3333340
16346 p_passed_value := l_service_request_rec.verify_cp_flag;
16347 IF (l_service_request_rec.verify_cp_flag <> FND_API.G_MISS_CHAR
16348 AND l_service_request_rec.verify_cp_flag IS NOT NULL) THEN
16349
16350 IF (l_service_request_rec.verify_cp_flag NOT IN ('Y','N')) THEN
16351 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
16352 ( p_token_an => l_api_name_full,
16353 p_token_v => l_service_request_rec.verify_cp_flag,
16354 p_token_p => 'verify_cp_flag',
16355 p_table_name => G_TABLE_NAME ,
16356 p_column_name => '');
16357 RAISE FND_API.G_EXC_ERROR;
16358 END IF;
16359 END IF;
16360
16361 IF (l_service_request_rec.customer_product_id <> FND_API.G_MISS_NUM AND
16362 l_service_request_rec.customer_product_id IS NOT NULL) THEN
16363 l_service_request_rec.verify_cp_flag := 'Y';
16364 ELSIF ( l_service_request_rec.customer_product_id IS NULL) THEN
16365 l_service_request_rec.verify_cp_flag := 'N';
16366 ELSE
16367 IF (l_old_ServiceRequest_rec.customer_product_id IS NOT NULL) THEN
16368 l_service_request_rec.verify_cp_flag := 'Y';
16369 ELSE
16370 l_service_request_rec.verify_cp_flag := 'N';
16371 END IF;
16372 END IF;
16373
16374 if ( p_passed_value <> FND_API.G_MISS_CHAR) then
16375 if ( p_passed_value <> l_service_request_rec.verify_cp_flag) then
16376 CS_ServiceRequest_UTIL.Add_Cp_Flag_Ignored_Msg (p_token_an => l_api_name_full,
16377 p_token_ip => p_passed_value,
16378 p_token_pv => l_service_request_rec.verify_cp_flag);
16379 end if;
16380 end if;
16381
16382
16383
16384 l_SR_Validation_rec.caller_type := l_service_request_rec.caller_type;
16385 ----**********************
16386 IF (l_service_request_rec.customer_id = FND_API.G_MISS_NUM) THEN
16387 IF (l_service_request_rec.customer_number = FND_API.G_MISS_CHAR) THEN
16388 l_service_request_rec.customer_id := l_old_ServiceRequest_rec.customer_id;
16389 --Since we are not going to store the customer number in the base table
16390 --l_service_request_rec.customer_number := l_old_ServiceRequest_rec.customer_number;
16391 ELSE
16392 BEGIN
16393 SELECT party_id INTO l_service_request_rec.customer_id
16394 FROM hz_parties
16395 WHERE party_number = l_service_request_rec.customer_number;
16396 EXCEPTION
16397 WHEN OTHERS THEN
16398
16399 CS_ServiceRequest_UTIL.Add_Invalid_Argument_Msg
16400 ( p_token_an => l_api_name_full,
16401 p_token_v => l_service_request_rec.customer_number,
16402 p_token_p => 'p_customer_number',
16403 p_table_name => G_TABLE_NAME ,
16404 p_column_name => 'CUSTOMER_NUMBER');
16405
16406 RAISE FND_API.G_EXC_ERROR;
16407 END;
16408 END IF;
16409 ELSIF (l_service_request_rec.customer_id IS NOT NULL) THEN
16410 l_SR_Validation_rec.validate_customer := FND_API.G_TRUE;
16411 l_SR_Validation_rec.customer_id := l_service_request_rec.customer_id;
16412 END IF;
16413
16414 IF (l_service_request_rec.bill_to_site_id = FND_API.G_MISS_NUM) OR
16415 (NVL(l_service_request_rec.bill_to_site_id, -99)
16416 = NVL(l_old_ServiceRequest_rec.bill_to_site_id, -99)) THEN
16417 l_service_request_rec.bill_to_site_id := l_old_ServiceRequest_rec.bill_to_site_id;
16418 ELSE
16419 l_SR_Validation_rec.validate_bill_to_site := FND_API.G_TRUE;
16420 l_SR_Validation_rec.bill_to_party_id := l_service_request_rec.bill_to_party_id;
16421 l_SR_Validation_rec.bill_to_site_id := l_service_request_rec.bill_to_site_id;
16422 END IF;
16423
16424 IF (l_service_request_rec.bill_to_site_use_id = FND_API.G_MISS_NUM) OR
16425 (NVL(l_service_request_rec.bill_to_site_use_id, -99) =
16426 NVL(l_old_ServiceRequest_rec.bill_to_site_use_id, -99)) THEN
16427 l_service_request_rec.bill_to_site_use_id := l_old_ServiceRequest_rec.bill_to_site_use_id;
16428 ELSE
16429 l_SR_Validation_rec.bill_to_party_id := l_service_request_rec.bill_to_party_id;
16430 l_SR_Validation_rec.bill_to_site_use_id := l_service_request_rec.bill_to_site_use_id;
16431 END IF;
16432
16433 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM) OR
16434 (NVL(l_service_request_rec.bill_to_party_id, -99) =
16435 NVL(l_old_ServiceRequest_rec.bill_to_party_id, -99)) THEN
16436 l_service_request_rec.bill_to_party_id := l_old_ServiceRequest_rec.bill_to_party_id;
16437 ELSE
16438 l_SR_Validation_rec.bill_to_party_id := l_service_request_rec.bill_to_party_id;
16439 END IF;
16440
16441 --Passed value is FND or same as old(which may be null)
16442 IF (l_service_request_rec.bill_to_contact_id = FND_API.G_MISS_NUM) OR
16443 (NVL(l_service_request_rec.bill_to_contact_id, -99) = NVL(l_old_ServiceRequest_rec.bill_to_contact_id, -99)) THEN
16444 l_service_request_rec.bill_to_contact_id := l_old_ServiceRequest_rec.bill_to_contact_id;
16445 -- For audit record added by shijain
16446 x_audit_vals_rec.change_bill_to_flag := 'N';
16447 x_audit_vals_rec.old_bill_to_contact_id := l_old_ServiceRequest_rec.bill_to_contact_id;
16448 x_audit_vals_rec.bill_to_contact_id := l_service_request_rec.bill_to_contact_id;
16449 ELSIF (l_service_request_rec.bill_to_contact_id IS NOT NULL) THEN
16450 l_SR_Validation_rec.bill_to_contact_id := l_service_request_rec.bill_to_contact_id;
16451 l_SR_Validation_rec.bill_to_party_id := l_service_request_rec.bill_to_party_id;
16452 END IF;
16453
16454 IF (NVL(l_service_request_rec.bill_to_contact_id, -99) <> NVL(l_old_ServiceRequest_rec.bill_to_contact_id, -99)) THEN
16455 -- For audit record
16456 x_audit_vals_rec.change_bill_to_FLAG := 'Y';
16457 x_audit_vals_rec.OLD_bill_to_contact_id := l_old_ServiceRequest_rec.bill_to_contact_id;
16458 x_audit_vals_rec.bill_to_contact_id := l_service_request_rec.bill_to_contact_id;
16459 --ELSE
16460 --l_new_vals_rec.bill_to_contact_id := l_service_request_rec.bill_to_contact_id;
16461 END IF;
16462
16463 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM) OR
16464 (NVL(l_service_request_rec.ship_to_party_id, -99) = NVL(l_old_ServiceRequest_rec.ship_to_party_id, -99)) THEN
16465 l_service_request_rec.ship_to_party_id := l_old_ServiceRequest_rec.ship_to_party_id;
16466 ELSIF (l_service_request_rec.ship_to_party_id IS NOT NULL) THEN
16467 l_SR_Validation_rec.ship_to_party_id := l_service_request_rec.ship_to_party_id;
16468 END IF;
16469
16470 IF (l_service_request_rec.ship_to_site_id = FND_API.G_MISS_NUM) OR
16471 (NVL(l_service_request_rec.ship_to_site_id, -99) =
16472 NVL(l_old_ServiceRequest_rec.ship_to_site_id, -99)) THEN
16473 l_service_request_rec.ship_to_site_id := l_old_ServiceRequest_rec.ship_to_site_id;
16474 ELSE
16475 l_SR_Validation_rec.validate_ship_to_site := FND_API.G_TRUE;
16476 l_SR_Validation_rec.ship_to_party_id := l_service_request_rec.ship_to_party_id;
16477 l_SR_Validation_rec.ship_to_site_id := l_service_request_rec.ship_to_site_id;
16478 END IF;
16479
16480 IF (l_service_request_rec.ship_to_site_use_id = FND_API.G_MISS_NUM) OR
16481 (NVL(l_service_request_rec.ship_to_site_use_id, -99) =
16482 NVL(l_old_ServiceRequest_rec.ship_to_site_use_id, -99)) THEN
16483 l_service_request_rec.ship_to_site_use_id := l_old_ServiceRequest_rec.ship_to_site_use_id;
16484 ELSE
16485 l_SR_Validation_rec.ship_to_party_id := l_service_request_rec.ship_to_party_id;
16486 l_SR_Validation_rec.ship_to_site_use_id := l_service_request_rec.ship_to_site_use_id;
16487 END IF;
16488
16489 IF (l_service_request_rec.ship_to_contact_id = FND_API.G_MISS_NUM) OR
16490 (NVL(l_service_request_rec.ship_to_contact_id, -99) = NVL(l_old_ServiceRequest_rec.ship_to_contact_id, -99))THEN
16491 l_service_request_rec.ship_to_contact_id := l_old_ServiceRequest_rec.ship_to_contact_id;
16492 -- For audit record added by shijain
16493 x_audit_vals_rec.change_ship_to_flag := 'N';
16494 x_audit_vals_rec.old_ship_to_contact_id := l_old_ServiceRequest_rec.ship_to_contact_id;
16495 x_audit_vals_rec.ship_to_contact_id := l_service_request_rec.ship_to_contact_id;
16496 ELSIF (l_service_request_rec.ship_to_contact_id IS NOT NULL) THEN
16497 l_SR_Validation_rec.ship_to_contact_id := l_service_request_rec.ship_to_contact_id;
16498 l_SR_Validation_rec.ship_to_party_id := l_service_request_rec.ship_to_party_id;
16499 END IF;
16500
16501 IF (NVL(l_service_request_rec.ship_to_contact_id, -99) <> NVL(l_old_ServiceRequest_rec.ship_to_contact_id, -99)) THEN
16502 -- For audit record
16503 x_audit_vals_rec.change_ship_to_FLAG := 'Y';
16504 x_audit_vals_rec.OLD_ship_to_contact_id := l_old_ServiceRequest_rec.ship_to_contact_id;
16505 x_audit_vals_rec.ship_to_contact_id := l_service_request_rec.ship_to_contact_id;
16506 --ELSE
16507 -- l_new_vals_rec.ship_to_contact_id := l_service_request_rec.ship_to_contact_id;
16508 END IF;
16509
16510 IF (l_service_request_rec.install_site_id = FND_API.G_MISS_NUM) OR
16511 (nvl(l_service_request_rec.install_site_id, -99) =
16512 nvl(l_old_ServiceRequest_rec.install_site_id, -99) ) THEN
16513 l_service_request_rec.install_site_id := l_old_ServiceRequest_rec.install_site_id;
16514 ELSE
16515 l_SR_Validation_rec.validate_install_site := FND_API.G_TRUE;
16516 l_SR_Validation_rec.install_site_id := l_service_request_rec.install_site_id;
16517 END IF;
16518
16519 IF (l_service_request_rec.install_site_use_id = FND_API.G_MISS_NUM) OR
16520 (nvl(l_service_request_rec.install_site_use_id, -99) =
16521 nvl(l_old_ServiceRequest_rec.install_site_use_id, -99) ) THEN
16522 l_service_request_rec.install_site_use_id := l_old_ServiceRequest_rec.install_site_use_id;
16523 ELSE
16524 l_SR_Validation_rec.validate_install_site := FND_API.G_TRUE;
16525 l_SR_Validation_rec.install_site_use_id := l_service_request_rec.install_site_use_id;
16526 END IF;
16527
16528 ---Put this fix because audit was erroring out from CC to SR.
16529 IF (l_service_request_rec.verify_cp_flag = 'Y') THEN
16530 IF (l_service_request_rec.customer_product_id = FND_API.G_MISS_NUM) OR
16531 (NVL(l_service_request_rec.customer_product_id,-99)
16532 = NVL(l_old_ServiceRequest_rec.customer_product_id,-99)) THEN
16533 l_service_request_rec.customer_product_id := l_old_ServiceRequest_rec.customer_product_id;
16534 -- For audit record added by shijain
16535 x_audit_vals_rec.change_customer_product_FLAG := 'N';
16536 x_audit_vals_rec.OLD_customer_product_id := l_old_ServiceRequest_rec.customer_product_id;
16537 x_audit_vals_rec.customer_product_id := l_service_request_rec.customer_product_id;
16538
16539 ELSE
16540 IF (l_service_request_rec.customer_product_id IS NOT NULL) THEN
16541 l_SR_Validation_rec.customer_product_id := l_service_request_rec.customer_product_id;
16542 -- For audit record
16543 x_audit_vals_rec.change_customer_product_FLAG := 'N';
16544 x_audit_vals_rec.OLD_customer_product_id := l_old_ServiceRequest_rec.customer_product_id;
16545 x_audit_vals_rec.customer_product_id := l_service_request_rec.customer_product_id;
16546 END IF;
16547 END IF;
16548 -- END IF;
16549
16550 l_service_request_rec.original_order_number := NULL;
16551 l_service_request_rec.purchase_order_num := NULL;
16552
16553 ELSE
16554
16555 -- for bug 3333340
16556 if (l_service_request_rec.cp_component_id <> FND_API.G_MISS_NUM AND
16557 l_service_request_rec.cp_component_id IS NOT NULL) then
16558 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16559 p_token_an => l_api_name_full,
16560 p_token_ip => 'p_cp_component_id' );
16561
16562 l_service_request_rec.cp_component_id := NULL;
16563 end if;
16564
16565 if (l_service_request_rec.cp_component_version_id <> FND_API.G_MISS_NUM AND
16566 l_service_request_rec.cp_component_version_id IS NOT NULL) then
16567 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16568 p_token_an => l_api_name_full,
16569 p_token_ip => 'p_cp_component_version_id' );
16570
16571 l_service_request_rec.cp_component_version_id := NULL;
16572 end if;
16573
16574 if (l_service_request_rec.cp_subcomponent_id <> FND_API.G_MISS_NUM AND
16575 l_service_request_rec.cp_subcomponent_id IS NOT NULL) then
16576 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16577 p_token_an => l_api_name_full,
16578 p_token_ip => 'p_cp_subcomponent_id' );
16579
16580 l_service_request_rec.cp_subcomponent_id := NULL;
16581 end if;
16582
16583 if (l_service_request_rec.cp_subcomponent_version_id <> FND_API.G_MISS_NUM AND
16584 l_service_request_rec.cp_subcomponent_version_id IS NOT NULL) then
16585 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16586 p_token_an => l_api_name_full,
16587 p_token_ip => 'p_cp_subcomponent_version_id' );
16588
16589 l_service_request_rec.cp_subcomponent_version_id := NULL;
16590 end if;
16591
16592 if (l_service_request_rec.cp_revision_id <> FND_API.G_MISS_NUM AND
16593 l_service_request_rec.cp_revision_id IS NOT NULL) then
16594 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16595 p_token_an => l_api_name_full,
16596 p_token_ip => 'p_cp_revision_id' );
16597
16598 l_service_request_rec.cp_revision_id := NULL;
16599 end if;
16600
16601 if (l_service_request_rec.product_revision <> FND_API.G_MISS_CHAR AND
16602 l_service_request_rec.product_revision IS NOT NULL) then
16603 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16604 p_token_an => l_api_name_full,
16605 p_token_ip => 'p_product_revision' );
16606
16607 l_service_request_rec.product_revision := NULL;
16608 end if;
16609
16610 if (l_service_request_rec.component_version <> FND_API.G_MISS_CHAR AND
16611 l_service_request_rec.component_version IS NOT NULL) then
16612 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16613 p_token_an => l_api_name_full,
16614 p_token_ip => 'p_component_version' );
16615
16616 l_service_request_rec.component_version := NULL;
16617 end if;
16618
16619 if (l_service_request_rec.subcomponent_version <> FND_API.G_MISS_CHAR AND
16620 l_service_request_rec.subcomponent_version IS NOT NULL) then
16621 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg(
16622 p_token_an => l_api_name_full,
16623 p_token_ip => 'p_subcomponent_version' );
16624
16625 l_service_request_rec.subcomponent_version := NULL;
16626 end if;
16627
16628 -- Verify CP is 'N'
16629 -- This step id done so that l_service_request_rec.customer_product_id does not have MISS NUM value
16630 -- Added to take care of a situation where verify_cp is passed as 'N' by the caller
16631 -- This means that the customer_product_id and the related fields should be null
16632 l_service_request_rec.customer_product_id := NULL;
16633 x_audit_vals_rec.customer_product_id := NULL ;
16634 ---l_service_request_rec.account_id := NULL;
16635 l_service_request_rec.cp_component_id := NULL;
16636 l_service_request_rec.cp_component_version_id := NULL;
16637 l_service_request_rec.cp_subcomponent_id := NULL;
16638 l_service_request_rec.cp_subcomponent_version_id := NULL;
16639 l_service_request_rec.cp_revision_id := NULL;
16640 l_service_request_rec.product_revision := NULL;
16641 l_service_request_rec.component_version := NULL;
16642 l_service_request_rec.subcomponent_version := NULL;
16643
16644
16645
16646 --- fix for bug# 1657370 --jngeorge --05/22/01
16647 --l_service_request_rec.current_serial_number := NULL;
16648 --- commenting the above line 'coz it clears the current_serial_number
16649 --- during an update for a non-IB .Fix for Bug# 1902127.
16650
16651 -- added a condition to check if the new inventory_item_id is same
16652 -- as old value. Fix for Bug#1854325 -- jngeorge
16653
16654 IF (l_service_request_rec.inventory_item_id = FND_API.G_MISS_NUM) OR
16655 (l_service_request_rec.inventory_item_id =l_old_ServiceRequest_rec.inventory_item_id) THEN
16656 l_service_request_rec.inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id;
16657 ELSE
16658 IF (l_service_request_rec.inventory_item_id IS NOT NULL) THEN
16659 l_SR_Validation_rec.inventory_item_id := l_service_request_rec.inventory_item_id;
16660 END IF;
16661 END IF;
16662
16663 IF (l_service_request_rec.original_order_number = FND_API.G_MISS_NUM) THEN
16664 l_service_request_rec.original_order_number := l_old_ServiceRequest_rec.original_order_number;
16665 END IF;
16666
16667 IF (l_service_request_rec.purchase_order_num = FND_API.G_MISS_CHAR) THEN
16668 l_service_request_rec.purchase_order_num := l_old_ServiceRequest_rec.purchase_order_num;
16669 END IF;
16670
16671 END IF;
16672
16673 -- added a condition to check if the new inventory_item_id is same
16674 -- as old value. Fix for Bug#1854325 -- jngeorge
16675 IF (l_service_request_rec.inventory_item_id = FND_API.G_MISS_NUM) OR
16676 (l_service_request_rec.inventory_item_id =l_old_ServiceRequest_rec.inventory_item_id) THEN
16677 l_service_request_rec.inventory_item_id := l_old_ServiceRequest_rec.inventory_item_id;
16678 ELSE
16679 IF (l_service_request_rec.inventory_item_id IS NOT NULL) THEN
16680 l_SR_Validation_rec.inventory_item_id := l_service_request_rec.inventory_item_id;
16681 END IF;
16682 END IF;
16683
16684 IF (NVL(l_service_request_rec.customer_product_id, -99) <> NVL(l_old_ServiceRequest_rec.customer_product_id, -99)) THEN
16685 -- For audit record
16686 x_audit_vals_rec.change_customer_product_FLAG := 'Y';
16687 x_audit_vals_rec.OLD_customer_product_id := l_old_ServiceRequest_rec.customer_product_id;
16688 x_audit_vals_rec.customer_product_id := l_service_request_rec.customer_product_id;
16689 END IF;
16690
16691 IF (l_service_request_rec.current_serial_number = FND_API.G_MISS_CHAR) THEN
16692 l_service_request_rec.current_serial_number := l_old_ServiceRequest_rec.current_serial_number;
16693 ELSE
16694 IF (l_service_request_rec.current_serial_number IS NOT NULL) THEN
16695 l_SR_Validation_rec.current_serial_number := l_service_request_rec.current_serial_number;
16696 END IF;
16697 END IF;
16698
16699 --Assign the inventory org id retrived from the table to the validation record
16700 l_SR_Validation_rec.inventory_org_id := l_service_request_rec.inventory_org_id;
16701
16702 -- Added for ER# 2433831 -- Bill To Account and Ship to Account
16703 IF (l_service_request_rec.bill_to_account_id = FND_API.G_MISS_NUM) THEN
16704 l_service_request_rec.bill_to_account_id := l_old_ServiceRequest_rec.bill_to_account_id ;
16705 ELSE
16706 IF (l_service_request_rec.bill_to_account_id IS NOT NULL) THEN
16707 l_SR_Validation_rec.bill_to_account_id := l_service_request_rec.bill_to_account_id ;
16708 l_SR_Validation_rec.bill_to_party_id := l_service_request_rec.bill_to_party_id ;
16709 END IF;
16710 END IF ;
16711
16712 IF (l_service_request_rec.ship_to_account_id = FND_API.G_MISS_NUM) THEN
16713 l_service_request_rec.ship_to_account_id := l_old_ServiceRequest_rec.ship_to_account_id ;
16714 ELSE
16715 IF (l_service_request_rec.ship_to_account_id IS NOT NULL) THEN
16716 l_SR_Validation_rec.ship_to_account_id := l_service_request_rec.ship_to_account_id ;
16717 l_SR_Validation_rec.ship_to_party_id := l_service_request_rec.ship_to_party_id ;
16718 END IF;
16719 END IF ;
16720
16721 -- Added for ER# 2463321 -- Non-Promary customer contacts (Phone and Email).
16722 IF (l_service_request_rec.customer_phone_id = FND_API.G_MISS_NUM) THEN
16723 l_service_request_rec.customer_phone_id := l_old_ServiceRequest_rec.customer_phone_id ;
16724 ELSE
16725 IF (l_service_request_rec.customer_phone_id IS NOT NULL) THEN
16726 l_SR_Validation_rec.customer_phone_id := l_service_request_rec.customer_phone_id ;
16727 END IF;
16728 END IF ;
16729
16730 IF (l_service_request_rec.customer_email_id = FND_API.G_MISS_NUM) THEN
16731 l_service_request_rec.customer_email_id := l_old_ServiceRequest_rec.customer_email_id ;
16732 ELSE
16733 IF (l_service_request_rec.customer_email_id IS NOT NULL) THEN
16734 l_SR_Validation_rec.customer_email_id := l_service_request_rec.customer_email_id ;
16735 END IF;
16736 END IF ;
16737
16738 -- for cmro_eam
16739 IF (l_service_request_rec.owning_dept_id = FND_API.G_MISS_NUM) THEN
16740 l_service_request_rec.owning_dept_id := l_old_ServiceRequest_rec.owning_department_id ;
16741 ELSE
16742 IF (l_service_request_rec.owning_dept_id IS NOT NULL) THEN
16743 l_SR_Validation_rec.owning_dept_id := l_service_request_rec.owning_dept_id ;
16744 END IF;
16745 END IF;
16746
16747 -- end of cmro_eam
16748
16749 -- For bug 3635269
16750 IF (l_service_request_rec.sr_creation_channel = FND_API.G_MISS_CHAR) THEN
16751 l_service_request_rec.sr_creation_channel := l_old_ServiceRequest_rec.sr_creation_channel ;
16752 ELSE
16753 IF (l_service_request_rec.sr_creation_channel IS NOT NULL) THEN
16754 l_SR_Validation_rec.sr_creation_channel := l_service_request_rec.sr_creation_channel ;
16755 END IF;
16756 END IF;
16757
16758 --
16759 -- Call the validation procedure if the validation level is
16760 -- properly set
16761 --
16762 IF (p_validation_level > FND_API.G_VALID_LEVEL_NONE) THEN
16763 Validate_ServiceRequest_Record(
16764 p_api_name => l_api_name_full,
16765 p_service_request_rec => l_SR_Validation_rec,
16766 p_request_date => l_old_ServiceRequest_rec.incident_date,
16767 p_org_id => l_org_id,
16768 p_resp_appl_id => p_resp_appl_id,
16769 p_resp_id => p_resp_id,
16770 p_user_id => p_last_updated_by,
16771 p_operation => l_operation,
16772 p_close_flag => l_close_flag,
16773 p_disallow_request_update=> l_disallow_request_update,
16774 p_disallow_owner_update => l_disallow_owner_update,
16775 p_disallow_product_update=> l_disallow_product_update,
16776 p_employee_name => l_employee_name,
16777 p_inventory_item_id => l_cp_inventory_item_id,
16778 p_contract_id => l_contra_id,
16779 p_contract_number => l_contract_number,
16780 x_bill_to_site_id => l_bill_to_site_id,
16781 x_ship_to_site_id => l_ship_to_site_id,
16782 x_bill_to_site_use_id => l_bill_to_site_use_id,
16783 x_ship_to_site_use_id => l_ship_to_site_use_id,
16784 x_return_status => l_return_status,
16785 x_group_name => l_group_name,
16786 x_owner_name => l_owner_name,
16787 x_product_revision => l_dummy0,
16788 x_component_version => l_dummy1,
16789 x_subcomponent_version => l_dummy2,
16790 --for cmro_eam
16791 p_cmro_flag => p_cmro_flag,
16792 p_maintenance_flag => p_maintenance_flag,
16793 p_sr_mode => 'UPDATE'
16794 );
16795
16796 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
16797 RAISE FND_API.G_EXC_ERROR;
16798 END IF;
16799 IF (l_contra_id is NOT NULL) THEN
16800 x_contra_id := l_contra_id;
16801 END IF;
16802 IF (l_contra_id is NOT NULL) THEN
16803 x_contract_number := l_contract_number;
16804 END IF;
16805
16806 -- For bug 3340433
16807 /* Commenting the assignments as the validations are not called from
16808 validate_servicerequest_record because of the update mode */
16809
16810 /*
16811
16812 IF (l_service_request_rec.ship_to_site_id = FND_API.G_MISS_NUM) OR
16813 (NVL(l_service_request_rec.ship_to_site_id, -99)
16814 = NVL(l_old_ServiceRequest_rec.ship_to_site_id, -99))
16815 THEN
16816 IF l_ship_to_site_id IS NULL OR
16817 l_ship_to_site_id =l_old_ServiceRequest_rec.ship_to_site_id
16818 THEN
16819 l_service_request_rec.ship_to_site_id :=
16820 l_old_ServiceRequest_rec.ship_to_site_id;
16821 ELSE
16822 l_service_request_rec.ship_to_site_id := l_ship_to_site_id;
16823 END IF;
16824 END IF;
16825
16826 IF (l_service_request_rec.ship_to_site_use_id = FND_API.G_MISS_NUM) OR
16827 (NVL(l_service_request_rec.ship_to_site_use_id, -99)
16828 = NVL(l_old_ServiceRequest_rec.ship_to_site_use_id, -99))
16829 THEN
16830 IF l_ship_to_site_use_id IS NULL OR
16831 l_ship_to_site_use_id =l_old_ServiceRequest_rec.ship_to_site_use_id
16832 THEN
16833 l_service_request_rec.ship_to_site_use_id :=
16834 l_old_ServiceRequest_rec.ship_to_site_use_id;
16835 ELSE
16836 l_service_request_rec.ship_to_site_use_id := l_ship_to_site_use_id;
16837 END IF;
16838 END IF;
16839
16840 IF (l_service_request_rec.bill_to_site_id = FND_API.G_MISS_NUM) OR
16841 (NVL(l_service_request_rec.bill_to_site_id, -99)
16842 = NVL(l_old_ServiceRequest_rec.bill_to_site_id, -99))
16843 THEN
16844 IF l_bill_to_site_id IS NULL OR
16845 l_bill_to_site_id =l_old_ServiceRequest_rec.bill_to_site_id
16846 THEN
16847 l_service_request_rec.bill_to_site_id :=
16848 l_old_ServiceRequest_rec.bill_to_site_id;
16849 ELSE
16850 l_service_request_rec.bill_to_site_id := l_bill_to_site_id;
16851 END IF;
16852 END IF;
16853
16854 IF (l_service_request_rec.bill_to_site_use_id = FND_API.G_MISS_NUM) OR
16855 (NVL(l_service_request_rec.bill_to_site_use_id, -99)
16856 = NVL(l_old_ServiceRequest_rec.bill_to_site_use_id, -99))
16857 THEN
16858 IF l_bill_to_site_use_id IS NULL OR
16859 l_bill_to_site_use_id =l_old_ServiceRequest_rec.bill_to_site_use_id
16860 THEN
16861 l_service_request_rec.bill_to_site_use_id :=
16862 l_old_ServiceRequest_rec.bill_to_site_use_id;
16863 ELSE
16864 l_service_request_rec.bill_to_site_use_id := l_bill_to_site_use_id;
16865 END IF;
16866 END IF;
16867
16868 --
16869 -- Need to store the inventory_item_id from the CP if CP is
16870 -- used
16871 --
16872 -- Added a condition because inventory_item_id becomes null
16873 -- Fix for Bug# 1854325.-- jngeorge
16874 -- If customer_product_id is specified then the inventory item id
16875 -- specified in the record type is always overwritten by the
16876 -- inventory item id value in the
16877 -- CS_CUSTOMER_PRODUCTS_ALL for that customer_product_id
16878
16879
16880
16881 IF (l_service_request_rec.customer_product_id IS NOT NULL) AND
16882 (l_service_request_rec.inventory_item_id <> l_old_ServiceRequest_rec.inventory_item_id) THEN
16883 l_service_request_rec.inventory_item_id := l_cp_inventory_item_id;
16884
16885 END IF; */
16886
16887 --added this code on dec 8th 2000
16888 IF l_status_validated = TRUE THEN
16889 l_close_flag := l_closed_flag_temp ;
16890 END IF;
16891
16892 -- For bug 3464004
16893 -- Close date was nullified when the closed SR is updated with summary
16894 -- or urgency
16895 -- The validate_status and validate_updated_status is not called when the
16896 -- status is not updated so the close_flag is null
16897
16898 if ( l_service_request_rec.status_id = FND_API.G_MISS_NUM) then
16899
16900 l_temp_close_flag := get_status_flag(l_old_ServiceRequest_rec.incident_status_id);
16901 if (l_temp_close_flag = 'C') then
16902 l_close_flag := 'Y';
16903 else
16904 l_close_flag := 'N';
16905 end if;
16906 else
16907 -- for bug 3520943 - to get the close date
16908 l_temp_close_flag := get_status_flag(l_service_request_rec.status_id);
16909
16910 if (l_temp_close_flag = 'C') then
16911 l_close_flag := 'Y';
16912 else
16913 l_close_flag := 'N';
16914 end if;
16915
16916 end if;
16917
16918 --
16919 -- We can only verify the close_date after calling the validation
16920 -- procedure because we need to get the closed_flag first
16921 --
16922 IF (l_close_flag = 'Y') THEN
16923 -- Added it for Ehn. 2655115
16924 -- Commented out for bug #3050727, since this is now redundant after the bug-fix --anmukher --09/15/03
16925 -- l_service_request_rec.status_flag := 'C';
16926
16927 IF ((l_service_request_rec.closed_date = FND_API.G_MISS_DATE) OR
16928 (l_service_request_rec.closed_date IS NULL)) THEN
16929 IF (l_old_ServiceRequest_rec.close_date IS NULL) THEN
16930 l_service_request_rec.closed_date := SYSDATE;
16931 ELSE
16932 l_service_request_rec.closed_date := l_old_ServiceRequest_rec.close_date;
16933 END IF;
16934 ELSIF (l_service_request_rec.closed_date IS NOT NULL) THEN
16935
16936 CS_ServiceRequest_UTIL.Validate_Closed_Date
16937 ( p_api_name => l_api_name_full,
16938 p_parameter_name => 'p_closed_date',
16939 p_closed_date => l_service_request_rec.closed_date,
16940 p_request_date => l_old_ServiceRequest_rec.incident_date,
16941 x_return_status => l_return_status
16942 );
16943 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
16944 RAISE FND_API.G_EXC_ERROR;
16945 END IF;
16946 END IF;
16947 ELSE
16948 -- Added it for Ehn. 2655115
16949 -- Commented out for bug #3050727, since this is now redundant after the bug-fix --anmukher --09/15/03
16950 -- l_service_request_rec.status_flag:= 'O';
16951
16952 IF (l_service_request_rec.closed_date <> FND_API.G_MISS_DATE) THEN
16953
16954 CS_ServiceRequest_UTIL.Add_Param_Ignored_Msg
16955 ( p_token_an => l_api_name_full,
16956 p_token_ip => 'p_closed_date',
16957 p_table_name => G_TABLE_NAME,
16958 p_column_name => 'CLOSED_DATE' );
16959 END IF;
16960 l_service_request_rec.closed_date := NULL;
16961 END IF;
16962 END IF; /* Validation Level */
16963
16964 -- for the bug 3050727
16965 -- Commented out the IF-END IF since the assignment should be done anyway --anmukher --09/15/03
16966 -- IF (p_validation_level = FND_API.G_VALID_LEVEL_NONE) THEN
16967 l_service_request_rec.status_flag := get_status_flag(l_service_request_rec.status_id);
16968 -- END IF;
16969
16970 /* Bug 2624341 close date should be audited if the status is changed,
16971 i.e. if the status is changed from closed to open the the close_date
16972 should be nullfied, in the audit table, so moved this code after
16973 checking the close_flag and setting the close_date based on the
16974 close_flag. Change done by shijain*/
16975
16976 IF (l_service_request_rec.closed_date = FND_API.G_MISS_DATE) OR
16977 (l_service_request_rec.closed_date IS NULL AND
16978 l_old_ServiceRequest_rec.close_date IS NULL) OR
16979 (l_service_request_rec.closed_date = l_old_ServiceRequest_rec.close_date)
16980 THEN
16981 l_service_request_rec.closed_date := l_old_ServiceRequest_rec.close_date;
16982 IF (x_audit_vals_rec.change_incident_status_flag = 'Y')
16983 AND (l_closed_flag_temp = 'N' OR l_closed_flag_temp IS NULL)
16984 THEN
16985 l_service_request_rec.closed_date := NULL;
16986 END IF;
16987 -- For audit record added by shijain
16988 x_audit_vals_rec.change_close_date_flag := 'N';
16989 x_audit_vals_rec.old_close_date := l_old_ServiceRequest_rec.close_date;
16990 x_audit_vals_rec.close_date := l_service_request_rec.closed_date;
16991 ELSE
16992 -- For audit record
16993 x_audit_vals_rec.change_close_date_FLAG := 'Y';
16994 x_audit_vals_rec.OLD_close_date := l_old_ServiceRequest_rec.close_date;
16995 x_audit_vals_rec.close_date := l_service_request_rec.closed_date;
16996 END IF;
16997
16998 /* Enh. 2624341 status flag should be audited based on the close_flag,
16999 if the close flag='Y' then the status_flag should be C else O, so
17000 we are checking the status flag after we get the close flag in
17001 validate_service_request procedure.Change done by shijain*/
17002
17003 IF (l_service_request_rec.status_flag = FND_API.G_MISS_CHAR) OR
17004 ( l_service_request_rec.status_flag = l_old_ServiceRequest_rec.status_flag )
17005 THEN
17006 l_service_request_rec.status_flag := l_old_ServiceRequest_rec.status_flag;
17007 -- For audit record added by shijain
17008 x_audit_vals_rec.change_status_flag := 'N';
17009 x_audit_vals_rec.old_status_flag := l_old_ServiceRequest_rec.status_flag ;
17010 x_audit_vals_rec.status_flag := l_service_request_rec.status_flag;
17011 ELSE
17012 -- For audit record
17013 x_audit_vals_rec.CHANGE_status_flag := 'Y';
17014 x_audit_vals_rec.OLD_status_flag := l_old_ServiceRequest_rec.status_flag ;
17015 x_audit_vals_rec.status_flag := l_service_request_rec.status_flag;
17016 END IF;
17017
17018 -- for cmro_eam
17019 IF (l_service_request_rec.owning_dept_id = FND_API.G_MISS_NUM OR
17020 l_service_request_rec.owning_dept_id = l_old_ServiceRequest_rec.owning_department_id) THEN
17021 l_service_request_rec.owning_dept_id := l_old_ServiceRequest_rec.owning_department_id;
17022 END IF;
17023
17024 -- end for cmro_eam
17025 ---------------------------------------------------
17026 -- Before the actual update, see if the all the fields have their old values or null values
17027 --(otherwise they will have the MISS_NUM constants)
17028 IF (l_service_request_rec.customer_id = FND_API.G_MISS_NUM OR
17029 l_service_request_rec.customer_id = l_old_ServiceRequest_rec.customer_id) THEN
17030 l_service_request_rec.customer_id := l_old_ServiceRequest_rec.customer_id;
17031 END IF;
17032
17033 IF (l_service_request_rec.bill_to_site_id = FND_API.G_MISS_NUM OR
17034 l_service_request_rec.bill_to_site_id = l_old_ServiceRequest_rec.bill_to_site_id) THEN
17035 l_service_request_rec.bill_to_site_id := l_old_ServiceRequest_rec.bill_to_site_id ;
17036 END IF;
17037
17038 IF (l_service_request_rec.bill_to_site_use_id = FND_API.G_MISS_NUM OR
17039 l_service_request_rec.bill_to_site_use_id = l_old_ServiceRequest_rec.bill_to_site_use_id) THEN
17040 l_service_request_rec.bill_to_site_use_id := l_old_ServiceRequest_rec.bill_to_site_use_id ;
17041 END IF;
17042
17043 IF (l_service_request_rec.bill_to_party_id = FND_API.G_MISS_NUM OR
17044 l_service_request_rec.bill_to_party_id = l_old_ServiceRequest_rec.bill_to_party_id) THEN
17045 l_service_request_rec.bill_to_party_id := l_old_ServiceRequest_rec.bill_to_party_id ;
17046 END IF;
17047
17048 IF (l_service_request_rec.ship_to_site_id = FND_API.G_MISS_NUM OR
17049 l_service_request_rec.ship_to_site_id = l_old_ServiceRequest_rec.ship_to_site_id) THEN
17050 l_service_request_rec.ship_to_site_id := l_old_ServiceRequest_rec.ship_to_site_id ;
17051 END IF;
17052
17053 IF (l_service_request_rec.ship_to_site_use_id = FND_API.G_MISS_NUM OR
17054 l_service_request_rec.ship_to_site_use_id = l_old_ServiceRequest_rec.ship_to_site_use_id) THEN
17055 l_service_request_rec.ship_to_site_use_id := l_old_ServiceRequest_rec.ship_to_site_use_id ;
17056 END IF;
17057
17058 IF (l_service_request_rec.ship_to_party_id = FND_API.G_MISS_NUM OR
17059 l_service_request_rec.ship_to_party_id = l_old_ServiceRequest_rec.ship_to_party_id) THEN
17060 l_service_request_rec.ship_to_party_id := l_old_ServiceRequest_rec.ship_to_party_id ;
17061 END IF;
17062
17063 IF (l_service_request_rec.install_site_id = FND_API.G_MISS_NUM OR
17064 nvl(l_service_request_rec.install_site_id,-99) = nvl(l_old_ServiceRequest_rec.install_site_id,-99)
17065 )
17066 AND (l_service_request_rec.install_site_use_id <> FND_API.G_MISS_NUM OR
17067 nvl(l_service_request_rec.install_site_use_id,-99) <> nvl(l_old_ServiceRequest_rec.install_site_use_id,-99))
17068 THEN
17069 l_service_request_rec.install_site_use_id := l_service_request_rec.install_site_use_id;
17070 l_service_request_rec.install_site_id := l_service_request_rec.install_site_use_id;
17071 END IF;
17072
17073 IF (l_service_request_rec.install_site_use_id = FND_API.G_MISS_NUM OR
17074 nvl(l_service_request_rec.install_site_use_id,-99) = nvl(l_old_ServiceRequest_rec.install_site_use_id,-99)
17075 )
17076 AND (l_service_request_rec.install_site_id <> FND_API.G_MISS_NUM OR
17077 nvl(l_service_request_rec.install_site_id,-99) <> nvl(l_old_ServiceRequest_rec.install_site_id,-99))
17078 THEN
17079 l_service_request_rec.install_site_id := l_service_request_rec.install_site_id;
17080 l_service_request_rec.install_site_use_id := l_service_request_rec.install_site_id;
17081 END IF;
17082
17083 IF (l_service_request_rec.bill_to_contact_id = FND_API.G_MISS_NUM OR
17084 l_service_request_rec.bill_to_contact_id = l_old_ServiceRequest_rec.bill_to_contact_id) THEN
17085 l_service_request_rec.bill_to_contact_id := l_old_ServiceRequest_rec.bill_to_contact_id;
17086 END IF;
17087
17088 IF (l_service_request_rec.ship_to_contact_id = FND_API.G_MISS_NUM OR
17089 l_service_request_rec.ship_to_contact_id = l_old_ServiceRequest_rec.ship_to_contact_id) THEN
17090 l_service_request_rec.ship_to_contact_id := l_old_ServiceRequest_rec.ship_to_contact_id;
17091 END IF;
17092
17093 -- Added for ER# 2320056 -- Coverage Type
17094 IF (l_service_request_rec.coverage_type = FND_API.G_MISS_CHAR) THEN
17095 l_service_request_rec.coverage_type := l_old_ServiceRequest_rec.coverage_type ;
17096 END IF ;
17097
17098 -- If the contract service id is null then coverage type should be null
17099 -- Added this check for 1159 by shijain dec6th 2002
17100 IF (l_service_request_rec.contract_service_id = FND_API.G_MISS_NUM)
17101 OR (l_service_request_rec.contract_service_id IS NULL) THEN
17102 l_service_request_rec.coverage_type := NULL;
17103 END IF;
17104
17105
17106 IF (l_service_request_rec.program_id = FND_API.G_MISS_NUM) THEN
17107 l_service_request_rec.program_id := l_old_ServiceRequest_rec.program_id ;
17108 END IF ;
17109
17110 IF (l_service_request_rec.program_application_id = FND_API.G_MISS_NUM) THEN
17111 l_service_request_rec.program_application_id := l_old_ServiceRequest_rec.program_application_id ;
17112 END IF ;
17113
17114 IF (l_service_request_rec.conc_request_id = FND_API.G_MISS_NUM) THEN
17115 l_service_request_rec.conc_request_id := l_old_ServiceRequest_rec.request_id ;
17116 END IF ;
17117
17118 IF (l_service_request_rec.program_login_id = FND_API.G_MISS_NUM) THEN
17119 l_service_request_rec.program_login_id := l_old_ServiceRequest_rec.program_login_id ;
17120 END IF ;
17121
17122 --- Added for HA, the WHO columns should be derived before inserting
17123 --- if passed null or has G_MISS values.
17124 IF (l_service_request_rec.last_update_date = FND_API.G_MISS_DATE OR
17125 l_service_request_rec.last_update_date IS NULL ) THEN
17126 l_service_request_rec.last_update_date := SYSDATE;
17127 END IF;
17128
17129 IF (l_service_request_rec.last_updated_by = FND_API.G_MISS_NUM OR
17130 l_service_request_rec.last_updated_by IS NULL ) THEN
17131 l_service_request_rec.last_updated_by := p_last_updated_by;
17132 END IF;
17133
17134 IF (l_service_request_rec.creation_date = FND_API.G_MISS_DATE OR
17135 l_service_request_rec.creation_date IS NULL ) THEN
17136 l_service_request_rec.creation_date := SYSDATE;
17137 END IF;
17138
17139 IF (l_service_request_rec.created_by = FND_API.G_MISS_NUM OR
17140 l_service_request_rec.created_by IS NULL ) THEN
17141 l_service_request_rec.created_by := p_last_updated_by;
17142 END IF;
17143
17144 IF (l_service_request_rec.last_update_login = FND_API.G_MISS_NUM OR
17145 l_service_request_rec.last_update_login IS NULL ) THEN
17146 l_service_request_rec.last_update_login := p_last_update_login;
17147 END IF;
17148
17149 IF (l_service_request_rec.maint_organization_id = FND_API.G_MISS_NUM) THEN
17150 l_service_request_rec.maint_organization_id := l_old_ServiceRequest_rec.maint_organization_id ;
17151 END IF ;
17152
17153 IF (l_service_request_rec.site_id = FND_API.G_MISS_NUM) THEN
17154 l_service_request_rec.site_id := l_old_ServiceRequest_rec.site_id ;
17155 END IF ;
17156
17157
17158 ---------------------------------------------------
17159 ----Added for Enhancements 11.5.6
17160 IF (l_service_request_rec.owner_group_id IS NOT NULL AND
17161 l_service_request_rec.owner_id IS NOT NULL) OR
17162 (l_service_request_rec.owner_group_id IS NOT NULL AND
17163 l_service_request_rec.group_type = 'RS_TEAM') THEN
17164 l_service_request_rec.owner_assigned_flag := 'Y';
17165 ELSIF (l_service_request_rec.owner_group_id IS NULL) THEN
17166 l_service_request_rec.owner_assigned_flag := 'N';
17167 END IF;
17168 --*************************************************
17169
17170 --Added code to fix Bug# 1948054
17171 IF (p_validation_level = FND_API.G_VALID_LEVEL_NONE) THEN
17172 --
17173 -- Validate contract service id
17174 --
17175 IF (l_service_request_rec.contract_service_id <> FND_API.G_MISS_NUM AND
17176 l_service_request_rec.contract_service_id IS NOT NULL) THEN
17177
17178 CS_ServiceRequest_UTIL.Validate_Contract_Service_Id(
17179 p_api_name => l_api_name,
17180 p_parameter_name => 'p_contract_service_id',
17181 p_contract_service_id => l_service_request_rec.contract_service_id,
17182 x_contract_id =>x_contra_id,
17183 x_contract_number =>x_contract_number,
17184 x_return_status => l_return_status);
17185
17186 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
17187 x_return_status := FND_API.G_RET_STS_ERROR;
17188 RETURN;
17189 END IF;
17190 END IF;
17191
17192 -- Validate contract id
17193 --
17194 IF (p_service_request_rec.contract_id <> FND_API.G_MISS_NUM) AND
17195 (p_service_request_rec.contract_id IS NOT NULL) AND
17196 (p_service_request_rec.contract_service_id IS NULL OR
17197 p_service_request_rec.contract_service_id = FND_API.G_MISS_NUM) THEN
17198
17199 CS_ServiceRequest_UTIL.Validate_Contract_Id(
17200 p_api_name => l_api_name,
17201 p_parameter_name => 'p_contract_id',
17202 p_contract_id => l_service_request_rec.contract_id,
17203 x_contract_number => x_contract_number,
17204 x_return_status => l_return_status);
17205
17206 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
17207 x_return_status := FND_API.G_RET_STS_ERROR;
17208 RETURN;
17209 END IF;
17210 x_contra_id := l_service_request_rec.contract_id;
17211
17212 END IF;
17213
17214 END IF; --- p validation_level
17215
17216 ---- Added this code because the form is clearing the group,
17217 ---- when group_type is not entered.
17218
17219 IF (l_service_request_rec.owner_group_id IS NOT NULL AND
17220 l_service_request_rec.group_type IS NULL) THEN
17221 l_service_request_rec.owner_group_id := NULL;
17222 END IF;
17223
17224 -- Added this code for source changes for 11.5.9 by shijain dated oct 11 2002
17225 -- this code is to check if the last_update_program_code is passed and is not
17226 -- null as this is a mandatory parameter.
17227
17228 IF (l_service_request_rec.last_update_program_code = FND_API.G_MISS_CHAR OR
17229 l_service_request_rec.last_update_program_code IS NULL) THEN
17230
17231 /*Commented this code for backward compatibility, that if someone
17232 passes a last update program code as NULL or G_MISS_CHAR, we are supporting
17233 it now and defaulting it to UNKNOWN
17234 CS_ServiceRequest_UTIL.Add_Null_Parameter_Msg
17235 ( p_token_an => l_api_name_full,
17236 p_token_np => 'SR Last Update Program Code',
17237 p_table_name => G_TABLE_NAME ,
17238 p_column_name => 'LAST_UPDATE_PROGRAM_CODE');
17239
17240 RAISE FND_API.G_EXC_ERROR;
17241 */
17242 l_service_request_rec.last_update_program_code:='UNKNOWN';
17243 END IF;
17244
17245 --
17246 -- Validate last update program code 10/11/02 shijain
17247 --
17248
17249 IF (l_service_request_rec.last_update_program_code <> FND_API.G_MISS_CHAR) AND
17250 (l_service_request_rec.last_update_program_code IS NOT NULL) THEN
17251
17252 CS_ServiceRequest_UTIL.Validate_source_program_code(
17253 p_api_name => l_api_name,
17254 p_parameter_name => 'p_last_update_program_code',
17255 p_source_program_code => l_service_request_rec.last_update_program_code,
17256 x_return_status => l_return_status);
17257
17258 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
17259 x_return_status := FND_API.G_RET_STS_ERROR;
17260 RETURN;
17261 END IF;
17262 END IF;
17263
17264 -- Added for address by shijain 05 dec 2002
17265 IF (l_service_request_rec.INCIDENT_DIRECTION_QUALIFIER <> FND_API.G_MISS_CHAR) AND
17266 (l_service_request_rec.INCIDENT_DIRECTION_QUALIFIER IS NOT NULL) THEN
17267
17268 CS_ServiceRequest_UTIL.Validate_INC_DIRECTION_QUAL(
17269 p_api_name => l_api_name,
17270 p_parameter_name => 'p_INC_DIRECTION_QUAL',
17271 p_INC_DIRECTION_QUAL => l_service_request_rec.INCIDENT_DIRECTION_QUALIFIER,
17272 x_return_status => l_return_status);
17273
17274 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
17275 x_return_status := FND_API.G_RET_STS_ERROR;
17276 RETURN;
17277 END IF;
17278 END IF;
17279
17280 -- Added for address by shijain 05 dec 2002
17281 IF (l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM <> FND_API.G_MISS_CHAR) AND
17282 (l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM IS NOT NULL) THEN
17283
17284
17285 CS_ServiceRequest_UTIL.Validate_INC_DIST_QUAL_UOM(
17286 p_api_name => l_api_name,
17287 p_parameter_name => 'p_INC_DIST_QUAL_UOM',
17288 p_INC_DIST_QUAL_UOM => l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM,
17289 x_return_status => l_return_status);
17290
17291 IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
17292 x_return_status := FND_API.G_RET_STS_ERROR;
17293 RETURN;
17294 END IF;
17295 END IF;
17296
17297 x_audit_vals_rec.OLD_INCIDENT_NUMBER := l_old_ServiceRequest_rec.INCIDENT_NUMBER;
17298 x_audit_vals_rec.INCIDENT_NUMBER := l_old_ServiceRequest_rec.INCIDENT_NUMBER;
17299
17300 x_audit_vals_rec.OLD_CUSTOMER_ID := l_old_ServiceRequest_rec.CUSTOMER_ID;
17301 IF (nvl(l_service_request_rec.CUSTOMER_ID,-99) <> FND_API.G_MISS_NUM) AND
17302 (nvl(l_service_request_rec.CUSTOMER_ID,-99) <> nvl(l_old_ServiceRequest_rec.CUSTOMER_ID,-99)) THEN
17303 x_audit_vals_rec.CUSTOMER_ID := l_service_request_rec.CUSTOMER_ID;
17304 ELSE
17305 x_audit_vals_rec.CUSTOMER_ID := l_old_ServiceRequest_rec.CUSTOMER_ID;
17306 END IF;
17307
17308 x_audit_vals_rec.OLD_BILL_TO_SITE_USE_ID := l_old_ServiceRequest_rec.BILL_TO_SITE_USE_ID;
17309 IF (nvl(l_service_request_rec.BILL_TO_SITE_USE_ID,-99) <> FND_API.G_MISS_NUM) AND
17310 (nvl(l_service_request_rec.BILL_TO_SITE_USE_ID,-99) <> nvl(l_old_ServiceRequest_rec.BILL_TO_SITE_USE_ID,-99)) THEN
17311 x_audit_vals_rec.BILL_TO_SITE_USE_ID := l_service_request_rec.BILL_TO_SITE_USE_ID;
17312 ELSE
17313 x_audit_vals_rec.BILL_TO_SITE_USE_ID := l_old_ServiceRequest_rec.BILL_TO_SITE_USE_ID;
17314 END IF;
17315
17316 x_audit_vals_rec.OLD_EMPLOYEE_ID := l_old_ServiceRequest_rec.EMPLOYEE_ID;
17317 IF (nvl(l_service_request_rec.EMPLOYEE_ID,-99) <> FND_API.G_MISS_NUM) AND
17318 (nvl(l_service_request_rec.EMPLOYEE_ID,-99) <> nvl(l_old_ServiceRequest_rec.EMPLOYEE_ID,-99)) THEN
17319 x_audit_vals_rec.EMPLOYEE_ID := l_service_request_rec.EMPLOYEE_ID;
17320 ELSE
17321 x_audit_vals_rec.EMPLOYEE_ID := l_old_ServiceRequest_rec.EMPLOYEE_ID;
17322 END IF;
17323
17324 x_audit_vals_rec.OLD_SHIP_TO_SITE_USE_ID := l_old_ServiceRequest_rec.SHIP_TO_SITE_USE_ID;
17325 IF (nvl(l_service_request_rec.SHIP_TO_SITE_USE_ID,-99) <> FND_API.G_MISS_NUM) AND
17326 (nvl(l_service_request_rec.SHIP_TO_SITE_USE_ID,-99) <> nvl(l_old_ServiceRequest_rec.SHIP_TO_SITE_USE_ID,-99)) THEN
17327 x_audit_vals_rec.SHIP_TO_SITE_USE_ID := l_service_request_rec.SHIP_TO_SITE_USE_ID;
17328 ELSE
17329 x_audit_vals_rec.SHIP_TO_SITE_USE_ID := l_old_ServiceRequest_rec.SHIP_TO_SITE_USE_ID;
17330 END IF;
17331
17332 x_audit_vals_rec.OLD_PROBLEM_CODE := l_old_ServiceRequest_rec.PROBLEM_CODE;
17333 IF (nvl(l_service_request_rec.PROBLEM_CODE,-99) <> FND_API.G_MISS_CHAR) AND
17334 (nvl(l_service_request_rec.PROBLEM_CODE,-99) <> nvl(l_old_ServiceRequest_rec.PROBLEM_CODE,-99)) THEN
17335 x_audit_vals_rec.PROBLEM_CODE := l_service_request_rec.PROBLEM_CODE;
17336 ELSE
17337 x_audit_vals_rec.PROBLEM_CODE := l_old_ServiceRequest_rec.PROBLEM_CODE;
17338 END IF;
17339
17340 x_audit_vals_rec.OLD_ACTUAL_RESOLUTION_DATE := l_old_ServiceRequest_rec.ACTUAL_RESOLUTION_DATE;
17341 IF (nvl(l_service_request_rec.ACT_RESOLUTION_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <> FND_API.G_MISS_DATE) AND
17342 (nvl(l_service_request_rec.ACT_RESOLUTION_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <>
17343 nvl(l_old_ServiceRequest_rec.ACTUAL_RESOLUTION_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY'))) THEN
17344 x_audit_vals_rec.ACTUAL_RESOLUTION_DATE := l_service_request_rec.ACT_RESOLUTION_DATE;
17345 ELSE
17346 x_audit_vals_rec.ACTUAL_RESOLUTION_DATE := l_old_ServiceRequest_rec.ACTUAL_RESOLUTION_DATE;
17347 END IF;
17348
17349 x_audit_vals_rec.OLD_INSTALL_SITE_USE_ID := l_old_ServiceRequest_rec.INSTALL_SITE_USE_ID;
17350 IF (nvl(l_service_request_rec.INSTALL_SITE_USE_ID,-99) <> FND_API.G_MISS_NUM) AND
17351 (nvl(l_service_request_rec.INSTALL_SITE_USE_ID,-99) <> nvl(l_old_ServiceRequest_rec.INSTALL_SITE_USE_ID,-99)) THEN
17352 x_audit_vals_rec.INSTALL_SITE_USE_ID := l_service_request_rec.INSTALL_SITE_USE_ID;
17353 ELSE
17354 x_audit_vals_rec.INSTALL_SITE_USE_ID := l_old_ServiceRequest_rec.INSTALL_SITE_USE_ID;
17355 END IF;
17356
17357 x_audit_vals_rec.OLD_CURRENT_SERIAL_NUMBER := l_old_ServiceRequest_rec.CURRENT_SERIAL_NUMBER;
17358 IF (nvl(l_service_request_rec.CURRENT_SERIAL_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
17359 (nvl(l_service_request_rec.CURRENT_SERIAL_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.CURRENT_SERIAL_NUMBER,-99)) THEN
17360 x_audit_vals_rec.CURRENT_SERIAL_NUMBER := l_service_request_rec.CURRENT_SERIAL_NUMBER;
17361 ELSE
17362 x_audit_vals_rec.CURRENT_SERIAL_NUMBER := l_old_ServiceRequest_rec.CURRENT_SERIAL_NUMBER;
17363 END IF;
17364
17365 x_audit_vals_rec.OLD_SYSTEM_ID := l_old_ServiceRequest_rec.SYSTEM_ID;
17366 IF (nvl(l_service_request_rec.SYSTEM_ID,-99) <> FND_API.G_MISS_NUM) AND
17367 (nvl(l_service_request_rec.SYSTEM_ID,-99) <> nvl(l_old_ServiceRequest_rec.SYSTEM_ID,-99)) THEN
17368 x_audit_vals_rec.SYSTEM_ID := l_service_request_rec.SYSTEM_ID;
17369 ELSE
17370 x_audit_vals_rec.SYSTEM_ID := l_old_ServiceRequest_rec.SYSTEM_ID;
17371 END IF;
17372
17373 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_1 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_1;
17374 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_1,-99) <> FND_API.G_MISS_CHAR) AND
17375 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_1,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_1,-99)) THEN
17376 x_audit_vals_rec.INCIDENT_ATTRIBUTE_1 := l_service_request_rec.REQUEST_ATTRIBUTE_1;
17377 ELSE
17378 x_audit_vals_rec.INCIDENT_ATTRIBUTE_1 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_1;
17379 END IF;
17380
17381
17382 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_2 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_2;
17383 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_2,-99) <> FND_API.G_MISS_CHAR) AND
17384 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_2,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_2,-99)) THEN
17385 x_audit_vals_rec.INCIDENT_ATTRIBUTE_2 := l_service_request_rec.REQUEST_ATTRIBUTE_2;
17386 ELSE
17387 x_audit_vals_rec.INCIDENT_ATTRIBUTE_2 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_2;
17388 END IF;
17389
17390 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_3 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_3;
17391 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_3,-99) <> FND_API.G_MISS_CHAR) AND
17392 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_3,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_3,-99)) THEN
17393 x_audit_vals_rec.INCIDENT_ATTRIBUTE_3 := l_service_request_rec.REQUEST_ATTRIBUTE_3;
17394 ELSE
17395 x_audit_vals_rec.INCIDENT_ATTRIBUTE_3 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_3;
17396 END IF;
17397
17398 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_4 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_4;
17399 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_4,-99) <> FND_API.G_MISS_CHAR) AND
17400 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_4,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_4,-99)) THEN
17401 x_audit_vals_rec.INCIDENT_ATTRIBUTE_4 := l_service_request_rec.REQUEST_ATTRIBUTE_4;
17402 ELSE
17403 x_audit_vals_rec.INCIDENT_ATTRIBUTE_4 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_4;
17404 END IF;
17405
17406 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_5 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_5;
17407 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_5,-99) <> FND_API.G_MISS_CHAR) AND
17408 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_5,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_5,-99)) THEN
17409 x_audit_vals_rec.INCIDENT_ATTRIBUTE_5 := l_service_request_rec.REQUEST_ATTRIBUTE_5;
17410 ELSE
17411 x_audit_vals_rec.INCIDENT_ATTRIBUTE_5 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_5;
17412 END IF;
17413
17414 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_6 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_6;
17415 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_6,-99) <> FND_API.G_MISS_CHAR) AND
17416 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_6,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_6,-99)) THEN
17417 x_audit_vals_rec.INCIDENT_ATTRIBUTE_6 := l_service_request_rec.REQUEST_ATTRIBUTE_6;
17418 ELSE
17419 x_audit_vals_rec.INCIDENT_ATTRIBUTE_6 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_6;
17420 END IF;
17421
17422 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_7 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_7;
17423 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_7,-99) <> FND_API.G_MISS_CHAR) AND
17424 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_7,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_7,-99)) THEN
17425 x_audit_vals_rec.INCIDENT_ATTRIBUTE_7 := l_service_request_rec.REQUEST_ATTRIBUTE_7;
17426 ELSE
17427 x_audit_vals_rec.INCIDENT_ATTRIBUTE_7 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_7;
17428 END IF;
17429
17430 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_8 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_8;
17431 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_8,-99) <> FND_API.G_MISS_CHAR) AND
17432 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_8,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_8,-99)) THEN
17433 x_audit_vals_rec.INCIDENT_ATTRIBUTE_8 := l_service_request_rec.REQUEST_ATTRIBUTE_8;
17434 ELSE
17435 x_audit_vals_rec.INCIDENT_ATTRIBUTE_8 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_8;
17436 END IF;
17437
17438 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_9 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_9;
17439 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_9,-99) <> FND_API.G_MISS_CHAR) AND
17440 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_9,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_9,-99)) THEN
17441 x_audit_vals_rec.INCIDENT_ATTRIBUTE_9 := l_service_request_rec.REQUEST_ATTRIBUTE_9;
17442 ELSE
17443 x_audit_vals_rec.INCIDENT_ATTRIBUTE_9 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_9;
17444 END IF;
17445
17446 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_10 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_10;
17447 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_10,-99) <> FND_API.G_MISS_CHAR) AND
17448 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_10,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_10,-99)) THEN
17449 x_audit_vals_rec.INCIDENT_ATTRIBUTE_10 := l_service_request_rec.REQUEST_ATTRIBUTE_10;
17450 ELSE
17451 x_audit_vals_rec.INCIDENT_ATTRIBUTE_10 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_10;
17452 END IF;
17453
17454 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_11 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_11;
17455 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_11,-99) <> FND_API.G_MISS_CHAR) AND
17456 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_11,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_11,-99)) THEN
17457 x_audit_vals_rec.INCIDENT_ATTRIBUTE_11 := l_service_request_rec.REQUEST_ATTRIBUTE_11;
17458 ELSE
17459 x_audit_vals_rec.INCIDENT_ATTRIBUTE_11 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_11;
17460 END IF;
17461
17462 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_12 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_12;
17463 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_12,-99) <> FND_API.G_MISS_CHAR) AND
17464 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_12,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_12,-99)) THEN
17465 x_audit_vals_rec.INCIDENT_ATTRIBUTE_12 := l_service_request_rec.REQUEST_ATTRIBUTE_12;
17466 ELSE
17467 x_audit_vals_rec.INCIDENT_ATTRIBUTE_12 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_12;
17468 END IF;
17469
17470 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_13 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_13;
17471 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_13,-99) <> FND_API.G_MISS_CHAR) AND
17472 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_13,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_13,-99)) THEN
17473 x_audit_vals_rec.INCIDENT_ATTRIBUTE_13 := l_service_request_rec.REQUEST_ATTRIBUTE_13;
17474 ELSE
17475 x_audit_vals_rec.INCIDENT_ATTRIBUTE_13 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_13;
17476 END IF;
17477
17478 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_14 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_14;
17479 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_14,-99) <> FND_API.G_MISS_CHAR) AND
17480 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_14,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_14,-99)) THEN
17481 x_audit_vals_rec.INCIDENT_ATTRIBUTE_14 := l_service_request_rec.REQUEST_ATTRIBUTE_14;
17482 ELSE
17483 x_audit_vals_rec.INCIDENT_ATTRIBUTE_14 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_14;
17484 END IF;
17485
17486 x_audit_vals_rec.OLD_INCIDENT_ATTRIBUTE_15 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_15;
17487 IF (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_15,-99) <> FND_API.G_MISS_CHAR) AND
17488 (nvl(l_service_request_rec.REQUEST_ATTRIBUTE_15,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_15,-99)) THEN
17489 x_audit_vals_rec.INCIDENT_ATTRIBUTE_15 := l_service_request_rec.REQUEST_ATTRIBUTE_15;
17490 ELSE
17491 x_audit_vals_rec.INCIDENT_ATTRIBUTE_15 := l_old_ServiceRequest_rec.INCIDENT_ATTRIBUTE_15;
17492 END IF;
17493
17494 x_audit_vals_rec.OLD_INCIDENT_CONTEXT := l_old_ServiceRequest_rec.INCIDENT_CONTEXT;
17495 IF (nvl(l_service_request_rec.REQUEST_CONTEXT,-99) <> FND_API.G_MISS_CHAR) AND
17496 (nvl(l_service_request_rec.REQUEST_CONTEXT,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_CONTEXT,-99)) THEN
17497 x_audit_vals_rec.INCIDENT_CONTEXT := l_service_request_rec.REQUEST_CONTEXT;
17498 ELSE
17499 x_audit_vals_rec.INCIDENT_CONTEXT := l_old_ServiceRequest_rec.INCIDENT_CONTEXT;
17500 END IF;
17501
17502 x_audit_vals_rec.OLD_RESOLUTION_CODE := l_old_ServiceRequest_rec.RESOLUTION_CODE;
17503 IF (nvl(l_service_request_rec.RESOLUTION_CODE,-99) <> FND_API.G_MISS_CHAR) AND
17504 (nvl(l_service_request_rec.RESOLUTION_CODE,-99) <> nvl(l_old_ServiceRequest_rec.RESOLUTION_CODE,-99)) THEN
17505 x_audit_vals_rec.RESOLUTION_CODE := l_service_request_rec.RESOLUTION_CODE;
17506 ELSE
17507 x_audit_vals_rec.RESOLUTION_CODE := l_old_ServiceRequest_rec.RESOLUTION_CODE;
17508 END IF;
17509
17510 x_audit_vals_rec.OLD_ORIGINAL_ORDER_NUMBER := l_old_ServiceRequest_rec.ORIGINAL_ORDER_NUMBER;
17511 IF (nvl(l_service_request_rec.ORIGINAL_ORDER_NUMBER,-99) <> FND_API.G_MISS_NUM) AND
17512 (nvl(l_service_request_rec.ORIGINAL_ORDER_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.ORIGINAL_ORDER_NUMBER,-99)) THEN
17513 x_audit_vals_rec.ORIGINAL_ORDER_NUMBER := l_service_request_rec.ORIGINAL_ORDER_NUMBER;
17514 ELSE
17515 x_audit_vals_rec.ORIGINAL_ORDER_NUMBER := l_old_ServiceRequest_rec.ORIGINAL_ORDER_NUMBER;
17516 END IF;
17517
17518 /* Could not populate this column as no equivalent column was found in l_service_request_rec */
17519 /*
17520 IF (nvl(l_service_request_rec.,-99) <> FND_API.G_MISS_NUM) AND
17521 (nvl(l_service_request_rec. ,-99)) THEN
17522 x_audit_vals_rec.ORG_ID := l_service_request_rec.;
17523 END IF;
17524 */
17525
17526 x_audit_vals_rec.OLD_PURCHASE_ORDER_NUMBER := l_old_ServiceRequest_rec.PURCHASE_ORDER_NUM;
17527 IF (nvl(l_service_request_rec.PURCHASE_ORDER_NUM,-99) <> FND_API.G_MISS_CHAR) AND
17528 (nvl(l_service_request_rec.PURCHASE_ORDER_NUM,-99) <> nvl(l_old_ServiceRequest_rec.PURCHASE_ORDER_NUM,-99)) THEN
17529 x_audit_vals_rec.PURCHASE_ORDER_NUMBER := l_service_request_rec.PURCHASE_ORDER_NUM;
17530 ELSE
17531 x_audit_vals_rec.PURCHASE_ORDER_NUMBER := l_old_ServiceRequest_rec.PURCHASE_ORDER_NUM;
17532 END IF;
17533
17534 x_audit_vals_rec.OLD_PUBLISH_FLAG := l_old_ServiceRequest_rec.PUBLISH_FLAG;
17535 IF (nvl(l_service_request_rec.PUBLISH_FLAG,-99) <> FND_API.G_MISS_CHAR) AND
17536 (nvl(l_service_request_rec.PUBLISH_FLAG,-99) <> nvl(l_old_ServiceRequest_rec.PUBLISH_FLAG,-99)) THEN
17537 x_audit_vals_rec.PUBLISH_FLAG := l_service_request_rec.PUBLISH_FLAG;
17538 ELSE
17539 x_audit_vals_rec.PUBLISH_FLAG := l_old_ServiceRequest_rec.PUBLISH_FLAG;
17540 END IF;
17541
17542 x_audit_vals_rec.OLD_QA_COLLECTION_ID := l_old_ServiceRequest_rec.QA_COLLECTION_ID;
17543 IF (nvl(l_service_request_rec.QA_COLLECTION_PLAN_ID,-99) <> FND_API.G_MISS_NUM) AND
17544 (nvl(l_service_request_rec.QA_COLLECTION_PLAN_ID,-99) <> nvl(l_old_ServiceRequest_rec.QA_COLLECTION_ID,-99)) THEN
17545 x_audit_vals_rec.QA_COLLECTION_ID := l_service_request_rec.QA_COLLECTION_PLAN_ID;
17546 ELSE
17547 x_audit_vals_rec.QA_COLLECTION_ID := l_old_ServiceRequest_rec.QA_COLLECTION_ID;
17548 END IF;
17549
17550 x_audit_vals_rec.OLD_CONTRACT_ID := l_old_ServiceRequest_rec.CONTRACT_ID;
17551 IF (nvl(l_service_request_rec.CONTRACT_ID,-99) <> FND_API.G_MISS_NUM) AND
17552 (nvl(l_service_request_rec.CONTRACT_ID,-99) <> nvl(l_old_ServiceRequest_rec.CONTRACT_ID,-99)) THEN
17553 x_audit_vals_rec.CONTRACT_ID := l_service_request_rec.CONTRACT_ID;
17554 ELSE
17555 x_audit_vals_rec.CONTRACT_ID := l_old_ServiceRequest_rec.CONTRACT_ID;
17556 END IF;
17557
17558 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
17559 /*
17560 IF (nvl(l_service_request_rec.,-99) <> FND_API.G_MISS_CHAR) AND
17561 (nvl(l_service_request_rec. ,-99)) THEN
17562 x_audit_vals_rec.CONTRACT_NUMBER := l_service_request_rec.;
17563 END IF;
17564 */
17565
17566 x_audit_vals_rec.OLD_CONTRACT_SERVICE_ID := l_old_ServiceRequest_rec.CONTRACT_SERVICE_ID;
17567 IF (nvl(l_service_request_rec.CONTRACT_SERVICE_ID,-99) <> FND_API.G_MISS_NUM) AND
17568 (nvl(l_service_request_rec.CONTRACT_SERVICE_ID,-99) <> nvl(l_old_ServiceRequest_rec.CONTRACT_SERVICE_ID,-99)) THEN
17569 x_audit_vals_rec.CONTRACT_SERVICE_ID := l_service_request_rec.CONTRACT_SERVICE_ID;
17570 ELSE
17571 x_audit_vals_rec.CONTRACT_SERVICE_ID := l_old_ServiceRequest_rec.CONTRACT_SERVICE_ID;
17572 END IF;
17573
17574 x_audit_vals_rec.OLD_TIME_ZONE_ID := l_old_ServiceRequest_rec.TIME_ZONE_ID;
17575 IF (nvl(l_service_request_rec.TIME_ZONE_ID,-99) <> FND_API.G_MISS_NUM) AND
17576 (nvl(l_service_request_rec.TIME_ZONE_ID,-99) <> nvl(l_old_ServiceRequest_rec.TIME_ZONE_ID,-99)) THEN
17577 x_audit_vals_rec.TIME_ZONE_ID := l_service_request_rec.TIME_ZONE_ID;
17578 ELSE
17579 x_audit_vals_rec.TIME_ZONE_ID := l_old_ServiceRequest_rec.TIME_ZONE_ID;
17580 END IF;
17581
17582 x_audit_vals_rec.OLD_ACCOUNT_ID := l_old_ServiceRequest_rec.ACCOUNT_ID;
17583 IF (nvl(l_service_request_rec.ACCOUNT_ID,-99) <> FND_API.G_MISS_NUM) AND
17584 (nvl(l_service_request_rec.ACCOUNT_ID,-99) <> nvl(l_old_ServiceRequest_rec.ACCOUNT_ID,-99)) THEN
17585 x_audit_vals_rec.ACCOUNT_ID := l_service_request_rec.ACCOUNT_ID;
17586 ELSE
17587 x_audit_vals_rec.ACCOUNT_ID := l_old_ServiceRequest_rec.ACCOUNT_ID;
17588 END IF;
17589
17590 x_audit_vals_rec.OLD_TIME_DIFFERENCE := l_old_ServiceRequest_rec.TIME_DIFFERENCE;
17591 IF (nvl(l_service_request_rec.TIME_DIFFERENCE,-99) <> FND_API.G_MISS_NUM) AND
17592 (nvl(l_service_request_rec.TIME_DIFFERENCE,-99) <> nvl(l_old_ServiceRequest_rec.TIME_DIFFERENCE,-99)) THEN
17593 x_audit_vals_rec.TIME_DIFFERENCE := l_service_request_rec.TIME_DIFFERENCE;
17594 ELSE
17595 x_audit_vals_rec.TIME_DIFFERENCE := l_old_ServiceRequest_rec.TIME_DIFFERENCE;
17596 END IF;
17597
17598 x_audit_vals_rec.OLD_CUSTOMER_PO_NUMBER := l_old_ServiceRequest_rec.CUSTOMER_PO_NUMBER;
17599 IF (nvl(l_service_request_rec.CUST_PO_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
17600 (nvl(l_service_request_rec.CUST_PO_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.CUSTOMER_PO_NUMBER,-99)) THEN
17601 x_audit_vals_rec.CUSTOMER_PO_NUMBER := l_service_request_rec.CUST_PO_NUMBER;
17602 ELSE
17603 x_audit_vals_rec.CUSTOMER_PO_NUMBER := l_old_ServiceRequest_rec.CUSTOMER_PO_NUMBER;
17604 END IF;
17605
17606 x_audit_vals_rec.OLD_CUSTOMER_TICKET_NUMBER := l_old_ServiceRequest_rec.CUSTOMER_TICKET_NUMBER;
17607 IF (nvl(l_service_request_rec.CUST_TICKET_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
17608 (nvl(l_service_request_rec.CUST_TICKET_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.CUSTOMER_TICKET_NUMBER,-99)) THEN
17609 x_audit_vals_rec.CUSTOMER_TICKET_NUMBER := l_service_request_rec.CUST_TICKET_NUMBER;
17610 ELSE
17611 x_audit_vals_rec.CUSTOMER_TICKET_NUMBER := l_old_ServiceRequest_rec.CUSTOMER_TICKET_NUMBER;
17612 END IF;
17613
17614 x_audit_vals_rec.OLD_CUSTOMER_SITE_ID := l_old_ServiceRequest_rec.CUSTOMER_SITE_ID;
17615 IF (nvl(l_service_request_rec.CUSTOMER_SITE_ID,-99) <> FND_API.G_MISS_NUM) AND
17616 (nvl(l_service_request_rec.CUSTOMER_SITE_ID,-99) <> nvl(l_old_ServiceRequest_rec.CUSTOMER_SITE_ID,-99)) THEN
17617 x_audit_vals_rec.CUSTOMER_SITE_ID := l_service_request_rec.CUSTOMER_SITE_ID;
17618 ELSE
17619 x_audit_vals_rec.CUSTOMER_SITE_ID := l_old_ServiceRequest_rec.CUSTOMER_SITE_ID;
17620 END IF;
17621
17622 x_audit_vals_rec.OLD_CALLER_TYPE := l_old_ServiceRequest_rec.CALLER_TYPE;
17623 IF (nvl(l_service_request_rec.CALLER_TYPE,-99) <> FND_API.G_MISS_CHAR) AND
17624 (nvl(l_service_request_rec.CALLER_TYPE,-99) <> nvl(l_old_ServiceRequest_rec.CALLER_TYPE,-99)) THEN
17625 x_audit_vals_rec.CALLER_TYPE := l_service_request_rec.CALLER_TYPE;
17626 ELSE
17627 x_audit_vals_rec.CALLER_TYPE := l_old_ServiceRequest_rec.CALLER_TYPE;
17628 END IF;
17629
17630 x_audit_vals_rec.OLD_PROJECT_NUMBER := l_old_ServiceRequest_rec.PROJECT_NUMBER;
17631 IF (nvl(l_service_request_rec.PROJECT_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
17632 (nvl(l_service_request_rec.PROJECT_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.PROJECT_NUMBER,-99)) THEN
17633 x_audit_vals_rec.PROJECT_NUMBER := l_service_request_rec.PROJECT_NUMBER;
17634 ELSE
17635 x_audit_vals_rec.PROJECT_NUMBER := l_old_ServiceRequest_rec.PROJECT_NUMBER;
17636 END IF;
17637
17638 x_audit_vals_rec.OLD_PLATFORM_VERSION := l_old_ServiceRequest_rec.PLATFORM_VERSION;
17639 IF (nvl(l_service_request_rec.PLATFORM_VERSION,-99) <> FND_API.G_MISS_CHAR) AND
17640 (nvl(l_service_request_rec.PLATFORM_VERSION,-99) <> nvl(l_old_ServiceRequest_rec.PLATFORM_VERSION,-99)) THEN
17641 x_audit_vals_rec.PLATFORM_VERSION := l_service_request_rec.PLATFORM_VERSION;
17642 ELSE
17643 x_audit_vals_rec.PLATFORM_VERSION := l_old_ServiceRequest_rec.PLATFORM_VERSION;
17644 END IF;
17645
17646 x_audit_vals_rec.OLD_PLATFORM_VERSION_ID := l_old_ServiceRequest_rec.PLATFORM_VERSION_ID;
17647 IF (nvl(l_service_request_rec.PLATFORM_VERSION_ID,-99) <> FND_API.G_MISS_NUM) AND
17648 (nvl(l_service_request_rec.PLATFORM_VERSION_ID,-99) <> nvl(l_old_ServiceRequest_rec.PLATFORM_VERSION_ID,-99)) THEN
17649 x_audit_vals_rec.PLATFORM_VERSION_ID := l_service_request_rec.PLATFORM_VERSION_ID;
17650 ELSE
17651 x_audit_vals_rec.PLATFORM_VERSION_ID := l_old_ServiceRequest_rec.PLATFORM_VERSION_ID;
17652 END IF;
17653
17654 x_audit_vals_rec.OLD_inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
17655 IF (nvl(l_service_request_rec.inv_platform_org_id,-99) <> FND_API.G_MISS_NUM) AND
17656 nvl(l_service_request_rec.inv_platform_org_id,-99) <> nvl(l_old_ServiceRequest_rec.inv_platform_org_id,-99)
17657 THEN
17658 x_audit_vals_rec.inv_platform_org_id := l_service_request_rec.inv_platform_org_id;
17659 ELSE
17660 x_audit_vals_rec.inv_platform_org_id := l_old_ServiceRequest_rec.inv_platform_org_id;
17661 END IF;
17662
17663 x_audit_vals_rec.OLD_DB_VERSION := l_old_ServiceRequest_rec.DB_VERSION;
17664 IF (nvl(l_service_request_rec.DB_VERSION,-99) <> FND_API.G_MISS_CHAR) AND
17665 (nvl(l_service_request_rec.DB_VERSION,-99) <> nvl(l_old_ServiceRequest_rec.DB_VERSION,-99)) THEN
17666 x_audit_vals_rec.DB_VERSION := l_service_request_rec.DB_VERSION;
17667 ELSE
17668 x_audit_vals_rec.DB_VERSION := l_old_ServiceRequest_rec.DB_VERSION;
17669 END IF;
17670
17671 x_audit_vals_rec.OLD_CUST_PREF_LANG_ID := l_old_ServiceRequest_rec.CUST_PREF_LANG_ID;
17672 IF (nvl(l_service_request_rec.CUST_PREF_LANG_ID,-99) <> FND_API.G_MISS_NUM) AND
17673 (nvl(l_service_request_rec.CUST_PREF_LANG_ID,-99) <> nvl(l_old_ServiceRequest_rec.CUST_PREF_LANG_ID,-99)) THEN
17674 x_audit_vals_rec.CUST_PREF_LANG_ID := l_service_request_rec.CUST_PREF_LANG_ID;
17675 ELSE
17676 x_audit_vals_rec.CUST_PREF_LANG_ID := l_old_ServiceRequest_rec.CUST_PREF_LANG_ID;
17677 END IF;
17678
17679 x_audit_vals_rec.OLD_TIER := l_old_ServiceRequest_rec.TIER;
17680 IF (nvl(l_service_request_rec.TIER,-99) <> FND_API.G_MISS_CHAR) AND
17681 (nvl(l_service_request_rec.TIER,-99) <> nvl(l_old_ServiceRequest_rec.TIER,-99)) THEN
17682 x_audit_vals_rec.TIER := l_service_request_rec.TIER;
17683 ELSE
17684 x_audit_vals_rec.TIER := l_old_ServiceRequest_rec.TIER;
17685 END IF;
17686
17687 x_audit_vals_rec.OLD_CATEGORY_ID := l_old_ServiceRequest_rec.CATEGORY_ID;
17688 IF (nvl(l_service_request_rec.CATEGORY_ID,-99) <> FND_API.G_MISS_NUM) AND
17689 (nvl(l_service_request_rec.CATEGORY_ID,-99) <> nvl(l_old_ServiceRequest_rec.CATEGORY_ID,-99)) THEN
17690 x_audit_vals_rec.CATEGORY_ID := l_service_request_rec.CATEGORY_ID;
17691 ELSE
17692 x_audit_vals_rec.CATEGORY_ID := l_old_ServiceRequest_rec.CATEGORY_ID;
17693 END IF;
17694
17695 x_audit_vals_rec.OLD_OPERATING_SYSTEM := l_old_ServiceRequest_rec.OPERATING_SYSTEM;
17696 IF (nvl(l_service_request_rec.OPERATING_SYSTEM,-99) <> FND_API.G_MISS_CHAR) AND
17697 (nvl(l_service_request_rec.OPERATING_SYSTEM,-99) <> nvl(l_old_ServiceRequest_rec.OPERATING_SYSTEM,-99)) THEN
17698 x_audit_vals_rec.OPERATING_SYSTEM := l_service_request_rec.OPERATING_SYSTEM;
17699 ELSE
17700 x_audit_vals_rec.OPERATING_SYSTEM := l_old_ServiceRequest_rec.OPERATING_SYSTEM;
17701 END IF;
17702
17703 x_audit_vals_rec.OLD_OPERATING_SYSTEM_VERSION := l_old_ServiceRequest_rec.OPERATING_SYSTEM_VERSION;
17704 IF (nvl(l_service_request_rec.OPERATING_SYSTEM_VERSION,-99) <> FND_API.G_MISS_CHAR) AND
17705 (nvl(l_service_request_rec.OPERATING_SYSTEM_VERSION,-99) <> nvl(l_old_ServiceRequest_rec.OPERATING_SYSTEM_VERSION,-99)) THEN
17706 x_audit_vals_rec.OPERATING_SYSTEM_VERSION := l_service_request_rec.OPERATING_SYSTEM_VERSION;
17707 ELSE
17708 x_audit_vals_rec.OPERATING_SYSTEM_VERSION := l_old_ServiceRequest_rec.OPERATING_SYSTEM_VERSION;
17709 END IF;
17710
17711
17712 x_audit_vals_rec.OLD_DATABASE := l_old_ServiceRequest_rec.DATABASE;
17713 IF (nvl(l_service_request_rec.DATABASE,-99) <> FND_API.G_MISS_CHAR) AND
17714 (nvl(l_service_request_rec.DATABASE,-99) <> nvl(l_old_ServiceRequest_rec.DATABASE,-99)) THEN
17715 x_audit_vals_rec.DATABASE := l_service_request_rec.DATABASE;
17716 ELSE
17717 x_audit_vals_rec.DATABASE := l_old_ServiceRequest_rec.DATABASE;
17718 END IF;
17719
17720 x_audit_vals_rec.OLD_GROUP_TERRITORY_ID := l_old_ServiceRequest_rec.GROUP_TERRITORY_ID;
17721 IF (nvl(l_service_request_rec.GROUP_TERRITORY_ID,-99) <> FND_API.G_MISS_NUM) AND
17722 (nvl(l_service_request_rec.GROUP_TERRITORY_ID,-99) <> nvl(l_old_ServiceRequest_rec.GROUP_TERRITORY_ID,-99)) THEN
17723 x_audit_vals_rec.GROUP_TERRITORY_ID := l_service_request_rec.GROUP_TERRITORY_ID;
17724 ELSE
17725 x_audit_vals_rec.GROUP_TERRITORY_ID := l_old_ServiceRequest_rec.GROUP_TERRITORY_ID;
17726 END IF;
17727 IF (l_service_request_rec.territory_id = FND_API.G_MISS_NUM) OR
17728 (nvl(l_service_request_rec.territory_id,-99) = nvl(l_old_ServiceRequest_rec.territory_id,-99)) THEN
17729 x_audit_vals_rec.change_territory_id_flag := 'N';
17730 x_audit_vals_rec.old_territory_id := l_old_ServiceRequest_rec.territory_id;
17731 x_audit_vals_rec.territory_id := l_old_ServiceRequest_rec.territory_id;
17732 ELSE
17733 x_audit_vals_rec.change_territory_id_FLAG := 'Y';
17734 x_audit_vals_rec.OLD_territory_id := l_old_ServiceRequest_rec.territory_id;
17735 x_audit_vals_rec.territory_id := l_service_request_rec.territory_id;
17736 END IF;
17737
17738 x_audit_vals_rec.OLD_COMM_PREF_CODE := l_old_ServiceRequest_rec.COMM_PREF_CODE;
17739 IF (nvl(l_service_request_rec.COMM_PREF_CODE,-99) <> FND_API.G_MISS_CHAR) AND
17740 (nvl(l_service_request_rec.COMM_PREF_CODE,-99) <> nvl(l_old_ServiceRequest_rec.COMM_PREF_CODE,-99)) THEN
17741 x_audit_vals_rec.COMM_PREF_CODE := l_service_request_rec.COMM_PREF_CODE;
17742 ELSE
17743 x_audit_vals_rec.COMM_PREF_CODE := l_old_ServiceRequest_rec.COMM_PREF_CODE;
17744 END IF;
17745
17746 x_audit_vals_rec.OLD_LAST_UPDATE_CHANNEL := l_old_ServiceRequest_rec.LAST_UPDATE_CHANNEL;
17747 IF (nvl(l_service_request_rec.LAST_UPDATE_CHANNEL,-99) <> FND_API.G_MISS_CHAR) AND
17748 (nvl(l_service_request_rec.LAST_UPDATE_CHANNEL,-99) <> nvl(l_old_ServiceRequest_rec.LAST_UPDATE_CHANNEL,-99)) THEN
17749 x_audit_vals_rec.LAST_UPDATE_CHANNEL := l_service_request_rec.LAST_UPDATE_CHANNEL;
17750 ELSE
17751 x_audit_vals_rec.LAST_UPDATE_CHANNEL := l_old_ServiceRequest_rec.LAST_UPDATE_CHANNEL;
17752 END IF;
17753
17754 x_audit_vals_rec.OLD_CUST_PREF_LANG_CODE := l_old_ServiceRequest_rec.CUST_PREF_LANG_CODE;
17755 IF (nvl(l_service_request_rec.CUST_PREF_LANG_CODE,-99) <> FND_API.G_MISS_CHAR) AND
17756 (nvl(l_service_request_rec.CUST_PREF_LANG_CODE,-99) <> nvl(l_old_ServiceRequest_rec.CUST_PREF_LANG_CODE,-99)) THEN
17757 x_audit_vals_rec.CUST_PREF_LANG_CODE := l_service_request_rec.CUST_PREF_LANG_CODE;
17758 ELSE
17759 x_audit_vals_rec.CUST_PREF_LANG_CODE := l_old_ServiceRequest_rec.CUST_PREF_LANG_CODE;
17760 END IF;
17761
17762 x_audit_vals_rec.OLD_ERROR_CODE := l_old_ServiceRequest_rec.ERROR_CODE;
17763 IF (nvl(l_service_request_rec.ERROR_CODE,-99) <> FND_API.G_MISS_CHAR) AND
17764 (nvl(l_service_request_rec.ERROR_CODE,-99) <> nvl(l_old_ServiceRequest_rec.ERROR_CODE,-99)) THEN
17765 x_audit_vals_rec.ERROR_CODE := l_service_request_rec.ERROR_CODE;
17766 ELSE
17767 x_audit_vals_rec.ERROR_CODE := l_old_ServiceRequest_rec.ERROR_CODE;
17768 END IF;
17769
17770 x_audit_vals_rec.OLD_CATEGORY_SET_ID := l_old_ServiceRequest_rec.CATEGORY_SET_ID;
17771 IF (nvl(l_service_request_rec.CATEGORY_SET_ID,-99) <> FND_API.G_MISS_NUM) AND
17772 (nvl(l_service_request_rec.CATEGORY_SET_ID,-99) <> nvl(l_old_ServiceRequest_rec.CATEGORY_SET_ID,-99)) THEN
17773 x_audit_vals_rec.CATEGORY_SET_ID := l_service_request_rec.CATEGORY_SET_ID;
17774 ELSE
17775 x_audit_vals_rec.CATEGORY_SET_ID := l_old_ServiceRequest_rec.CATEGORY_SET_ID;
17776 END IF;
17777
17778 x_audit_vals_rec.OLD_EXTERNAL_REFERENCE := l_old_ServiceRequest_rec.EXTERNAL_REFERENCE;
17779 IF (nvl(l_service_request_rec.EXTERNAL_REFERENCE,-99) <> FND_API.G_MISS_CHAR) AND
17780 (nvl(l_service_request_rec.EXTERNAL_REFERENCE,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_REFERENCE,-99)) THEN
17781 x_audit_vals_rec.EXTERNAL_REFERENCE := l_service_request_rec.EXTERNAL_REFERENCE;
17782 ELSE
17783 x_audit_vals_rec.EXTERNAL_REFERENCE := l_old_ServiceRequest_rec.EXTERNAL_REFERENCE;
17784 END IF;
17785
17786 x_audit_vals_rec.OLD_INCIDENT_OCCURRED_DATE := l_old_ServiceRequest_rec.INCIDENT_OCCURRED_DATE;
17787 IF (nvl(l_service_request_rec.INCIDENT_OCCURRED_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <> FND_API.G_MISS_DATE) AND
17788 (nvl(l_service_request_rec.INCIDENT_OCCURRED_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <>
17789 nvl(l_old_ServiceRequest_rec.INCIDENT_OCCURRED_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY'))) THEN
17790 x_audit_vals_rec.INCIDENT_OCCURRED_DATE := l_service_request_rec.INCIDENT_OCCURRED_DATE;
17791 ELSE
17792 x_audit_vals_rec.INCIDENT_OCCURRED_DATE := l_old_ServiceRequest_rec.INCIDENT_OCCURRED_DATE;
17793 END IF;
17794
17795 /*Bug 3666722 smisra. incident resolved date and incident responded by date could set
17796 if incident status has responded and/or resolved flag set to Y. so copy to audit should
17797 done after these dates are set depending on new status.
17798 moved this code after call to update_sr_validation procedure.
17799 */
17800 --x_audit_vals_rec.OLD_INCIDENT_RESOLVED_DATE := l_old_ServiceRequest_rec.INCIDENT_RESOLVED_DATE;
17801 --IF (nvl(l_service_request_rec.INCIDENT_RESOLVED_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <> FND_API.G_MISS_DATE) AND
17802 -- (nvl(l_service_request_rec.INCIDENT_RESOLVED_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <>
17803 -- nvl(l_old_ServiceRequest_rec.INCIDENT_RESOLVED_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY'))) THEN
17804 -- x_audit_vals_rec.INCIDENT_RESOLVED_DATE := l_service_request_rec.INCIDENT_RESOLVED_DATE;
17805 --ELSE
17806 -- x_audit_vals_rec.INCIDENT_RESOLVED_DATE := l_old_ServiceRequest_rec.INCIDENT_RESOLVED_DATE;
17807 --END IF;
17808 --
17809 --x_audit_vals_rec.OLD_INC_RESPONDED_BY_DATE := l_old_ServiceRequest_rec.INC_RESPONDED_BY_DATE;
17810 --IF (nvl(l_service_request_rec.INC_RESPONDED_BY_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <> FND_API.G_MISS_DATE) AND
17811 -- (nvl(l_service_request_rec.INC_RESPONDED_BY_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <>
17812 -- nvl(l_old_ServiceRequest_rec.INC_RESPONDED_BY_DATE,TO_DATE('09-09-0999', 'DD-MM-YYYY'))) THEN
17813 -- x_audit_vals_rec.INC_RESPONDED_BY_DATE := l_service_request_rec.INC_RESPONDED_BY_DATE;
17814 --ELSE
17815 -- x_audit_vals_rec.INC_RESPONDED_BY_DATE := l_old_ServiceRequest_rec.INC_RESPONDED_BY_DATE;
17816 --END IF;
17817
17818 /* 12/13/05 smisra moved to update_service_request procedure just before call to
17819 create audit record
17820 x_audit_vals_rec.OLD_INCIDENT_LOCATION_ID := l_old_ServiceRequest_rec.INCIDENT_LOCATION_ID;
17821 IF (nvl(l_service_request_rec.INCIDENT_LOCATION_ID,-99) <> FND_API.G_MISS_NUM) AND
17822 (nvl(l_service_request_rec.INCIDENT_LOCATION_ID,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_LOCATION_ID,-99)) THEN
17823 x_audit_vals_rec.INCIDENT_LOCATION_ID := l_service_request_rec.INCIDENT_LOCATION_ID;
17824 ELSE
17825 x_audit_vals_rec.INCIDENT_LOCATION_ID := l_old_ServiceRequest_rec.INCIDENT_LOCATION_ID;
17826 END IF;
17827 */
17828
17829 x_audit_vals_rec.OLD_INCIDENT_ADDRESS := l_old_ServiceRequest_rec.INCIDENT_ADDRESS;
17830 IF (nvl(l_service_request_rec.INCIDENT_ADDRESS,-99) <> FND_API.G_MISS_CHAR) AND
17831 (nvl(l_service_request_rec.INCIDENT_ADDRESS,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ADDRESS,-99)) THEN
17832 x_audit_vals_rec.INCIDENT_ADDRESS := l_service_request_rec.INCIDENT_ADDRESS;
17833 ELSE
17834 x_audit_vals_rec.INCIDENT_ADDRESS := l_old_ServiceRequest_rec.INCIDENT_ADDRESS;
17835 END IF;
17836
17837 x_audit_vals_rec.OLD_INCIDENT_CITY := l_old_ServiceRequest_rec.INCIDENT_CITY;
17838 IF (nvl(l_service_request_rec.INCIDENT_CITY,-99) <> FND_API.G_MISS_CHAR) AND
17839 (nvl(l_service_request_rec.INCIDENT_CITY,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_CITY,-99)) THEN
17840 x_audit_vals_rec.INCIDENT_CITY := l_service_request_rec.INCIDENT_CITY;
17841 ELSE
17842 x_audit_vals_rec.INCIDENT_CITY := l_old_ServiceRequest_rec.INCIDENT_CITY;
17843 END IF;
17844
17845 x_audit_vals_rec.OLD_INCIDENT_STATE := l_old_ServiceRequest_rec.INCIDENT_STATE;
17846 IF (nvl(l_service_request_rec.INCIDENT_STATE,-99) <> FND_API.G_MISS_CHAR) AND
17847 (nvl(l_service_request_rec.INCIDENT_STATE,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_STATE,-99)) THEN
17848 x_audit_vals_rec.INCIDENT_STATE := l_service_request_rec.INCIDENT_STATE;
17849 ELSE
17850 x_audit_vals_rec.INCIDENT_STATE := l_old_ServiceRequest_rec.INCIDENT_STATE;
17851 END IF;
17852
17853 /* 12/13/05 smisra moved to update_service_request procedure just before call to
17854 create audit record
17855 x_audit_vals_rec.OLD_INCIDENT_COUNTRY := l_old_ServiceRequest_rec.INCIDENT_COUNTRY;
17856 IF (nvl(l_service_request_rec.INCIDENT_COUNTRY,-99) <> FND_API.G_MISS_CHAR) AND
17857 (nvl(l_service_request_rec.INCIDENT_COUNTRY,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_COUNTRY,-99)) THEN
17858 x_audit_vals_rec.INCIDENT_COUNTRY := l_service_request_rec.INCIDENT_COUNTRY;
17859 ELSE
17860 x_audit_vals_rec.INCIDENT_COUNTRY := l_old_ServiceRequest_rec.INCIDENT_COUNTRY;
17861 END IF;
17862 */
17863
17864 x_audit_vals_rec.OLD_INCIDENT_PROVINCE := l_old_ServiceRequest_rec.INCIDENT_PROVINCE;
17865 IF (nvl(l_service_request_rec.INCIDENT_PROVINCE,-99) <> FND_API.G_MISS_CHAR) AND
17866 (nvl(l_service_request_rec.INCIDENT_PROVINCE,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_PROVINCE,-99)) THEN
17867 x_audit_vals_rec.INCIDENT_PROVINCE := l_service_request_rec.INCIDENT_PROVINCE;
17868 ELSE
17869 x_audit_vals_rec.INCIDENT_PROVINCE := l_old_ServiceRequest_rec.INCIDENT_PROVINCE;
17870 END IF;
17871
17872 x_audit_vals_rec.OLD_INCIDENT_POSTAL_CODE := l_old_ServiceRequest_rec.INCIDENT_POSTAL_CODE;
17873 IF (nvl(l_service_request_rec.INCIDENT_POSTAL_CODE,-99) <> FND_API.G_MISS_CHAR) AND
17874 (nvl(l_service_request_rec.INCIDENT_POSTAL_CODE,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_POSTAL_CODE,-99)) THEN
17875 x_audit_vals_rec.INCIDENT_POSTAL_CODE := l_service_request_rec.INCIDENT_POSTAL_CODE;
17876 ELSE
17877 x_audit_vals_rec.INCIDENT_POSTAL_CODE := l_old_ServiceRequest_rec.INCIDENT_POSTAL_CODE;
17878 END IF;
17879
17880 x_audit_vals_rec.OLD_INCIDENT_COUNTY := l_old_ServiceRequest_rec.INCIDENT_COUNTY;
17881 IF (nvl(l_service_request_rec.INCIDENT_COUNTY,-99) <> FND_API.G_MISS_CHAR) AND
17882 (nvl(l_service_request_rec.INCIDENT_COUNTY,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_COUNTY,-99)) THEN
17883 x_audit_vals_rec.INCIDENT_COUNTY := l_service_request_rec.INCIDENT_COUNTY;
17884 ELSE
17885 x_audit_vals_rec.INCIDENT_COUNTY := l_old_ServiceRequest_rec.INCIDENT_COUNTY;
17886 END IF;
17887
17888 x_audit_vals_rec.OLD_SR_CREATION_CHANNEL := l_old_ServiceRequest_rec.SR_CREATION_CHANNEL;
17889 IF (nvl(l_service_request_rec.SR_CREATION_CHANNEL,-99) <> FND_API.G_MISS_CHAR) AND
17890 (nvl(l_service_request_rec.SR_CREATION_CHANNEL,-99) <> nvl(l_old_ServiceRequest_rec.SR_CREATION_CHANNEL,-99)) THEN
17891 x_audit_vals_rec.SR_CREATION_CHANNEL := l_service_request_rec.SR_CREATION_CHANNEL;
17892 ELSE
17893 x_audit_vals_rec.SR_CREATION_CHANNEL := l_old_ServiceRequest_rec.SR_CREATION_CHANNEL;
17894 END IF;
17895
17896 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
17897 /*
17898 IF (nvl(l_service_request_rec.,-99) <> FND_API.G_MISS_NUM) AND
17899 (nvl(l_service_request_rec. ,-99)) THEN
17900 x_audit_vals_rec.DEF_DEFECT_ID := l_service_request_rec.;
17901 END IF;
17902 */
17903
17904 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
17905 /*
17906 IF (nvl(l_service_request_rec.,-99) <> FND_API.G_MISS_NUM) AND
17907 (nvl(l_service_request_rec. ,-99)) THEN
17908 x_audit_vals_rec.DEF_DEFECT_ID2 := l_service_request_rec.;
17909 END IF;
17910 */
17911
17912 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_1 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_1;
17913 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_1,-99) <> FND_API.G_MISS_CHAR) AND
17914 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_1,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_1,-99)) THEN
17915 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_1 := l_service_request_rec.EXTERNAL_ATTRIBUTE_1;
17916 ELSE
17917 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_1 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_1;
17918 END IF;
17919
17920 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_2 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_2;
17921 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_2,-99) <> FND_API.G_MISS_CHAR) AND
17922 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_2,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_2,-99)) THEN
17923 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_2 := l_service_request_rec.EXTERNAL_ATTRIBUTE_2;
17924 ELSE
17925 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_2 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_2;
17926 END IF;
17927
17928 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_3 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_3;
17929 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_3,-99) <> FND_API.G_MISS_CHAR) AND
17930 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_3,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_3,-99)) THEN
17931 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_3 := l_service_request_rec.EXTERNAL_ATTRIBUTE_3;
17932 ELSE
17933 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_3 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_3;
17934 END IF;
17935
17936 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_4 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_4;
17937 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_4,-99) <> FND_API.G_MISS_CHAR) AND
17938 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_4,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_4,-99)) THEN
17939 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_4 := l_service_request_rec.EXTERNAL_ATTRIBUTE_4;
17940 ELSE
17941 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_4 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_4;
17942 END IF;
17943
17944 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_5 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_5;
17945 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_5,-99) <> FND_API.G_MISS_CHAR) AND
17946 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_5,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_5,-99)) THEN
17947 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_5 := l_service_request_rec.EXTERNAL_ATTRIBUTE_5;
17948 ELSE
17949 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_5 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_5;
17950 END IF;
17951
17952 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_6 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_6;
17953 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_6,-99) <> FND_API.G_MISS_CHAR) AND
17954 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_6,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_6,-99)) THEN
17955 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_6 := l_service_request_rec.EXTERNAL_ATTRIBUTE_6;
17956 ELSE
17957 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_6 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_6;
17958 END IF;
17959
17960 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_7 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_7;
17961 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_7,-99) <> FND_API.G_MISS_CHAR) AND
17962 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_7,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_7,-99)) THEN
17963 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_7 := l_service_request_rec.EXTERNAL_ATTRIBUTE_7;
17964 ELSE
17965 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_7 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_7;
17966 END IF;
17967
17968 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_8 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_8;
17969 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_8,-99) <> FND_API.G_MISS_CHAR) AND
17970 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_8,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_8,-99)) THEN
17971 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_8 := l_service_request_rec.EXTERNAL_ATTRIBUTE_8;
17972 ELSE
17973 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_8 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_8;
17974 END IF;
17975
17976 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_9 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_9;
17977 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_9,-99) <> FND_API.G_MISS_CHAR) AND
17978 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_9,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_9,-99)) THEN
17979 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_9 := l_service_request_rec.EXTERNAL_ATTRIBUTE_9;
17980 ELSE
17981 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_9 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_9;
17982 END IF;
17983
17984 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_10 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_10;
17985 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_10,-99) <> FND_API.G_MISS_CHAR) AND
17986 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_10,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_10,-99)) THEN
17987 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_10 := l_service_request_rec.EXTERNAL_ATTRIBUTE_10;
17988 ELSE
17989 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_10 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_10;
17990 END IF;
17991
17992 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_11 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_11;
17993 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_11,-99) <> FND_API.G_MISS_CHAR) AND
17994 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_11,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_11,-99)) THEN
17995 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_11 := l_service_request_rec.EXTERNAL_ATTRIBUTE_11;
17996 ELSE
17997 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_11 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_11;
17998 END IF;
17999
18000 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_12 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_12;
18001 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_12,-99) <> FND_API.G_MISS_CHAR) AND
18002 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_12,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_12,-99)) THEN
18003 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_12 := l_service_request_rec.EXTERNAL_ATTRIBUTE_12;
18004 ELSE
18005 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_12 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_12;
18006 END IF;
18007
18008 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_13 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_13;
18009 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_13,-99) <> FND_API.G_MISS_CHAR) AND
18010 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_13,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_13,-99)) THEN
18011 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_13 := l_service_request_rec.EXTERNAL_ATTRIBUTE_13;
18012 ELSE
18013 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_13 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_13;
18014 END IF;
18015
18016 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_14 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_14;
18017 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_14,-99) <> FND_API.G_MISS_CHAR) AND
18018 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_14,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_14,-99)) THEN
18019 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_14 := l_service_request_rec.EXTERNAL_ATTRIBUTE_14;
18020 ELSE
18021 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_14 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_14;
18022 END IF;
18023
18024 x_audit_vals_rec.OLD_EXTERNAL_ATTRIBUTE_15 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_15;
18025 IF (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_15,-99) <> FND_API.G_MISS_CHAR) AND
18026 (nvl(l_service_request_rec.EXTERNAL_ATTRIBUTE_15,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_15,-99)) THEN
18027 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_15 := l_service_request_rec.EXTERNAL_ATTRIBUTE_15;
18028 ELSE
18029 x_audit_vals_rec.EXTERNAL_ATTRIBUTE_15 := l_old_ServiceRequest_rec.EXTERNAL_ATTRIBUTE_15;
18030 END IF;
18031
18032 x_audit_vals_rec.OLD_EXTERNAL_CONTEXT := l_old_ServiceRequest_rec.EXTERNAL_CONTEXT;
18033 IF (nvl(l_service_request_rec.EXTERNAL_CONTEXT,-99) <> FND_API.G_MISS_CHAR) AND
18034 (nvl(l_service_request_rec.EXTERNAL_CONTEXT,-99) <> nvl(l_old_ServiceRequest_rec.EXTERNAL_CONTEXT,-99)) THEN
18035 x_audit_vals_rec.EXTERNAL_CONTEXT := l_service_request_rec.EXTERNAL_CONTEXT;
18036 ELSE
18037 x_audit_vals_rec.EXTERNAL_CONTEXT := l_old_ServiceRequest_rec.EXTERNAL_CONTEXT;
18038 END IF;
18039
18040 x_audit_vals_rec.OLD_LAST_UPDATE_PROGRAM_CODE := l_old_ServiceRequest_rec.LAST_UPDATE_PROGRAM_CODE;
18041 IF (nvl(l_service_request_rec.LAST_UPDATE_PROGRAM_CODE,-99) <> FND_API.G_MISS_CHAR) AND
18042 (nvl(l_service_request_rec.LAST_UPDATE_PROGRAM_CODE,-99) <> nvl(l_old_ServiceRequest_rec.LAST_UPDATE_PROGRAM_CODE,-99)) THEN
18043 x_audit_vals_rec.LAST_UPDATE_PROGRAM_CODE := l_service_request_rec.LAST_UPDATE_PROGRAM_CODE;
18044 ELSE
18045 x_audit_vals_rec.LAST_UPDATE_PROGRAM_CODE := l_old_ServiceRequest_rec.LAST_UPDATE_PROGRAM_CODE;
18046 END IF;
18047
18048 x_audit_vals_rec.OLD_CREATION_PROGRAM_CODE := l_old_ServiceRequest_rec.CREATION_PROGRAM_CODE;
18049 IF (nvl(l_service_request_rec.CREATION_PROGRAM_CODE,-99) <> FND_API.G_MISS_CHAR) AND
18050 (nvl(l_service_request_rec.CREATION_PROGRAM_CODE,-99) <> nvl(l_old_ServiceRequest_rec.CREATION_PROGRAM_CODE,-99)) THEN
18051 x_audit_vals_rec.CREATION_PROGRAM_CODE := l_service_request_rec.CREATION_PROGRAM_CODE;
18052 ELSE
18053 x_audit_vals_rec.CREATION_PROGRAM_CODE := l_old_ServiceRequest_rec.CREATION_PROGRAM_CODE;
18054 END IF;
18055
18056 x_audit_vals_rec.OLD_COVERAGE_TYPE := l_old_ServiceRequest_rec.COVERAGE_TYPE;
18057 IF (nvl(l_service_request_rec.COVERAGE_TYPE,-99) <> FND_API.G_MISS_CHAR) AND
18058 (nvl(l_service_request_rec.COVERAGE_TYPE,-99) <> nvl(l_old_ServiceRequest_rec.COVERAGE_TYPE,-99)) THEN
18059 x_audit_vals_rec.COVERAGE_TYPE := l_service_request_rec.COVERAGE_TYPE;
18060 ELSE
18061 x_audit_vals_rec.COVERAGE_TYPE := l_old_ServiceRequest_rec.COVERAGE_TYPE;
18062 END IF;
18063
18064 x_audit_vals_rec.OLD_BILL_TO_ACCOUNT_ID := l_old_ServiceRequest_rec.BILL_TO_ACCOUNT_ID;
18065 IF (nvl(l_service_request_rec.BILL_TO_ACCOUNT_ID,-99) <> FND_API.G_MISS_NUM) AND
18066 (nvl(l_service_request_rec.BILL_TO_ACCOUNT_ID,-99) <> nvl(l_old_ServiceRequest_rec.BILL_TO_ACCOUNT_ID,-99)) THEN
18067 x_audit_vals_rec.BILL_TO_ACCOUNT_ID := l_service_request_rec.BILL_TO_ACCOUNT_ID;
18068 ELSE
18069 x_audit_vals_rec.BILL_TO_ACCOUNT_ID := l_old_ServiceRequest_rec.BILL_TO_ACCOUNT_ID;
18070 END IF;
18071
18072 x_audit_vals_rec.OLD_SHIP_TO_ACCOUNT_ID := l_old_ServiceRequest_rec.SHIP_TO_ACCOUNT_ID;
18073 IF (nvl(l_service_request_rec.SHIP_TO_ACCOUNT_ID,-99) <> FND_API.G_MISS_NUM) AND
18074 (nvl(l_service_request_rec.SHIP_TO_ACCOUNT_ID,-99) <> nvl(l_old_ServiceRequest_rec.SHIP_TO_ACCOUNT_ID,-99)) THEN
18075 x_audit_vals_rec.SHIP_TO_ACCOUNT_ID := l_service_request_rec.SHIP_TO_ACCOUNT_ID;
18076 ELSE
18077 x_audit_vals_rec.SHIP_TO_ACCOUNT_ID := l_old_ServiceRequest_rec.SHIP_TO_ACCOUNT_ID;
18078 END IF;
18079
18080 x_audit_vals_rec.OLD_CUSTOMER_EMAIL_ID := l_old_ServiceRequest_rec.CUSTOMER_EMAIL_ID;
18081 IF (nvl(l_service_request_rec.CUSTOMER_EMAIL_ID,-99) <> FND_API.G_MISS_NUM) AND
18082 (nvl(l_service_request_rec.CUSTOMER_EMAIL_ID,-99) <> nvl(l_old_ServiceRequest_rec.CUSTOMER_EMAIL_ID,-99)) THEN
18083 x_audit_vals_rec.CUSTOMER_EMAIL_ID := l_service_request_rec.CUSTOMER_EMAIL_ID;
18084 ELSE
18085 x_audit_vals_rec.CUSTOMER_EMAIL_ID := l_old_ServiceRequest_rec.CUSTOMER_EMAIL_ID;
18086 END IF;
18087
18088 x_audit_vals_rec.OLD_CUSTOMER_PHONE_ID := l_old_ServiceRequest_rec.CUSTOMER_PHONE_ID;
18089 IF (nvl(l_service_request_rec.CUSTOMER_PHONE_ID,-99) <> FND_API.G_MISS_NUM) AND
18090 (nvl(l_service_request_rec.CUSTOMER_PHONE_ID,-99) <> nvl(l_old_ServiceRequest_rec.CUSTOMER_PHONE_ID,-99)) THEN
18091 x_audit_vals_rec.CUSTOMER_PHONE_ID := l_service_request_rec.CUSTOMER_PHONE_ID;
18092 ELSE
18093 x_audit_vals_rec.CUSTOMER_PHONE_ID := l_old_ServiceRequest_rec.CUSTOMER_PHONE_ID;
18094 END IF;
18095
18096 x_audit_vals_rec.OLD_BILL_TO_PARTY_ID := l_old_ServiceRequest_rec.BILL_TO_PARTY_ID;
18097 IF (nvl(l_service_request_rec.BILL_TO_PARTY_ID,-99) <> FND_API.G_MISS_NUM) AND
18098 (nvl(l_service_request_rec.BILL_TO_PARTY_ID,-99) <> nvl(l_old_ServiceRequest_rec.BILL_TO_PARTY_ID,-99)) THEN
18099 x_audit_vals_rec.BILL_TO_PARTY_ID := l_service_request_rec.BILL_TO_PARTY_ID;
18100 ELSE
18101 x_audit_vals_rec.BILL_TO_PARTY_ID := l_old_ServiceRequest_rec.BILL_TO_PARTY_ID;
18102 END IF;
18103
18104 x_audit_vals_rec.OLD_SHIP_TO_PARTY_ID := l_old_ServiceRequest_rec.SHIP_TO_PARTY_ID;
18105 IF (nvl(l_service_request_rec.SHIP_TO_PARTY_ID,-99) <> FND_API.G_MISS_NUM) AND
18106 (nvl(l_service_request_rec.SHIP_TO_PARTY_ID,-99) <> nvl(l_old_ServiceRequest_rec.SHIP_TO_PARTY_ID,-99)) THEN
18107 x_audit_vals_rec.SHIP_TO_PARTY_ID := l_service_request_rec.SHIP_TO_PARTY_ID;
18108 ELSE
18109 x_audit_vals_rec.SHIP_TO_PARTY_ID := l_old_ServiceRequest_rec.SHIP_TO_PARTY_ID;
18110 END IF;
18111
18112 x_audit_vals_rec.OLD_BILL_TO_SITE_ID := l_old_ServiceRequest_rec.BILL_TO_SITE_ID;
18113 IF (nvl(l_service_request_rec.BILL_TO_SITE_ID,-99) <> FND_API.G_MISS_NUM) AND
18114 (nvl(l_service_request_rec.BILL_TO_SITE_ID,-99) <> nvl(l_old_ServiceRequest_rec.BILL_TO_SITE_ID,-99)) THEN
18115 x_audit_vals_rec.BILL_TO_SITE_ID := l_service_request_rec.BILL_TO_SITE_ID;
18116 ELSE
18117 x_audit_vals_rec.BILL_TO_SITE_ID := l_old_ServiceRequest_rec.BILL_TO_SITE_ID;
18118 END IF;
18119
18120 x_audit_vals_rec.OLD_SHIP_TO_SITE_ID := l_old_ServiceRequest_rec.SHIP_TO_SITE_ID;
18121 IF (nvl(l_service_request_rec.SHIP_TO_SITE_ID,-99) <> FND_API.G_MISS_NUM) AND
18122 (nvl(l_service_request_rec.SHIP_TO_SITE_ID,-99) <> nvl(l_old_ServiceRequest_rec.SHIP_TO_SITE_ID,-99)) THEN
18123 x_audit_vals_rec.SHIP_TO_SITE_ID := l_service_request_rec.SHIP_TO_SITE_ID;
18124 ELSE
18125 x_audit_vals_rec.SHIP_TO_SITE_ID := l_old_ServiceRequest_rec.SHIP_TO_SITE_ID;
18126 END IF;
18127
18128 x_audit_vals_rec.OLD_PROGRAM_LOGIN_ID := l_old_ServiceRequest_rec.PROGRAM_LOGIN_ID;
18129 IF (nvl(l_service_request_rec.PROGRAM_LOGIN_ID,-99) <> FND_API.G_MISS_NUM) AND
18130 (nvl(l_service_request_rec.PROGRAM_LOGIN_ID,-99) <> nvl(l_old_ServiceRequest_rec.PROGRAM_LOGIN_ID,-99)) THEN
18131 x_audit_vals_rec.PROGRAM_LOGIN_ID := l_service_request_rec.PROGRAM_LOGIN_ID;
18132 ELSE
18133 x_audit_vals_rec.PROGRAM_LOGIN_ID := l_old_ServiceRequest_rec.PROGRAM_LOGIN_ID;
18134 END IF;
18135
18136 x_audit_vals_rec.OLD_INCIDENT_POINT_OF_INTEREST := l_old_ServiceRequest_rec.INCIDENT_POINT_OF_INTEREST;
18137 IF (nvl(l_service_request_rec.INCIDENT_POINT_OF_INTEREST,-99) <> FND_API.G_MISS_CHAR) AND
18138 (nvl(l_service_request_rec.INCIDENT_POINT_OF_INTEREST,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_POINT_OF_INTEREST,-99)) THEN
18139 x_audit_vals_rec.INCIDENT_POINT_OF_INTEREST := l_service_request_rec.INCIDENT_POINT_OF_INTEREST;
18140 ELSE
18141 x_audit_vals_rec.INCIDENT_POINT_OF_INTEREST := l_old_ServiceRequest_rec.INCIDENT_POINT_OF_INTEREST;
18142 END IF;
18143
18144 x_audit_vals_rec.OLD_INCIDENT_CROSS_STREET := l_old_ServiceRequest_rec.INCIDENT_CROSS_STREET;
18145 IF (nvl(l_service_request_rec.INCIDENT_CROSS_STREET,-99) <> FND_API.G_MISS_CHAR) AND
18146 (nvl(l_service_request_rec.INCIDENT_CROSS_STREET,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_CROSS_STREET,-99)) THEN
18147 x_audit_vals_rec.INCIDENT_CROSS_STREET := l_service_request_rec.INCIDENT_CROSS_STREET;
18148 ELSE
18149 x_audit_vals_rec.INCIDENT_CROSS_STREET := l_old_ServiceRequest_rec.INCIDENT_CROSS_STREET;
18150 END IF;
18151
18152 x_audit_vals_rec.OLD_INCIDENT_DIRECTION_QUALIF := l_old_ServiceRequest_rec.INCIDENT_DIRECTION_QUALIFIER;
18153 IF (nvl(l_service_request_rec.incident_direction_qualifier,-99) <> FND_API.G_MISS_CHAR) AND
18154 (nvl(l_service_request_rec.incident_direction_qualifier,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_DIRECTION_QUALIFIER,-99)) THEN
18155 x_audit_vals_rec.INCIDENT_DIRECTION_QUALIF := l_service_request_rec.incident_direction_qualifier;
18156 ELSE
18157 x_audit_vals_rec.INCIDENT_DIRECTION_QUALIF := l_old_ServiceRequest_rec.INCIDENT_DIRECTION_QUALIFIER;
18158 END IF;
18159
18160 x_audit_vals_rec.OLD_INCIDENT_DISTANCE_QUALIF := l_old_ServiceRequest_rec.INCIDENT_DISTANCE_QUALIFIER;
18161 IF (nvl(l_service_request_rec.incident_distance_qualifier,-99) <> FND_API.G_MISS_CHAR) AND
18162 (nvl(l_service_request_rec.incident_distance_qualifier,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_DISTANCE_QUALIFIER,-99)) THEN
18163 x_audit_vals_rec.INCIDENT_DISTANCE_QUALIF := l_service_request_rec.incident_distance_qualifier;
18164 ELSE
18165 x_audit_vals_rec.INCIDENT_DISTANCE_QUALIF := l_old_ServiceRequest_rec.INCIDENT_DISTANCE_QUALIFIER;
18166 END IF;
18167
18168 x_audit_vals_rec.OLD_INCIDENT_DISTANCE_QUAL_UOM := l_old_ServiceRequest_rec.INCIDENT_DISTANCE_QUAL_UOM;
18169 IF (nvl(l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM,-99) <> FND_API.G_MISS_CHAR) AND
18170 (nvl(l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_DISTANCE_QUAL_UOM,-99)) THEN
18171 x_audit_vals_rec.INCIDENT_DISTANCE_QUAL_UOM := l_service_request_rec.INCIDENT_DISTANCE_QUAL_UOM;
18172 ELSE
18173 x_audit_vals_rec.INCIDENT_DISTANCE_QUAL_UOM := l_old_ServiceRequest_rec.INCIDENT_DISTANCE_QUAL_UOM;
18174 END IF;
18175
18176 x_audit_vals_rec.OLD_INCIDENT_ADDRESS2 := l_old_ServiceRequest_rec.INCIDENT_ADDRESS2;
18177 IF (nvl(l_service_request_rec.INCIDENT_ADDRESS2,-99) <> FND_API.G_MISS_CHAR) AND
18178 (nvl(l_service_request_rec.INCIDENT_ADDRESS2,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ADDRESS2,-99)) THEN
18179 x_audit_vals_rec.INCIDENT_ADDRESS2 := l_service_request_rec.INCIDENT_ADDRESS2;
18180 ELSE
18181 x_audit_vals_rec.INCIDENT_ADDRESS2 := l_old_ServiceRequest_rec.INCIDENT_ADDRESS2;
18182 END IF;
18183
18184 x_audit_vals_rec.OLD_INCIDENT_ADDRESS3 := l_old_ServiceRequest_rec.INCIDENT_ADDRESS3;
18185 IF (nvl(l_service_request_rec.INCIDENT_ADDRESS3,-99) <> FND_API.G_MISS_CHAR) AND
18186 (nvl(l_service_request_rec.INCIDENT_ADDRESS3,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ADDRESS3,-99)) THEN
18187 x_audit_vals_rec.INCIDENT_ADDRESS3 := l_service_request_rec.INCIDENT_ADDRESS3;
18188 ELSE
18189 x_audit_vals_rec.INCIDENT_ADDRESS3 := l_old_ServiceRequest_rec.INCIDENT_ADDRESS3;
18190 END IF;
18191
18192 x_audit_vals_rec.OLD_INCIDENT_ADDRESS4 := l_old_ServiceRequest_rec.INCIDENT_ADDRESS4;
18193 IF (nvl(l_service_request_rec.INCIDENT_ADDRESS4,-99) <> FND_API.G_MISS_CHAR) AND
18194 (nvl(l_service_request_rec.INCIDENT_ADDRESS4,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ADDRESS4,-99)) THEN
18195 x_audit_vals_rec.INCIDENT_ADDRESS4 := l_service_request_rec.INCIDENT_ADDRESS4;
18196 ELSE
18197 x_audit_vals_rec.INCIDENT_ADDRESS4 := l_old_ServiceRequest_rec.INCIDENT_ADDRESS4;
18198 END IF;
18199
18200 x_audit_vals_rec.OLD_INCIDENT_ADDRESS_STYLE := l_old_ServiceRequest_rec.INCIDENT_ADDRESS_STYLE;
18201 IF (nvl(l_service_request_rec.INCIDENT_ADDRESS_STYLE,-99) <> FND_API.G_MISS_CHAR) AND
18202 (nvl(l_service_request_rec.INCIDENT_ADDRESS_STYLE,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ADDRESS_STYLE,-99)) THEN
18203 x_audit_vals_rec.INCIDENT_ADDRESS_STYLE := l_service_request_rec.INCIDENT_ADDRESS_STYLE;
18204 ELSE
18205 x_audit_vals_rec.INCIDENT_ADDRESS_STYLE := l_old_ServiceRequest_rec.INCIDENT_ADDRESS_STYLE;
18206 END IF;
18207
18208 x_audit_vals_rec.OLD_INCIDENT_ADDR_LNS_PHONETIC := l_old_ServiceRequest_rec.INCIDENT_ADDR_LINES_PHONETIC;
18209 IF (nvl(l_service_request_rec.incident_addr_lines_phonetic,-99) <> FND_API.G_MISS_CHAR) AND
18210 (nvl(l_service_request_rec.incident_addr_lines_phonetic,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_ADDR_LINES_PHONETIC,-99)) THEN
18211 x_audit_vals_rec.INCIDENT_ADDR_LNS_PHONETIC := l_service_request_rec.incident_addr_lines_phonetic;
18212 ELSE
18213 x_audit_vals_rec.INCIDENT_ADDR_LNS_PHONETIC := l_old_ServiceRequest_rec.INCIDENT_ADDR_LINES_PHONETIC;
18214 END IF;
18215
18216 x_audit_vals_rec.OLD_INCIDENT_PO_BOX_NUMBER := l_old_ServiceRequest_rec.INCIDENT_PO_BOX_NUMBER;
18217 IF (nvl(l_service_request_rec.INCIDENT_PO_BOX_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
18218 (nvl(l_service_request_rec.INCIDENT_PO_BOX_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_PO_BOX_NUMBER,-99)) THEN
18219 x_audit_vals_rec.INCIDENT_PO_BOX_NUMBER := l_service_request_rec.INCIDENT_PO_BOX_NUMBER;
18220 ELSE
18221 x_audit_vals_rec.INCIDENT_PO_BOX_NUMBER := l_old_ServiceRequest_rec.INCIDENT_PO_BOX_NUMBER;
18222 END IF;
18223
18224 x_audit_vals_rec.OLD_INCIDENT_HOUSE_NUMBER := l_old_ServiceRequest_rec.INCIDENT_HOUSE_NUMBER;
18225 IF (nvl(l_service_request_rec.INCIDENT_HOUSE_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
18226 (nvl(l_service_request_rec.INCIDENT_HOUSE_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_HOUSE_NUMBER,-99)) THEN
18227 x_audit_vals_rec.INCIDENT_HOUSE_NUMBER := l_service_request_rec.INCIDENT_HOUSE_NUMBER;
18228 ELSE
18229 x_audit_vals_rec.INCIDENT_HOUSE_NUMBER := l_old_ServiceRequest_rec.INCIDENT_HOUSE_NUMBER;
18230 END IF;
18231
18232 x_audit_vals_rec.OLD_INCIDENT_STREET_SUFFIX := l_old_ServiceRequest_rec.INCIDENT_STREET_SUFFIX;
18233 IF (nvl(l_service_request_rec.INCIDENT_STREET_SUFFIX,-99) <> FND_API.G_MISS_CHAR) AND
18234 (nvl(l_service_request_rec.INCIDENT_STREET_SUFFIX,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_STREET_SUFFIX,-99)) THEN
18235 x_audit_vals_rec.INCIDENT_STREET_SUFFIX := l_service_request_rec.INCIDENT_STREET_SUFFIX;
18236 ELSE
18237 x_audit_vals_rec.INCIDENT_STREET_SUFFIX := l_old_ServiceRequest_rec.INCIDENT_STREET_SUFFIX;
18238 END IF;
18239
18240 x_audit_vals_rec.OLD_INCIDENT_STREET := l_old_ServiceRequest_rec.INCIDENT_STREET;
18241 IF (nvl(l_service_request_rec.INCIDENT_STREET,-99) <> FND_API.G_MISS_CHAR) AND
18242 (nvl(l_service_request_rec.INCIDENT_STREET,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_STREET,-99)) THEN
18243 x_audit_vals_rec.INCIDENT_STREET := l_service_request_rec.INCIDENT_STREET;
18244 ELSE
18245 x_audit_vals_rec.INCIDENT_STREET := l_old_ServiceRequest_rec.INCIDENT_STREET;
18246 END IF;
18247
18248 x_audit_vals_rec.OLD_INCIDENT_STREET_NUMBER := l_old_ServiceRequest_rec.INCIDENT_STREET_NUMBER;
18249 IF (nvl(l_service_request_rec.INCIDENT_STREET_NUMBER,-99) <> FND_API.G_MISS_CHAR) AND
18250 (nvl(l_service_request_rec.INCIDENT_STREET_NUMBER,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_STREET_NUMBER,-99)) THEN
18251 x_audit_vals_rec.INCIDENT_STREET_NUMBER := l_service_request_rec.INCIDENT_STREET_NUMBER;
18252 ELSE
18253 x_audit_vals_rec.INCIDENT_STREET_NUMBER := l_old_ServiceRequest_rec.INCIDENT_STREET_NUMBER;
18254 END IF;
18255
18256 x_audit_vals_rec.OLD_INCIDENT_FLOOR := l_old_ServiceRequest_rec.INCIDENT_FLOOR;
18257 IF (nvl(l_service_request_rec.INCIDENT_FLOOR,-99) <> FND_API.G_MISS_CHAR) AND
18258 (nvl(l_service_request_rec.INCIDENT_FLOOR,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_FLOOR,-99)) THEN
18259 x_audit_vals_rec.INCIDENT_FLOOR := l_service_request_rec.INCIDENT_FLOOR;
18260 ELSE
18261 x_audit_vals_rec.INCIDENT_FLOOR := l_old_ServiceRequest_rec.INCIDENT_FLOOR;
18262 END IF;
18263
18264 x_audit_vals_rec.OLD_INCIDENT_SUITE := l_old_ServiceRequest_rec.INCIDENT_SUITE;
18265 IF (nvl(l_service_request_rec.INCIDENT_SUITE,-99) <> FND_API.G_MISS_CHAR) AND
18266 (nvl(l_service_request_rec.INCIDENT_SUITE,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_SUITE,-99)) THEN
18267 x_audit_vals_rec.INCIDENT_SUITE := l_service_request_rec.INCIDENT_SUITE;
18268 ELSE
18269 x_audit_vals_rec.INCIDENT_SUITE := l_old_ServiceRequest_rec.INCIDENT_SUITE;
18270 END IF;
18271
18272 x_audit_vals_rec.OLD_INCIDENT_POSTAL_PLUS4_CODE := l_old_ServiceRequest_rec.INCIDENT_POSTAL_PLUS4_CODE;
18273 IF (nvl(l_service_request_rec.INCIDENT_POSTAL_PLUS4_CODE,-99) <> FND_API.G_MISS_CHAR) AND
18274 (nvl(l_service_request_rec.INCIDENT_POSTAL_PLUS4_CODE,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_POSTAL_PLUS4_CODE,-99)) THEN
18275 x_audit_vals_rec.INCIDENT_POSTAL_PLUS4_CODE := l_service_request_rec.INCIDENT_POSTAL_PLUS4_CODE;
18276 ELSE
18277 x_audit_vals_rec.INCIDENT_POSTAL_PLUS4_CODE := l_old_ServiceRequest_rec.INCIDENT_POSTAL_PLUS4_CODE;
18278 END IF;
18279
18280 x_audit_vals_rec.OLD_INCIDENT_POSITION := l_old_ServiceRequest_rec.INCIDENT_POSITION;
18281 IF (nvl(l_service_request_rec.INCIDENT_POSITION,-99) <> FND_API.G_MISS_CHAR) AND
18282 (nvl(l_service_request_rec.INCIDENT_POSITION,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_POSITION,-99)) THEN
18283 x_audit_vals_rec.INCIDENT_POSITION := l_service_request_rec.INCIDENT_POSITION;
18284 ELSE
18285 x_audit_vals_rec.INCIDENT_POSITION := l_old_ServiceRequest_rec.INCIDENT_POSITION;
18286 END IF;
18287
18288 x_audit_vals_rec.OLD_INCIDENT_LOC_DIRECTIONS := l_old_ServiceRequest_rec.INCIDENT_LOCATION_DIRECTIONS;
18289 IF (nvl(l_service_request_rec.incident_location_directions,-99) <> FND_API.G_MISS_CHAR) AND
18290 (nvl(l_service_request_rec.incident_location_directions,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_LOCATION_DIRECTIONS,-99)) THEN
18291 x_audit_vals_rec.INCIDENT_LOC_DIRECTIONS := l_service_request_rec.incident_location_directions;
18292 ELSE
18293 x_audit_vals_rec.INCIDENT_LOC_DIRECTIONS := l_old_ServiceRequest_rec.INCIDENT_LOCATION_DIRECTIONS;
18294 END IF;
18295
18296 x_audit_vals_rec.OLD_INCIDENT_LOC_DESCRIPTION := l_old_ServiceRequest_rec.INCIDENT_LOCATION_DESCRIPTION;
18297 IF (nvl(l_service_request_rec.incident_location_description,-99) <> FND_API.G_MISS_CHAR) AND
18298 (nvl(l_service_request_rec.incident_location_description,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_LOCATION_DESCRIPTION,-99)) THEN
18299 x_audit_vals_rec.INCIDENT_LOC_DESCRIPTION := l_service_request_rec.incident_location_description;
18300 END IF;
18301
18302 x_audit_vals_rec.OLD_INSTALL_SITE_ID := l_old_ServiceRequest_rec.INSTALL_SITE_ID;
18303 IF (nvl(l_service_request_rec.INSTALL_SITE_ID,-99) <> FND_API.G_MISS_NUM) AND
18304 (nvl(l_service_request_rec.INSTALL_SITE_ID,-99) <> nvl(l_old_ServiceRequest_rec.INSTALL_SITE_ID,-99)) THEN
18305 x_audit_vals_rec.INSTALL_SITE_ID := l_service_request_rec.INSTALL_SITE_ID;
18306 ELSE
18307 x_audit_vals_rec.INSTALL_SITE_ID := l_old_ServiceRequest_rec.INSTALL_SITE_ID;
18308 END IF;
18309
18310 x_audit_vals_rec.OLD_TIER_VERSION := l_old_ServiceRequest_rec.TIER_VERSION;
18311 IF (nvl(l_service_request_rec.TIER_VERSION,-99) <> FND_API.G_MISS_CHAR) AND
18312 (nvl(l_service_request_rec.TIER_VERSION,-99) <> nvl(l_old_ServiceRequest_rec.TIER_VERSION,-99)) THEN
18313 x_audit_vals_rec.TIER_VERSION := l_service_request_rec.TIER_VERSION;
18314 ELSE
18315 x_audit_vals_rec.TIER_VERSION := l_old_ServiceRequest_rec.TIER_VERSION;
18316 END IF;
18317
18318 -- anmukher --09/12/03
18319
18320 x_audit_vals_rec.OLD_INC_OBJECT_VERSION_NUMBER := l_old_ServiceRequest_rec.OBJECT_VERSION_NUMBER;
18321 x_audit_vals_rec.INC_OBJECT_VERSION_NUMBER := l_old_ServiceRequest_rec.OBJECT_VERSION_NUMBER + 1;
18322
18323 x_audit_vals_rec.OLD_INC_REQUEST_ID := l_old_ServiceRequest_rec.REQUEST_ID;
18324 IF (nvl(l_service_request_rec.conc_request_id,-99) <> FND_API.G_MISS_NUM) AND
18325 (nvl(l_service_request_rec.conc_request_id,-99) <> nvl(l_old_ServiceRequest_rec.REQUEST_ID,-99)) THEN
18326 x_audit_vals_rec.INC_REQUEST_ID := l_service_request_rec.conc_request_id;
18327 ELSE
18328 x_audit_vals_rec.INC_REQUEST_ID := l_old_ServiceRequest_rec.REQUEST_ID;
18329 END IF;
18330
18331 x_audit_vals_rec.OLD_INC_PROGRAM_APPLICATION_ID := l_old_ServiceRequest_rec.PROGRAM_APPLICATION_ID;
18332 IF (nvl(l_service_request_rec.program_application_id,-99) <> FND_API.G_MISS_NUM) AND
18333 (nvl(l_service_request_rec.program_application_id,-99) <> nvl(l_old_ServiceRequest_rec.PROGRAM_APPLICATION_ID,-99)) THEN
18334 x_audit_vals_rec.INC_PROGRAM_APPLICATION_ID := l_service_request_rec.program_application_id;
18335 ELSE
18336 x_audit_vals_rec.INC_PROGRAM_APPLICATION_ID := l_old_ServiceRequest_rec.PROGRAM_APPLICATION_ID;
18337 END IF;
18338
18339 x_audit_vals_rec.OLD_INC_PROGRAM_ID := l_old_ServiceRequest_rec.PROGRAM_ID;
18340 IF (nvl(l_service_request_rec.program_id,-99) <> FND_API.G_MISS_NUM) AND
18341 (nvl(l_service_request_rec.program_id,-99) <> nvl(l_old_ServiceRequest_rec.PROGRAM_ID,-99)) THEN
18342 x_audit_vals_rec.INC_PROGRAM_ID := l_service_request_rec.program_id;
18343 ELSE
18344 x_audit_vals_rec.INC_PROGRAM_ID := l_old_ServiceRequest_rec.PROGRAM_ID;
18345 END IF;
18346
18347 /* Cannot populate this column as there is no equivalent column in l_service_request_rec */
18348 /*
18349 IF (nvl(l_service_request_rec. ,TO_DATE('09-09-0999', 'DD-MM-YYYY')) <> FND_API.G_MISS_DATE) AND
18350 (l_service_request_rec. ) THEN
18351 x_audit_vals_rec.INC_PROGRAM_UPDATE_DATE := l_service_request_rec.;
18352 END IF;
18353 */
18354
18355 x_audit_vals_rec.OLD_OWNING_DEPARTMENT_ID := l_old_ServiceRequest_rec.OWNING_DEPARTMENT_ID;
18356 IF (nvl(l_service_request_rec.owning_dept_id,-99) <> FND_API.G_MISS_NUM) AND
18357 (nvl(l_service_request_rec.owning_dept_id,-99) <> nvl(l_old_ServiceRequest_rec.OWNING_DEPARTMENT_ID,-99)) THEN
18358 x_audit_vals_rec.OWNING_DEPARTMENT_ID := l_service_request_rec.owning_dept_id;
18359 ELSE
18360 x_audit_vals_rec.OWNING_DEPARTMENT_ID := l_old_ServiceRequest_rec.OWNING_DEPARTMENT_ID;
18361 END IF;
18362
18363 /* 12/13/05 smisra moved to update_service_request procedure just before call to
18364 create audit record
18365 x_audit_vals_rec.OLD_INCIDENT_LOCATION_TYPE := l_old_ServiceRequest_rec.INCIDENT_LOCATION_TYPE;
18366 IF (nvl(l_service_request_rec.incident_location_type,-99) <> FND_API.G_MISS_CHAR) AND
18367 (nvl(l_service_request_rec.incident_location_type,-99) <> nvl(l_old_ServiceRequest_rec.INCIDENT_LOCATION_TYPE,-99)) THEN
18368 x_audit_vals_rec.INCIDENT_LOCATION_TYPE := l_service_request_rec.incident_location_type;
18369 ELSE
18370 x_audit_vals_rec.INCIDENT_LOCATION_TYPE := l_old_ServiceRequest_rec.INCIDENT_LOCATION_TYPE;
18371 END IF;
18372 ****/
18373
18374
18375 -- Assigning org_id values for auditing spusegao 09/22/03
18376 x_audit_vals_rec.org_id := l_old_ServiceRequest_rec.org_id ;
18377 x_audit_vals_rec.old_org_id := l_old_ServiceRequest_rec.org_id ;
18378
18379 CLOSE l_ServiceRequest_csr;
18380
18381 --- Assinging the values to x_service_request_rec
18382 x_service_request_rec := l_service_request_rec;
18383
18384 EXCEPTION
18385 WHEN FND_API.G_EXC_ERROR THEN
18386 ROLLBACK TO Update_ServiceRequest_PVT;
18387 IF (l_ServiceRequest_csr%ISOPEN) THEN
18388 CLOSE l_ServiceRequest_csr;
18389 END IF;
18390 x_return_status := FND_API.G_RET_STS_ERROR;
18391 FND_MSG_PUB.Count_And_Get
18392 ( p_count => x_msg_count,
18393 p_data => x_msg_data
18394 );
18395
18396 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
18397 ROLLBACK TO Update_ServiceRequest_PVT;
18398 IF (l_ServiceRequest_csr%ISOPEN) THEN
18399 CLOSE l_ServiceRequest_csr;
18400 END IF;
18401 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
18402 FND_MSG_PUB.Count_And_Get
18403 ( p_count => x_msg_count,
18404 p_data => x_msg_data
18405 );
18406
18407 WHEN OnlyUpdStatus THEN
18408 IF (l_ServiceRequest_csr%ISOPEN) THEN
18409 CLOSE l_ServiceRequest_csr;
18410 END IF;
18411 x_return_status := 'R';
18412 FND_MSG_PUB.Count_And_Get
18413 ( p_count => x_msg_count,
18414 p_data => x_msg_data
18415 );
18416
18417 WHEN OTHERS THEN
18418 ROLLBACK TO Update_ServiceRequest_PVT;
18419 IF (l_ServiceRequest_csr%ISOPEN) THEN
18420 CLOSE l_ServiceRequest_csr;
18421 END IF;
18422 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
18423 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
18424 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
18425 END IF;
18426 FND_MSG_PUB.Count_And_Get
18427 ( p_count => x_msg_count,
18428 p_data => x_msg_data
18429 );
18430 END Update_SR_Validation;
18431
18432 PROCEDURE initialize_rec(
18433 p_sr_record IN OUT NOCOPY service_request_rec_type
18434 ) AS
18435 BEGIN
18436 p_sr_record.request_date := FND_API.G_MISS_DATE;
18437 p_sr_record.type_id := FND_API.G_MISS_NUM;
18438 p_sr_record.status_id := FND_API.G_MISS_NUM;
18439 p_sr_record.severity_id := FND_API.G_MISS_NUM;
18440 p_sr_record.urgency_id := FND_API.G_MISS_NUM;
18441 p_sr_record.closed_date := FND_API.G_MISS_DATE;
18442 p_sr_record.owner_id := FND_API.G_MISS_NUM;
18443 p_sr_record.owner_group_id := FND_API.G_MISS_NUM;
18444 p_sr_record.publish_flag := FND_API.G_MISS_CHAR;
18445 p_sr_record.summary := FND_API.G_MISS_CHAR;
18446 p_sr_record.caller_type := FND_API.G_MISS_CHAR;
18447 p_sr_record.customer_id := FND_API.G_MISS_NUM;
18448 p_sr_record.customer_number := FND_API.G_MISS_CHAR;
18449 p_sr_record.employee_id := FND_API.G_MISS_NUM;
18450 p_sr_record.verify_cp_flag := FND_API.G_MISS_CHAR;
18451 p_sr_record.customer_product_id := FND_API.G_MISS_NUM;
18452 p_sr_record.platform_id := FND_API.G_MISS_NUM;
18453 p_sr_record.platform_version := FND_API.G_MISS_CHAR;
18454 p_sr_record.db_version := FND_API.G_MISS_CHAR;
18455 p_sr_record.platform_version_id := FND_API.G_MISS_NUM;
18456 p_sr_record.cp_component_id := FND_API.G_MISS_NUM;
18457 p_sr_record.cp_component_version_id := FND_API.G_MISS_NUM;
18458 p_sr_record.cp_subcomponent_id := FND_API.G_MISS_NUM;
18459 p_sr_record.cp_subcomponent_version_id := FND_API.G_MISS_NUM;
18460 p_sr_record.language_id := FND_API.G_MISS_NUM;
18461 p_sr_record.LANGUAGE := FND_API.G_MISS_CHAR;
18462 p_sr_record.inventory_item_id := FND_API.G_MISS_NUM;
18463 p_sr_record.inventory_org_id := FND_API.G_MISS_NUM;
18464 p_sr_record.current_serial_number := FND_API.G_MISS_CHAR;
18465 p_sr_record.original_order_number := FND_API.G_MISS_NUM;
18466 p_sr_record.purchase_order_num := FND_API.G_MISS_CHAR;
18467 p_sr_record.problem_code := FND_API.G_MISS_CHAR;
18468 p_sr_record.exp_resolution_date := FND_API.G_MISS_DATE;
18469 p_sr_record.install_site_use_id := FND_API.G_MISS_NUM;
18470 p_sr_record.request_attribute_1 := FND_API.G_MISS_CHAR;
18471 p_sr_record.request_attribute_2 := FND_API.G_MISS_CHAR;
18472 p_sr_record.request_attribute_3 := FND_API.G_MISS_CHAR;
18473 p_sr_record.request_attribute_4 := FND_API.G_MISS_CHAR;
18474 p_sr_record.request_attribute_5 := FND_API.G_MISS_CHAR;
18475 p_sr_record.request_attribute_6 := FND_API.G_MISS_CHAR;
18476 p_sr_record.request_attribute_7 := FND_API.G_MISS_CHAR;
18477 p_sr_record.request_attribute_8 := FND_API.G_MISS_CHAR;
18478 p_sr_record.request_attribute_9 := FND_API.G_MISS_CHAR;
18479 p_sr_record.request_attribute_10 := FND_API.G_MISS_CHAR;
18480 p_sr_record.request_attribute_11 := FND_API.G_MISS_CHAR;
18481 p_sr_record.request_attribute_12 := FND_API.G_MISS_CHAR;
18482 p_sr_record.request_attribute_13 := FND_API.G_MISS_CHAR;
18483 p_sr_record.request_attribute_14 := FND_API.G_MISS_CHAR;
18484 p_sr_record.request_attribute_15 := FND_API.G_MISS_CHAR;
18485 p_sr_record.request_context := FND_API.G_MISS_CHAR;
18486 p_sr_record.external_attribute_1 := FND_API.G_MISS_CHAR;
18487 p_sr_record.external_attribute_2 := FND_API.G_MISS_CHAR;
18488 p_sr_record.external_attribute_3 := FND_API.G_MISS_CHAR;
18489 p_sr_record.external_attribute_4 := FND_API.G_MISS_CHAR;
18490 p_sr_record.external_attribute_5 := FND_API.G_MISS_CHAR;
18491 p_sr_record.external_attribute_6 := FND_API.G_MISS_CHAR;
18492 p_sr_record.external_attribute_7 := FND_API.G_MISS_CHAR;
18493 p_sr_record.external_attribute_8 := FND_API.G_MISS_CHAR;
18494 p_sr_record.external_attribute_9 := FND_API.G_MISS_CHAR;
18495 p_sr_record.external_attribute_10 := FND_API.G_MISS_CHAR;
18496 p_sr_record.external_attribute_11 := FND_API.G_MISS_CHAR;
18497 p_sr_record.external_attribute_12 := FND_API.G_MISS_CHAR;
18498 p_sr_record.external_attribute_13 := FND_API.G_MISS_CHAR;
18499 p_sr_record.external_attribute_14 := FND_API.G_MISS_CHAR;
18500 p_sr_record.external_attribute_15 := FND_API.G_MISS_CHAR;
18501 p_sr_record.external_context := FND_API.G_MISS_CHAR;
18502 p_sr_record.bill_to_site_use_id := FND_API.G_MISS_NUM;
18503 p_sr_record.bill_to_contact_id := FND_API.G_MISS_NUM;
18504 p_sr_record.ship_to_site_use_id := FND_API.G_MISS_NUM;
18505 p_sr_record.ship_to_contact_id := FND_API.G_MISS_NUM;
18506 p_sr_record.resolution_code := FND_API.G_MISS_CHAR;
18507 p_sr_record.act_resolution_date := FND_API.G_MISS_DATE;
18508 p_sr_record.public_comment_flag := FND_API.G_MISS_CHAR;
18509 p_sr_record.parent_interaction_id := FND_API.G_MISS_NUM;
18510 p_sr_record.contract_service_id := FND_API.G_MISS_NUM;
18511 p_sr_record.contract_id := FND_API.G_MISS_NUM;
18512 p_sr_record.project_number := FND_API.G_MISS_CHAR;
18513 p_sr_record.qa_collection_plan_id := FND_API.G_MISS_NUM;
18514 p_sr_record.account_id := FND_API.G_MISS_NUM;
18515 p_sr_record.resource_type := FND_API.G_MISS_CHAR;
18516 p_sr_record.resource_subtype_id := FND_API.G_MISS_NUM;
18517 p_sr_record.cust_po_number := FND_API.G_MISS_CHAR;
18518 p_sr_record.cust_ticket_number := FND_API.G_MISS_CHAR;
18519 p_sr_record.sr_creation_channel := FND_API.G_MISS_CHAR;
18520 p_sr_record.obligation_date := FND_API.G_MISS_DATE;
18521 p_sr_record.time_zone_id := FND_API.G_MISS_NUM;
18522 p_sr_record.time_difference := FND_API.G_MISS_NUM;
18523 p_sr_record.site_id := FND_API.G_MISS_NUM;
18524 p_sr_record.customer_site_id := FND_API.G_MISS_NUM;
18525 p_sr_record.territory_id := FND_API.G_MISS_NUM;
18526 p_sr_record.initialize_flag := G_INITIALIZED;
18527 p_sr_record.cp_revision_id := FND_API.G_MISS_NUM;
18528 p_sr_record.inv_item_revision := FND_API.G_MISS_CHAR;
18529 p_sr_record.inv_component_id := FND_API.G_MISS_NUM;
18530 p_sr_record.inv_component_version := FND_API.G_MISS_CHAR;
18531 p_sr_record.inv_subcomponent_id := FND_API.G_MISS_NUM;
18532 p_sr_record.inv_subcomponent_version := FND_API.G_MISS_CHAR;
18533 p_sr_record.tier := FND_API.G_MISS_CHAR;
18534 p_sr_record.tier_version := FND_API.G_MISS_CHAR;
18535 p_sr_record.operating_system := FND_API.G_MISS_CHAR;
18536 p_sr_record.operating_system := FND_API.G_MISS_CHAR;
18537 p_sr_record.DATABASE := FND_API.G_MISS_CHAR;
18538 p_sr_record.cust_pref_lang_id := FND_API.G_MISS_NUM;
18539 p_sr_record.category_id := FND_API.G_MISS_NUM;
18540 p_sr_record.group_type := FND_API.G_MISS_CHAR;
18541 p_sr_record.group_territory_id := FND_API.G_MISS_NUM;
18542 p_sr_record.inv_platform_org_id := FND_API.G_MISS_NUM;
18543 p_sr_record.component_version := FND_API.G_MISS_CHAR;
18544 p_sr_record.subcomponent_version := FND_API.G_MISS_CHAR;
18545 p_sr_record.product_revision := FND_API.G_MISS_CHAR;
18546 p_sr_record.comm_pref_code := FND_API.G_MISS_CHAR;
18547 p_sr_record.cust_pref_lang_code := FND_API.G_MISS_CHAR;
18548 p_sr_record.category_set_id := FND_API.G_MISS_NUM;
18549 p_sr_record.external_reference := FND_API.G_MISS_CHAR;
18550 p_sr_record.system_id := FND_API.G_MISS_NUM;
18551 -- Added for HA
18552 p_sr_record.last_update_date := FND_API.G_MISS_DATE;
18553 p_sr_record.last_updated_by := FND_API.G_MISS_NUM;
18554 p_sr_record.creation_date := FND_API.G_MISS_DATE;
18555 p_sr_record.created_by := FND_API.G_MISS_NUM;
18556 p_sr_record.last_update_login := FND_API.G_MISS_NUM;
18557 p_sr_record.owner_assigned_flag := FND_API.G_MISS_CHAR;
18558 p_sr_record.owner_assigned_time := FND_API.G_MISS_DATE;
18559 p_sr_record.error_code := FND_API.G_MISS_CHAR;
18560 p_sr_record.incident_occurred_date := FND_API.G_MISS_DATE;
18561 p_sr_record.incident_resolved_date := FND_API.G_MISS_DATE;
18562 p_sr_record.inc_responded_by_date := FND_API.G_MISS_DATE;
18563 p_sr_record.incident_location_id := FND_API.G_MISS_NUM;
18564 p_sr_record.incident_address := FND_API.G_MISS_CHAR;
18565 p_sr_record.incident_city := FND_API.G_MISS_CHAR;
18566 p_sr_record.incident_state := FND_API.G_MISS_CHAR;
18567 p_sr_record.incident_country := FND_API.G_MISS_CHAR;
18568 p_sr_record.incident_province := FND_API.G_MISS_CHAR;
18569 p_sr_record.incident_postal_code := FND_API.G_MISS_CHAR;
18570 p_sr_record.incident_county := FND_API.G_MISS_CHAR;
18571 p_sr_record.resolution_summary := FND_API.G_MISS_CHAR;
18572 p_sr_record.owner := FND_API.G_MISS_CHAR;
18573 p_sr_record.group_owner := FND_API.G_MISS_CHAR;
18574 -- Added for ER# 2320056
18575 p_sr_record.coverage_type := FND_API.G_MISS_CHAR;
18576 -- Added for ER# 2433831
18577 p_sr_record.bill_to_account_id := FND_API.G_MISS_NUM;
18578 p_sr_record.ship_to_account_id := FND_API.G_MISS_NUM;
18579 -- Added for ER# 2463321
18580 p_sr_record.customer_phone_id := FND_API.G_MISS_NUM;
18581 p_sr_record.customer_email_id := FND_API.G_MISS_NUM;
18582 -- Added these parameters for 11.5.9 source changes
18583 p_sr_record.creation_program_code := FND_API.G_MISS_CHAR;
18584 p_sr_record.last_update_program_code := FND_API.G_MISS_CHAR;
18585 -- Bill_to_party, ship_to_party
18586 p_sr_record.bill_to_party_id := FND_API.G_MISS_NUM;
18587 p_sr_record.ship_to_party_id := FND_API.G_MISS_NUM;
18588 -- Conc request related fields
18589 p_sr_record.program_id := FND_API.G_MISS_NUM;
18590 p_sr_record.program_application_id := FND_API.G_MISS_NUM;
18591 p_sr_record.conc_request_id := FND_API.G_MISS_NUM;
18592 p_sr_record.program_login_id := FND_API.G_MISS_NUM;
18593 -- Bill_to_site, ship_to_site
18594 p_sr_record.bill_to_site_id := FND_API.G_MISS_NUM;
18595 p_sr_record.ship_to_site_id := FND_API.G_MISS_NUM;
18596 -- Added to initialize the address columns by shijain dec 4th 2002
18597 p_sr_record.incident_point_of_interest := FND_API.G_MISS_CHAR;
18598 p_sr_record.incident_cross_street := FND_API.G_MISS_CHAR;
18599 p_sr_record.incident_direction_qualifier := FND_API.G_MISS_CHAR;
18600 p_sr_record.incident_distance_qualifier := FND_API.G_MISS_CHAR;
18601 p_sr_record.incident_distance_qual_uom := FND_API.G_MISS_CHAR;
18602 p_sr_record.incident_address2 := FND_API.G_MISS_CHAR;
18603 p_sr_record.incident_address3 := FND_API.G_MISS_CHAR;
18604 p_sr_record.incident_address4 := FND_API.G_MISS_CHAR;
18605 p_sr_record.incident_address_style := FND_API.G_MISS_CHAR;
18606 p_sr_record.incident_addr_lines_phonetic := FND_API.G_MISS_CHAR;
18607 p_sr_record.incident_po_box_number := FND_API.G_MISS_CHAR;
18608 p_sr_record.incident_house_number := FND_API.G_MISS_CHAR;
18609 p_sr_record.incident_street_suffix := FND_API.G_MISS_CHAR;
18610 p_sr_record.incident_street := FND_API.G_MISS_CHAR;
18611 p_sr_record.incident_street_number := FND_API.G_MISS_CHAR;
18612 p_sr_record.incident_floor := FND_API.G_MISS_CHAR;
18613 p_sr_record.incident_suite := FND_API.G_MISS_CHAR;
18614 p_sr_record.incident_postal_plus4_code := FND_API.G_MISS_CHAR;
18615 p_sr_record.incident_position := FND_API.G_MISS_CHAR;
18616 p_sr_record.incident_location_directions := FND_API.G_MISS_CHAR;
18617 p_sr_record.incident_location_description:= FND_API.G_MISS_CHAR;
18618 p_sr_record.install_site_id := FND_API.G_MISS_NUM;
18619 -- Added to initialize the columns added for CMRO-EAM project (11.5.10) by anmukher aug 12 2003
18620 p_sr_record.owning_dept_id := FND_API.G_MISS_NUM;
18621 p_sr_record.old_type_CMRO_flag := FND_API.G_MISS_CHAR;
18622 p_sr_record.new_type_CMRO_flag := FND_API.G_MISS_CHAR;
18623 p_sr_record.old_type_maintenance_flag := FND_API.G_MISS_CHAR;
18624 p_sr_record.new_type_maintenance_flag := FND_API.G_MISS_CHAR;
18625 -- Added to initialize the column incident_location_type for MISC ERs Project (11.5.10) --anmukher --08/26/03
18626 p_sr_record.incident_location_type := FND_API.G_MISS_CHAR;
18627 p_sr_record.maint_organization_id := FND_API.G_MISS_NUM;
18628 END initialize_rec;
18629
18630 ---- Procedure to initialize the audit record.
18631 -- -----------------------------------------------------------------------------
18632 -- Modification History
18633 -- Date Name Desc
18634 -- -------- --------- ----------------------------------------------------------
18635 -- 07/21/05 smisra Added miant organization and old maint organization id col
18636 -- -----------------------------------------------------------------------------
18637 PROCEDURE initialize_audit_rec(
18638 p_sr_audit_record IN OUT NOCOPY sr_audit_rec_type
18639 ) AS
18640 BEGIN
18641 p_sr_audit_record.INCIDENT_STATUS_ID := NULL;
18642 p_sr_audit_record.OLD_INCIDENT_STATUS_ID := NULL;
18643 p_sr_audit_record.CHANGE_INCIDENT_STATUS_FLAG := NULL;
18644 p_sr_audit_record.INCIDENT_TYPE_ID := NULL;
18645 p_sr_audit_record.OLD_INCIDENT_TYPE_ID := NULL;
18646 p_sr_audit_record.CHANGE_INCIDENT_TYPE_FLAG := NULL;
18647 p_sr_audit_record.INCIDENT_URGENCY_ID := NULL;
18648 p_sr_audit_record.OLD_INCIDENT_URGENCY_ID := NULL;
18649 p_sr_audit_record.CHANGE_INCIDENT_URGENCY_FLAG := NULL;
18650 p_sr_audit_record.INCIDENT_SEVERITY_ID := NULL;
18651 p_sr_audit_record.OLD_INCIDENT_SEVERITY_ID := NULL;
18652 p_sr_audit_record.CHANGE_INCIDENT_SEVERITY_FLAG := NULL;
18653 p_sr_audit_record.RESPONSIBLE_GROUP_ID := NULL;
18654 p_sr_audit_record.OLD_RESPONSIBLE_GROUP_ID := NULL;
18655 p_sr_audit_record.CHANGE_RESPONSIBLE_GROUP_FLAG := NULL;
18656 p_sr_audit_record.INCIDENT_OWNER_ID := NULL;
18657 p_sr_audit_record.OLD_INCIDENT_OWNER_ID := NULL;
18658 p_sr_audit_record.CHANGE_INCIDENT_OWNER_FLAG := NULL;
18659 p_sr_audit_record.CREATE_MANUAL_ACTION := NULL;
18660 p_sr_audit_record.ACTION_ID := NULL;
18661 p_sr_audit_record.EXPECTED_RESOLUTION_DATE := NULL;
18662 p_sr_audit_record.OLD_EXPECTED_RESOLUTION_DATE := NULL;
18663 p_sr_audit_record.CHANGE_RESOLUTION_FLAG := NULL;
18664 p_sr_audit_record.NEW_WORKFLOW_FLAG := NULL;
18665 p_sr_audit_record.WORKFLOW_PROCESS_NAME := NULL;
18666 p_sr_audit_record.WORKFLOW_PROCESS_ITEMKEY := NULL;
18667 p_sr_audit_record.GROUP_ID := NULL;
18668 p_sr_audit_record.OLD_GROUP_ID := NULL;
18669 p_sr_audit_record.CHANGE_GROUP_FLAG := NULL;
18670 p_sr_audit_record.OBLIGATION_DATE := NULL;
18671 p_sr_audit_record.OLD_OBLIGATION_DATE := NULL;
18672 p_sr_audit_record.CHANGE_OBLIGATION_FLAG := NULL;
18673 p_sr_audit_record.SITE_ID := NULL;
18674 p_sr_audit_record.OLD_SITE_ID := NULL;
18675 p_sr_audit_record.CHANGE_SITE_FLAG := NULL;
18676 p_sr_audit_record.BILL_TO_CONTACT_ID := NULL;
18677 p_sr_audit_record.OLD_BILL_TO_CONTACT_ID := NULL;
18678 p_sr_audit_record.CHANGE_BILL_TO_FLAG := NULL;
18679 p_sr_audit_record.SHIP_TO_CONTACT_ID := NULL;
18680 p_sr_audit_record.OLD_SHIP_TO_CONTACT_ID := NULL;
18681 p_sr_audit_record.CHANGE_SHIP_TO_FLAG := NULL;
18682 p_sr_audit_record.INCIDENT_DATE := NULL;
18683 p_sr_audit_record.OLD_INCIDENT_DATE := NULL;
18684 p_sr_audit_record.CHANGE_INCIDENT_DATE_FLAG := NULL;
18685 p_sr_audit_record.CLOSE_DATE := NULL;
18686 p_sr_audit_record.OLD_CLOSE_DATE := NULL;
18687 p_sr_audit_record.CHANGE_CLOSE_DATE_FLAG := NULL;
18688 p_sr_audit_record.CUSTOMER_PRODUCT_ID := NULL;
18689 p_sr_audit_record.OLD_CUSTOMER_PRODUCT_ID := NULL;
18690 p_sr_audit_record.CHANGE_CUSTOMER_PRODUCT_FLAG := NULL;
18691 p_sr_audit_record.PLATFORM_ID := NULL;
18692 p_sr_audit_record.OLD_PLATFORM_ID := NULL;
18693 p_sr_audit_record.CHANGE_PLATFORM_ID_FLAG := NULL;
18694 p_sr_audit_record.PLATFORM_VERSION_ID := NULL;
18695 p_sr_audit_record.OLD_PLATFORM_VERSION_ID := NULL;
18696 p_sr_audit_record.CHANGE_PLAT_VER_ID_FLAG := NULL;
18697 p_sr_audit_record.CP_COMPONENT_ID := NULL;
18698 p_sr_audit_record.OLD_CP_COMPONENT_ID := NULL;
18699 p_sr_audit_record.CHANGE_CP_COMPONENT_ID_FLAG := NULL;
18700 p_sr_audit_record.CP_COMPONENT_VERSION_ID := NULL;
18701 p_sr_audit_record.OLD_CP_COMPONENT_VERSION_ID := NULL;
18702 p_sr_audit_record.CHANGE_CP_COMP_VER_ID_FLAG := NULL;
18703 p_sr_audit_record.CP_SUBCOMPONENT_ID := NULL;
18704 p_sr_audit_record.OLD_CP_SUBCOMPONENT_ID := NULL;
18705 p_sr_audit_record.CHANGE_CP_SUBCOMPONENT_ID_FLAG := NULL;
18706 p_sr_audit_record.CP_SUBCOMPONENT_VERSION_ID := NULL;
18707 p_sr_audit_record.OLD_CP_SUBCOMPONENT_VERSION_ID := NULL;
18708 p_sr_audit_record.CHANGE_CP_SUBCOMP_VER_ID_FLAG := NULL;
18709 p_sr_audit_record.LANGUAGE_ID := NULL;
18710 p_sr_audit_record.OLD_LANGUAGE_ID := NULL;
18711 p_sr_audit_record.CHANGE_LANGUAGE_ID_FLAG := NULL;
18712 p_sr_audit_record.TERRITORY_ID := NULL;
18713 p_sr_audit_record.OLD_TERRITORY_ID := NULL;
18714 p_sr_audit_record.CHANGE_TERRITORY_ID_FLAG := NULL;
18715 p_sr_audit_record.CP_REVISION_ID := NULL;
18716 p_sr_audit_record.OLD_CP_REVISION_ID := NULL;
18717 p_sr_audit_record.CHANGE_CP_REVISION_ID_FLAG := NULL;
18718 p_sr_audit_record.INV_ITEM_REVISION := NULL;
18719 p_sr_audit_record.OLD_INV_ITEM_REVISION := NULL;
18720 p_sr_audit_record.CHANGE_INV_ITEM_REVISION := NULL;
18721 p_sr_audit_record.INV_COMPONENT_ID := NULL;
18722 p_sr_audit_record.OLD_INV_COMPONENT_ID := NULL;
18723 p_sr_audit_record.CHANGE_INV_COMPONENT_ID := NULL;
18724 p_sr_audit_record.INV_COMPONENT_VERSION := NULL;
18725 p_sr_audit_record.OLD_INV_COMPONENT_VERSION := NULL;
18726 p_sr_audit_record.CHANGE_INV_COMPONENT_VERSION := NULL;
18727 p_sr_audit_record.INV_SUBCOMPONENT_ID := NULL;
18728 p_sr_audit_record.OLD_INV_SUBCOMPONENT_ID := NULL;
18729 p_sr_audit_record.CHANGE_INV_SUBCOMPONENT_ID := NULL;
18730 p_sr_audit_record.INV_SUBCOMPONENT_VERSION := NULL;
18731 p_sr_audit_record.OLD_INV_SUBCOMPONENT_VERSION := NULL;
18732 p_sr_audit_record.CHANGE_INV_SUBCOMP_VERSION := NULL;
18733 p_sr_audit_record.RESOURCE_TYPE := NULL;
18734 p_sr_audit_record.OLD_RESOURCE_TYPE := NULL;
18735 p_sr_audit_record.CHANGE_RESOURCE_TYPE_FLAG := NULL;
18736 p_sr_audit_record.SECURITY_GROUP_ID := NULL;
18737 p_sr_audit_record.UPGRADED_STATUS_FLAG := NULL;
18738 p_sr_audit_record.OLD_GROUP_TYPE := NULL;
18739 p_sr_audit_record.GROUP_TYPE := NULL;
18740 p_sr_audit_record.CHANGE_GROUP_TYPE_FLAG := NULL;
18741 p_sr_audit_record.OLD_OWNER_ASSIGNED_TIME := NULL;
18742 p_sr_audit_record.OWNER_ASSIGNED_TIME := NULL;
18743 p_sr_audit_record.CHANGE_ASSIGNED_TIME_FLAG := NULL;
18744 p_sr_audit_record.INV_PLATFORM_ORG_ID := NULL;
18745 p_sr_audit_record.OLD_INV_PLATFORM_ORG_ID := NULL;
18746 p_sr_audit_record.CHANGE_PLATFORM_ORG_ID_FLAG := NULL;
18747 p_sr_audit_record.COMPONENT_VERSION := NULL;
18748 p_sr_audit_record.OLD_COMPONENT_VERSION := NULL;
18749 p_sr_audit_record.CHANGE_COMP_VER_FLAG := NULL;
18750 p_sr_audit_record.SUBCOMPONENT_VERSION := NULL;
18751 p_sr_audit_record.OLD_SUBCOMPONENT_VERSION := NULL;
18752 p_sr_audit_record.CHANGE_SUBCOMP_VER_FLAG := NULL;
18753 p_sr_audit_record.PRODUCT_REVISION := NULL;
18754 p_sr_audit_record.OLD_PRODUCT_REVISION := NULL;
18755 p_sr_audit_record.CHANGE_PRODUCT_REVISION_FLAG := NULL;
18756 p_sr_audit_record.STATUS_FLAG := NULL;
18757 p_sr_audit_record.OLD_STATUS_FLAG := NULL;
18758 p_sr_audit_record.CHANGE_STATUS_FLAG := NULL;
18759 p_sr_audit_record.INVENTORY_ITEM_ID := NULL;
18760 p_sr_audit_record.OLD_INVENTORY_ITEM_ID := NULL;
18761 p_sr_audit_record.CHANGE_INVENTORY_ITEM_FLAG := NULL;
18762 p_sr_audit_record.INV_ORGANIZATION_ID := NULL;
18763 p_sr_audit_record.OLD_INV_ORGANIZATION_ID := NULL;
18764 p_sr_audit_record.CHANGE_INV_ORGANIZATION_FLAG := NULL;
18765 --p_sr_audit_record.PRIMARY_CONTACT_ID := NULL;
18766 --p_sr_audit_record.CHANGE_PRIMARY_CONTACT_FLAG := NULL;
18767 --p_sr_audit_record.OLD_PRIMARY_CONTACT_ID := NULL;
18768
18769 --Added for Auditing project of 11.5.10 --anmukher --09/09/03
18770
18771 p_sr_audit_record.UPGRADE_FLAG_FOR_CREATE := NULL;
18772 p_sr_audit_record.OLD_INCIDENT_NUMBER := NULL;
18773 p_sr_audit_record.INCIDENT_NUMBER := NULL;
18774 p_sr_audit_record.OLD_CUSTOMER_ID := NULL;
18775 p_sr_audit_record.CUSTOMER_ID := NULL;
18776 p_sr_audit_record.OLD_BILL_TO_SITE_USE_ID := NULL;
18777 p_sr_audit_record.BILL_TO_SITE_USE_ID := NULL;
18778 p_sr_audit_record.OLD_EMPLOYEE_ID := NULL;
18779 p_sr_audit_record.EMPLOYEE_ID := NULL;
18780 p_sr_audit_record.OLD_SHIP_TO_SITE_USE_ID := NULL;
18781 p_sr_audit_record.SHIP_TO_SITE_USE_ID := NULL;
18782 p_sr_audit_record.OLD_PROBLEM_CODE := NULL;
18783 p_sr_audit_record.PROBLEM_CODE := NULL;
18784 p_sr_audit_record.OLD_ACTUAL_RESOLUTION_DATE := NULL;
18785 p_sr_audit_record.ACTUAL_RESOLUTION_DATE := NULL;
18786 p_sr_audit_record.OLD_INSTALL_SITE_USE_ID := NULL;
18787 p_sr_audit_record.INSTALL_SITE_USE_ID := NULL;
18788 p_sr_audit_record.OLD_CURRENT_SERIAL_NUMBER := NULL;
18789 p_sr_audit_record.CURRENT_SERIAL_NUMBER := NULL;
18790 p_sr_audit_record.OLD_SYSTEM_ID := NULL;
18791 p_sr_audit_record.SYSTEM_ID := NULL;
18792 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_1 := NULL;
18793 p_sr_audit_record.INCIDENT_ATTRIBUTE_1 := NULL;
18794 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_2 := NULL;
18795 p_sr_audit_record.INCIDENT_ATTRIBUTE_2 := NULL;
18796 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_3 := NULL;
18797 p_sr_audit_record.INCIDENT_ATTRIBUTE_3 := NULL;
18798 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_4 := NULL;
18799 p_sr_audit_record.INCIDENT_ATTRIBUTE_4 := NULL;
18800 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_5 := NULL;
18801 p_sr_audit_record.INCIDENT_ATTRIBUTE_5 := NULL;
18802 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_6 := NULL;
18803 p_sr_audit_record.INCIDENT_ATTRIBUTE_6 := NULL;
18804 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_7 := NULL;
18805 p_sr_audit_record.INCIDENT_ATTRIBUTE_7 := NULL;
18806 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_8 := NULL;
18807 p_sr_audit_record.INCIDENT_ATTRIBUTE_8 := NULL;
18808 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_9 := NULL;
18809 p_sr_audit_record.INCIDENT_ATTRIBUTE_9 := NULL;
18810 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_10 := NULL;
18811 p_sr_audit_record.INCIDENT_ATTRIBUTE_10 := NULL;
18812 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_11 := NULL;
18813 p_sr_audit_record.INCIDENT_ATTRIBUTE_11 := NULL;
18814 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_12 := NULL;
18815 p_sr_audit_record.INCIDENT_ATTRIBUTE_12 := NULL;
18816 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_13 := NULL;
18817 p_sr_audit_record.INCIDENT_ATTRIBUTE_13 := NULL;
18818 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_14 := NULL;
18819 p_sr_audit_record.INCIDENT_ATTRIBUTE_14 := NULL;
18820 p_sr_audit_record.OLD_INCIDENT_ATTRIBUTE_15 := NULL;
18821 p_sr_audit_record.INCIDENT_ATTRIBUTE_15 := NULL;
18822 p_sr_audit_record.OLD_INCIDENT_CONTEXT := NULL;
18823 p_sr_audit_record.INCIDENT_CONTEXT := NULL;
18824 p_sr_audit_record.OLD_RESOLUTION_CODE := NULL;
18825 p_sr_audit_record.RESOLUTION_CODE := NULL;
18826 p_sr_audit_record.OLD_ORIGINAL_ORDER_NUMBER := NULL;
18827 p_sr_audit_record.ORIGINAL_ORDER_NUMBER := NULL;
18828 p_sr_audit_record.OLD_ORG_ID := NULL;
18829 p_sr_audit_record.ORG_ID := NULL;
18830 p_sr_audit_record.OLD_PURCHASE_ORDER_NUMBER := NULL;
18831 p_sr_audit_record.PURCHASE_ORDER_NUMBER := NULL;
18832 p_sr_audit_record.OLD_PUBLISH_FLAG := NULL;
18833 p_sr_audit_record.PUBLISH_FLAG := NULL;
18834 p_sr_audit_record.OLD_QA_COLLECTION_ID := NULL;
18835 p_sr_audit_record.QA_COLLECTION_ID := NULL;
18836 p_sr_audit_record.OLD_CONTRACT_ID := NULL;
18837 p_sr_audit_record.CONTRACT_ID := NULL;
18838 p_sr_audit_record.OLD_CONTRACT_NUMBER := NULL;
18839 p_sr_audit_record.CONTRACT_NUMBER := NULL;
18840 p_sr_audit_record.OLD_CONTRACT_SERVICE_ID := NULL;
18841 p_sr_audit_record.CONTRACT_SERVICE_ID := NULL;
18842 p_sr_audit_record.OLD_TIME_ZONE_ID := NULL;
18843 p_sr_audit_record.TIME_ZONE_ID := NULL;
18844 p_sr_audit_record.OLD_ACCOUNT_ID := NULL;
18845 p_sr_audit_record.ACCOUNT_ID := NULL;
18846 p_sr_audit_record.OLD_TIME_DIFFERENCE := NULL;
18847 p_sr_audit_record.TIME_DIFFERENCE := NULL;
18848 p_sr_audit_record.OLD_CUSTOMER_PO_NUMBER := NULL;
18849 p_sr_audit_record.CUSTOMER_PO_NUMBER := NULL;
18850 p_sr_audit_record.OLD_CUSTOMER_TICKET_NUMBER := NULL;
18851 p_sr_audit_record.CUSTOMER_TICKET_NUMBER := NULL;
18852 p_sr_audit_record.OLD_CUSTOMER_SITE_ID := NULL;
18853 p_sr_audit_record.CUSTOMER_SITE_ID := NULL;
18854 p_sr_audit_record.OLD_CALLER_TYPE := NULL;
18855 p_sr_audit_record.CALLER_TYPE := NULL;
18856 p_sr_audit_record.OLD_SECURITY_GROUP_ID := NULL;
18857 p_sr_audit_record.OLD_ORIG_SYSTEM_REFERENCE := NULL;
18858 p_sr_audit_record.ORIG_SYSTEM_REFERENCE := NULL;
18859 p_sr_audit_record.OLD_ORIG_SYSTEM_REFERENCE_ID := NULL;
18860 p_sr_audit_record.ORIG_SYSTEM_REFERENCE_ID := NULL;
18861 p_sr_audit_record.REQUEST_ID := NULL;
18862 p_sr_audit_record.PROGRAM_APPLICATION_ID := NULL;
18863 p_sr_audit_record.PROGRAM_ID := NULL;
18864 p_sr_audit_record.PROGRAM_UPDATE_DATE := NULL;
18865 p_sr_audit_record.OLD_PROJECT_NUMBER := NULL;
18866 p_sr_audit_record.PROJECT_NUMBER := NULL;
18867 p_sr_audit_record.OLD_PLATFORM_VERSION := NULL;
18868 p_sr_audit_record.PLATFORM_VERSION := NULL;
18869 p_sr_audit_record.OLD_DB_VERSION := NULL;
18870 p_sr_audit_record.DB_VERSION := NULL;
18871 p_sr_audit_record.OLD_CUST_PREF_LANG_ID := NULL;
18872 p_sr_audit_record.CUST_PREF_LANG_ID := NULL;
18873 p_sr_audit_record.OLD_TIER := NULL;
18874 p_sr_audit_record.TIER := NULL;
18875 p_sr_audit_record.OLD_CATEGORY_ID := NULL;
18876 p_sr_audit_record.CATEGORY_ID := NULL;
18877 p_sr_audit_record.OLD_OPERATING_SYSTEM := NULL;
18878 p_sr_audit_record.OPERATING_SYSTEM := NULL;
18879 p_sr_audit_record.OLD_OPERATING_SYSTEM_VERSION := NULL;
18880 p_sr_audit_record.OPERATING_SYSTEM_VERSION := NULL;
18881 p_sr_audit_record.OLD_DATABASE := NULL;
18882 p_sr_audit_record.DATABASE := NULL;
18883 p_sr_audit_record.OLD_GROUP_TERRITORY_ID := NULL;
18884 p_sr_audit_record.GROUP_TERRITORY_ID := NULL;
18885 p_sr_audit_record.OLD_COMM_PREF_CODE := NULL;
18886 p_sr_audit_record.COMM_PREF_CODE := NULL;
18887 p_sr_audit_record.OLD_LAST_UPDATE_CHANNEL := NULL;
18888 p_sr_audit_record.LAST_UPDATE_CHANNEL := NULL;
18889 p_sr_audit_record.OLD_CUST_PREF_LANG_CODE := NULL;
18890 p_sr_audit_record.CUST_PREF_LANG_CODE := NULL;
18891 p_sr_audit_record.OLD_ERROR_CODE := NULL;
18892 p_sr_audit_record.ERROR_CODE := NULL;
18893 p_sr_audit_record.OLD_CATEGORY_SET_ID := NULL;
18894 p_sr_audit_record.CATEGORY_SET_ID := NULL;
18895 p_sr_audit_record.OLD_EXTERNAL_REFERENCE := NULL;
18896 p_sr_audit_record.EXTERNAL_REFERENCE := NULL;
18897 p_sr_audit_record.OLD_INCIDENT_OCCURRED_DATE := NULL;
18898 p_sr_audit_record.INCIDENT_OCCURRED_DATE := NULL;
18899 p_sr_audit_record.OLD_INCIDENT_RESOLVED_DATE := NULL;
18900 p_sr_audit_record.INCIDENT_RESOLVED_DATE := NULL;
18901 p_sr_audit_record.OLD_INC_RESPONDED_BY_DATE := NULL;
18902 p_sr_audit_record.INC_RESPONDED_BY_DATE := NULL;
18903 p_sr_audit_record.OLD_INCIDENT_LOCATION_ID := NULL;
18904 p_sr_audit_record.INCIDENT_LOCATION_ID := NULL;
18905 p_sr_audit_record.OLD_INCIDENT_ADDRESS := NULL;
18906 p_sr_audit_record.INCIDENT_ADDRESS := NULL;
18907 p_sr_audit_record.OLD_INCIDENT_CITY := NULL;
18908 p_sr_audit_record.INCIDENT_CITY := NULL;
18909 p_sr_audit_record.OLD_INCIDENT_STATE := NULL;
18910 p_sr_audit_record.INCIDENT_STATE := NULL;
18911 p_sr_audit_record.OLD_INCIDENT_COUNTRY := NULL;
18912 p_sr_audit_record.INCIDENT_COUNTRY := NULL;
18913 p_sr_audit_record.OLD_INCIDENT_PROVINCE := NULL;
18914 p_sr_audit_record.INCIDENT_PROVINCE := NULL;
18915 p_sr_audit_record.OLD_INCIDENT_POSTAL_CODE := NULL;
18916 p_sr_audit_record.INCIDENT_POSTAL_CODE := NULL;
18917 p_sr_audit_record.OLD_INCIDENT_COUNTY := NULL;
18918 p_sr_audit_record.INCIDENT_COUNTY := NULL;
18919 p_sr_audit_record.OLD_SR_CREATION_CHANNEL := NULL;
18920 p_sr_audit_record.SR_CREATION_CHANNEL := NULL;
18921 p_sr_audit_record.OLD_DEF_DEFECT_ID := NULL;
18922 p_sr_audit_record.DEF_DEFECT_ID := NULL;
18923 p_sr_audit_record.OLD_DEF_DEFECT_ID2 := NULL;
18924 p_sr_audit_record.DEF_DEFECT_ID2 := NULL;
18925 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_1 := NULL;
18926 p_sr_audit_record.EXTERNAL_ATTRIBUTE_1 := NULL;
18927 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_2 := NULL;
18928 p_sr_audit_record.EXTERNAL_ATTRIBUTE_2 := NULL;
18929 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_3 := NULL;
18930 p_sr_audit_record.EXTERNAL_ATTRIBUTE_3 := NULL;
18931 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_4 := NULL;
18932 p_sr_audit_record.EXTERNAL_ATTRIBUTE_4 := NULL;
18933 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_5 := NULL;
18934 p_sr_audit_record.EXTERNAL_ATTRIBUTE_5 := NULL;
18935 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_6 := NULL;
18936 p_sr_audit_record.EXTERNAL_ATTRIBUTE_6 := NULL;
18937 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_7 := NULL;
18938 p_sr_audit_record.EXTERNAL_ATTRIBUTE_7 := NULL;
18939 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_8 := NULL;
18940 p_sr_audit_record.EXTERNAL_ATTRIBUTE_8 := NULL;
18941 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_9 := NULL;
18942 p_sr_audit_record.EXTERNAL_ATTRIBUTE_9 := NULL;
18943 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_10 := NULL;
18944 p_sr_audit_record.EXTERNAL_ATTRIBUTE_10 := NULL;
18945 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_11 := NULL;
18946 p_sr_audit_record.EXTERNAL_ATTRIBUTE_11 := NULL;
18947 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_12 := NULL;
18948 p_sr_audit_record.EXTERNAL_ATTRIBUTE_12 := NULL;
18949 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_13 := NULL;
18950 p_sr_audit_record.EXTERNAL_ATTRIBUTE_13 := NULL;
18951 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_14 := NULL;
18952 p_sr_audit_record.EXTERNAL_ATTRIBUTE_14 := NULL;
18953 p_sr_audit_record.OLD_EXTERNAL_ATTRIBUTE_15 := NULL;
18954 p_sr_audit_record.EXTERNAL_ATTRIBUTE_15 := NULL;
18955 p_sr_audit_record.OLD_EXTERNAL_CONTEXT := NULL;
18956 p_sr_audit_record.EXTERNAL_CONTEXT := NULL;
18957 p_sr_audit_record.OLD_LAST_UPDATE_PROGRAM_CODE := NULL;
18958 p_sr_audit_record.LAST_UPDATE_PROGRAM_CODE := NULL;
18959 p_sr_audit_record.OLD_CREATION_PROGRAM_CODE := NULL;
18960 p_sr_audit_record.CREATION_PROGRAM_CODE := NULL;
18961 p_sr_audit_record.OLD_COVERAGE_TYPE := NULL;
18962 p_sr_audit_record.COVERAGE_TYPE := NULL;
18963 p_sr_audit_record.OLD_BILL_TO_ACCOUNT_ID := NULL;
18964 p_sr_audit_record.BILL_TO_ACCOUNT_ID := NULL;
18965 p_sr_audit_record.OLD_SHIP_TO_ACCOUNT_ID := NULL;
18966 p_sr_audit_record.SHIP_TO_ACCOUNT_ID := NULL;
18967 p_sr_audit_record.OLD_CUSTOMER_EMAIL_ID := NULL;
18968 p_sr_audit_record.CUSTOMER_EMAIL_ID := NULL;
18969 p_sr_audit_record.OLD_CUSTOMER_PHONE_ID := NULL;
18970 p_sr_audit_record.CUSTOMER_PHONE_ID := NULL;
18971 p_sr_audit_record.OLD_BILL_TO_PARTY_ID := NULL;
18972 p_sr_audit_record.BILL_TO_PARTY_ID := NULL;
18973 p_sr_audit_record.OLD_SHIP_TO_PARTY_ID := NULL;
18974 p_sr_audit_record.SHIP_TO_PARTY_ID := NULL;
18975 p_sr_audit_record.OLD_BILL_TO_SITE_ID := NULL;
18976 p_sr_audit_record.BILL_TO_SITE_ID := NULL;
18977 p_sr_audit_record.OLD_SHIP_TO_SITE_ID := NULL;
18978 p_sr_audit_record.SHIP_TO_SITE_ID := NULL;
18979 p_sr_audit_record.OLD_PROGRAM_LOGIN_ID := NULL;
18980 p_sr_audit_record.PROGRAM_LOGIN_ID := NULL;
18981 p_sr_audit_record.OLD_INCIDENT_POINT_OF_INTEREST := NULL;
18982 p_sr_audit_record.INCIDENT_POINT_OF_INTEREST := NULL;
18983 p_sr_audit_record.OLD_INCIDENT_CROSS_STREET := NULL;
18984 p_sr_audit_record.INCIDENT_CROSS_STREET := NULL;
18985 p_sr_audit_record.OLD_INCIDENT_DIRECTION_QUALIF := NULL;
18986 p_sr_audit_record.INCIDENT_DIRECTION_QUALIF := NULL;
18987 p_sr_audit_record.OLD_INCIDENT_DISTANCE_QUALIF := NULL;
18988 p_sr_audit_record.INCIDENT_DISTANCE_QUALIF := NULL;
18989 p_sr_audit_record.OLD_INCIDENT_DISTANCE_QUAL_UOM := NULL;
18990 p_sr_audit_record.INCIDENT_DISTANCE_QUAL_UOM := NULL;
18991 p_sr_audit_record.OLD_INCIDENT_ADDRESS2 := NULL;
18992 p_sr_audit_record.INCIDENT_ADDRESS2 := NULL;
18993 p_sr_audit_record.OLD_INCIDENT_ADDRESS3 := NULL;
18994 p_sr_audit_record.INCIDENT_ADDRESS3 := NULL;
18995 p_sr_audit_record.OLD_INCIDENT_ADDRESS4 := NULL;
18996 p_sr_audit_record.INCIDENT_ADDRESS4 := NULL;
18997 p_sr_audit_record.OLD_INCIDENT_ADDRESS_STYLE := NULL;
18998 p_sr_audit_record.INCIDENT_ADDRESS_STYLE := NULL;
18999 p_sr_audit_record.OLD_INCIDENT_ADDR_LNS_PHONETIC := NULL;
19000 p_sr_audit_record.INCIDENT_ADDR_LNS_PHONETIC := NULL;
19001 p_sr_audit_record.OLD_INCIDENT_PO_BOX_NUMBER := NULL;
19002 p_sr_audit_record.INCIDENT_PO_BOX_NUMBER := NULL;
19003 p_sr_audit_record.OLD_INCIDENT_HOUSE_NUMBER := NULL;
19004 p_sr_audit_record.INCIDENT_HOUSE_NUMBER := NULL;
19005 p_sr_audit_record.OLD_INCIDENT_STREET_SUFFIX := NULL;
19006 p_sr_audit_record.INCIDENT_STREET_SUFFIX := NULL;
19007 p_sr_audit_record.OLD_INCIDENT_STREET := NULL;
19008 p_sr_audit_record.INCIDENT_STREET := NULL;
19009 p_sr_audit_record.OLD_INCIDENT_STREET_NUMBER := NULL;
19010 p_sr_audit_record.INCIDENT_STREET_NUMBER := NULL;
19011 p_sr_audit_record.OLD_INCIDENT_FLOOR := NULL;
19012 p_sr_audit_record.INCIDENT_FLOOR := NULL;
19013 p_sr_audit_record.OLD_INCIDENT_SUITE := NULL;
19014 p_sr_audit_record.INCIDENT_SUITE := NULL;
19015 p_sr_audit_record.OLD_INCIDENT_POSTAL_PLUS4_CODE := NULL;
19016 p_sr_audit_record.INCIDENT_POSTAL_PLUS4_CODE := NULL;
19017 p_sr_audit_record.OLD_INCIDENT_POSITION := NULL;
19018 p_sr_audit_record.INCIDENT_POSITION := NULL;
19019 p_sr_audit_record.OLD_INCIDENT_LOC_DIRECTIONS := NULL;
19020 p_sr_audit_record.INCIDENT_LOC_DIRECTIONS := NULL;
19021 p_sr_audit_record.OLD_INCIDENT_LOC_DESCRIPTION := NULL;
19022 p_sr_audit_record.INCIDENT_LOC_DESCRIPTION := NULL;
19023 p_sr_audit_record.OLD_INSTALL_SITE_ID := NULL;
19024 p_sr_audit_record.INSTALL_SITE_ID := NULL;
19025 p_sr_audit_record.INCIDENT_LAST_MODIFIED_DATE := NULL;
19026 p_sr_audit_record.UPDATED_ENTITY_CODE := NULL;
19027 p_sr_audit_record.UPDATED_ENTITY_ID := NULL;
19028 p_sr_audit_record.ENTITY_ACTIVITY_CODE := NULL;
19029 p_sr_audit_record.OLD_TIER_VERSION := NULL;
19030 p_sr_audit_record.TIER_VERSION := NULL;
19031 -- anmukher --09/12/03
19032 p_sr_audit_record.OLD_INC_OBJECT_VERSION_NUMBER := NULL;
19033 p_sr_audit_record.INC_OBJECT_VERSION_NUMBER := NULL;
19034 p_sr_audit_record.OLD_INC_REQUEST_ID := NULL;
19035 p_sr_audit_record.INC_REQUEST_ID := NULL;
19036 p_sr_audit_record.OLD_INC_PROGRAM_APPLICATION_ID := NULL;
19037 p_sr_audit_record.INC_PROGRAM_APPLICATION_ID := NULL;
19038 p_sr_audit_record.OLD_INC_PROGRAM_ID := NULL;
19039 p_sr_audit_record.INC_PROGRAM_ID := NULL;
19040 p_sr_audit_record.OLD_INC_PROGRAM_UPDATE_DATE := NULL;
19041 p_sr_audit_record.INC_PROGRAM_UPDATE_DATE := NULL;
19042 p_sr_audit_record.OLD_OWNING_DEPARTMENT_ID := NULL;
19043 p_sr_audit_record.OWNING_DEPARTMENT_ID := NULL;
19044 p_sr_audit_record.OLD_INCIDENT_LOCATION_TYPE := NULL;
19045 p_sr_audit_record.INCIDENT_LOCATION_TYPE := NULL;
19046 p_sr_audit_record.OLD_UNASSIGNED_INDICATOR := NULL;
19047 p_sr_audit_record.UNASSIGNED_INDICATOR := NULL;
19048 p_sr_audit_record.maint_organization_id := NULL;
19049 p_sr_audit_record.old_maint_organization_id := NULL;
19050
19051 END initialize_audit_rec;
19052
19053 --Procedure to support MLS
19054 PROCEDURE ADD_LANGUAGE
19055 IS
19056 BEGIN
19057 DELETE FROM CS_INCIDENTS_ALL_TL T
19058 WHERE NOT EXISTS
19059 (SELECT NULL
19060 FROM CS_INCIDENTS_ALL_B B
19061 WHERE B.INCIDENT_ID = T.INCIDENT_ID
19062 );
19063
19064 UPDATE CS_INCIDENTS_ALL_TL T SET (
19065 SUMMARY,
19066 RESOLUTION_SUMMARY
19067 --SR_CREATION_CHANNEL
19068 ) = (SELECT
19069 B.SUMMARY,
19070 B.RESOLUTION_SUMMARY
19071 --B.SR_CREATION_CHANNEL
19072 FROM CS_INCIDENTS_ALL_TL B
19073 WHERE B.INCIDENT_ID = T.INCIDENT_ID
19074 AND B.LANGUAGE = T.SOURCE_LANG)
19075 WHERE (
19076 T.INCIDENT_ID,
19077 T.LANGUAGE
19078 ) IN (SELECT
19079 SUBT.INCIDENT_ID,
19080 SUBT.LANGUAGE
19081 FROM CS_INCIDENTS_ALL_TL SUBB, CS_INCIDENTS_ALL_TL SUBT
19082 WHERE SUBB.INCIDENT_ID = SUBT.INCIDENT_ID
19083 AND SUBB.LANGUAGE = SUBT.SOURCE_LANG
19084 AND (SUBB.SUMMARY <> SUBT.SUMMARY
19085 OR SUBB.RESOLUTION_SUMMARY <> SUBT.RESOLUTION_SUMMARY
19086 OR (SUBB.RESOLUTION_SUMMARY IS NULL AND SUBT.RESOLUTION_SUMMARY IS NOT NULL)
19087 OR (SUBB.RESOLUTION_SUMMARY IS NOT NULL AND SUBT.RESOLUTION_SUMMARY IS NULL)
19088 --or SUBB.SR_CREATION_CHANNEL <> SUBT.SR_CREATION_CHANNEL
19089 --or (SUBB.SR_CREATION_CHANNEL is null and SUBT.SR_CREATION_CHANNEL is not null)
19090 --or (SUBB.SR_CREATION_CHANNEL is not null and SUBT.SR_CREATION_CHANNEL is null)
19091 ));
19092
19093 INSERT INTO CS_INCIDENTS_ALL_TL (
19094 INCIDENT_ID,
19095 SUMMARY,
19096 RESOLUTION_SUMMARY,
19097 LAST_UPDATE_DATE,
19098 LAST_UPDATED_BY,
19099 CREATION_DATE,
19100 CREATED_BY,
19101 LAST_UPDATE_LOGIN,
19102 --SR_CREATION_CHANNEL,
19103 LANGUAGE,
19104 SOURCE_LANG
19105 ) SELECT
19106 B.INCIDENT_ID,
19107 B.SUMMARY,
19108 B.RESOLUTION_SUMMARY,
19109 B.LAST_UPDATE_DATE,
19110 B.LAST_UPDATED_BY,
19111 B.CREATION_DATE,
19112 B.CREATED_BY,
19113 B.LAST_UPDATE_LOGIN,
19114 --B.SR_CREATION_CHANNEL,
19115 L.LANGUAGE_CODE,
19116 B.SOURCE_LANG
19117 FROM CS_INCIDENTS_ALL_TL B, FND_LANGUAGES L
19118 WHERE L.INSTALLED_FLAG IN ('I', 'B')
19119 AND B.LANGUAGE = USERENV('LANG')
19120 AND NOT EXISTS
19121 (SELECT NULL
19122 FROM CS_INCIDENTS_ALL_TL T
19123 WHERE T.INCIDENT_ID = B.INCIDENT_ID
19124 AND T.LANGUAGE = L.LANGUAGE_CODE);
19125
19126 -- This is for the incident_audit_table
19127 DELETE FROM CS_INCIDENTS_AUDIT_TL T
19128 WHERE NOT EXISTS
19129 (SELECT NULL
19130 FROM CS_INCIDENTS_AUDIT_B B
19131 WHERE B.INCIDENT_AUDIT_ID = T.INCIDENT_AUDIT_ID
19132 );
19133
19134 UPDATE CS_INCIDENTS_AUDIT_TL T SET (
19135 CHANGE_DESCRIPTION
19136 ) = (SELECT
19137 B.CHANGE_DESCRIPTION
19138 FROM CS_INCIDENTS_AUDIT_TL B
19139 WHERE B.INCIDENT_AUDIT_ID = T.INCIDENT_AUDIT_ID
19140 AND B.LANGUAGE = T.SOURCE_LANG)
19141 WHERE (
19142 T.INCIDENT_AUDIT_ID,
19143 T.LANGUAGE
19144 ) IN (SELECT
19145 SUBT.INCIDENT_AUDIT_ID,
19146 SUBT.LANGUAGE
19147 FROM CS_INCIDENTS_AUDIT_TL SUBB, CS_INCIDENTS_AUDIT_TL SUBT
19148 WHERE SUBB.INCIDENT_AUDIT_ID = SUBT.INCIDENT_AUDIT_ID
19149 AND SUBB.LANGUAGE = SUBT.SOURCE_LANG
19150 AND (SUBB.CHANGE_DESCRIPTION <> SUBT.CHANGE_DESCRIPTION
19151 OR (SUBB.CHANGE_DESCRIPTION IS NULL AND SUBT.CHANGE_DESCRIPTION IS NOT NULL)
19152 OR (SUBB.CHANGE_DESCRIPTION IS NOT NULL AND SUBT.CHANGE_DESCRIPTION IS NULL)
19153 ));
19154
19155 INSERT INTO CS_INCIDENTS_AUDIT_TL (
19156 INCIDENT_AUDIT_ID,
19157 INCIDENT_ID,
19158 LAST_UPDATE_DATE,
19159 LAST_UPDATED_BY,
19160 CREATION_DATE,
19161 CREATED_BY,
19162 LAST_UPDATE_LOGIN,
19163 CHANGE_DESCRIPTION,
19164 LANGUAGE,
19165 SOURCE_LANG
19166 ) SELECT
19167 B.INCIDENT_AUDIT_ID,
19168 B.INCIDENT_ID,
19169 B.LAST_UPDATE_DATE,
19170 B.LAST_UPDATED_BY,
19171 B.CREATION_DATE,
19172 B.CREATED_BY,
19173 B.LAST_UPDATE_LOGIN,
19174 B.CHANGE_DESCRIPTION,
19175 L.LANGUAGE_CODE,
19176 B.SOURCE_LANG
19177 FROM CS_INCIDENTS_AUDIT_TL B, FND_LANGUAGES L
19178 WHERE L.INSTALLED_FLAG IN ('I', 'B')
19179 AND B.LANGUAGE = USERENV('LANG')
19180 AND NOT EXISTS
19181 (SELECT NULL
19182 FROM CS_INCIDENTS_AUDIT_TL T
19183 WHERE T.INCIDENT_AUDIT_ID = B.INCIDENT_AUDIT_ID
19184 AND T.LANGUAGE = L.LANGUAGE_CODE);
19185
19186
19187 END ADD_LANGUAGE;
19188
19189
19190 -- Procedure Lock Row
19191 -- This is called by the Service Request form to lock a record
19192 PROCEDURE LOCK_ROW(
19193 X_INCIDENT_ID NUMBER,
19194 X_OBJECT_VERSION_NUMBER NUMBER
19195 )
19196 IS
19197 CURSOR C IS
19198 SELECT OBJECT_VERSION_NUMBER
19199 FROM CS_INCIDENTS_ALL_B
19200 WHERE INCIDENT_ID = X_INCIDENT_ID
19201 FOR UPDATE OF INCIDENT_ID NOWAIT;
19202
19203 RECINFO C%ROWTYPE;
19204 BEGIN
19205 OPEN C;
19206 FETCH C INTO RECINFO;
19207 IF (C%NOTFOUND) THEN
19208 CLOSE C;
19209 FND_MESSAGE.SET_NAME('FND', 'FORM_RECORD_DELETED');
19210 FND_MSG_PUB.ADD;
19211 APP_EXCEPTION.RAISE_EXCEPTION;
19212 END IF;
19213 CLOSE C;
19214
19215 IF (RECINFO.OBJECT_VERSION_NUMBER = X_OBJECT_VERSION_NUMBER) THEN
19216 NULL;
19217 ELSE
19218 FND_MESSAGE.SET_NAME('FND', 'FORM_RECORD_CHANGED');
19219 FND_MSG_PUB.ADD;
19220 APP_EXCEPTION.RAISE_EXCEPTION;
19221 END IF;
19222
19223 END LOCK_ROW;
19224
19225 FUNCTION Get_API_Revision RETURN NUMBER IS
19226 BEGIN
19227 RETURN G_API_REVISION;
19228 END Get_API_Revision;
19229
19230
19231 /** Following 3 functions are added for UWQ -SR integration for
19232 pop-messages in service request form
19233 **/
19234
19235 FUNCTION Get_Importance_Level(P_Severity_Id IN NUMBER)
19236 RETURN NUMBER IS
19237 CURSOR c_imp_csr IS
19238 SELECT importance_level
19239 FROM cs_incident_severities_b
19240 WHERE incident_severity_id = p_severity_id;
19241 l_imp_level NUMBER;
19242 BEGIN
19243 OPEN c_imp_csr;
19244 FETCH c_imp_csr INTO l_imp_level;
19245 CLOSE c_imp_csr;
19246
19247 RETURN(l_imp_level);
19248 END Get_Importance_Level;
19249
19250 FUNCTION Get_Old_Importance_level(p_incident_id IN NUMBER)
19251 RETURN NUMBER IS
19252 CURSOR c_imp_old_csr IS
19253 SELECT importance_level
19254 FROM cs_incident_severities_b
19255 WHERE incident_severity_id =( SELECT incident_severity_id
19256 FROM CS_INCIDENTS_ALL_B
19257 WHERE incident_id = p_incident_id);
19258 l_old_imp_level NUMBER;
19259 BEGIN
19260 OPEN c_imp_old_csr;
19261 FETCH c_imp_old_csr INTO l_old_imp_level;
19262 CLOSE c_imp_old_csr;
19263 RETURN(l_old_imp_level);
19264 END Get_Old_Importance_level;
19265
19266 FUNCTION Get_Owner_id(p_incident_id IN NUMBER)
19267 RETURN NUMBER IS
19268 CURSOR c_owner_id IS
19269 SELECT incident_owner_id
19270 FROM cs_incidents_all_b
19271 WHERE incident_id = p_incident_id;
19272 l_owner_id NUMBER;
19273 BEGIN
19274 OPEN c_owner_id;
19275 FETCH c_owner_id INTO l_owner_id;
19276 CLOSE c_owner_id;
19277
19278 RETURN(l_owner_id);
19279 END Get_Owner_id;
19280
19281 FUNCTION Get_Title(P_Object_Code IN VARCHAR2)
19282 RETURN VARCHAR2 IS
19283 CURSOR c_title_csr IS
19284 SELECT description
19285 FROM jtf_objects_vl
19286 WHERE object_code=P_Object_Code;
19287 --Fixed bug#2802393, changed length from 30 to 80
19288 l_title VARCHAR2(80);
19289 BEGIN
19290 OPEN c_title_csr;
19291 FETCH c_title_csr INTO l_title;
19292 CLOSE c_title_csr;
19293
19294 RETURN(l_title);
19295 END Get_Title;
19296
19297 FUNCTION Get_Message(p_message_code IN VARCHAR2)
19298 RETURN VARCHAR2 IS
19299 CURSOR c_uwq_message IS
19300 SELECT message_text
19301 FROM fnd_new_messages
19302 WHERE application_id = 170
19303 AND message_name = p_message_code
19304 AND language_code = USERENV('LANG');
19305 --Fixed bug#2802393, changed length from 80 to 2000
19306 l_uwq_message VARCHAR2(2000);
19307 BEGIN
19308 OPEN c_uwq_message;
19309 FETCH c_uwq_message INTO l_uwq_message;
19310 CLOSE c_uwq_message;
19311
19312 RETURN(l_uwq_message);
19313 END Get_Message;
19314
19315 /* Added for enh.2655115, procedure to get the value of status_flag for
19316 inserting into cs_incidents_all_b table. If the closed flag is Y then
19317 the status is closed, else its open.created by shijain dated nov 27th 2002*/
19318
19319 FUNCTION GET_STATUS_FLAG( p_incident_status_id IN NUMBER)
19320 RETURN VARCHAR2 IS
19321 CURSOR get_close_flag IS
19322 SELECT close_flag
19323 FROM cs_incident_statuses_b
19324 WHERE incident_status_id = p_incident_status_id;
19325
19326 l_closed_flag VARCHAR2(1);
19327 l_status_flag VARCHAR2(1):='O';
19328 BEGIN
19329 OPEN get_close_flag;
19330 FETCH get_close_flag INTO l_closed_flag;
19331 CLOSE get_close_flag;
19332
19333 IF l_closed_flag = 'Y' THEN
19334 l_status_flag:= 'C';
19335 ELSE
19336 l_status_flag:= 'O';
19337 END IF;
19338 RETURN(l_status_flag);
19339
19340 END GET_STATUS_FLAG;
19341
19342
19343
19344
19345 /* Added for enh.2690787, procedure to get the value of primary_contact_id for
19346 inserting into cs_incidents_all_b table based on the incident_id and the
19347 primary flag from the cs_hz_sr_contact_points table by shijain
19348
19349 FUNCTION GET_PRIMARY_CONTACT( p_incident_id IN NUMBER)
19350 RETURN NUMBER IS
19351
19352 CURSOR get_primary_contact IS
19353 SELECT sr_contact_point_id
19354 FROM cs_hz_sr_contact_points
19355 WHERE incident_id = p_incident_id
19356 AND primary_flag = 'Y';
19357
19358 l_primary_contact NUMBER;
19359
19360 BEGIN
19361 OPEN get_primary_contact;
19362 FETCH get_primary_contact INTO l_primary_contact;
19363 CLOSE get_primary_contact;
19364
19365 RETURN(l_primary_contact);
19366
19367 END GET_PRIMARY_CONTACT;
19368 */
19369
19370 /* This is a overloaded procedure for create service request which is mainly
19371 created for making the changes for 1159 backward compatiable. This does not
19372 contain the following parameters:-
19373 x_individual_owner, x_group_owner, x_individual_type and p_auto_assign.
19374 and will call the above procedure with all these parameters and version
19375 as 3.0*/
19376
19377 PROCEDURE Create_ServiceRequest(
19378 p_api_version IN NUMBER,
19379 p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false,
19380 p_commit IN VARCHAR2 DEFAULT fnd_api.g_false,
19381 p_validation_level IN NUMBER DEFAULT fnd_api.g_valid_level_full,
19382 x_return_status OUT NOCOPY VARCHAR2,
19383 x_msg_count OUT NOCOPY NUMBER,
19384 x_msg_data OUT NOCOPY VARCHAR2,
19385 p_resp_appl_id IN NUMBER DEFAULT NULL,
19386 p_resp_id IN NUMBER DEFAULT NULL,
19387 p_user_id IN NUMBER,
19388 p_login_id IN NUMBER DEFAULT NULL,
19389 p_org_id IN NUMBER DEFAULT NULL,
19390 p_request_id IN NUMBER DEFAULT NULL,
19391 p_request_number IN VARCHAR2 DEFAULT NULL,
19392 p_invocation_mode IN VARCHAR2 := 'NORMAL' ,
19393 p_service_request_rec IN SERVICE_REQUEST_REC_TYPE,
19394 p_notes IN NOTES_TABLE,
19395 p_contacts IN CONTACTS_TABLE,
19396 p_default_contract_sla_ind IN VARCHAR2 Default 'N',
19397 x_request_id OUT NOCOPY NUMBER,
19398 x_request_number OUT NOCOPY VARCHAR2,
19399 x_interaction_id OUT NOCOPY NUMBER,
19400 x_workflow_process_id OUT NOCOPY NUMBER
19401 ) IS
19402 l_api_name CONSTANT VARCHAR2(30) := 'Create_ServiceRequest';
19403 l_api_version CONSTANT NUMBER := 2.0;
19404 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
19405 l_return_status VARCHAR2(1);
19406 l_individual_owner NUMBER;
19407 l_group_owner NUMBER;
19408 l_individual_type VARCHAR2(30);
19409
19410
19411 BEGIN
19412 -- Standard start of API savepoint
19413 SAVEPOINT Create_ServiceRequest_PVT;
19414
19415 IF NOT FND_API.Compatible_API_Call(l_api_version, p_api_version, l_api_name,
19416 G_PKG_NAME) THEN
19417 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
19418 END IF;
19419
19420 -- Initialize API return status to success
19421 x_return_status := FND_API.G_RET_STS_SUCCESS;
19422
19423 CS_ServiceRequest_PVT.Create_ServiceRequest
19424 ( p_api_version => 3.0,
19425 p_init_msg_list => p_init_msg_list,
19426 p_commit => p_commit,
19427 p_validation_level => p_validation_level,
19428 x_return_status => x_return_status,
19429 x_msg_count => x_msg_count,
19430 x_msg_data => x_msg_data,
19431 p_resp_appl_id => p_resp_appl_id,
19432 p_resp_id => p_resp_id,
19433 p_user_id => p_user_id,
19434 p_login_id => p_login_id,
19435 p_org_id => p_org_id,
19436 p_request_id => p_request_id,
19437 p_request_number => p_request_number,
19438 p_invocation_mode => p_invocation_mode,
19439 p_service_request_rec => p_service_request_rec,
19440 p_notes => p_notes,
19441 p_contacts => p_contacts,
19442 p_auto_assign => 'N',
19443 p_default_contract_sla_ind => p_default_contract_sla_ind,
19444 x_request_id => x_request_id,
19445 x_request_number => x_request_number,
19446 x_interaction_id => x_interaction_id,
19447 x_workflow_process_id => x_workflow_process_id,
19448 x_individual_owner => l_individual_owner,
19449 x_group_owner => l_group_owner,
19450 x_individual_type => l_individual_type
19451 );
19452
19453 IF (l_return_status = FND_API.G_RET_STS_ERROR) THEN
19454 RAISE FND_API.G_EXC_ERROR;
19455 ELSIF (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) THEN
19456 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
19457 END IF;
19458
19459 EXCEPTION
19460 WHEN FND_API.G_EXC_ERROR THEN
19461 ROLLBACK TO Create_ServiceRequest_PVT;
19462 x_return_status := FND_API.G_RET_STS_ERROR;
19463 FND_MSG_PUB.Count_And_Get
19464 ( p_count => x_msg_count,
19465 p_data => x_msg_data
19466 );
19467 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
19468 ROLLBACK TO Create_ServiceRequest_PVT;
19469 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
19470 FND_MSG_PUB.Count_And_Get
19471 ( p_count => x_msg_count,
19472 p_data => x_msg_data
19473 );
19474 WHEN OTHERS THEN
19475 ROLLBACK TO Create_ServiceRequest_PVT;
19476 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
19477 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
19478 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
19479 END IF;
19480 FND_MSG_PUB.Count_And_Get
19481 ( p_count => x_msg_count,
19482 p_data => x_msg_data
19483 );
19484
19485 END Create_ServiceRequest;
19486 --
19487 PROCEDURE handle_missing_value(x_new_value in out nocopy varchar2,
19488 p_old_value in varchar2) is
19489 BEGIN
19490 -- if new value is g_miss_char then it should be set to value from database
19491 -- in case of new value being null, if condition will fail and new value will remain
19492 -- set to null
19493 IF (x_new_value = FND_API.G_MISS_CHAR) then
19494 x_new_value := p_old_value;
19495 END IF;
19496 END;
19497 -- -----------------------------------------------------------------------------
19498 -- Modification History:
19499 -- Date Name Desc
19500 -- -------- -------- -----------------------------------------------------------
19501 -- 12/23/05 smisra Bug 4868997
19502 -- Added a condition of application_id column of both tables.
19503 -- Value of application id should be 170
19504 -- -----------------------------------------------------------------------------
19505 PROCEDURE set_attribute_value(x_attr_val in out nocopy varchar2,
19506 p_attr_val_old in varchar2,
19507 p_ff_name in varchar2,
19508 p_attr_col in varchar2) is
19509 p_app_id NUMBER;
19510 CURSOR c_global_attr is
19511 select 1
19512 from fnd_descr_flex_column_usages a,
19513 fnd_descr_flex_contexts b
19514 where a.descriptive_flexfield_name = p_ff_name
19515 and b.descriptive_flexfield_name = p_ff_name
19516 and a.application_column_name = p_attr_col
19517 and a.descriptive_flex_context_code = b.descriptive_flex_context_code
19518 AND a.application_id = p_app_id
19519 AND b.application_id = p_app_id
19520 and B.global_flag = 'Y';
19521 l_dummy number;
19522 BEGIN
19523
19524 p_app_id := 170;
19525 if (x_attr_val = FND_API.G_MISS_CHAR) then
19526 open c_global_attr;
19527 fetch c_global_attr into l_dummy;
19528 if c_global_attr%found then
19529 x_attr_val := p_attr_val_old;
19530 else
19531 x_attr_val := null;
19532 end if;
19533 close c_global_attr;
19534 end if;
19535 END set_attribute_value;
19536 ------------------------
19537
19538 --------------------------------------------------------------------------------
19539 -- Procedure Name : DELETE_SERVICEREQUEST
19540 --
19541 -- Parameters (other than standard ones)
19542 -- IN
19543 -- p_purge_set_id : Id that helps identify a set of SRs
19544 -- that were purged in a single batch
19545 -- p_processing_set_id : Id that helps the API in identifying
19546 -- the set of SRs for which the child
19547 -- objects have to be deleted.
19548 -- p_purge_source_with_open_task : Indicates whether the SRs containing
19549 -- OPEN non field service tasks should
19550 -- be purged or not
19551 -- p_audit_required : Indicates if audit information has
19552 -- to be generated after purging the
19553 -- service requests
19554 --
19555 -- Description
19556 -- This API physically removes the SRs and all its child objects after
19557 -- performing validations wherever required. This is a wrapper which
19558 -- delegates the work to another helper API named
19559 -- cs_sr_delete_util.delete_servicerequest
19560 --
19561 -- HISTORY
19562 --
19563 ----------------+------------+--------------------------------------------------
19564 -- DATE | UPDATED BY | Change Description
19565 ----------------+------------+--------------------------------------------------
19566 -- 2-Aug-2005 | varnaray | Created
19567 -- | |
19568 ----------------+------------+--------------------------------------------------
19569 /*#
19570 * This API physically removes the SRs and all its child objects after
19571 * performing validations wherever required. This is a wrapper which delegates
19572 * the work to another helper API named
19573 * cs_sr_delete_util.delete_servicerequest
19574 * @param p_purge_set_id Id that helps identify a set of SRs that were purged
19575 * in a single batch
19576 * @param p_processing_set_id Id that helps the API in identifying the set of
19577 * SRs for which the child
19578 * objects have to be deleted.
19579 * @param p_purge_source_with_open_task Indicates whether the SRs containing
19580 * OPEN non field service
19581 * tasks should be purged or not
19582 * @param p_audit_required Indicates if audit information has to be generated
19583 * after purging the
19584 * service requests
19585 * @rep:scope Internal
19586 * @rep:product CS
19587 * @rep:displayname Delete Service Requests
19588 */
19589 PROCEDURE Delete_ServiceRequest
19590 (
19591 p_api_version_number IN NUMBER := 1.0
19592 , p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
19593 , p_commit IN VARCHAR2 := FND_API.G_FALSE
19594 , p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
19595 , p_processing_set_id IN NUMBER
19596 , p_purge_set_id IN NUMBER
19597 , p_purge_source_with_open_task IN VARCHAR2
19598 , p_audit_required IN VARCHAR2
19599 , x_return_status OUT NOCOPY VARCHAR2
19600 , x_msg_count OUT NOCOPY NUMBER
19601 , x_msg_data OUT NOCOPY VARCHAR2
19602 )
19603 IS
19604 --------------------------------------------------------------------------------
19605 L_API_VERSION CONSTANT NUMBER := 1.0;
19606 L_API_NAME CONSTANT VARCHAR2(30) := 'DELETE_SERVICEREQUEST';
19607 L_API_NAME_FULL CONSTANT VARCHAR2(61) := G_PKG_NAME || '.' || L_API_NAME;
19608 L_LOG_MODULE CONSTANT VARCHAR2(255) := 'cs.plsql.' || L_API_NAME_FULL || '.';
19609
19610 x_msg_index_out NUMBER;
19611
19612 BEGIN
19613 x_return_status := FND_API.G_RET_STS_SUCCESS;
19614
19615 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
19616 THEN
19617 FND_LOG.String
19618 (
19619 FND_LOG.level_procedure
19620 , L_LOG_MODULE || 'start'
19621 , 'Inside ' || L_API_NAME_FULL || ', called with parameters below:'
19622 );
19623 FND_LOG.String
19624 (
19625 FND_LOG.level_procedure
19626 , L_LOG_MODULE || 'param 1'
19627 , 'p_api_version_number:' || p_api_version_number
19628 );
19629 FND_LOG.String
19630 (
19631 FND_LOG.level_procedure
19632 , L_LOG_MODULE || 'param 2'
19633 , 'p_init_msg_list:' || p_init_msg_list
19634 );
19635 FND_LOG.String
19636 (
19637 FND_LOG.level_procedure
19638 , L_LOG_MODULE || 'param 3'
19639 , 'p_commit:' || p_commit
19640 );
19641 FND_LOG.String
19642 (
19643 FND_LOG.level_procedure
19644 , L_LOG_MODULE || 'param 4'
19645 , 'p_validation_level:' || p_validation_level
19646 );
19647 FND_LOG.String
19648 (
19649 FND_LOG.level_procedure
19650 , L_LOG_MODULE || 'param 5'
19651 , 'p_purge_source_with_open_task:' || p_purge_source_with_open_task
19652 );
19653 FND_LOG.String
19654 (
19655 FND_LOG.level_procedure
19656 , L_LOG_MODULE || 'param 6'
19657 , 'p_processing_set_id:' || p_processing_set_id
19658 );
19659 FND_LOG.String
19660 (
19661 FND_LOG.level_procedure
19662 , L_LOG_MODULE || 'param 7'
19663 , 'p_purge_set_id:' || p_purge_set_id
19664 );
19665 FND_LOG.String
19666 (
19667 FND_LOG.level_procedure
19668 , L_LOG_MODULE || 'param 8'
19669 , 'p_audit_required:' || p_audit_required
19670 );
19671 END IF ;
19672
19673 IF NOT FND_API.Compatible_API_Call
19674 (
19675 L_API_VERSION
19676 , p_api_version_number
19677 , L_API_NAME
19678 , G_PKG_NAME
19679 )
19680 THEN
19681 FND_MSG_PUB.Count_And_Get
19682 (
19683 p_count => x_msg_count
19684 , p_data => x_msg_data
19685 );
19686 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
19687 END IF ;
19688
19689 IF FND_API.to_Boolean(p_init_msg_list)
19690 THEN
19691 FND_MSG_PUB.initialize;
19692 END IF ;
19693
19694 ------------------------------------------------------------------------------
19695 -- Parameter Validations:
19696 ------------------------------------------------------------------------------
19697
19698 IF p_processing_set_id IS NULL
19699 THEN
19700 IF FND_LOG.level_unexpected >= FND_LOG.g_current_runtime_level
19701 THEN
19702 FND_LOG.String
19703 (
19704 FND_LOG.level_unexpected
19705 , L_LOG_MODULE || 'proc_set_id_invalid'
19706 , 'p_processing_set_id should not be NULL.'
19707 );
19708 END IF ;
19709
19710 FND_MESSAGE.Set_Name('CS', 'CS_SR_PARAM_VALUE_ERROR');
19711 FND_MESSAGE.Set_Token('API_NAME', L_API_NAME_FULL);
19712 FND_MESSAGE.Set_Token('PARAM', 'p_processing_set_id');
19713 FND_MESSAGE.Set_Token('CURRVAL', NVL(to_char(p_processing_set_id),'NULL'));
19714 FND_MSG_PUB.ADD;
19715
19716 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
19717 END IF;
19718
19719 ---
19720
19721 IF p_purge_source_with_open_task IS NULL
19722 OR NVL(p_purge_source_with_open_task, 'X') NOT IN ('Y', 'N')
19723 THEN
19724 IF FND_LOG.level_unexpected >= FND_LOG.g_current_runtime_level
19725 THEN
19726 FND_LOG.String
19727 (
19728 FND_LOG.level_unexpected
19729 , L_LOG_MODULE || 'p_purge_source_with_open_task_invalid'
19730 , 'p_purge_source_with_open_task value is invalid.'
19731 );
19732 END IF ;
19733
19734 FND_MESSAGE.Set_Name('CS', 'CS_SR_PARAM_VALUE_ERROR');
19735 FND_MESSAGE.Set_Token('API_NAME', L_API_NAME_FULL);
19736 FND_MESSAGE.Set_Token('PARAM', 'p_purge_source_with_open_task');
19737 FND_MESSAGE.Set_Token
19738 (
19739 'CURRVAL'
19740 , NVL(p_purge_source_with_open_task, 'NULL')
19741 );
19742 FND_MSG_PUB.ADD;
19743
19744 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
19745 END IF;
19746
19747 ---
19748
19749 IF p_audit_required IS NULL
19750 OR NVL(p_audit_required, 'X') NOT IN ('Y', 'N')
19751 THEN
19752 IF FND_LOG.level_unexpected >= FND_LOG.g_current_runtime_level
19753 THEN
19754 FND_LOG.String
19755 (
19756 FND_LOG.level_unexpected
19757 , L_LOG_MODULE || 'audit_required_invalid'
19758 , 'p_audit_required value is invalid.'
19759 );
19760 END IF ;
19761
19762 FND_MESSAGE.Set_Name('CS', 'CS_SR_PARAM_VALUE_ERROR');
19763 FND_MESSAGE.Set_Token('API_NAME', L_API_NAME_FULL);
19764 FND_MESSAGE.Set_Token('PARAM', 'p_audit_required');
19765 FND_MESSAGE.Set_Token('CURRVAL', NVL(p_audit_required, 'NULL'));
19766 FND_MSG_PUB.ADD;
19767
19768 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
19769 END IF;
19770
19771 ------------------------------------------------------------------------------
19772 -- Actual Logic starts below:
19773 ------------------------------------------------------------------------------
19774
19775 IF p_validation_level = FND_API.G_VALID_LEVEL_FULL
19776 THEN
19777 IF FND_LOG.level_statement >= FND_LOG.g_current_runtime_level
19778 THEN
19779 FND_LOG.String
19780 (
19781 FND_LOG.level_statement
19782 , L_LOG_MODULE || 'purge_valid_start'
19783 , 'calling the SR delete validation API '
19784 || 'cs_sr_delete_util.delete_sr_validations'
19785 );
19786 END IF;
19787
19788 -- The following procedure call performs validations on child objects
19789 -- and marks the purge_status in the global temp table. This status
19790 -- is used by the delete_servicerequest call to identify the SRs that
19791 -- can be actually purged.
19792
19793 CS_SR_DELETE_UTIL.Delete_Sr_Validations
19794 (
19795 p_api_version_number => '1.0'
19796 , p_init_msg_list => FND_API.G_FALSE
19797 , p_commit => FND_API.G_FALSE
19798 , p_object_type => 'SR'
19799 , p_processing_set_id => p_processing_set_id
19800 , p_purge_source_with_open_task => p_purge_source_with_open_task
19801 , x_return_status => x_return_status
19802 , x_msg_count => x_msg_count
19803 , x_msg_data => x_msg_data
19804 );
19805
19806 IF FND_LOG.level_statement >= FND_LOG.g_current_runtime_level
19807 THEN
19808 FND_LOG.String
19809 (
19810 FND_LOG.level_statement
19811 , L_LOG_MODULE || 'purge_valid_end'
19812 , 'returned from the SR delete validation API with status '
19813 || x_return_status
19814 );
19815 END IF;
19816 END IF;
19817
19818 IF x_return_status = FND_API.G_RET_STS_SUCCESS
19819 THEN
19820 IF FND_LOG.level_statement >= FND_LOG.g_current_runtime_level
19821 THEN
19822 FND_LOG.String
19823 (
19824 FND_LOG.level_statement
19825 , L_LOG_MODULE || 'purge_start'
19826 , 'calling the SR delete helper API '
19827 || 'cs_sr_delete_util.delete_servicerequest'
19828 );
19829 END IF;
19830
19831 -- This call refers to the SRs in the global temp table with purge_status
19832 -- null and calls other child object delete APIs to delete the child objects
19833 -- of SRs and also deletes the SRs from the base and TL tables.
19834
19835 CS_SR_DELETE_UTIL.Delete_ServiceRequest
19836 (
19837 p_api_version_number => '1.0'
19838 , p_init_msg_list => FND_API.G_FALSE
19839 , p_commit => FND_API.G_FALSE
19840 , p_processing_set_id => p_processing_set_id
19841 , p_object_type => 'SR'
19842 , p_purge_set_id => p_purge_set_id
19843 , p_audit_required => p_audit_required
19844 , x_return_status => x_return_status
19845 , x_msg_count => x_msg_count
19846 , x_msg_data => x_msg_data
19847 );
19848
19849 IF FND_LOG.level_statement >= FND_LOG.g_current_runtime_level
19850 THEN
19851 FND_LOG.String
19852 (
19853 FND_LOG.level_statement
19854 , L_LOG_MODULE || 'purge_end'
19855 , 'returned from the SR delete helper API with status ' || x_return_status
19856 );
19857 END IF;
19858
19859 IF p_commit = FND_API.G_TRUE
19860 AND x_return_status = FND_API.G_RET_STS_SUCCESS
19861 THEN
19862 COMMIT;
19863
19864 IF FND_LOG.level_statement >= FND_LOG.g_current_runtime_level
19865 THEN
19866 FND_LOG.String
19867 (
19868 FND_LOG.level_statement
19869 , L_LOG_MODULE || 'commit'
19870 , 'Performed a COMMIT.'
19871 );
19872 END IF;
19873 END IF;
19874 END IF;
19875
19876 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
19877 THEN
19878 FND_LOG.String
19879 (
19880 FND_LOG.level_procedure
19881 , L_LOG_MODULE || 'end'
19882 , 'Completed work in ' || L_API_NAME_FULL || ' with return status '
19883 || x_return_status
19884 );
19885 END IF;
19886 EXCEPTION
19887 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
19888 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
19889
19890 IF FND_LOG.level_unexpected >= FND_LOG.g_current_runtime_level
19891 THEN
19892 FND_LOG.String
19893 (
19894 FND_LOG.level_unexpected
19895 , L_LOG_MODULE || 'unexpected_error'
19896 , 'Inside WHEN FND_API.G_EXC_UNEXPECTED_ERROR of ' || L_API_NAME_FULL
19897 );
19898
19899 x_msg_count := FND_MSG_PUB.Count_Msg;
19900
19901 IF x_msg_count > 0
19902 THEN
19903 FOR
19904 i IN 1..x_msg_count
19905 LOOP
19906 FND_MSG_PUB.Get
19907 (
19908 p_msg_index => i
19909 , p_encoded => 'F'
19910 , p_data => x_msg_data
19911 , p_msg_index_out => x_msg_index_out
19912 );
19913 FND_LOG.String
19914 (
19915 FND_LOG.level_unexpected
19916 , L_LOG_MODULE || 'unexpected_error'
19917 , 'Error encountered is : ' || x_msg_data || ' [Index:'
19918 || x_msg_index_out || ']'
19919 );
19920 END LOOP;
19921 END IF ;
19922 END IF ;
19923
19924 WHEN OTHERS THEN
19925 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
19926 FND_MESSAGE.Set_Name('CS', 'CS_SR_DEL_API_FAIL');
19927 FND_MESSAGE.Set_Token('API_NAME', L_API_NAME_FULL);
19928 FND_MESSAGE.Set_Token('ERROR', SQLERRM);
19929 FND_MSG_PUB.ADD;
19930
19931 FND_MSG_PUB.Count_And_Get
19932 (
19933 p_count => x_msg_count
19934 , p_data => x_msg_data
19935 );
19936
19937 IF FND_LOG.level_unexpected >= FND_LOG.g_current_runtime_level
19938 THEN
19939 FND_LOG.String
19940 (
19941 FND_LOG.level_unexpected
19942 , L_LOG_MODULE || 'when_others'
19943 , 'Inside WHEN OTHERS of ' || L_API_NAME_FULL || '. Oracle Error was:'
19944 );
19945 FND_LOG.String
19946 (
19947 FND_LOG.level_unexpected
19948 , L_LOG_MODULE || 'when_others'
19949 , SQLERRM
19950 );
19951 END IF ;
19952 END Delete_ServiceRequest;
19953 -- -----------------------------------------------------------------------------
19954 -- Procedure Name : process_sr_ext_attrs
19955 -- Parameters : For in out parameter, please look at procedure
19956 -- process_sr_ext_attrs in file csvextb.pls
19957 -- IN :
19958 -- OUT :
19959 --
19960 -- Description : This is a wrapper for procedure
19961 -- cs_servicerequest_pvt.process_sr_ext_attrs
19962 --
19963 -- Modification History:
19964 -- Date Name Desc
19965 -- -------- -------- -----------------------------------------------------------
19966 -- 08/23/05 smisra Created
19967 -- -----------------------------------------------------------------------------
19968 PROCEDURE process_sr_ext_attrs
19969 ( p_api_version IN NUMBER
19970 , p_init_msg_list IN VARCHAR2 DEFAULT NULL
19971 , p_commit IN VARCHAR2 DEFAULT NULL
19972 , p_incident_id IN NUMBER
19973 , p_ext_attr_grp_tbl IN CS_ServiceRequest_PUB.EXT_ATTR_GRP_TBL_TYPE
19974 , p_ext_attr_tbl IN CS_ServiceRequest_PUB.EXT_ATTR_TBL_TYPE
19975 , p_modified_by IN NUMBER DEFAULT NULL
19976 , p_modified_on IN DATE DEFAULT NULL
19977 , x_failed_row_id_list OUT NOCOPY VARCHAR2
19978 , x_return_status OUT NOCOPY VARCHAR2
19979 , x_errorcode OUT NOCOPY NUMBER
19980 , x_msg_count OUT NOCOPY NUMBER
19981 , x_msg_data OUT NOCOPY VARCHAR2
19982 ) IS
19983 BEGIN
19984 CS_SR_EXTATTRIBUTES_PVT.process_sr_ext_attrs
19985 ( p_api_version => p_api_version
19986 , p_init_msg_list => p_init_msg_list
19987 , p_commit => p_commit
19988 , p_incident_id => p_incident_id
19989 , p_ext_attr_grp_tbl => p_ext_attr_grp_tbl
19990 , p_ext_attr_tbl => p_ext_attr_tbl
19991 , p_modified_by => p_modified_by
19992 , p_modified_on => p_modified_on
19993 , x_failed_row_id_list => x_failed_row_id_list
19994 , x_return_status => x_return_status
19995 , x_errorcode => x_errorcode
19996 , x_msg_count => x_msg_count
19997 , x_msg_data => x_msg_data
19998 );
19999 END process_sr_ext_attrs;
20000
20001 -- -----------------------------------------------------------------------------
20002 -- Procedure Name : Log_SR_PVT_Parameters
20003 -- Parameters :
20004 -- IN :
20005 -- OUT :
20006 --
20007 -- Description : Procedure to LOG the in parameters of PVT SR procedures
20008 -- service request rec and notes, contacts tables are covered.
20009 --
20010 -- Modification History:
20011 -- Date Name Desc
20012 -- -------- -------- -----------------------------------------------------------
20013 -- 09/06/05 pkesani Created
20014 -- -----------------------------------------------------------------------------
20015
20016 PROCEDURE Log_SR_PVT_Parameters
20017 ( p_service_request_rec IN service_request_rec_type
20018 ,p_notes IN notes_table
20019 ,p_contacts IN contacts_table
20020 )
20021 IS
20022 l_api_name CONSTANT VARCHAR2(30) := 'Create_ServiceRequest';
20023 l_api_name_full CONSTANT VARCHAR2(61) := G_PKG_NAME||'.'||l_api_name;
20024 l_log_module CONSTANT VARCHAR2(255) := 'cs.plsql.' || l_api_name_full || '.';
20025 l_note_index BINARY_INTEGER;
20026 l_contact_index BINARY_INTEGER;
20027 BEGIN
20028
20029 IF FND_LOG.level_procedure >= FND_LOG.g_current_runtime_level
20030 THEN
20031 --- service_request_rec_type parameters --
20032 FND_LOG.String
20033 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20034 , 'request_date :' || p_service_request_rec.request_date
20035 );
20036 FND_LOG.String
20037 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20038 , 'type_id :' || p_service_request_rec.type_id
20039 );
20040 FND_LOG.String
20041 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20042 , 'status_id :' || p_service_request_rec.status_id
20043 );
20044 FND_LOG.String
20045 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20046 , 'severity_id :' || p_service_request_rec.severity_id
20047 );
20048 FND_LOG.String
20049 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20050 , 'urgency_id :' || p_service_request_rec.urgency_id
20051 );
20052 FND_LOG.String
20053 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20054 , 'closed_date :' || p_service_request_rec.closed_date
20055 );
20056 FND_LOG.String
20057 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20058 , 'owner_id :' || p_service_request_rec.owner_id
20059 );
20060 FND_LOG.String
20061 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20062 , 'owner_group_id :' || p_service_request_rec.owner_group_id
20063 );
20064 FND_LOG.String
20065 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20066 , 'publish_flag :' || p_service_request_rec.publish_flag
20067 );
20068 FND_LOG.String
20069 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20070 , 'summary :' || p_service_request_rec.summary
20071 );
20072 FND_LOG.String
20073 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20074 , 'caller_type :' || p_service_request_rec.caller_type
20075 );
20076 FND_LOG.String
20077 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20078 , 'customer_id :' || p_service_request_rec.customer_id
20079 );
20080 FND_LOG.String
20081 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20082 , 'customer_number :' || p_service_request_rec.customer_number
20083 );
20084 FND_LOG.String
20085 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20086 , 'employee_id :' || p_service_request_rec.employee_id
20087 );
20088 FND_LOG.String
20089 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20090 , 'verify_cp_flag :' || p_service_request_rec.verify_cp_flag
20091 );
20092 FND_LOG.String
20093 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20094 , 'customer_product_id :' || p_service_request_rec.customer_product_id
20095 );
20096 FND_LOG.String
20097 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20098 , 'platform_id :' || p_service_request_rec.platform_id
20099 );
20100 FND_LOG.String
20101 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20102 , 'platform_version :' || p_service_request_rec.platform_version
20103 );
20104 FND_LOG.String
20105 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20106 , 'db_version :' || p_service_request_rec.db_version
20107 );
20108 FND_LOG.String
20109 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20110 , 'platform_version_id :' || p_service_request_rec.platform_version_id
20111 );
20112 FND_LOG.String
20113 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20114 , 'cp_component_id :' || p_service_request_rec.cp_component_id
20115 );
20116 FND_LOG.String
20117 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20118 , 'cp_component_version_id :' || p_service_request_rec.cp_component_version_id
20119 );
20120 FND_LOG.String
20121 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20122 , 'cp_subcomponent_id :' || p_service_request_rec.cp_subcomponent_id
20123 );
20124 FND_LOG.String
20125 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20126 , 'cp_subcomponent_version_id :' || p_service_request_rec.cp_subcomponent_version_id
20127 );
20128 FND_LOG.String
20129 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20130 , 'language_id :' || p_service_request_rec.language_id
20131 );
20132 FND_LOG.String
20133 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20134 , 'language :' || p_service_request_rec.language
20135 );
20136 FND_LOG.String
20137 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20138 , 'inventory_item_id :' || p_service_request_rec.inventory_item_id
20139 );
20140 FND_LOG.String
20141 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20142 , 'inventory_org_id :' || p_service_request_rec.inventory_org_id
20143 );
20144 FND_LOG.String
20145 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20146 , 'current_serial_number :' || p_service_request_rec.current_serial_number
20147 );
20148 FND_LOG.String
20149 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20150 , 'original_order_number :' || p_service_request_rec.original_order_number
20151 );
20152 FND_LOG.String
20153 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20154 , 'purchase_order_num :' || p_service_request_rec.purchase_order_num
20155 );
20156 FND_LOG.String
20157 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20158 , 'problem_code :' || p_service_request_rec.problem_code
20159 );
20160 FND_LOG.String
20161 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20162 , 'exp_resolution_date :' || p_service_request_rec.exp_resolution_date
20163 );
20164 FND_LOG.String
20165 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20166 , 'install_site_use_id :' || p_service_request_rec.install_site_use_id
20167 );
20168 FND_LOG.String
20169 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20170 , 'request_attribute_1 :' || p_service_request_rec.request_attribute_1
20171 );
20172 FND_LOG.String
20173 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20174 , 'request_attribute_2 :' || p_service_request_rec.request_attribute_2
20175 );
20176 FND_LOG.String
20177 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20178 , 'request_attribute_3 :' || p_service_request_rec.request_attribute_3
20179 );
20180 FND_LOG.String
20181 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20182 , 'request_attribute_4 :' || p_service_request_rec.request_attribute_4
20183 );
20184 FND_LOG.String
20185 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20186 , 'request_attribute_5 :' || p_service_request_rec.request_attribute_5
20187 );
20188 FND_LOG.String
20189 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20190 , 'request_attribute_6 :' || p_service_request_rec.request_attribute_6
20191 );
20192 FND_LOG.String
20193 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20194 , 'request_attribute_7 :' || p_service_request_rec.request_attribute_7
20195 );
20196 FND_LOG.String
20197 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20198 , 'request_attribute_8 :' || p_service_request_rec.request_attribute_8
20199 );
20200 FND_LOG.String
20201 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20202 , 'request_attribute_9 :' || p_service_request_rec.request_attribute_9
20203 );
20204 FND_LOG.String
20205 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20206 , 'request_attribute_10 :' || p_service_request_rec.request_attribute_10
20207 );
20208 FND_LOG.String
20209 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20210 , 'request_attribute_11 :' || p_service_request_rec.request_attribute_11
20211 );
20212 FND_LOG.String
20213 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20214 , 'request_attribute_12 :' || p_service_request_rec.request_attribute_12
20215 );
20216 FND_LOG.String
20217 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20218 , 'request_attribute_13 :' || p_service_request_rec.request_attribute_13
20219 );
20220 FND_LOG.String
20221 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20222 , 'request_attribute_14 :' || p_service_request_rec.request_attribute_14
20223 );
20224 FND_LOG.String
20225 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20226 , 'request_attribute_15 :' || p_service_request_rec.request_attribute_15
20227 );
20228 FND_LOG.String
20229 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20230 , 'request_context :' || p_service_request_rec.request_context
20231 );
20232 FND_LOG.String
20233 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20234 , 'external_attribute_1 :' || p_service_request_rec.external_attribute_1
20235 );
20236 FND_LOG.String
20237 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20238 , 'external_attribute_2 :' || p_service_request_rec.external_attribute_2
20239 );
20240 FND_LOG.String
20241 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20242 , 'external_attribute_3 :' || p_service_request_rec.external_attribute_3
20243 );
20244 FND_LOG.String
20245 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20246 , 'external_attribute_4 :' || p_service_request_rec.external_attribute_4
20247 );
20248 FND_LOG.String
20249 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20250 , 'external_attribute_5 :' || p_service_request_rec.external_attribute_5
20251 );
20252 FND_LOG.String
20253 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20254 , 'external_attribute_6 :' || p_service_request_rec.external_attribute_6
20255 );
20256 FND_LOG.String
20257 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20258 , 'external_attribute_7 :' || p_service_request_rec.external_attribute_7
20259 );
20260 FND_LOG.String
20261 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20262 , 'external_attribute_8 :' || p_service_request_rec.external_attribute_8
20263 );
20264 FND_LOG.String
20265 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20266 , 'external_attribute_9 :' || p_service_request_rec.external_attribute_9
20267 );
20268 FND_LOG.String
20269 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20270 , 'external_attribute_10 :' || p_service_request_rec.external_attribute_10
20271 );
20272 FND_LOG.String
20273 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20274 , 'external_attribute_11 :' || p_service_request_rec.external_attribute_11
20275 );
20276 FND_LOG.String
20277 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20278 , 'external_attribute_12 :' || p_service_request_rec.external_attribute_12
20279 );
20280 FND_LOG.String
20281 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20282 , 'external_attribute_13 :' || p_service_request_rec.external_attribute_13
20283 );
20284 FND_LOG.String
20285 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20286 , 'external_attribute_14 :' || p_service_request_rec.external_attribute_14
20287 );
20288 FND_LOG.String
20289 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20290 , 'external_attribute_15 :' || p_service_request_rec.external_attribute_15
20291 );
20292 FND_LOG.String
20293 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20294 , 'external_context :' || p_service_request_rec.external_context
20295 );
20296 FND_LOG.String
20297 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20298 , 'bill_to_site_use_id :' || p_service_request_rec.bill_to_site_use_id
20299 );
20300 FND_LOG.String
20301 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20302 , 'bill_to_contact_id :' || p_service_request_rec.bill_to_contact_id
20303 );
20304 FND_LOG.String
20305 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20306 , 'ship_to_site_use_id :' || p_service_request_rec.ship_to_site_use_id
20307 );
20308 FND_LOG.String
20309 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20310 , 'ship_to_contact_id :' || p_service_request_rec.ship_to_contact_id
20311 );
20312 FND_LOG.String
20313 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20314 , 'resolution_code :' || p_service_request_rec.resolution_code
20315 );
20316 FND_LOG.String
20317 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20318 , 'act_resolution_date :' || p_service_request_rec.act_resolution_date
20319 );
20320 FND_LOG.String
20321 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20322 , 'public_comment_flag :' || p_service_request_rec.public_comment_flag
20323 );
20324 FND_LOG.String
20325 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20326 , 'parent_interaction_id :' || p_service_request_rec.parent_interaction_id
20327 );
20328 FND_LOG.String
20329 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20330 , 'contract_service_id :' || p_service_request_rec.contract_service_id
20331 );
20332 FND_LOG.String
20333 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20334 , 'contract_id :' || p_service_request_rec.contract_id
20335 );
20336 FND_LOG.String
20337 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20338 , 'project_number :' || p_service_request_rec.project_number
20339 );
20340 FND_LOG.String
20341 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20342 , 'qa_collection_plan_id :' || p_service_request_rec.qa_collection_plan_id
20343 );
20344 FND_LOG.String
20345 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20346 , 'account_id :' || p_service_request_rec.account_id
20347 );
20348 FND_LOG.String
20349 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20350 , 'resource_type :' || p_service_request_rec.resource_type
20351 );
20352 FND_LOG.String
20353 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20354 , 'resource_subtype_id :' || p_service_request_rec.resource_subtype_id
20355 );
20356 FND_LOG.String
20357 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20358 , 'cust_po_number :' || p_service_request_rec.cust_po_number
20359 );
20360 FND_LOG.String
20361 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20362 , 'cust_ticket_number :' || p_service_request_rec.cust_ticket_number
20363 );
20364 FND_LOG.String
20365 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20366 , 'sr_creation_channel :' || p_service_request_rec.sr_creation_channel
20367 );
20368 FND_LOG.String
20369 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20370 , 'obligation_date :' || p_service_request_rec.obligation_date
20371 );
20372 FND_LOG.String
20373 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20374 , 'time_zone_id :' || p_service_request_rec.time_zone_id
20375 );
20376 FND_LOG.String
20377 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20378 , 'time_difference :' || p_service_request_rec.time_difference
20379 );
20380 FND_LOG.String
20381 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20382 , 'site_id :' || p_service_request_rec.site_id
20383 );
20384 FND_LOG.String
20385 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20386 , 'customer_site_id :' || p_service_request_rec.customer_site_id
20387 );
20388 FND_LOG.String
20389 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20390 , 'territory_id :' || p_service_request_rec.territory_id
20391 );
20392 FND_LOG.String
20393 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20394 , 'initialize_flag :' || p_service_request_rec.initialize_flag
20395 );
20396 FND_LOG.String
20397 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20398 , 'cp_revision_id :' || p_service_request_rec.cp_revision_id
20399 );
20400 FND_LOG.String
20401 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20402 , 'inv_item_revision :' || p_service_request_rec.inv_item_revision
20403 );
20404 FND_LOG.String
20405 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20406 , 'inv_component_id :' || p_service_request_rec.inv_component_id
20407 );
20408 FND_LOG.String
20409 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20410 , 'inv_component_version :' || p_service_request_rec.inv_component_version
20411 );
20412 FND_LOG.String
20413 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20414 , 'inv_subcomponent_id :' || p_service_request_rec.inv_subcomponent_id
20415 );
20416 FND_LOG.String
20417 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20418 , 'inv_subcomponent_version :' || p_service_request_rec.inv_subcomponent_version
20419 );
20420 FND_LOG.String
20421 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20422 , 'tier :' || p_service_request_rec.tier
20423 );
20424 FND_LOG.String
20425 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20426 , 'tier_version :' || p_service_request_rec.tier_version
20427 );
20428 FND_LOG.String
20429 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20430 , 'operating_system :' || p_service_request_rec.operating_system
20431 );
20432 FND_LOG.String
20433 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20434 , 'operating_system_version :' || p_service_request_rec.operating_system_version
20435 );
20436 FND_LOG.String
20437 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20438 , 'database :' || p_service_request_rec.database
20439 );
20440 FND_LOG.String
20441 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20442 , 'cust_pref_lang_id :' || p_service_request_rec.cust_pref_lang_id
20443 );
20444 FND_LOG.String
20445 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20446 , 'category_id :' || p_service_request_rec.category_id
20447 );
20448 FND_LOG.String
20449 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20450 , 'group_type :' || p_service_request_rec.group_type
20451 );
20452 FND_LOG.String
20453 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20454 , 'group_territory_id :' || p_service_request_rec.group_territory_id
20455 );
20456 FND_LOG.String
20457 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20458 , 'inv_platform_org_id :' || p_service_request_rec.inv_platform_org_id
20459 );
20460 FND_LOG.String
20461 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20462 , 'product_revision :' || p_service_request_rec.product_revision
20463 );
20464 FND_LOG.String
20465 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20466 , 'component_version :' || p_service_request_rec.component_version
20467 );
20468 FND_LOG.String
20469 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20470 , 'subcomponent_version :' || p_service_request_rec.subcomponent_version
20471 );
20472 FND_LOG.String
20473 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20474 , 'comm_pref_code :' || p_service_request_rec.comm_pref_code
20475 );
20476 FND_LOG.String
20477 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20478 , 'last_update_date :' || p_service_request_rec.last_update_date
20479 );
20480 FND_LOG.String
20481 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20482 , 'last_updated_by :' || p_service_request_rec.last_updated_by
20483 );
20484 FND_LOG.String
20485 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20486 , 'creation_date :' || p_service_request_rec.creation_date
20487 );
20488 FND_LOG.String
20489 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20490 , 'created_by :' || p_service_request_rec.created_by
20491 );
20492 FND_LOG.String
20493 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20494 , 'last_update_login :' || p_service_request_rec.last_update_login
20495 );
20496 FND_LOG.String
20497 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20498 , 'owner_assigned_time :' || p_service_request_rec.owner_assigned_time
20499 );
20500 FND_LOG.String
20501 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20502 , 'owner_assigned_flag :' || p_service_request_rec.owner_assigned_flag
20503 );
20504 FND_LOG.String
20505 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20506 , 'last_update_channel :' || p_service_request_rec.last_update_channel
20507 );
20508 FND_LOG.String
20509 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20510 , 'cust_pref_lang_code :' || p_service_request_rec.cust_pref_lang_code
20511 );
20512 FND_LOG.String
20513 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20514 , 'load_balance :' || p_service_request_rec.load_balance
20515 );
20516 FND_LOG.String
20517 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20518 , 'assign_owner :' || p_service_request_rec.assign_owner
20519 );
20520 FND_LOG.String
20521 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20522 , 'category_set_id :' || p_service_request_rec.category_set_id
20523 );
20524 FND_LOG.String
20525 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20526 , 'external_reference :' || p_service_request_rec.external_reference
20527 );
20528 FND_LOG.String
20529 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20530 , 'system_id :' || p_service_request_rec.system_id
20531 );
20532 FND_LOG.String
20533 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20534 , 'error_code :' || p_service_request_rec.error_code
20535 );
20536 FND_LOG.String
20537 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20538 , 'incident_occurred_date :' || p_service_request_rec.incident_occurred_date
20539 );
20540 FND_LOG.String
20541 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20542 , 'incident_resolved_date :' || p_service_request_rec.incident_resolved_date
20543 );
20544 FND_LOG.String
20545 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20546 , 'inc_responded_by_date :' || p_service_request_rec.inc_responded_by_date
20547 );
20548 FND_LOG.String
20549 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20550 , 'resolution_summary :' || p_service_request_rec.resolution_summary
20551 );
20552 FND_LOG.String
20553 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20554 , 'incident_location_id :' || p_service_request_rec.incident_location_id
20555 );
20556 FND_LOG.String
20557 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20558 , 'incident_address :' || p_service_request_rec.incident_address
20559 );
20560 FND_LOG.String
20561 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20562 , 'incident_city :' || p_service_request_rec.incident_city
20563 );
20564 FND_LOG.String
20565 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20566 , 'incident_state :' || p_service_request_rec.incident_state
20567 );
20568 FND_LOG.String
20569 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20570 , 'incident_country :' || p_service_request_rec.incident_country
20571 );
20572 FND_LOG.String
20573 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20574 , 'incident_province :' || p_service_request_rec.incident_province
20575 );
20576 FND_LOG.String
20577 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20578 , 'incident_postal_code :' || p_service_request_rec.incident_postal_code
20579 );
20580 FND_LOG.String
20581 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20582 , 'incident_county :' || p_service_request_rec.incident_county
20583 );
20584 FND_LOG.String
20585 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20586 , 'owner :' || p_service_request_rec.owner
20587 );
20588 FND_LOG.String
20589 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20590 , 'group_owner :' || p_service_request_rec.group_owner
20591 );
20592 FND_LOG.String
20593 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20594 , 'cc_number :' || p_service_request_rec.cc_number
20595 );
20596 FND_LOG.String
20597 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20598 , 'cc_expiration_date :' || p_service_request_rec.cc_expiration_date
20599 );
20600 FND_LOG.String
20601 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20602 , 'cc_type_code :' || p_service_request_rec.cc_type_code
20603 );
20604 FND_LOG.String
20605 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20606 , 'cc_first_name :' || p_service_request_rec.cc_first_name
20607 );
20608 FND_LOG.String
20609 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20610 , 'cc_last_name :' || p_service_request_rec.cc_last_name
20611 );
20612 FND_LOG.String
20613 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20614 , 'cc_middle_name :' || p_service_request_rec.cc_middle_name
20615 );
20616 FND_LOG.String
20617 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20618 , 'cc_id :' || p_service_request_rec.cc_id
20619 );
20620 FND_LOG.String
20621 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20622 , 'coverage_type :' || p_service_request_rec.coverage_type
20623 );
20624 FND_LOG.String
20625 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20626 , 'bill_to_account_id :' || p_service_request_rec.bill_to_account_id
20627 );
20628 FND_LOG.String
20629 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20630 , 'ship_to_account_id :' || p_service_request_rec.ship_to_account_id
20631 );
20632 FND_LOG.String
20633 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20634 , 'customer_phone_id :' || p_service_request_rec.customer_phone_id
20635 );
20636 FND_LOG.String
20637 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20638 , 'customer_email_id :' || p_service_request_rec.customer_email_id
20639 );
20640 FND_LOG.String
20641 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20642 , 'creation_program_code :' || p_service_request_rec.creation_program_code
20643 );
20644 FND_LOG.String
20645 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20646 , 'last_update_program_code :' || p_service_request_rec.last_update_program_code
20647 );
20648 FND_LOG.String
20649 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20650 , 'bill_to_party_id :' || p_service_request_rec.bill_to_party_id
20651 );
20652 FND_LOG.String
20653 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20654 , 'ship_to_party_id :' || p_service_request_rec.ship_to_party_id
20655 );
20656 FND_LOG.String
20657 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20658 , 'program_id :' || p_service_request_rec.program_id
20659 );
20660 FND_LOG.String
20661 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20662 , 'program_application_id :' || p_service_request_rec.program_application_id
20663 );
20664 FND_LOG.String
20665 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20666 , 'conc_request_id :' || p_service_request_rec.conc_request_id
20667 );
20668 FND_LOG.String
20669 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20670 , 'program_login_id :' || p_service_request_rec.program_login_id
20671 );
20672 FND_LOG.String
20673 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20674 , 'bill_to_site_id :' || p_service_request_rec.bill_to_site_id
20675 );
20676 FND_LOG.String
20677 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20678 , 'ship_to_site_id :' || p_service_request_rec.ship_to_site_id
20679 );
20680 FND_LOG.String
20681 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20682 , 'incident_point_of_interest :' || p_service_request_rec.incident_point_of_interest
20683 );
20684 FND_LOG.String
20685 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20686 , 'incident_cross_street :' || p_service_request_rec.incident_cross_street
20687 );
20688 FND_LOG.String
20689 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20690 , 'incident_direction_qualifier :' || p_service_request_rec.incident_direction_qualifier
20691 );
20692 FND_LOG.String
20693 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20694 , 'incident_distance_qualifier :' || p_service_request_rec.incident_distance_qualifier
20695 );
20696 FND_LOG.String
20697 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20698 , 'incident_distance_qual_uom :' || p_service_request_rec.incident_distance_qual_uom
20699 );
20700 FND_LOG.String
20701 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20702 , 'incident_address2 :' || p_service_request_rec.incident_address2
20703 );
20704 FND_LOG.String
20705 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20706 , 'incident_address3 :' || p_service_request_rec.incident_address3
20707 );
20708 FND_LOG.String
20709 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20710 , 'incident_address4 :' || p_service_request_rec.incident_address4
20711 );
20712 FND_LOG.String
20713 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20714 , 'incident_address_style :' || p_service_request_rec.incident_address_style
20715 );
20716 FND_LOG.String
20717 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20718 , 'incident_addr_lines_phonetic :' || p_service_request_rec.incident_addr_lines_phonetic
20719 );
20720 FND_LOG.String
20721 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20722 , 'incident_po_box_number :' || p_service_request_rec.incident_po_box_number
20723 );
20724 FND_LOG.String
20725 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20726 , 'incident_house_number :' || p_service_request_rec.incident_house_number
20727 );
20728 FND_LOG.String
20729 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20730 , 'incident_street_suffix :' || p_service_request_rec.incident_street_suffix
20731 );
20732 FND_LOG.String
20733 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20734 , 'incident_street :' || p_service_request_rec.incident_street
20735 );
20736 FND_LOG.String
20737 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20738 , 'incident_street_number :' || p_service_request_rec.incident_street_number
20739 );
20740 FND_LOG.String
20741 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20742 , 'incident_floor :' || p_service_request_rec.incident_floor
20743 );
20744 FND_LOG.String
20745 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20746 , 'incident_suite :' || p_service_request_rec.incident_suite
20747 );
20748 FND_LOG.String
20749 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20750 , 'incident_postal_plus4_code :' || p_service_request_rec.incident_postal_plus4_code
20751 );
20752 FND_LOG.String
20753 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20754 , 'incident_position :' || p_service_request_rec.incident_position
20755 );
20756 FND_LOG.String
20757 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20758 , 'incident_location_directions :' || p_service_request_rec.incident_location_directions
20759 );
20760 FND_LOG.String
20761 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20762 , 'incident_location_description :' || p_service_request_rec.incident_location_description
20763 );
20764 FND_LOG.String
20765 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20766 , 'install_site_id :' || p_service_request_rec.install_site_id
20767 );
20768 FND_LOG.String
20769 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20770 , 'status_flag :' || p_service_request_rec.status_flag
20771 );
20772 FND_LOG.String
20773 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20774 , 'primary_contact_id :' || p_service_request_rec.primary_contact_id
20775 );
20776 FND_LOG.String
20777 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20778 , 'old_type_maintenance_flag :' || p_service_request_rec.old_type_maintenance_flag
20779 );
20780 FND_LOG.String
20781 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20782 , 'new_type_maintenance_flag :' || p_service_request_rec.new_type_maintenance_flag
20783 );
20784 FND_LOG.String
20785 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20786 , 'old_type_CMRO_flag :' || p_service_request_rec.old_type_CMRO_flag
20787 );
20788 FND_LOG.String
20789 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20790 , 'new_type_CMRO_flag :' || p_service_request_rec.new_type_CMRO_flag
20791 );
20792 FND_LOG.String
20793 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20794 , 'item_serial_number :' || p_service_request_rec.item_serial_number
20795 );
20796 FND_LOG.String
20797 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20798 , 'owning_dept_id :' || p_service_request_rec.owning_dept_id
20799 );
20800 FND_LOG.String
20801 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20802 , 'incident_location_type :' || p_service_request_rec.incident_location_type
20803 );
20804 FND_LOG.String
20805 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20806 , 'org_id :' || p_service_request_rec.org_id
20807 );
20808 FND_LOG.String
20809 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20810 , 'maint_organization_id :' || p_service_request_rec.maint_organization_id
20811 );
20812
20813 -- For Notes
20814 l_note_index := p_notes.FIRST;
20815 WHILE l_note_index IS NOT NULL LOOP
20816 FND_LOG.String
20817 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20818 , 'note :' ||p_notes(l_note_index).note
20819 );
20820 FND_LOG.String
20821 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20822 , 'note_detail :' ||p_notes(l_note_index).note_detail
20823 );
20824 FND_LOG.String
20825 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20826 , 'note_type :' ||p_notes(l_note_index).note_type
20827 );
20828 FND_LOG.String
20829 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20830 , 'note_context_type_01 :' ||p_notes(l_note_index).note_context_type_01
20831 );
20832 FND_LOG.String
20833 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20834 , 'note_context_type_id_01 :' ||p_notes(l_note_index).note_context_type_id_01
20835 );
20836 FND_LOG.String
20837 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20838 , 'note_context_type_02 :' ||p_notes(l_note_index).note_context_type_02
20839 );
20840 FND_LOG.String
20841 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20842 , 'note_context_type_id_02 :' ||p_notes(l_note_index).note_context_type_id_02
20843 );
20844 FND_LOG.String
20845 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20846 , 'note_context_type_03 :' ||p_notes(l_note_index).note_context_type_03
20847 );
20848 FND_LOG.String
20849 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20850 , 'note_context_type_id_03 :' ||p_notes(l_note_index).note_context_type_id_03
20851 );
20852
20853 l_note_index := p_notes.NEXT(l_note_index);
20854 END LOOP;
20855
20856 -- For Contacts
20857 l_contact_index := p_contacts.FIRST;
20858 WHILE l_contact_index IS NOT NULL LOOP
20859 FND_LOG.String
20860 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20861 , 'sr_contact_point_id :' || p_contacts(l_contact_index).sr_contact_point_id
20862 );
20863 FND_LOG.String
20864 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20865 , 'party_id :' || p_contacts(l_contact_index).party_id
20866 );
20867 FND_LOG.String
20868 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20869 , 'contact_point_id :' || p_contacts(l_contact_index).contact_point_id
20870 );
20871 FND_LOG.String
20872 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20873 , 'contact_point_type :' || p_contacts(l_contact_index).contact_point_type
20874 );
20875 FND_LOG.String
20876 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20877 , 'primary_flag :' || p_contacts(l_contact_index).primary_flag
20878 );
20879 FND_LOG.String
20880 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20881 , 'contact_type :' || p_contacts(l_contact_index).contact_type
20882 );
20883 FND_LOG.String
20884 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20885 , 'party_role_code :' || P_contacts(l_contact_index).party_role_code
20886 );
20887 FND_LOG.String
20888 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20889 , 'start_date_active :' || P_contacts(l_contact_index).start_date_active
20890 );
20891 FND_LOG.String
20892 ( FND_LOG.level_procedure , L_LOG_MODULE || ''
20893 , 'end_date_active :' || P_contacts(l_contact_index).end_date_active
20894 );
20895
20896 l_contact_index := p_contacts.NEXT(l_contact_index);
20897 END LOOP;
20898
20899 END IF ;
20900
20901 END Log_SR_PVT_Parameters;
20902
20903 END CS_ServiceRequest_PVT;