[Home] [Help]
PACKAGE BODY: APPS.IES_TRANSACTIONS_PKG
Source
1 PACKAGE BODY ies_transactions_pkg AS
2 /* $Header: iestranb.pls 115.4 2003/06/17 23:06:40 prkotha noship $ */
3
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'ies_transactions_pkg';
5
6 /* private functions */
7
8 FUNCTION getTransactionStatus(p_transaction_id IN NUMBER) RETURN NUMBER IS
9 l_status NUMBER;
10 TYPE transaction_status_type IS REF CURSOR;
11 trx_status transaction_status_type ;
12 BEGIN
13 OPEN trx_status FOR '
14 SELECT status
15 FROM ies_transactions
16 WHERE transaction_id = :1' using p_transaction_id;
17 LOOP
18 FETCH trx_status INTO l_status;
19 EXIT WHEN trx_status%NOTFOUND;
20 END LOOP;
21 return l_status;
22 END;
23
24 /* end of private function */
25
26
27 PROCEDURE endSuspendedTransaction
28 (
29 p_api_version IN NUMBER,
30 p_transaction_id IN NUMBER,
31 x_return_status OUT NOCOPY VARCHAR2,
32 x_msg_count OUT NOCOPY NUMBER,
33 x_msg_data OUT NOCOPY VARCHAR2
34 ) IS
35 l_api_name CONSTANT VARCHAR2(30) := 'endSuspendedTransaction';
36 l_api_version CONSTANT NUMBER := 1.0;
37 l_status NUMBER;
38 BEGIN
39 -- Standard Start of API savepoint
40 SAVEPOINT end_suspended_trx_sp;
41
42 -- Standard call to check for call compatibility
43 IF NOT FND_API.Compatible_API_Call ( l_api_version,
44 p_api_version,
45 l_api_name,
46 G_PKG_NAME)
47 THEN
48 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
49 END IF;
50
51 FND_MSG_PUB.initialize;
52
53 -- Initialize the API return status to success
54 x_return_status := FND_API.G_RET_STS_SUCCESS;
55
56 BEGIN
57 -- API body
58 l_status := getTransactionStatus(p_transaction_id);
59 if (l_status = 1) then
60 EXECUTE IMMEDIATE 'UPDATE ies_transactions SET status = 0 '||
61 'WHERE transaction_id = :1' USING p_transaction_id;
62 else
63 FND_MESSAGE.SET_NAME('IES', 'IES_STATUS_UPDATE_ERROR');
64 FND_MSG_PUB.Add;
65
66 RAISE FND_API.G_EXC_ERROR;
67 end if;
68
69 EXCEPTION
70 WHEN OTHERS THEN
71 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR)
72 THEN
73 FND_MESSAGE.SET_NAME('IES', 'IES_END_SUSPENDED_TRX_ERROR');
74 FND_MSG_PUB.Add;
75 END IF;
76
77 RAISE FND_API.G_EXC_ERROR;
78 END;
79
80 -- Signify Success
81 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS)
82 THEN
83 FND_MESSAGE.SET_NAME('IES', 'IES_END_SUSPENDED_TRX_SUCCESS');
84 FND_MSG_PUB.Add;
85 END IF;
86
87 -- End of API body
88
89 COMMIT WORK;
90
91 -- Standard call to get message count and if count is 1, get message info
92 FND_MSG_PUB.Count_And_Get
93 (
94 p_count => x_msg_count,
95 p_data => x_msg_data
96 );
97
98 EXCEPTION
99 WHEN FND_API.G_EXC_ERROR THEN
100 ROLLBACK TO end_suspended_trx_sp;
101 x_return_status := FND_API.G_RET_STS_ERROR;
102
103 FND_MSG_PUB.Count_And_Get
104 (
105 p_count => x_msg_count,
106 p_data => x_msg_data
107 );
108
109 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
110 ROLLBACK TO end_suspended_trx_sp;
111 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
112
113 FND_MSG_PUB.Count_And_Get
114 (
115 p_count => x_msg_count,
116 p_data => x_msg_data
117 );
118
119 WHEN OTHERS THEN
120 ROLLBACK TO end_suspended_trx_sp;
121 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
122
123 IF FND_MSG_PUB.Check_Msg_Level
124 (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
125 THEN
126 FND_MSG_PUB.Add_Exc_Msg
127 ( p_pkg_name => G_PKG_NAME,
128 p_procedure_name => l_api_name,
129 p_error_text => 'G_MSG_LVL_UNEXP_ERROR'
130 );
131 END IF;
132 FND_MSG_PUB.Count_And_Get
133 (
134 p_count => x_msg_count,
135 p_data => x_msg_data
136 );
137
138 END endSuspendedTransaction;
139
140 END ies_transactions_pkg;