48: -- Standard Start of API savepoint
49: SAVEPOINT Calculate_InventoryValue_PUB;
50:
51: -- Check for call compatibility
52: IF NOT FND_API.Compatible_API_Call
53: ( p_current_version_number => l_api_version,
54: p_caller_version_number => p_api_version,
55: p_api_name => l_api_name,
56: p_pkg_name => G_PKG_NAME
55: p_api_name => l_api_name,
56: p_pkg_name => G_PKG_NAME
57: )
58: THEN
59: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
60: END IF;
61:
62: -- Initialize API message list if necessary
63: IF FND_API.To_Boolean(p_init_msg_list)
59: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
60: END IF;
61:
62: -- Initialize API message list if necessary
63: IF FND_API.To_Boolean(p_init_msg_list)
64: THEN
65: FND_MSG_PUB.Initialize;
66: END IF;
67:
69: l_msg_level_threshold := FND_PROFILE.Value('FND_AS_MSG_LEVEL_THRESHOLD');
70: x_msg_count := l_msg_level_threshold;
71:
72: -- Check for the value of p_commit
73: IF NOT FND_API.To_Boolean(p_commit)
74: THEN
75: FND_MSG_PUB.Add_Exc_Msg(
76: p_pkg_name => G_PKG_NAME,
77: p_procedure_name => l_api_name,
76: p_pkg_name => G_PKG_NAME,
77: p_procedure_name => l_api_name,
78: p_error_text => 'This API should not be called with p_commit set to false'
79: );
80: RAISE FND_API.G_EXC_ERROR;
81: END IF;
82:
83: IF l_msg_level_threshold <= FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH
84: THEN
136: p_one_time_item => p_one_time_item,
137: x_return_status => x_return_status
138: );
139:
140: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
141: THEN
142: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
143: END IF;
144:
138: );
139:
140: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
141: THEN
142: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
143: END IF;
144:
145: -- Find the cost groups that match the specifications
146: l_stmt_num := 20;
152: p_own => p_own,
153: x_return_status => x_return_status
154: );
155:
156: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
157: THEN
158: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
159: END IF;
160:
154: );
155:
156: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
157: THEN
158: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
159: END IF;
160:
161: -- Find the subinventories that match the specifications
162: l_stmt_num := 30;
168: p_expense_sub => p_expense_sub,
169: x_return_status => x_return_status
170: );
171:
172: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
173: THEN
174: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
175: END IF;
176:
170: );
171:
172: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
173: THEN
174: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
175: END IF;
176:
177:
178: -- Calculate the onhand quantity of matching items in the cost groups and subinventories
188: p_unvalued_txns => p_unvalued_txns,
189: x_return_status => x_return_status
190: );
191:
192: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
193: THEN
194: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
195: END IF;
196: END IF;
190: );
191:
192: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
193: THEN
194: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
195: END IF;
196: END IF;
197:
198: -- Calculate the intransit quantity of matching items in the cost groups
210: p_unvalued_txns => p_unvalued_txns,
211: x_return_status => x_return_status
212: );
213:
214: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
215: THEN
216: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
217: END IF;
218: END IF;
212: );
213:
214: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
215: THEN
216: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
217: END IF;
218: END IF;
219:
220: -- Calculate the receiving quantity of matching items
229: p_include_period_end => p_include_period_end,
230: x_return_status => x_return_status
231: );
232:
233: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
234: THEN
235: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
236: END IF;
237: END IF;
231: );
232:
233: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
234: THEN
235: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
236: END IF;
237: END IF;
238:
239:
245: p_organization_id => p_organization_id,
246: x_return_status => x_return_status
247: );
248:
249: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
250: THEN
251: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
252: END IF;
253:
247: );
248:
249: IF x_return_status <> FND_API.G_RET_STS_SUCCESS
250: THEN
251: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
252: END IF;
253:
254:
255: l_stmt_num := 80;
262: );
263: END IF;
264:
265: EXCEPTION
266: WHEN FND_API.G_EXC_ERROR THEN
267: ROLLBACK TO Calculate_InventoryValue_PUB;
268: x_return_status := FND_API.G_RET_STS_ERROR;
269: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
270: ROLLBACK TO Calculate_InventoryValue_PUB;
264:
265: EXCEPTION
266: WHEN FND_API.G_EXC_ERROR THEN
267: ROLLBACK TO Calculate_InventoryValue_PUB;
268: x_return_status := FND_API.G_RET_STS_ERROR;
269: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
270: ROLLBACK TO Calculate_InventoryValue_PUB;
271: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
272: WHEN OTHERS THEN
265: EXCEPTION
266: WHEN FND_API.G_EXC_ERROR THEN
267: ROLLBACK TO Calculate_InventoryValue_PUB;
268: x_return_status := FND_API.G_RET_STS_ERROR;
269: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
270: ROLLBACK TO Calculate_InventoryValue_PUB;
271: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
272: WHEN OTHERS THEN
273: ROLLBACK TO Calculate_InventoryValue_PUB;
267: ROLLBACK TO Calculate_InventoryValue_PUB;
268: x_return_status := FND_API.G_RET_STS_ERROR;
269: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
270: ROLLBACK TO Calculate_InventoryValue_PUB;
271: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
272: WHEN OTHERS THEN
273: ROLLBACK TO Calculate_InventoryValue_PUB;
274: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
275: IF l_msg_level_threshold <= FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR
270: ROLLBACK TO Calculate_InventoryValue_PUB;
271: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
272: WHEN OTHERS THEN
273: ROLLBACK TO Calculate_InventoryValue_PUB;
274: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
275: IF l_msg_level_threshold <= FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR
276: THEN
277: FND_MSG_PUB.Add_Exc_Msg(
278: p_pkg_name => G_PKG_NAME,