DBA Data[Home] [Help]

PACKAGE BODY: APPS.WSH_OTM_SYNC_REF_DATA_PKG

Source


1 PACKAGE BODY WSH_OTM_SYNC_REF_DATA_PKG AS
2 /* $Header: WSHTMTHB.pls 120.1.12020000.2 2013/03/12 12:54:27 sunilku ship $ */
3 
4 G_PKG_NAME CONSTANT VARCHAR2(50) := 'WSH_OTM_SYNC_REF_DATA_PKG';
5 
6 PROCEDURE is_ref_data_send_reqd(p_entity_id IN NUMBER,
7 				p_parent_entity_id IN VARCHAR2,
8 				p_entity_type IN VARCHAR2,
9 				p_entity_updated_date IN DATE,
10 				x_substitute_entity OUT NOCOPY VARCHAR2,
11 				p_transmission_id IN NUMBER,
12 				x_send_allowed OUT NOCOPY BOOLEAN,
13 				x_return_status OUT NOCOPY VARCHAR2
14 				) IS
15 
16 --Cursor to check whether the entity exists in WOSRD
17 CURSOR c_entity_exists(p_id NUMBER, p_type VARCHAR2, p_parent_id NUMBER) IS
18 SELECT	sync_ref_id,
19 	substitute_entity,
20 	last_sent_date
21 FROM	wsh_otm_sync_ref_data
22 WHERE	entity_id = p_id
23 AND	entity_type = p_type
24 AND	parent_entity_id = nvl(p_parent_id,0);
25 
26 /*
27 --Cursor to find whether the item was updated in MSI after it was sent to GLOG
28 CURSOR c_check_item_date(p_item_id NUMBER, p_entity_type VARCHAR2) IS
29 SELECT	msi.last_update_date,
30 	wosrd.sync_ref_id,
31 	wosrd.substitute_entity
32 FROM	mtl_system_items msi,
33 	wsh_otm_sync_ref_data wosrd
34 WHERE	msi.inventory_item_id = p_item_id
35 AND	wosrd.entity_type = p_entity_type
36 AND	wosrd.entity_id = msi.inventory_item_id
37 AND	msi.last_update_date > wosrd.last_sent_date;
38 
39 ----Cursor to find whether the location was updated in MSI after it was sent to GLOG
40 CURSOR c_check_location_date(p_location_id NUMBER, p_entity_type VARCHAR2) IS
41 SELECT	wl.last_update_date,
42 	wosrd.sync_ref_id,
43 	wosrd.substitute_entity
44 FROM	wsh_locations wl,
45 	wsh_otm_sync_ref_data wosrd
46 WHERE	wl.wsh_location_id = p_location_id
47 AND	wosrd.entity_type = p_entity_type
48 AND	wosrd.entity_id = wl.wsh_location_id
49 AND	wl.last_update_date > wosrd.last_sent_date;
50 */
51 l_check_entity_exists NUMBER := 0;
52 l_last_update_date DATE;
53 l_last_sent_date DATE;
54 l_substitute_entity VARCHAR2(50);
55 l_sync_ref_id NUMBER;
56 
57 l_num_errors      NUMBER := 0;
58 l_num_warnings    NUMBER := 0;
59 l_return_status VARCHAR2(1);
60 e_entity_type_error EXCEPTION;
61 
62 l_debug_on BOOLEAN ;
63 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'IS_REF_DATA_SEND_REQD';
64 
65 BEGIN
66 
67 -- Debug Statements
68 --
69 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
70 --
71 IF l_debug_on IS NULL THEN
72     l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
73 END IF;
74 
75 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
76 x_send_allowed := FALSE;
77 
78 IF l_debug_on THEN
79 	WSH_DEBUG_SV.push(l_module_name);
80 	WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_ID ',p_entity_id);
81 	WSH_DEBUG_SV.log(l_module_name,'P_PARENT_ENTITY_ID ',p_parent_entity_id);
82 	WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_TYPE ',p_entity_type);
83 	WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_UPDATED_DATE ',p_entity_updated_date);
84 	WSH_DEBUG_SV.log(l_module_name,'P_TRANSMISSION_ID ',p_transmission_id);
85 END IF;
86 
87 --Check whether the entity exists in wosrd
88 OPEN c_entity_exists(p_entity_id, p_entity_type, p_parent_entity_id);
89 LOOP
90 	FETCH c_entity_exists INTO l_sync_ref_id, l_substitute_entity, l_last_sent_date;
91 	EXIT WHEN c_entity_exists%NOTFOUND;
92 END LOOP;
93 CLOSE c_entity_exists;
94 
95 --Check for l_sync_ref_id.
96 --If its null that means the entity has never been sent to GLOG
97 --and we have to make and entry both in WOSRD and WOSRDL.
98 IF l_sync_ref_id is null THEN
99 	IF l_debug_on THEN
100 		WSH_DEBUG_SV.log(l_module_name,'l_sync_ref_id IS NULL');
101 	END IF;
102 
103 	IF l_debug_on THEN
104 		WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_OTM_SYNC_REF_DATA_PKG.INSERT_ROW_SYNC_REF_DATA',WSH_DEBUG_SV.C_PROC_LEVEL);
105 	END IF;
106 	insert_row_sync_ref_data(p_entity_id => p_entity_id ,
107 				p_parent_entity_id => p_parent_entity_id,
108 				p_entity_type => p_entity_type,
109 				p_transmission_id => p_transmission_id,
110                                 x_sync_ref_id     => l_sync_ref_id,
111 				x_substitute_entity => l_substitute_entity,
112 				x_return_status => l_return_status
113 				);
114 	IF l_debug_on THEN
115 		WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
116 	END IF;
117 	--
118 	wsh_util_core.api_post_call(
119 	p_return_status    => l_return_status,
120 	x_num_warnings     => l_num_warnings,
121 	x_num_errors       => l_num_errors);
122 
123 	IF l_debug_on THEN
124 		WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_OTM_SYNC_REF_DATA_PKG.INSERT_ROW_SYNC_REF_DATA_LOG',WSH_DEBUG_SV.C_PROC_LEVEL);
125 	END IF;
126 	insert_row_sync_ref_data_log	(p_sync_ref_id => l_sync_ref_id,
127 					p_transmission_id => p_transmission_id,
128                                         p_entity_type => p_entity_type,
129 					x_return_status => l_return_status
130 					);
131 	IF l_debug_on THEN
132 		WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
133 	END IF;
134 	--
135 	wsh_util_core.api_post_call(
136 	p_return_status    => l_return_status,
137 	x_num_warnings     => l_num_warnings,
138 	x_num_errors       => l_num_errors);
139 
140 	x_send_allowed := true;
141 ELSE --means that entry in WOSRD is already there and just have to check the dates.
142 	IF l_debug_on THEN
143 		WSH_DEBUG_SV.log(l_module_name,'l_sync_ref_id ', l_sync_ref_id);
144                 WSH_DEBUG_SV.log(l_module_name,'p_entity_updated_date ', p_entity_updated_date);
145   	        WSH_DEBUG_SV.log(l_module_name,'l_last_sent_date  ', l_last_sent_date);
146 	END IF;
147 
148 	IF p_entity_updated_date >= l_last_sent_date THEN
149          -- OR to_number(sysdate - l_last_sent_date) <= 1 THEN -- Bugfix 14526032
150 
151 		IF l_debug_on THEN
152 			WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_OTM_SYNC_REF_DATA_PKG.INSERT_ROW_SYNC_REF_DATA_LOG',WSH_DEBUG_SV.C_PROC_LEVEL);
153 		END IF;
154 
155 		insert_row_sync_ref_data_log	(p_sync_ref_id => l_sync_ref_id,
156 						p_transmission_id => p_transmission_id,
157                                                 p_entity_type => p_entity_type,
158 						x_return_status => l_return_status
159 						);
160 		IF l_debug_on THEN
161 			WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_UTIL_CORE.API_POST_CALL',WSH_DEBUG_SV.C_PROC_LEVEL);
162 		END IF;
163 		--
164 		wsh_util_core.api_post_call(
165 		p_return_status    => l_return_status,
166 		x_num_warnings     => l_num_warnings,
167 		x_num_errors       => l_num_errors);
168 
169 		x_send_allowed := TRUE;
170 	END IF;
171 END IF;
172 
173 x_substitute_entity := l_substitute_entity;
174 
175 IF (l_num_warnings > 0 AND x_return_status = WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN
176 	x_return_status := WSH_UTIL_CORE.G_RET_STS_WARNING;
177 ELSE
178 	x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
179 END IF;
180 
181 IF l_debug_on THEN
182 	WSH_DEBUG_SV.pop(l_module_name);
183 END IF;
184 
185 EXCEPTION
186 WHEN e_entity_type_error THEN
190 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:WRONG_ENTITY_TYPE');
187 	x_return_status := WSH_UTIL_CORE.G_RET_STS_ERROR ;
188 	IF l_debug_on THEN
189 		WSH_DEBUG_SV.logmsg(l_module_name,'wrong entity type passed',WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
191 		raise;
192 	END IF;
193 WHEN OTHERS THEN
194 	x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
195 	IF l_debug_on THEN
196 		WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
197 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
198 		raise;
199 	END IF;
200 
201 END is_ref_data_send_reqd;
202 
203 PROCEDURE update_ref_data(	p_transmission_id IN NUMBER,
204 				p_transmission_status IN VARCHAR2,
205 				x_return_status OUT NOCOPY VARCHAR2
206 				) IS
207 
208 --Cursor to get sync_ref_id's for given transmission_id
209 CURSOR c_get_sync_ref_id(p_trans_id NUMBER) IS
210 SELECT	distinct entity_type, sync_ref_id
211 FROM	wsh_otm_sync_ref_data_log
212 WHERE	transmission_id = p_trans_id
213 ORDER BY entity_type, sync_ref_id;
214 
215 
216 --Cursor to lock the record in wsh_otm_sync_ref_data
217 CURSOR c_lock_parent_table(p_sync_ref_id NUMBER) IS
218 SELECT	1
219 FROM	wsh_otm_sync_ref_data
220 WHERE	sync_ref_id = p_sync_ref_id
221 FOR UPDATE NOWAIT;
222 
223 --Cursor to obtain the first sent_date
224 CURSOR c_get_sent_date(p_sync_id NUMBER) IS
225 SELECT	sent_date
226 FROM	wsh_otm_sync_ref_data_log
227 WHERE	sync_ref_id = p_sync_id
228 AND	rownum = 1;
229 
230 
231 l_recinfo c_lock_parent_table%ROWTYPE;
232 l_sync_ref_id NUMBER;
233 l_entity_type VARCHAR2(100);
234 l_sent_date DATE;
235 
236 l_dummy_fetch VARCHAR2(10);
237 
238 l_debug_on BOOLEAN ;
239 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'UPDATE_REF_DATA';
240 
241 BEGIN
242 
243 -- Debug Statements
244 --
245 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
246 --
247 IF l_debug_on IS NULL THEN
248     l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
249 END IF;
250 
251 IF l_debug_on THEN
252 	WSH_DEBUG_SV.push(l_module_name);
253 	WSH_DEBUG_SV.log(l_module_name,'P_TRANSMISSION_ID ',p_transmission_id);
254 	WSH_DEBUG_SV.log(l_module_name,'P_TRANSMISSION_STATUS ',p_transmission_status);
255 END IF;
256 
257 IF p_transmission_status = 'S' THEN
258 	--Get the sync ref ids for the transmission id
259 	OPEN c_get_sync_ref_id(p_transmission_id);
260 	LOOP
261 		FETCH c_get_sync_ref_id INTO l_entity_type, l_sync_ref_id;
262 		EXIT WHEN c_get_sync_ref_id%NOTFOUND;
263 
264 		DECLARE
265 		l_notfound BOOLEAN;
266 		BEGIN
267 			OPEN c_lock_parent_table(l_sync_ref_id);
268 			FETCH c_lock_parent_table INTO l_dummy_fetch;
269 
270 			IF c_lock_parent_table%NOTFOUND THEN
271 				-- probably taken care of by another request go to next record
272 				GOTO next_sync_ref_id;
273 			END IF;
274 
275 			CLOSE c_lock_parent_table;
276 
277                         IF l_debug_on THEN
278 	                  WSH_DEBUG_SV.log(l_module_name,'Obtained the lock for l_sync_ref_id ', l_sync_ref_id);
279                         END IF;
280 
281 			--Obtain the first sent_date for the l_sync_ref_id
282 			OPEN c_get_sent_date(l_sync_ref_id);
283 			FETCH c_get_sent_date into l_sent_date;
284 			CLOSE c_get_sent_date;
285 
286                         IF l_debug_on THEN
287 	                  WSH_DEBUG_SV.log(l_module_name,'sent_date', l_sent_date);
288                         END IF;
289 
290 			--Update last_sent_date of WOSRD with sent_date of WOSRDL.sent_date
291 			UPDATE	wsh_otm_sync_ref_data
292 			SET	last_sent_date = l_sent_date
293 			WHERE	sync_ref_id = l_sync_ref_id;
294 
295                         IF l_debug_on THEN
296 	                  WSH_DEBUG_SV.log(l_module_name,'Updated ', SQL%ROWCOUNT);
297                         END IF;
298 
299 			--Delete data from WOSRDL for l_sync_ref_id
300 			DELETE
301 			FROM	wsh_otm_sync_ref_data_log
302 			WHERE	sync_ref_id = l_sync_ref_id;
303 
304 		EXCEPTION
305 		WHEN OTHERS THEN
306 		NULL;
307 		END;
308 
309 		<<next_sync_ref_id>>
310 		NULL;
311 
312 	END LOOP;
313 	CLOSE c_get_sync_ref_id;
314 ELSE
315 	--Since this is an error case delete all the data from WOSRDL for given transmission_id
316 	IF l_debug_on THEN
317 	  WSH_DEBUG_SV.log(l_module_name,'Error case. So deleting all the data from WOSRDL for transmission_id ', p_transmission_id);
318 	END IF;
319 
320 	DELETE
321 	FROM	wsh_otm_sync_ref_data_log
322 	WHERE	transmission_id = p_transmission_id;
323 END IF;
324 
325 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
326 
327 IF l_debug_on THEN
328 	WSH_DEBUG_SV.pop(l_module_name);
329 END IF;
330 
331 EXCEPTION
332 WHEN OTHERS THEN
333 	x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
334 	IF l_debug_on THEN
335 		WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
336 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
337 		raise;
338 	END IF;
339 
340 END update_ref_data;
341 
342 PROCEDURE insert_row_sync_ref_data(	p_entity_id IN NUMBER,
343 					p_parent_entity_id IN NUMBER,
344 					p_entity_type IN VARCHAR2,
345 					p_transmission_id IN NUMBER,
346                                         x_sync_ref_id     OUT NOCOPY NUMBER,
347 					x_substitute_entity OUT NOCOPY VARCHAR2,
348 					x_return_status OUT NOCOPY VARCHAR2
349 				  ) IS
350 
351 PRAGMA AUTONOMOUS_TRANSACTION; --since its an autonomous transaction
352 
353 CURSOR c_entity_exists(p_id NUMBER, p_type VARCHAR2) IS
354 SELECT	entity_id, parent_entity_id
355 FROM	wsh_otm_sync_ref_data
356 WHERE	entity_id = p_id
357 AND	entity_type = p_type
358 AND	substitute_entity IS NULL;
359 
360 l_sync_ref_id NUMBER;
361 l_substitute_entity VARCHAR2(50);
362 l_entity_id NUMBER;
363 l_parent_entity_id NUMBER;
364 l_check_entity_exists NUMBER := 0;
365 l_entity_type VARCHAR2(50);
366 
367 l_debug_on BOOLEAN ;
368 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'INSERT_ROW_SYNC_REF_DATA';
369 
370 BEGIN
371 
372 -- Debug Statements
373 --
374 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
375 --
376 IF l_debug_on IS NULL THEN
377     l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
378 END IF;
379 
380 IF l_debug_on THEN
381 	WSH_DEBUG_SV.push(l_module_name);
382 	WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_ID ',p_entity_id);
383 	WSH_DEBUG_SV.log(l_module_name,'P_PARENT_ENTITY_ID ',p_parent_entity_id);
384 	WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_TYPE ',p_entity_type);
385 	WSH_DEBUG_SV.log(l_module_name,'P_TRANSMISSION_ID ',p_transmission_id);
386 END IF;
387 
388 --Check whether the input entity id and type exists or not
389 OPEN c_entity_exists(p_entity_id, p_entity_type);
390 LOOP
391 	FETCH c_entity_exists INTO l_entity_id, l_parent_entity_id;
392 	EXIT WHEN c_entity_exists%NOTFOUND;
393 END LOOP;
394 CLOSE c_entity_exists;
395 
396 IF l_debug_on THEN
397 	WSH_DEBUG_SV.logmsg(l_module_name,'After opening cursor c_entity_exists');
398 	WSH_DEBUG_SV.log(l_module_name,'l_entity_id ', l_entity_id);
399 	WSH_DEBUG_SV.log(l_module_name,'l_parent_entity_id ', l_parent_entity_id);
400 END IF;
401 
402 --Bug#11695906
403 --get the value for substitute_entity. Also check the value of p_parent_entity_id here.
404 IF l_entity_id is not null and p_entity_type <> 'CUST_LOC' THEN
405 	--Get the value into l_entity_type
406 	--IF p_entity_type = 'CUST_LOC' THEN
407 	--	l_entity_type := 'CUS';
408 	IF p_entity_type = 'ORG_LOC' THEN
409 		l_entity_type := 'ORG';
410 	ELSIF p_entity_type = 'CAR_LOC' THEN
411 		l_entity_type := 'CAR';
412 	END IF;
413 
414 	IF l_parent_entity_id IS NULL OR l_parent_entity_id = 0 THEN
415 		l_substitute_entity := l_entity_type || '-' || '000' || '-' || p_entity_id ;
416 	ELSE
417 		l_substitute_entity := l_entity_type || '-' || l_parent_entity_id || '-' || p_entity_id ;
418 	END IF;
419 END IF;
420 
421 --Insert data into the table
422 BEGIN
423 	INSERT INTO wsh_otm_sync_ref_data	(sync_ref_id,
424 						entity_id,
425 						parent_entity_id,
426 						entity_type,
427 						substitute_entity,
428 						last_sent_date,
429 						called_by_module,
430 						additional_num,
431 						additional_char,
432 						additional_date,
433 						creation_date,
434 						created_by,
435 						last_update_date,
436 						last_updated_by,
437 						last_update_login
438 						)
439 					VALUES	(wsh_otm_sync_ref_data_s.NEXTVAL,
440 						p_entity_id,
441 						nvl(p_parent_entity_id,0),
442 						p_entity_type,
443 						l_substitute_entity,
444 						to_date('1900/01/01 00:00:01', 'YYYY/MM/DD HH24:MI:SS'),
445 						'WSH-TXN',
446 						NULL,
447 						NULL,
448 						NULL,
449 						SYSDATE, --creation_date
450 						FND_GLOBAL.USER_ID,
451 						SYSDATE, --last_update_date
452 						FND_GLOBAL.USER_ID,
453 						FND_GLOBAL.USER_ID
454 						) returning sync_ref_id into x_sync_ref_id;
455 EXCEPTION
456 WHEN OTHERS THEN
457 
458 	IF l_debug_on THEN
459 		WSH_DEBUG_SV.logmsg(l_module_name,'Exception while inserting data into WOSRD ' || SQLERRM);
460 	END IF;
461 
462 	SELECT	substitute_entity
463 	INTO	l_substitute_entity
464 	FROM	wsh_otm_sync_ref_data
465 	WHERE	entity_id = p_entity_id
466 	AND	parent_entity_id = nvl(p_parent_entity_id,0)
467 	AND	entity_type = p_entity_type;
468 END;
469 
470 x_substitute_entity := l_substitute_entity;
471 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
472 
473 IF l_debug_on THEN
474 	WSH_DEBUG_SV.pop(l_module_name);
475 END IF;
476 COMMIT;
477 
478 EXCEPTION
479 WHEN OTHERS THEN
480 	x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
481 	IF l_debug_on THEN
482 		WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
483 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
484 		raise;
485 	END IF;
486 	ROLLBACK;
487 END insert_row_sync_ref_data;
488 
489 PROCEDURE insert_row_sync_ref_data_log(	p_sync_ref_id NUMBER,
490 					p_transmission_id NUMBER,
491                                         p_entity_type VARCHAR2,
492 					x_return_status OUT NOCOPY VARCHAR2
493 					) IS
494 
495 l_debug_on BOOLEAN ;
496 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'INSERT_ROW_SYNC_REF_DATA_LOG';
497 
498 BEGIN
499 
500 -- Debug Statements
501 --
502 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
503 --
504 IF l_debug_on IS NULL THEN
505     l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
506 END IF;
507 
508 IF l_debug_on THEN
509 	WSH_DEBUG_SV.push(l_module_name);
510 	WSH_DEBUG_SV.log(l_module_name,'P_SYNC_REF_ID ',p_sync_ref_id);
511 	WSH_DEBUG_SV.log(l_module_name,'P_TRANSMISSION_ID ',p_transmission_id);
512 	WSH_DEBUG_SV.log(l_module_name,'P_ENTITY_TYPE ',P_ENTITY_TYPE);
513 END IF;
514 
515 --Inset data into the table
516 INSERT INTO wsh_otm_sync_ref_data_log	(transmission_id,
517 					sync_ref_id,
518                                         entity_type,
519 					sent_date,
520 					creation_date,
521 					created_by,
522 					last_update_date,
523 					last_updated_by,
524 					last_update_login
525 					)
526 VALUES					(p_transmission_id,
527 					 p_sync_ref_id,
528                                          p_entity_type,
529 					 SYSDATE, --sent_date
530 					 SYSDATE, --creation_date
531 					 FND_GLOBAL.USER_ID,
532 					 SYSDATE, --last_update_date
533 					 FND_GLOBAL.USER_ID,
534 					 FND_GLOBAL.USER_ID
535 					);
536 
537 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
538 
539 IF l_debug_on THEN
540 	WSH_DEBUG_SV.pop(l_module_name);
541 END IF;
542 
543 EXCEPTION
544 WHEN OTHERS THEN
545 	x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR;
546 	IF l_debug_on THEN
547 		WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
548 		WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
549 		raise;
550 	END IF;
551 
552 END insert_row_sync_ref_data_log;
553 
554 END WSH_OTM_SYNC_REF_DATA_PKG;