85: begin
86: if P_meter_id is null or p_actv_assoc_id is null
87: then
88: FND_MESSAGE.SET_NAME('EAM','EAM_IAA_ID_MISSING');
89: fnd_msg_pub.add;
90: RAISE fnd_api.g_exc_error;
91: end if;
92:
93: open c_val_meter_id(p_meter_id);
94: fetch c_val_meter_id into l_dummy;
95: IF c_val_meter_id%NOTFOUND
96: THEN
97: FND_MESSAGE.SET_NAME('EAM','EAM_IAA_INV_METER_ID');
98: fnd_msg_pub.add;
99: RAISE fnd_api.g_exc_error;
100: END IF;
101: CLOSE c_val_meter_id;
102:
104: fetch c_val_act_assoc_id into l_dummy;
105: IF c_val_act_assoc_id%NOTFOUND
106: THEN
107: FND_MESSAGE.SET_NAME('EAM','EAM_IAA_INV_ACTIVITY_ASSOC_ID');
108: fnd_msg_pub.add;
109: RAISE fnd_api.g_exc_error;
110: END IF;
111: CLOSE c_val_act_assoc_id;
112:
114: fetch c_meter_act_assoc into l_dummy;
115: IF c_meter_act_assoc %NOTFOUND
116: THEN
117: FND_MESSAGE.SET_NAME('EAM','EAM_IAA_INV_METER_ID');
118: fnd_msg_pub.add;
119: RAISE fnd_api.g_exc_error;
120: END IF;
121: CLOSE c_meter_act_assoc;
122:
165: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
166: END IF;
167: -- Initialize message list if p_init_msg_list is set to TRUE.
168: IF FND_API.to_Boolean( p_init_msg_list ) THEN
169: FND_MSG_PUB.initialize;
170: END IF;
171: -- Initialize API return status to success
172: x_return_status := FND_API.G_RET_STS_SUCCESS;
173:
182: IF (p_pm_last_service_tbl(i).last_service_reading is null /*or
183: p_pm_last_service_tbl(i).prev_service_reading is null*/ ) THEN
184:
185: FND_MESSAGE.SET_NAME('EAM','EAM_NULL_METER_READING');
186: fnd_msg_pub.add;
187: RAISE fnd_api.g_exc_error;
188:
189: END IF;
190:
248: IF FND_API.To_Boolean( p_commit ) THEN
249: COMMIT WORK;
250: END IF;
251: -- Standard call to get message count and if count is 1, get message info.
252: FND_MSG_PUB.Count_And_Get
253: ( p_count => x_msg_count ,
254: p_data => x_msg_data
255: );
256: EXCEPTION
256: EXCEPTION
257: WHEN FND_API.G_EXC_ERROR THEN
258: ROLLBACK TO process_pm_last_service;
259: x_return_status := FND_API.G_RET_STS_ERROR ;
260: FND_MSG_PUB.Count_And_Get
261: ( p_count => x_msg_count ,
262: p_data => x_msg_data ,
263: P_ENCODED => FND_API.G_FALSE
264: );
265: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
266: ROLLBACK TO process_pm_last_service;
267: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
268:
269: FND_MSG_PUB.Count_And_Get
270: ( p_count => x_msg_count ,
271: p_data => x_msg_data ,
272: P_ENCODED => FND_API.G_FALSE
273: );
273: );
274: WHEN OTHERS THEN
275: ROLLBACK TO process_pm_last_service;
276: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
277: IF FND_MSG_PUB.Check_Msg_Level
278: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
279: THEN
280: FND_MSG_PUB.Add_Exc_Msg
281: ( G_PKG_NAME ,
274: WHEN OTHERS THEN
275: ROLLBACK TO process_pm_last_service;
276: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
277: IF FND_MSG_PUB.Check_Msg_Level
278: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
279: THEN
280: FND_MSG_PUB.Add_Exc_Msg
281: ( G_PKG_NAME ,
282: l_api_name
276: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
277: IF FND_MSG_PUB.Check_Msg_Level
278: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
279: THEN
280: FND_MSG_PUB.Add_Exc_Msg
281: ( G_PKG_NAME ,
282: l_api_name
283: );
284: END IF;
281: ( G_PKG_NAME ,
282: l_api_name
283: );
284: END IF;
285: FND_MSG_PUB.Count_And_Get
286: ( p_count => x_msg_count ,
287: p_data => x_msg_data ,
288: P_ENCODED => FND_API.G_FALSE
289: );