[Home] [Help]
PACKAGE BODY: APPS.AMS_CONTACT_POINT_PVT
Source
1 PACKAGE BODY AMS_CONTACT_POINT_PVT as
2 /* $Header: amsvcptb.pls 115.4 2002/11/22 08:55:17 jieli ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 -- AMS_CONTACT_POINT_PVT
7 -- Purpose
8 --
9 -- History
10 --
11 --
12 -- NOTE
13 --
14 -- End of Comments
15 -- ===============================================================
16
17
18 G_PKG_NAME CONSTANT VARCHAR2(30):= 'AMS_CONTACT_POINT_PVT';
19 G_FILE_NAME CONSTANT VARCHAR2(12) := 'amsvcptb.pls';
20
21 /*
22 G_USER_ID NUMBER := FND_GLOBAL.USER_ID;
23 G_LOGIN_ID NUMBER := FND_GLOBAL.CONC_LOGIN_ID;
24 */
25
26 -- Hint: Primary key needs to be returned.
27 AMS_DEBUG_HIGH_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH);
28 AMS_DEBUG_LOW_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW);
29 AMS_DEBUG_MEDIUM_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_MEDIUM);
30
31 PROCEDURE create_contact_POINT(
32 p_api_version_number IN NUMBER,
33 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
34 p_commit IN VARCHAR2 := FND_API.G_FALSE,
35 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
36
37 x_return_status OUT NOCOPY VARCHAR2,
38 x_msg_count OUT NOCOPY NUMBER,
39 x_msg_data OUT NOCOPY VARCHAR2,
40
41 p_ams_contact_point_rec IN contact_POINT_rec_type ,
42 p_ams_edi_rec IN edi_rec_type := g_miss_edi_rec,
43 p_ams_email_rec IN email_rec_type := g_miss_email_rec,
44 p_ams_phone_rec IN phone_rec_type := g_miss_phone_rec,
45 p_ams_telex_rec IN telex_rec_type := g_miss_telex_rec,
46 p_ams_web_rec IN web_rec_type := g_miss_web_rec,
47
48 x_contact_POINT_id OUT NOCOPY NUMBER
49 )
50
51 IS
52 L_API_NAME CONSTANT VARCHAR2(30) := 'create_contact_POINT';
53 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
54 l_object_version_number NUMBER := 1;
55 l_contact_POINT_id NUMBER;
56 l_return_status VARCHAR2(1);
57 l_msg_count NUMBER;
58 l_msg_data VARCHAR2(2000);
59
60
61
62 l_hz_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
63 l_hz_edi_rec HZ_CONTACT_POINT_V2PUB.edi_rec_type;
64 l_hz_email_rec HZ_CONTACT_POINT_V2PUB.email_rec_type;
65 l_hz_phone_rec HZ_CONTACT_POINT_V2PUB.phone_rec_type;
66 l_hz_telex_rec HZ_CONTACT_POINT_V2PUB.telex_rec_type;
67 l_hz_web_rec HZ_CONTACT_POINT_V2PUB.web_rec_type;
68
69 BEGIN
70 -- Standard Start of API savepoint
71 SAVEPOINT Create_Contact_POINT_PVT;
72
73
74 -- Standard call to check for call compatibility.
75
76 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
77 p_api_version_number,
78 l_api_name,
79 G_PKG_NAME)
80 THEN
81 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
82 END IF;
83
84
85 -- Initialize message list if p_init_msg_list is set to TRUE.
86 IF FND_API.to_Boolean( p_init_msg_list )
87 THEN
88 FND_MSG_PUB.initialize;
89 END IF;
90
91 -- Debug Message
92 IF (AMS_DEBUG_HIGH_ON) THEN
93
94 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
95 END IF;
96
97
98 -- Initialize API return status to SUCCESS
99 x_return_status := FND_API.G_RET_STS_SUCCESS;
100
101
102 -- =========================================================================
103 -- Validate Environment
104 -- =========================================================================
105
106 IF FND_GLOBAL.User_Id IS NULL
107 THEN
108 AMS_Utility_PVT.Error_Message(p_message_name => 'USER_PROFILE_MISSING');
109 RAISE FND_API.G_EXC_ERROR;
110 END IF;
111
112 -- Debug Message
113 IF (AMS_DEBUG_HIGH_ON) THEN
114
115 AMS_UTILITY_PVT.debug_message( 'Private API: Calling HZ create table PUB');
116 END IF;
117
118
119 l_hz_contact_point_rec.contact_POINT_id := p_ams_contact_point_rec.contact_POINT_id;
120 l_hz_contact_point_rec.contact_point_type := p_ams_contact_point_rec.contact_point_type;
121 l_hz_contact_point_rec.owner_table_name := p_ams_contact_point_rec.owner_table_name;
122 l_hz_contact_point_rec.owner_table_id := p_ams_contact_point_rec.owner_table_id;
123 l_hz_contact_point_rec.primary_flag := p_ams_contact_point_rec.primary_flag;
124 l_hz_contact_point_rec.orig_system_reference := p_ams_contact_point_rec.orig_system_reference;
125 l_hz_contact_point_rec.content_source_type := p_ams_contact_point_rec.content_source_type;
126 l_hz_contact_point_rec.attribute_category := p_ams_contact_point_rec.attribute_category;
127 l_hz_contact_point_rec.contact_point_purpose := p_ams_contact_point_rec.contact_point_purpose;
128 l_hz_contact_point_rec.primary_by_purpose := p_ams_contact_point_rec.primary_by_purpose;
129 --l_hz_contact_point_rec.actual_content_source := p_ams_contact_point_rec.actual_content_source;
130
131
132 -- Do not include the following columns. It will make update failed without any error message
133 /*
134 l_hz_contact_point_rec.status := p_ams_contact_point_rec.status;
135 l_hz_contact_point_rec.created_by_module := p_ams_contact_point_rec.created_by_module;
136 l_hz_contact_point_rec.application_id := p_ams_contact_point_rec.application_id;
137 */
138
139 l_hz_edi_rec.edi_transaction_handling := p_ams_edi_rec.edi_transaction_handling;
140 l_hz_edi_rec.edi_id_number := p_ams_edi_rec.edi_id_number;
141 l_hz_edi_rec.edi_payment_method := p_ams_edi_rec.edi_payment_method;
142 l_hz_edi_rec.edi_payment_format := p_ams_edi_rec.edi_payment_format;
143 l_hz_edi_rec.edi_remittance_method := p_ams_edi_rec.edi_remittance_method;
144 l_hz_edi_rec.edi_remittance_instruction := p_ams_edi_rec.edi_remittance_instruction;
145 l_hz_edi_rec.edi_tp_header_id := p_ams_edi_rec.edi_tp_header_id;
146 l_hz_edi_rec.edi_ece_tp_location_code := p_ams_edi_rec.edi_ece_tp_location_code;
147
148 l_hz_email_rec.email_format := p_ams_email_rec.email_format;
149 l_hz_email_rec.email_address := p_ams_email_rec.email_address;
150
151 l_hz_phone_rec.phone_calling_calendar := p_ams_phone_rec.phone_calling_calendar;
152 l_hz_phone_rec.last_contact_dt_time := p_ams_phone_rec.last_contact_dt_time;
153 l_hz_phone_rec.timezone_id := p_ams_phone_rec.timezone_id;
154 l_hz_phone_rec.phone_area_code := p_ams_phone_rec.phone_area_code;
155 l_hz_phone_rec.phone_country_code := p_ams_phone_rec.phone_country_code;
156 l_hz_phone_rec.phone_number := p_ams_phone_rec.phone_number;
157 l_hz_phone_rec.phone_extension := p_ams_phone_rec.phone_extension;
158 l_hz_phone_rec.phone_line_type := p_ams_phone_rec.phone_line_type;
159 l_hz_phone_rec.raw_phone_number := p_ams_phone_rec.raw_phone_number;
160
161 l_hz_telex_rec.telex_number := p_ams_telex_rec.telex_number;
162
163 l_hz_web_rec.web_type := p_ams_web_rec.web_type;
164 l_hz_web_rec.url := p_ams_web_rec.url;
165
166
167 HZ_CONTACT_POINT_V2PUB.create_contact_POINT
168 (
169 p_init_msg_list => p_init_msg_list,
170 p_contact_POINT_rec => l_hz_contact_point_rec ,
171 p_edi_rec => l_hz_edi_rec,
172 p_email_rec => l_hz_email_rec,
173 p_phone_rec => l_hz_phone_rec,
174 p_telex_rec => l_hz_telex_rec,
175 p_web_rec => l_hz_web_rec,
176
177 x_contact_POINT_id => l_contact_POINT_id,
178 x_return_status => l_return_status,
179 x_msg_count => l_msg_count,
180 x_msg_data => l_msg_data
181 );
182
183
184 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
185 x_msg_count := l_msg_count;
186 x_msg_data := l_msg_data;
187 RAISE FND_API.G_EXC_ERROR;
188 END IF;
189 x_contact_POINT_id:=l_contact_POINT_id;
190
191 -- Standard check for p_commit
192 IF FND_API.to_Boolean( p_commit )
193 THEN
194 COMMIT WORK;
195 END IF;
196
197
198 -- Debug Message
199 IF (AMS_DEBUG_HIGH_ON) THEN
200
201 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
202 END IF;
203
204 -- Standard call to get message count and if count is 1, get message info.
205 FND_MSG_PUB.Count_And_Get
206 (p_count => x_msg_count,
207 p_data => x_msg_data
208 );
209 EXCEPTION
210
211 WHEN AMS_Utility_PVT.resource_locked THEN
212 x_return_status := FND_API.g_ret_sts_error;
213 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
214
215 WHEN FND_API.G_EXC_ERROR THEN
216 ROLLBACK TO Create_Contact_POINT_PVT;
217 x_return_status := FND_API.G_RET_STS_ERROR;
218 -- Standard call to get message count and if count=1, get the message
219 FND_MSG_PUB.Count_And_Get (
220 p_encoded => FND_API.G_FALSE,
221 p_count => x_msg_count,
222 p_data => x_msg_data
223 );
224
225 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
226 ROLLBACK TO Create_Contact_POINT_PVT;
227 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
228 -- Standard call to get message count and if count=1, get the message
229 FND_MSG_PUB.Count_And_Get (
230 p_encoded => FND_API.G_FALSE,
231 p_count => x_msg_count,
232 p_data => x_msg_data
233 );
234
235 WHEN OTHERS THEN
236 ROLLBACK TO Create_Contact_POINT_PVT;
237 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
238 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
239 THEN
240 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
241 END IF;
242 -- Standard call to get message count and if count=1, get the message
243 FND_MSG_PUB.Count_And_Get (
244 p_encoded => FND_API.G_FALSE,
245 p_count => x_msg_count,
246 p_data => x_msg_data
247 );
248 End create_contact_POINT;
249
250
251
252
253 PROCEDURE update_contact_POINT(
254 p_api_version_number IN NUMBER,
255 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
256 p_commit IN VARCHAR2 := FND_API.G_FALSE,
257 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
258
259 x_return_status OUT NOCOPY VARCHAR2,
260 x_msg_count OUT NOCOPY NUMBER,
261 x_msg_data OUT NOCOPY VARCHAR2,
262
263 p_ams_contact_point_rec IN contact_POINT_rec_type ,
264 p_ams_edi_rec IN edi_rec_type := g_miss_edi_rec,
265 p_ams_email_rec IN email_rec_type := g_miss_email_rec,
266 p_ams_phone_rec IN phone_rec_type := g_miss_phone_rec,
267 p_ams_telex_rec IN telex_rec_type := g_miss_telex_rec,
268 p_ams_web_rec IN web_rec_type := g_miss_web_rec,
269
270 px_object_version_number IN OUT NOCOPY NUMBER
271 )
272
273 IS
274 L_API_NAME CONSTANT VARCHAR2(30) := 'update_contact_POINT';
275 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
279 l_return_status VARCHAR2(1);
276 l_object_version_number NUMBER;
277 l_contact_POINT_id NUMBER;
278 l_commit VARCHAR2(1) := FND_API.g_true;
280 l_msg_count NUMBER;
281 l_msg_data VARCHAR2(2000);
282
283 l_hz_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
284 l_hz_edi_rec HZ_CONTACT_POINT_V2PUB.edi_rec_type;
285 l_hz_email_rec HZ_CONTACT_POINT_V2PUB.email_rec_type;
286 l_hz_phone_rec HZ_CONTACT_POINT_V2PUB.phone_rec_type;
287 l_hz_telex_rec HZ_CONTACT_POINT_V2PUB.telex_rec_type;
288 l_hz_web_rec HZ_CONTACT_POINT_V2PUB.web_rec_type;
289
290
291
292 BEGIN
293 -- Standard Start of API savepoint
294 SAVEPOINT UPDATE_CONTACT_POINT_PVT;
295
296 -- Standard call to check for call compatibility.
297 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
298 p_api_version_number,
299 l_api_name,
300 G_PKG_NAME)
301 THEN
302 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
303 END IF;
304
305 -- Initialize message list if p_init_msg_list is set to TRUE.
306 IF FND_API.to_Boolean( p_init_msg_list )
307 THEN
308 FND_MSG_PUB.initialize;
309 END IF;
310
311 -- Debug Message
312 IF (AMS_DEBUG_HIGH_ON) THEN
313
314 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
315 END IF;
316
317
318 -- Initialize API return status to SUCCESS
319 x_return_status := FND_API.G_RET_STS_SUCCESS;
320
321 -- Debug Message
322 IF (AMS_DEBUG_HIGH_ON) THEN
323
324 AMS_UTILITY_PVT.debug_message('Private API: Calling HZ update table PUB');
325 END IF;
326
327
328 l_hz_contact_point_rec.contact_POINT_id := p_ams_contact_point_rec.contact_POINT_id;
329 l_hz_contact_point_rec.primary_flag := p_ams_contact_point_rec.primary_flag;
330 -- Do not include the following columns. It will make update failed without any error message
331
332 /*
333 l_hz_contact_point_rec.contact_point_type := p_ams_contact_point_rec.contact_point_type;
334 l_hz_contact_point_rec.owner_table_name := p_ams_contact_point_rec.owner_table_name;
335 l_hz_contact_point_rec.owner_table_id := p_ams_contact_point_rec.owner_table_id;
336 l_hz_contact_point_rec.orig_system_reference := p_ams_contact_point_rec.orig_system_reference;
337 l_hz_contact_point_rec.content_source_type := p_ams_contact_point_rec.content_source_type;
338 l_hz_contact_point_rec.attribute_category := p_ams_contact_point_rec.attribute_category;
339 l_hz_contact_point_rec.contact_point_purpose := p_ams_contact_point_rec.contact_point_purpose;
340 l_hz_contact_point_rec.primary_by_purpose := p_ams_contact_point_rec.primary_by_purpose;
341 */
342 -- l_hz_contact_point_rec.actual_content_source := p_ams_contact_point_rec.actual_content_source;
343
344
345 /*
346 l_hz_contact_point_rec.status := p_ams_contact_point_rec.status;
347 l_hz_contact_point_rec.created_by_module := p_ams_contact_point_rec.created_by_module;
348 l_hz_contact_point_rec.application_id := p_ams_contact_point_rec.application_id;
349 */
350 /*
351 l_hz_edi_rec.edi_transaction_handling := p_ams_edi_rec.edi_transaction_handling;
352 l_hz_edi_rec.edi_id_number := p_ams_edi_rec.edi_id_number;
353 l_hz_edi_rec.edi_payment_method := p_ams_edi_rec.edi_payment_method;
354 l_hz_edi_rec.edi_payment_format := p_ams_edi_rec.edi_payment_format;
355 l_hz_edi_rec.edi_remittance_method := p_ams_edi_rec.edi_remittance_method;
356 l_hz_edi_rec.edi_remittance_instruction := p_ams_edi_rec.edi_remittance_instruction;
357 l_hz_edi_rec.edi_tp_header_id := p_ams_edi_rec.edi_tp_header_id;
358 l_hz_edi_rec.edi_ece_tp_location_code := p_ams_edi_rec.edi_ece_tp_location_code;
359
360 l_hz_email_rec.email_format := p_ams_email_rec.email_format;
361 l_hz_email_rec.email_address := p_ams_email_rec.email_address;
362
363 l_hz_phone_rec.phone_calling_calendar := p_ams_phone_rec.phone_calling_calendar;
364 l_hz_phone_rec.last_contact_dt_time := p_ams_phone_rec.last_contact_dt_time;
365 l_hz_phone_rec.timezone_id := p_ams_phone_rec.timezone_id;
366 l_hz_phone_rec.phone_area_code := p_ams_phone_rec.phone_area_code;
367 l_hz_phone_rec.phone_country_code := p_ams_phone_rec.phone_country_code;
368 l_hz_phone_rec.phone_number := p_ams_phone_rec.phone_number;
369 l_hz_phone_rec.phone_extension := p_ams_phone_rec.phone_extension;
370 l_hz_phone_rec.phone_line_type := p_ams_phone_rec.phone_line_type;
371 l_hz_phone_rec.raw_phone_number := p_ams_phone_rec.raw_phone_number;
372
373 l_hz_telex_rec.telex_number := p_ams_telex_rec.telex_number;
374
375 l_hz_web_rec.web_type := p_ams_web_rec.web_type;
376 l_hz_web_rec.url := p_ams_web_rec.url;
377 */
378
379 HZ_CONTACT_POINT_V2PUB.update_contact_POINT
380 (
381 p_init_msg_list => p_init_msg_list,
382 p_contact_POINT_rec => l_hz_contact_point_rec,
383 p_edi_rec => l_hz_edi_rec,
384 p_email_rec => l_hz_email_rec,
385 p_phone_rec => l_hz_phone_rec,
386 p_telex_rec => l_hz_telex_rec,
387 p_web_rec => l_hz_web_rec,
388
389 p_object_version_number => px_object_version_number,
390 x_return_status => l_return_status,
391 x_msg_count => l_msg_count,
392 x_msg_data => l_msg_data
393 );
394
395
396 -- Standard check for p_commit
397 IF FND_API.to_Boolean( p_commit )
398 THEN
399 COMMIT WORK;
400 END IF;
404 IF (AMS_DEBUG_HIGH_ON) THEN
401
402
403 -- Debug Message
405
406 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
407 END IF;
408
409 -- Standard call to get message count and if count is 1, get message info.
410 FND_MSG_PUB.Count_And_Get
411 (p_count => x_msg_count,
412 p_data => x_msg_data
413 );
414 EXCEPTION
415
416 WHEN AMS_Utility_PVT.resource_locked THEN
417 x_return_status := FND_API.g_ret_sts_error;
418 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
419
420 WHEN FND_API.G_EXC_ERROR THEN
421 ROLLBACK TO UPDATE_CONTACT_POINT_PVT;
422 x_return_status := FND_API.G_RET_STS_ERROR;
423 -- Standard call to get message count and if count=1, get the message
424 FND_MSG_PUB.Count_And_Get (
425 p_encoded => FND_API.G_FALSE,
426 p_count => x_msg_count,
427 p_data => x_msg_data
428 );
429
430 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
431 ROLLBACK TO UPDATE_CONTACT_POINT_PVT;
432 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
433 -- Standard call to get message count and if count=1, get the message
434 FND_MSG_PUB.Count_And_Get (
435 p_encoded => FND_API.G_FALSE,
436 p_count => x_msg_count,
437 p_data => x_msg_data
438 );
439
440 WHEN OTHERS THEN
441 ROLLBACK TO UPDATE_CONTACT_POINT_PVT;
442 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
443 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
444 THEN
445 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
446 END IF;
447 -- Standard call to get message count and if count=1, get the message
448 FND_MSG_PUB.Count_And_Get (
449 p_encoded => FND_API.G_FALSE,
450 p_count => x_msg_count,
451 p_data => x_msg_data
452 );
453 End update_contact_POINT;
454
455
456
457 END AMS_CONTACT_POINT_PVT;