[Home] [Help]
PACKAGE BODY: APPS.INV_TRANSACTIONS_HISTORY_PKG
Source
1 PACKAGE BODY inv_transactions_history_pkg as
2 /* $Header: INVTXHSB.pls 120.0.12010000.5 2010/04/09 21:00:41 kdong noship $ */
3
4 g_debug NUMBER := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
5
6 --
7 G_PKG_NAME CONSTANT VARCHAR2(50) := 'INV_TRANSACTIONS_HISTORY_PKG';
8 --
9
10 PROCEDURE Create_Update_Txns_History(
11 p_txns_history_rec IN OUT NOCOPY Txns_History_Record_Type,
12 P_xml_document_id IN NUMBER,
13 x_txns_id OUT NOCOPY NUMBER,
14 x_return_status OUT NOCOPY VARCHAR2
15 ) IS
16
17 -- local variables
18 l_txns_id NUMBER;
19 l_exist_check NUMBER := 0;
20
21 l_transaction_id NUMBER;
22 x_transaction_id NUMBER;
23 l_transaction_status VARCHAR2(2);
24 l_trans_status VARCHAR2(5);
25 l_msg_data VARCHAR2(3000);
26 l_xml_document_id NUMBER;
27 l_return_status VARCHAR2(2);
28 l_dummy NUMBER := 0;
29
30 --exceptions
31 invalid_status exception;
32 invalid_action exception;
33 invalid_entity_type exception;
34 invalid_direction exception;
35 invalid_document_type exception;
36
37 --cursors
38 CURSOR txn_cur IS
39 SELECT transaction_id, transaction_status
40 FROM MTL_TXNS_HISTORY
41 WHERE document_type = p_txns_history_rec.document_type AND
42 document_number = p_txns_history_rec.document_number AND
43 document_direction = p_txns_history_rec.document_direction AND
44 action_type = p_txns_history_rec.action_type AND
45 entity_number = p_txns_history_rec.entity_number AND
46 entity_type = p_txns_history_rec.entity_type AND
47 trading_partner_id = p_txns_history_rec.trading_partner_id AND
48 transaction_status = 'IP'
49 FOR UPDATE NOWAIT;
50 --k proj bmso
51
52 l_status_code VARCHAR2(5);
53 l_number_of_warnings NUMBER := 0;
54 l_number_of_errors NUMBER := 0;
55
56 BEGIN
57
58 if (g_debug = 1) then
59 inv_trx_util_pub.TRACE('Entering Create_Update_Txns_History', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
60 inv_trx_util_pub.TRACE('Entity Type is '||p_txns_history_Rec.entity_type, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
61 inv_trx_util_pub.TRACE('Entity number is '||p_txns_history_Rec.entity_number, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
62 inv_trx_util_pub.TRACE('Transaction status is '||p_txns_history_Rec.transaction_status, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
63 end if;
64
65 x_return_status := rcv_error_pkg.g_ret_sts_success;
66 l_xml_document_id := P_xml_document_id;
67
68 -- First check for null values
69 IF (
70 p_txns_history_rec.document_type IS NOT NULL AND
71 p_txns_history_rec.document_number IS NOT NULL AND
72 p_txns_history_rec.document_direction IS NOT NULL AND
73 p_txns_history_rec.transaction_status IS NOT NULL AND
74 p_txns_history_rec.entity_type IS NOT NULL AND
75 p_txns_history_rec.entity_number IS NOT NULL AND
76 p_txns_history_rec.action_type IS NOT NULL AND
77 p_txns_history_rec.trading_partner_id IS NOT NULL
78 ) THEN
79
80
81 IF(p_txns_history_rec.document_type NOT IN('ADJ','ONHAND')) THEN
82 raise invalid_document_type;
83 END IF;
84
85 IF(p_txns_history_rec.document_direction NOT IN('I', 'O')) THEN
86 raise invalid_direction;
87 END IF;
88
89 IF(p_txns_history_rec.entity_type NOT IN('INVADJ','INVMOQD')) THEN
90 raise invalid_entity_type;
91 END IF;
92
93 IF(p_txns_history_rec.action_type NOT IN('A', 'D', 'C')) THEN
94 raise invalid_action;
95 END IF;
96
97 IF(p_txns_history_rec.transaction_status NOT IN('ST', 'IP', 'ER', 'SC', 'AP')) THEN
98 raise invalid_status;
99 END IF;
100
101 -- Check if a record already exists
102
103 if (g_debug = 1) then
104 inv_trx_util_pub.TRACE('Opening txn_cur', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
105 end if;
106
107 OPEN txn_cur;
108
109 if (g_debug = 1) then
110 inv_trx_util_pub.TRACE('Fetching txn_cur', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
111 end if;
112
113 FETCH txn_cur INTO l_transaction_id,l_transaction_status;
114
115 IF (txn_cur%NOTFOUND) THEN
116
117 l_trans_status := p_txns_history_rec.transaction_status;
118
119 -- Record does not exist. So create a new record
120
121 -- Before Insert Check for validity of data
122 -- Need to validate document_direction, entity_type, action_type
123 -- ctd.. transaction_status, document_type
124
125
126 SELECT MTL_TXNS_HISTORY_S.nextval
127 INTO x_transaction_id
128 FROM dual;
129
130 if (g_debug = 1) then
131 inv_trx_util_pub.TRACE('Transaction ID is '|| x_transaction_id, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
132 inv_trx_util_pub.TRACE('Inserting into MTL_TXNS_HISTORY', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
133 end if;
134
135 INSERT INTO MTL_TXNS_HISTORY(
136 TRANSACTION_ID,
137 DOCUMENT_TYPE,
138 DOCUMENT_NUMBER,
139 DOCUMENT_DIRECTION,
140 TRANSACTION_STATUS,
141 ACTION_TYPE,
142 ENTITY_NUMBER,
143 ENTITY_TYPE,
144 TRADING_PARTNER_ID,
145 ECX_MESSAGE_ID,
146 EVENT_NAME,
147 EVENT_KEY,
148 ITEM_TYPE,
149 INTERNAL_CONTROL_NUMBER,
150 CREATION_DATE,
151 CREATED_BY,
152 LAST_UPDATE_DATE,
153 LAST_UPDATED_BY,
154 LAST_UPDATE_LOGIN,
155 DOCUMENT_REVISION,
156 PROGRAM_APPLICATION_ID,
157 PROGRAM_ID,
158 PROGRAM_UPDATE_DATE,
159 REQUEST_ID,
160 ATTRIBUTE_CATEGORY,
161 ATTRIBUTE1,
162 ATTRIBUTE2,
163 ATTRIBUTE3,
164 ATTRIBUTE4,
165 ATTRIBUTE5,
166 ATTRIBUTE6,
167 ATTRIBUTE7,
168 ATTRIBUTE8,
169 ATTRIBUTE9,
170 ATTRIBUTE10,
171 ATTRIBUTE11,
172 ATTRIBUTE12,
173 ATTRIBUTE13,
174 ATTRIBUTE14,
175 ATTRIBUTE15)
176 VALUES( x_transaction_id,
177 p_txns_history_rec.document_type,
178 p_txns_history_rec.document_number,
179 p_txns_history_rec.document_direction,
180 -- k proj bmso p_txns_history_rec.transaction_status,
181 l_trans_status,
182 p_txns_history_rec.action_type,
183 p_txns_history_rec.entity_number,
184 p_txns_history_rec.entity_type,
185 p_txns_history_rec.trading_partner_id,
186 p_txns_history_rec.ECX_MESSAGE_ID,
187 p_txns_history_rec.EVENT_NAME,
188 p_txns_history_rec.EVENT_KEY,
189 p_txns_history_rec.ITEM_TYPE,
190 p_txns_history_rec.INTERNAL_CONTROL_NUMBER,
191 SYSDATE,
192 FND_GLOBAL.USER_ID,
193 SYSDATE,
194 FND_GLOBAL.USER_ID,
195 FND_GLOBAL.USER_ID,
196 p_txns_history_rec.DOCUMENT_REVISION,
197 fnd_global.prog_appl_id,
198 fnd_global.conc_program_id,
199 SYSDATE,
200 fnd_global.conc_request_id,
201 p_txns_history_rec.ATTRIBUTE_CATEGORY,
202 p_txns_history_rec.ATTRIBUTE1,
203 p_txns_history_rec.ATTRIBUTE2,
204 p_txns_history_rec.ATTRIBUTE3,
205 p_txns_history_rec.ATTRIBUTE4,
206 p_txns_history_rec.ATTRIBUTE5,
207 p_txns_history_rec.ATTRIBUTE6,
208 p_txns_history_rec.ATTRIBUTE7,
209 p_txns_history_rec.ATTRIBUTE8,
210 p_txns_history_rec.ATTRIBUTE9,
211 p_txns_history_rec.ATTRIBUTE10,
212 p_txns_history_rec.ATTRIBUTE11,
213 p_txns_history_rec.ATTRIBUTE12,
214 p_txns_history_rec.ATTRIBUTE13,
215 p_txns_history_rec.ATTRIBUTE14,
216 p_txns_history_rec.ATTRIBUTE15);
217
218
219 x_txns_id := x_transaction_id;
220
221 if (g_debug = 1) then
222 inv_trx_util_pub.TRACE('Record inserted into MTL_TXNS_HISTORY', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
223 inv_trx_util_pub.TRACE('x_transaction_id is '||x_transaction_id, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
224 end if;
225
226 ELSE
227
228 if (g_debug = 1) then
229 inv_trx_util_pub.TRACE('transaction_id is ' || l_transaction_id, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
230 inv_trx_util_pub.TRACE('l_transaction_status is ' || l_transaction_status, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
231 inv_trx_util_pub.TRACE('p_txns_history_rec.transaction_status is ' || p_txns_history_rec.transaction_status, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
232 inv_trx_util_pub.TRACE('Record already exists. So need to update in MTL_TXNS_HISTORY', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
233 end if;
234
235 -- Record already exists. So Need to Update
236 -- Before Update Check for validity of status
237
238 IF(l_transaction_status in ('IP', 'AP') AND p_txns_history_rec.transaction_status NOT IN('ER', 'ST','IP')) THEN
239 raise invalid_status;
240
241 ELSIF(l_transaction_status = 'ER' AND p_txns_history_rec.transaction_status NOT IN('IP','ER')) THEN
242 raise invalid_status;
243
244 END IF; -- if l_transaction_status checks
245
246 if (g_debug = 1) then
247 inv_trx_util_pub.TRACE('Updating MTL_XML_TXNS_HISTORY', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
248 end if;
249
250 UPDATE MTL_TXNS_HISTORY
251 SET entity_number = p_txns_history_rec.entity_number,
252 entity_type = p_txns_history_rec.entity_type,
253 transaction_status = p_txns_history_rec.transaction_status,
254 ecx_message_id = p_txns_history_rec.ecx_message_id,
255 event_name = p_txns_history_rec.event_name,
256 event_key = p_txns_history_rec.event_key,
257 internal_control_number = p_txns_history_rec.internal_control_number,
258 item_type = p_txns_history_rec.item_type,
259 last_update_date = SYSDATE,
260 last_updated_by = fnd_global.user_id,
261 program_application_id = fnd_global.prog_appl_id,
262 program_id = fnd_global.conc_program_id,
263 program_update_date = SYSDATE,
264 request_id = fnd_global.conc_request_id,
265 attribute_category = p_txns_history_rec.ATTRIBUTE_CATEGORY,
266 attribute1 = p_txns_history_rec.ATTRIBUTE1,
267 attribute2 = p_txns_history_rec.ATTRIBUTE2,
268 attribute3 = p_txns_history_rec.ATTRIBUTE3,
269 attribute4 = p_txns_history_rec.ATTRIBUTE4,
270 attribute5 = p_txns_history_rec.ATTRIBUTE5,
271 attribute6 = p_txns_history_rec.ATTRIBUTE6,
272 attribute7 = p_txns_history_rec.ATTRIBUTE7,
273 attribute8 = p_txns_history_rec.ATTRIBUTE8,
274 attribute9 = p_txns_history_rec.ATTRIBUTE9,
275 attribute10 = p_txns_history_rec.ATTRIBUTE10,
276 attribute11 = p_txns_history_rec.ATTRIBUTE11,
277 attribute12 = p_txns_history_rec.ATTRIBUTE12,
278 attribute13 = p_txns_history_rec.ATTRIBUTE13,
279 attribute14 = p_txns_history_rec.ATTRIBUTE14,
280 attribute15 = p_txns_history_rec.ATTRIBUTE15
281 WHERE transaction_id = l_transaction_id;
282
283 if (g_debug = 1) then
284 inv_trx_util_pub.TRACE('MTL_TXNS_HISTORY record updated', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
285 end if;
286
287 if p_txns_history_rec.document_type ='ADJ' then --added for onhand
288 select count(*)
289 into l_dummy
290 from mtl_adjustment_sync_temp
291 where entity_id = p_txns_history_rec.entity_number;
292
293 if (g_debug = 1) then
294 inv_trx_util_pub.TRACE('temp table count: '||l_dummy, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
295 end if;
296
297 UPDATE mtl_material_transactions
298 SET transaction_extracted = 'Y',
299 xml_document_id = p_txns_history_rec.entity_number
300 WHERE NVL(transaction_extracted, 'N') = 'P'
301 AND xml_document_id is null
302 AND transaction_id IN (select transaction_number
303 from mtl_adjustment_sync_temp
304 where entity_id = p_txns_history_rec.entity_number);
305
306 if (g_debug = 1) then
307 inv_trx_util_pub.TRACE('No of rows in MMT updated: '||SQL%ROWCOUNT, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
308 end if;
309
310 if (g_debug = 1) then
311 inv_trx_util_pub.TRACE('MMT updated, now delete the temp table', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
312 end if;
313
314 INV_INVENTORY_ADJUSTMENT.delete_temp_table(p_txns_history_rec.entity_number);
315
316 end if; --added for onhand
317 END IF; -- if txn_cur%notfound
318
319 IF(txn_cur%ISOPEN) THEN
320 CLOSE txn_cur;
321
322 if (g_debug = 1) then
323 inv_trx_util_pub.TRACE('Closing txn_cur', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
324 end if;
325
326 END IF;
327 ELSE
328
329 -- Not Null checks failed. Return Error
330 x_return_status := rcv_error_pkg.g_ret_sts_error;
331
332 END IF; -- if p_txns_history_rec columns are not null
333
334 if (g_debug = 1) then
335 inv_trx_util_pub.TRACE('Exiting Create_Update_Txns_History', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
336 end if;
337
338 EXCEPTION
339 WHEN invalid_status THEN
340 x_return_status := rcv_error_pkg.g_ret_sts_error;
341 if (g_debug = 1) then
342 inv_trx_util_pub.TRACE('invalid_status exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
343 end if;
344 WHEN invalid_action THEN
345 x_return_status := rcv_error_pkg.g_ret_sts_error;
346 if (g_debug = 1) then
347 inv_trx_util_pub.TRACE('invalid_action exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
348 end if;
349 WHEN invalid_entity_type THEN
350 x_return_status := rcv_error_pkg.g_ret_sts_error;
351 if (g_debug = 1) then
352 inv_trx_util_pub.TRACE('invalid_entity_type exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
353 end if;
354 WHEN invalid_direction THEN
355 x_return_status := rcv_error_pkg.g_ret_sts_error;
356 if (g_debug = 1) then
357 inv_trx_util_pub.TRACE('invalid_direction exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
358 end if;
359 WHEN invalid_document_type THEN
360 x_return_status := rcv_error_pkg.g_ret_sts_error;
361 if (g_debug = 1) then
362 inv_trx_util_pub.TRACE('invalid_document_type exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
363 end if;
364 WHEN Others THEN
365 x_return_status := rcv_error_pkg.g_ret_sts_error;
366 if (g_debug = 1) then
367 inv_trx_util_pub.TRACE('Unexpected error has occured. Oracle error message is '|| SQLERRM, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
368 end if;
369
370 END Create_Update_Txns_History;
371
372
373 PROCEDURE Get_Txns_History(
374 p_item_type IN VARCHAR2,
375 p_event_key IN VARCHAR2,
376 p_direction IN VARCHAR2,
377 p_document_type IN VARCHAR2,
378 p_txns_history_rec OUT NOCOPY Txns_History_Record_Type,
379 x_return_status OUT NOCOPY VARCHAR2
380 ) IS
381
382 CURSOR txns_history_cur IS
383 SELECT wth.transaction_id,
384 wth.document_type,
385 wth.document_direction,
386 wth.document_number,
387 wth.entity_number,
388 wth.entity_type,
389 wth.trading_partner_id,
390 wth.action_type,
391 wth.transaction_status,
392 wth.ecx_message_id,
393 wth.event_name,
394 wth.event_key ,
395 wth.item_type,
396 wth.internal_control_number,
397 wth.document_revision,
398 wth.attribute_category,
399 wth.attribute1,
400 wth.attribute2,
401 wth.attribute3,
402 wth.attribute4,
403 wth.attribute5,
404 wth.attribute6,
405 wth.attribute7,
406 wth.attribute8,
407 wth.attribute9,
408 wth.attribute10,
409 wth.attribute11,
410 wth.attribute12,
411 wth.attribute13,
412 wth.attribute14,
413 wth.attribute15,
414 ''
415 FROM MTL_TXNS_HISTORY wth
416 WHERE wth.item_type = p_item_type
417 and wth.event_key = p_event_key
418 and wth.document_direction = p_direction
419 and wth.document_type = p_document_type
420 and rownum = 1;
421
422 --exceptions
423 no_record_found exception;
424
425
426 BEGIN
427
428 if (g_debug = 1) then
429 inv_trx_util_pub.TRACE('Entering Get_Txns_History', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
430 end if;
431
432 x_return_status := rcv_error_pkg.g_ret_sts_success;
433
434 OPEN txns_history_cur;
435 FETCH txns_history_cur INTO p_txns_history_rec;
436
437 IF(txns_history_cur%NOTFOUND) THEN
438 raise no_record_found;
439 END IF;
440
441 CLOSE txns_history_cur;
442
443 if (g_debug = 1) then
444 inv_trx_util_pub.TRACE('Exiting Get_Txns_History', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
445 end if;
446
447 EXCEPTION
448 WHEN no_record_found THEN
449
450 IF(txns_history_cur%ISOPEN) THEN
451 CLOSE txns_history_cur;
452 END IF;
453
454 x_return_status := rcv_error_pkg.g_ret_sts_error;
455 if (g_debug = 1) then
456 inv_trx_util_pub.TRACE('no_record_found exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
457 end if;
458
459 WHEN Others THEN
460 x_return_status := rcv_error_pkg.g_ret_sts_unexp_error;
461 if (g_debug = 1) then
462 inv_trx_util_pub.TRACE('Unexpected error has occured. Oracle error message is '|| SQLERRM, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
463 end if;
464 END Get_Txns_History;
465
466 /* should be deleted, if not needed.
467 -----------------------------------------------------------------------------
468 PROCEDURE : Create_Txns_History
469 PARAMETERS :
470 DESCRIPTION : This procedure is written for use by the inbound mapping.
471 Since XML gateway does not support calls to procedures with record types as
472 parameters, we need this wrapper. This takes in the individual columns,
473 creates a txns-history record and calls the create_update_txns_history
474 procedure with that record
475 -----------------------------------------------------------------------------
476
477 PROCEDURE Create_Txns_History(
478 p_transaction_id IN NUMBER,
479 p_document_type IN VARCHAR2,
480 p_document_direction IN VARCHAR2,
481 p_document_number IN VARCHAR2,
482 p_orig_document_number IN VARCHAR2,
483 p_entity_number IN VARCHAR2,
484 p_entity_type IN VARCHAR2,
485 p_trading_partner_id IN NUMBER,
486 p_action_type IN VARCHAR2,
487 p_transaction_status IN VARCHAR2,
488 p_ecx_message_id IN VARCHAR2,
489 p_event_name IN VARCHAR2,
490 p_event_key IN VARCHAR2,
491 p_item_type IN VARCHAR2,
492 p_internal_control_number IN VARCHAR2,
493 p_document_revision IN NUMBER DEFAULT NULL,
494 x_return_status OUT NOCOPY VARCHAR2) IS
495
496 l_txn_hist_rec Txns_History_Record_Type;
497 l_return_status VARCHAR2(30);
498 l_txn_id NUMBER;
499
500 create_update_failed exception;
501
502 BEGIN
503
504 if (g_debug = 1) then
505 inv_trx_util_pub.TRACE('Entering Create_Txns_History', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
506 inv_trx_util_pub.TRACE('Transaction ID is '||p_transaction_id, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
507 inv_trx_util_pub.TRACE('document Type is '||p_document_type, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
508 inv_trx_util_pub.TRACE('Doc Direction is '||p_document_direction, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
509 inv_trx_util_pub.TRACE('Doc number is '||p_document_number, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
510 inv_trx_util_pub.TRACE('Orig doc num is '||p_orig_document_number, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
511 inv_trx_util_pub.TRACE('Entity Type is '||p_entity_type, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
512 inv_trx_util_pub.TRACE('Entity number is '||p_entity_number, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
513 inv_trx_util_pub.TRACE('Trading Partner id is '||p_trading_partner_id, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
514 inv_trx_util_pub.TRACE('Action type is '||p_action_type, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
515 inv_trx_util_pub.TRACE('Transaction status is '||p_transaction_status, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
516 inv_trx_util_pub.TRACE('ECX Message ID is '||p_ecx_message_id, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
517 inv_trx_util_pub.TRACE('Event Name is '||p_event_name, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
518 inv_trx_util_pub.TRACE('Event Key is '||p_event_key, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
519 inv_trx_util_pub.TRACE('Item Type is '||p_item_type, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
520 inv_trx_util_pub.TRACE('In. control num is '||p_internal_control_number, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
521 inv_trx_util_pub.TRACE('Document Revision is '||p_document_revision, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
522 end if;
523
524 x_return_status := rcv_error_pkg.g_ret_sts_success;
525
526 l_txn_hist_rec.transaction_id := p_transaction_id;
527 l_txn_hist_rec.document_type := p_document_type;
528 l_txn_hist_rec.document_direction := p_document_direction;
529 l_txn_hist_rec.document_number := p_document_number;
530 l_txn_hist_rec.orig_document_number := p_orig_document_number;
531 l_txn_hist_rec.entity_number := p_entity_number;
532 l_txn_hist_rec.entity_type := p_entity_type;
533 l_txn_hist_rec.trading_partner_id := p_trading_partner_id;
534 l_txn_hist_rec.action_type := p_action_type;
535 l_txn_hist_rec.transaction_status := p_transaction_status;
536 l_txn_hist_rec.ecx_message_id := p_ecx_message_id;
537 l_txn_hist_rec.event_name := p_event_name;
538 l_txn_hist_rec.event_key := p_event_key;
539 l_txn_hist_rec.item_type := p_item_type;
540 l_txn_hist_rec.internal_control_number := p_internal_control_number;
541
542 l_txn_hist_rec.document_revision := p_document_revision;
543
544 Create_Update_Txns_History(
545 p_txns_history_rec => l_txn_hist_rec,
546 x_txns_id => l_txn_id,
547 x_return_status => l_return_status);
548
549 if (g_debug = 1) then
550 inv_trx_util_pub.TRACE('l_return_status is '||l_return_status, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
551 end if;
552
553 IF(l_return_status <> rcv_error_pkg.g_ret_sts_success) THEN
554 raise create_update_failed;
555 END IF;
556
557 EXCEPTION
558 WHEN create_update_failed THEN
559 x_return_status := rcv_error_pkg.g_ret_sts_error;
560 if (g_debug = 1) then
561 inv_trx_util_pub.TRACE('create_update_failed exception has occured.', 'INV_TRANSACTIONS_HISTORY_PKG', 9);
562 end if;
563 WHEN Others THEN
564 x_return_status := rcv_error_pkg.g_ret_sts_unexp_error;
565 if (g_debug = 1) then
566 inv_trx_util_pub.TRACE('Unexpected error has occured. Oracle error message is '|| SQLERRM, 'INV_TRANSACTIONS_HISTORY_PKG', 9);
567 end if;
568 END Create_Txns_History;
569
570 */
571
572 END INV_TRANSACTIONS_HISTORY_PKG;