[Home] [Help]
PACKAGE BODY: APPS.AK_ATTRIBUTE_PVT
Source
1 package body AK_Attribute_pvt as
2 /* $Header: akdvatrb.pls 120.5 2006/11/30 23:21:34 tshort ship $ */
3
4 --=======================================================
5 -- Function VALIDATE_ATTRIBUTE
6 --
7 -- Usage Private API for validating an attribute. This
8 -- API should only be called by other APIs that are
9 -- owned by the Core Modules Team (AK).
10 --
11 -- Desc Perform validation on an attribute record.
12 --
13 -- Results The API returns the standard p_return_status parameter
14 -- indicating one of the standard return statuses :
15 -- * Unexpected error
16 -- * Error
17 -- * Success
18 -- In addition, this function returns TRUE if all
19 -- validation tests are passed, or FALSE otherwise.
20 -- Parameters Attribute columns
21 -- p_caller : IN required
22 -- Must be one of the following values defined
23 -- in package AK_ON_OBJECTS_PVT:
24 -- - G_CREATE (if calling from the Create API)
25 -- - G_DOWNLOAD (if calling from the Download API)
26 -- - G_UPDATE (if calling from the Update API)
27 --
28 -- Note This API is intended for performing record-level
29 -- validation. It is not designed for item-level
30 -- validation.
31 --
32 -- Version Initial version number = 1.0
33 -- History Current version number = 1.0
34 --=======================================================
35 function VALIDATE_ATTRIBUTE (
36 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
37 p_api_version_number IN NUMBER,
38 p_return_status OUT NOCOPY VARCHAR2,
39 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
40 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
41 p_attribute_label_length IN NUMBER := FND_API.G_MISS_NUM,
42 p_attribute_value_length IN NUMBER := FND_API.G_MISS_NUM,
43 p_bold IN VARCHAR2 := FND_API.G_MISS_CHAR,
44 p_italic IN VARCHAR2 := FND_API.G_MISS_CHAR,
45 p_vertical_alignment IN VARCHAR2 := FND_API.G_MISS_CHAR,
46 p_horizontal_alignment IN VARCHAR2 := FND_API.G_MISS_CHAR,
47 p_data_type IN VARCHAR2 := FND_API.G_MISS_CHAR,
48 p_upper_case_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
49 p_default_value_varchar2 IN VARCHAR2 := FND_API.G_MISS_CHAR,
50 p_default_value_number IN NUMBER := FND_API.G_MISS_NUM,
51 p_default_value_date IN DATE := FND_API.G_MISS_DATE,
52 p_lov_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
53 p_lov_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
54 p_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
55 p_attribute_label_long IN VARCHAR2 := FND_API.G_MISS_CHAR,
56 p_attribute_label_short IN VARCHAR2 := FND_API.G_MISS_CHAR,
57 p_description IN VARCHAR2 := FND_API.G_MISS_CHAR,
58 p_caller IN VARCHAR2,
59 p_pass IN NUMBER := 2
60 ) return BOOLEAN is
61 l_api_version_number CONSTANT number := 1.0;
62 l_api_name CONSTANT varchar2(30) := 'Validate_Attribute';
63 l_error BOOLEAN;
64 l_return_status VARCHAR2(1);
65 begin
66 IF NOT FND_API.Compatible_API_Call (
67 l_api_version_number, p_api_version_number, l_api_name,
68 G_PKG_NAME) then
69 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
70 return FALSE;
71 END IF;
72
73 l_error := FALSE;
74 --
75 -- if validation level is none, no validation is necessary
76 --
77 if (p_validation_level = FND_API.G_VALID_LEVEL_NONE) then
78 p_return_status := FND_API.G_RET_STS_SUCCESS;
79 return TRUE;
80 end if;
81
82 --
83 -- check that key columns are not null and not missing
84 --
85 if ((p_attribute_application_id is null) or
86 (p_attribute_application_id = FND_API.G_MISS_NUM)) then
87 l_error := TRUE;
88 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
89 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
90 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_APPLICATION_ID');
91 FND_MSG_PUB.Add;
92 end if;
93 end if;
94
95 if ((p_attribute_code is null) or
96 (p_attribute_code = FND_API.G_MISS_CHAR)) then
97 l_error := TRUE;
98 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
99 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
100 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_CODE');
101 FND_MSG_PUB.Add;
102 end if;
103 end if;
104
105 /*** check that required columns are not null and, unless calling ***/
106 /*** from UPDATE procedure, the columns are not missing ***/
107 if ((p_bold is null) or
108 (p_bold = FND_API.G_MISS_CHAR and
109 p_caller <> AK_ON_OBJECTS_PVT.G_UPDATE)) then
110 l_error := TRUE;
111 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
112 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
113 FND_MESSAGE.SET_TOKEN('COLUMN', 'BOLD');
114 FND_MSG_PUB.Add;
115 end if;
116 end if;
117
118 if ((p_italic is null) or
119 (p_italic = FND_API.G_MISS_CHAR and
120 p_caller <> AK_ON_OBJECTS_PVT.G_UPDATE)) then
121 l_error := TRUE;
122 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
123 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
124 FND_MESSAGE.SET_TOKEN('COLUMN', 'ITALIC');
125 FND_MSG_PUB.Add;
126 end if;
127 end if;
128
129 if ((p_vertical_alignment is null) or
130 (p_vertical_alignment = FND_API.G_MISS_CHAR and
131 p_caller <> AK_ON_OBJECTS_PVT.G_UPDATE))
132 then
133 l_error := TRUE;
134 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
135 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
136 FND_MESSAGE.SET_TOKEN('COLUMN', 'VERTICAL_ALIGNMENT');
137 FND_MSG_PUB.Add;
138 end if;
139 end if;
140
141 if ((p_horizontal_alignment is null) or
142 (p_horizontal_alignment = FND_API.G_MISS_CHAR and
143 p_caller <> AK_ON_OBJECTS_PVT.G_UPDATE))
144 then
145 l_error := TRUE;
146 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
147 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
148 FND_MESSAGE.SET_TOKEN('COLUMN', 'HORIZONTAL_ALIGNMENT');
149 FND_MSG_PUB.Add;
150 end if;
151 end if;
152
153 if ((p_data_type is null) or
154 (p_data_type = FND_API.G_MISS_CHAR and
155 p_caller <> AK_ON_OBJECTS_PVT.G_UPDATE)) then
156 l_error := TRUE;
157 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
158 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
159 FND_MESSAGE.SET_TOKEN('COLUMN', 'DATA_TYPE');
160 FND_MSG_PUB.Add;
161 end if;
162 end if;
163
164 if ((p_name is null) or
165 (p_name = FND_API.G_MISS_CHAR and
166 p_caller <> AK_ON_OBJECTS_PVT.G_UPDATE)) then
167 l_error := TRUE;
168 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
169 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
170 FND_MESSAGE.SET_TOKEN('COLUMN', 'NAME');
171 FND_MSG_PUB.Add;
172 end if;
173 end if;
174
175 --*** Validate columns ***
176
177 -- - application ID
178 if (p_attribute_application_id <> FND_API.G_MISS_NUM) then
179 if (NOT AK_ON_OBJECTS_PVT.VALID_APPLICATION_ID (
180 p_api_version_number => 1.0,
181 p_return_status => l_return_status,
182 p_application_id => p_attribute_application_id)
183 ) then
184 l_error := TRUE;
185 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
186 FND_MESSAGE.SET_NAME('AK','AK_INVALID_COLUMN_VALUE');
187 FND_MESSAGE.SET_TOKEN('COLUMN','ATTRIBUTE_APPLICATION_ID');
188 FND_MSG_PUB.Add;
189 end if;
190 end if;
191 end if;
192
193 -- - data type
194 if (p_data_type <> FND_API.G_MISS_CHAR) then
195 if (NOT AK_ON_OBJECTS_PVT.VALID_LOOKUP_CODE (
196 p_api_version_number => 1.0,
197 p_return_status => l_return_status,
198 p_lookup_type => 'DATA_TYPE',
199 p_lookup_code => p_data_type) ) then
200 l_error := TRUE;
201 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
202 FND_MESSAGE.SET_NAME('AK','AK_INVALID_COLUMN_VALUE');
203 FND_MESSAGE.SET_TOKEN('COLUMN','DATA_TYPE');
204 FND_MSG_PUB.Add;
205 end if;
206 end if;
207 end if;
208
209 -- - bold
210 if (p_bold <> FND_API.G_MISS_CHAR) then
211 if (NOT AK_ON_OBJECTS_PVT.VALID_YES_NO(p_bold)) then
212 l_error := TRUE;
213 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
214 FND_MESSAGE.SET_NAME('AK','AK_VALUE_NOT_YES_NO');
215 FND_MESSAGE.SET_TOKEN('COLUMN','BOLD');
216 FND_MSG_PUB.Add;
217 end if;
218 end if;
219 end if;
220
221 -- - upper_case_flag
222 if (p_upper_case_flag <> FND_API.G_MISS_CHAR) then
223 if (NOT AK_ON_OBJECTS_PVT.VALID_YES_NO(p_upper_case_flag)) then
224 l_error := TRUE;
225 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
226 FND_MESSAGE.SET_NAME('AK','AK_VALUE_NOT_YES_NO');
227 FND_MESSAGE.SET_TOKEN('COLUMN','UPPER_CASE_FLAG');
228 FND_MSG_PUB.Add;
229 end if;
230 end if;
231 end if;
232
233 -- - italic
234 if (p_italic <> FND_API.G_MISS_CHAR) then
235 if (NOT AK_ON_OBJECTS_PVT.VALID_YES_NO(p_italic)) then
236 l_error := TRUE;
237 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
238 FND_MESSAGE.SET_NAME('AK','AK_VALUE_NOT_YES_NO');
239 FND_MESSAGE.SET_TOKEN('COLUMN','ITALIC');
240 FND_MSG_PUB.Add;
241 end if;
242 end if;
243 end if;
244
245 -- - vertical alignment
246 if (p_vertical_alignment <> FND_API.G_MISS_CHAR) then
247 if (NOT AK_ON_OBJECTS_PVT.VALID_LOOKUP_CODE (
248 p_api_version_number => 1.0,
249 p_return_status => l_return_status,
250 p_lookup_type => 'VERTICAL_ALIGNMENT',
251 p_lookup_code => p_vertical_alignment)) then
252 l_error := TRUE;
253 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
254 FND_MESSAGE.SET_NAME('AK','AK_INVALID_COLUMN_VALUE');
255 FND_MESSAGE.SET_TOKEN('COLUMN','VERTICAL_ALIGNMENT');
256 FND_MSG_PUB.Add;
257 end if;
258 end if;
259 end if;
260
261 /* - horizontal alignment */
262 if (p_horizontal_alignment <> FND_API.G_MISS_CHAR) then
263 if (NOT AK_ON_OBJECTS_PVT.VALID_LOOKUP_CODE (
264 p_api_version_number => 1.0,
265 p_return_status => l_return_status,
266 p_lookup_type => 'HORIZONTAL_ALIGNMENT',
267 p_lookup_code => p_horizontal_alignment)) then
268 l_error := TRUE;
269 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
270 FND_MESSAGE.SET_NAME('AK','AK_INVALID_COLUMN_VALUE');
271 FND_MESSAGE.SET_TOKEN('COLUMN','HORIZONTAL_ALIGNMENT');
272 FND_MSG_PUB.Add;
273 end if;
274 -- dbms_output.put_line('Invalid Horizontal Alignment value');
275 end if;
276 end if;
277
278 -- - lov_region_application_id and lov_region_code
279 if ( (p_lov_region_application_id <> FND_API.G_MISS_NUM) and
280 (p_lov_region_application_id is not null) ) or
281 ( (p_lov_region_code <> FND_API.G_MISS_CHAR) and
282 (p_lov_region_code is not null) )then
283 if (NOT AK_REGION_PVT.REGION_EXISTS (
284 p_api_version_number => 1.0,
285 p_return_status => l_return_status,
286 p_region_application_id => p_lov_region_application_id,
287 p_region_code => p_lov_region_code)) then
288 l_error := TRUE;
289 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
290 FND_MESSAGE.SET_NAME('AK','AK_LOV_REG_DOES_NOT_EXIST');
291 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_lov_region_application_id)||' '||p_lov_region_code);
292 FND_MSG_PUB.Add;
293 end if;
294 end if;
295 end if;
296
297 /* return true if no error, false otherwise */
298 p_return_status := FND_API.G_RET_STS_SUCCESS;
299 return (not l_error);
300
301 EXCEPTION
302 WHEN FND_API.G_EXC_ERROR THEN
303 p_return_status := FND_API.G_RET_STS_ERROR;
304 return FALSE;
305 WHEN OTHERS THEN
306 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
307 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
308 SUBSTR (SQLERRM, 1, 240) );
309 FND_MSG_PUB.Add;
310 return FALSE;
311
312 end VALIDATE_ATTRIBUTE;
313
314 --=======================================================
315 -- Function ATTRIBUTE_EXISTS
316 --
317 -- Usage Private API for checking for the existence of
318 -- an attribute with the given key values. This
319 -- API should only be called by other APIs that are
320 -- owned by the Core Modules Team (AK).
321 --
322 -- Desc This API check to see if an attribute record
323 -- exists with the given key values.
324 --
325 -- Results The API returns the standard p_return_status parameter
326 -- indicating one of the standard return statuses :
327 -- * Unexpected error
328 -- * Error
329 -- * Success
330 -- This function will return TRUE if such an attribute
331 -- exists, or FALSE otherwise.
332 -- Parameters Attribute key columns
333 --
334 -- Version Initial version number = 1.0
335 -- History Current version number = 1.0
336 --=======================================================
337 function ATTRIBUTE_EXISTS (
338 p_api_version_number IN NUMBER,
339 p_return_status OUT NOCOPY VARCHAR2,
340 p_attribute_application_id IN NUMBER,
341 p_attribute_code IN VARCHAR2
342 ) return BOOLEAN is
343 cursor l_check_csr is
344 select 1
345 from AK_ATTRIBUTES
346 where attribute_application_id = p_attribute_application_id
347 and attribute_code = p_attribute_code;
348 l_api_version_number CONSTANT number := 1.0;
349 l_api_name CONSTANT varchar2(30) := 'Attribute_Exists';
350 l_dummy number;
351 begin
352 IF NOT FND_API.Compatible_API_Call (
353 l_api_version_number, p_api_version_number, l_api_name,
354 G_PKG_NAME) then
355 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
356 return FALSE;
357 END IF;
358
359 open l_check_csr;
360 fetch l_check_csr into l_dummy;
361 if (l_check_csr%notfound) then
362 close l_check_csr;
363 p_return_status := FND_API.G_RET_STS_SUCCESS;
364 return FALSE;
365 else
366 close l_check_csr;
367 p_return_status := FND_API.G_RET_STS_SUCCESS;
368 return TRUE;
369 end if;
370
371 EXCEPTION
372 WHEN FND_API.G_EXC_ERROR THEN
373 p_return_status := FND_API.G_RET_STS_ERROR;
374 return FALSE;
375 WHEN OTHERS THEN
376 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
377 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
378 SUBSTR (SQLERRM, 1, 240) );
379 FND_MSG_PUB.Add;
380 return FALSE;
381
382 end ATTRIBUTE_EXISTS;
383
384 --========================================================
385 -- Procedure CREATE_ATTRIBUTE
386 --
387 -- Usage Private API for creating an attribute. This
388 -- API should only be called by other APIs that are
389 -- owned by the Core Modules Team (AK).
390 --
391 -- Desc Creates an attribute using the given info. This
392 -- API should only be called by other APIs that are
393 -- owned by the Core Modules Team (AK).
394 --
395 -- Results The API returns the standard p_return_status parameter
396 -- indicating one of the standard return statuses :
397 -- * Unexpected error
398 -- * Error
399 -- * Success
400 -- Parameters Attribute columns
401 -- p_loader_timestamp : IN optional
402 -- If a timestamp is passed, the API will create the
403 -- record using this timestamp. Only the upload API
404 -- should call with this parameter loaded.
405 -- p_temp_redo_tbl: IN required
406 -- For saving records temporarily to see if it
407 -- fails in first pass of upload. If it does,
408 -- then the record is saved for second pass
409 -- Version Initial version number = 1.0
410 -- History Current version number = 1.0
411 --=======================================================
412 procedure CREATE_ATTRIBUTE (
413 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
414 p_api_version_number IN NUMBER,
415 p_init_msg_tbl IN BOOLEAN := FALSE,
416 p_msg_count OUT NOCOPY NUMBER,
417 p_msg_data OUT NOCOPY VARCHAR2,
418 p_return_status OUT NOCOPY VARCHAR2,
419 p_attribute_application_id IN NUMBER,
420 p_attribute_code IN VARCHAR2,
421 p_attribute_label_length IN NUMBER := FND_API.G_MISS_NUM,
422 p_attribute_value_length IN NUMBER := FND_API.G_MISS_NUM,
423 p_bold IN VARCHAR2,
424 p_italic IN VARCHAR2,
425 p_vertical_alignment IN VARCHAR2,
426 p_horizontal_alignment IN VARCHAR2,
427 p_data_type IN VARCHAR2 := FND_API.G_MISS_CHAR,
428 p_upper_case_flag IN VARCHAR2,
429 p_default_value_varchar2 IN VARCHAR2 := FND_API.G_MISS_CHAR,
430 p_default_value_number IN NUMBER := FND_API.G_MISS_NUM,
431 p_default_value_date IN DATE := FND_API.G_MISS_DATE,
432 p_lov_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
433 p_lov_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
434 p_item_style IN VARCHAR2,
435 p_display_height IN NUMBER := FND_API.G_MISS_NUM,
436 p_css_class_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
437 p_poplist_viewobject IN VARCHAR2 := FND_API.G_MISS_CHAR,
438 p_poplist_display_attr IN VARCHAR2 := FND_API.G_MISS_CHAR,
439 p_poplist_value_attr IN VARCHAR2 := FND_API.G_MISS_CHAR,
440 p_css_label_class_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
441 p_precision IN NUMBER := FND_API.G_MISS_NUM,
442 p_expansion IN NUMBER := FND_API.G_MISS_NUM,
443 p_als_max_length IN NUMBER := FND_API.G_MISS_NUM,
444 p_attribute_category IN VARCHAR2 := FND_API.G_MISS_CHAR,
445 p_attribute1 IN VARCHAR2 := FND_API.G_MISS_CHAR,
446 p_attribute2 IN VARCHAR2 := FND_API.G_MISS_CHAR,
447 p_attribute3 IN VARCHAR2 := FND_API.G_MISS_CHAR,
448 p_attribute4 IN VARCHAR2 := FND_API.G_MISS_CHAR,
449 p_attribute5 IN VARCHAR2 := FND_API.G_MISS_CHAR,
450 p_attribute6 IN VARCHAR2 := FND_API.G_MISS_CHAR,
451 p_attribute7 IN VARCHAR2 := FND_API.G_MISS_CHAR,
452 p_attribute8 IN VARCHAR2 := FND_API.G_MISS_CHAR,
453 p_attribute9 IN VARCHAR2 := FND_API.G_MISS_CHAR,
454 p_attribute10 IN VARCHAR2 := FND_API.G_MISS_CHAR,
455 p_attribute11 IN VARCHAR2 := FND_API.G_MISS_CHAR,
456 p_attribute12 IN VARCHAR2 := FND_API.G_MISS_CHAR,
457 p_attribute13 IN VARCHAR2 := FND_API.G_MISS_CHAR,
458 p_attribute14 IN VARCHAR2 := FND_API.G_MISS_CHAR,
459 p_attribute15 IN VARCHAR2 := FND_API.G_MISS_CHAR,
460 p_name IN VARCHAR2,
461 p_attribute_label_long IN VARCHAR2 := FND_API.G_MISS_CHAR,
462 p_attribute_label_short IN VARCHAR2 := FND_API.G_MISS_CHAR,
463 p_description IN VARCHAR2 := FND_API.G_MISS_CHAR,
464 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
465 p_creation_date IN DATE := FND_API.G_MISS_DATE,
466 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
467 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
468 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
469 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
470 p_pass IN NUMBER,
471 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
472 ) is
473 l_api_version_number CONSTANT number := 1.0;
474 l_api_name CONSTANT varchar2(30) := 'Create_Attribute';
475 l_attribute_label_length NUMBER := null;
476 l_attribute_label_long VARCHAR2(80);
477 l_attribute_label_short VARCHAR2(40);
478 l_attribute_value_length NUMBER := null;
479 l_created_by number;
480 l_creation_date date;
481 l_description VARCHAR2(2000) := null;
482 l_default_value_varchar2 VARCHAR2(240) := null;
483 l_default_value_number number;
484 l_default_value_date date;
485 l_attribute_category VARCHAR2(30);
486 l_attribute1 VARCHAR2(150);
487 l_attribute2 VARCHAR2(150);
488 l_attribute3 VARCHAR2(150);
489 l_attribute4 VARCHAR2(150);
490 l_attribute5 VARCHAR2(150);
491 l_attribute6 VARCHAR2(150);
492 l_attribute7 VARCHAR2(150);
493 l_attribute8 VARCHAR2(150);
494 l_attribute9 VARCHAR2(150);
495 l_attribute10 VARCHAR2(150);
496 l_attribute11 VARCHAR2(150);
497 l_attribute12 VARCHAR2(150);
498 l_attribute13 VARCHAR2(150);
499 l_attribute14 VARCHAR2(150);
500 l_attribute15 VARCHAR2(150);
501 l_lang varchar2(30);
502 l_last_update_date date;
503 l_last_update_login number;
504 l_last_updated_by number;
505 l_lov_region_application_id number;
506 l_lov_region_code VARCHAR2(15);
507 l_return_status varchar2(1);
508 l_upper_case_flag VARCHAR2(1) := null;
509 l_item_style VARCHAR2(30) := 'TEXT';
510 l_display_height number := null;
511 l_css_class_name VARCHAR2(80) := NULL;
512 l_css_label_class_name VARCHAR2(80) := NULL;
513 l_precision number := null;
514 l_expansion number := null;
515 l_als_max_length number := null;
516 l_poplist_viewobject VARCHAR2(240) := null;
517 l_poplist_display_attr VARCHAR2(80) := NULL;
518 l_poplist_value_attr VARCHAR2(80) := NULL;
519
520 begin
521
522 IF NOT FND_API.Compatible_API_Call (
523 l_api_version_number, p_api_version_number, l_api_name,
524 G_PKG_NAME) then
525 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
526 return;
527 END IF;
528
529 -- Initialize the message table if requested.
530
531 if p_init_msg_tbl then
532 FND_MSG_PUB.initialize;
533 end if;
534
535 savepoint start_create_attribute;
536
537 /* TSHORT - 5665840 - new logic to avoid unique constraint error */
538 /* now if we hit that error the exception handling calls update_attribute */
539 /* --
540 -- check to see if row already exists
541 --
542 if AK_ATTRIBUTE_PVT.ATTRIBUTE_EXISTS (
543 p_api_version_number => 1.0,
544 p_return_status => l_return_status,
545 p_attribute_application_id => p_attribute_application_id,
546 p_attribute_code => p_attribute_code) then
547 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
548 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_EXISTS');
549 FND_MSG_PUB.Add;
550 end if;
551 raise FND_API.G_EXC_ERROR;
552 end if; */
553
554 --** create with blank lov region application id, and lov region code
555 --** if calling from the loader **
556 -- (this is because no region records have been loaded
557 -- at the time when the loader is creating attributes)
558 --
559 if (p_loader_timestamp <> FND_API.G_MISS_DATE) then
560 l_lov_region_application_id := null;
561 l_lov_region_code := null;
562 else
563 if (p_lov_region_application_id <> FND_API.G_MISS_NUM) then
564 l_lov_region_application_id := p_lov_region_application_id;
565 end if;
566 if (p_lov_region_code <> FND_API.G_MISS_CHAR) then
567 l_lov_region_code := p_lov_region_code;
568 end if;
569 end if;
570
571 --
572 -- validate table columns passed in
573 --
574 if (p_validation_level <> FND_API.G_VALID_LEVEL_NONE) then
575 --
576 -- If this API is called from the upload_attribute API,
577 -- we will create an attribute with a null lov region if
578 -- the lov region passed is invalid.
579 --
580 if (p_loader_timestamp <> FND_API.G_MISS_DATE) and
581 (p_lov_region_code is not null) and
582 (p_lov_region_code <> FND_API.G_MISS_CHAR) then
583 if NOT AK_REGION_PVT.REGION_EXISTS (
584 p_api_version_number => 1.0,
585 p_return_status => l_return_status,
586 p_region_application_id => p_lov_region_application_id,
587 p_region_code => p_lov_region_code) then
588 l_lov_region_application_id := null;
589 l_lov_region_code := null;
590 end if;
591 end if;
592 --
593 -- Validate all columns passed in
594 --
595 if NOT VALIDATE_ATTRIBUTE(
596 p_validation_level => p_validation_level,
597 p_api_version_number => 1.0,
598 p_return_status => l_return_status,
599 p_attribute_application_id => p_attribute_application_id,
600 p_attribute_code => p_attribute_code,
601 p_attribute_label_length => p_attribute_label_length,
602 p_attribute_value_length => p_attribute_value_length,
603 p_bold => p_bold,
604 p_italic => p_italic,
605 p_vertical_alignment => p_vertical_alignment,
606 p_horizontal_alignment => p_horizontal_alignment,
607 p_data_type => p_data_type,
608 p_upper_case_flag => p_upper_case_flag,
609 p_default_value_varchar2 => p_default_value_varchar2,
610 p_default_value_number => p_default_value_number,
611 p_default_value_date => p_default_value_date,
612 p_lov_region_application_id => l_lov_region_application_id,
613 p_lov_region_code => l_lov_region_code,
614 p_name => p_name,
615 p_attribute_label_long => p_attribute_label_long,
616 p_attribute_label_short => p_attribute_label_short,
617 p_description => p_description,
618 p_caller => AK_ON_OBJECTS_PVT.G_CREATE,
619 p_pass => p_pass
620 ) then
621 -- Do not raise an error if it's the first pass, continue to
622 -- insert the record
623 if (p_pass = 1) then
624 p_copy_redo_flag := TRUE;
625 else
626 raise FND_API.G_EXC_ERROR;
627 end if; -- /* if p_pass */
628 end if; --/* if VALIDATE_ATTRIBUTE */
629 end if; --/* if p_validation_level */
630
631 --
632 -- Load non-required columns if their values are given
633 -- (do not load lov_region_application_id and lov_region_code
634 -- again since they have already been loaded earlier)
635 --
636 if (p_attribute_label_length <> FND_API.G_MISS_NUM) then
637 l_attribute_label_length := p_attribute_label_length;
638 end if;
639
640 if (p_attribute_value_length <> FND_API.G_MISS_NUM) then
641 l_attribute_value_length := p_attribute_value_length;
642 end if;
643
644 if (p_upper_case_flag <> FND_API.G_MISS_CHAR) then
645 l_upper_case_flag := p_upper_case_flag;
646 end if;
647
648 if (p_default_value_varchar2 <> FND_API.G_MISS_CHAR) then
649 l_default_value_varchar2 := p_default_value_varchar2;
650 end if;
651
652 if (p_default_value_number <> FND_API.G_MISS_NUM) then
653 l_default_value_number := p_default_value_number;
654 end if;
655
656 if (p_default_value_date <> FND_API.G_MISS_DATE) then
657 l_default_value_date := p_default_value_date;
658 end if;
659
660 -- Load non-required JSP columns
661 if (p_item_style <> FND_API.G_MISS_CHAR and p_item_style is not null) then
662 l_item_style := p_item_style;
663 end if;
664
665 if (p_display_height <> FND_API.G_MISS_NUM) then
666 l_display_height := p_display_height;
667 end if;
668
669 if (p_css_class_name <> FND_API.G_MISS_CHAR) then
670 l_css_class_name := p_css_class_name;
671 end if;
672
673 if (p_poplist_viewobject <> FND_API.G_MISS_CHAR) then
674 l_poplist_viewobject := p_poplist_viewobject;
675 end if;
676
677 if (p_poplist_display_attr <> FND_API.G_MISS_CHAR) then
678 l_poplist_display_attr := p_poplist_display_attr;
679 end if;
680
681 if (p_poplist_value_attr <> FND_API.G_MISS_CHAR) then
682 l_poplist_value_attr := p_poplist_value_attr;
683 end if;
684
685 if (p_css_label_class_name <> FND_API.G_MISS_CHAR) then
686 l_css_label_class_name := p_css_label_class_name;
687 end if;
688
689 if (p_precision <> FND_API.G_MISS_NUM) then
690 l_precision := p_precision;
691 end if;
692
693 if (p_expansion <> FND_API.G_MISS_NUM) then
694 l_expansion := p_expansion;
695 end if;
696
697 if (p_als_max_length <> FND_API.G_MISS_NUM) then
698 l_als_max_length := p_als_max_length;
699 end if;
700
701 -- flex columns
702 if (p_attribute_category <> FND_API.G_MISS_CHAR) then
703 l_attribute_category := p_attribute_category;
704 end if;
705
706 if (p_attribute1 <> FND_API.G_MISS_CHAR) then
707 l_attribute1 := p_attribute1;
708 end if;
709
710 if (p_attribute2 <> FND_API.G_MISS_CHAR) then
711 l_attribute2 := p_attribute2;
712 end if;
713
714 if (p_attribute3 <> FND_API.G_MISS_CHAR) then
715 l_attribute3 := p_attribute3;
716 end if;
717
718 if (p_attribute4 <> FND_API.G_MISS_CHAR) then
719 l_attribute4 := p_attribute4;
720 end if;
721
722 if (p_attribute5 <> FND_API.G_MISS_CHAR) then
723 l_attribute5 := p_attribute5;
724 end if;
725
726 if (p_attribute6 <> FND_API.G_MISS_CHAR) then
727 l_attribute6 := p_attribute6;
728 end if;
729
730 if (p_attribute7 <> FND_API.G_MISS_CHAR) then
731 l_attribute7:= p_attribute7;
732 end if;
733
734 if (p_attribute8 <> FND_API.G_MISS_CHAR) then
735 l_attribute8 := p_attribute8;
736 end if;
737
738 if (p_attribute9 <> FND_API.G_MISS_CHAR) then
739 l_attribute9 := p_attribute9;
740 end if;
741
742 if (p_attribute10 <> FND_API.G_MISS_CHAR) then
743 l_attribute10 := p_attribute10;
744 end if;
745
746 if (p_attribute11 <> FND_API.G_MISS_CHAR) then
747 l_attribute11 := p_attribute11;
748 end if;
749
750 if (p_attribute12 <> FND_API.G_MISS_CHAR) then
751 l_attribute12 := p_attribute12;
752 end if;
753
754 if (p_attribute13 <> FND_API.G_MISS_CHAR) then
755 l_attribute13 := p_attribute13;
756 end if;
757
758 if (p_attribute14 <> FND_API.G_MISS_CHAR) then
759 l_attribute14 := p_attribute14;
760 end if;
761
762 if (p_attribute15 <> FND_API.G_MISS_CHAR) then
763 l_attribute15 := p_attribute15;
764 end if;
765
766 if (p_description <> FND_API.G_MISS_CHAR) then
767 l_description := p_description;
768 end if;
769
770 if (p_attribute_label_long <> FND_API.G_MISS_CHAR) then
771 l_attribute_label_long := p_attribute_label_long;
772 end if;
773
774 if (p_attribute_label_short <> FND_API.G_MISS_CHAR) then
775 l_attribute_label_short := p_attribute_label_short;
776 end if;
777
778 if (p_created_by <> FND_API.G_MISS_NUM) then
779 l_created_by := p_created_by;
780 end if;
781
782 if (p_creation_date <> FND_API.G_MISS_DATE) then
783 l_creation_date := p_creation_date;
784 end if;
785
786 if (p_last_updated_by <> FND_API.G_MISS_NUM) then
787 l_last_updated_by := p_last_updated_by;
788 end if;
789
790 if (p_last_update_date <> FND_API.G_MISS_DATE) then
791 l_last_update_date := p_last_update_date;
792 end if;
793
794 if (p_last_update_login <> FND_API.G_MISS_NUM) then
795 l_last_update_login := p_last_update_login;
796 end if;
797
798 --
799 -- Create record if no validation error was found
800 --
801 -- NOTE - Calling IS_UPDATEABLE for backward compatibility
802 -- old jlt files didn't have who columns and IS_UPDATEABLE
803 -- calls SET_WHO which populates those columns, for later
804 -- jlt files IS_UPDATEABLE will always return TRUE for CREATE
805
806 if AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
807 p_loader_timestamp => p_loader_timestamp,
808 p_created_by => l_created_by,
809 p_creation_date => l_creation_date,
810 p_last_updated_by => l_last_updated_by,
811 p_db_last_updated_by => null,
812 p_last_update_date => l_last_update_date,
813 p_db_last_update_date => null,
814 p_last_update_login => l_last_update_login,
815 p_create_or_update => 'CREATE') then
816 null;
817 end if;
818
819 -- Gets userenv('LANG') which is the system's current language code
820
821 select userenv('LANG') into l_lang
822 from dual;
823
824 insert into AK_ATTRIBUTES (
825 ATTRIBUTE_APPLICATION_ID,
826 ATTRIBUTE_CODE,
827 ATTRIBUTE_LABEL_LENGTH,
828 ATTRIBUTE_VALUE_LENGTH,
829 BOLD,
830 ITALIC,
831 VERTICAL_ALIGNMENT,
832 HORIZONTAL_ALIGNMENT,
833 DATA_TYPE,
834 UPPER_CASE_FLAG,
835 DEFAULT_VALUE_VARCHAR2,
836 DEFAULT_VALUE_NUMBER,
837 DEFAULT_VALUE_DATE,
838 LOV_REGION_APPLICATION_ID,
839 LOV_REGION_CODE,
840 ITEM_STYLE,
841 DISPLAY_HEIGHT,
842 CSS_CLASS_NAME,
843 POPLIST_VIEWOBJECT,
844 POPLIST_DISPLAY_ATTRIBUTE,
845 POPLIST_VALUE_ATTRIBUTE,
846 CSS_LABEL_CLASS_NAME,
847 PRECISION,
848 EXPANSION,
849 ALS_MAX_LENGTH,
850 ATTRIBUTE_CATEGORY,
851 ATTRIBUTE1,
852 ATTRIBUTE2,
853 ATTRIBUTE3,
854 ATTRIBUTE4,
855 ATTRIBUTE5,
856 ATTRIBUTE6,
857 ATTRIBUTE7,
858 ATTRIBUTE8,
859 ATTRIBUTE9,
860 ATTRIBUTE10,
861 ATTRIBUTE11,
862 ATTRIBUTE12,
863 ATTRIBUTE13,
864 ATTRIBUTE14,
865 ATTRIBUTE15,
866 CREATION_DATE,
867 CREATED_BY,
868 LAST_UPDATE_DATE,
869 LAST_UPDATED_BY,
870 LAST_UPDATE_LOGIN
871 ) values (
872 p_attribute_application_id,
873 p_attribute_code,
874 l_attribute_label_length,
875 l_attribute_value_length,
876 p_bold,
877 p_italic,
878 p_vertical_alignment,
879 p_horizontal_alignment,
880 p_data_type,
881 l_upper_case_flag,
882 l_default_value_varchar2,
883 l_default_value_number,
884 l_default_value_date,
885 l_lov_region_application_id,
886 l_lov_region_code,
887 l_item_style,
888 l_display_height,
889 l_css_class_name,
890 l_poplist_viewobject,
891 l_poplist_display_attr,
892 l_poplist_value_attr,
893 l_css_label_class_name,
894 l_precision,
895 l_expansion,
896 l_als_max_length,
897 l_attribute_category,
898 l_attribute1,
899 l_attribute2,
900 l_attribute3,
901 l_attribute4,
902 l_attribute5,
903 l_attribute6,
904 l_attribute7,
905 l_attribute8,
906 l_attribute9,
907 l_attribute10,
908 l_attribute11,
909 l_attribute12,
910 l_attribute13,
911 l_attribute14,
912 l_attribute15,
913 l_creation_date,
914 l_created_by,
915 l_last_update_date,
916 l_last_updated_by,
917 l_last_update_login
918 );
919
920 --
921 -- row should exists before inserting rows for other languages
922 --
923 if NOT AK_ATTRIBUTE_PVT.ATTRIBUTE_EXISTS (
924 p_api_version_number => 1.0,
925 p_return_status => l_return_status,
926 p_attribute_application_id => p_attribute_application_id,
927 p_attribute_code => p_attribute_code) then
928 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
929 FND_MESSAGE.SET_NAME('AK','AK_INSERT_ATTRIBUTE_FAILED');
930 FND_MESSAGE.SET_TOKEN('OBJECT','AK_LC_ATTRIBUTE',TRUE);
931 FND_MSG_PUB.Add;
932 end if;
933 raise FND_API.G_EXC_ERROR;
934 end if;
935
936 insert into AK_ATTRIBUTES_TL (
937 ATTRIBUTE_APPLICATION_ID,
938 ATTRIBUTE_CODE,
939 LANGUAGE,
940 NAME,
941 ATTRIBUTE_LABEL_LONG,
942 ATTRIBUTE_LABEL_SHORT,
943 DESCRIPTION,
944 SOURCE_LANG,
945 CREATED_BY,
946 CREATION_DATE,
947 LAST_UPDATED_BY,
948 LAST_UPDATE_DATE,
949 LAST_UPDATE_LOGIN
950 ) select
951 p_attribute_application_id,
952 p_attribute_code,
953 L.LANGUAGE_CODE,
954 p_name,
955 l_attribute_label_long,
956 l_attribute_label_short,
957 l_description,
958 l_lang,
959 l_created_by,
960 l_creation_date,
961 l_last_updated_by,
962 l_last_update_date,
963 l_last_update_login
964 from FND_LANGUAGES L
965 where L.INSTALLED_FLAG in ('I', 'B')
966 and not exists
967 (select NULL
968 from AK_ATTRIBUTES_TL T
969 where T.ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
970 and T.ATTRIBUTE_CODE = p_attribute_code
971 and T.LANGUAGE = L.LANGUAGE_CODE);
972
973 -- /** commit the insert **/
974 commit;
975
976 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
977 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_CREATED');
978 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
979 ' ' || p_attribute_code);
980 FND_MSG_PUB.Add;
981 end if;
982
983 p_return_status := FND_API.G_RET_STS_SUCCESS;
984
985 FND_MSG_PUB.Count_And_Get (
986 p_count => p_msg_count,
987 p_data => p_msg_data);
988
989
990 EXCEPTION
991 WHEN VALUE_ERROR THEN
992 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
993 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_VALUE_ERROR');
994 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
995 ' ' || p_attribute_code);
996 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_CREATED');
997 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
998 ' ' || p_attribute_code);
999 FND_MSG_PUB.Add;
1000 end if;
1001 p_return_status := FND_API.G_RET_STS_ERROR;
1002 rollback to start_create_attribute;
1003 FND_MSG_PUB.Count_And_Get (
1004 p_count => p_msg_count,
1005 p_data => p_msg_data);
1006 WHEN FND_API.G_EXC_ERROR THEN
1007 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1008 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_CREATED');
1009 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
1010 ' ' || p_attribute_code);
1011 FND_MSG_PUB.Add;
1012 end if;
1013 p_return_status := FND_API.G_RET_STS_ERROR;
1014 rollback to start_create_attribute;
1015 FND_MSG_PUB.Count_And_Get (
1016 p_count => p_msg_count,
1017 p_data => p_msg_data);
1018 WHEN OTHERS THEN
1019 if (SQLCODE = -1) then
1020 rollback to start_create_attribute;
1021 AK_ATTRIBUTE_PVT.UPDATE_ATTRIBUTE (
1022 p_validation_level => p_validation_level,
1023 p_api_version_number => 1.0,
1024 p_msg_count => p_msg_count,
1025 p_msg_data => p_msg_data,
1026 p_return_status => p_return_status,
1027 p_attribute_application_id => p_attribute_application_id,
1028 p_attribute_code => p_attribute_code,
1029 p_attribute_label_length => p_attribute_label_length,
1030 p_attribute_value_length => p_attribute_value_length,
1031 p_bold => p_bold,
1032 p_italic => p_italic,
1033 p_vertical_alignment => p_vertical_alignment,
1034 p_horizontal_alignment => p_horizontal_alignment,
1035 p_data_type => p_data_type,
1036 p_precision => p_precision,
1037 p_upper_case_flag => p_upper_case_flag,
1038 p_default_value_varchar2 => p_default_value_varchar2,
1039 p_default_value_number => p_default_value_number,
1040 p_default_value_date => p_default_value_date,
1041 p_lov_region_application_id => p_lov_region_application_id,
1042 p_lov_region_code => p_lov_region_code,
1043 p_item_style => p_item_style,
1044 p_display_height => p_display_height,
1045 p_css_class_name => p_css_class_name,
1046 p_poplist_viewobject => p_poplist_viewobject,
1047 p_poplist_display_attr => p_poplist_display_attr,
1048 p_poplist_value_attr => p_poplist_value_attr,
1049 p_css_label_class_name => p_css_label_class_name,
1050 p_attribute_category => p_attribute_category,
1051 p_expansion => p_expansion,
1052 p_als_max_length => p_als_max_length,
1053 p_attribute1 => p_attribute1,
1054 p_attribute2 => p_attribute2,
1055 p_attribute3 => p_attribute3,
1056 p_attribute4 => p_attribute4,
1057 p_attribute5 => p_attribute5,
1058 p_attribute6 => p_attribute6,
1059 p_attribute7 => p_attribute7,
1060 p_attribute8 => p_attribute8,
1061 p_attribute9 => p_attribute9,
1062 p_attribute10 => p_attribute10,
1063 p_attribute11 => p_attribute11,
1064 p_attribute12 => p_attribute12,
1065 p_attribute13 => p_attribute13,
1066 p_attribute14 => p_attribute14,
1067 p_attribute15 => p_attribute15,
1068 p_created_by => p_created_by,
1069 p_creation_date => p_creation_date,
1070 p_last_updated_by => p_last_updated_by,
1071 p_last_update_date => p_last_update_date,
1072 p_last_update_login => p_last_update_login,
1073 p_name => p_name,
1074 p_attribute_label_long => p_attribute_label_long,
1075 p_attribute_label_short =>p_attribute_label_short,
1076 p_description => p_description,
1077 p_loader_timestamp => p_loader_timestamp,
1078 p_pass => p_pass,
1079 p_copy_redo_flag => p_copy_redo_flag
1080 );
1081 else
1082 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1083 rollback to start_create_attribute;
1084 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, l_api_name,
1085 SUBSTR (SQLERRM, 1, 240) );
1086 FND_MSG_PUB.Count_And_Get (
1087 p_count => p_msg_count,
1088 p_data => p_msg_data);
1089 end if;
1090 end CREATE_ATTRIBUTE;
1091
1092 --=======================================================
1093 -- Procedure DELETE_ATTRIBUTE
1094 --
1095 -- Usage Private API for deleting an attribute. This
1096 -- API should only be called by other APIs that are
1097 -- owned by the Core Modules Team (AK).
1098 --
1099 -- Desc Deletes an attribute with the given key value.
1100 --
1101 -- Results The API returns the standard p_return_status parameter
1102 -- indicating one of the standard return statuses :
1103 -- * Unexpected error
1104 -- * Error
1105 -- * Success
1106 -- Parameters p_attribute_application_id : IN required
1107 -- p_attribute_code : IN required
1108 -- Key value of the attribute to be deleted.
1109 -- p_delete_cascade : IN required
1110 -- If p_delete_cascade flag is 'Y', also delete all
1111 -- rows in other tables that references this attribute.
1112 -- Otherwise, this attribute will not be deleted if there
1113 -- are any other rows referencing it.
1114 --
1115 -- Version Initial version number = 1.0
1116 -- History Current version number = 1.0
1117 --=======================================================
1118 procedure DELETE_ATTRIBUTE (
1119 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1120 p_api_version_number IN NUMBER,
1121 p_init_msg_tbl IN BOOLEAN := FALSE,
1122 p_msg_count OUT NOCOPY NUMBER,
1123 p_msg_data OUT NOCOPY VARCHAR2,
1124 p_return_status OUT NOCOPY VARCHAR2,
1125 p_attribute_application_id IN NUMBER,
1126 p_attribute_code IN VARCHAR2,
1127 p_delete_cascade IN VARCHAR2
1128 ) is
1129 cursor l_get_obj_attr_csr is
1130 select DATABASE_OBJECT_NAME
1131 from AK_OBJECT_ATTRIBUTES
1132 where ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
1133 and ATTRIBUTE_CODE = p_attribute_code;
1134 cursor l_get_region_item_csr is
1135 select REGION_APPLICATION_ID, REGION_CODE
1136 from AK_REGION_ITEMS
1137 where ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
1138 and ATTRIBUTE_CODE = p_attribute_code
1139 and OBJECT_ATTRIBUTE_FLAG = 'N';
1140 l_api_version_number CONSTANT number := 1.0;
1141 l_api_name CONSTANT varchar2(30) := 'Delete_Attribute';
1142 l_database_object_name VARCHAR2(30);
1143 l_msg_count NUMBER;
1144 l_msg_data VARCHAR2(2000);
1145 l_region_application_id NUMBER;
1146 l_region_code VARCHAR2(30);
1147 l_return_status varchar2(1);
1148 begin
1149
1150 IF NOT FND_API.Compatible_API_Call (
1151 l_api_version_number, p_api_version_number, l_api_name,
1152 G_PKG_NAME) then
1153 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1154 return;
1155 END IF;
1156
1157 -- Initialize the message table if requested.
1158
1159 if p_init_msg_tbl then
1160 FND_MSG_PUB.initialize;
1161 end if;
1162
1163 savepoint start_delete_attribute;
1164
1165 --
1166 -- error if attribute to be deleted does not exists
1167 --
1168 if NOT AK_ATTRIBUTE_PVT.ATTRIBUTE_EXISTS (
1169 p_api_version_number => 1.0,
1170 p_return_status => l_return_status,
1171 p_attribute_application_id => p_attribute_application_id,
1172 p_attribute_code => p_attribute_code) then
1173 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1174 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
1175 FND_MSG_PUB.Add;
1176 end if;
1177 raise FND_API.G_EXC_ERROR;
1178 end if;
1179
1180 if (p_delete_cascade = 'N') then
1181 --
1182 -- If we are not deleting any referencing records, we cannot
1183 -- delete the attribute if it is being referenced in any of
1184 -- following tables.
1185 --
1186 -- AK_OBJECT_ATTRIBUTES
1187 --
1188 open l_get_obj_attr_csr;
1189 fetch l_get_obj_attr_csr into l_database_object_name;
1190 if l_get_obj_attr_csr%found then
1191 close l_get_obj_attr_csr;
1192 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1193 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_DEL_REF_ATTR_OA');
1194 FND_MSG_PUB.Add;
1195 end if;
1196 raise FND_API.G_EXC_ERROR;
1197 end if;
1198 close l_get_obj_attr_csr;
1199 --
1200 -- AK_REGION_ITEMS
1201 --
1202 open l_get_region_item_csr;
1203 fetch l_get_region_item_csr into l_region_application_id, l_region_code;
1204 if l_get_region_item_csr%found then
1205 close l_get_region_item_csr;
1206 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1207 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_DEL_REF_ATTR_RI');
1208 FND_MSG_PUB.Add;
1209 end if;
1210 raise FND_API.G_EXC_ERROR;
1211 end if;
1212 close l_get_region_item_csr;
1213
1214 else
1215 --
1216 -- Otherwise, delete all referencing rows in other tables
1217 --
1218 -- AK_OBJECT_ATTRIBUTES
1219 --
1220 open l_get_obj_attr_csr;
1221 loop
1222 fetch l_get_obj_attr_csr into l_database_object_name;
1223 exit when l_get_obj_attr_csr%notfound;
1224 AK_OBJECT_PVT.DELETE_ATTRIBUTE(
1225 p_validation_level => p_validation_level,
1226 p_api_version_number => 1.0,
1227 p_msg_count => l_msg_count,
1228 p_msg_data => l_msg_data,
1229 p_return_status => l_return_status,
1230 p_database_object_name => l_database_object_name,
1231 p_attribute_application_id => p_attribute_application_id,
1232 p_attribute_code => p_attribute_code,
1233 p_delete_cascade => p_delete_cascade
1234 );
1235 if (l_return_status = FND_API.G_RET_STS_ERROR) or
1236 (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1237 close l_get_obj_attr_csr;
1238 raise FND_API.G_EXC_ERROR;
1239 end if;
1240 end loop;
1241 close l_get_obj_attr_csr;
1242 --
1243 -- AK_REGION_ITEMS
1244 --
1245 open l_get_region_item_csr;
1246 loop
1247 fetch l_get_region_item_csr into l_region_application_id, l_region_code;
1248 exit when l_get_region_item_csr%notfound;
1249 AK_REGION_PVT.DELETE_ITEM (
1250 p_validation_level => p_validation_level,
1251 p_api_version_number => 1.0,
1252 p_msg_count => l_msg_count,
1253 p_msg_data => l_msg_data,
1254 p_return_status => l_return_status,
1255 p_region_application_id => l_region_application_id,
1256 p_region_code => l_region_code,
1257 p_attribute_application_id => p_attribute_application_id,
1258 p_attribute_code => p_attribute_code,
1259 p_delete_cascade => p_delete_cascade
1260 );
1261 if (l_return_status = FND_API.G_RET_STS_ERROR) or
1262 (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1263 close l_get_region_item_csr;
1264 raise FND_API.G_EXC_ERROR;
1265 end if;
1266 end loop;
1267 close l_get_region_item_csr;
1268
1269 end if;
1270
1271 --
1272 -- delete attribute once we checked that there are no references
1273 -- to this attribute, or all references have been deleted.
1274 --
1275 delete from ak_attributes
1276 where attribute_application_id = p_attribute_application_id
1277 and attribute_code = p_attribute_code;
1278
1279 if (sql%notfound) then
1280 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1281 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
1282 FND_MSG_PUB.Add;
1283 end if;
1284 raise FND_API.G_EXC_ERROR;
1285 end if;
1286
1287 delete from ak_attributes_tl
1288 where attribute_application_id = p_attribute_application_id
1289 and attribute_code = p_attribute_code;
1290
1291 if (sql%notfound) then
1292 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1293 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
1294 FND_MSG_PUB.Add;
1295 end if;
1296 raise FND_API.G_EXC_ERROR;
1297 end if;
1298
1299 --
1300 -- Load success message
1301 --
1302 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) then
1303 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DELETED');
1304 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_attribute_application_id) ||
1305 ' ' || p_attribute_code);
1306 FND_MSG_PUB.Add;
1307 end if;
1308
1309 p_return_status := FND_API.G_RET_STS_SUCCESS;
1310
1311 FND_MSG_PUB.Count_And_Get (
1312 p_count => p_msg_count,
1313 p_data => p_msg_data);
1314
1315 EXCEPTION
1316 WHEN FND_API.G_EXC_ERROR THEN
1317 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1318 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_DELETED');
1319 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_attribute_application_id) ||
1320 ' ' || p_attribute_code);
1321 FND_MSG_PUB.Add;
1322 end if;
1323 p_return_status := FND_API.G_RET_STS_ERROR;
1324 rollback to start_delete_attribute;
1325 FND_MSG_PUB.Count_And_Get (
1326 p_count => p_msg_count,
1327 p_data => p_msg_data);
1328 WHEN OTHERS THEN
1329 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1330 rollback to start_delete_attribute;
1331 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, l_api_name,
1332 SUBSTR (SQLERRM, 1, 240) );
1333 FND_MSG_PUB.Count_And_Get (
1334 p_count => p_msg_count,
1335 p_data => p_msg_data);
1336 end DELETE_ATTRIBUTE;
1337
1338 --=======================================================
1339 -- Procedure WRITE_TO_BUFFER (local procedure)
1340 --
1341 -- Usage Local procedure for writing one attribute to
1342 -- the output file. Not designed to be called
1343 -- from outside this package.
1344 --
1345 -- Desc Appends the single attribute passed in through the
1346 -- parameters to the specified output file. The
1347 -- output will be in loader file format.
1348 --
1349 -- Results The API returns the standard p_return_status parameter
1350 -- indicating one of the standard return statuses :
1351 -- * Unexpected error
1352 -- * Error
1353 -- * Success
1354 -- Parameters Attribute record and its TL record.
1355 --=======================================================
1356 procedure WRITE_TO_BUFFER (
1357 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1358 p_return_status OUT NOCOPY VARCHAR2,
1359 p_attributes_rec IN ak_attributes%ROWTYPE,
1360 p_attributes_tl_rec IN ak_attributes_tl%ROWTYPE
1361 ) is
1362 l_api_name CONSTANT varchar2(30) := 'Write_to_buffer';
1363 l_databuffer_tbl AK_ON_OBJECTS_PUB.Buffer_Tbl_Type;
1364 l_index NUMBER;
1365 l_lov_object VARCHAR2(30);
1366 l_return_status varchar2(1);
1367 begin
1368 --
1369 -- Attribute must be validated before it is written to the file
1370 --
1371 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
1372 if not VALIDATE_ATTRIBUTE (
1373 p_validation_level => p_validation_level,
1374 p_api_version_number => 1.0,
1375 p_return_status => l_return_status,
1376 p_attribute_application_id =>
1377 p_attributes_rec.attribute_application_id,
1378 p_attribute_code => p_attributes_rec.attribute_code,
1379 p_attribute_label_length => p_attributes_rec.attribute_label_length,
1380 p_attribute_value_length => p_attributes_rec.attribute_value_length,
1381 p_bold => p_attributes_rec.bold,
1382 p_italic => p_attributes_rec.italic,
1383 p_vertical_alignment => p_attributes_rec.vertical_alignment,
1384 p_horizontal_alignment => p_attributes_rec.horizontal_alignment,
1385 p_data_type => p_attributes_rec.data_type,
1386 p_upper_case_flag => p_attributes_rec.upper_case_flag,
1387 p_default_value_varchar2 => p_attributes_rec.default_value_varchar2,
1388 p_default_value_number => p_attributes_rec.default_value_number,
1389 p_default_value_date => p_attributes_rec.default_value_date,
1390 p_lov_region_application_id =>
1391 p_attributes_rec.lov_region_application_id,
1392 p_lov_region_code => p_attributes_rec.lov_region_code,
1393 p_name => p_attributes_tl_rec.name,
1394 p_attribute_label_long => p_attributes_tl_rec.attribute_label_long,
1395 p_attribute_label_short => p_attributes_tl_rec.attribute_label_short,
1396 p_description => p_attributes_tl_rec.description,
1397 p_caller => AK_ON_OBJECTS_PVT.G_DOWNLOAD)
1398 then
1399 -- dbms_output.put_line('Attribute ' || p_attributes_rec.attribute_code
1400 -- || ' not downloaded due to validation error');
1401 raise FND_API.G_EXC_ERROR;
1402 end if;
1403 end if;
1404
1405 --
1406 -- Write attribute and its TL record into buffer
1407 --
1408 l_databuffer_tbl.DELETE;
1409 l_index := 1;
1410
1411 l_databuffer_tbl(l_index) := 'BEGIN ATTRIBUTE "' ||
1412 p_attributes_rec.attribute_application_id || '" "' ||
1413 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.attribute_code) || '"';
1414 --
1415 -- only write out columns that is not null
1416 --
1417 if ((p_attributes_rec.attribute_label_length IS NOT NULL) and
1418 (p_attributes_rec.attribute_label_length <> FND_API.G_MISS_NUM)) then
1419 l_index := l_index + 1;
1420 l_databuffer_tbl(l_index) := ' ATTRIBUTE_LABEL_LENGTH = "' ||
1421 nvl(to_char(p_attributes_rec.attribute_label_length),'') || '"';
1422 end if;
1423 if ((p_attributes_rec.attribute_value_length IS NOT NULL) and
1424 (p_attributes_rec.attribute_value_length <> FND_API.G_MISS_NUM)) then
1425 l_index := l_index + 1;
1426 l_databuffer_tbl(l_index) := ' ATTRIBUTE_VALUE_LENGTH = "' ||
1427 nvl(to_char(p_attributes_rec.attribute_value_length),'') || '"';
1428 end if;
1429 if ((p_attributes_rec.bold IS NOT NULL) and
1430 (p_attributes_rec.bold <> FND_API.G_MISS_CHAR)) then
1431 l_index := l_index + 1;
1432 l_databuffer_tbl(l_index) := ' BOLD = "' ||
1433 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.bold) || '"';
1434 end if;
1435 if ((p_attributes_rec.italic IS NOT NULL) and
1436 (p_attributes_rec.italic <> FND_API.G_MISS_CHAR)) then
1437 l_index := l_index + 1;
1438 l_databuffer_tbl(l_index) := ' ITALIC = "' ||
1439 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.italic) || '"';
1440 end if;
1441 if ((p_attributes_rec.vertical_alignment IS NOT NULL) and
1442 (p_attributes_rec.vertical_alignment <> FND_API.G_MISS_CHAR)) then
1443 l_index := l_index + 1;
1444 l_databuffer_tbl(l_index) := ' VERTICAL_ALIGNMENT = "' ||
1445 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.vertical_alignment)
1446 || '"';
1447 end if;
1448 if ((p_attributes_rec.horizontal_alignment IS NOT NULL) and
1449 (p_attributes_rec.horizontal_alignment <> FND_API.G_MISS_CHAR)) then
1450 l_index := l_index + 1;
1451 l_databuffer_tbl(l_index) := ' HORIZONTAL_ALIGNMENT = "' ||
1452 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.horizontal_alignment)
1453 || '"';
1454 end if;
1455 if ((p_attributes_rec.data_type IS NOT NULL) and
1456 (p_attributes_rec.data_type <> FND_API.G_MISS_CHAR)) then
1457 l_index := l_index + 1;
1458 l_databuffer_tbl(l_index) := ' DATA_TYPE = "' ||
1459 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.data_type) || '"';
1460 end if;
1461 if ((p_attributes_rec.upper_case_flag IS NOT NULL) and
1462 (p_attributes_rec.upper_case_flag <> FND_API.G_MISS_CHAR)) then
1463 l_index := l_index + 1;
1464 l_databuffer_tbl(l_index) := ' UPPER_CASE_FLAG = "' ||
1465 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.upper_case_flag)
1466 || '"';
1467 end if;
1468 if ((p_attributes_rec.default_value_varchar2 IS NOT NULL) and
1469 (p_attributes_rec.default_value_varchar2 <> FND_API.G_MISS_CHAR)) then
1470 l_index := l_index + 1;
1471 l_databuffer_tbl(l_index) := ' DEFAULT_VALUE_VARCHAR2 = "' ||
1472 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1473 p_attributes_rec.default_value_varchar2) || '"';
1474 end if;
1475 if ((p_attributes_rec.default_value_number IS NOT NULL) and
1476 (p_attributes_rec.default_value_number <> FND_API.G_MISS_NUM)) then
1477 l_index := l_index + 1;
1478 l_databuffer_tbl(l_index) := ' DEFAULT_VALUE_NUMBER = "' ||
1479 nvl(to_char(p_attributes_rec.default_value_number),'') || '"';
1480 end if;
1481 if ((p_attributes_rec.default_value_date IS NOT NULL) and
1482 (p_attributes_rec.default_value_date <> FND_API.G_MISS_DATE)) then
1483 l_index := l_index + 1;
1484 l_databuffer_tbl(l_index) := ' DEFAULT_VALUE_DATE = "' ||
1485 to_char(p_attributes_rec.default_value_date,
1486 AK_ON_OBJECTS_PUB.G_DATE_FORMAT) || '"';
1487 end if;
1488 if ((p_attributes_rec.lov_region_application_id IS NOT NULL) and
1489 (p_attributes_rec.lov_region_application_id <> FND_API.G_MISS_NUM) and
1490 (p_attributes_rec.lov_region_code IS NOT NULL) and
1491 (p_attributes_rec.lov_region_code <> FND_API.G_MISS_CHAR)) then
1492 l_index := l_index + 1;
1493 l_databuffer_tbl(l_index) := ' LOV_REGION = "' ||
1494 nvl(to_char(p_attributes_rec.lov_region_application_id),'')||'" "'||
1495 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_rec.lov_region_code) ||
1496 '"';
1497 end if;
1498 -- new columns for JSP renderer
1499 if ((p_attributes_rec.item_style IS NOT NULL) and
1500 (p_attributes_rec.item_style <> FND_API.G_MISS_CHAR)) then
1501 l_index := l_index + 1;
1502 l_databuffer_tbl(l_index) := ' ITEM_STYLE = "' ||
1503 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1504 p_attributes_rec.item_style) || '"';
1505 end if;
1506 if ((p_attributes_rec.display_height IS NOT NULL) and
1507 (p_attributes_rec.display_height <> FND_API.G_MISS_NUM)) then
1508 l_index := l_index + 1;
1509 l_databuffer_tbl(l_index) := ' DISPLAY_HEIGHT = "' ||
1510 nvl(to_char(p_attributes_rec.display_height),'') || '"';
1511 end if;
1512 if ((p_attributes_rec.css_class_name IS NOT NULL) and
1513 (p_attributes_rec.css_class_name <> FND_API.G_MISS_CHAR)) then
1514 l_index := l_index + 1;
1515 l_databuffer_tbl(l_index) := ' CSS_CLASS_NAME = "' ||
1516 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1517 p_attributes_rec.css_class_name) || '"';
1518 end if;
1519 if ((p_attributes_rec.poplist_viewobject IS NOT NULL) and
1520 (p_attributes_rec.poplist_viewobject <> FND_API.G_MISS_CHAR)) then
1521 l_index := l_index + 1;
1522 l_databuffer_tbl(l_index) := ' POPLIST_VIEWOBJECT = "' ||
1523 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1524 p_attributes_rec.poplist_viewobject) || '"';
1525 end if;
1526 if ((p_attributes_rec.poplist_display_attribute IS NOT NULL) and
1527 (p_attributes_rec.poplist_display_attribute <> FND_API.G_MISS_CHAR)) then
1528 l_index := l_index + 1;
1529 l_databuffer_tbl(l_index) := ' POPLIST_DISPLAY_ATTRIBUTE = "' ||
1530 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1531 p_attributes_rec.poplist_display_attribute) || '"';
1532 end if;
1533 if ((p_attributes_rec.poplist_value_attribute IS NOT NULL) and
1534 (p_attributes_rec.poplist_value_attribute <> FND_API.G_MISS_CHAR)) then
1535 l_index := l_index + 1;
1536 l_databuffer_tbl(l_index) := ' POPLIST_VALUE_ATTRIBUTE = "' ||
1537 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1538 p_attributes_rec.poplist_value_attribute) || '"';
1539 end if;
1540 if ((p_attributes_rec.css_label_class_name IS NOT NULL ) and
1541 (p_attributes_rec.css_label_class_name <> FND_API.G_MISS_CHAR)) then
1542 l_index := l_index + 1;
1543 l_databuffer_tbl(l_index) := ' CSS_LABEL_CLASS_NAME = "' ||
1544 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1545 p_attributes_rec.css_label_class_name) || '"';
1546 end if;
1547 if ((p_attributes_rec.precision IS NOT NULL ) and
1548 (p_attributes_rec.precision <> FND_API.G_MISS_NUM)) then
1549 l_index := l_index + 1;
1550 l_databuffer_tbl(l_index) := ' PRECISION = "' ||
1551 nvl(to_char(p_attributes_rec.precision),'') || '"';
1552 end if;
1553 if ((p_attributes_rec.expansion IS NOT NULL ) and
1554 (p_attributes_rec.expansion <> FND_API.G_MISS_NUM)) then
1555 l_index := l_index + 1;
1556 l_databuffer_tbl(l_index) := ' EXPANSION = "' ||
1557 nvl(to_char(p_attributes_rec.expansion),'') || '"';
1558 end if;
1559 if ((p_attributes_rec.als_max_length IS NOT NULL ) and
1560 (p_attributes_rec.als_max_length <> FND_API.G_MISS_NUM)) then
1561 l_index := l_index + 1;
1562 l_databuffer_tbl(l_index) := ' ALS_MAX_LENGTH = "' ||
1563 nvl(to_char(p_attributes_rec.als_max_length),'') || '"';
1564 end if;
1565
1566
1567 -- Flex Fields
1568 --
1569 if ((p_attributes_rec.attribute_category IS NOT NULL) and
1570 (p_attributes_rec.attribute_category <> FND_API.G_MISS_CHAR)) then
1571 l_index := l_index + 1;
1572 l_databuffer_tbl(l_index) := ' ATTRIBUTE_CATEGORY = "' ||
1573 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1574 p_attributes_rec.attribute_category) || '"';
1575 end if;
1576 if ((p_attributes_rec.attribute1 IS NOT NULL) and
1577 (p_attributes_rec.attribute1 <> FND_API.G_MISS_CHAR)) then
1578 l_index := l_index + 1;
1579 l_databuffer_tbl(l_index) := ' ATTRIBUTE1 = "' ||
1580 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1581 p_attributes_rec.attribute1) || '"';
1582 end if;
1583 if ((p_attributes_rec.attribute2 IS NOT NULL) and
1584 (p_attributes_rec.attribute2 <> FND_API.G_MISS_CHAR)) then
1585 l_index := l_index + 1;
1586 l_databuffer_tbl(l_index) := ' ATTRIBUTE2 = "' ||
1587 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1588 p_attributes_rec.attribute2) || '"';
1589 end if;
1590 if ((p_attributes_rec.attribute3 IS NOT NULL) and
1591 (p_attributes_rec.attribute3 <> FND_API.G_MISS_CHAR)) then
1592 l_index := l_index + 1;
1593 l_databuffer_tbl(l_index) := ' ATTRIBUTE3 = "' ||
1594 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1595 p_attributes_rec.attribute3) || '"';
1596 end if;
1597 if ((p_attributes_rec.attribute4 IS NOT NULL) and
1598 (p_attributes_rec.attribute4 <> FND_API.G_MISS_CHAR)) then
1599 l_index := l_index + 1;
1600 l_databuffer_tbl(l_index) := ' ATTRIBUTE4 = "' ||
1601 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1602 p_attributes_rec.attribute4) || '"';
1603 end if;
1604 if ((p_attributes_rec.attribute5 IS NOT NULL) and
1605 (p_attributes_rec.attribute5 <> FND_API.G_MISS_CHAR)) then
1606 l_index := l_index + 1;
1607 l_databuffer_tbl(l_index) := ' ATTRIBUTE5 = "' ||
1608 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1609 p_attributes_rec.attribute5) || '"';
1610 end if;
1611 if ((p_attributes_rec.attribute6 IS NOT NULL) and
1612 (p_attributes_rec.attribute6 <> FND_API.G_MISS_CHAR)) then
1613 l_index := l_index + 1;
1614 l_databuffer_tbl(l_index) := ' ATTRIBUTE6 = "' ||
1615 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1616 p_attributes_rec.attribute6) || '"';
1617 end if;
1618 if ((p_attributes_rec.attribute7 IS NOT NULL) and
1619 (p_attributes_rec.attribute7 <> FND_API.G_MISS_CHAR)) then
1620 l_index := l_index + 1;
1621 l_databuffer_tbl(l_index) := ' ATTRIBUTE7 = "' ||
1622 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1623 p_attributes_rec.attribute7) || '"';
1624 end if;
1625 if ((p_attributes_rec.attribute8 IS NOT NULL) and
1626 (p_attributes_rec.attribute8 <> FND_API.G_MISS_CHAR)) then
1627 l_index := l_index + 1;
1628 l_databuffer_tbl(l_index) := ' ATTRIBUTE8 = "' ||
1629 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1630 p_attributes_rec.attribute8) || '"';
1631 end if;
1632 if ((p_attributes_rec.attribute9 IS NOT NULL) and
1633 (p_attributes_rec.attribute9 <> FND_API.G_MISS_CHAR)) then
1634 l_index := l_index + 1;
1635 l_databuffer_tbl(l_index) := ' ATTRIBUTE9 = "' ||
1636 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1637 p_attributes_rec.attribute9) || '"';
1638 end if;
1639 if ((p_attributes_rec.attribute10 IS NOT NULL) and
1640 (p_attributes_rec.attribute10 <> FND_API.G_MISS_CHAR)) then
1641 l_index := l_index + 1;
1642 l_databuffer_tbl(l_index) := ' ATTRIBUTE10 = "' ||
1643 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1644 p_attributes_rec.attribute10) || '"';
1645 end if;
1646 if ((p_attributes_rec.attribute11 IS NOT NULL) and
1647 (p_attributes_rec.attribute11 <> FND_API.G_MISS_CHAR)) then
1648 l_index := l_index + 1;
1649 l_databuffer_tbl(l_index) := ' ATTRIBUTE11 = "' ||
1650 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1651 p_attributes_rec.attribute11) || '"';
1652 end if;
1653 if ((p_attributes_rec.attribute12 IS NOT NULL) and
1654 (p_attributes_rec.attribute12 <> FND_API.G_MISS_CHAR)) then
1655 l_index := l_index + 1;
1656 l_databuffer_tbl(l_index) := ' ATTRIBUTE12 = "' ||
1657 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1658 p_attributes_rec.attribute12) || '"';
1659 end if;
1660 if ((p_attributes_rec.attribute13 IS NOT NULL) and
1661 (p_attributes_rec.attribute13 <> FND_API.G_MISS_CHAR)) then
1662 l_index := l_index + 1;
1663 l_databuffer_tbl(l_index) := ' ATTRIBUTE13 = "' ||
1664 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1665 p_attributes_rec.attribute13) || '"';
1666 end if;
1667 if ((p_attributes_rec.attribute14 IS NOT NULL) and
1668 (p_attributes_rec.attribute14 <> FND_API.G_MISS_CHAR)) then
1669 l_index := l_index + 1;
1670 l_databuffer_tbl(l_index) := ' ATTRIBUTE14 = "' ||
1671 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1672 p_attributes_rec.attribute14) || '"';
1673 end if;
1674 if ((p_attributes_rec.attribute15 IS NOT NULL) and
1675 (p_attributes_rec.attribute15 <> FND_API.G_MISS_CHAR)) then
1676 l_index := l_index + 1;
1677 l_databuffer_tbl(l_index) := ' ATTRIBUTE15 = "' ||
1678 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(
1679 p_attributes_rec.attribute15) || '"';
1680 end if;
1681 -- - Write out who columns
1682 l_index := l_index + 1;
1683 l_databuffer_tbl(l_index) := ' CREATED_BY = "' ||
1684 nvl(to_char(p_attributes_rec.created_by),'') || '"';
1685 l_index := l_index + 1;
1686 l_databuffer_tbl(l_index) := ' CREATION_DATE = "' ||
1687 to_char(p_attributes_rec.creation_date,
1688 AK_ON_OBJECTS_PUB.G_DATE_FORMAT) || '"';
1689 l_index := l_index + 1;
1690 -- CHANGED TO OWNER FOR R12
1691 -- l_databuffer_tbl(l_index) := ' LAST_UPDATED_BY = "' ||
1692 -- nvl(to_char(p_attributes_rec.last_updated_by),'') || '"';
1693 l_databuffer_tbl(l_index) := ' OWNER = "' ||
1694 FND_LOAD_UTIL.OWNER_NAME(p_attributes_rec.last_updated_by) || '"';
1695 l_index := l_index + 1;
1696 l_databuffer_tbl(l_index) := ' LAST_UPDATE_DATE = "' ||
1697 to_char(p_attributes_rec.last_update_date,
1698 AK_ON_OBJECTS_PUB.G_DATE_FORMAT) || '"';
1699 l_index := l_index + 1;
1700 l_databuffer_tbl(l_index) := ' LAST_UPDATE_LOGIN = "' ||
1701 nvl(to_char(p_attributes_rec.last_update_login),'') || '"';
1702 -- translation columns
1703 --
1704 if ((p_attributes_tl_rec.name IS NOT NULL) and
1705 (p_attributes_tl_rec.name <> FND_API.G_MISS_CHAR)) then
1706 l_index := l_index + 1;
1707 l_databuffer_tbl(l_index) := ' NAME = "' ||
1708 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_tl_rec.name) || '"';
1709 end if;
1710 if ((p_attributes_tl_rec.attribute_label_long IS NOT NULL) and
1711 (p_attributes_tl_rec.attribute_label_long <> FND_API.G_MISS_CHAR)) then
1712 l_index := l_index + 1;
1713 l_databuffer_tbl(l_index) := ' ATTRIBUTE_LABEL_LONG = "' ||
1714 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_tl_rec.attribute_label_long)
1715 || '"';
1716 end if;
1717 if ((p_attributes_tl_rec.attribute_label_short IS NOT NULL) and
1718 (p_attributes_tl_rec.attribute_label_short <> FND_API.G_MISS_CHAR)) then
1719 l_index := l_index + 1;
1720 l_databuffer_tbl(l_index) := ' ATTRIBUTE_LABEL_SHORT = "' ||
1721 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_tl_rec.attribute_label_short)
1722 || '"';
1723 end if;
1724 if ((p_attributes_tl_rec.description IS NOT NULL) and
1725 (p_attributes_tl_rec.description <> FND_API.G_MISS_CHAR)) then
1726 l_index := l_index + 1;
1727 l_databuffer_tbl(l_index) := ' DESCRIPTION = "' ||
1728 AK_ON_OBJECTS_PVT.REPLACE_SPECIAL_CHAR(p_attributes_tl_rec.description) || '"';
1729 end if;
1730
1731 l_index := l_index + 1;
1732 l_databuffer_tbl(l_index) := 'END ATTRIBUTE';
1733 l_index := l_index + 1;
1734 l_databuffer_tbl(l_index) := ' ';
1735
1736 --
1737 -- - Write attribute data out to the specified file
1738 --
1739 AK_ON_OBJECTS_PVT.WRITE_FILE (
1740 p_return_status => l_return_status,
1741 p_buffer_tbl => l_databuffer_tbl,
1742 p_write_mode => AK_ON_OBJECTS_PUB.G_APPEND
1743 );
1744
1745 --
1746 -- If API call returns with an error status...
1747 --
1748 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
1749 (l_return_status = FND_API.G_RET_STS_ERROR) then
1750 RAISE FND_API.G_EXC_ERROR;
1751 end if;
1752
1753 p_return_status := FND_API.G_RET_STS_SUCCESS;
1754
1755 EXCEPTION
1756 WHEN VALUE_ERROR THEN
1757 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1758 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_VALUE_ERROR');
1759 FND_MESSAGE.SET_TOKEN('KEY',
1760 to_char(p_attributes_rec.attribute_application_id) ||
1761 ' ' || p_attributes_rec.attribute_code);
1762 FND_MSG_PUB.Add;
1763 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_DOWNLOADED');
1764 FND_MESSAGE.SET_TOKEN('KEY',
1765 to_char(p_attributes_rec.attribute_application_id) ||
1766 ' ' || p_attributes_rec.attribute_code);
1767 FND_MSG_PUB.Add;
1768 end if;
1769 p_return_status := FND_API.G_RET_STS_ERROR;
1770 WHEN FND_API.G_EXC_ERROR THEN
1771 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
1772 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_DOWNLOADED');
1773 FND_MESSAGE.SET_TOKEN('KEY',
1774 to_char(p_attributes_rec.attribute_application_id) ||
1775 ' ' || p_attributes_rec.attribute_code);
1776 FND_MSG_PUB.Add;
1777 end if;
1778 p_return_status := FND_API.G_RET_STS_ERROR;
1779 WHEN OTHERS THEN
1780 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1781 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
1782 SUBSTR (SQLERRM, 1, 240) );
1783 FND_MSG_PUB.Add;
1784 end WRITE_TO_BUFFER;
1785
1786 --=======================================================
1787 -- Procedure DOWNLOAD_ATTRIBUTE
1788 --
1789 -- Usage Private API for downloading attributes. This
1790 -- API should only be called by other APIs that are
1791 -- owned by the Core Modules Team (AK).
1792 --
1793 -- Desc This API will extract the attributes selected
1794 -- by application ID or by key values from the
1795 -- database to the output file.
1796 --
1797 -- Results The API returns the standard p_return_status parameter
1798 -- indicating one of the standard return statuses :
1799 -- * Unexpected error
1800 -- * Error
1801 -- * Success
1802 -- Parameters
1803 -- p_nls_language : IN optional
1804 -- NLS language for database. If none if given,
1805 -- the current NLS language will be used.
1806 --
1807 -- One of the following parameters must be provided:
1808 --
1809 -- p_application_id : IN optional
1810 -- If given, all attributes for this application ID
1811 -- will be written to the output file.
1812 -- p_application_id will be ignored if a table is
1813 -- given in p_attribute_pk_tbl.
1814 -- p_attribute_pk_tbl : IN optional
1815 -- If given, only attributes whose key values are
1816 -- included in this table will be written to the
1817 -- output file.
1818 --
1819 --
1820 -- Version Initial version number = 1.0
1821 -- History Current version number = 1.0
1822 --=======================================================
1823 procedure DOWNLOAD_ATTRIBUTE (
1824 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1825 p_api_version_number IN NUMBER,
1826 p_return_status OUT NOCOPY VARCHAR2,
1827 p_application_id IN NUMBER := FND_API.G_MISS_NUM,
1828 p_attribute_pk_tbl IN AK_ATTRIBUTE_PUB.Attribute_PK_Tbl_Type
1829 := AK_ATTRIBUTE_PUB.G_MISS_ATTRIBUTE_PK_TBL,
1830 p_nls_language IN VARCHAR2
1831 ) is
1832 cursor l_get_attribute_1_csr (appl_id_parm number) is
1833 select *
1834 from AK_ATTRIBUTES
1835 where ATTRIBUTE_APPLICATION_ID = appl_id_parm;
1836 cursor l_get_attribute_2_csr (appl_id_parm number,
1837 attr_code_parm varchar2) is
1838 select *
1839 from AK_ATTRIBUTES
1840 where ATTRIBUTE_APPLICATION_ID = appl_id_parm
1841 and ATTRIBUTE_CODE = attr_code_parm;
1842 cursor l_get_attribute_2p_csr (appl_id_parm number,
1843 attr_code_parm varchar2) is
1844 select *
1845 from AK_ATTRIBUTES
1846 where ATTRIBUTE_APPLICATION_ID = appl_id_parm
1847 and ATTRIBUTE_CODE like attr_code_parm;
1848 cursor l_get_tl_csr (appl_id_parm number,
1849 attr_code_parm varchar2,
1850 lang_parm varchar2) is
1851 select *
1852 from AK_ATTRIBUTES_TL
1853 where ATTRIBUTE_APPLICATION_ID = appl_id_parm
1854 and ATTRIBUTE_CODE = attr_code_parm
1855 and LANGUAGE = lang_parm;
1856 cursor l_get_tlp_csr (appl_id_parm number,
1857 attr_code_parm varchar2,
1858 lang_parm varchar2) is
1859 select *
1860 from AK_ATTRIBUTES_TL
1861 where ATTRIBUTE_APPLICATION_ID = appl_id_parm
1862 and ATTRIBUTE_CODE like attr_code_parm
1863 and LANGUAGE = lang_parm;
1864 cursor l_percent_check (attr_code_parm varchar2) is
1865 select instr(attr_code_parm,'%')
1866 from dual;
1867
1868 l_api_version_number CONSTANT number := 1.0;
1869 l_api_name CONSTANT varchar2(30) := 'Download';
1870 l_attribute_found BOOLEAN;
1871 i number;
1872 l_attribute_appl_id NUMBER;
1873 l_attributes_rec ak_attributes%ROWTYPE;
1874 l_attributes_tl_rec ak_attributes_tl%ROWTYPE;
1875 l_return_status varchar2(1);
1876 l_select_by_appl_id BOOLEAN;
1877 l_percent NUMBER;
1878 begin
1879 IF NOT FND_API.Compatible_API_Call (
1880 l_api_version_number, p_api_version_number, l_api_name,
1881 G_PKG_NAME) then
1882 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1883 return;
1884 END IF;
1885
1886 --
1887 -- Check that one of the following selection criteria is given:
1888 -- - p_application_id alone, or
1889 -- - attribute_application_id and attribute_code pairs in
1890 -- p_attribute_pk_tbl, or
1891 -- - both p_application_id and p_attribute_pk_tbl if any
1892 -- p_attribute_application_id is missing in p_attribute_pk_tbl
1893 --
1894 if (p_application_id = FND_API.G_MISS_NUM) then
1895 if (p_attribute_pk_tbl.count = 0) then
1896 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1897 FND_MESSAGE.SET_NAME('AK','AK_NO_SELECTION');
1898 FND_MSG_PUB.Add;
1899 end if;
1900 raise FND_API.G_EXC_ERROR;
1901 else
1902 --
1903 -- since no application ID is passed in thru p_application_id,
1904 -- none of the attribute_application_id or attribute_code
1905 -- in table can be null
1906 --
1907
1908 for i in p_attribute_pk_tbl.FIRST .. p_attribute_pk_tbl.LAST LOOP
1909 if (p_attribute_pk_tbl.exists(i)) then
1910 if (p_attribute_pk_tbl(i).attribute_appl_id = FND_API.G_MISS_NUM) or
1911 (p_attribute_pk_tbl(i).attribute_code = FND_API.G_MISS_CHAR)
1912 then
1913 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1914 FND_MESSAGE.SET_NAME('AK','AK_INVALID_LIST');
1915 FND_MESSAGE.SET_TOKEN('ELEMENT_NUM',to_char(i));
1916 FND_MSG_PUB.Add;
1917 end if;
1918 raise FND_API.G_EXC_ERROR;
1919 end if; /* if attribute_appl_id is null */
1920 end if; /* if exists */
1921 end LOOP;
1922
1923 end if;
1924 end if;
1925
1926 --
1927 -- selection is by application ID if the attribute list table is empty
1928 --
1929 if (p_attribute_pk_tbl.count = 0) then
1930 l_select_by_appl_id := TRUE;
1931 else
1932 l_select_by_appl_id := FALSE;
1933 end if;
1934
1935 --
1936 -- Retrieve attributes from AK_ATTRIBUTES that fits the selection
1937 -- criteria, one at a time, and write it the buffer table
1938 --
1939 if (l_select_by_appl_id) then
1940 --
1941 -- download by application ID
1942 --
1943 open l_get_attribute_1_csr(p_application_id);
1944
1945 loop
1946 fetch l_get_attribute_1_csr into l_attributes_rec;
1947 exit when l_get_attribute_1_csr%notfound;
1948 open l_get_tl_csr (l_attributes_rec.attribute_application_id,
1949 l_attributes_rec.attribute_code,
1950 p_nls_language);
1951 fetch l_get_tl_csr into l_attributes_tl_rec;
1952 exit when l_get_tl_csr%notfound;
1953 close l_get_tl_csr;
1954
1955 WRITE_TO_BUFFER(
1956 p_validation_level => p_validation_level,
1957 p_return_status => l_return_status,
1958 p_attributes_rec => l_attributes_rec,
1959 p_attributes_tl_rec => l_attributes_tl_rec
1960 );
1961 --
1962 -- abort Download if validation has been failed
1963 --
1964 if (l_return_status = FND_API.G_RET_STS_ERROR) then
1965 raise FND_API.G_EXC_ERROR;
1966 end if;
1967 end loop;
1968 close l_get_attribute_1_csr;
1969
1970 if l_get_tl_csr%isopen then
1971 close l_get_tl_csr;
1972 end if;
1973 else
1974 --
1975 -- download by list of attributes
1976 --
1977 for i in p_attribute_pk_tbl.FIRST .. p_attribute_pk_tbl.LAST LOOP
1978 if (p_attribute_pk_tbl.exists(i)) then
1979 --
1980 -- default application ID to p_application_id if not given
1981 --
1982 if (p_attribute_pk_tbl(i).attribute_appl_id = FND_API.G_MISS_NUM) then
1983 l_attribute_appl_id := p_application_id;
1984 else
1985 l_attribute_appl_id := p_attribute_pk_tbl(i).attribute_appl_id;
1986 end if;
1987
1988 --
1989 -- Retrieve attribute and its TL entry from the database
1990 --
1991 l_attribute_found := TRUE;
1992 open l_percent_check(p_attribute_pk_tbl(i).attribute_code);
1993 fetch l_percent_check into l_percent;
1994 if l_percent <> 0 then
1995 open l_get_attribute_2p_csr(l_attribute_appl_id,
1996 p_attribute_pk_tbl(i).attribute_code);
1997 loop
1998 fetch l_get_attribute_2p_csr into l_attributes_rec;
1999 exit when l_get_attribute_2p_csr%notfound;
2000 open l_get_tlp_csr (l_attributes_rec.attribute_application_id,
2001 l_attributes_rec.attribute_code,
2002 p_nls_language);
2003 fetch l_get_tlp_csr into l_attributes_tl_rec;
2004 exit when l_get_tlp_csr%notfound;
2005 close l_get_tlp_csr;
2006
2007 WRITE_TO_BUFFER(
2008 p_validation_level => p_validation_level,
2009 p_return_status => l_return_status,
2010 p_attributes_rec => l_attributes_rec,
2011 p_attributes_tl_rec => l_attributes_tl_rec
2012 );
2013 --
2014 -- abort Download if validation has been failed
2015 --
2016 if (l_return_status = FND_API.G_RET_STS_ERROR) then
2017 raise FND_API.G_EXC_ERROR;
2018 end if;
2019 end loop;
2020 close l_get_attribute_2p_csr;
2021 else
2022 open l_get_attribute_2_csr(l_attribute_appl_id,
2023 p_attribute_pk_tbl(i).attribute_code);
2024 fetch l_get_attribute_2_csr into l_attributes_rec;
2025 if (l_get_attribute_2_csr%notfound) then
2026 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
2027 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
2028 FND_MSG_PUB.Add;
2029 FND_MESSAGE.SET_NAME('AK','AK_ATTR_NOT_DOWNLOADED');
2030 FND_MESSAGE.SET_TOKEN('KEY', to_char(l_attribute_appl_id) ||
2031 ' ' || p_attribute_pk_tbl(i).attribute_code);
2032 FND_MSG_PUB.Add;
2033 end if;
2034 l_attribute_found := FALSE;
2035 else
2036 open l_get_tl_csr (l_attributes_rec.attribute_application_id,
2037 l_attributes_rec.attribute_code,
2038 p_nls_language);
2039 fetch l_get_tl_csr into l_attributes_tl_rec;
2040 if ( l_get_tl_csr%notfound) then
2041 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
2042 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
2043 FND_MSG_PUB.Add;
2044 end if;
2045 l_attribute_found := FALSE;
2046 end if;
2047 close l_get_tl_csr;
2048 end if;
2049 close l_get_attribute_2_csr;
2050
2051 --
2052 -- write attribute and its TL entry to buffer
2053 --
2054 if l_attribute_found then
2055 WRITE_TO_BUFFER(
2056 p_validation_level => p_validation_level,
2057 p_return_status => l_return_status,
2058 p_attributes_rec => l_attributes_rec,
2059 p_attributes_tl_rec => l_attributes_tl_rec
2060 );
2061 --
2062 -- abort Download if validation has been failed
2063 --
2064 if (l_return_status = FND_API.G_RET_STS_ERROR) then
2065 raise FND_API.G_EXC_ERROR;
2066 end if;
2067 end if; /* if l_attribute_found */
2068 end if; /* if l_percent */
2069 close l_percent_check;
2070 end if; /* if exists(i) */
2071 end loop;
2072 end if;
2073
2074 p_return_status := FND_API.G_RET_STS_SUCCESS;
2075
2076 EXCEPTION
2077 WHEN FND_API.G_EXC_ERROR THEN
2078 p_return_status := FND_API.G_RET_STS_ERROR;
2079 WHEN OTHERS THEN
2080 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2081 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, l_api_name,
2082 SUBSTR (SQLERRM, 1, 240) );
2083 end DOWNLOAD_ATTRIBUTE;
2084
2085 --=======================================================
2086 -- Procedure UPLOAD_ATTRIBUTE
2087 --
2088 -- Usage Private API for loading attributes from a
2089 -- loader file to the database.
2090 -- This API should only be called by other APIs
2091 -- that are owned by the Core Modules Team (AK).
2092 --
2093 -- Desc This API reads the attribute data stored in
2094 -- the loader file currently being processed, parses
2095 -- the data, and loads them to the database. The tables
2096 -- are updated with the timestamp passed. This API
2097 -- will process the file until the EOF is reached,
2098 -- a parse error is encountered, or when data for
2099 -- a different business object is read from the file.
2100 --
2101 -- Results The API returns the standard p_return_status parameter
2102 -- indicating one of the standard return statuses :
2103 -- * Unexpected error
2104 -- * Error
2105 -- * Success
2106 -- Parameters p_index : IN OUT required
2107 -- Index of PL/SQL file to be processed.
2108 -- p_loader_timestamp : IN required
2109 -- The timestamp to be used when creating or updating
2110 -- records
2111 -- p_line_num : IN optional
2112 -- The first line number in the file to be processed.
2113 -- It is used for keeping track of the line number
2114 -- read so that this info can be included in the
2115 -- error message when a parse error occurred.
2116 -- p_buffer : IN required
2117 -- The content of the first line to be processed.
2118 -- The calling API has already read the first line
2119 -- that needs to be parsed by this API, so this
2120 -- line won't be read from the file again.
2121 -- p_line_num_out : OUT
2122 -- The number of the last line in the loader file
2123 -- that is read by this API.
2124 -- p_buffer_out : OUT
2125 -- The content of the last line read by this API.
2126 -- If an EOF has not reached, this line would
2127 -- contain the beginning of another business object
2128 -- that will need to be processed by another API.
2129 --
2130 -- Version Initial version number = 1.0
2131 -- History Current version number = 1.0
2132 --=======================================================
2133 procedure UPLOAD_ATTRIBUTE (
2134 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
2135 p_api_version_number IN NUMBER,
2136 p_return_status OUT NOCOPY VARCHAR2,
2137 p_index IN OUT NOCOPY NUMBER,
2138 p_loader_timestamp IN DATE,
2139 p_line_num IN NUMBER := FND_API.G_MISS_NUM,
2140 p_buffer IN AK_ON_OBJECTS_PUB.Buffer_Type,
2141 p_line_num_out OUT NOCOPY NUMBER,
2142 p_buffer_out OUT NOCOPY AK_ON_OBJECTS_PUB.Buffer_Type,
2143 p_upl_loader_cur IN OUT NOCOPY AK_ON_OBJECTS_PUB.LoaderCurTyp,
2144 p_pass IN NUMBER := 1
2145 ) is
2146 l_api_version_number CONSTANT number := 1.0;
2147 l_api_name CONSTANT varchar2(30) := 'Upload_Attribute';
2148 l_attribute_rec ak_attributes%ROWTYPE;
2149 l_attribute_tl_rec AK_ATTRIBUTE_PUB.Attribute_Tl_Rec_Type;
2150 l_buffer AK_ON_OBJECTS_PUB.Buffer_Type;
2151 l_column varchar2(30);
2152 l_dummy NUMBER;
2153 l_empty_attribute_rec ak_attributes%ROWTYPE;
2154 l_empty_attribute_tl_rec AK_ATTRIBUTE_PUB.Attribute_Tl_Rec_Type;
2155 l_eof_flag VARCHAR2(1);
2156 l_line_num NUMBER;
2157 l_lines_read NUMBER;
2158 l_msg_count NUMBER;
2159 l_msg_data VARCHAR2(2000);
2160 l_more_attr BOOLEAN := TRUE;
2161 l_return_status varchar2(1);
2162 l_saved_token AK_ON_OBJECTS_PUB.Buffer_type;
2163 l_state NUMBER; /* parse state */
2164 l_token AK_ON_OBJECTS_PUB.Buffer_Type;
2165 l_value_count NUMBER; /* # of values read for current column */
2166 l_copy_redo_flag BOOLEAN := FALSE;
2167 l_user_id1 NUMBER;
2168 l_user_id2 NUMBER;
2169 l_update1 DATE;
2170 l_update2 DATE;
2171 begin
2172 IF NOT FND_API.Compatible_API_Call (
2173 l_api_version_number, p_api_version_number, l_api_name,
2174 G_PKG_NAME) then
2175 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2176 return;
2177 END IF;
2178
2179 --dbms_output.put_line('Started attribute upload: ' ||
2180 -- to_char(sysdate, 'MON-DD HH24:MI:SS'));
2181
2182 -- SAVEPOINT Start_Upload;
2183
2184 --
2185 -- Retrieve the first non-blank, non-comment line
2186 --
2187 l_state := 0;
2188 l_eof_flag := 'N';
2189 --
2190 -- if calling from ak_on_objects.upload (ie, loader timestamp is given),
2191 -- the tokens 'BEGIN ATTRIBUTE' has already been parsed. Set initial
2192 -- buffer to 'BEGIN ATTRIBUTE' before reading the next line from the
2193 -- file. Otherwise, set initial buffer to null.
2194 --
2195 if (p_loader_timestamp <> FND_API.G_MISS_DATE) then
2196 l_buffer := 'BEGIN ATTRIBUTE ' || p_buffer;
2197 else
2198 l_buffer := null;
2199 end if;
2200
2201 if (p_line_num = FND_API.G_MISS_NUM) then
2202 l_line_num := 0;
2203 else
2204 l_line_num := p_line_num;
2205 end if;
2206
2207 while (l_buffer is null and l_eof_flag = 'N' and p_index <= AK_ON_OBJECTS_PVT.G_UPL_TABLE_NUM) loop
2208 AK_ON_OBJECTS_PVT.READ_LINE (
2209 p_return_status => l_return_status,
2210 p_index => p_index,
2211 p_buffer => l_buffer,
2212 p_lines_read => l_lines_read,
2213 p_eof_flag => l_eof_flag,
2214 p_upl_loader_cur => p_upl_loader_cur
2215 );
2216 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2217 (l_return_status = FND_API.G_RET_STS_ERROR) then
2218 RAISE FND_API.G_EXC_ERROR;
2219 end if;
2220 --dbms_output.put_line('READ_LINE gets l_buffer = '||l_buffer);
2221
2222 l_line_num := l_line_num + l_lines_read;
2223 --
2224 -- trim leading spaces and discard comment lines
2225 --
2226 l_buffer := LTRIM(l_buffer);
2227 if (SUBSTR(l_buffer, 1, 1) = '#') then
2228 l_buffer := null;
2229 end if;
2230 end loop;
2231
2232 --
2233 -- Error if there is nothing to be read from the file
2234 --
2235 if (l_buffer is null and l_eof_flag = 'Y') then
2236 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2237 FND_MESSAGE.SET_NAME('AK','AK_EMPTY_BUFFER');
2238 FND_MSG_PUB.Add;
2239 end if;
2240 raise FND_API.G_EXC_ERROR;
2241 end if;
2242
2243 --
2244 -- Read tokens from file, one at a time
2245 --
2246 while (l_eof_flag = 'N') and (l_buffer is not null)
2247 and (l_more_attr) loop
2248
2249 AK_ON_OBJECTS_PVT.GET_TOKEN(
2250 p_return_status => l_return_status,
2251 p_in_buf => l_buffer,
2252 p_token => l_token
2253 );
2254
2255 --dbms_output.put_line(' State:' || l_state || 'Token:' || l_token);
2256 -- to_char(sysdate, 'MON-DD HH24:MI:SS'));
2257
2258 if (l_return_status = FND_API.G_RET_STS_ERROR) or
2259 (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
2260 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2261 -- dbms_output.put_line('State '||l_state||' Token '||l_token|| 'l_buffer '||l_buffer);
2262 FND_MESSAGE.SET_NAME('AK','AK_GET_TOKEN_ERROR');
2263 FND_MSG_PUB.Add;
2264 end if;
2265 -- dbms_output.put_line('Error parsing buffer');
2266 raise FND_API.G_EXC_ERROR;
2267 end if;
2268
2269 if (l_state = 0) then
2270 if (l_token = 'BEGIN') then
2271 --== Clear out previous column data ==--
2272 l_attribute_rec := l_empty_attribute_rec;
2273 l_attribute_tl_rec := l_empty_attribute_tl_rec;
2274 l_state := 1;
2275 else
2276 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2277 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
2278 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2279 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2280 FND_MESSAGE.SET_TOKEN('EXPECTED','BEGIN');
2281 FND_MSG_PUB.Add;
2282 end if;
2283 raise FND_API.G_EXC_ERROR;
2284 end if;
2285 elsif (l_state = 1) then
2286 if (l_token = 'ATTRIBUTE') then
2287 l_state := 2;
2288 else
2289 -- Found the beginning of a non-attribute object,
2290 -- rebuild last line and pass it back to the caller
2291 -- (ak_on_objects_pvt.upload).
2292 p_buffer_out := 'BEGIN ' || l_token || ' ' || l_buffer;
2293 l_more_attr := FALSE;
2294 end if;
2295 elsif (l_state = 2) then
2296 if (l_token is not null) then
2297 l_attribute_rec.attribute_application_id := to_number(l_token);
2298 l_state := 3;
2299 else
2300 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2301 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
2302 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2303 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2304 FND_MESSAGE.SET_TOKEN('EXPECTED','ATTRIBUTE_APPLICATION_ID');
2305 FND_MSG_PUB.Add;
2306 end if;
2307 -- dbms_output.put_line('Expecting attribute application ID');
2308 raise FND_API.G_EXC_ERROR;
2309 end if;
2310 elsif (l_state = 3) then
2311 if (l_token is not null) then
2312 l_attribute_rec.attribute_code := l_token;
2313 l_value_count := null;
2314 l_state := 10;
2315 else
2316 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2317 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
2318 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2319 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2320 FND_MESSAGE.SET_TOKEN('EXPECTED','ATTRIBUTE_CODE');
2321 FND_MSG_PUB.Add;
2322 end if;
2323 --dbms_output.put_line('Expecting attribute code');
2324 raise FND_API.G_EXC_ERROR;
2325 end if;
2326 elsif (l_state = 10) then
2327 if (l_token = 'END') then
2328 l_state := 19;
2329 elsif (l_token = 'ATTRIBUTE_LABEL_LENGTH') or
2330 (l_token = 'ATTRIBUTE_VALUE_LENGTH') or
2331 (l_token = 'BOLD') or
2332 (l_token = 'ITALIC') or
2333 (l_token = 'VERTICAL_ALIGNMENT') or
2334 (l_token = 'HORIZONTAL_ALIGNMENT') or
2335 (l_token = 'DATA_TYPE') or
2336 (l_token = 'UPPER_CASE_FLAG') or
2337 (l_token = 'DEFAULT_VALUE_VARCHAR2') or
2338 (l_token = 'DEFAULT_VALUE_NUMBER') or
2339 (l_token = 'DEFAULT_VALUE_DATE') or
2340 (l_token = 'LOV_REGION') or
2341 (l_token = 'ITEM_STYLE') or
2342 (l_token = 'DISPLAY_HEIGHT') or
2343 (l_token = 'CSS_CLASS_NAME') or
2344 (l_token = 'POPLIST_VIEWOBJECT') or
2345 (l_token = 'POPLIST_DISPLAY_ATTRIBUTE') or
2346 (l_token = 'POPLIST_VALUE_ATTRIBUTE') or
2347 (l_token = 'CSS_LABEL_CLASS_NAME') or
2348 (l_token = 'PRECISION') or
2349 (l_token = 'EXPANSION') or
2350 (l_token = 'ALS_MAX_LENGTH') or
2351 (l_token = 'ATTRIBUTE_CATEGORY') or
2352 (l_token = 'ATTRIBUTE1') or
2353 (l_token = 'ATTRIBUTE2') or
2354 (l_token = 'ATTRIBUTE3') or
2355 (l_token = 'ATTRIBUTE4') or
2356 (l_token = 'ATTRIBUTE5') or
2357 (l_token = 'ATTRIBUTE6') or
2358 (l_token = 'ATTRIBUTE7') or
2359 (l_token = 'ATTRIBUTE8') or
2360 (l_token = 'ATTRIBUTE9') or
2361 (l_token = 'ATTRIBUTE10') or
2362 (l_token = 'ATTRIBUTE11') or
2363 (l_token = 'ATTRIBUTE12') or
2364 (l_token = 'ATTRIBUTE13') or
2365 (l_token = 'ATTRIBUTE14') or
2366 (l_token = 'ATTRIBUTE15') or
2367 (l_token = 'CREATED_BY') or
2368 (l_token = 'CREATION_DATE') or
2369 (l_token = 'LAST_UPDATED_BY') or
2370 (l_token = 'OWNER') or
2371 (l_token = 'LAST_UPDATE_DATE') or
2372 (l_token = 'LAST_UPDATE_LOGIN') or
2373 (l_token = 'ATTRIBUTE_LABEL_LONG') or
2374 (l_token = 'ATTRIBUTE_LABEL_SHORT') or
2375 (l_token = 'NAME') or
2376 (l_token = 'DESCRIPTION') then
2377 l_column := l_token;
2378 l_state := 11;
2379 else
2380 --
2381 -- error if not expecting attribute values added by the translation team
2382 -- or if we have read in more than a certain number of values
2383 -- for the same DB column
2384 --
2385 l_value_count := l_value_count + 1;
2386 --
2387 -- save second value. It will be the token with error if
2388 -- it turns out that there is a parse error on this line.
2389 --
2390 if (l_value_count = 2) then
2391 l_saved_token := l_token;
2392 end if;
2393 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
2394 (l_value_count is null) then
2395 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2396 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
2397 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2398 if (l_value_count is null) then
2399 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
2400 else
2401 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
2402 end if;
2403 FND_MESSAGE.SET_TOKEN('EXPECTED','ATTRIBUTE');
2404 FND_MSG_PUB.Add;
2405 end if;
2406 -- dbms_output.put_line('Expecting attribute field or END');
2407 raise FND_API.G_EXC_ERROR;
2408 end if;
2409 end if;
2410 elsif (l_state = 11) then
2411 if (l_token = '=') then
2412 l_state := 12;
2413 else
2414 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2415 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
2416 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2417 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2418 FND_MESSAGE.SET_TOKEN('EXPECTED','=');
2419 FND_MSG_PUB.Add;
2420 end if;
2421 raise FND_API.G_EXC_ERROR;
2422 end if;
2423 elsif (l_state = 12) then
2424 l_value_count := 1;
2425 if (l_column = 'ATTRIBUTE_LABEL_LENGTH') then
2426 l_attribute_rec.attribute_label_length := to_number(l_token);
2427 l_state := 10;
2428 elsif (l_column = 'ATTRIBUTE_VALUE_LENGTH') then
2429 l_attribute_rec.attribute_value_length := to_number(l_token);
2430 l_state := 10;
2431 elsif (l_column = 'BOLD') then
2432 l_attribute_rec.bold := l_token;
2433 l_state := 10;
2434 elsif (l_column = 'ITALIC')then
2435 l_attribute_rec.italic := l_token;
2436 l_state := 10;
2437 elsif (l_column = 'VERTICAL_ALIGNMENT') then
2438 l_attribute_rec.vertical_alignment := l_token;
2439 l_state := 10;
2440 elsif (l_column = 'HORIZONTAL_ALIGNMENT') then
2441 l_attribute_rec.horizontal_alignment := l_token;
2442 l_state := 10;
2443 elsif (l_column = 'DATA_TYPE') then
2444 l_attribute_rec.data_type := l_token;
2445 l_state := 10;
2446 elsif (l_column = 'UPPER_CASE_FLAG') then
2447 l_attribute_rec.upper_case_flag := l_token;
2448 l_state := 10;
2449 elsif (l_column = 'DEFAULT_VALUE_VARCHAR2') then
2450 l_attribute_rec.default_value_varchar2 := l_token;
2451 l_state := 10;
2452 elsif (l_column = 'DEFAULT_VALUE_NUMBER') then
2453 l_attribute_rec.default_value_number := to_number(l_token);
2454 l_state := 10;
2455 elsif (l_column = 'DEFAULT_VALUE_DATE') then
2456 l_attribute_rec.default_value_date := to_date(l_token,
2457 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
2458 l_state := 10;
2459 elsif (l_column = 'LOV_REGION') then
2460 l_attribute_rec.lov_region_application_id := to_number(l_token);
2461 l_state := 14;
2462 elsif (l_column = 'ITEM_STYLE') then
2463 l_attribute_rec.item_style := l_token;
2464 l_state := 10;
2465 elsif (l_column = 'DISPLAY_HEIGHT') then
2466 l_attribute_rec.display_height := to_number(l_token);
2467 l_state := 10;
2468 elsif (l_column = 'CSS_CLASS_NAME') then
2469 l_attribute_rec.css_class_name := l_token;
2470 l_state := 10;
2471 elsif (l_column = 'POPLIST_VIEWOBJECT') then
2472 l_attribute_rec.poplist_viewobject := l_token;
2473 l_state := 10;
2474 elsif (l_column = 'POPLIST_DISPLAY_ATTRIBUTE') then
2475 l_attribute_rec.poplist_display_attribute := l_token;
2476 l_state := 10;
2477 elsif (l_column = 'POPLIST_VALUE_ATTRIBUTE') then
2478 l_attribute_rec.poplist_value_attribute := l_token;
2479 l_state := 10;
2480 elsif (l_column = 'CSS_LABEL_CLASS_NAME') then
2481 l_attribute_rec.css_label_class_name := l_token;
2482 l_state := 10;
2483 elsif (l_column = 'PRECISION') then
2484 l_attribute_rec.precision := l_token;
2485 l_state := 10;
2486 elsif (l_column = 'EXPANSION') then
2487 l_attribute_rec.expansion := to_number(l_token);
2488 l_state := 10;
2489 elsif (l_column = 'ALS_MAX_LENGTH') then
2490 l_attribute_rec.als_max_length := to_number(l_token);
2491 l_state := 10;
2492 elsif (l_column = 'ATTRIBUTE_CATEGORY') then
2493 l_attribute_rec.attribute_category := l_token;
2494 l_state := 10;
2495 elsif (l_column = 'ATTRIBUTE1') then
2496 l_attribute_rec.attribute1 := l_token;
2497 l_state := 10;
2498 elsif (l_column = 'ATTRIBUTE2') then
2499 l_attribute_rec.attribute2 := l_token;
2500 l_state := 10;
2501 elsif (l_column = 'ATTRIBUTE3') then
2502 l_attribute_rec.attribute3 := l_token;
2503 l_state := 10;
2504 elsif (l_column = 'ATTRIBUTE4') then
2505 l_attribute_rec.attribute4 := l_token;
2506 l_state := 10;
2507 elsif (l_column = 'ATTRIBUTE5') then
2508 l_attribute_rec.attribute5 := l_token;
2509 l_state := 10;
2510 elsif (l_column = 'ATTRIBUTE6') then
2511 l_attribute_rec.attribute6 := l_token;
2512 l_state := 10;
2513 elsif (l_column = 'ATTRIBUTE7') then
2514 l_attribute_rec.attribute7 := l_token;
2515 l_state := 10;
2516 elsif (l_column = 'ATTRIBUTE8') then
2517 l_attribute_rec.attribute8 := l_token;
2518 l_state := 10;
2519 elsif (l_column = 'ATTRIBUTE9') then
2520 l_attribute_rec.attribute9 := l_token;
2521 l_state := 10;
2522 elsif (l_column = 'ATTRIBUTE10') then
2523 l_attribute_rec.attribute10 := l_token;
2524 l_state := 10;
2525 elsif (l_column = 'ATTRIBUTE11') then
2526 l_attribute_rec.attribute11 := l_token;
2527 l_state := 10;
2528 elsif (l_column = 'ATTRIBUTE12') then
2529 l_attribute_rec.attribute12 := l_token;
2530 l_state := 10;
2531 elsif (l_column = 'ATTRIBUTE13') then
2532 l_attribute_rec.attribute13 := l_token;
2533 l_state := 10;
2534 elsif (l_column = 'ATTRIBUTE14') then
2535 l_attribute_rec.attribute14 := l_token;
2536 l_state := 10;
2537 elsif (l_column = 'ATTRIBUTE15') then
2538 l_attribute_rec.attribute15 := l_token;
2539 l_state := 10;
2540 elsif (l_column = 'CREATED_BY') then
2541 l_attribute_rec.created_by := to_number(l_token);
2542 l_state := 10;
2543 elsif (l_column = 'CREATION_DATE') then
2544 l_attribute_rec.creation_date := to_date(l_token,
2545 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
2546 l_state := 10;
2547 elsif (l_column = 'LAST_UPDATED_BY') then
2548 l_attribute_rec.last_updated_by := to_number(l_token);
2549 l_state := 10;
2550 elsif (l_column = 'OWNER') then
2551 l_attribute_rec.last_updated_by := FND_LOAD_UTIL.OWNER_ID(l_token);
2552 l_state := 10;
2553 elsif (l_column = 'LAST_UPDATE_DATE') then
2554 l_attribute_rec.last_update_date := to_date(l_token,
2555 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
2556 l_state := 10;
2557 elsif (l_column = 'LAST_UPDATE_LOGIN') then
2558 l_attribute_rec.last_update_login := to_number(l_token);
2559 l_state := 10;
2560 elsif (l_column = 'ATTRIBUTE_LABEL_SHORT') then
2561 l_attribute_tl_rec.attribute_label_short := l_token;
2562 l_state := 10;
2563 elsif (l_column = 'ATTRIBUTE_LABEL_LONG') then
2564 l_attribute_tl_rec.attribute_label_long := l_token;
2565 l_state := 10;
2566 elsif (l_column = 'NAME') then
2567 l_attribute_tl_rec.name := l_token;
2568 l_state := 10;
2569 elsif (l_column = 'DESCRIPTION') then
2570 l_attribute_tl_rec.description := l_token;
2571 l_state := 10;
2572 else
2573 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2574 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
2575 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2576 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2577 FND_MESSAGE.SET_TOKEN('EXPECTED',l_column);
2578 FND_MSG_PUB.Add;
2579 end if;
2580 --dbms_output.put_line('Expecting ' || l_column || ' value');
2581 raise FND_API.G_EXC_ERROR;
2582 end if;
2583 elsif (l_state = 14) then
2584 if (l_column = 'LOV_REGION') then
2585 l_attribute_rec.lov_region_code := l_token;
2586 l_state := 10;
2587 else
2588 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2589 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
2590 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2591 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2592 FND_MESSAGE.SET_TOKEN('EXPECTED',l_column);
2593 FND_MSG_PUB.Add;
2594 end if;
2595 --dbms_output.put_line('Expecting ' || l_column || ' value');
2596 raise FND_API.G_EXC_ERROR;
2597 end if;
2598 elsif (l_state = 19) then
2599 if (l_token = 'ATTRIBUTE') then
2600 if AK_ATTRIBUTE_PVT.ATTRIBUTE_EXISTS (
2601 p_api_version_number => 1.0,
2602 p_return_status => l_return_status,
2603 p_attribute_application_id=>
2604 l_attribute_rec.attribute_application_id,
2605 p_attribute_code => l_attribute_rec.attribute_code) then
2606 --
2607 -- do not update customized data
2608 if (AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE) then
2609 select aa.last_updated_by, aat.last_updated_by,
2610 aa.last_update_date, aat.last_update_date
2611 into l_user_id1, l_user_id2, l_update1, l_update2
2612 from ak_attributes aa, ak_attributes_tl aat
2613 where aa.attribute_code = l_attribute_rec.attribute_code
2614 and aa.attribute_application_id = l_attribute_rec.attribute_application_id
2615 and aa.attribute_code = aat.attribute_code
2616 and aa.attribute_application_id = aat.attribute_application_id
2617 and aat.language = userenv('LANG');
2618
2619 /*if (( l_user_id1 = 1 or l_user_id1 = 2) and
2620 (l_user_id2 = 1 or l_user_id2 = 2)) then*/
2621 if (AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
2622 p_loader_timestamp => p_loader_timestamp,
2623 p_created_by => l_attribute_rec.created_by,
2624 p_creation_date => l_attribute_rec.creation_date,
2625 p_last_updated_by => l_attribute_rec.last_updated_by,
2626 p_db_last_updated_by => l_user_id1,
2627 p_last_update_date => l_attribute_rec.last_update_date,
2628 p_db_last_update_date => l_update1,
2629 p_last_update_login => l_attribute_rec.last_update_login,
2630 p_create_or_update => 'UPDATE') and
2631
2632 AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
2633 p_loader_timestamp => p_loader_timestamp,
2634 p_created_by => l_attribute_rec.created_by,
2635 p_creation_date => l_attribute_rec.creation_date,
2636 p_last_updated_by => l_attribute_rec.last_updated_by,
2637 p_db_last_updated_by => l_user_id2,
2638 p_last_update_date => l_attribute_rec.last_update_date,
2639 p_db_last_update_date => l_update2,
2640 p_last_update_login => l_attribute_rec.last_update_login,
2641 p_create_or_update => 'UPDATE')) then
2642
2643 AK_ATTRIBUTE_PVT.UPDATE_ATTRIBUTE (
2644 p_validation_level => p_validation_level,
2645 p_api_version_number => 1.0,
2646 p_msg_count => l_msg_count,
2647 p_msg_data => l_msg_data,
2648 p_return_status => l_return_status,
2649 p_attribute_application_id =>
2650 l_attribute_rec.attribute_application_id,
2651 p_attribute_code => l_attribute_rec.attribute_code,
2652 p_attribute_label_length => l_attribute_rec.attribute_label_length,
2653 p_attribute_value_length => l_attribute_rec.attribute_value_length,
2654 p_bold => l_attribute_rec.bold,
2655 p_italic => l_attribute_rec.italic,
2656 p_vertical_alignment => l_attribute_rec.vertical_alignment,
2657 p_horizontal_alignment => l_attribute_rec.horizontal_alignment,
2658 p_data_type => l_attribute_rec.data_type,
2659 p_precision => l_attribute_rec.precision,
2660 p_upper_case_flag => l_attribute_rec.upper_case_flag,
2661 p_default_value_varchar2 => l_attribute_rec.default_value_varchar2,
2662 p_default_value_number => l_attribute_rec.default_value_number,
2663 p_default_value_date => l_attribute_rec.default_value_date,
2664 p_lov_region_application_id =>
2665 l_attribute_rec.lov_region_application_id,
2666 p_lov_region_code => l_attribute_rec.lov_region_code,
2667 p_item_style => l_attribute_rec.item_style,
2668 p_display_height => l_attribute_rec.display_height,
2669 p_css_class_name => l_attribute_rec.css_class_name,
2670 p_poplist_viewobject => l_attribute_rec.poplist_viewobject,
2671 p_poplist_display_attr => l_attribute_rec.poplist_display_attribute,
2672 p_poplist_value_attr => l_attribute_rec.poplist_value_attribute,
2673 p_css_label_class_name => l_attribute_rec.css_label_class_name,
2674 p_attribute_category => l_attribute_rec.attribute_category,
2675 p_expansion => l_attribute_rec.expansion,
2676 p_als_max_length => l_attribute_rec.als_max_length,
2677 p_attribute1 => l_attribute_rec.attribute1,
2678 p_attribute2 => l_attribute_rec.attribute2,
2679 p_attribute3 => l_attribute_rec.attribute3,
2680 p_attribute4 => l_attribute_rec.attribute4,
2681 p_attribute5 => l_attribute_rec.attribute5,
2682 p_attribute6 => l_attribute_rec.attribute6,
2683 p_attribute7 => l_attribute_rec.attribute7,
2684 p_attribute8 => l_attribute_rec.attribute8,
2685 p_attribute9 => l_attribute_rec.attribute9,
2686 p_attribute10 => l_attribute_rec.attribute10,
2687 p_attribute11 => l_attribute_rec.attribute11,
2688 p_attribute12 => l_attribute_rec.attribute12,
2689 p_attribute13 => l_attribute_rec.attribute13,
2690 p_attribute14 => l_attribute_rec.attribute14,
2691 p_attribute15 => l_attribute_rec.attribute15,
2692 p_created_by => l_attribute_rec.created_by,
2693 p_creation_date => l_attribute_rec.creation_date,
2694 p_last_updated_by => l_attribute_rec.last_updated_by,
2695 p_last_update_date => l_attribute_rec.last_update_date,
2696 p_last_update_login => l_attribute_rec.last_update_login,
2697
2698 p_name => l_attribute_tl_rec.name,
2699 p_attribute_label_long => l_attribute_tl_rec.attribute_label_long,
2700 p_attribute_label_short =>l_attribute_tl_rec.attribute_label_short,
2701 p_description => l_attribute_tl_rec.description,
2702 p_loader_timestamp => p_loader_timestamp,
2703 p_pass => p_pass,
2704 p_copy_redo_flag => l_copy_redo_flag
2705 );
2706 end if; /* l_user_id */
2707 -- update all records --
2708 --
2709 -- Update record only if Update mode is set to true
2710 --
2711 elsif (AK_UPLOAD_GRP.G_UPDATE_MODE) then
2712 AK_ATTRIBUTE_PVT.UPDATE_ATTRIBUTE (
2713 p_validation_level => p_validation_level,
2714 p_api_version_number => 1.0,
2715 p_msg_count => l_msg_count,
2716 p_msg_data => l_msg_data,
2717 p_return_status => l_return_status,
2718 p_attribute_application_id =>
2719 l_attribute_rec.attribute_application_id,
2720 p_attribute_code => l_attribute_rec.attribute_code,
2721 p_attribute_label_length => l_attribute_rec.attribute_label_length,
2722 p_attribute_value_length => l_attribute_rec.attribute_value_length,
2723 p_bold => l_attribute_rec.bold,
2724 p_italic => l_attribute_rec.italic,
2725 p_vertical_alignment => l_attribute_rec.vertical_alignment,
2726 p_horizontal_alignment => l_attribute_rec.horizontal_alignment,
2727 p_data_type => l_attribute_rec.data_type,
2728 p_precision => l_attribute_rec.precision,
2729 p_upper_case_flag => l_attribute_rec.upper_case_flag,
2730 p_default_value_varchar2 => l_attribute_rec.default_value_varchar2,
2731 p_default_value_number => l_attribute_rec.default_value_number,
2732 p_default_value_date => l_attribute_rec.default_value_date,
2733 p_lov_region_application_id =>
2734 l_attribute_rec.lov_region_application_id,
2735 p_lov_region_code => l_attribute_rec.lov_region_code,
2736 p_item_style => l_attribute_rec.item_style,
2737 p_display_height => l_attribute_rec.display_height,
2738 p_css_class_name => l_attribute_rec.css_class_name,
2739 p_poplist_viewobject => l_attribute_rec.poplist_viewobject,
2740 p_poplist_display_attr => l_attribute_rec.poplist_display_attribute,
2741 p_poplist_value_attr => l_attribute_rec.poplist_value_attribute,
2742 p_css_label_class_name => l_attribute_rec.css_label_class_name,
2743 p_expansion => l_attribute_rec.expansion,
2744 p_als_max_length => l_attribute_rec.als_max_length,
2745 p_attribute_category => l_attribute_rec.attribute_category,
2746 p_attribute1 => l_attribute_rec.attribute1,
2747 p_attribute2 => l_attribute_rec.attribute2,
2748 p_attribute3 => l_attribute_rec.attribute3,
2749 p_attribute4 => l_attribute_rec.attribute4,
2750 p_attribute5 => l_attribute_rec.attribute5,
2751 p_attribute6 => l_attribute_rec.attribute6,
2752 p_attribute7 => l_attribute_rec.attribute7,
2753 p_attribute8 => l_attribute_rec.attribute8,
2754 p_attribute9 => l_attribute_rec.attribute9,
2755 p_attribute10 => l_attribute_rec.attribute10,
2756 p_attribute11 => l_attribute_rec.attribute11,
2757 p_attribute12 => l_attribute_rec.attribute12,
2758 p_attribute13 => l_attribute_rec.attribute13,
2759 p_attribute14 => l_attribute_rec.attribute14,
2760 p_attribute15 => l_attribute_rec.attribute15,
2761 p_created_by => l_attribute_rec.created_by,
2762 p_creation_date => l_attribute_rec.creation_date,
2763 p_last_updated_by => l_attribute_rec.last_updated_by,
2764 p_last_update_date => l_attribute_rec.last_update_date,
2765 p_last_update_login => l_attribute_rec.last_update_login,
2766 p_name => l_attribute_tl_rec.name,
2767 p_attribute_label_long => l_attribute_tl_rec.attribute_label_long,
2768 p_attribute_label_short =>l_attribute_tl_rec.attribute_label_short,
2769 p_description => l_attribute_tl_rec.description,
2770 p_loader_timestamp => p_loader_timestamp,
2771 p_pass => p_pass,
2772 p_copy_redo_flag => l_copy_redo_flag
2773 );
2774 end if; -- /* if G_UPDATE_MODE G_NC_UPDATE_MODE*/
2775 else
2776 AK_ATTRIBUTE_PVT.CREATE_ATTRIBUTE (
2777 p_validation_level => p_validation_level,
2778 p_api_version_number => 1.0,
2779 p_msg_count => l_msg_count,
2780 p_msg_data => l_msg_data,
2781 p_return_status => l_return_status,
2782 p_attribute_application_id =>
2783 l_attribute_rec.attribute_application_id,
2784 p_attribute_code => l_attribute_rec.attribute_code,
2785 p_attribute_label_length => l_attribute_rec.attribute_label_length,
2786 p_attribute_value_length => l_attribute_rec.attribute_value_length,
2787 p_bold => l_attribute_rec.bold,
2788 p_italic => l_attribute_rec.italic,
2789 p_vertical_alignment => l_attribute_rec.vertical_alignment,
2790 p_horizontal_alignment => l_attribute_rec.horizontal_alignment,
2791 p_data_type => l_attribute_rec.data_type,
2792 p_precision => l_attribute_rec.precision,
2793 p_upper_case_flag => l_attribute_rec.upper_case_flag,
2794 p_default_value_varchar2 => l_attribute_rec.default_value_varchar2,
2795 p_default_value_number => l_attribute_rec.default_value_number,
2796 p_default_value_date => l_attribute_rec.default_value_date,
2797 p_lov_region_application_id =>
2798 l_attribute_rec.lov_region_application_id,
2799 p_lov_region_code => l_attribute_rec.lov_region_code,
2800 p_item_style => l_attribute_rec.item_style,
2801 p_display_height => l_attribute_rec.display_height,
2802 p_css_class_name => l_attribute_rec.css_class_name,
2803 p_poplist_viewobject => l_attribute_rec.poplist_viewobject,
2804 p_poplist_display_attr => l_attribute_rec.poplist_display_attribute,
2805 p_poplist_value_attr => l_attribute_rec.poplist_value_attribute,
2806 p_css_label_class_name => l_attribute_rec.css_label_class_name,
2807 p_expansion => l_attribute_rec.expansion,
2808 p_als_max_length => l_attribute_rec.als_max_length,
2809 p_attribute_category => l_attribute_rec.attribute_category,
2810 p_attribute1 => l_attribute_rec.attribute1,
2811 p_attribute2 => l_attribute_rec.attribute2,
2812 p_attribute3 => l_attribute_rec.attribute3,
2813 p_attribute4 => l_attribute_rec.attribute4,
2814 p_attribute5 => l_attribute_rec.attribute5,
2815 p_attribute6 => l_attribute_rec.attribute6,
2816 p_attribute7 => l_attribute_rec.attribute7,
2817 p_attribute8 => l_attribute_rec.attribute8,
2818 p_attribute9 => l_attribute_rec.attribute9,
2819 p_attribute10 => l_attribute_rec.attribute10,
2820 p_attribute11 => l_attribute_rec.attribute11,
2821 p_attribute12 => l_attribute_rec.attribute12,
2822 p_attribute13 => l_attribute_rec.attribute13,
2823 p_attribute14 => l_attribute_rec.attribute14,
2824 p_attribute15 => l_attribute_rec.attribute15,
2825 p_created_by => l_attribute_rec.created_by,
2826 p_creation_date => l_attribute_rec.creation_date,
2827 p_last_updated_by => l_attribute_rec.last_updated_by,
2828 p_last_update_date => l_attribute_rec.last_update_date,
2829 p_last_update_login => l_attribute_rec.last_update_login,
2830 p_name => l_attribute_tl_rec.name,
2831 p_attribute_label_long => l_attribute_tl_rec.attribute_label_long,
2832 p_attribute_label_short =>l_attribute_tl_rec.attribute_label_short,
2833 p_description => l_attribute_tl_rec.description,
2834 p_loader_timestamp => p_loader_timestamp,
2835 p_pass => p_pass,
2836 p_copy_redo_flag => l_copy_redo_flag
2837 );
2838 end if; -- /* if ATTRIBUTE_EXISTS */
2839 --
2840 -- If API call returns with an error status, upload aborts
2841 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2842 (l_return_status = FND_API.G_RET_STS_ERROR) then
2843 RAISE FND_API.G_EXC_ERROR;
2844 end if; -- /* if l_return_status */
2845 --
2846 -- if validation fails, then this record should go to second pass
2847 if (l_copy_redo_flag) then
2848 G_ATTRIBUTE_REDO_INDEX := G_ATTRIBUTE_REDO_INDEX + 1;
2849 G_ATTRIBUTE_REDO_TBL(G_ATTRIBUTE_REDO_INDEX) := l_attribute_rec;
2850 G_ATTRIBUTE_TL_REDO_TBL(G_ATTRIBUTE_REDO_INDEX) := l_attribute_tl_rec;
2851 l_copy_redo_flag := FALSE;
2852 end if; --/* if l_copy_redo_flag */
2853 l_state := 0;
2854 else
2855 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2856 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
2857 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2858 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
2859 FND_MESSAGE.SET_TOKEN('EXPECTED','ATTRIBUTE');
2860 FND_MSG_PUB.Add;
2861 end if;
2862 raise FND_API.G_EXC_ERROR;
2863 end if;
2864 end if;
2865
2866 --
2867 -- Get rid of leading white spaces, so that buffer would become
2868 -- null if the only thing in it are white spaces
2869 --
2870 l_buffer := LTRIM(l_buffer);
2871
2872 --
2873 -- Get the next non-blank, non-comment line if current line is
2874 -- fully parsed
2875 --
2876 while (l_buffer is null and l_eof_flag = 'N' and p_index <= AK_ON_OBJECTS_PVT.G_UPL_TABLE_NUM) loop
2877 AK_ON_OBJECTS_PVT.READ_LINE (
2878 p_return_status => l_return_status,
2879 p_index => p_index,
2880 p_buffer => l_buffer,
2881 p_lines_read => l_lines_read,
2882 p_eof_flag => l_eof_flag,
2883 p_upl_loader_cur => p_upl_loader_cur
2884 );
2885
2886 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2887 (l_return_status = FND_API.G_RET_STS_ERROR) then
2888 RAISE FND_API.G_EXC_ERROR;
2889 end if;
2890 l_line_num := l_line_num + l_lines_read;
2891 --
2892 -- trim leading spaces and discard comment lines
2893 --
2894 l_buffer := LTRIM(l_buffer);
2895 if (SUBSTR(l_buffer, 1, 1) = '#') then
2896 l_buffer := null;
2897 end if;
2898 end loop;
2899
2900 end LOOP;
2901
2902 -- If the loops end in a state other then at the end of an attribute
2903 -- (state 0) or when the beginning of another business object was
2904 -- detected, then the file must have ended prematurely, which is an error
2905 --
2906 if (l_state <> 0) and (l_more_attr) then
2907 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2908 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
2909 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
2910 FND_MESSAGE.SET_TOKEN('TOKEN','END OF FILE');
2911 FND_MESSAGE.SET_TOKEN('EXPECTED',null);
2912 FND_MSG_PUB.Add;
2913 end if;
2914 --dbms_output.put_line('Unexpected END OF FILE: state is ' ||
2915 -- to_char(l_state));
2916 raise FND_API.G_EXC_ERROR;
2917 end if;
2918
2919 --
2920 -- Load line number of the last file line processed
2921 --
2922 p_line_num_out := l_line_num;
2923
2924 p_return_status := FND_API.G_RET_STS_SUCCESS;
2925
2926 -- dbms_output.put_line('Leaving attribute upload: ' ||
2927 -- to_char(sysdate, 'MON-DD HH24:MI:SS'));
2928
2929 EXCEPTION
2930 WHEN FND_API.G_EXC_ERROR THEN
2931 p_return_status := FND_API.G_RET_STS_ERROR;
2932 WHEN VALUE_ERROR THEN
2933 p_return_status := FND_API.G_RET_STS_ERROR;
2934 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_VALUE_ERROR');
2935 FND_MESSAGE.SET_TOKEN('KEY',to_char(l_attribute_rec.attribute_application_id) ||
2936 ' ' || l_attribute_rec.attribute_code);
2937 FND_MSG_PUB.Add;
2938 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
2939 SUBSTR (SQLERRM, 1, 240)||': '||l_column||'='||l_token );
2940 FND_MSG_PUB.Add;
2941 WHEN OTHERS THEN
2942 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2943 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
2944 SUBSTR (SQLERRM, 1, 240) );
2945 FND_MSG_PUB.Add;
2946 end UPLOAD_ATTRIBUTE;
2947
2948 --=======================================================
2949 -- Procedure INSERT_ATTRIBUTE_PK_TABLE
2950 --
2951 -- Usage Private API for inserting the given attribute's
2952 -- primary key value into the given attribute
2953 -- table.
2954 -- This API should only be called by other APIs
2955 -- that are owned by the Core Modules Team (AK).
2956 --
2957 -- Desc This API inserts the given attribute primary
2958 -- key value into a given attribute table
2959 -- (of type Attribute_PK_Tbl_Type) only if the
2960 -- primary key does not already exist in the table.
2961 --
2962 -- Results The API returns the standard p_return_status parameter
2963 -- indicating one of the standard return statuses :
2964 -- * Unexpected error
2965 -- * Error
2966 -- * Success
2967 -- Parameters p_attribute_application_id : IN required
2968 -- Application ID of the attribute to be inserted to the
2969 -- table.
2970 -- p_attribute_code : IN required
2971 -- Application code of the attribute to be inserted to the
2972 -- table.
2973 -- p_attribute_pk_tbl : IN OUT
2974 -- Attribute table to be updated.
2975 --
2976 -- Version Initial version number = 1.0
2977 -- History Current version number = 1.0
2978 --=======================================================
2979 procedure INSERT_ATTRIBUTE_PK_TABLE (
2980 p_return_status OUT NOCOPY VARCHAR2,
2981 p_attribute_application_id IN NUMBER,
2982 p_attribute_code IN VARCHAR2,
2983 p_attribute_pk_tbl IN OUT NOCOPY AK_ATTRIBUTE_PUB.Attribute_PK_Tbl_Type
2984 ) is
2985 l_api_version_number CONSTANT number := 1.0;
2986 l_api_name CONSTANT varchar2(30) := 'Insert_Attribute_PK_Table';
2987 l_index NUMBER;
2988 begin
2989 --
2990 -- if table is empty, just insert the attribute primary key into it
2991 --
2992 if (p_attribute_pk_tbl.count = 0) then
2993 p_attribute_pk_tbl(1).attribute_appl_id := p_attribute_application_id;
2994 p_attribute_pk_tbl(1).attribute_code := p_attribute_code;
2995 return;
2996 end if;
2997
2998 --
2999 -- otherwise, insert the attribute to the end of the table if it is
3000 -- not already in the table. If it is already in the table, return
3001 -- without changing the table.
3002 --
3003 for l_index in p_attribute_pk_tbl.FIRST .. p_attribute_pk_tbl.LAST loop
3004 if (p_attribute_pk_tbl.exists(l_index)) then
3005 if (p_attribute_pk_tbl(l_index).attribute_appl_id = p_attribute_application_id)
3006 and
3007 (p_attribute_pk_tbl(l_index).attribute_code = p_attribute_code) then
3008 return;
3009 end if;
3010 end if;
3011 end loop;
3012
3013 l_index := p_attribute_pk_tbl.LAST + 1;
3014 p_attribute_pk_tbl(l_index).attribute_appl_id := p_attribute_application_id;
3015 p_attribute_pk_tbl(l_index).attribute_code := p_attribute_code;
3016
3017 EXCEPTION
3018 WHEN FND_API.G_EXC_ERROR THEN
3019 p_return_status := FND_API.G_RET_STS_ERROR;
3020 WHEN OTHERS THEN
3021 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3022 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
3023 SUBSTR (SQLERRM, 1, 240) );
3024 FND_MSG_PUB.Add;
3025 end INSERT_ATTRIBUTE_PK_TABLE;
3026
3027 --=======================================================
3028 -- Procedure UPDATE_ATTRIBUTE
3029 --
3030 -- Usage Private API for updating an attribute.
3031 -- This API should only be called by other APIs
3032 -- that are owned by the Core Modules Team (AK).
3033 --
3034 -- Desc This API updates an attribute using the given info
3035 --
3036 -- Results The API returns the standard p_return_status parameter
3037 -- indicating one of the standard return statuses :
3038 -- * Unexpected error
3039 -- * Error
3040 -- * Success
3041 -- Parameters Attribute columns
3042 -- p_loader_timestamp : IN optional
3043 -- If a timestamp is passed, the API will update the
3044 -- record using this timestamp. Only the upload API
3045 -- should call with this parameter loaded.
3046 -- p_temp_redo_tbl: IN required
3047 -- For saving records temporarily to see if it
3048 -- fails in first pass of upload. If it does,
3049 -- then the record is saved for second pass
3050 --
3051 -- Version Initial version number = 1.0
3052 -- History Current version number = 1.0
3053 --=======================================================
3054 procedure UPDATE_ATTRIBUTE (
3055 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3056 p_api_version_number IN NUMBER,
3057 p_init_msg_tbl IN BOOLEAN := FALSE,
3058 p_msg_count OUT NOCOPY NUMBER,
3059 p_msg_data OUT NOCOPY VARCHAR2,
3060 p_return_status OUT NOCOPY VARCHAR2,
3061 p_attribute_application_id IN NUMBER,
3062 p_attribute_code IN VARCHAR2,
3063 p_attribute_label_length IN NUMBER := FND_API.G_MISS_NUM,
3064 p_attribute_value_length IN NUMBER := FND_API.G_MISS_NUM,
3065 p_bold IN VARCHAR2 := FND_API.G_MISS_CHAR,
3066 p_italic IN VARCHAR2 := FND_API.G_MISS_CHAR,
3067 p_vertical_alignment IN VARCHAR2 := FND_API.G_MISS_CHAR,
3068 p_horizontal_alignment IN VARCHAR2 := FND_API.G_MISS_CHAR,
3069 p_data_type IN VARCHAR2 := FND_API.G_MISS_CHAR,
3070 p_upper_case_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
3071 p_default_value_varchar2 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3072 p_default_value_number IN NUMBER := FND_API.G_MISS_NUM,
3073 p_default_value_date IN DATE := FND_API.G_MISS_DATE,
3074 p_lov_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
3075 p_lov_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
3076 p_item_style IN VARCHAR2 := FND_API.G_MISS_CHAR,
3077 p_display_height IN NUMBER := FND_API.G_MISS_NUM,
3078 p_css_class_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
3079 p_poplist_viewobject IN VARCHAR2 := FND_API.G_MISS_CHAR,
3080 p_poplist_display_attr IN VARCHAR2 := FND_API.G_MISS_CHAR,
3081 p_poplist_value_attr IN VARCHAR2 := FND_API.G_MISS_CHAR,
3082 p_css_label_class_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
3083 p_precision IN NUMBER := FND_API.G_MISS_NUM,
3084 p_expansion IN NUMBER := FND_API.G_MISS_NUM,
3085 p_als_max_length IN NUMBER := FND_API.G_MISS_NUM,
3086 p_attribute_category IN VARCHAR2 := FND_API.G_MISS_CHAR,
3087 p_attribute1 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3088 p_attribute2 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3089 p_attribute3 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3090 p_attribute4 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3091 p_attribute5 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3092 p_attribute6 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3093 p_attribute7 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3094 p_attribute8 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3095 p_attribute9 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3096 p_attribute10 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3097 p_attribute11 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3098 p_attribute12 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3099 p_attribute13 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3100 p_attribute14 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3101 p_attribute15 IN VARCHAR2 := FND_API.G_MISS_CHAR,
3102 p_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
3103 p_attribute_label_long IN VARCHAR2 := FND_API.G_MISS_CHAR,
3104 p_attribute_label_short IN VARCHAR2 := FND_API.G_MISS_CHAR,
3105 p_description IN VARCHAR2 := FND_API.G_MISS_CHAR,
3106 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
3107 p_creation_date IN DATE := FND_API.G_MISS_DATE,
3108 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
3109 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
3110 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
3111 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
3112 p_pass IN NUMBER,
3113 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
3114 ) is
3115 cursor l_get_row_csr is
3116 select *
3117 from AK_ATTRIBUTES
3118 where ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
3119 and ATTRIBUTE_CODE = p_attribute_code
3120 for update of ATTRIBUTE_APPLICATION_ID;
3121 cursor l_get_tl_row_csr (lang_parm varchar2) is
3122 select *
3123 from AK_ATTRIBUTES_TL
3124 where ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
3125 and ATTRIBUTE_CODE = p_attribute_code
3126 and LANGUAGE = lang_parm
3127 for update of ATTRIBUTE_APPLICATION_ID;
3128 cursor l_check_navigation_csr is
3129 select 1
3130 from AK_OBJECT_ATTRIBUTE_NAVIGATION
3131 where ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
3132 and ATTRIBUTE_CODE = p_attribute_code;
3133 cursor l_check_attr_value_csr is
3134 select 1
3135 from AK_INST_ATTRIBUTE_VALUES
3136 where ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
3137 and ATTRIBUTE_CODE = p_attribute_code;
3138 cursor l_check_page_region_item_csr is
3139 select 1
3140 from AK_FLOW_PAGE_REGION_ITEMS ri
3141 where ri.to_url_attribute_appl_id = p_attribute_application_id
3142 and ri.to_url_attribute_code = p_attribute_code;
3143 l_api_version_number CONSTANT number := 1.0;
3144 l_api_name CONSTANT varchar2(30) := 'Update_Attribute';
3145 l_attributes_rec ak_attributes%ROWTYPE;
3146 l_attributes_tl_rec ak_attributes_tl%ROWTYPE;
3147 l_created_by number;
3148 l_creation_date date;
3149 l_dummy number;
3150 l_error boolean;
3151 l_lang varchar2(30);
3152 l_last_update_date date;
3153 l_last_update_login number;
3154 l_last_updated_by number;
3155 l_return_status varchar2(1);
3156 l_item_style varchar2(30) := 'TEXT';
3157 l_file_version number;
3158 begin
3159 IF NOT FND_API.Compatible_API_Call (
3160 l_api_version_number, p_api_version_number, l_api_name,
3161 G_PKG_NAME) then
3162 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3163 return;
3164 END IF;
3165
3166 -- Initialize the message table if requested.
3167
3168 if p_init_msg_tbl then
3169 FND_MSG_PUB.initialize;
3170 end if;
3171
3172 savepoint start_update_attribute;
3173
3174 select userenv('LANG') into l_lang
3175 from dual;
3176
3177 --
3178 -- retrieve ak_attributes row if it exists
3179 --
3180 open l_get_row_csr;
3181 fetch l_get_row_csr into l_attributes_rec;
3182 if (l_get_row_csr%notfound) then
3183 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
3184 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
3185 FND_MSG_PUB.Add;
3186 end if;
3187 close l_get_row_csr;
3188 raise FND_API.G_EXC_ERROR;
3189 end if;
3190 close l_get_row_csr;
3191
3192 --
3193 -- retrieve ak_attributes_tl row if it exists
3194 --
3195 open l_get_tl_row_csr(l_lang);
3196 fetch l_get_tl_row_csr into l_attributes_tl_rec;
3197 if (l_get_tl_row_csr%notfound) then
3198 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
3199 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_DOES_NOT_EXIST');
3200 FND_MSG_PUB.Add;
3201 end if;
3202 -- dbms_output.put_line('Error - TL Row does not exist');
3203 close l_get_tl_row_csr;
3204 raise FND_API.G_EXC_ERROR;
3205 end if;
3206 close l_get_tl_row_csr;
3207
3208 --
3209 -- validate table columns passed in
3210 --
3211 if (p_validation_level <> FND_API.G_VALID_LEVEL_NONE) then
3212 if not VALIDATE_ATTRIBUTE (
3213 p_validation_level => p_validation_level,
3214 p_api_version_number => 1.0,
3215 p_return_status => l_return_status,
3216 p_attribute_application_id => p_attribute_application_id,
3217 p_attribute_code => p_attribute_code,
3218 p_attribute_label_length => p_attribute_label_length,
3219 p_attribute_value_length => p_attribute_value_length,
3220 p_bold => p_bold,
3221 p_italic => p_italic,
3222 p_vertical_alignment => p_vertical_alignment,
3223 p_horizontal_alignment => p_horizontal_alignment,
3224 p_data_type => p_data_type,
3225 p_upper_case_flag => p_upper_case_flag,
3226 p_default_value_varchar2 => p_default_value_varchar2,
3227 p_default_value_number => p_default_value_number,
3228 p_default_value_date => p_default_value_date,
3229 p_lov_region_application_id => p_lov_region_application_id,
3230 p_lov_region_code => p_lov_region_code,
3231 p_name => p_name,
3232 p_attribute_label_long => p_attribute_label_long,
3233 p_attribute_label_short => p_attribute_label_short,
3234 p_description => p_description,
3235 p_caller => AK_ON_OBJECTS_PVT.G_UPDATE,
3236 p_pass => p_pass
3237 ) then
3238 if (p_pass = 1) then
3239 p_copy_redo_flag := TRUE;
3240 else
3241 raise FND_API.G_EXC_ERROR;
3242 end if; --/* if p_pass */
3243 end if;
3244 end if;
3245
3246 --** Additional validation logic for update **
3247
3248 -- - Cannot change data_type if there are attribute navigation,
3249 -- attribute value, or page region item data for this attribute
3250
3251 if ((p_data_type is not null) and (p_data_type <> FND_API.G_MISS_CHAR) and
3252 (p_data_type <> l_attributes_rec.data_type)) then
3253
3254 if (l_attributes_rec.data_type = 'URL') then
3255 /* see if any 'To URL attribute' in ak_flow_page_region_items */
3256 /* are using this URL-type object attribute */
3257 open l_check_page_region_item_csr;
3258 fetch l_check_page_region_item_csr into l_dummy;
3259 if (l_check_page_region_item_csr%found) then
3260 close l_check_page_region_item_csr;
3261 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3262 FND_MESSAGE.SET_NAME('AK','AK_CHANGE_DATA_TYPE');
3263 FND_MESSAGE.SET_TOKEN('FORM','AK_PAGE_REGION_LINKS', TRUE);
3264 FND_MSG_PUB.Add;
3265 end if;
3266 -- dbms_output.put_line(l_api_name || ' Cannot change data type');
3267 raise FND_API.G_EXC_ERROR;
3268 end if;
3269 close l_check_page_region_item_csr;
3270 else
3271 /* see if there are any attribute navigation for this non-URL type */
3272 /* object attribute */
3273 open l_check_navigation_csr;
3274 fetch l_check_navigation_csr into l_dummy;
3275 if (l_check_navigation_csr%found) then
3276 close l_check_navigation_csr;
3277 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3278 FND_MESSAGE.SET_NAME('AK','AK_CHANGE_DATA_TYPE');
3279 FND_MESSAGE.SET_TOKEN('FORM','AK_ATTRIBUTE_NAVIGATION', TRUE);
3280 FND_MSG_PUB.Add;
3281 end if;
3282 -- dbms_output.put_line(l_api_name || ' Cannot change data type');
3283 raise FND_API.G_EXC_ERROR;
3284 end if;
3285 close l_check_navigation_csr;
3286
3287 /* see if there are any attribute values for this non-URL type */
3288 /* object attribute */
3289 open l_check_attr_value_csr;
3290 fetch l_check_attr_value_csr into l_dummy;
3291 if (l_check_attr_value_csr%found) then
3292 close l_check_attr_value_csr;
3293 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3294 FND_MESSAGE.SET_NAME('AK','AK_CHANGE_DATA_TYPE');
3295 FND_MESSAGE.SET_TOKEN('FORM','AK_ATTRIBUTE_VALUE', TRUE);
3296 FND_MSG_PUB.Add;
3297 end if;
3298 raise FND_API.G_EXC_ERROR;
3299 end if;
3300 close l_check_attr_value_csr;
3301 end if;
3302 end if;
3303
3304 --
3305 -- Load record to be updated to the database
3306 -- - first load nullable columns
3307 --
3308 if (p_upper_case_flag <> FND_API.G_MISS_CHAR) or
3309 (p_upper_case_flag is null) then
3310 l_attributes_rec.upper_case_flag := p_upper_case_flag;
3311 end if;
3312 if (p_default_value_varchar2 <> FND_API.G_MISS_CHAR) or
3313 (p_default_value_varchar2 is null) then
3314 l_attributes_rec.default_value_varchar2 := p_default_value_varchar2;
3315 end if;
3316 if (p_default_value_number <> FND_API.G_MISS_NUM) or
3317 (p_default_value_number is null) then
3318 l_attributes_rec.default_value_number := p_default_value_number;
3319 end if;
3320 if (p_default_value_date <> FND_API.G_MISS_DATE) or
3321 (p_default_value_date is null) then
3322 l_attributes_rec.default_value_date := p_default_value_date;
3323 end if;
3324 if (p_lov_region_application_id <> FND_API.G_MISS_NUM) or
3325 (p_lov_region_application_id is null) then
3326 l_attributes_rec.lov_region_application_id := p_lov_region_application_id;
3327 end if;
3328 if (p_lov_region_code <> FND_API.G_MISS_CHAR) or
3329 (p_lov_region_code is null) then
3330 l_attributes_rec.lov_region_code := p_lov_region_code;
3331 end if;
3332 -- JSP new columns
3333 if (p_item_style <> FND_API.G_MISS_CHAR) and
3334 (p_item_style is not null) then
3335 l_attributes_rec.item_style := p_item_style;
3336 else
3337 l_attributes_rec.item_style := l_item_style;
3338 end if;
3339 if (p_display_height <> FND_API.G_MISS_NUM) or
3340 (p_display_height is null) then
3341 l_attributes_rec.display_height := p_display_height;
3342 end if;
3343 if (p_css_class_name <> FND_API.G_MISS_CHAR) or
3344 (p_css_class_name is null) then
3345 l_attributes_rec.css_class_name := p_css_class_name;
3346 end if;
3347 if (p_poplist_viewobject <> FND_API.G_MISS_CHAR) or
3348 (p_poplist_viewobject is null) then
3349 l_attributes_rec.poplist_viewobject := p_poplist_viewobject;
3350 end if;
3351 if (p_poplist_display_attr <> FND_API.G_MISS_CHAR) or
3352 (p_poplist_display_attr is null) then
3353 l_attributes_rec.poplist_display_attribute := p_poplist_display_attr;
3354 end if;
3355 if (p_poplist_value_attr <> FND_API.G_MISS_CHAR) or
3356 (p_poplist_value_attr is null) then
3357 l_attributes_rec.poplist_value_attribute := p_poplist_value_attr;
3358 end if;
3359 if (p_css_label_class_name <> FND_API.G_MISS_CHAR) or
3360 (p_css_label_class_name is null) then
3361 l_attributes_rec.css_label_class_name := p_css_label_class_name;
3362 end if;
3363 if (p_precision <> FND_API.G_MISS_NUM) or
3364 (p_precision is null) then
3365 l_attributes_rec.precision := p_precision;
3366 end if;
3367 if (p_expansion <> FND_API.G_MISS_NUM) or
3368 (p_expansion is null) then
3369 l_attributes_rec.expansion := p_expansion;
3370 end if;
3371 if (p_als_max_length <> FND_API.G_MISS_NUM) or
3372 (p_als_max_length is null) then
3373 l_attributes_rec.als_max_length := p_als_max_length;
3374 end if;
3375
3376 if (p_attribute_category <> FND_API.G_MISS_CHAR) or
3377 (p_attribute_category is null) then
3378 l_attributes_rec.attribute_category := p_attribute_category;
3379 end if;
3380 if (p_attribute1 <> FND_API.G_MISS_CHAR) or
3381 (p_attribute1 is null) then
3382 l_attributes_rec.attribute1 := p_attribute1;
3383 end if;
3384 if (p_attribute2 <> FND_API.G_MISS_CHAR) or
3385 (p_attribute2 is null) then
3386 l_attributes_rec.attribute2 := p_attribute2;
3387 end if;
3388 if (p_attribute3 <> FND_API.G_MISS_CHAR) or
3389 (p_attribute3 is null) then
3390 l_attributes_rec.attribute3 := p_attribute3;
3391 end if;
3392 if (p_attribute4 <> FND_API.G_MISS_CHAR) or
3393 (p_attribute4 is null) then
3394 l_attributes_rec.attribute4 := p_attribute4;
3395 end if;
3396 if (p_attribute5 <> FND_API.G_MISS_CHAR) or
3397 (p_attribute5 is null) then
3398 l_attributes_rec.attribute5 := p_attribute5;
3399 end if;
3400 if (p_attribute6 <> FND_API.G_MISS_CHAR) or
3401 (p_attribute6 is null) then
3402 l_attributes_rec.attribute6 := p_attribute6;
3403 end if;
3404 if (p_attribute7 <> FND_API.G_MISS_CHAR) or
3405 (p_attribute7 is null) then
3406 l_attributes_rec.attribute7 := p_attribute7;
3407 end if;
3408 if (p_attribute8 <> FND_API.G_MISS_CHAR) or
3409 (p_attribute8 is null) then
3410 l_attributes_rec.attribute8 := p_attribute8;
3411 end if;
3412 if (p_attribute9 <> FND_API.G_MISS_CHAR) or
3413 (p_attribute9 is null) then
3414 l_attributes_rec.attribute9 := p_attribute9;
3415 end if;
3416 if (p_attribute10 <> FND_API.G_MISS_CHAR) or
3417 (p_attribute10 is null) then
3418 l_attributes_rec.attribute10 := p_attribute10;
3419 end if;
3420 if (p_attribute11 <> FND_API.G_MISS_CHAR) or
3421 (p_attribute11 is null) then
3422 l_attributes_rec.attribute11 := p_attribute11;
3423 end if;
3424 if (p_attribute12 <> FND_API.G_MISS_CHAR) or
3425 (p_attribute12 is null) then
3426 l_attributes_rec.attribute12 := p_attribute12;
3427 end if;
3428 if (p_attribute13 <> FND_API.G_MISS_CHAR) or
3429 (p_attribute13 is null) then
3430 l_attributes_rec.attribute13 := p_attribute13;
3431 end if;
3432 if (p_attribute14 <> FND_API.G_MISS_CHAR) or
3433 (p_attribute14 is null) then
3434 l_attributes_rec.attribute14 := p_attribute14;
3435 end if;
3436 if (p_attribute15 <> FND_API.G_MISS_CHAR) or
3437 (p_attribute15 is null) then
3438 l_attributes_rec.attribute15 := p_attribute15;
3439 end if;
3440 if (p_attribute_label_length <> FND_API.G_MISS_NUM) or
3441 (p_attribute_label_length is null) then
3442 l_attributes_rec.attribute_label_length := p_attribute_label_length;
3443 end if;
3444 if (p_attribute_value_length <> FND_API.G_MISS_NUM) or
3445 (p_attribute_value_length is null) then
3446 l_attributes_rec.attribute_value_length := p_attribute_value_length;
3447 end if;
3448 if (p_attribute_label_long <> FND_API.G_MISS_CHAR) or
3449 (p_attribute_label_long is null) then
3450 l_attributes_tl_rec.attribute_label_long := p_attribute_label_long;
3451 end if;
3452 if (p_attribute_label_short <> FND_API.G_MISS_CHAR) or
3453 (p_attribute_label_short is null) then
3454 l_attributes_tl_rec.attribute_label_short := p_attribute_label_short;
3455 end if;
3456 if (p_description <> FND_API.G_MISS_CHAR) or
3457 (p_description is null) then
3458 l_attributes_tl_rec.description := p_description;
3459 end if;
3460
3461 --
3462 -- - next, load non-null columns
3463 --
3464 if (p_bold <> FND_API.G_MISS_CHAR) then
3465 l_attributes_rec.bold := p_bold;
3466 end if;
3467 if (p_italic <> FND_API.G_MISS_CHAR) then
3468 l_attributes_rec.italic := p_italic;
3469 end if;
3470 if (p_vertical_alignment <> FND_API.G_MISS_CHAR) then
3471 l_attributes_rec.vertical_alignment := p_vertical_alignment;
3472 end if;
3473 if (p_horizontal_alignment <> FND_API.G_MISS_CHAR) then
3474 l_attributes_rec.horizontal_alignment := p_horizontal_alignment;
3475 end if;
3476 if (p_data_type <> FND_API.G_MISS_CHAR) then
3477 l_attributes_rec.data_type := p_data_type;
3478 end if;
3479 if (p_name <> FND_API.G_MISS_CHAR) then
3480 l_attributes_tl_rec.name := p_name;
3481 end if;
3482 if (p_created_by <> FND_API.G_MISS_NUM) then
3483 l_created_by := p_created_by;
3484 end if;
3485 if (p_creation_date <> FND_API.G_MISS_DATE) then
3486 l_creation_date := p_creation_date;
3487 end if;
3488 if (p_last_updated_by <> FND_API.G_MISS_NUM) then
3489 l_last_updated_by := p_last_updated_by;
3490 end if;
3491 if (p_last_update_date <> FND_API.G_MISS_DATE) then
3492 l_last_update_date := p_last_update_date;
3493 end if;
3494 if (p_last_update_login <> FND_API.G_MISS_NUM) then
3495 l_last_update_login := p_last_update_login;
3496 end if;
3497
3498 if AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
3499 p_loader_timestamp => p_loader_timestamp,
3500 p_created_by => l_created_by,
3501 p_creation_date => l_creation_date,
3502 p_last_updated_by => l_last_updated_by,
3503 p_db_last_updated_by => l_attributes_rec.last_updated_by,
3504 p_last_update_date => l_last_update_date,
3505 p_db_last_update_date => l_attributes_rec.last_update_date,
3506 p_last_update_login => l_last_update_login,
3507 p_create_or_update => 'UPDATE') then
3508
3509 update AK_ATTRIBUTES set
3510 ATTRIBUTE_LABEL_LENGTH = l_attributes_rec.attribute_label_length,
3511 ATTRIBUTE_VALUE_LENGTH = l_attributes_rec.attribute_value_length,
3512 BOLD = l_attributes_rec.bold,
3513 ITALIC = l_attributes_rec.italic,
3514 VERTICAL_ALIGNMENT = l_attributes_rec.vertical_alignment,
3515 HORIZONTAL_ALIGNMENT = l_attributes_rec.horizontal_alignment,
3516 DATA_TYPE = l_attributes_rec.data_type,
3517 UPPER_CASE_FLAG = l_attributes_rec.upper_case_flag,
3518 DEFAULT_VALUE_VARCHAR2 = l_attributes_rec.default_value_varchar2,
3519 DEFAULT_VALUE_NUMBER = l_attributes_rec.default_value_number,
3520 DEFAULT_VALUE_DATE = l_attributes_rec.default_value_date,
3521 LOV_REGION_APPLICATION_ID = l_attributes_rec.lov_region_application_id,
3522 LOV_REGION_CODE = l_attributes_rec.lov_region_code,
3523 ITEM_STYLE = l_attributes_rec.item_style,
3524 DISPLAY_HEIGHT = l_attributes_rec.display_height,
3525 CSS_CLASS_NAME = l_attributes_rec.css_class_name,
3526 POPLIST_VIEWOBJECT = l_attributes_rec.poplist_viewobject,
3527 POPLIST_DISPLAY_ATTRIBUTE = l_attributes_rec.poplist_display_attribute,
3528 POPLIST_VALUE_ATTRIBUTE = l_attributes_rec.poplist_value_attribute,
3529 CSS_LABEL_CLASS_NAME = l_attributes_rec.css_label_class_name,
3530 PRECISION = l_attributes_rec.precision,
3531 EXPANSION = l_attributes_rec.expansion,
3532 ALS_MAX_LENGTH = l_attributes_rec.als_max_length,
3533 ATTRIBUTE_CATEGORY = l_attributes_rec.attribute_category,
3534 ATTRIBUTE1 = l_attributes_rec.attribute1,
3535 ATTRIBUTE2 = l_attributes_rec.attribute2,
3536 ATTRIBUTE3 = l_attributes_rec.attribute3,
3537 ATTRIBUTE4 = l_attributes_rec.attribute4,
3538 ATTRIBUTE5 = l_attributes_rec.attribute5,
3539 ATTRIBUTE6 = l_attributes_rec.attribute6,
3540 ATTRIBUTE7 = l_attributes_rec.attribute7,
3541 ATTRIBUTE8 = l_attributes_rec.attribute8,
3542 ATTRIBUTE9 = l_attributes_rec.attribute9,
3543 ATTRIBUTE10 = l_attributes_rec.attribute10,
3544 ATTRIBUTE11 = l_attributes_rec.attribute11,
3545 ATTRIBUTE12 = l_attributes_rec.attribute12,
3546 ATTRIBUTE13 = l_attributes_rec.attribute13,
3547 ATTRIBUTE14 = l_attributes_rec.attribute14,
3548 ATTRIBUTE15 = l_attributes_rec.attribute15,
3549 LAST_UPDATE_DATE = l_last_update_date,
3550 LAST_UPDATED_BY = l_last_updated_by,
3551 LAST_UPDATE_LOGIN = l_last_update_login
3552 where attribute_application_id = p_attribute_application_id
3553 and attribute_code = p_attribute_code;
3554 if (sql%notfound) then
3555 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3556 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_UPDATE_FAILED');
3557 FND_MSG_PUB.Add;
3558 end if;
3559 raise FND_API.G_EXC_ERROR;
3560 end if;
3561
3562 update AK_ATTRIBUTES_TL set
3563 NAME = l_attributes_tl_rec.name,
3564 ATTRIBUTE_LABEL_LONG = l_attributes_tl_rec.attribute_label_long,
3565 ATTRIBUTE_LABEL_SHORT = l_attributes_tl_rec.attribute_label_short,
3566 DESCRIPTION = l_attributes_tl_rec.description,
3567 LAST_UPDATED_BY = l_last_updated_by,
3568 LAST_UPDATE_DATE = l_last_update_date,
3569 LAST_UPDATE_LOGIN = l_last_update_login,
3570 SOURCE_LANG = l_lang
3571 where attribute_application_id = p_attribute_application_id
3572 and attribute_code = p_attribute_code
3573 and l_lang in (LANGUAGE, SOURCE_LANG);
3574 if (sql%notfound) then
3575 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3576 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_UPDATE_FAILED');
3577 FND_MSG_PUB.Add;
3578 end if;
3579 -- dbms_output.put_line('TL Row does not exist during update');
3580 raise FND_API.G_EXC_ERROR;
3581 end if;
3582
3583 -- /** commit the update **/
3584 commit;
3585
3586 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
3587 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_UPDATED');
3588 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
3589 ' ' || p_attribute_code);
3590 FND_MSG_PUB.Add;
3591 end if;
3592
3593 end if;
3594 p_return_status := FND_API.G_RET_STS_SUCCESS;
3595
3596 FND_MSG_PUB.Count_And_Get (
3597 p_count => p_msg_count,
3598 p_data => p_msg_data);
3599
3600
3601 EXCEPTION
3602 WHEN VALUE_ERROR THEN
3603 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3604 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_VALUE_ERROR');
3605 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
3606 ' ' || p_attribute_code);
3607 FND_MSG_PUB.Add;
3608 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_UPDATED');
3609 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
3610 ' ' || p_attribute_code);
3611 FND_MSG_PUB.Add;
3612 end if;
3613 p_return_status := FND_API.G_RET_STS_ERROR;
3614 rollback to start_update_attribute;
3615 FND_MSG_PUB.Count_And_Get (
3616 p_count => p_msg_count,
3617 p_data => p_msg_data);
3618 WHEN FND_API.G_EXC_ERROR THEN
3619 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
3620 FND_MESSAGE.SET_NAME('AK','AK_ATTRIBUTE_NOT_UPDATED');
3621 FND_MESSAGE.SET_TOKEN('KEY',to_char(p_attribute_application_id) ||
3622 ' ' || p_attribute_code);
3623 FND_MSG_PUB.Add;
3624 end if;
3625 p_return_status := FND_API.G_RET_STS_ERROR;
3626 rollback to start_update_attribute;
3627 FND_MSG_PUB.Count_And_Get (
3628 p_count => p_msg_count,
3629 p_data => p_msg_data);
3630 WHEN OTHERS THEN
3631 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3632 rollback to start_update_attribute;
3633 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
3634 SUBSTR (SQLERRM, 1, 240) );
3635 FND_MSG_PUB.Count_And_Get (
3636 p_count => p_msg_count,
3637 p_data => p_msg_data);
3638 end UPDATE_ATTRIBUTE;
3639
3640 --=======================================================
3641 -- Procedure UPLOAD_ATTRIBUTE_SECOND
3642 --
3643 -- Usage Private API for loading attributes that were
3644 -- failed during its first pass
3645 -- This API should only be called by other APIs
3646 -- that are owned by the Core Modules Team (AK).
3647 --
3648 -- Desc This API reads the attribute data from PL/SQL table
3649 -- that was prepared during 1st pass, then processes
3650 -- the data, and loads them to the database. The tables
3651 -- are updated with the timestamp passed. This API
3652 -- will process the file until the EOF is reached,
3653 -- a parse error is encountered, or when data for
3654 -- a different business object is read from the file.
3655 --
3656 -- Results The API returns the standard p_return_status parameter
3657 -- indicating one of the standard return statuses :
3658 -- * Unexpected error
3659 -- * Error
3660 -- * Success
3661 -- Parameters p_validation_level : IN required
3662 -- validation level
3663 --
3664 -- Version Initial version number = 1.0
3665 -- History Current version number = 1.0
3666 --=======================================================
3667 procedure UPLOAD_ATTRIBUTE_SECOND (
3668 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3669 p_return_status OUT NOCOPY VARCHAR2,
3670 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
3671 p_pass IN NUMBER := 2
3672 ) is
3673 l_api_name CONSTANT varchar2(30) := 'Upload_Attribute_Second';
3674 l_rec_index NUMBER;
3675 l_return_status VARCHAR2(1);
3676 l_msg_count NUMBER;
3677 l_msg_data VARCHAR2(240);
3678 l_copy_redo_flag BOOLEAN;
3679 begin
3680 if (G_ATTRIBUTE_REDO_TBL.count > 0) then
3681 for l_rec_index in G_ATTRIBUTE_REDO_TBL.FIRST .. G_ATTRIBUTE_REDO_TBL.LAST loop
3682 if (G_ATTRIBUTE_REDO_TBL.exists(l_rec_index)) then
3683 if AK_ATTRIBUTE_PVT.ATTRIBUTE_EXISTS (
3684 p_api_version_number => 1.0,
3685 p_return_status => l_return_status,
3686 p_attribute_application_id=>
3687 G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_application_id,
3688 p_attribute_code => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_code) then
3689 AK_ATTRIBUTE_PVT.UPDATE_ATTRIBUTE (
3690 p_validation_level => p_validation_level,
3691 p_api_version_number => 1.0,
3692 p_msg_count => l_msg_count,
3693 p_msg_data => l_msg_data,
3694 p_return_status => l_return_status,
3695 p_attribute_application_id =>
3696 G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_application_id,
3697 p_attribute_code => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_code,
3698 p_attribute_label_length => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_label_length,
3699 p_attribute_value_length => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_value_length,
3700 p_bold => G_ATTRIBUTE_REDO_TBL(l_rec_index).bold,
3701 p_italic => G_ATTRIBUTE_REDO_TBL(l_rec_index).italic,
3702 p_vertical_alignment => G_ATTRIBUTE_REDO_TBL(l_rec_index).vertical_alignment,
3703 p_horizontal_alignment => G_ATTRIBUTE_REDO_TBL(l_rec_index).horizontal_alignment,
3704 p_data_type => G_ATTRIBUTE_REDO_TBL(l_rec_index).data_type,
3705 p_upper_case_flag => G_ATTRIBUTE_REDO_TBL(l_rec_index).upper_case_flag,
3706 p_default_value_varchar2 => G_ATTRIBUTE_REDO_TBL(l_rec_index).default_value_varchar2,
3707 p_default_value_number => G_ATTRIBUTE_REDO_TBL(l_rec_index).default_value_number,
3708 p_default_value_date => G_ATTRIBUTE_REDO_TBL(l_rec_index).default_value_date,
3709 p_lov_region_application_id =>
3710 G_ATTRIBUTE_REDO_TBL(l_rec_index).lov_region_application_id,
3711 p_lov_region_code => G_ATTRIBUTE_REDO_TBL(l_rec_index).lov_region_code,
3712 p_item_style => G_ATTRIBUTE_REDO_TBL(l_rec_index).item_style,
3713 p_display_height => G_ATTRIBUTE_REDO_TBL(l_rec_index).display_height,
3714 p_css_class_name => G_ATTRIBUTE_REDO_TBL(l_rec_index).css_class_name,
3715 p_poplist_viewobject => G_ATTRIBUTE_REDO_TBL(l_rec_index).poplist_viewobject,
3716 p_poplist_display_attr => G_ATTRIBUTE_REDO_TBL(l_rec_index).poplist_display_attribute,
3717 p_poplist_value_attr => G_ATTRIBUTE_REDO_TBL(l_rec_index).poplist_value_attribute,
3718 p_css_label_class_name => G_ATTRIBUTE_REDO_TBL(l_rec_index).css_label_class_name,
3719 p_precision => G_ATTRIBUTE_REDO_TBL(l_rec_index).precision,
3720 p_expansion => G_ATTRIBUTE_REDO_TBL(l_rec_index).expansion,
3721 p_als_max_length => G_ATTRIBUTE_REDO_TBL(l_rec_index).als_max_length,
3722 p_attribute_category => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_category,
3723 p_attribute1 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute1,
3724 p_attribute2 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute2,
3725 p_attribute3 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute3,
3726 p_attribute4 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute4,
3727 p_attribute5 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute5,
3728 p_attribute6 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute6,
3729 p_attribute7 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute7,
3730 p_attribute8 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute8,
3731 p_attribute9 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute9,
3732 p_attribute10 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute10,
3733 p_attribute11 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute11,
3734 p_attribute12 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute12,
3735 p_attribute13 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute13,
3736 p_attribute14 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute14,
3737 p_attribute15 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute15,
3738 p_name => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).name,
3739 p_attribute_label_long => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).attribute_label_long,
3740 p_attribute_label_short => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).attribute_label_short,
3741 p_description => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).description,
3742 p_created_by => G_ATTRIBUTE_REDO_TBL(l_rec_index).created_by,
3743 p_creation_date => G_ATTRIBUTE_REDO_TBL(l_rec_index).creation_date,
3744 p_last_updated_by => G_ATTRIBUTE_REDO_TBL(l_rec_index).last_updated_by,
3745 p_last_update_date => G_ATTRIBUTE_REDO_TBL(l_rec_index).last_update_date,
3746 p_last_update_login => G_ATTRIBUTE_REDO_TBL(l_rec_index).last_update_login,
3747 p_loader_timestamp => p_loader_timestamp,
3748 p_pass => p_pass,
3749 p_copy_redo_flag => l_copy_redo_flag
3750 );
3751 else
3752 AK_ATTRIBUTE_PVT.CREATE_ATTRIBUTE (
3753 p_validation_level => p_validation_level,
3754 p_api_version_number => 1.0,
3755 p_msg_count => l_msg_count,
3756 p_msg_data => l_msg_data,
3757 p_return_status => l_return_status,
3758 p_attribute_application_id =>
3759 G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_application_id,
3760 p_attribute_code => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_code,
3761 p_attribute_label_length => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_label_length,
3762 p_attribute_value_length => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute_value_length,
3763 p_bold => G_ATTRIBUTE_REDO_TBL(l_rec_index).bold,
3764 p_italic => G_ATTRIBUTE_REDO_TBL(l_rec_index).italic,
3765 p_vertical_alignment => G_ATTRIBUTE_REDO_TBL(l_rec_index).vertical_alignment,
3766 p_horizontal_alignment => G_ATTRIBUTE_REDO_TBL(l_rec_index).horizontal_alignment,
3767 p_data_type => G_ATTRIBUTE_REDO_TBL(l_rec_index).data_type,
3768 p_upper_case_flag => G_ATTRIBUTE_REDO_TBL(l_rec_index).upper_case_flag,
3769 p_default_value_varchar2 => G_ATTRIBUTE_REDO_TBL(l_rec_index).default_value_varchar2,
3770 p_default_value_number => G_ATTRIBUTE_REDO_TBL(l_rec_index).default_value_number,
3771 p_default_value_date => G_ATTRIBUTE_REDO_TBL(l_rec_index).default_value_date,
3772 p_lov_region_application_id =>
3773 G_ATTRIBUTE_REDO_TBL(l_rec_index).lov_region_application_id,
3774 p_lov_region_code => G_ATTRIBUTE_REDO_TBL(l_rec_index).lov_region_code,
3775 p_item_style => G_ATTRIBUTE_REDO_TBL(l_rec_index).item_style,
3776 p_display_height => G_ATTRIBUTE_REDO_TBL(l_rec_index).display_height,
3777 p_css_class_name => G_ATTRIBUTE_REDO_TBL(l_rec_index).css_class_name,
3778 p_poplist_viewobject => G_ATTRIBUTE_REDO_TBL(l_rec_index).poplist_viewobject,
3779 p_poplist_display_attr => G_ATTRIBUTE_REDO_TBL(l_rec_index).poplist_display_attribute,
3780 p_poplist_value_attr => G_ATTRIBUTE_REDO_TBL(l_rec_index).poplist_value_attribute,
3781 p_css_label_class_name => G_ATTRIBUTE_REDO_TBL(l_rec_index).css_label_class_name,
3782 p_precision => G_ATTRIBUTE_REDO_TBL(l_rec_index).precision,
3783 p_expansion => G_ATTRIBUTE_REDO_TBL(l_rec_index).expansion,
3784 p_als_max_length => G_ATTRIBUTE_REDO_TBL(l_rec_index).als_max_length,
3785 p_attribute1 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute1,
3786 p_attribute2 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute2,
3787 p_attribute3 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute3,
3788 p_attribute4 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute4,
3789 p_attribute5 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute5,
3790 p_attribute6 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute6,
3791 p_attribute7 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute7,
3792 p_attribute8 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute8,
3793 p_attribute9 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute9,
3794 p_attribute10 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute10,
3795 p_attribute11 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute11,
3796 p_attribute12 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute12,
3797 p_attribute13 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute13,
3798 p_attribute14 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute14,
3799 p_attribute15 => G_ATTRIBUTE_REDO_TBL(l_rec_index).attribute15,
3800 p_name => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).name,
3801 p_attribute_label_long => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).attribute_label_long,
3802 p_attribute_label_short =>G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).attribute_label_short,
3803 p_description => G_ATTRIBUTE_TL_REDO_TBL(l_rec_index).description,
3804 p_created_by => G_ATTRIBUTE_REDO_TBL(l_rec_index).created_by,
3805 p_creation_date => G_ATTRIBUTE_REDO_TBL(l_rec_index).creation_date,
3806 p_last_updated_by => G_ATTRIBUTE_REDO_TBL(l_rec_index).last_updated_by,
3807 p_last_update_date => G_ATTRIBUTE_REDO_TBL(l_rec_index).last_update_date,
3808 p_last_update_login => G_ATTRIBUTE_REDO_TBL(l_rec_index).last_update_login,
3809 p_loader_timestamp => p_loader_timestamp,
3810 p_pass => p_pass,
3811 p_copy_redo_flag => l_copy_redo_flag
3812 );
3813 end if; -- /* if ATTRIBUTE_EXISTS */
3814 --
3815 -- If API call returns with an error status, upload aborts
3816 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
3817 (l_return_status = FND_API.G_RET_STS_ERROR) then
3818 RAISE FND_API.G_EXC_ERROR;
3819 end if; -- /* if l_return_status */
3820 end if; -- /* if G_ATTRIBUTE_REDO_TBL.exists */
3821 end loop; --/* for loop */
3822 end if; -- /* if G_ATTRIBUTE_REDO_TBL.count */
3823
3824 p_return_status := FND_API.G_RET_STS_SUCCESS;
3825
3826 EXCEPTION
3827 WHEN FND_API.G_EXC_ERROR THEN
3828 p_return_status := FND_API.G_RET_STS_ERROR;
3829 FND_MSG_PUB.Count_And_Get (
3830 p_count => l_msg_count,
3831 p_data => l_msg_data);
3832 WHEN OTHERS THEN
3833 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3834 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
3835 SUBSTR (SQLERRM, 1, 240) );
3836 FND_MSG_PUB.Count_And_Get (
3837 p_count => l_msg_count,
3838 p_data => l_msg_data);
3839
3840 end UPLOAD_ATTRIBUTE_SECOND;
3841
3842 end AK_Attribute_pvt;