[Home] [Help]
PACKAGE BODY: APPS.MTL_ONLINE_TRANSACTION_PUB
Source
1 PACKAGE BODY mtl_online_transaction_pub AS
2 /* $Header: INVTXNB.pls 120.0 2005/05/25 05:37:17 appldev noship $ */
3
4
5 FUNCTION process_online(p_transaction_header_id IN NUMBER,
6 p_timeout in number default NULL,
7 p_error_code OUT NOCOPY VARCHAR2,
8 p_error_explanation OUT NOCOPY VARCHAR2
9 )
10 RETURN BOOLEAN
11 IS
12 p_success boolean := TRUE;
13 p_retval number;
14 l_transaction_header_id number;
15 l_return_status varchar(2);
16 l_msg_cnt number;
17 l_msg_data varchar2(241);
18 l_trans_count number;
19 l_mti_cnt number;
20 l_mmtt_cnt number;
21 l_dbgfile varchar2(240) := 'invtmonl.log';
22 l_dbgdir varchar2(240);
23
24 l_debug number := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
25 BEGIN
26
27 l_transaction_header_id := p_transaction_header_id;
28
29 /*
30 * Lock all the rows corresponding to this batch so that
31 * the Background manager does not pick it up
32 */
33 UPDATE MTL_TRANSACTIONS_INTERFACE
34 SET LOCK_FLAG = 1
35 WHERE PROCESS_FLAG = 1
36 AND TRANSACTION_HEADER_ID = l_transaction_header_id;
37 COMMIT;
38
39 -- call to process transactions online
40 /* p_success := inv_tm.launch
41 (
42 program => 'INXTCW',
43 args => to_char(l_transaction_header_id),
44 timeout => NVL(p_timeout,120),
45 rc_field => NULL); */
46
47 -- calling process_transactions() with p_commit = true as otherwise
48 -- error-codes stamped on MTI could get rolled back.
49 p_retval := INV_TXN_MANAGER_PUB.process_Transactions(p_api_version => 1,
50 p_init_msg_list => fnd_api.g_false ,
51 p_commit => fnd_api.g_true ,
52 p_validation_level => fnd_api.g_valid_level_full ,
53 x_return_status => l_return_status,
54 x_msg_count => l_msg_cnt,
55 x_msg_data => l_msg_data,
56 x_trans_count => l_trans_count,
57 p_table => 1,
58 p_header_id => l_transaction_header_id);
59
60 -- BUG 2709500 / 2718486 - added commit and changed p_commit above to false
61 COMMIT;
62
63 -- no need to unlock the records in the interface tables
64 -- as the underlying code has done just that.
65 -- no need to set the error_code and error_explaination
66 -- either as underlying code also has done that.
67 if(p_retval <> 0) THEN
68 p_success := false;
69 select error_code, error_explanation
70 into p_error_code, p_error_explanation
71 from mtl_transactions_interface
72 where transaction_header_id = l_transaction_header_id
73 and rownum = 1;
74
75 IF (l_debug = 1) THEN
76 inv_log_util.trace('Error from INV worker : error_code : '||
77 p_error_code||', err_expl :'||p_error_explanation,'INVTXNB',1);
78 END IF;
79
80 end if;
81
82 return p_success;
83
84 EXCEPTION
85 -- the underlying code should have provided enough error message
86 -- in the stack. we need not add any additional messages
87
88 WHEN NO_DATA_FOUND THEN
89 p_error_code := ' ';
90 p_error_explanation := 'No Errors';
91 RETURN TRUE;
92 WHEN TOO_MANY_ROWS THEN
93 -- dbms_output.put_line('Please specify the correct transaction header');
94 p_error_explanation:= fnd_message.get;
95 -- p_error_explanation:= 'Please specify the correct transaction header';
96 RETURN false;
97 WHEN OTHERS THEN
98 --commented for testing ROLLBACK;
99 RETURN FALSE;
100
101 END;
102
103 END;