[Home] [Help]
PACKAGE BODY: APPS.AK_REGION2_PVT
Source
1 package body AK_REGION2_PVT as
2 /* $Header: akdvre2b.pls 120.4.12020000.2 2012/11/20 19:12:16 tshort ship $ */
3
4 --=======================================================
5 -- Procedure UPLOAD_REGION
6 --
7 -- Usage Private API for loading regions from a
8 -- loader file to the database.
9 -- This API should only be called by other APIs
10 -- that are owned by the Core Modules Team (AK).
11 --
12 -- Desc This API reads the region data (including region
13 -- items) stored in the loader file currently being
14 -- processed, parses the data, and loads them to the
15 -- database. The tables are updated with the timestamp
16 -- passed. This API will process the file until the
17 -- EOF is reached, a parse error is encountered, or when
18 -- data for a different business object is read from the file.
19 --
20 -- Results The API returns the standard p_return_status parameter
21 -- indicating one of the standard return statuses :
22 -- * Unexpected error
23 -- * Error
24 -- * Success
25 -- Parameters p_index : IN OUT required
26 -- Index of PL/SQL file to be processed.
27 -- p_loader_timestamp : IN required
28 -- The timestamp to be used when creating or updating
29 -- records
30 -- p_line_num : IN optional
31 -- The first line number in the file to be processed.
32 -- It is used for keeping track of the line number
33 -- read so that this info can be included in the
34 -- error message when a parse error occurred.
35 -- p_buffer : IN required
36 -- The content of the first line to be processed.
37 -- The calling API has already read the first line
38 -- that needs to be parsed by this API, so this
39 -- line won't be read from the file again.
40 -- p_line_num_out : OUT
41 -- The number of the last line in the loader file
42 -- that is read by this API.
43 -- p_buffer_out : OUT
44 -- The content of the last line read by this API.
45 -- If an EOF has not reached, this line would
46 -- contain the beginning of another business object
47 -- that will need to be processed by another API.
48 --
49 -- Version Initial version number = 1.0
50 -- History Current version number = 1.0
51 --=======================================================
52 procedure UPLOAD_REGION (
53 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
54 p_api_version_number IN NUMBER,
55 p_return_status OUT NOCOPY VARCHAR2,
56 p_index IN OUT NOCOPY NUMBER,
57 p_loader_timestamp IN DATE,
58 p_line_num IN NUMBER := FND_API.G_MISS_NUM,
59 p_buffer IN AK_ON_OBJECTS_PUB.Buffer_Type,
60 p_line_num_out OUT NOCOPY NUMBER,
61 p_buffer_out OUT NOCOPY AK_ON_OBJECTS_PUB.Buffer_Type,
62 p_upl_loader_cur IN OUT NOCOPY AK_ON_OBJECTS_PUB.LoaderCurTyp,
63 p_pass IN NUMBER := 1
64 ) is
65 cursor l_check_fnd_category_name_csr (p_category_id in number) is
66 select name
67 from fnd_document_categories
68 where category_id = p_category_id;
69 cursor l_check_fnd_category_id_csr (p_category_name in varchar2) is
70 select category_id
71 from fnd_document_categories
72 where name =p_category_name;
73 cursor l_get_region_item_csr (region_appl_id_param number,
74 region_code_param varchar2) is
75 select ATTRIBUTE_APPLICATION_ID, ATTRIBUTE_CODE
76 from AK_REGION_ITEMS
77 where region_application_id = region_appl_id_param
78 and region_code = region_code_param;
79 l_api_version_number CONSTANT number := 1.0;
80 l_api_name CONSTANT varchar2(30) := 'Upload_Region';
81 l_item_index NUMBER := 0;
82 l_item_rec AK_REGION_PUB.Item_Rec_Type;
83 l_item_tbl AK_REGION_PUB.Item_Tbl_Type;
84 -- l_graph_index NUMBER := 0;
85 -- l_graph_rec AK_REGION_PUB.Graph_Rec_Type;
86 -- l_empty_graph_rec AK_REGION_PUB.Graph_Rec_Type;
87 -- l_graph_tbl AK_REGION_PUB.Graph_Tbl_Type;
88 -- l_graph_column_index NUMBER := 0;
89 -- l_graph_column_rec AK_REGION_GRAPH_COLUMNS%ROWTYPE;
90 -- l_empty_graph_column_rec AK_REGION_GRAPH_COLUMNS%ROWTYPE;
91 -- l_graph_column_tbl AK_REGION_PUB.Graph_Column_Tbl_Type;
92 l_buffer AK_ON_OBJECTS_PUB.Buffer_Type;
93 l_column varchar2(30);
94 l_dummy NUMBER;
95 l_eof_flag VARCHAR2(1);
96 l_index NUMBER;
97 l_line_num NUMBER;
98 l_lines_read NUMBER;
99 l_more_region BOOLEAN := TRUE;
100 l_msg_count NUMBER;
101 l_msg_data VARCHAR2(2000);
102 l_region_index NUMBER := 0;
103 l_lov_relation_index NUMBER := 0;
104 l_category_usage_index NUMBER := 0;
105 l_region_rec AK_REGION_PUB.Region_Rec_Type;
106 l_region_tbl AK_REGION_PUB.Region_Tbl_Type;
107 l_lov_relation_rec AK_REGION_LOV_RELATIONS%ROWTYPE;
108 l_empty_lov_relation_rec AK_REGION_LOV_RELATIONS%ROWTYPE;
109 l_lov_relation_tbl AK_REGION_PUB.Lov_Relation_Tbl_Type;
110 l_category_usage_rec AK_CATEGORY_USAGES%ROWTYPE;
111 l_empty_category_usage_rec AK_CATEGORY_USAGES%ROWTYPE;
112 l_category_usage_tbl AK_REGION_PUB.Category_Usages_Tbl_Type;
113 l_return_status varchar2(1);
114 l_saved_token AK_ON_OBJECTS_PUB.Buffer_Type;
115 l_state NUMBER;
116 l_token AK_ON_OBJECTS_PUB.Buffer_Type;
117 l_value_count NUMBER;
118 l_copy_redo_flag BOOLEAN := FALSE;
119 l_user_id1 NUMBER;
120 l_user_id2 NUMBER;
121 l_update1 DATE;
122 l_update2 DATE;
123 begin
124 --dbms_output.put_line('Started region upload: ' ||
125 -- to_char(sysdate, 'MON-DD HH24:MI:SS'));
126
127 IF NOT FND_API.Compatible_API_Call (
128 l_api_version_number, p_api_version_number, l_api_name,
129 G_PKG_NAME) then
130 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
131 return;
132 END IF;
133
134 -- 5665840 - removed savepoint as child procedures do the savepoint/
135 -- rollback/commit
136 --SAVEPOINT Start_Upload;
137
138 -- Retrieve the first non-blank, non-comment line
139 l_state := 0;
140 l_eof_flag := 'N';
141 --
142 -- if calling from ak_on_objects.upload (ie, loader timestamp is given),
143 -- the tokens 'BEGIN REGION' has already been parsed. Set initial
144 -- buffer to 'BEGIN REGION' before reading the next line from the
145 -- file. Otherwise, set initial buffer to null.
146 --
147 if (p_loader_timestamp <> FND_API.G_MISS_DATE) then
148 l_buffer := 'BEGIN REGION ' || p_buffer;
149 else
150 l_buffer := null;
151 end if;
152
153 if (p_line_num = FND_API.G_MISS_NUM) then
154 l_line_num := 0;
155 else
156 l_line_num := p_line_num;
157 end if;
158
159 while (l_buffer is null and l_eof_flag = 'N' and p_index <= AK_ON_OBJECTS_PVT.G_UPL_TABLE_NUM) loop
160 AK_ON_OBJECTS_PVT.READ_LINE (
161 p_return_status => l_return_status,
162 p_index => p_index,
163 p_buffer => l_buffer,
164 p_lines_read => l_lines_read,
165 p_eof_flag => l_eof_flag,
166 p_upl_loader_cur => p_upl_loader_cur
167 );
168 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
169 (l_return_status = FND_API.G_RET_STS_ERROR) then
170 RAISE FND_API.G_EXC_ERROR;
171 end if;
172 l_line_num := l_line_num + l_lines_read;
173 --
174 -- trim leading spaces and discard comment lines
175 --
176 l_buffer := LTRIM(l_buffer);
177 if (SUBSTR(l_buffer, 1, 1) = '#') then
178 l_buffer := null;
179 end if;
180 end loop;
181
182 --
183 -- Error if there is nothing to be read from the file
184 --
185 if (l_buffer is null and l_eof_flag = 'Y') then
186 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
187 FND_MESSAGE.SET_NAME('AK','AK_EMPTY_BUFFER');
188 FND_MSG_PUB.Add;
189 end if;
190 raise FND_API.G_EXC_ERROR;
191 end if;
192
193 -- Read tokens from file, one at a time
194
195 while (l_eof_flag = 'N') and (l_buffer is not null)
196 and (l_more_region) loop
197
198 AK_ON_OBJECTS_PVT.GET_TOKEN(
199 p_return_status => l_return_status,
200 p_in_buf => l_buffer,
201 p_token => l_token
202 );
203
204 --dbms_output.put_line(' State:' || l_state || 'Token:' || l_token);
205
206 if (l_return_status = FND_API.G_RET_STS_ERROR) or
207 (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
208 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
209 FND_MESSAGE.SET_NAME('AK','AK_GET_TOKEN_ERROR');
210 FND_MSG_PUB.Add;
211 end if;
212 --dbms_output.put_line(l_api_name || ' Error parsing buffer');
213 raise FND_API.G_EXC_ERROR;
214 end if;
215
216
217 --
218 -- REGION (states 0 - 19)
219 --
220 if (l_state = 0) then
221 if (l_token = 'BEGIN') then
222 l_state := 1;
223 else
224 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
225 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
226 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
227 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
228 FND_MESSAGE.SET_TOKEN('EXPECTED','BEGIN');
229 FND_MSG_PUB.Add;
230 end if;
231 raise FND_API.G_EXC_ERROR;
232 end if;
233 elsif (l_state = 1) then
234 if (l_token = 'REGION') then
235 --== Clear out previous column data ==--
236 l_region_rec := AK_REGION_PUB.G_MISS_REGION_REC;
237 l_state := 2;
238 else
239 -- Found the beginning of a non-region object,
240 -- rebuild last line and pass it back to the caller
241 -- (ak_on_objects_pvt.upload).
242 p_buffer_out := 'BEGIN ' || l_token || ' ' || l_buffer;
243 l_more_region := FALSE;
244 end if;
245 elsif (l_state = 2) then
246 if (l_token is not null) then
247 l_region_rec.region_application_id := to_number(l_token);
248 l_state := 3;
249 else
250 --dbms_output.put_line('Expecting region application ID');
251 raise FND_API.G_EXC_ERROR;
252 end if;
253 elsif (l_state = 3) then
254 if (l_token is not null) then
255 l_region_rec.region_code := l_token;
256 l_value_count := null;
257 l_state := 10;
258 else
259 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
260 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
261 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
262 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
263 FND_MESSAGE.SET_TOKEN('EXPECTED','REGION_CODE');
264 FND_MSG_PUB.Add;
265 end if;
266 raise FND_API.G_EXC_ERROR;
267 end if;
268 elsif (l_state = 10) then
269 if (l_token = 'BEGIN') then
270 l_state := 13;
271 elsif (l_token = 'END') then
272 l_state := 19;
273 elsif (l_token = 'DATABASE_OBJECT_NAME') or
274 (l_token = 'REGION_STYLE') or
275 (l_token = 'ICX_CUSTOM_CALL') or
276 (l_token = 'NUM_COLUMNS') or
277 (l_token = 'REGION_DEFAULTING_API_PKG') or
278 (l_token = 'REGION_DEFAULTING_API_PROC') or
279 (l_token = 'REGION_VALIDATION_API_PKG') or
280 (l_token = 'REGION_VALIDATION_API_PROC') or
281 (l_token = 'APPLICATIONMODULE_OBJECT_TYPE') or
282 (l_token = 'NUM_ROWS_DISPLAY') or
283 (l_token = 'REGION_OBJECT_TYPE') or
284 (l_token = 'IMAGE_FILE_NAME') or
285 (l_token = 'ISFORM_FLAG') or
286 (l_token = 'HELP_TARGET') or
287 (l_token = 'STYLE_SHEET_FILENAME') or
288 (l_token = 'VERSION') or
289 (l_token = 'APPLICATIONMODULE_USAGE_NAME') or
290 (l_token = 'ADD_INDEXED_CHILDREN') or
291 (l_token = 'STATEFUL_FLAG') or
292 (l_token = 'FUNCTION_NAME') or
293 (l_token = 'CHILDREN_VIEW_USAGE_NAME') or
294 (l_token = 'SEARCH_PANEL') or
295 (l_token = 'ADVANCED_SEARCH_PANEL') or
296 (l_token = 'CUSTOMIZE_PANEL') or
297 (l_token = 'DEFAULT_SEARCH_PANEL') or
298 (l_token = 'RESULTS_BASED_SEARCH') or
299 (l_token = 'DISPLAY_GRAPH_TABLE') or
300 (l_token = 'DISABLE_HEADER') or
301 (l_token = 'STANDALONE') or
302 (l_token = 'AUTO_CUSTOMIZATION_CRITERIA') or
303 (l_token = 'ATTRIBUTE_CATEGORY') or
304 (l_token = 'ATTRIBUTE1') or
305 (l_token = 'ATTRIBUTE2') or
306 (l_token = 'ATTRIBUTE3') or
307 (l_token = 'ATTRIBUTE4') or
308 (l_token = 'ATTRIBUTE5') or
309 (l_token = 'ATTRIBUTE6') or
310 (l_token = 'ATTRIBUTE7') or
311 (l_token = 'ATTRIBUTE8') or
312 (l_token = 'ATTRIBUTE9') or
313 (l_token = 'ATTRIBUTE10') or
314 (l_token = 'ATTRIBUTE11') or
315 (l_token = 'ATTRIBUTE12') or
316 (l_token = 'ATTRIBUTE13') or
317 (l_token = 'ATTRIBUTE14') or
318 (l_token = 'ATTRIBUTE15') or
319 (l_token = 'NAME') or
320 (l_token = 'DESCRIPTION') or
321 (l_token = 'CREATED_BY') or
322 (l_token = 'CREATION_DATE') or
323 (l_token = 'LAST_UPDATED_BY') or
324 (l_token = 'OWNER') or
325 (l_token = 'LAST_UPDATE_DATE') or
326 (l_token = 'LAST_UPDATE_LOGIN') then
327 l_column := l_token;
328 l_state := 11;
329 else
330 --
331 -- error if not expecting attribute values added by the translation team
332 -- or if we have read in more than a certain number of values
333 -- for the same DB column
334 --
335 l_value_count := l_value_count + 1;
336 --
337 -- save second value. It will be the token with error if
338 -- it turns out that there is a parse error on this line.
339 --
340 if (l_value_count = 2) then
341 l_saved_token := l_token;
342 end if;
343 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
344 (l_value_count is null) then
345 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
346 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
347 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
348 if (l_value_count is null) then
349 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
350 else
351 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
352 end if;
353 FND_MESSAGE.SET_TOKEN('EXPECTED','REGION');
354 FND_MSG_PUB.Add;
355 end if;
356 -- dbms_output.put_line('Expecting region field, BEGIN, or END');
357 raise FND_API.G_EXC_ERROR;
358 end if;
359 end if;
360 elsif (l_state = 11) then
361 if (l_token = '=') then
362 l_state := 12;
363 else
364 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
365 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
366 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
367 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
368 FND_MESSAGE.SET_TOKEN('EXPECTED','=');
369 FND_MSG_PUB.Add;
370 end if;
371 raise FND_API.G_EXC_ERROR;
372 end if;
373 elsif (l_state = 12) then
374 l_value_count := 1;
375 if (l_column = 'DATABASE_OBJECT_NAME') then
376 l_region_rec.database_object_name := l_token;
377 elsif (l_column = 'REGION_STYLE') then
378 l_region_rec.region_style := l_token;
379 elsif (l_column = 'ICX_CUSTOM_CALL') then
380 l_region_rec.icx_custom_call := l_token;
381 elsif (l_column = 'NUM_COLUMNS') then
382 l_region_rec.num_columns := to_number(l_token);
383 elsif (l_column = 'REGION_DEFAULTING_API_PKG') then
384 l_region_rec.region_defaulting_api_pkg := l_token;
385 elsif (l_column = 'REGION_DEFAULTING_API_PROC') then
386 l_region_rec.region_defaulting_api_proc := l_token;
387 elsif (l_column = 'REGION_VALIDATION_API_PKG') then
388 l_region_rec.region_validation_api_pkg := l_token;
389 elsif (l_column = 'REGION_VALIDATION_API_PROC') then
390 l_region_rec.region_validation_api_proc := l_token;
391 elsif (l_column = 'APPLICATIONMODULE_OBJECT_TYPE') then
392 l_region_rec.applicationmodule_object_type := l_token;
393 elsif (l_column = 'NUM_ROWS_DISPLAY') then
394 l_region_rec.num_rows_display := l_token;
395 elsif (l_column = 'REGION_OBJECT_TYPE') then
396 l_region_rec.region_object_type := l_token;
397 elsif (l_column = 'IMAGE_FILE_NAME') then
398 l_region_rec.image_file_name := l_token;
399 elsif (l_column = 'ISFORM_FLAG') then
400 l_region_rec.isform_flag := l_token;
401 elsif (l_column = 'HELP_TARGET') then
402 l_region_rec.help_target := l_token;
403 elsif (l_column = 'STYLE_SHEET_FILENAME') then
404 l_region_rec.style_sheet_filename := l_token;
405 elsif (l_column = 'VERSION') then
406 l_region_rec.version := l_token;
407 elsif (l_column = 'APPLICATIONMODULE_USAGE_NAME') then
408 l_region_rec.applicationmodule_usage_name := l_token;
409 elsif (l_column = 'ADD_INDEXED_CHILDREN') then
410 l_region_rec.add_indexed_children := l_token;
411 elsif (l_column = 'STATEFUL_FLAG') then
412 l_region_rec.stateful_flag := l_token;
413 elsif (l_column = 'FUNCTION_NAME') then
414 l_region_rec.function_name := l_token;
415 elsif (l_column = 'CHILDREN_VIEW_USAGE_NAME') then
416 l_region_rec.children_view_usage_name := l_token;
417 elsif (l_column = 'SEARCH_PANEL') then
418 l_region_rec.search_panel := l_token;
419 elsif (l_column = 'ADVANCED_SEARCH_PANEL') then
420 l_region_rec.advanced_search_panel := l_token;
421 elsif (l_column = 'CUSTOMIZE_PANEL') then
422 l_region_rec.customize_panel := l_token;
423 elsif (l_column = 'DEFAULT_SEARCH_PANEL') then
424 l_region_rec.default_search_panel := l_token;
425 elsif (l_column = 'RESULTS_BASED_SEARCH') then
426 l_region_rec.results_based_search := l_token;
427 elsif (l_column = 'DISPLAY_GRAPH_TABLE') then
428 l_region_rec.display_graph_table := l_token;
429 elsif (l_column = 'DISABLE_HEADER') then
430 l_region_rec.disable_header := l_token;
431 elsif (l_column = 'STANDALONE') then
432 l_region_rec.standalone := l_token;
433 elsif (l_column = 'AUTO_CUSTOMIZATION_CRITERIA') then
434 l_region_rec.auto_customization_criteria := l_token;
435 elsif (l_column = 'ATTRIBUTE_CATEGORY') then
436 l_region_rec.attribute_category := l_token;
437 elsif (l_column = 'ATTRIBUTE1') then
438 l_region_rec.attribute1 := l_token;
439 elsif (l_column = 'ATTRIBUTE2') then
440 l_region_rec.attribute2 := l_token;
441 elsif (l_column = 'ATTRIBUTE3') then
442 l_region_rec.attribute3 := l_token;
443 elsif (l_column = 'ATTRIBUTE4') then
444 l_region_rec.attribute4 := l_token;
445 elsif (l_column = 'ATTRIBUTE5') then
446 l_region_rec.attribute5 := l_token;
447 elsif (l_column = 'ATTRIBUTE6') then
448 l_region_rec.attribute6 := l_token;
449 elsif (l_column = 'ATTRIBUTE7') then
450 l_region_rec.attribute7 := l_token;
451 elsif (l_column = 'ATTRIBUTE8') then
452 l_region_rec.attribute8 := l_token;
453 elsif (l_column = 'ATTRIBUTE9') then
454 l_region_rec.attribute9 := l_token;
455 elsif (l_column = 'ATTRIBUTE10') then
456 l_region_rec.attribute10 := l_token;
457 elsif (l_column = 'ATTRIBUTE11') then
458 l_region_rec.attribute11 := l_token;
459 elsif (l_column = 'ATTRIBUTE12') then
460 l_region_rec.attribute12 := l_token;
461 elsif (l_column = 'ATTRIBUTE13') then
462 l_region_rec.attribute13 := l_token;
463 elsif (l_column = 'ATTRIBUTE14') then
464 l_region_rec.attribute14 := l_token;
465 elsif (l_column = 'ATTRIBUTE15') then
466 l_region_rec.attribute15 := l_token;
467 elsif (l_column = 'NAME') then
468 l_region_rec.name := l_token;
469 elsif (l_column = 'DESCRIPTION') then
470 l_region_rec.description := l_token;
471 elsif (l_column = 'CREATED_BY') then
472 l_region_rec.created_by := to_number(l_token);
473 elsif (l_column = 'CREATION_DATE') then
474 l_region_rec.creation_date := to_date(l_token,
475 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
476 elsif (l_column = 'LAST_UPDATED_BY') then
477 l_region_rec.last_updated_by := to_number(l_token);
478 elsif (l_column = 'OWNER') then
479 l_region_rec.last_updated_by := FND_LOAD_UTIL.OWNER_ID(l_token);
480 elsif (l_column = 'LAST_UPDATE_DATE') then
481 l_region_rec.last_update_date := to_date(l_token,
482 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
483 elsif (l_column = 'LAST_UPDATE_LOGIN') then
484 l_region_rec.last_update_login := to_number(l_token);
485 else
486 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
487 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
488 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
489 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
490 FND_MESSAGE.SET_TOKEN('EXPECTED', l_column);
491 FND_MSG_PUB.Add;
492 end if;
493 raise FND_API.G_EXC_ERROR;
494 end if;
495 l_state := 10;
496 elsif (l_state = 13) then
497 if (l_token = 'REGION_ITEM') then
498 --== Clear out previous region item column data ==--
499 -- and load region key values into record --
500 l_item_rec := AK_REGION_PUB.G_MISS_ITEM_REC;
501 l_item_rec.region_application_id := l_region_rec.region_application_id;
502 l_item_rec.region_code := l_region_rec.region_code;
503 l_state := 20;
504 elsif ( l_token = 'REGION_LOV_RELATION') then
505 -- clear out previous region lov relation column data --
506 -- and load region item key values into record --
507 l_lov_relation_rec := l_empty_lov_relation_rec;
508 l_lov_relation_rec.region_application_id := l_item_rec.region_application_id;
509 l_lov_relation_rec.region_code := l_item_rec.region_code;
510 l_lov_relation_rec.attribute_application_id := l_item_rec.attribute_application_id;
511 l_lov_relation_rec.attribute_code := l_item_rec.attribute_code;
512 l_state := 100;
513 elsif ( l_token = 'CATEGORY_USAGE') then
514 -- clear out previous region lov relation column data --
515 -- and load region item key values into record --
516 l_category_usage_rec := l_empty_category_usage_rec;
517 l_category_usage_rec.region_application_id := l_item_rec.region_application_id;
518 l_category_usage_rec.region_code := l_item_rec.region_code;
519 l_category_usage_rec.attribute_application_id := l_item_rec.attribute_application_id;
520 l_category_usage_rec.attribute_code := l_item_rec.attribute_code;
521 l_state := 200;
522 elsif (l_token = 'REGION_GRAPH') then
523 -- clear out previous region graph data --
524 -- and load region graph key values into record --
525 -- l_graph_rec := l_empty_graph_rec;
526 -- l_graph_rec.region_application_id := l_region_rec.region_application_id;
527 -- l_graph_rec.region_code := l_region_rec.region_code;
528 l_state := 300;
529 elsif (l_token = 'REGION_GRAPH_COLUMN') then
530 -- clear out previous region graph column data --
531 -- and load region graph column key values into record --
532 -- l_graph_column_rec := l_empty_graph_column_rec;
533 -- l_graph_column_rec.region_application_id := l_graph_rec.region_application_id;
534 -- l_graph_column_rec.region_code := l_graph_rec.region_code;
535 -- l_graph_column_rec.graph_number := l_graph_rec.graph_number;
536 l_state := 400;
537 else
538 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
539 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
540 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
541 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
542 FND_MESSAGE.SET_TOKEN('EXPECTED', 'REGION_ITEM, REGION_LOV_RELATION, CATEGORY_USAGE');
543 FND_MSG_PUB.Add;
544 end if;
545 raise FND_API.G_EXC_ERROR;
546 end if;
547 elsif (l_state = 19) then
548 if (l_token = 'REGION') then
549 l_state := 0;
550 l_region_index := l_region_index + 1;
551 l_region_tbl(l_region_index) := l_region_rec;
552 else
553 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
554 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
555 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
556 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
557 FND_MESSAGE.SET_TOKEN('EXPECTED', 'REGION');
558 FND_MSG_PUB.Add;
559 end if;
560 raise FND_API.G_EXC_ERROR;
561 end if;
562
563 --
564 -- REGION_ITEM (states 20 - 39)
565 --
566 elsif (l_state = 20) then
567 if (l_token is not null) then
568 l_item_rec.attribute_application_id := to_number(l_token);
569 l_state := 21;
570 else
571 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
572 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
573 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
574 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
575 FND_MESSAGE.SET_TOKEN('EXPECTED', 'ATTRIBUTE_APPLICATION_ID');
576 FND_MSG_PUB.Add;
577 end if;
578 raise FND_API.G_EXC_ERROR;
579 end if;
580 elsif (l_state = 21) then
581 if (l_token is not null) then
582 l_item_rec.attribute_code := l_token;
583 l_value_count := null;
584 l_state := 30;
585 else
586 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
587 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
588 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
589 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
590 FND_MESSAGE.SET_TOKEN('EXPECTED', 'ATTRIBUTE_CODE');
591 FND_MSG_PUB.Add;
592 end if;
593 raise FND_API.G_EXC_ERROR;
594 end if;
595 elsif (l_state = 30) then
596 if (l_token = 'END') then
597 l_state := 39;
598 elsif (l_token = 'BEGIN') then
599 l_state := 13;
600 elsif (l_token = 'DISPLAY_SEQUENCE') or
601 (l_token = 'NODE_DISPLAY_FLAG') or
602 (l_token = 'NODE_QUERY_FLAG') or
603 (l_token = 'ATTRIBUTE_LABEL_LENGTH') or
604 (l_token = 'DISPLAY_VALUE_LENGTH') or
605 (l_token = 'BOLD') or
606 (l_token = 'ITALIC') or
607 (l_token = 'VERTICAL_ALIGNMENT') or
608 (l_token = 'HORIZONTAL_ALIGNMENT') or
609 (l_token = 'ITEM_STYLE') or
610 (l_token = 'OBJECT_ATTRIBUTE_FLAG') or
611 (l_token = 'ICX_CUSTOM_CALL') or
612 (l_token = 'UPDATE_FLAG') or
613 (l_token = 'REQUIRED_FLAG') or
614 (l_token = 'SECURITY_CODE') or
615 (l_token = 'DEFAULT_VALUE_VARCHAR2') or
616 (l_token = 'DEFAULT_VALUE_NUMBER') or
617 (l_token = 'DEFAULT_VALUE_DATE') or
618 (l_token = 'LOV_REGION') or
619 (l_token = 'LOV_FOREIGN_KEY_NAME') or
620 (l_token = 'LOV_ATTRIBUTE') or
621 (l_token = 'LOV_DEFAULT_FLAG') or
622 (l_token = 'REGION_DEFAULTING_API_PKG') or
623 (l_token = 'REGION_DEFAULTING_API_PROC') or
624 (l_token = 'REGION_VALIDATION_API_PKG') or
625 (l_token = 'REGION_VALIDATION_API_PROC') or
626 (l_token = 'ORDER_SEQUENCE') or
627 (l_token = 'INITIAL_SORT_SEQUENCE') or
628 (l_token = 'CUSTOMIZATION_APPLICATION_ID') or
629 (l_token = 'CUSTOMIZATION_CODE') or
630 (l_token = 'ORDER_DIRECTION') or
631 (l_token = 'SUBMIT') or
632 (l_token = 'ENCRYPT') or
633 (l_token = 'DISPLAY_HEIGHT') or
634 (l_token = 'CSS_CLASS_NAME') or
635 (l_token = 'VIEW_USAGE_NAME') or
636 (l_token = 'VIEW_ATTRIBUTE_NAME') or
637 (l_token = 'NESTED_REGION_APPLICATION_ID') or
638 (l_token = 'NESTED_REGION_CODE') or
639 (l_token = 'URL') or
640 (l_token = 'POPLIST_VIEWOBJECT') or
641 (l_token = 'POPLIST_DISPLAY_ATTRIBUTE') or
642 (l_token = 'POPLIST_VALUE_ATTRIBUTE') or
643 (l_token = 'IMAGE_FILE_NAME') or
644 (l_token = 'ITEM_NAME') or
645 (l_token = 'CSS_LABEL_CLASS_NAME') or
646 (l_token = 'MENU_NAME') or
647 (l_token = 'FLEXFIELD_NAME') or
648 (l_token = 'FLEXFIELD_APPLICATION_ID') or
649 (l_token = 'TABULAR_FUNCTION_CODE') or
650 (l_token = 'TIP_TYPE') or
651 (l_token = 'TIP_MESSAGE_NAME') or
652 (l_token = 'TIP_MESSAGE_APPLICATION_ID') or
653 (l_token = 'FLEX_SEGMENT_LIST') or
654 (l_token = 'ENTITY_ID') or
655 (l_token = 'ANCHOR') or
656 (l_token = 'POPLIST_VIEW_USAGE_NAME') or
657 (l_token = 'USER_CUSTOMIZABLE') or
658 (l_token = 'SORTBY_VIEW_ATTRIBUTE_NAME') or
659 (l_token = 'ADMIN_CUSTOMIZABLE') or
660 (l_token = 'INVOKE_FUNCTION_NAME') or
661 (l_token = 'EXPANSION') or
662 (l_token = 'ALS_MAX_LENGTH') or
663 (l_token = 'ATTRIBUTE_CATEGORY') or
664 (l_token = 'ATTRIBUTE1') or
665 (l_token = 'ATTRIBUTE2') or
666 (l_token = 'ATTRIBUTE3') or
667 (l_token = 'ATTRIBUTE4') or
668 (l_token = 'ATTRIBUTE5') or
669 (l_token = 'ATTRIBUTE6') or
670 (l_token = 'ATTRIBUTE7') or
671 (l_token = 'ATTRIBUTE8') or
672 (l_token = 'ATTRIBUTE9') or
673 (l_token = 'ATTRIBUTE10') or
674 (l_token = 'ATTRIBUTE11') or
675 (l_token = 'ATTRIBUTE12') or
676 (l_token = 'ATTRIBUTE13') or
677 (l_token = 'ATTRIBUTE14') or
678 (l_token = 'ATTRIBUTE15') or
679 (l_token = 'CREATED_BY') or
680 (l_token = 'CREATION_DATE') or
681 (l_token = 'LAST_UPDATED_BY') or
682 (l_token = 'OWNER') or
683 (l_token = 'LAST_UPDATE_DATE') or
684 (l_token = 'LAST_UPDATE_LOGIN') or
685 (l_token = 'ATTRIBUTE_LABEL_LONG') or
686 (l_token = 'ATTRIBUTE_LABEL_SHORT') or
687 (l_token = 'DESCRIPTION') then
688 l_column := l_token;
689 l_state := 31;
690 else
691 --
692 -- error if not expecting attribute values added by the translation team
693 -- or if we have read in more than a certain number of values
694 -- for the same DB column
695 --
696 l_value_count := l_value_count + 1;
697 --
698 -- save second value. It will be the token with error if
699 -- it turns out that there is a parse error on this line.
700 --
701 if (l_value_count = 2) then
702 l_saved_token := l_token;
703 end if;
704 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
705 (l_value_count is null) then
706 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
707 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
708 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
709 if (l_value_count is null) then
710 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
711 else
712 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
713 end if;
714 FND_MESSAGE.SET_TOKEN('EXPECTED','REGION_ITEM');
715 FND_MSG_PUB.Add;
716 end if;
717 raise FND_API.G_EXC_ERROR;
718 end if;
719 end if;
720 elsif (l_state = 31) then
721 if (l_token = '=') then
722 l_state := 32;
723 else
724 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
725 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
726 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
727 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
728 FND_MESSAGE.SET_TOKEN('EXPECTED', '=');
729 FND_MSG_PUB.Add;
730 end if;
731 raise FND_API.G_EXC_ERROR;
732 end if;
733 elsif (l_state = 32) then
734 l_value_count := 1;
735 if (l_column = 'DISPLAY_SEQUENCE') then
736 l_item_rec.DISPLAY_SEQUENCE := to_number(l_token);
737 l_state := 30;
738 elsif (l_column = 'NODE_DISPLAY_FLAG') then
739 l_item_rec.NODE_DISPLAY_FLAG := l_token;
740 l_state := 30;
741 elsif (l_column = 'NODE_QUERY_FLAG') then
742 l_item_rec.NODE_QUERY_FLAG := l_token;
743 l_state := 30;
744 elsif (l_column = 'ATTRIBUTE_LABEL_LENGTH') then
745 l_item_rec.ATTRIBUTE_LABEL_LENGTH := to_number(l_token);
746 l_state := 30;
747 elsif (l_column = 'DISPLAY_VALUE_LENGTH') then
748 l_item_rec.DISPLAY_VALUE_LENGTH := to_number(l_token);
749 l_state := 30;
750 elsif (l_column = 'BOLD') then
751 l_item_rec.BOLD := l_token;
752 l_state := 30;
753 elsif (l_column = 'ITALIC') then
754 l_item_rec.ITALIC := l_token;
755 l_state := 30;
756 elsif (l_column = 'VERTICAL_ALIGNMENT') then
757 l_item_rec.VERTICAL_ALIGNMENT := l_token;
758 l_state := 30;
759 elsif (l_column = 'HORIZONTAL_ALIGNMENT') then
760 l_item_rec.HORIZONTAL_ALIGNMENT := l_token;
761 l_state := 30;
762 elsif (l_column = 'ITEM_STYLE') then
763 l_item_rec.ITEM_STYLE := l_token;
764 l_state := 30;
765 elsif (l_column = 'OBJECT_ATTRIBUTE_FLAG') then
766 l_item_rec.OBJECT_ATTRIBUTE_FLAG := l_token;
767 l_state := 30;
768 elsif (l_column = 'ICX_CUSTOM_CALL') then
769 l_item_rec.ICX_CUSTOM_CALL := l_token;
770 l_state := 30;
771 elsif (l_column = 'UPDATE_FLAG') then
772 l_item_rec.update_flag := l_token;
773 l_state := 30;
774 elsif (l_column = 'REQUIRED_FLAG') then
775 l_item_rec.required_flag := l_token;
776 l_state := 30;
777 elsif (l_column = 'SECURITY_CODE') then
778 l_item_rec.security_code := l_token;
779 l_state := 30;
780 elsif (l_column = 'DEFAULT_VALUE_VARCHAR2') then
781 l_item_rec.default_value_varchar2 := l_token;
782 l_state := 30;
783 elsif (l_column = 'DEFAULT_VALUE_NUMBER') then
784 l_item_rec.default_value_number := to_number(l_token);
785 l_state := 30;
786 elsif (l_column = 'DEFAULT_VALUE_DATE') then
787 l_item_rec.default_value_date := to_date(l_token,
788 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
789 l_state := 30;
790 elsif (l_column = 'LOV_REGION') then
791 l_item_rec.lov_region_application_id := to_number(l_token);
792 l_state := 34;
793 elsif (l_column = 'LOV_FOREIGN_KEY_NAME') then
794 l_item_rec.lov_foreign_key_name := l_token;
795 l_state := 30;
796 elsif (l_column = 'LOV_ATTRIBUTE') then
797 l_item_rec.lov_attribute_application_id := to_number(l_token);
798 l_state := 34;
799 elsif (l_column = 'LOV_DEFAULT_FLAG') then
800 l_item_rec.lov_default_flag := l_token;
801 l_state := 30;
802 elsif (l_column = 'REGION_DEFAULTING_API_PKG') then
803 l_item_rec.REGION_defaulting_api_pkg := l_token;
804 l_state := 30;
805 elsif (l_column = 'REGION_DEFAULTING_API_PROC') then
806 l_item_rec.REGION_defaulting_api_proc := l_token;
807 l_state := 30;
808 elsif (l_column = 'REGION_VALIDATION_API_PKG') then
809 l_item_rec.REGION_validation_api_pkg := l_token;
810 l_state := 30;
811 elsif (l_column = 'REGION_VALIDATION_API_PROC') then
812 l_item_rec.REGION_validation_api_proc := l_token;
813 l_state := 30;
814 elsif (l_column = 'ORDER_SEQUENCE') then
815 l_item_rec.order_sequence := to_number(l_token);
816 l_state := 30;
817 elsif (l_column = 'INITIAL_SORT_SEQUENCE') then
818 l_item_rec.initial_sort_sequence := l_token;
819 l_state := 30;
820 elsif (l_column = 'CUSTOMIZATION_APPLICATION_ID') then
821 l_item_rec.customization_application_id := l_token;
822 l_state := 30;
823 elsif (l_column = 'CUSTOMIZATION_CODE') then
824 l_item_rec.customization_code := l_token;
825 l_state := 30;
826 elsif (l_column = 'ORDER_DIRECTION') then
827 l_item_rec.ORDER_DIRECTION := l_token;
828 l_state := 30;
829 elsif (l_column = 'SUBMIT') then
830 l_item_rec.SUBMIT := l_token;
831 l_state := 30;
832 elsif (l_column = 'ENCRYPT') then
833 l_item_rec.ENCRYPT := l_token;
834 l_state := 30;
835 elsif (l_column = 'DISPLAY_HEIGHT') then
836 l_item_rec.DISPLAY_HEIGHT := to_number(l_token);
837 l_state := 30;
838 elsif (l_column = 'CSS_CLASS_NAME') then
839 l_item_rec.CSS_CLASS_NAME := l_token;
840 l_state := 30;
841 elsif (l_column = 'VIEW_USAGE_NAME') then
842 l_item_rec.VIEW_USAGE_NAME := l_token;
843 l_state := 30;
844 elsif (l_column = 'VIEW_ATTRIBUTE_NAME') then
845 l_item_rec.VIEW_ATTRIBUTE_NAME := l_token;
846 l_state := 30;
847 elsif (l_column = 'NESTED_REGION_APPLICATION_ID') then
848 l_item_rec.NESTED_REGION_APPLICATION_ID := to_number(l_token);
849 l_state := 30;
850 elsif (l_column = 'NESTED_REGION_CODE') then
851 l_item_rec.NESTED_REGION_CODE := l_token;
852 l_state := 30;
853 elsif (l_column = 'URL') then
854 l_item_rec.URL := l_token;
855 l_state := 30;
856 elsif (l_column = 'POPLIST_VIEWOBJECT') then
857 l_item_rec.POPLIST_VIEWOBJECT := l_token;
858 l_state := 30;
859 elsif (l_column = 'POPLIST_DISPLAY_ATTRIBUTE') then
860 l_item_rec.POPLIST_DISPLAY_ATTR := l_token;
861 l_state := 30;
862 elsif (l_column = 'POPLIST_VALUE_ATTRIBUTE') then
863 l_item_rec.POPLIST_VALUE_ATTR := l_token;
864 l_state := 30;
865 elsif (l_column = 'IMAGE_FILE_NAME') then
866 l_item_rec.IMAGE_FILE_NAME := l_token;
867 l_state := 30;
868 elsif (l_column = 'ITEM_NAME') then
869 l_item_rec.ITEM_NAME := l_token;
870 l_state := 30;
871 elsif (l_column = 'CSS_LABEL_CLASS_NAME') then
872 l_item_rec.CSS_LABEL_CLASS_NAME := l_token;
873 l_state := 30;
874 elsif (l_column = 'MENU_NAME') then
875 l_item_rec.MENU_NAME := l_token;
876 l_state := 30;
877 elsif (l_column = 'FLEXFIELD_NAME') then
878 l_item_rec.FLEXFIELD_NAME := l_token;
879 l_state := 30;
880 elsif (l_column = 'FLEXFIELD_APPLICATION_ID') then
881 l_item_rec.FLEXFIELD_APPLICATION_ID := l_token;
882 l_state := 30;
883 elsif (l_column = 'TABULAR_FUNCTION_CODE') then
884 l_item_rec.TABULAR_FUNCTION_CODE := l_token;
885 l_state := 30;
886 elsif (l_column = 'TIP_TYPE') then
887 l_item_rec.TIP_TYPE := l_token;
888 l_state := 30;
889 elsif (l_column = 'TIP_MESSAGE_NAME') then
890 l_item_rec.TIP_MESSAGE_NAME := l_token;
891 l_state := 30;
892 elsif (l_column = 'TIP_MESSAGE_APPLICATION_ID') then
893 l_item_rec.TIP_MESSAGE_APPLICATION_ID := l_token;
894 l_state := 30;
895 elsif (l_column = 'FLEX_SEGMENT_LIST') then
896 l_item_rec.FLEX_SEGMENT_LIST := l_token;
897 l_state := 30;
898 elsif (l_column = 'ENTITY_ID') then
899 l_item_rec.ENTITY_ID := l_token;
900 l_state := 30;
901 elsif (l_column = 'ANCHOR') then
902 l_item_rec.ANCHOR := l_token;
903 l_state := 30;
904 elsif (l_column = 'POPLIST_VIEW_USAGE_NAME') then
905 l_item_rec.POPLIST_VIEW_USAGE_NAME := l_token;
906 l_state := 30;
907 elsif (l_column = 'USER_CUSTOMIZABLE') then
908 l_item_rec.USER_CUSTOMIZABLE := l_token;
909 l_state := 30;
910 elsif (l_column = 'SORTBY_VIEW_ATTRIBUTE_NAME') then
911 l_item_rec.SORTBY_VIEW_ATTRIBUTE_NAME := l_token;
912 l_state := 30;
913 elsif (l_column = 'ADMIN_CUSTOMIZABLE') then
914 l_item_rec.ADMIN_CUSTOMIZABLE := l_token;
915 l_state := 30;
916 elsif (l_column = 'INVOKE_FUNCTION_NAME') then
917 l_item_rec.INVOKE_FUNCTION_NAME := l_token;
918 l_state := 30;
919 elsif (l_column = 'EXPANSION') then
920 l_item_rec.EXPANSION := l_token;
921 l_state := 30;
922 elsif (l_column = 'ALS_MAX_LENGTH') then
923 l_item_rec.ALS_MAX_LENGTH := l_token;
924 l_state := 30;
925 elsif (l_column = 'ATTRIBUTE_CATEGORY') then
926 l_item_rec.attribute_category := l_token;
927 l_state := 30;
928 elsif (l_column = 'ATTRIBUTE1') then
929 l_item_rec.attribute1 := l_token;
930 l_state := 30;
931 elsif (l_column = 'ATTRIBUTE2') then
932 l_item_rec.attribute2 := l_token;
933 l_state := 30;
934 elsif (l_column = 'ATTRIBUTE3') then
935 l_item_rec.attribute3 := l_token;
936 l_state := 30;
937 elsif (l_column = 'ATTRIBUTE4') then
938 l_item_rec.attribute4 := l_token;
939 l_state := 30;
940 elsif (l_column = 'ATTRIBUTE5') then
941 l_item_rec.attribute5 := l_token;
942 l_state := 30;
943 elsif (l_column = 'ATTRIBUTE6') then
944 l_item_rec.attribute6 := l_token;
945 l_state := 30;
946 elsif (l_column = 'ATTRIBUTE7') then
947 l_item_rec.attribute7 := l_token;
948 l_state := 30;
949 elsif (l_column = 'ATTRIBUTE8') then
950 l_item_rec.attribute8 := l_token;
951 l_state := 30;
952 elsif (l_column = 'ATTRIBUTE9') then
953 l_item_rec.attribute9 := l_token;
954 l_state := 30;
955 elsif (l_column = 'ATTRIBUTE10') then
956 l_item_rec.attribute10 := l_token;
957 l_state := 30;
958 elsif (l_column = 'ATTRIBUTE11') then
959 l_item_rec.attribute11 := l_token;
960 l_state := 30;
961 elsif (l_column = 'ATTRIBUTE12') then
962 l_item_rec.attribute12 := l_token;
963 l_state := 30;
964 elsif (l_column = 'ATTRIBUTE13') then
965 l_item_rec.attribute13 := l_token;
966 l_state := 30;
967 elsif (l_column = 'ATTRIBUTE14') then
968 l_item_rec.attribute14 := l_token;
969 l_state := 30;
970 elsif (l_column = 'ATTRIBUTE15') then
971 l_item_rec.attribute15 := l_token;
972 l_state := 30;
973 elsif (l_column = 'CREATED_BY') then
974 l_item_rec.created_by := to_number(l_token);
975 l_state := 30;
976 elsif (l_column = 'CREATION_DATE') then
977 l_item_rec.creation_date := to_date(l_token,
978 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
979 l_state := 30;
980 elsif (l_column = 'LAST_UPDATED_BY') then
981 l_item_rec.last_updated_by := to_number(l_token);
982 l_state := 30;
983 elsif (l_column = 'OWNER') then
984 l_item_rec.last_updated_by := FND_LOAD_UTIL.OWNER_ID(l_token);
985 l_state := 30;
986 elsif (l_column = 'LAST_UPDATE_DATE') then
987 l_item_rec.last_update_date := to_date(l_token,
988 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
989 l_state := 30;
990 elsif (l_column = 'LAST_UPDATE_LOGIN') then
991 l_item_rec.last_update_login := to_number(l_token);
992 l_state := 30;
993 elsif (l_column = 'ATTRIBUTE_LABEL_LONG') then
994 l_item_rec.ATTRIBUTE_LABEL_LONG := l_token;
995 l_state := 30;
996 elsif (l_column = 'ATTRIBUTE_LABEL_SHORT') then
997 l_item_rec.ATTRIBUTE_LABEL_SHORT := l_token;
998 l_state := 30;
999 elsif (l_column = 'DESCRIPTION') then
1000 l_item_rec.DESCRIPTION := l_token;
1001 l_state := 30;
1002 else
1003 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1004 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1005 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1006 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1007 FND_MESSAGE.SET_TOKEN('EXPECTED', l_column || ' value');
1008 FND_MSG_PUB.Add;
1009 end if;
1010 raise FND_API.G_EXC_ERROR;
1011 end if;
1012 elsif (l_state = 34) then
1013 if (l_column = 'LOV_REGION') then
1014 l_item_rec.lov_region_code := l_token;
1015 l_state := 30;
1016 elsif (l_column = 'LOV_ATTRIBUTE') then
1017 l_item_rec.lov_attribute_code := l_token;
1018 l_state := 30;
1019 else
1020 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1021 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1022 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1023 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1024 FND_MESSAGE.SET_TOKEN('EXPECTED', l_column);
1025 FND_MSG_PUB.Add;
1026 end if;
1027 raise FND_API.G_EXC_ERROR;
1028 end if;
1029 elsif (l_state = 39) then
1030 if (l_token = 'REGION_ITEM') then
1031 l_value_count := null;
1032 l_state := 10;
1033 l_item_index := l_item_index + 1;
1034 l_item_tbl(l_item_index) := l_item_rec;
1035 else
1036 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1037 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1038 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1039 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1040 FND_MESSAGE.SET_TOKEN('EXPECTED', 'REGION_ITEM');
1041 FND_MSG_PUB.Add;
1042 end if;
1043 raise FND_API.G_EXC_ERROR;
1044 end if;
1045
1046 --
1047 -- REGION_LOV_RELATION (states 100 - 139)
1048 --
1049 elsif (l_state = 100) then
1050 if (l_token is not null) then
1051 l_lov_relation_rec.lov_region_appl_id := to_number(l_token);
1052 l_state := 101;
1053 else
1054 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1055 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1056 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1057 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1058 FND_MESSAGE.SET_TOKEN('EXPECTED', 'LOV_REGION_APPL_ID');
1059 FND_MSG_PUB.Add;
1060 end if;
1061 raise FND_API.G_EXC_ERROR;
1062 end if;
1063 elsif (l_state = 101) then
1064 if (l_token is not null) then
1065 l_lov_relation_rec.lov_region_code := l_token;
1066 l_value_count := null;
1067 l_state := 102;
1068 else
1069 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1070 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1071 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1072 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1073 FND_MESSAGE.SET_TOKEN('EXPECTED', 'LOV_REGION_CODE');
1074 FND_MSG_PUB.Add;
1075 end if;
1076 raise FND_API.G_EXC_ERROR;
1077 end if;
1078 elsif (l_state = 102) then
1079 if (l_token is not null) then
1080 l_lov_relation_rec.lov_attribute_appl_id := to_number(l_token);
1081 l_state := 103;
1082 else
1083 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1084 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1085 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1086 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1087 FND_MESSAGE.SET_TOKEN('EXPECTED', 'LOV_ATTRIBUTE_APPL_ID');
1088 FND_MSG_PUB.Add;
1089 end if;
1090 raise FND_API.G_EXC_ERROR;
1091 end if;
1092 elsif (l_state = 103) then
1093 if (l_token is not null) then
1094 l_lov_relation_rec.lov_attribute_code := l_token;
1095 l_value_count := null;
1096 l_state := 104;
1097 else
1098 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1099 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1100 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1101 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1102 FND_MESSAGE.SET_TOKEN('EXPECTED', 'LOV_ATTRIBUTE_CODE');
1103 FND_MSG_PUB.Add;
1104 end if;
1105 raise FND_API.G_EXC_ERROR;
1106 end if;
1107 elsif (l_state = 104) then
1108 if (l_token is not null) then
1109 l_lov_relation_rec.base_attribute_appl_id := to_number(l_token);
1110 l_state := 105;
1111 else
1112 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1113 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1114 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1115 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1116 FND_MESSAGE.SET_TOKEN('EXPECTED', 'BASE_ATTRIBUTE_APPL_ID');
1117 FND_MSG_PUB.Add;
1118 end if;
1119 raise FND_API.G_EXC_ERROR;
1120 end if;
1121 elsif (l_state = 105) then
1122 if (l_token is not null) then
1123 l_lov_relation_rec.base_attribute_code := l_token;
1124 l_value_count := null;
1125 l_state := 106;
1126 else
1127 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1128 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1129 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1130 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1131 FND_MESSAGE.SET_TOKEN('EXPECTED', 'BASE_ATTRIBUTE_CODE');
1132 FND_MSG_PUB.Add;
1133 end if;
1134 raise FND_API.G_EXC_ERROR;
1135 end if;
1136 elsif (l_state = 106) then
1137 if (l_token is not null) then
1138 l_lov_relation_rec.direction_flag := l_token;
1139 l_value_count := null;
1140 l_state := 130;
1141 else
1142 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1143 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1144 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1145 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1146 FND_MESSAGE.SET_TOKEN('EXPECTED', 'DIRECTION_FLAG');
1147 FND_MSG_PUB.Add;
1148 end if;
1149 raise FND_API.G_EXC_ERROR;
1150 end if;
1151 elsif (l_state = 130) then
1152 if (l_token = 'END') then
1153 l_state := 139;
1154 elsif ( l_token = 'BASE_REGION_APPL_ID' ) or
1155 ( l_token = 'BASE_REGION_CODE' ) or
1156 ( l_token = 'REQUIRED_FLAG' ) or
1157 (l_token = 'CREATED_BY') or
1158 (l_token = 'CREATION_DATE') or
1159 (l_token = 'LAST_UPDATED_BY') or
1160 (l_token = 'OWNER') or
1161 (l_token = 'LAST_UPDATE_DATE') or
1162 (l_token = 'LAST_UPDATE_LOGIN') then
1163 l_column := l_token;
1164 l_state := 131;
1165 else
1166 --
1167 -- error if not expecting attribute values added by the translation team
1168 -- or if we have read in more than a certain number of values
1169 -- for the same DB column
1170 --
1171 l_value_count := l_value_count + 1;
1172 --
1173 -- save second value. It will be the token with error if
1174 -- it turns out that there is a parse error on this line.
1175 --
1176 if (l_value_count = 2) then
1177 l_saved_token := l_token;
1178 end if;
1179 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
1180 (l_value_count is null) then
1181 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1182 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
1183 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1184 if (l_value_count is null) then
1185 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
1186 else
1187 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
1188 end if;
1189 FND_MESSAGE.SET_TOKEN('EXPECTED','REGION_LOV_RELATION');
1190 FND_MSG_PUB.Add;
1191 end if;
1192 raise FND_API.G_EXC_ERROR;
1193 end if;
1194 end if;
1195 elsif (l_state = 131) then
1196 if (l_token = '=') then
1197 l_state := 132;
1198 else
1199 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1200 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1201 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1202 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1203 FND_MESSAGE.SET_TOKEN('EXPECTED', '=');
1204 FND_MSG_PUB.Add;
1205 end if;
1206 raise FND_API.G_EXC_ERROR;
1207 end if;
1208 elsif (l_state = 132) then
1209 l_value_count := 1;
1210 if (l_column = 'BASE_REGION_APPL_ID') then
1211 l_lov_relation_rec.BASE_REGION_APPL_ID := to_number(l_token);
1212 l_state := 130;
1213 elsif (l_column = 'BASE_REGION_CODE') then
1214 l_lov_relation_rec.BASE_REGION_CODE := l_token;
1215 l_state := 130;
1216 elsif (l_column = 'REQUIRED_FLAG') then
1217 l_lov_relation_rec.REQUIRED_FLAG := l_token;
1218 l_state := 130;
1219 elsif (l_column = 'CREATED_BY') then
1220 l_lov_relation_rec.created_by := to_number(l_token);
1221 l_state := 130;
1222 elsif (l_column = 'CREATION_DATE') then
1223 l_lov_relation_rec.creation_date := to_date(l_token,
1224 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
1225 l_state := 130;
1226 elsif (l_column = 'LAST_UPDATED_BY') then
1227 l_lov_relation_rec.last_updated_by := to_number(l_token);
1228 l_state := 130;
1229 elsif (l_column = 'OWNER') then
1230 l_lov_relation_rec.last_updated_by := FND_LOAD_UTIL.OWNER_ID(l_token);
1231 l_state := 130;
1232 elsif (l_column = 'LAST_UPDATE_DATE') then
1233 l_lov_relation_rec.last_update_date := to_date(l_token,
1234 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
1235 l_state := 130;
1236 elsif (l_column = 'LAST_UPDATE_LOGIN') then
1237 l_lov_relation_rec.last_update_login := to_number(l_token);
1238 l_state := 130;
1239 else
1240 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1241 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1242 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1243 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1244 FND_MESSAGE.SET_TOKEN('EXPECTED', l_column || ' value');
1245 FND_MSG_PUB.Add;
1246 end if;
1247 raise FND_API.G_EXC_ERROR;
1248 end if;
1249 elsif (l_state = 139) then
1250 if (l_token = 'REGION_LOV_RELATION') then
1251 l_value_count := null;
1252 l_state := 30;
1253 l_lov_relation_index := l_lov_relation_index + 1;
1254 l_lov_relation_tbl(l_lov_relation_index) := l_lov_relation_rec;
1255 else
1256 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1257 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1258 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1259 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1260 FND_MESSAGE.SET_TOKEN('EXPECTED', 'REGION_LOV_RELATION');
1261 FND_MSG_PUB.Add;
1262 end if;
1263 raise FND_API.G_EXC_ERROR;
1264 end if;
1265
1266 --
1267 -- CATEGORY_USAGE (states 200 - 239)
1268 --
1269 elsif (l_state = 200) then
1270 if (l_token is not null) then
1271 l_category_usage_rec.category_id := to_number(l_token);
1272 -- select name into l_category_usage_rec.category_name from fnd_document_categories where category_id = l_category_usage_rec.category_id;
1273 l_value_count := null;
1274 l_state := 230;
1275 else
1276 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1277 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1278 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1279 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1280 FND_MESSAGE.SET_TOKEN('EXPECTED', 'CATEGORY_ID');
1281 FND_MSG_PUB.Add;
1282 end if;
1283 raise FND_API.G_EXC_ERROR;
1284 end if;
1285 elsif (l_state = 230) then
1286 if (l_token = 'END') then
1287 l_state := 239;
1288 elsif (l_token = 'CATEGORY_NAME') or
1289 (l_token = 'APPLICATION_ID') or
1290 (l_token = 'SHOW_ALL') or
1291 (l_token = 'CREATED_BY') or
1292 (l_token = 'CREATION_DATE') or
1293 (l_token = 'LAST_UPDATED_BY') or
1294 (l_token = 'OWNER') or
1295 (l_token = 'LAST_UPDATE_DATE') or
1296 (l_token = 'LAST_UPDATE_LOGIN') then
1297 l_column := l_token;
1298 l_state := 231;
1299 else
1300 --
1301 -- error if not expecting attribute values added by the translation team
1302 -- or if we have read in more than a certain number of values
1303 -- for the same DB column
1304 --
1305 l_value_count := l_value_count + 1;
1306 --
1307 -- save second value. It will be the token with error if
1308 -- it turns out that there is a parse error on this line.
1309 --
1310 if (l_value_count = 2) then
1311 l_saved_token := l_token;
1312 end if;
1313 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
1314 (l_value_count is null) then
1315 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1316 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
1317 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1318 if (l_value_count is null) then
1319 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
1320 else
1321 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
1322 end if;
1323 FND_MESSAGE.SET_TOKEN('EXPECTED','CATEGORY_USAGE');
1324 FND_MSG_PUB.Add;
1325 end if;
1326 raise FND_API.G_EXC_ERROR;
1327 end if;
1328 end if;
1329 elsif (l_state = 231) then
1330 if (l_token = '=') then
1331 l_state := 232;
1332 else
1333 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1334 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1335 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1336 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1337 FND_MESSAGE.SET_TOKEN('EXPECTED', '=');
1338 FND_MSG_PUB.Add;
1339 end if;
1340 raise FND_API.G_EXC_ERROR;
1341 end if;
1342 elsif (l_state = 232) then
1343 l_value_count := 1;
1344 if (l_column = 'CATEGORY_NAME') then
1345 l_category_usage_rec.CATEGORY_NAME := l_token;
1346 l_state := 230;
1347 elsif (l_column = 'APPLICATION_ID') then
1348 l_category_usage_rec.APPLICATION_ID := to_number(l_token);
1349 l_state := 230;
1350 elsif (l_column = 'SHOW_ALL') then
1351 l_category_usage_rec.SHOW_ALL := l_token;
1352 l_state := 230;
1353 elsif (l_column = 'CREATED_BY') then
1354 l_category_usage_rec.created_by := to_number(l_token);
1355 l_state := 230;
1356 elsif (l_column = 'CREATION_DATE') then
1357 l_category_usage_rec.creation_date := to_date(l_token,
1358 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
1359 l_state := 230;
1360 elsif (l_column = 'LAST_UPDATED_BY') then
1361 l_category_usage_rec.last_updated_by := to_number(l_token);
1362 l_state := 230;
1363 elsif (l_column = 'OWNER') then
1364 l_category_usage_rec.last_updated_by := FND_LOAD_UTIL.OWNER_ID(l_token);
1365 l_state := 230;
1366 elsif (l_column = 'LAST_UPDATE_DATE') then
1367 l_category_usage_rec.last_update_date := to_date(l_token,
1368 AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
1369 l_state := 230;
1370 elsif (l_column = 'LAST_UPDATE_LOGIN') then
1371 l_category_usage_rec.last_update_login := to_number(l_token);
1372 l_state := 230;
1373 else
1374 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1375 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1376 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1377 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1378 FND_MESSAGE.SET_TOKEN('EXPECTED', l_column || ' value');
1379 FND_MSG_PUB.Add;
1380 end if;
1381 raise FND_API.G_EXC_ERROR;
1382 end if;
1383 elsif (l_state = 239) then
1384 if (l_token = 'CATEGORY_USAGE') then
1385 l_value_count := null;
1386 l_state := 30;
1387 l_category_usage_index := l_category_usage_index + 1;
1388 l_category_usage_tbl(l_category_usage_index) := l_category_usage_rec;
1389 else
1390 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1391 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1392 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1393 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1394 FND_MESSAGE.SET_TOKEN('EXPECTED', 'CATEGORY_USAGE');
1395 FND_MSG_PUB.Add;
1396 end if;
1397 raise FND_API.G_EXC_ERROR;
1398 end if;
1399
1400 --
1401 -- REGION_GRAPH (states 300 - 339)
1402 --
1403 elsif (l_state = 300) then
1404 if (l_token is not null) then
1405 -- l_graph_rec.graph_number := to_number(l_token);
1406 l_state := 310;
1407 else
1408 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1409 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1410 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1411 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1412 FND_MESSAGE.SET_TOKEN('EXPECTED', 'GRAPH_NUMBER');
1413 FND_MSG_PUB.Add;
1414 end if;
1415 raise FND_API.G_EXC_ERROR;
1416 end if;
1417 elsif (l_state = 310) then
1418 if (l_token = 'END') then
1419 l_state := 319;
1420 elsif (l_token = 'BEGIN') then
1421 l_state := 13;
1422 elsif (l_token = 'GRAPH_STYLE') or
1423 (l_token = 'DISPLAY_FLAG') or
1424 (l_token = 'DEPTH_RADIUS') or
1425 (l_token = 'GRAPH_TITLE') or
1426 (l_token = 'Y_AXIS_LABEL') or
1427 (l_token = 'CREATED_BY') or
1428 (l_token = 'CREATION_DATE') or
1429 (l_token = 'LAST_UPDATED_BY') or
1430 (l_token = 'LAST_UPDATE_DATE') or
1431 (l_token = 'LAST_UPDATE_LOGIN') then
1432 l_column := l_token;
1433 l_state := 311;
1434 else
1435 --
1436 -- error if not expecting attribute values added by the translation team
1437 -- or if we have read in more than a certain number of values
1438 -- for the same DB column
1439 --
1440 l_value_count := l_value_count + 1;
1441 --
1442 -- save second value. It will be the token with error if
1443 -- it turns out that there is a parse error on this line.
1444 --
1445 if (l_value_count = 2) then
1446 l_saved_token := l_token;
1447 end if;
1448 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
1449 (l_value_count is null) then
1450 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1451 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
1452 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1453 if (l_value_count is null) then
1454 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
1455 else
1456 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
1457 end if;
1458 FND_MESSAGE.SET_TOKEN('EXPECTED','REGION_GRAPH');
1459 FND_MSG_PUB.Add;
1460 end if;
1461 raise FND_API.G_EXC_ERROR;
1462 end if;
1463 end if;
1464 elsif (l_state = 311) then
1465 if (l_token = '=') then
1466 l_state := 312;
1467 else
1468 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1469 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1470 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1471 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1472 FND_MESSAGE.SET_TOKEN('EXPECTED', '=');
1473 FND_MSG_PUB.Add;
1474 end if;
1475 raise FND_API.G_EXC_ERROR;
1476 end if;
1477 elsif (l_state = 312) then
1478 l_value_count := 1;
1479 if (l_column = 'GRAPH_STYLE') then
1480 -- l_graph_rec.GRAPH_STYLE := to_number(l_token);
1481 l_state := 310;
1482 elsif (l_column = 'DISPLAY_FLAG') then
1483 -- l_graph_rec.DISPLAY_FLAG := l_token;
1484 l_state := 310;
1485 elsif (l_column = 'DEPTH_RADIUS') then
1486 -- l_graph_rec.DEPTH_RADIUS := to_number(l_token);
1487 l_state := 310;
1488 elsif (l_column = 'GRAPH_TITLE') then
1489 -- l_graph_rec.GRAPH_TITLE := l_token;
1490 l_state := 310;
1491 elsif (l_column = 'Y_AXIS_LABEL') then
1492 -- l_graph_rec.Y_AXIS_LABEL := l_token;
1493 l_state := 310;
1494 elsif (l_column = 'CREATED_BY') then
1495 -- l_graph_rec.created_by := to_number(l_token);
1496 l_state := 310;
1497 elsif (l_column = 'CREATION_DATE') then
1498 -- l_graph_rec.creation_date := to_date(l_token,
1499 -- AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
1500 l_state := 310;
1501 elsif (l_column = 'LAST_UPDATED_BY') then
1502 -- l_graph_rec.last_updated_by := to_number(l_token);
1503 l_state := 310;
1504 elsif (l_column = 'LAST_UPDATE_DATE') then
1505 -- l_graph_rec.last_update_date := to_date(l_token,
1506 -- AK_ON_OBJECTS_PUB.G_DATE_FORMAT);
1507 l_state := 310;
1508 elsif (l_column = 'LAST_UPDATE_LOGIN') then
1509 -- l_graph_rec.last_update_login := to_number(l_token);
1510 l_state := 310;
1511 else
1512 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1513 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1514 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1515 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1516 FND_MESSAGE.SET_TOKEN('EXPECTED', l_column || ' value');
1517 FND_MSG_PUB.Add;
1518 end if;
1519 raise FND_API.G_EXC_ERROR;
1520 end if;
1521 elsif (l_state = 319) then
1522 if (l_token = 'REGION_GRAPH') then
1523 l_value_count := null;
1524 l_state := 10;
1525 -- l_graph_index := l_graph_index + 1;
1526 -- l_graph_tbl(l_graph_index) := l_graph_rec;
1527 else
1528 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1529 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1530 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1531 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1532 FND_MESSAGE.SET_TOKEN('EXPECTED', 'REGION_GRAPH');
1533 FND_MSG_PUB.Add;
1534 end if;
1535 raise FND_API.G_EXC_ERROR;
1536 end if;
1537
1538 --
1539 -- REGION_GRAPH_COLUMN (400 - 449)
1540 --
1541 elsif (l_state = 400) then
1542 if (l_token is not null) then
1543 -- l_graph_column_rec.attribute_application_id := to_number(l_token);
1544 l_state := 401;
1545 else
1546 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1547 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1548 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1549 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1550 FND_MESSAGE.SET_TOKEN('EXPECTED', 'ATTRIBUTE_APPLICATION_ID');
1551 FND_MSG_PUB.Add;
1552 end if;
1553 raise FND_API.G_EXC_ERROR;
1554 end if;
1555 elsif (l_state = 401) then
1556 if (l_token is not null) then
1557 -- l_graph_column_rec.attribute_code := l_token;
1558 l_value_count := null;
1559 l_state := 410;
1560 else
1561 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1562 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_VALUE');
1563 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1564 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1565 FND_MESSAGE.SET_TOKEN('EXPECTED', 'ATTRIBUTE_CODE');
1566 FND_MSG_PUB.Add;
1567 end if;
1568 raise FND_API.G_EXC_ERROR;
1569 end if;
1570 elsif (l_state = 410) then
1571 if (l_token = 'END') then
1572 l_state := 419;
1573 else
1574 --
1575 -- error if not expecting attribute values added by the translation team
1576 -- or if we have read in more than a certain number of values
1577 -- for the same DB column
1578 --
1579 l_value_count := l_value_count + 1;
1580 --
1581 -- save second value. It will be the token with error if
1582 -- it turns out that there is a parse error on this line.
1583 --
1584 if (l_value_count = 2) then
1585 l_saved_token := l_token;
1586 end if;
1587 if (l_value_count > AK_ON_OBJECTS_PUB.G_MAX_NUM_LOADER_VALUES) or
1588 (l_value_count is null) then
1589 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1590 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR_EFIELD');
1591 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1592 if (l_value_count is null) then
1593 FND_MESSAGE.SET_TOKEN('TOKEN', l_token);
1594 else
1595 FND_MESSAGE.SET_TOKEN('TOKEN',l_saved_token);
1596 end if;
1597 FND_MESSAGE.SET_TOKEN('EXPECTED','REGION_GRAPH_COLUMN');
1598 FND_MSG_PUB.Add;
1599 end if;
1600 raise FND_API.G_EXC_ERROR;
1601 end if;
1602 end if;
1603 elsif (l_state = 419) then
1604 if (l_token = 'REGION_GRAPH_COLUMN') then
1605 l_value_count := null;
1606 l_state := 310;
1607 -- l_graph_column_index := l_graph_column_index + 1;
1608 -- l_graph_column_tbl(l_graph_column_index) := l_graph_column_rec;
1609 else
1610 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1611 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1612 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1613 FND_MESSAGE.SET_TOKEN('TOKEN',l_token);
1614 FND_MESSAGE.SET_TOKEN('EXPECTED', 'REGION_GRAPH_COLUMN');
1615 FND_MSG_PUB.Add;
1616 end if;
1617 raise FND_API.G_EXC_ERROR;
1618 end if;
1619
1620 end if; -- if l_state = ...
1621
1622 -- Get rid of leading white spaces, so that buffer would become
1623 -- null if the only thing in it are white spaces
1624 l_buffer := LTRIM(l_buffer);
1625
1626 -- Get the next non-blank, non-comment line if current line is
1627 -- fully parsed
1628 while (l_buffer is null and l_eof_flag = 'N' and p_index <= AK_ON_OBJECTS_PVT.G_UPL_TABLE_NUM) loop
1629 AK_ON_OBJECTS_PVT.READ_LINE (
1630 p_return_status => l_return_status,
1631 p_index => p_index,
1632 p_buffer => l_buffer,
1633 p_lines_read => l_lines_read,
1634 p_eof_flag => l_eof_flag,
1635 p_upl_loader_cur => p_upl_loader_cur
1636 );
1637 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
1638 (l_return_status = FND_API.G_RET_STS_ERROR) then
1639 RAISE FND_API.G_EXC_ERROR;
1640 end if;
1641 l_line_num := l_line_num + l_lines_read;
1642 --
1643 -- trim leading spaces and discard comment lines
1644 --
1645 l_buffer := LTRIM(l_buffer);
1646 if (SUBSTR(l_buffer, 1, 1) = '#') then
1647 l_buffer := null;
1648 end if;
1649 end loop;
1650
1651 end LOOP;
1652
1653 -- If the loops end in a state other then at the end of a region
1654 -- (state 0) or when the beginning of another business object was
1655 -- detected, then the file must have ended prematurely, which is an error
1656 if (l_state <> 0) and (l_more_region) then
1657 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1658 FND_MESSAGE.SET_NAME('AK','AK_PARSE_ERROR');
1659 FND_MESSAGE.SET_TOKEN('LINENUM', to_char(l_line_num));
1660 FND_MESSAGE.SET_TOKEN('TOKEN', 'END OF FILE');
1661 FND_MESSAGE.SET_TOKEN('EXPECTED', null);
1662 FND_MSG_PUB.Add;
1663 end if;
1664 --dbms_output.put_line('Unexpected END OF FILE: state is ' ||
1665 -- to_char(l_state));
1666 raise FND_API.G_EXC_ERROR;
1667 end if;
1668
1669 --
1670 -- create or update all regions to the database
1671 --
1672 if (l_region_tbl.count > 0) then
1673 for l_index in l_region_tbl.FIRST .. l_region_tbl.LAST loop
1674 if (l_region_tbl.exists(l_index)) then
1675 if AK_REGION_PVT.REGION_EXISTS (
1676 p_api_version_number => 1.0,
1677 p_return_status => l_return_status,
1678 p_region_application_id =>
1679 l_region_tbl(l_index).region_application_id,
1680 p_region_code => l_region_tbl(l_index).region_code) then
1681 /* REMOVE DELETE FUNCTIONALITY DURING UPLOAD
1682 --Delete all region items under this region only when the
1683 --jlt file was extracted in the REGION mode
1684 if (AK_UPLOAD_GRP.G_EXTRACT_OBJ = 'REGION') then
1685 for l_item_rec in l_get_region_item_csr(
1686 l_region_tbl(l_index).region_application_id,
1687 l_region_tbl(l_index).region_code) LOOP
1688 AK_REGION_PVT.DELETE_ITEM (
1689 p_validation_level => p_validation_level,
1690 p_api_version_number => 1.0,
1691 p_msg_count => l_msg_count,
1692 p_msg_data => l_msg_data,
1693 p_return_status => l_return_status,
1694 p_region_application_id =>
1695 l_region_tbl(l_index).region_application_id,
1696 p_region_code => l_region_tbl(l_index).region_code,
1697 p_attribute_application_id =>
1698 l_item_rec.attribute_application_id,
1699 p_attribute_code => l_item_rec.attribute_code,
1700 p_delete_cascade => 'N');
1701 end loop;
1702 end if;
1703 */
1704 --
1705 -- Update Regions only if G_UPDATE_MODE is TRUE
1706 --
1707 if (AK_UPLOAD_GRP.G_UPDATE_MODE) then
1708 AK_REGION_PVT.UPDATE_REGION (
1709 p_validation_level => p_validation_level,
1710 p_api_version_number => 1.0,
1711 p_msg_count => l_msg_count,
1712 p_msg_data => l_msg_data,
1713 p_return_status => l_return_status,
1714 p_region_application_id =>
1715 l_region_tbl(l_index).region_application_id,
1716 p_region_code => l_region_tbl(l_index).region_code,
1717 p_database_object_name =>l_region_tbl(l_index).database_object_name,
1718 p_region_style => l_region_tbl(l_index).region_style,
1719 p_num_columns => l_region_tbl(l_index).num_columns,
1720 p_icx_custom_call => l_region_tbl(l_index).icx_custom_call,
1721 p_region_defaulting_api_pkg =>
1722 l_region_tbl(l_index).region_defaulting_api_pkg,
1723 p_region_defaulting_api_proc =>
1724 l_region_tbl(l_index).region_defaulting_api_proc,
1725 p_region_validation_api_pkg =>
1726 l_region_tbl(l_index).region_validation_api_pkg,
1727 p_region_validation_api_proc =>
1728 l_region_tbl(l_index).region_validation_api_proc,
1729 p_appmodule_object_type =>
1730 l_region_tbl(l_index).applicationmodule_object_type,
1731 p_num_rows_display =>
1732 l_region_tbl(l_index).num_rows_display,
1733 p_region_object_type =>
1734 l_region_tbl(l_index).region_object_type,
1735 p_image_file_name =>
1736 l_region_tbl(l_index).image_file_name,
1737 p_isform_flag => l_region_tbl(l_index).isform_flag,
1738 p_help_target => l_region_tbl(l_index).help_target,
1739 p_style_sheet_filename => l_region_tbl(l_index).style_sheet_filename,
1740 p_version => l_region_tbl(l_index).version,
1741 p_applicationmodule_usage_name => l_region_tbl(l_index).applicationmodule_usage_name,
1742 p_add_indexed_children => l_region_tbl(l_index).add_indexed_children,
1743 p_stateful_flag => l_region_tbl(l_index).stateful_flag,
1744 p_function_name => l_region_tbl(l_index).function_name,
1745 p_children_view_usage_name => l_region_tbl(l_index).children_view_usage_name,
1746 p_search_panel => l_region_tbl(l_index).search_panel,
1747 p_advanced_search_panel => l_region_tbl(l_index).advanced_search_panel,
1748 p_customize_panel => l_region_tbl(l_index).customize_panel,
1749 p_default_search_panel => l_region_tbl(l_index).default_search_panel,
1750 p_results_based_search => l_region_tbl(l_index).results_based_search,
1751 p_display_graph_table => l_region_tbl(l_index).display_graph_table,
1752 p_disable_header => l_region_tbl(l_index).disable_header,
1753 p_standalone => l_region_tbl(l_index).standalone,
1754 p_auto_customization_criteria => l_region_tbl(l_index).auto_customization_criteria,
1755 p_attribute_category => l_region_tbl(l_index).attribute_category,
1756 p_attribute1 => l_region_tbl(l_index).attribute1,
1757 p_attribute2 => l_region_tbl(l_index).attribute2,
1758 p_attribute3 => l_region_tbl(l_index).attribute3,
1759 p_attribute4 => l_region_tbl(l_index).attribute4,
1760 p_attribute5 => l_region_tbl(l_index).attribute5,
1761 p_attribute6 => l_region_tbl(l_index).attribute6,
1762 p_attribute7 => l_region_tbl(l_index).attribute7,
1763 p_attribute8 => l_region_tbl(l_index).attribute8,
1764 p_attribute9 => l_region_tbl(l_index).attribute9,
1765 p_attribute10 => l_region_tbl(l_index).attribute10,
1766 p_attribute11 => l_region_tbl(l_index).attribute11,
1767 p_attribute12 => l_region_tbl(l_index).attribute12,
1768 p_attribute13 => l_region_tbl(l_index).attribute13,
1769 p_attribute14 => l_region_tbl(l_index).attribute14,
1770 p_attribute15 => l_region_tbl(l_index).attribute15,
1771 p_name => l_region_tbl(l_index).name,
1772 p_description => l_region_tbl(l_index).description,
1773 p_created_by => l_region_tbl(l_index).created_by,
1774 p_creation_date => l_region_tbl(l_index).creation_date,
1775 p_last_updated_by => l_region_tbl(l_index).last_updated_by,
1776 p_last_update_date => l_region_tbl(l_index).last_update_date,
1777 p_last_update_login => l_region_tbl(l_index).last_update_login,
1778 p_loader_timestamp => p_loader_timestamp,
1779 p_pass => p_pass,
1780 p_copy_redo_flag => l_copy_redo_flag
1781 );
1782 elsif (AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE) then
1783 -- do not update customized data
1784 select ar.last_updated_by, art.last_updated_by,
1785 ar.last_update_date, art.last_update_date
1786 into l_user_id1, l_user_id2, l_update1, l_update2
1787 from ak_regions ar, ak_regions_tl art
1788 where ar.region_code = l_region_tbl(l_index).region_code
1789 and ar.region_application_id = l_region_tbl(l_index).region_application_id
1790 and ar.region_code = art.region_code
1791 and ar.region_application_id = art.region_application_id
1792 and art.language = userenv('LANG');
1793 /*if (( l_user_id1 = 1 or l_user_id1 = 2 ) and
1794 ( l_user_id2 = 1 or l_user_id2 = 2 )) then*/
1795 if (AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
1796 p_loader_timestamp => p_loader_timestamp,
1797 p_created_by => l_region_tbl(l_index).created_by,
1798 p_creation_date => l_region_tbl(l_index).creation_date,
1799 p_last_updated_by => l_region_tbl(l_index).last_updated_by,
1800 p_db_last_updated_by => l_user_id1,
1801 p_last_update_date => l_region_tbl(l_index).last_update_date,
1802 p_db_last_update_date => l_update1,
1803 p_last_update_login => l_region_tbl(l_index).last_update_login,
1804 p_create_or_update => 'UPDATE') and
1805
1806 AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
1807 p_loader_timestamp => p_loader_timestamp,
1808 p_created_by => l_region_tbl(l_index).created_by,
1809 p_creation_date => l_region_tbl(l_index).creation_date,
1810 p_last_updated_by => l_region_tbl(l_index).last_updated_by,
1811 p_db_last_updated_by => l_user_id2,
1812 p_last_update_date => l_region_tbl(l_index).last_update_date,
1813 p_db_last_update_date => l_update2,
1814 p_last_update_login => l_region_tbl(l_index).last_update_login,
1815 p_create_or_update => 'UPDATE')) then
1816
1817 AK_REGION_PVT.UPDATE_REGION (
1818 p_validation_level => p_validation_level,
1819 p_api_version_number => 1.0,
1820 p_msg_count => l_msg_count,
1821 p_msg_data => l_msg_data,
1822 p_return_status => l_return_status,
1823 p_region_application_id =>
1824 l_region_tbl(l_index).region_application_id,
1825 p_region_code => l_region_tbl(l_index).region_code,
1826 p_database_object_name =>l_region_tbl(l_index).database_object_name,
1827 p_region_style => l_region_tbl(l_index).region_style,
1828 p_num_columns => l_region_tbl(l_index).num_columns,
1829 p_icx_custom_call => l_region_tbl(l_index).icx_custom_call,
1830 p_region_defaulting_api_pkg =>
1831 l_region_tbl(l_index).region_defaulting_api_pkg,
1832 p_region_defaulting_api_proc =>
1833 l_region_tbl(l_index).region_defaulting_api_proc,
1834 p_region_validation_api_pkg =>
1835 l_region_tbl(l_index).region_validation_api_pkg,
1836 p_region_validation_api_proc =>
1837 l_region_tbl(l_index).region_validation_api_proc,
1838 p_appmodule_object_type =>
1839 l_region_tbl(l_index).applicationmodule_object_type,
1840 p_num_rows_display =>
1841 l_region_tbl(l_index).num_rows_display,
1842 p_region_object_type =>
1843 l_region_tbl(l_index).region_object_type,
1844 p_image_file_name =>
1845 l_region_tbl(l_index).image_file_name,
1846 p_isform_flag => l_region_tbl(l_index).isform_flag,
1847 p_help_target => l_region_tbl(l_index).help_target,
1848 p_style_sheet_filename => l_region_tbl(l_index).style_sheet_filename,
1849 p_version => l_region_tbl(l_index).version,
1850 p_applicationmodule_usage_name => l_region_tbl(l_index).applicationmodule_usage_name,
1851 p_add_indexed_children => l_region_tbl(l_index).add_indexed_children,
1852 p_stateful_flag => l_region_tbl(l_index).stateful_flag,
1853 p_function_name => l_region_tbl(l_index).function_name,
1854 p_children_view_usage_name => l_region_tbl(l_index).children_view_usage_name,
1855 p_search_panel => l_region_tbl(l_index).search_panel,
1856 p_advanced_search_panel => l_region_tbl(l_index).advanced_search_panel,
1857 p_customize_panel => l_region_tbl(l_index).customize_panel,
1858 p_default_search_panel => l_region_tbl(l_index).default_search_panel,
1859 p_results_based_search => l_region_tbl(l_index).results_based_search,
1860 p_display_graph_table => l_region_tbl(l_index).display_graph_table,
1861 p_disable_header => l_region_tbl(l_index).disable_header,
1862 p_standalone => l_region_tbl(l_index).standalone,
1863 p_auto_customization_criteria => l_region_tbl(l_index).auto_customization_criteria,
1864 p_attribute_category => l_region_tbl(l_index).attribute_category,
1865 p_attribute1 => l_region_tbl(l_index).attribute1,
1866 p_attribute2 => l_region_tbl(l_index).attribute2,
1867 p_attribute3 => l_region_tbl(l_index).attribute3,
1868 p_attribute4 => l_region_tbl(l_index).attribute4,
1869 p_attribute5 => l_region_tbl(l_index).attribute5,
1870 p_attribute6 => l_region_tbl(l_index).attribute6,
1871 p_attribute7 => l_region_tbl(l_index).attribute7,
1872 p_attribute8 => l_region_tbl(l_index).attribute8,
1873 p_attribute9 => l_region_tbl(l_index).attribute9,
1874 p_attribute10 => l_region_tbl(l_index).attribute10,
1875 p_attribute11 => l_region_tbl(l_index).attribute11,
1876 p_attribute12 => l_region_tbl(l_index).attribute12,
1877 p_attribute13 => l_region_tbl(l_index).attribute13,
1878 p_attribute14 => l_region_tbl(l_index).attribute14,
1879 p_attribute15 => l_region_tbl(l_index).attribute15,
1880 p_name => l_region_tbl(l_index).name,
1881 p_description => l_region_tbl(l_index).description,
1882 p_created_by => l_region_tbl(l_index).created_by,
1883 p_creation_date => l_region_tbl(l_index).creation_date,
1884 p_last_updated_by => l_region_tbl(l_index).last_updated_by,
1885 p_last_update_date => l_region_tbl(l_index).last_update_date,
1886 p_last_update_login => l_region_tbl(l_index).last_update_login,
1887 p_loader_timestamp => p_loader_timestamp,
1888 p_pass => p_pass,
1889 p_copy_redo_flag => l_copy_redo_flag
1890 );
1891 end if; -- /* if ( l_user_id1 = 1 and l_user_id2 = 1 ) */
1892 end if; -- /* if G_UPDATE_MODE G_NC_UPDATE_MODE*/
1893 else
1894 AK_REGION_PVT.CREATE_REGION (
1895 p_validation_level => p_validation_level,
1896 p_api_version_number => 1.0,
1897 p_msg_count => l_msg_count,
1898 p_msg_data => l_msg_data,
1899 p_return_status => l_return_status,
1900 p_region_application_id =>
1901 l_region_tbl(l_index).region_application_id,
1902 p_region_code => l_region_tbl(l_index).region_code,
1903 p_database_object_name =>l_region_tbl(l_index).database_object_name,
1904 p_region_style => l_region_tbl(l_index).region_style,
1905 p_num_columns => l_region_tbl(l_index).num_columns,
1906 p_icx_custom_call => l_region_tbl(l_index).icx_custom_call,
1907 p_region_defaulting_api_pkg =>
1908 l_region_tbl(l_index).region_defaulting_api_pkg,
1909 p_region_defaulting_api_proc =>
1910 l_region_tbl(l_index).region_defaulting_api_proc,
1911 p_region_validation_api_pkg =>
1912 l_region_tbl(l_index).region_validation_api_pkg,
1913 p_region_validation_api_proc =>
1914 l_region_tbl(l_index).region_validation_api_proc,
1915 p_appmodule_object_type =>
1916 l_region_tbl(l_index).applicationmodule_object_type,
1917 p_num_rows_display =>
1918 l_region_tbl(l_index).num_rows_display,
1919 p_region_object_type =>
1920 l_region_tbl(l_index).region_object_type,
1921 p_image_file_name =>
1922 l_region_tbl(l_index).image_file_name,
1923 p_isform_flag => l_region_tbl(l_index).isform_flag,
1924 p_help_target => l_region_tbl(l_index).help_target,
1925 p_style_sheet_filename => l_region_tbl(l_index).style_sheet_filename,
1926 p_version => l_region_tbl(l_index).version,
1927 p_applicationmodule_usage_name => l_region_tbl(l_index).applicationmodule_usage_name,
1928 p_add_indexed_children => l_region_tbl(l_index).add_indexed_children,
1929 p_stateful_flag => l_region_tbl(l_index).stateful_flag,
1930 p_function_name => l_region_tbl(l_index).function_name,
1931 p_children_view_usage_name => l_region_tbl(l_index).children_view_usage_name,
1932 p_search_panel => l_region_tbl(l_index).search_panel,
1933 p_advanced_search_panel => l_region_tbl(l_index).advanced_search_panel,
1934 p_customize_panel => l_region_tbl(l_index).customize_panel,
1935 p_default_search_panel => l_region_tbl(l_index).default_search_panel,
1936 p_results_based_search => l_region_tbl(l_index).results_based_search,
1937 p_display_graph_table => l_region_tbl(l_index).display_graph_table,
1938 p_disable_header => l_region_tbl(l_index).disable_header,
1939 p_standalone => l_region_tbl(l_index).standalone,
1940 p_auto_customization_criteria => l_region_tbl(l_index).auto_customization_criteria,
1941 p_attribute_category => l_region_tbl(l_index).attribute_category,
1942 p_attribute1 => l_region_tbl(l_index).attribute1,
1943 p_attribute2 => l_region_tbl(l_index).attribute2,
1944 p_attribute3 => l_region_tbl(l_index).attribute3,
1945 p_attribute4 => l_region_tbl(l_index).attribute4,
1946 p_attribute5 => l_region_tbl(l_index).attribute5,
1947 p_attribute6 => l_region_tbl(l_index).attribute6,
1948 p_attribute7 => l_region_tbl(l_index).attribute7,
1949 p_attribute8 => l_region_tbl(l_index).attribute8,
1950 p_attribute9 => l_region_tbl(l_index).attribute9,
1951 p_attribute10 => l_region_tbl(l_index).attribute10,
1952 p_attribute11 => l_region_tbl(l_index).attribute11,
1953 p_attribute12 => l_region_tbl(l_index).attribute12,
1954 p_attribute13 => l_region_tbl(l_index).attribute13,
1955 p_attribute14 => l_region_tbl(l_index).attribute14,
1956 p_attribute15 => l_region_tbl(l_index).attribute15,
1957 p_name => l_region_tbl(l_index).name,
1958 p_description => l_region_tbl(l_index).description,
1959 p_created_by => l_region_tbl(l_index).created_by,
1960 p_creation_date => l_region_tbl(l_index).creation_date,
1961 p_last_updated_by => l_region_tbl(l_index).last_updated_by,
1962 p_last_update_date => l_region_tbl(l_index).last_update_date,
1963 p_last_update_login => l_region_tbl(l_index).last_update_login,
1964 p_loader_timestamp => p_loader_timestamp,
1965 p_pass => p_pass,
1966 p_copy_redo_flag => l_copy_redo_flag
1967 );
1968 end if; -- /* if REGION_EXISTS */
1969 --
1970 -- If API call returns with an error status, upload aborts
1971 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
1972 (l_return_status = FND_API.G_RET_STS_ERROR) then
1973 RAISE FND_API.G_EXC_ERROR;
1974 end if; -- /* if l_return_status */
1975 --
1976 -- if validation fails, then this record should go to second pass
1977 if (l_copy_redo_flag) then
1978 G_REGION_REDO_INDEX := G_REGION_REDO_INDEX + 1;
1979 G_REGION_REDO_TBL(G_REGION_REDO_INDEX) := l_region_tbl(l_index);
1980 l_copy_redo_flag := FALSE;
1981 end if; --/* if l_copy_redo_flag */
1982 end if;
1983 end loop;
1984 end if;
1985
1986 --
1987 -- create or update all region items to the database
1988 --
1989 if (l_item_tbl.count > 0) then
1990 for l_index in l_item_tbl.FIRST .. l_item_tbl.LAST loop
1991 if (l_item_tbl.exists(l_index)) then
1992 if AK_REGION_PVT.ITEM_EXISTS (
1993 p_api_version_number => 1.0,
1994 p_return_status => l_return_status,
1995 p_region_application_id =>l_item_tbl(l_index).region_application_id,
1996 p_region_code => l_item_tbl(l_index).region_code,
1997 p_attribute_application_id =>
1998 l_item_tbl(l_index).attribute_application_id,
1999 p_attribute_code => l_item_tbl(l_index).attribute_code) then
2000 --
2001 -- Update Region Items only if G_UPDATE_MODE is TRUE
2002 --
2003 if (AK_UPLOAD_GRP.G_UPDATE_MODE) then
2004 AK_REGION_PVT.UPDATE_ITEM (
2005 p_validation_level => p_validation_level,
2006 p_api_version_number => 1.0,
2007 p_msg_count => l_msg_count,
2008 p_msg_data => l_msg_data,
2009 p_return_status => l_return_status,
2010 p_region_application_id =>l_item_tbl(l_index).region_application_id,
2011 p_region_code => l_item_tbl(l_index).region_code,
2012 p_attribute_application_id =>
2013 l_item_tbl(l_index).attribute_application_id,
2014 p_attribute_code => l_item_tbl(l_index).attribute_code,
2015 p_display_sequence => l_item_tbl(l_index).display_sequence,
2016 p_node_display_flag => l_item_tbl(l_index).node_display_flag,
2017 p_node_query_flag => l_item_tbl(l_index).node_query_flag,
2018 p_attribute_label_length =>
2019 l_item_tbl(l_index).attribute_label_length,
2020 p_display_value_length =>
2021 l_item_tbl(l_index).display_value_length,
2022 p_bold => l_item_tbl(l_index).bold,
2023 p_italic => l_item_tbl(l_index).italic,
2024 p_vertical_alignment => l_item_tbl(l_index).vertical_alignment,
2025 p_horizontal_alignment => l_item_tbl(l_index).horizontal_alignment,
2026 p_item_style => l_item_tbl(l_index).item_style,
2027 p_object_attribute_flag =>l_item_tbl(l_index).object_attribute_flag,
2028 p_icx_custom_call => l_item_tbl(l_index).icx_custom_call,
2029 p_update_flag => l_item_tbl(l_index).update_flag,
2030 p_required_flag => l_item_tbl(l_index).required_flag,
2031 p_security_code => l_item_tbl(l_index).security_code,
2032 p_default_value_varchar2 =>
2033 l_item_tbl(l_index).default_value_varchar2,
2034 p_default_value_number =>
2035 l_item_tbl(l_index).default_value_number,
2036 p_default_value_date =>
2037 l_item_tbl(l_index).default_value_date,
2038 p_lov_region_application_id =>
2039 l_item_tbl(l_index).lov_region_application_id,
2040 p_lov_region_code => l_item_tbl(l_index).lov_region_code,
2041 p_lov_foreign_key_name => l_item_tbl(l_index).lov_foreign_key_name,
2042 p_lov_attribute_application_id =>
2043 l_item_tbl(l_index).lov_attribute_application_id,
2044 p_lov_attribute_code => l_item_tbl(l_index).lov_attribute_code,
2045 p_lov_default_flag => l_item_tbl(l_index).lov_default_flag,
2046 p_region_defaulting_api_pkg =>
2047 l_item_tbl(l_index).region_defaulting_api_pkg,
2048 p_region_defaulting_api_proc =>
2049 l_item_tbl(l_index).region_defaulting_api_proc,
2050 p_region_validation_api_pkg =>
2051 l_item_tbl(l_index).region_validation_api_pkg,
2052 p_region_validation_api_proc =>
2053 l_item_tbl(l_index).region_validation_api_proc,
2054 p_order_sequence => l_item_tbl(l_index).order_sequence,
2055 p_order_direction => l_item_tbl(l_index).order_direction,
2056 p_display_height => l_item_tbl(l_index).display_height,
2057 p_submit => l_item_tbl(l_index).submit,
2058 p_encrypt => l_item_tbl(l_index).encrypt,
2059 p_css_class_name => l_item_tbl(l_index).css_class_name,
2060 p_view_usage_name =>l_item_tbl(l_index).view_usage_name,
2061 p_view_attribute_name =>l_item_tbl(l_index).view_attribute_name,
2062 p_nested_region_appl_id =>l_item_tbl(l_index).nested_region_application_id,
2063 p_nested_region_code =>l_item_tbl(l_index).nested_region_code,
2064 p_url =>l_item_tbl(l_index).url,
2065 p_poplist_viewobject =>l_item_tbl(l_index).poplist_viewobject,
2066 p_poplist_display_attr =>l_item_tbl(l_index).poplist_display_attr,
2067 p_poplist_value_attr =>l_item_tbl(l_index).poplist_value_attr,
2068 p_image_file_name =>l_item_tbl(l_index).image_file_name,
2069 p_item_name =>l_item_tbl(l_index).item_name,
2070 p_css_label_class_name => l_item_tbl(l_index).css_label_class_name,
2071 p_menu_name => l_item_tbl(l_index).menu_name,
2072 p_flexfield_name => l_item_tbl(l_index).flexfield_name,
2073 p_flexfield_application_id => l_item_tbl(l_index).flexfield_application_id,
2074 p_tabular_function_code => l_item_tbl(l_index).tabular_function_code,
2075 p_tip_type => l_item_tbl(l_index).tip_type,
2076 p_tip_message_name => l_item_tbl(l_index).tip_message_name,
2077 p_tip_message_application_id => l_item_tbl(l_index).tip_message_application_id ,
2078 p_flex_segment_list => l_item_tbl(l_index).flex_segment_list,
2079 p_entity_id => l_item_tbl(l_index).entity_id,
2080 p_anchor => l_item_tbl(l_index).anchor,
2081 p_poplist_view_usage_name => l_item_tbl(l_index).poplist_view_usage_name,
2082 p_user_customizable => l_item_tbl(l_index).user_customizable,
2083 p_sortby_view_attribute_name => l_item_tbl(l_index).sortby_view_attribute_name,
2084 p_admin_customizable => l_item_tbl(l_index).admin_customizable,
2085 p_invoke_function_name => l_item_tbl(l_index).invoke_function_name,
2086 p_expansion => l_item_tbl(l_index).expansion,
2087 p_als_max_length => l_item_tbl(l_index).als_max_length,
2088 p_initial_sort_sequence => l_item_tbl(l_index).initial_sort_sequence,
2089 p_customization_application_id => l_item_tbl(l_index).customization_application_id,
2090 p_customization_code => l_item_tbl(l_index).customization_code,
2091 p_attribute_category => l_item_tbl(l_index).attribute_category,
2092 p_attribute1 => l_item_tbl(l_index).attribute1,
2093 p_attribute2 => l_item_tbl(l_index).attribute2,
2094 p_attribute3 => l_item_tbl(l_index).attribute3,
2095 p_attribute4 => l_item_tbl(l_index).attribute4,
2096 p_attribute5 => l_item_tbl(l_index).attribute5,
2097 p_attribute6 => l_item_tbl(l_index).attribute6,
2098 p_attribute7 => l_item_tbl(l_index).attribute7,
2099 p_attribute8 => l_item_tbl(l_index).attribute8,
2100 p_attribute9 => l_item_tbl(l_index).attribute9,
2101 p_attribute10 => l_item_tbl(l_index).attribute10,
2102 p_attribute11 => l_item_tbl(l_index).attribute11,
2103 p_attribute12 => l_item_tbl(l_index).attribute12,
2104 p_attribute13 => l_item_tbl(l_index).attribute13,
2105 p_attribute14 => l_item_tbl(l_index).attribute14,
2106 p_attribute15 => l_item_tbl(l_index).attribute15,
2107 p_attribute_label_long => l_item_tbl(l_index).attribute_label_long,
2108 p_attribute_label_short =>l_item_tbl(l_index).attribute_label_short,
2109 p_description =>l_item_tbl(l_index).description,
2110 p_created_by => l_item_tbl(l_index).created_by,
2111 p_creation_date => l_item_tbl(l_index).creation_date,
2112 p_last_updated_by => l_item_tbl(l_index).last_updated_by,
2113 p_last_update_date => l_item_tbl(l_index).last_update_date,
2114 p_last_update_login => l_item_tbl(l_index).last_update_login,
2115 p_loader_timestamp => p_loader_timestamp,
2116 p_pass => p_pass,
2117 p_copy_redo_flag => l_copy_redo_flag
2118 );
2119 -- update non-customized data only
2120 elsif ( AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE ) then
2121 select ari.last_updated_by, arit.last_updated_by,
2122 ari.last_update_date, arit.last_update_date
2123 into l_user_id1, l_user_id2, l_update1, l_update2
2124 from ak_region_items ari, ak_region_items_tl arit
2125 where ari.region_code = l_item_tbl(l_index).region_code
2126 and ari.region_application_id = l_item_tbl(l_index).region_application_id
2127 and ari.attribute_code = l_item_tbl(l_index).attribute_code
2128 and ari.attribute_application_id = l_item_tbl(l_index).attribute_application_id
2129 and ari.region_code = arit.region_code
2130 and ari.region_application_id = arit.region_application_id
2131 and ari.attribute_code = arit.attribute_code
2132 and ari.attribute_application_id = arit.attribute_application_id
2133 and arit.language = userenv('LANG');
2134 /*if (( l_user_id1 = 1 or l_user_id1 = 2 ) and
2135 ( l_user_id2 = 1 or l_user_id2 = 2 )) then*/
2136 if (AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
2137 p_loader_timestamp => p_loader_timestamp,
2138 p_created_by => l_item_tbl(l_index).created_by,
2139 p_creation_date => l_item_tbl(l_index).creation_date,
2140 p_last_updated_by => l_item_tbl(l_index).last_updated_by,
2141 p_db_last_updated_by => l_user_id1,
2142 p_last_update_date => l_item_tbl(l_index).last_update_date,
2143 p_db_last_update_date => l_update1,
2144 p_last_update_login => l_item_tbl(l_index).last_update_login,
2145 p_create_or_update => 'UPDATE') and
2146
2147 AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
2148 p_loader_timestamp => p_loader_timestamp,
2149 p_created_by => l_item_tbl(l_index).created_by,
2150 p_creation_date => l_item_tbl(l_index).creation_date,
2151 p_last_updated_by => l_item_tbl(l_index).last_updated_by,
2152 p_db_last_updated_by => l_user_id2,
2153 p_last_update_date => l_item_tbl(l_index).last_update_date,
2154 p_db_last_update_date => l_update2,
2155 p_last_update_login => l_item_tbl(l_index).last_update_login,
2156 p_create_or_update => 'UPDATE')) then
2157
2158 AK_REGION_PVT.UPDATE_ITEM (
2159 p_validation_level => p_validation_level,
2160 p_api_version_number => 1.0,
2161 p_msg_count => l_msg_count,
2162 p_msg_data => l_msg_data,
2163 p_return_status => l_return_status,
2164 p_region_application_id =>l_item_tbl(l_index).region_application_id,
2165 p_region_code => l_item_tbl(l_index).region_code,
2166 p_attribute_application_id =>
2167 l_item_tbl(l_index).attribute_application_id,
2168 p_attribute_code => l_item_tbl(l_index).attribute_code,
2169 p_display_sequence => l_item_tbl(l_index).display_sequence,
2170 p_node_display_flag => l_item_tbl(l_index).node_display_flag,
2171 p_node_query_flag => l_item_tbl(l_index).node_query_flag,
2172 p_attribute_label_length =>
2173 l_item_tbl(l_index).attribute_label_length,
2174 p_display_value_length =>
2175 l_item_tbl(l_index).display_value_length,
2176 p_bold => l_item_tbl(l_index).bold,
2177 p_italic => l_item_tbl(l_index).italic,
2178 p_vertical_alignment => l_item_tbl(l_index).vertical_alignment,
2179 p_horizontal_alignment => l_item_tbl(l_index).horizontal_alignment,
2180 p_item_style => l_item_tbl(l_index).item_style,
2181 p_object_attribute_flag =>l_item_tbl(l_index).object_attribute_flag,
2182 p_icx_custom_call => l_item_tbl(l_index).icx_custom_call,
2183 p_update_flag => l_item_tbl(l_index).update_flag,
2184 p_required_flag => l_item_tbl(l_index).required_flag,
2185 p_security_code => l_item_tbl(l_index).security_code,
2186 p_default_value_varchar2 =>
2187 l_item_tbl(l_index).default_value_varchar2,
2188 p_default_value_number =>
2189 l_item_tbl(l_index).default_value_number,
2190 p_default_value_date =>
2191 l_item_tbl(l_index).default_value_date,
2192 p_lov_region_application_id =>
2193 l_item_tbl(l_index).lov_region_application_id,
2194 p_lov_region_code => l_item_tbl(l_index).lov_region_code,
2195 p_lov_foreign_key_name => l_item_tbl(l_index).lov_foreign_key_name,
2196 p_lov_attribute_application_id =>
2197 l_item_tbl(l_index).lov_attribute_application_id,
2198 p_lov_attribute_code => l_item_tbl(l_index).lov_attribute_code,
2199 p_lov_default_flag => l_item_tbl(l_index).lov_default_flag,
2200 p_region_defaulting_api_pkg =>
2201 l_item_tbl(l_index).region_defaulting_api_pkg,
2202 p_region_defaulting_api_proc =>
2203 l_item_tbl(l_index).region_defaulting_api_proc,
2204 p_region_validation_api_pkg =>
2205 l_item_tbl(l_index).region_validation_api_pkg,
2206 p_region_validation_api_proc =>
2207 l_item_tbl(l_index).region_validation_api_proc,
2208 p_order_sequence => l_item_tbl(l_index).order_sequence,
2209 p_order_direction => l_item_tbl(l_index).order_direction,
2210 p_display_height => l_item_tbl(l_index).display_height,
2211 p_submit => l_item_tbl(l_index).submit,
2212 p_encrypt => l_item_tbl(l_index).encrypt,
2213 p_css_class_name => l_item_tbl(l_index).css_class_name,
2214 p_view_usage_name =>l_item_tbl(l_index).view_usage_name,
2215 p_view_attribute_name =>l_item_tbl(l_index).view_attribute_name,
2216 p_nested_region_appl_id =>l_item_tbl(l_index).nested_region_application_id,
2217 p_nested_region_code =>l_item_tbl(l_index).nested_region_code,
2218 p_url =>l_item_tbl(l_index).url,
2219 p_poplist_viewobject =>l_item_tbl(l_index).poplist_viewobject,
2220 p_poplist_display_attr =>l_item_tbl(l_index).poplist_display_attr,
2221 p_poplist_value_attr =>l_item_tbl(l_index).poplist_value_attr,
2222 p_image_file_name =>l_item_tbl(l_index).image_file_name,
2223 p_item_name =>l_item_tbl(l_index).item_name,
2224 p_css_label_class_name => l_item_tbl(l_index).css_label_class_name,
2225 p_menu_name => l_item_tbl(l_index).menu_name,
2226 p_flexfield_name => l_item_tbl(l_index).flexfield_name,
2227 p_flexfield_application_id => l_item_tbl(l_index).flexfield_application_id,
2228 p_tabular_function_code => l_item_tbl(l_index).tabular_function_code,
2229 p_tip_type => l_item_tbl(l_index).tip_type,
2230 p_tip_message_name => l_item_tbl(l_index).tip_message_name,
2231 p_tip_message_application_id => l_item_tbl(l_index).tip_message_application_id ,
2232 p_flex_segment_list => l_item_tbl(l_index).flex_segment_list,
2233 p_entity_id => l_item_tbl(l_index).entity_id,
2234 p_anchor => l_item_tbl(l_index).anchor,
2235 p_poplist_view_usage_name => l_item_tbl(l_index).poplist_view_usage_name,
2236 p_user_customizable => l_item_tbl(l_index).user_customizable,
2237 p_sortby_view_attribute_name => l_item_tbl(l_index).sortby_view_attribute_name,
2238 p_admin_customizable => l_item_tbl(l_index).admin_customizable,
2239 p_invoke_function_name => l_item_tbl(l_index).invoke_function_name,
2240 p_expansion => l_item_tbl(l_index).expansion,
2241 p_als_max_length => l_item_tbl(l_index).als_max_length,
2242 p_initial_sort_sequence => l_item_tbl(l_index).initial_sort_sequence,
2243 p_customization_application_id => l_item_tbl(l_index).customization_application_id,
2244 p_customization_code => l_item_tbl(l_index).customization_code,
2245 p_attribute_category => l_item_tbl(l_index).attribute_category,
2246 p_attribute1 => l_item_tbl(l_index).attribute1,
2247 p_attribute2 => l_item_tbl(l_index).attribute2,
2248 p_attribute3 => l_item_tbl(l_index).attribute3,
2249 p_attribute4 => l_item_tbl(l_index).attribute4,
2250 p_attribute5 => l_item_tbl(l_index).attribute5,
2251 p_attribute6 => l_item_tbl(l_index).attribute6,
2252 p_attribute7 => l_item_tbl(l_index).attribute7,
2253 p_attribute8 => l_item_tbl(l_index).attribute8,
2254 p_attribute9 => l_item_tbl(l_index).attribute9,
2255 p_attribute10 => l_item_tbl(l_index).attribute10,
2256 p_attribute11 => l_item_tbl(l_index).attribute11,
2257 p_attribute12 => l_item_tbl(l_index).attribute12,
2258 p_attribute13 => l_item_tbl(l_index).attribute13,
2259 p_attribute14 => l_item_tbl(l_index).attribute14,
2260 p_attribute15 => l_item_tbl(l_index).attribute15,
2261 p_attribute_label_long => l_item_tbl(l_index).attribute_label_long,
2262 p_attribute_label_short =>l_item_tbl(l_index).attribute_label_short,
2263 p_description => l_item_tbl(l_index).description,
2264 p_created_by => l_item_tbl(l_index).created_by,
2265 p_creation_date => l_item_tbl(l_index).creation_date,
2266 p_last_updated_by => l_item_tbl(l_index).last_updated_by,
2267 p_last_update_date => l_item_tbl(l_index).last_update_date,
2268 p_last_update_login => l_item_tbl(l_index).last_update_login,
2269 p_loader_timestamp => p_loader_timestamp,
2270 p_pass => p_pass,
2271 p_copy_redo_flag => l_copy_redo_flag
2272 );
2273 end if; /* if l_user_id1 = 1 and l_user_id2 = 1 */
2274 end if; -- /* if G_UPDATE_MODE G_NO_CUSTOM_UPDATE */
2275 else
2276 AK_REGION_PVT.CREATE_ITEM (
2277 p_validation_level => p_validation_level,
2278 p_api_version_number => 1.0,
2279 p_msg_count => l_msg_count,
2280 p_msg_data => l_msg_data,
2281 p_return_status => l_return_status,
2282 p_region_application_id =>l_item_tbl(l_index).region_application_id,
2283 p_region_code => l_item_tbl(l_index).region_code,
2284 p_attribute_application_id =>
2285 l_item_tbl(l_index).attribute_application_id,
2286 p_attribute_code => l_item_tbl(l_index).attribute_code,
2287 p_display_sequence => l_item_tbl(l_index).display_sequence,
2288 p_node_display_flag => l_item_tbl(l_index).node_display_flag,
2289 p_node_query_flag => l_item_tbl(l_index).node_query_flag,
2290 p_attribute_label_length =>
2291 l_item_tbl(l_index).attribute_label_length,
2292 p_display_value_length =>
2293 l_item_tbl(l_index).display_value_length,
2294 p_bold => l_item_tbl(l_index).bold,
2295 p_italic => l_item_tbl(l_index).italic,
2296 p_vertical_alignment => l_item_tbl(l_index).vertical_alignment,
2297 p_horizontal_alignment => l_item_tbl(l_index).horizontal_alignment,
2298 p_item_style => l_item_tbl(l_index).item_style,
2299 p_object_attribute_flag =>l_item_tbl(l_index).object_attribute_flag,
2300 p_icx_custom_call => l_item_tbl(l_index).icx_custom_call,
2301 p_update_flag => l_item_tbl(l_index).update_flag,
2302 p_required_flag => l_item_tbl(l_index).required_flag,
2303 p_security_code => l_item_tbl(l_index).security_code,
2304 p_default_value_varchar2 =>
2305 l_item_tbl(l_index).default_value_varchar2,
2306 p_default_value_number =>
2307 l_item_tbl(l_index).default_value_number,
2308 p_default_value_date =>
2309 l_item_tbl(l_index).default_value_date,
2310 p_lov_region_application_id =>
2311 l_item_tbl(l_index).lov_region_application_id,
2312 p_lov_region_code => l_item_tbl(l_index).lov_region_code,
2313 p_lov_foreign_key_name => l_item_tbl(l_index).lov_foreign_key_name,
2314 p_lov_attribute_application_id =>
2315 l_item_tbl(l_index).lov_attribute_application_id,
2316 p_lov_attribute_code => l_item_tbl(l_index).lov_attribute_code,
2317 p_lov_default_flag => l_item_tbl(l_index).lov_default_flag,
2318 p_region_defaulting_api_pkg =>
2319 l_item_tbl(l_index).region_defaulting_api_pkg,
2320 p_region_defaulting_api_proc =>
2321 l_item_tbl(l_index).region_defaulting_api_proc,
2322 p_region_validation_api_pkg =>
2323 l_item_tbl(l_index).region_validation_api_pkg,
2324 p_region_validation_api_proc =>
2325 l_item_tbl(l_index).region_validation_api_proc,
2326 p_order_sequence => l_item_tbl(l_index).order_sequence,
2327 p_order_direction => l_item_tbl(l_index).order_direction,
2328 p_display_height => l_item_tbl(l_index).display_height,
2329 p_submit => l_item_tbl(l_index).submit,
2330 p_encrypt => l_item_tbl(l_index).encrypt,
2331 p_css_class_name => l_item_tbl(l_index).css_class_name,
2332 p_view_usage_name =>l_item_tbl(l_index).view_usage_name,
2333 p_view_attribute_name =>l_item_tbl(l_index).view_attribute_name,
2334 p_nested_region_appl_id =>l_item_tbl(l_index).nested_region_application_id,
2335 p_nested_region_code =>l_item_tbl(l_index).nested_region_code,
2336 p_url =>l_item_tbl(l_index).url,
2337 p_poplist_viewobject =>l_item_tbl(l_index).poplist_viewobject,
2338 p_poplist_display_attr =>l_item_tbl(l_index).poplist_display_attr,
2339 p_poplist_value_attr =>l_item_tbl(l_index).poplist_value_attr,
2340 p_image_file_name =>l_item_tbl(l_index).image_file_name,
2341 p_item_name => l_item_tbl(l_index).item_name,
2342 p_css_label_class_name => l_item_tbl(l_index).css_label_class_name,
2343 p_menu_name => l_item_tbl(l_index).menu_name,
2344 p_flexfield_name => l_item_tbl(l_index).flexfield_name,
2345 p_flexfield_application_id => l_item_tbl(l_index).flexfield_application_id,
2346 p_tabular_function_code => l_item_tbl(l_index).tabular_function_code,
2347 p_tip_type => l_item_tbl(l_index).tip_type,
2348 p_tip_message_name => l_item_tbl(l_index).tip_message_name,
2349 p_tip_message_application_id => l_item_tbl(l_index).tip_message_application_id ,
2350 p_flex_segment_list => l_item_tbl(l_index).flex_segment_list,
2351 p_entity_id => l_item_tbl(l_index).entity_id ,
2352 p_anchor => l_item_tbl(l_index).anchor,
2353 p_poplist_view_usage_name => l_item_tbl(l_index).poplist_view_usage_name,
2354 p_user_customizable => l_item_tbl(l_index).user_customizable,
2355 p_sortby_view_attribute_name => l_item_tbl(l_index).sortby_view_attribute_name,
2356 p_admin_customizable => l_item_tbl(l_index).admin_customizable,
2357 p_invoke_function_name => l_item_tbl(l_index).invoke_function_name,
2358 p_expansion => l_item_tbl(l_index).expansion,
2359 p_als_max_length => l_item_tbl(l_index).als_max_length,
2360 p_initial_sort_sequence => l_item_tbl(l_index).initial_sort_sequence,
2361 p_customization_application_id => l_item_tbl(l_index).customization_application_id,
2362 p_customization_code => l_item_tbl(l_index).customization_code,
2363 p_attribute_category => l_item_tbl(l_index).attribute_category,
2364 p_attribute1 => l_item_tbl(l_index).attribute1,
2365 p_attribute2 => l_item_tbl(l_index).attribute2,
2366 p_attribute3 => l_item_tbl(l_index).attribute3,
2367 p_attribute4 => l_item_tbl(l_index).attribute4,
2368 p_attribute5 => l_item_tbl(l_index).attribute5,
2369 p_attribute6 => l_item_tbl(l_index).attribute6,
2370 p_attribute7 => l_item_tbl(l_index).attribute7,
2371 p_attribute8 => l_item_tbl(l_index).attribute8,
2372 p_attribute9 => l_item_tbl(l_index).attribute9,
2373 p_attribute10 => l_item_tbl(l_index).attribute10,
2374 p_attribute11 => l_item_tbl(l_index).attribute11,
2375 p_attribute12 => l_item_tbl(l_index).attribute12,
2376 p_attribute13 => l_item_tbl(l_index).attribute13,
2377 p_attribute14 => l_item_tbl(l_index).attribute14,
2378 p_attribute15 => l_item_tbl(l_index).attribute15,
2379 p_attribute_label_long => l_item_tbl(l_index).attribute_label_long,
2380 p_attribute_label_short =>l_item_tbl(l_index).attribute_label_short,
2381 p_description => l_item_tbl(l_index).description,
2382 p_created_by => l_item_tbl(l_index).created_by,
2383 p_creation_date => l_item_tbl(l_index).creation_date,
2384 p_last_updated_by => l_item_tbl(l_index).last_updated_by,
2385 p_last_update_date => l_item_tbl(l_index).last_update_date,
2386 p_last_update_login => l_item_tbl(l_index).last_update_login,
2387 p_loader_timestamp => p_loader_timestamp,
2388 p_pass => p_pass,
2389 p_copy_redo_flag => l_copy_redo_flag
2390 );
2391 end if; -- /* if ITEM_EXISTS */
2392 --
2393 -- If API call returns with an error status, upload aborts
2394 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2395 (l_return_status = FND_API.G_RET_STS_ERROR) then
2396 RAISE FND_API.G_EXC_ERROR;
2397 end if; -- /* if l_return_status */
2398 --
2399 -- if validation fails, then this record should go to second pass
2400 if (l_copy_redo_flag) then
2401 G_ITEM_REDO_INDEX := G_ITEM_REDO_INDEX + 1;
2402 G_ITEM_REDO_TBL(G_ITEM_REDO_INDEX) := l_item_tbl(l_index);
2403 l_copy_redo_flag := FALSE;
2404 end if; --/* if l_copy_redo_flag */
2405 end if; -- /* if l_item_tbl.exists */
2406 end loop;
2407 end if; -- /* if l_item_tbl.count > 0 */
2408
2409 --
2410 -- create or update all region lov relations to the database
2411 --
2412 if (l_lov_relation_tbl.count > 0) then
2413 for l_index in l_lov_relation_tbl.FIRST .. l_lov_relation_tbl.LAST loop
2414 if (l_lov_relation_tbl.exists(l_index)) then
2415 if ( l_lov_relation_tbl(l_index).base_region_appl_id is null ) then
2416 l_lov_relation_tbl(l_index).base_region_appl_id := l_lov_relation_tbl(l_index).region_application_id;
2417 end if;
2418 if ( l_lov_relation_tbl(l_index).base_region_code is null ) then
2419 l_lov_relation_tbl(l_index).base_region_code := l_lov_relation_tbl(l_index).region_code;
2420 end if;
2421 if AK_REGION2_PVT.LOV_RELATION_EXISTS (
2422 p_api_version_number => 1.0,
2423 p_return_status => l_return_status,
2424 p_region_application_id =>
2425 l_lov_relation_tbl(l_index).region_application_id,
2426 p_region_code => l_lov_relation_tbl(l_index).region_code,
2427 p_attribute_application_id =>
2428 l_lov_relation_tbl(l_index).attribute_application_id,
2429 p_attribute_code => l_lov_relation_tbl(l_index).attribute_code,
2430 p_lov_region_appl_id => l_lov_relation_tbl(l_index).lov_region_appl_id,
2431 p_lov_region_code => l_lov_relation_tbl(l_index).lov_region_code,
2432 p_lov_attribute_appl_id =>
2433 l_lov_relation_tbl(l_index).lov_attribute_appl_id,
2434 p_lov_attribute_code => l_lov_relation_tbl(l_index).lov_attribute_code,
2435 p_base_attribute_appl_id => l_lov_relation_tbl(l_index).base_attribute_appl_id,
2436 p_base_attribute_code => l_lov_relation_tbl(l_index).base_attribute_code,
2437 p_direction_flag => l_lov_relation_tbl(l_index).direction_flag,
2438 p_base_region_appl_id => l_lov_relation_tbl(l_index).base_region_appl_id,
2439 p_base_region_code => l_lov_relation_tbl(l_index).base_region_code) then
2440 --
2441 -- Update Region lov relations if G_UPDATE_MODE is TRUE
2442 -- Also update Region Lov relations if G_NO_CUSTOM_UPDATE since there's
2443 -- no customized data in this table, do not update if G_NO_UPDATE_MODE
2444 --
2445 if (AK_UPLOAD_GRP.G_UPDATE_MODE or AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE) then
2446 AK_REGION2_PVT.UPDATE_LOV_RELATION (
2447 p_validation_level => p_validation_level,
2448 p_api_version_number => 1.0,
2449 p_msg_count => l_msg_count,
2450 p_msg_data => l_msg_data,
2451 p_return_status => l_return_status,
2452 p_region_application_id =>
2453 l_lov_relation_tbl(l_index).region_application_id,
2454 p_region_code => l_lov_relation_tbl(l_index).region_code,
2455 p_attribute_application_id =>
2456 l_lov_relation_tbl(l_index).attribute_application_id,
2457 p_attribute_code => l_lov_relation_tbl(l_index).attribute_code,
2458 p_lov_region_appl_id => l_lov_relation_tbl(l_index).lov_region_appl_id,
2459 p_lov_region_code => l_lov_relation_tbl(l_index).lov_region_code,
2460 p_lov_attribute_appl_id => l_lov_relation_tbl(l_index).lov_attribute_appl_id,
2461 p_lov_attribute_code => l_lov_relation_tbl(l_index).lov_attribute_code,
2462 p_base_attribute_appl_id => l_lov_relation_tbl(l_index).base_attribute_appl_id,
2463 p_base_attribute_code => l_lov_relation_tbl(l_index).base_attribute_code,
2464 p_direction_flag => l_lov_relation_tbl(l_index).direction_flag,
2465 p_base_region_appl_id => l_lov_relation_tbl(l_index).base_region_appl_id,
2466 p_base_region_code => l_lov_relation_tbl(l_index).base_region_code,
2467 p_required_flag => l_lov_relation_tbl(l_index).required_flag,
2468 p_created_by => l_lov_relation_tbl(l_index).created_by,
2469 p_creation_date => l_lov_relation_tbl(l_index).creation_date,
2470 p_last_updated_by => l_lov_relation_tbl(l_index).last_updated_by,
2471 p_last_update_date => l_lov_relation_tbl(l_index).last_update_date,
2472 p_last_update_login => l_lov_relation_tbl(l_index).last_update_login,
2473 p_loader_timestamp => p_loader_timestamp,
2474 p_pass => p_pass,
2475 p_copy_redo_flag => l_copy_redo_flag
2476 );
2477 end if;
2478 else
2479 AK_REGION2_PVT.CREATE_LOV_RELATION (
2480 p_validation_level => p_validation_level,
2481 p_api_version_number => 1.0,
2482 p_msg_count => l_msg_count,
2483 p_msg_data => l_msg_data,
2484 p_return_status => l_return_status,
2485 p_region_application_id =>
2486 l_lov_relation_tbl(l_index).region_application_id,
2487 p_region_code => l_lov_relation_tbl(l_index).region_code,
2488 p_attribute_application_id =>
2489 l_lov_relation_tbl(l_index).attribute_application_id,
2490 p_attribute_code => l_lov_relation_tbl(l_index).attribute_code,
2491 p_lov_region_appl_id => l_lov_relation_tbl(l_index).lov_region_appl_id,
2492 p_lov_region_code => l_lov_relation_tbl(l_index).lov_region_code,
2493 p_lov_attribute_appl_id => l_lov_relation_tbl(l_index).lov_attribute_appl_id,
2494 p_lov_attribute_code => l_lov_relation_tbl(l_index).lov_attribute_code,
2495 p_base_attribute_appl_id => l_lov_relation_tbl(l_index).base_attribute_appl_id,
2496 p_base_attribute_code => l_lov_relation_tbl(l_index).base_attribute_code,
2497 p_direction_flag => l_lov_relation_tbl(l_index).direction_flag,
2498 p_base_region_appl_id => l_lov_relation_tbl(l_index).base_region_appl_id,
2499 p_base_region_code => l_lov_relation_tbl(l_index).base_region_code,
2500 p_required_flag => l_lov_relation_tbl(l_index).required_flag,
2501 p_created_by => l_lov_relation_tbl(l_index).created_by,
2502 p_creation_date => l_lov_relation_tbl(l_index).creation_date,
2503 p_last_updated_by => l_lov_relation_tbl(l_index).last_updated_by,
2504 p_last_update_date => l_lov_relation_tbl(l_index).last_update_date,
2505 p_last_update_login => l_lov_relation_tbl(l_index).lasT_update_login,
2506 p_loader_timestamp => p_loader_timestamp,
2507 p_pass => p_pass,
2508 p_copy_redo_flag => l_copy_redo_flag
2509 );
2510 end if; -- /* if REGION_EXISTS */
2511 --
2512 -- If API call returns with an error status, upload aborts
2513 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2514 (l_return_status = FND_API.G_RET_STS_ERROR) then
2515 RAISE FND_API.G_EXC_ERROR;
2516 end if; -- /* if l_return_status */
2517 --
2518 -- if validation fails, then this record should go to second pass
2519 -- validation usually fails when referenced record has not been created yet
2520 if (l_copy_redo_flag) then
2521 G_LOV_RELATION_REDO_INDEX := G_LOV_RELATION_REDO_INDEX + 1;
2522 G_LOV_RELATION_REDO_TBL(G_LOV_RELATION_REDO_INDEX) := l_lov_relation_tbl(l_index);
2523 l_copy_redo_flag := FALSE;
2524 end if; --/* if l_copy_redo_flag */
2525 end if; -- /* end if l_lov_relation_tbl.exists(l_index) */
2526 end loop; -- /* end for l_index in l_lov_relation_tbl */
2527 end if;
2528
2529 --
2530 -- create or update all region item category relations to the database
2531 --
2532 if (l_category_usage_tbl.count > 0) then
2533 for l_index in l_category_usage_tbl.FIRST .. l_category_usage_tbl.LAST loop
2534 if (l_category_usage_tbl.exists(l_index)) then
2535 if (l_category_usage_tbl(l_index).category_name is null) then
2536 open l_check_fnd_category_name_csr(l_category_usage_tbl(l_index).category_id);
2537 fetch l_check_fnd_category_name_csr into l_category_usage_tbl(l_index).category_name;
2538 if (l_check_fnd_category_name_csr%notfound) then
2539 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_USAGE_SKIPPED');
2540 FND_MESSAGE.SET_TOKEN('KEY', to_char(l_category_usage_tbl(l_index).category_id));
2541 FND_MSG_PUB.Add;
2542 end if;
2543 close l_check_fnd_category_name_csr;
2544 elsif (l_category_usage_tbl(l_index).category_name is not null) then
2545 open l_check_fnd_category_id_csr(l_category_usage_tbl(l_index).category_name);
2546 fetch l_check_fnd_category_id_csr into l_category_usage_tbl(l_index).category_id;
2547 if (l_check_fnd_category_id_csr%notfound) then
2548 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
2549 FND_MESSAGE.SET_NAME('AK','AK_FND_CATEGORY_DOES_NOT_EXIST');
2550 FND_MESSAGE.SET_TOKEN('KEY', (l_category_usage_tbl(l_index).category_name));
2551 FND_MSG_PUB.Add;
2552 end if;
2553 close l_check_fnd_category_id_csr;
2554 raise FND_API.G_EXC_ERROR;
2555 end if;
2556 close l_check_fnd_category_id_csr;
2557 end if;
2558
2559 if (l_category_usage_tbl(l_index).category_name is not null) then
2560 if ( AK_REGION2_PVT.CATEGORY_USAGE_EXISTS(
2561 p_api_version_number => 1.0,
2562 p_return_status => l_return_status,
2563 p_region_application_id =>
2564 l_category_usage_tbl(l_index).region_application_id,
2565 p_region_code => l_category_usage_tbl(l_index).region_code,
2566 p_attribute_application_id =>
2567 l_category_usage_tbl(l_index).attribute_application_id,
2568 p_attribute_code => l_category_usage_tbl(l_index).attribute_code,
2569 p_category_name => l_category_usage_tbl(l_index).category_name) = false) then
2570 AK_REGION2_PVT.CREATE_CATEGORY_USAGE (
2571 p_validation_level => p_validation_level,
2572 p_api_version_number => 1.0,
2573 p_msg_count => l_msg_count,
2574 p_msg_data => l_msg_data,
2575 p_return_status => l_return_status,
2576 p_region_application_id =>
2577 l_category_usage_tbl(l_index).region_application_id,
2578 p_region_code => l_category_usage_tbl(l_index).region_code,
2579 p_attribute_application_id =>
2580 l_category_usage_tbl(l_index).attribute_application_id,
2581 p_attribute_code => l_category_usage_tbl(l_index).attribute_code,
2582 p_category_name => l_category_usage_tbl(l_index).category_name,
2583 p_category_id => l_category_usage_tbl(l_index).category_id,
2584 p_application_id => l_category_usage_tbl(l_index).application_id,
2585 p_show_all => l_category_usage_tbl(l_index).show_all,
2586 p_created_by => l_category_usage_tbl(l_index).created_by,
2587 p_creation_date => l_category_usage_tbl(l_index).creation_date,
2588 p_last_updated_by => l_category_usage_tbl(l_index).last_updated_by,
2589 p_last_update_date => l_category_usage_tbl(l_index).last_update_date,
2590 p_last_update_login => l_category_usage_tbl(l_index).last_update_login,
2591 p_loader_timestamp => p_loader_timestamp,
2592 p_pass => p_pass,
2593 p_copy_redo_flag => l_copy_redo_flag
2594 );
2595 else
2596 AK_REGION2_PVT.UPDATE_CATEGORY_USAGE (
2597 p_validation_level => p_validation_level,
2598 p_api_version_number => 1.0,
2599 p_msg_count => l_msg_count,
2600 p_msg_data => l_msg_data,
2601 p_return_status => l_return_status,
2602 p_region_application_id =>
2603 l_category_usage_tbl(l_index).region_application_id,
2604 p_region_code => l_category_usage_tbl(l_index).region_code,
2605 p_attribute_application_id =>
2606 l_category_usage_tbl(l_index).attribute_application_id,
2607 p_attribute_code => l_category_usage_tbl(l_index).attribute_code,
2608 p_category_name => l_category_usage_tbl(l_index).category_name,
2609 p_category_id => l_category_usage_tbl(l_index).category_id,
2610 p_application_id => l_category_usage_tbl(l_index).application_id,
2611 p_show_all => l_category_usage_tbl(l_index).show_all,
2612 p_created_by => l_category_usage_tbl(l_index).created_by,
2613 p_creation_date => l_category_usage_tbl(l_index).creation_date,
2614 p_last_updated_by => l_category_usage_tbl(l_index).last_updated_by,
2615 p_last_update_date => l_category_usage_tbl(l_index).last_update_date,
2616 p_last_update_login => l_category_usage_tbl(l_index).last_update_login,
2617 p_loader_timestamp => p_loader_timestamp,
2618 p_pass => p_pass,
2619 p_copy_redo_flag => l_copy_redo_flag
2620 );
2621 end if; -- /* if CATEGORY_USAGE_EXISTS */
2622 end if;
2623 --
2624 -- If API call returns with an error status, upload aborts
2625 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2626 (l_return_status = FND_API.G_RET_STS_ERROR) then
2627 RAISE FND_API.G_EXC_ERROR;
2628 end if; -- /* if l_return_status */
2629 --
2630 -- if validation fails, then this record should go to second pass
2631 -- validation usually fails when referenced record has not been created yet
2632 -- if (l_copy_redo_flag) then
2633 -- G_LOV_RELATION_REDO_INDEX := G_LOV_RELATION_REDO_INDEX + 1;
2634 -- G_LOV_RELATION_REDO_TBL(G_LOV_RELATION_REDO_INDEX) := l_lov_relation_tbl(l_index);
2635 -- l_copy_redo_flag := FALSE;
2636 -- end if; --/* if l_copy_redo_flag */
2637 end if; -- /* end if l_category_usage_tbl.exists(l_index) */
2638 end loop; -- /* end for l_index in l_category_usage_tbl */
2639 end if;
2640
2641 /*
2642 --
2643 -- create or update all region graphs to the database
2644 --
2645 if (l_graph_tbl.count > 0) then
2646 for l_index in l_graph_tbl.FIRST .. l_graph_tbl.LAST loop
2647 if (l_graph_tbl.exists(l_index)) then
2648 if AK_REGION_PVT.GRAPH_EXISTS (
2649 p_api_version_number => 1.0,
2650 p_return_status => l_return_status,
2651 p_region_application_id => l_graph_tbl(l_index).region_application_id,
2652 p_region_code => l_graph_tbl(l_index).region_code,
2653 p_graph_number => l_graph_tbl(l_index).graph_number) then
2654 --
2655 -- Update Region Graphs only if G_UPDATE_MODE is TRUE
2656 --
2657 if (AK_UPLOAD_GRP.G_UPDATE_MODE) then
2658 AK_REGION_PVT.UPDATE_GRAPH (
2659 p_validation_level => p_validation_level,
2660 p_api_version_number => 1.0,
2661 p_msg_count => l_msg_count,
2662 p_msg_data => l_msg_data,
2663 p_return_status => l_return_status,
2664 p_region_application_id =>l_graph_tbl(l_index).region_application_id,
2665 p_region_code => l_graph_tbl(l_index).region_code,
2666 p_graph_number => l_graph_tbl(l_index).graph_number,
2667 p_graph_style => l_graph_tbl(l_index).graph_style,
2668 p_display_flag => l_graph_tbl(l_index).display_flag,
2669 p_depth_radius => l_graph_tbl(l_index).depth_radius,
2670 p_graph_title => l_graph_tbl(l_index).graph_title,
2671 p_y_axis_label => l_graph_tbl(l_index).y_axis_label,
2672 p_created_by => l_graph_tbl(l_index).created_by,
2673 p_creation_date => l_graph_tbl(l_index).creation_date,
2674 p_last_updated_by => l_graph_tbl(l_index).last_updated_by,
2675 p_last_update_date => l_graph_tbl(l_index).last_update_date,
2676 p_last_update_login => l_graph_tbl(l_index).last_update_login,
2677 p_loader_timestamp => p_loader_timestamp,
2678 p_pass => p_pass,
2679 p_copy_redo_flag => l_copy_redo_flag
2680 );
2681 -- update non-customized data only
2682 elsif ( AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE ) then
2683 select arg.last_updated_by, argt.last_updated_by into l_user_id1, l_user_id2
2684 from ak_region_graphs arg, ak_region_graphs_tl argt
2685 where arg.region_code = l_graph_tbl(l_index).region_code
2686 and arg.region_application_id = l_graph_tbl(l_index).region_application_id
2687 and arg.graph_number = l_graph_tbl(l_index).graph_number
2688 and arg.region_code = argt.region_code
2689 and arg.region_application_id = argt.region_application_id
2690 and arg.graph_number = argt.graph_number
2691 and argt.language = userenv('LANG');
2692 if (( l_user_id1 = 1 or l_user_id1 = 2 ) and
2693 ( l_user_id2 = 1 or l_user_id2 = 2 )) then
2694 AK_REGION_PVT.UPDATE_GRAPH (
2695 p_validation_level => p_validation_level,
2696 p_api_version_number => 1.0,
2697 p_msg_count => l_msg_count,
2698 p_msg_data => l_msg_data,
2699 p_return_status => l_return_status,
2700 p_region_application_id =>l_graph_tbl(l_index).region_application_id,
2701 p_region_code => l_graph_tbl(l_index).region_code,
2702 p_graph_number => l_graph_tbl(l_index).graph_number,
2703 p_graph_style => l_graph_tbl(l_index).graph_style,
2704 p_display_flag => l_graph_tbl(l_index).display_flag,
2705 p_depth_Radius => l_graph_tbl(l_index).depth_radius,
2706 p_graph_title => l_graph_tbl(l_index).graph_title,
2707 p_y_axis_label => l_graph_tbl(l_index).y_axis_label,
2708 p_created_by => l_graph_tbl(l_index).created_by,
2709 p_creation_date => l_graph_tbl(l_index).creation_date,
2710 p_last_updated_by => l_graph_tbl(l_index).last_updated_by,
2711 p_last_update_date => l_graph_tbl(l_index).last_update_date,
2712 p_last_update_login => l_graph_tbl(l_index).last_update_login,
2713 p_loader_timestamp => p_loader_timestamp,
2714 p_pass => p_pass,
2715 p_copy_redo_flag => l_copy_redo_flag
2716 );
2717 end if; -- if l_user_id1 = 1 and l_user_id2 = 1
2718 end if; -- if G_UPDATE_MODE G_NO_CUSTOM_UPDATE
2719 else
2720 AK_REGION_PVT.CREATE_GRAPH (
2721 p_validation_level => p_validation_level,
2722 p_api_version_number => 1.0,
2723 p_msg_count => l_msg_count,
2724 p_msg_data => l_msg_data,
2725 p_return_status => l_return_status,
2726 p_region_application_id =>l_graph_tbl(l_index).region_application_id,
2727 p_region_code => l_graph_tbl(l_index).region_code,
2728 p_graph_number => l_graph_tbl(l_index).graph_number,
2729 p_graph_style => l_graph_tbl(l_index).graph_style,
2730 p_display_flag => l_graph_tbl(l_index).display_flag,
2731 p_depth_radius => l_graph_tbl(l_index).depth_radius,
2732 p_graph_title => l_graph_tbl(l_index).graph_title,
2733 p_y_axis_label => l_graph_tbl(l_index).y_axis_label,
2734 p_created_by => l_graph_tbl(l_index).created_by,
2735 p_creation_date => l_graph_tbl(l_index).creation_date,
2736 p_last_updated_by => l_graph_tbl(l_index).last_updated_by,
2737 p_last_update_date => l_graph_tbl(l_index).last_update_date,
2738 p_last_update_login => l_graph_tbl(l_index).last_update_login,
2739 p_loader_timestamp => p_loader_timestamp,
2740 p_pass => p_pass,
2741 p_copy_redo_flag => l_copy_redo_flag
2742 );
2743 end if; -- if ITEM_EXISTS
2744 --
2745 -- If API call returns with an error status, upload aborts
2746 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2747 (l_return_status = FND_API.G_RET_STS_ERROR) then
2748 RAISE FND_API.G_EXC_ERROR;
2749 end if; -- if l_return_status
2750 --
2751 -- if validation fails, then this record should go to second pass
2752 if (l_copy_redo_flag) then
2753 G_GRAPH_REDO_INDEX := G_GRAPH_REDO_INDEX + 1;
2754 G_GRAPH_REDO_TBL(G_GRAPH_REDO_INDEX) := l_graph_tbl(l_index);
2755 l_copy_redo_flag := FALSE;
2756 end if; -- if l_copy_redo_flag
2757 end if; -- if l_item_tbl.exists
2758 end loop;
2759 end if; -- if l_item_tbl.count > 0
2760
2761 --
2762 -- create or update all region graph columns to the database
2763 -- commented out update due to no updateable columns
2764 --
2765 if (l_graph_column_tbl.count > 0) then
2766 for l_index in l_graph_column_tbl.FIRST .. l_graph_column_tbl.LAST loop
2767 if (l_graph_column_tbl.exists(l_index)) then
2768 if (AK_REGION2_PVT.GRAPH_COLUMN_EXISTS(
2769 p_api_version_number => 1.0,
2770 p_return_status => l_return_status,
2771 p_region_application_id => l_graph_column_tbl(l_index).region_application_id,
2772 p_region_code => l_graph_column_tbl(l_index).region_code,
2773 p_graph_number => l_graph_column_tbl(l_index).graph_number,
2774 p_attribute_application_id => l_graph_column_tbl(l_index).attribute_application_id,
2775 p_attribute_code => l_graph_column_tbl(l_index).attribute_code) = false) then */
2776 /* --
2777 -- Update Region graph columns if G_UPDATE_MODE is TRUE
2778 --
2779 if (AK_UPLOAD_GRP.G_UPDATE_MODE) then
2780 AK_REGION2_PVT.UPDATE_GRAPH_COLUMN (
2781 p_validation_level => p_validation_level,
2782 p_api_version_number => 1.0,
2783 p_msg_count => l_msg_count,
2784 p_msg_data => l_msg_data,
2785 p_return_status => l_return_status,
2786 p_region_application_id =>l_graph_column_tbl(l_index).region_application_id,
2787 p_region_code => l_graph_column_tbl(l_index).region_code,
2788 p_graph_number => l_graph_column_tbl(l_index).graph_number,
2789 p_attribute_application_id => l_graph_column_tbl(l_index).attribute_application_id,
2790 p_attribute_code => l_graph_column_tbl(l_index).attribute_code,
2791 p_created_by => l_graph_column_tbl(l_index).created_by,
2792 p_creation_date => l_graph_column_tbl(l_index).creation_date,
2793 p_last_updated_by => l_graph_column_tbl(l_index).last_updated_by,
2794 p_last_update_date => l_graph_column_tbl(l_index).last_update_date,
2795 p_last_update_login => l_graph_column_tbl(l_index).last_update_login,
2796 p_loader_timestamp => p_loader_timestamp,
2797 p_pass => p_pass,
2798 p_copy_redo_flag => l_copy_redo_flag
2799 );
2800 -- update non-customized data only
2801 elsif ( AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE ) then
2802 select last_updated_by into l_user_id1
2803 from ak_region_graph_columns
2804 where region_code = l_graph_column_tbl(l_index).region_code
2805 and region_application_id = l_graph_column_tbl(l_index).region_application_id
2806 and graph_number = l_graph_column_tbl(l_index).graph_number
2807 and attribute_application_id = l_graph_column_tbl(l_index).attribute_application_id
2808 and attribute_code = l_graph_column_tbl(l_index).attribute_code;
2809 if ( l_user_id1 = 1 or l_user_id1 = 2) then
2810 AK_REGION2_PVT.UPDATE_GRAPH_COLUMN (
2811 p_validation_level => p_validation_level,
2812 p_api_version_number => 1.0,
2813 p_msg_count => l_msg_count,
2814 p_msg_data => l_msg_data,
2815 p_return_status => l_return_status,
2816 p_region_application_id => l_graph_column_tbl(l_index).region_application_id,
2817 p_region_code => l_graph_column_tbl(l_index).region_code,
2818 p_graph_number => l_graph_column_tbl(l_index).graph_number,
2819 p_attribute_application_id => l_graph_column_tbl(l_index).attribute_application_id,
2820 p_attribute_code => l_graph_column_tbl(l_index).attribute_code,
2821 p_created_by => l_graph_column_tbl(l_index).created_by,
2822 p_creation_date => l_graph_column_tbl(l_index).creation_date,
2823 p_last_updated_by => l_graph_column_tbl(l_index).last_updated_by,
2824 p_last_update_date => l_graph_column_tbl(l_index).last_update_date,
2825 p_last_update_login => l_graph_column_tbl(l_index).last_update_login,
2826 p_loader_timestamp => p_loader_timestamp,
2827 p_pass => p_pass,
2828 p_copy_redo_flag => l_copy_redo_flag
2829 );
2830 end if; */ /*if l_user_id1 = 1 */ /*
2831 end if; -- */ /* if G_UPDATE_MODE G_NO_CUSTOM_UPDATE */ /*
2832 else */
2833 /*
2834 AK_REGION2_PVT.CREATE_GRAPH_COLUMN (
2835 p_validation_level => p_validation_level,
2836 p_api_version_number => 1.0,
2837 p_msg_count => l_msg_count,
2838 p_msg_data => l_msg_data,
2839 p_return_status => l_return_status,
2840 p_region_application_id => l_graph_column_tbl(l_index).region_application_id,
2841 p_region_code => l_graph_column_tbl(l_index).region_code,
2842 p_graph_number => l_graph_column_tbl(l_index).graph_number,
2843 p_attribute_application_id => l_graph_column_tbl(l_index).attribute_application_id,
2844 p_attribute_code => l_graph_column_tbl(l_index).attribute_code,
2845 p_created_by => l_graph_column_tbl(l_index).created_by,
2846 p_creation_date => l_graph_column_tbl(l_index).creation_date,
2847 p_last_updated_by => l_graph_column_tbl(l_index).last_updated_by,
2848 p_last_update_date => l_graph_column_tbl(l_index).last_update_date,
2849 p_last_update_login => l_graph_column_tbl(l_index).last_update_login,
2850 p_loader_timestamp => p_loader_timestamp,
2851 p_pass => p_pass,
2852 p_copy_redo_flag => l_copy_redo_flag
2853 );
2854 end if; -- if GRAPH_EXISTS
2855 --
2856 -- If API call returns with an error status, upload aborts
2857 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
2858 (l_return_status = FND_API.G_RET_STS_ERROR) then
2859 RAISE FND_API.G_EXC_ERROR;
2860 end if; -- if l_return_status
2861 --
2862 -- if validation fails, then this record should go to second pass
2863 if (l_copy_redo_flag) then
2864 G_GRAPH_COLUMN_REDO_INDEX := G_GRAPH_COLUMN_REDO_INDEX + 1;
2865 G_GRAPH_COLUMN_REDO_TBL(G_GRAPH_COLUMN_REDO_INDEX) := l_graph_column_tbl(l_index);
2866 l_copy_redo_flag := FALSE;
2867 end if; -- if l_copy_redo_flag
2868 end if; -- if l_graph_tbl.exists
2869 end loop;
2870 end if; -- if l_graph_tbl.count > 0
2871 */
2872
2873 --
2874 -- Load line number of the last file line processed
2875 --
2876 p_line_num_out := l_line_num;
2877
2878 p_return_status := FND_API.G_RET_STS_SUCCESS;
2879
2880 --dbms_output.put_line('Leaving region upload: ' ||
2881 -- to_char(sysdate, 'MON-DD HH24:MI:SS'));
2882
2883 EXCEPTION
2884 WHEN FND_API.G_EXC_ERROR THEN
2885 p_return_status := FND_API.G_RET_STS_ERROR;
2886 --rollback to Start_Upload;
2887 WHEN VALUE_ERROR THEN
2888 p_return_status := FND_API.G_RET_STS_ERROR;
2889 FND_MESSAGE.SET_NAME('AK','AK_REGION_VALUE_ERROR');
2890 FND_MESSAGE.SET_TOKEN('KEY',to_char(l_region_rec.region_application_id)||' '||
2891 l_region_rec.region_code);
2892 FND_MSG_PUB.Add;
2893 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
2894 SUBSTR (SQLERRM, 1, 240)||': '||l_column||'='||l_token );
2895 FND_MSG_PUB.Add;
2896 WHEN OTHERS THEN
2897 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2898 --rollback to Start_Upload;
2899 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
2900 SUBSTR (SQLERRM, 1, 240) );
2901 FND_MSG_PUB.Add;
2902 end UPLOAD_REGION;
2903
2904 --=======================================================
2905 -- Procedure UPLOAD_REGION_SECOND
2906 --
2907 -- Usage Private API for loading regions that were
2908 -- failed during its first pass
2909 -- This API should only be called by other APIs
2910 -- that are owned by the Core Modules Team (AK).
2911 --
2912 -- Desc This API reads the region data from PL/SQL table
2913 -- that was prepared during 1st pass, then processes
2914 -- the data, and loads them to the database. The tables
2915 -- are updated with the timestamp passed. This API
2916 -- will process the file until the EOF is reached,
2917 -- a parse error is encountered, or when data for
2918 -- a different business object is read from the file.
2919 --
2920 -- Results The API returns the standard p_return_status parameter
2921 -- indicating one of the standard return statuses :
2922 -- * Unexpected error
2923 -- * Error
2924 -- * Success
2925 -- Parameters p_validation_level : IN required
2926 -- validation level
2927 --
2928 -- Version Initial version number = 1.0
2929 -- History Current version number = 1.0
2930 --=======================================================
2931 procedure UPLOAD_REGION_SECOND (
2932 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
2933 p_return_status OUT NOCOPY VARCHAR2,
2934 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
2935 p_pass IN NUMBER := 2
2936 ) is
2937 l_api_name CONSTANT varchar2(30) := 'Upload_Region_Second';
2938 l_rec_index NUMBER;
2939 l_return_status VARCHAR2(1);
2940 l_msg_count NUMBER;
2941 l_msg_data VARCHAR2(240);
2942 l_copy_redo_flag BOOLEAN;
2943 l_user_id1 NUMBER;
2944 l_user_id2 NUMBER;
2945 l_update1 DATE;
2946 l_update2 DATE;
2947 begin
2948 --
2949 -- create or update all regions to the database
2950 --
2951 if (G_REGION_REDO_INDEX > 0) then
2952 for l_index in G_REGION_REDO_TBL.FIRST .. G_REGION_REDO_TBL.LAST loop
2953 if (G_REGION_REDO_TBL.exists(l_index)) then
2954 if AK_REGION_PVT.REGION_EXISTS (
2955 p_api_version_number => 1.0,
2956 p_return_status => l_return_status,
2957 p_region_application_id =>
2958 G_REGION_REDO_TBL(l_index).region_application_id,
2959 p_region_code => G_REGION_REDO_TBL(l_index).region_code) then
2960 AK_REGION_PVT.UPDATE_REGION (
2961 p_validation_level => p_validation_level,
2962 p_api_version_number => 1.0,
2963 p_msg_count => l_msg_count,
2964 p_msg_data => l_msg_data,
2965 p_return_status => l_return_status,
2966 p_region_application_id =>
2967 G_REGION_REDO_TBL(l_index).region_application_id,
2968 p_region_code => G_REGION_REDO_TBL(l_index).region_code,
2969 p_database_object_name =>G_REGION_REDO_TBL(l_index).database_object_name,
2970 p_region_style => G_REGION_REDO_TBL(l_index).region_style,
2971 p_num_columns => G_REGION_REDO_TBL(l_index).num_columns,
2972 p_icx_custom_call => G_REGION_REDO_TBL(l_index).icx_custom_call,
2973 p_region_defaulting_api_pkg =>
2974 G_REGION_REDO_TBL(l_index).region_defaulting_api_pkg,
2975 p_region_defaulting_api_proc =>
2976 G_REGION_REDO_TBL(l_index).region_defaulting_api_proc,
2977 p_region_validation_api_pkg =>
2978 G_REGION_REDO_TBL(l_index).region_validation_api_pkg,
2979 p_region_validation_api_proc =>
2980 G_REGION_REDO_TBL(l_index).region_validation_api_proc,
2981 p_appmodule_object_type =>
2982 G_REGION_REDO_TBL(l_index).applicationmodule_object_type,
2983 p_num_rows_display =>
2984 G_REGION_REDO_TBL(l_index).num_rows_display,
2985 p_region_object_type =>
2986 G_REGION_REDO_TBL(l_index).region_object_type,
2987 p_image_file_name =>
2988 G_REGION_REDO_TBL(l_index).image_file_name,
2989 p_isform_flag => G_REGION_REDO_TBL(l_index).isform_flag,
2990 p_help_target => G_REGION_REDO_TBL(l_index).help_target,
2991 p_style_sheet_filename => G_REGION_REDO_TBL(l_index).style_sheet_filename,
2992 p_version => G_REGION_REDO_TBL(l_index).version,
2993 p_applicationmodule_usage_name => G_REGION_REDO_TBL(l_index).applicationmodule_usage_name,
2994 p_add_indexed_children => G_REGION_REDO_TBL(l_index).add_indexed_children,
2995 p_stateful_flag => G_REGION_REDO_TBL(l_index).stateful_flag,
2996 p_function_name => G_REGION_REDO_TBL(l_index).function_name,
2997 p_children_view_usage_name => G_REGION_REDO_TBL(l_index).children_view_usage_name,
2998 p_search_panel => G_REGION_REDO_TBL(l_index).search_panel,
2999 p_advanced_search_panel => G_REGION_REDO_TBL(l_index).advanced_search_panel,
3000 p_customize_panel => G_REGION_REDO_TBL(l_index).customize_panel,
3001 p_default_search_panel => G_REGION_REDO_TBL(l_index).default_search_panel,
3002 p_results_based_search => G_REGION_REDO_TBL(l_index).results_based_search,
3003 p_display_graph_table => G_REGION_REDO_TBL(l_index).display_graph_table,
3004 p_disable_header => G_REGION_REDO_TBL(l_index).disable_header,
3005 p_standalone => G_REGION_REDO_TBL(l_index).standalone,
3006 p_auto_customization_criteria => G_REGION_REDO_TBL(l_index).auto_customization_criteria,
3007 p_attribute_category => G_REGION_REDO_TBL(l_index).attribute_category,
3008 p_attribute1 => G_REGION_REDO_TBL(l_index).attribute1,
3009 p_attribute2 => G_REGION_REDO_TBL(l_index).attribute2,
3010 p_attribute3 => G_REGION_REDO_TBL(l_index).attribute3,
3011 p_attribute4 => G_REGION_REDO_TBL(l_index).attribute4,
3012 p_attribute5 => G_REGION_REDO_TBL(l_index).attribute5,
3013 p_attribute6 => G_REGION_REDO_TBL(l_index).attribute6,
3014 p_attribute7 => G_REGION_REDO_TBL(l_index).attribute7,
3015 p_attribute8 => G_REGION_REDO_TBL(l_index).attribute8,
3016 p_attribute9 => G_REGION_REDO_TBL(l_index).attribute9,
3017 p_attribute10 => G_REGION_REDO_TBL(l_index).attribute10,
3018 p_attribute11 => G_REGION_REDO_TBL(l_index).attribute11,
3019 p_attribute12 => G_REGION_REDO_TBL(l_index).attribute12,
3020 p_attribute13 => G_REGION_REDO_TBL(l_index).attribute13,
3021 p_attribute14 => G_REGION_REDO_TBL(l_index).attribute14,
3022 p_attribute15 => G_REGION_REDO_TBL(l_index).attribute15,
3023 p_name => G_REGION_REDO_TBL(l_index).name,
3024 p_description => G_REGION_REDO_TBL(l_index).description,
3025 p_created_by => G_REGION_REDO_TBL(l_index).created_by,
3026 p_creation_date => G_REGION_REDO_TBL(l_index).creation_date,
3027 p_last_updated_by => G_REGION_REDO_TBL(l_index).last_updated_by,
3028 p_last_update_date => G_REGION_REDO_TBL(l_index).last_update_date,
3029 p_last_update_login => G_REGION_REDO_TBL(l_index).last_update_login,
3030 p_loader_timestamp => p_loader_timestamp,
3031 p_pass => p_pass,
3032 p_copy_redo_flag => l_copy_redo_flag
3033 );
3034 else
3035 AK_REGION_PVT.CREATE_REGION (
3036 p_validation_level => p_validation_level,
3037 p_api_version_number => 1.0,
3038 p_msg_count => l_msg_count,
3039 p_msg_data => l_msg_data,
3040 p_return_status => l_return_status,
3041 p_region_application_id =>
3042 G_REGION_REDO_TBL(l_index).region_application_id,
3043 p_region_code => G_REGION_REDO_TBL(l_index).region_code,
3044 p_database_object_name =>G_REGION_REDO_TBL(l_index).database_object_name,
3045 p_region_style => G_REGION_REDO_TBL(l_index).region_style,
3046 p_num_columns => G_REGION_REDO_TBL(l_index).num_columns,
3047 p_icx_custom_call => G_REGION_REDO_TBL(l_index).icx_custom_call,
3048 p_region_defaulting_api_pkg =>
3049 G_REGION_REDO_TBL(l_index).region_defaulting_api_pkg,
3050 p_region_defaulting_api_proc =>
3051 G_REGION_REDO_TBL(l_index).region_defaulting_api_proc,
3052 p_region_validation_api_pkg =>
3053 G_REGION_REDO_TBL(l_index).region_validation_api_pkg,
3054 p_region_validation_api_proc =>
3055 G_REGION_REDO_TBL(l_index).region_validation_api_proc,
3056 p_appmodule_object_type =>
3057 G_REGION_REDO_TBL(l_index).applicationmodule_object_type,
3058 p_num_rows_display =>
3059 G_REGION_REDO_TBL(l_index).num_rows_display,
3060 p_region_object_type =>
3061 G_REGION_REDO_TBL(l_index).region_object_type,
3062 p_image_file_name =>
3063 G_REGION_REDO_TBL(l_index).image_file_name,
3064 p_isform_flag => G_REGION_REDO_TBL(l_index).isform_flag,
3065 p_help_target => G_REGION_REDO_TBL(l_index).help_target,
3066 p_style_sheet_filename => G_REGION_REDO_TBL(l_index).style_sheet_filename,
3067 p_version => G_REGION_REDO_TBL(l_index).version,
3068 p_applicationmodule_usage_name => G_REGION_REDO_TBL(l_index).applicationmodule_usage_name,
3069 p_add_indexed_children => G_REGION_REDO_TBL(l_index).add_indexed_children,
3070 p_stateful_flag => G_REGION_REDO_TBL(l_index).stateful_flag,
3071 p_function_name => G_REGION_REDO_TBL(l_index).function_name,
3072 p_children_view_usage_name => G_REGION_REDO_TBL(l_index).children_view_usage_name,
3073 p_search_panel => G_REGION_REDO_TBL(l_index).search_panel,
3074 p_advanced_search_panel => G_REGION_REDO_TBL(l_index).advanced_search_panel,
3075 p_customize_panel => G_REGION_REDO_TBL(l_index).customize_panel,
3076 p_default_search_panel => G_REGION_REDO_TBL(l_index).default_search_panel,
3077 p_results_based_search => G_REGION_REDO_TBL(l_index).results_based_search,
3078 p_display_graph_table => G_REGION_REDO_TBL(l_index).display_graph_table,
3079 p_disable_header => G_REGION_REDO_TBL(l_index).disable_header,
3080 p_standalone => G_REGION_REDO_TBL(l_index).standalone,
3081 p_auto_customization_criteria => G_REGION_REDO_TBL(l_index).auto_customization_criteria,
3082 p_attribute_category => G_REGION_REDO_TBL(l_index).attribute_category,
3083 p_attribute1 => G_REGION_REDO_TBL(l_index).attribute1,
3084 p_attribute2 => G_REGION_REDO_TBL(l_index).attribute2,
3085 p_attribute3 => G_REGION_REDO_TBL(l_index).attribute3,
3086 p_attribute4 => G_REGION_REDO_TBL(l_index).attribute4,
3087 p_attribute5 => G_REGION_REDO_TBL(l_index).attribute5,
3088 p_attribute6 => G_REGION_REDO_TBL(l_index).attribute6,
3089 p_attribute7 => G_REGION_REDO_TBL(l_index).attribute7,
3090 p_attribute8 => G_REGION_REDO_TBL(l_index).attribute8,
3091 p_attribute9 => G_REGION_REDO_TBL(l_index).attribute9,
3092 p_attribute10 => G_REGION_REDO_TBL(l_index).attribute10,
3093 p_attribute11 => G_REGION_REDO_TBL(l_index).attribute11,
3094 p_attribute12 => G_REGION_REDO_TBL(l_index).attribute12,
3095 p_attribute13 => G_REGION_REDO_TBL(l_index).attribute13,
3096 p_attribute14 => G_REGION_REDO_TBL(l_index).attribute14,
3097 p_attribute15 => G_REGION_REDO_TBL(l_index).attribute15,
3098 p_name => G_REGION_REDO_TBL(l_index).name,
3099 p_description => G_REGION_REDO_TBL(l_index).description,
3100 p_created_by => G_REGION_REDO_TBL(l_index).created_by,
3101 p_creation_date => G_REGION_REDO_TBL(l_index).creation_date,
3102 p_last_updated_by => G_REGION_REDO_TBL(l_index).last_updated_by,
3103 p_last_update_date => G_REGION_REDO_TBL(l_index).last_update_date,
3104 p_last_update_login => G_REGION_REDO_TBL(l_index).last_update_login,
3105 p_loader_timestamp => p_loader_timestamp,
3106 p_pass => p_pass,
3107 p_copy_redo_flag => l_copy_redo_flag
3108 );
3109 end if; -- /* if REGION_EXISTS */
3110 --
3111 -- If API call returns with an error status, upload aborts
3112 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
3113 (l_return_status = FND_API.G_RET_STS_ERROR) then
3114 RAISE FND_API.G_EXC_ERROR;
3115 end if; -- /* if l_return_status */
3116 end if; -- /* if G_REGION_REDO_TBL.exists(l_index) */
3117 end loop;
3118 G_REGION_REDO_INDEX := 0;
3119 G_REGION_REDO_TBL.DELETE;
3120 end if; -- /* if G_REGION_REDO_INDEX > 0 */
3121
3122 --
3123 -- create or update all region items to the database
3124 --
3125 if (G_ITEM_REDO_INDEX > 0) then
3126 for l_index in G_ITEM_REDO_TBL.FIRST .. G_ITEM_REDO_TBL.LAST loop
3127 if (G_ITEM_REDO_TBL.exists(l_index)) then
3128 if AK_REGION_PVT.ITEM_EXISTS (
3129 p_api_version_number => 1.0,
3130 p_return_status => l_return_status,
3131 p_region_application_id =>G_ITEM_REDO_TBL(l_index).region_application_id,
3132 p_region_code => G_ITEM_REDO_TBL(l_index).region_code,
3133 p_attribute_application_id =>
3134 G_ITEM_REDO_TBL(l_index).attribute_application_id,
3135 p_attribute_code => G_ITEM_REDO_TBL(l_index).attribute_code) then
3136 --
3137 -- Update Region Items only if G_UPDATE_MODE is TRUE
3138 --
3139 if (AK_UPLOAD_GRP.G_UPDATE_MODE) then
3140 AK_REGION_PVT.UPDATE_ITEM (
3141 p_validation_level => p_validation_level,
3142 p_api_version_number => 1.0,
3143 p_msg_count => l_msg_count,
3144 p_msg_data => l_msg_data,
3145 p_return_status => l_return_status,
3146 p_region_application_id =>G_ITEM_REDO_TBL(l_index).region_application_id,
3147 p_region_code => G_ITEM_REDO_TBL(l_index).region_code,
3148 p_attribute_application_id =>
3149 G_ITEM_REDO_TBL(l_index).attribute_application_id,
3150 p_attribute_code => G_ITEM_REDO_TBL(l_index).attribute_code,
3151 p_display_sequence => G_ITEM_REDO_TBL(l_index).display_sequence,
3152 p_node_display_flag => G_ITEM_REDO_TBL(l_index).node_display_flag,
3153 p_node_query_flag => G_ITEM_REDO_TBL(l_index).node_query_flag,
3154 p_attribute_label_length =>
3155 G_ITEM_REDO_TBL(l_index).attribute_label_length,
3156 p_display_value_length =>
3157 G_ITEM_REDO_TBL(l_index).display_value_length,
3158 p_bold => G_ITEM_REDO_TBL(l_index).bold,
3159 p_italic => G_ITEM_REDO_TBL(l_index).italic,
3160 p_vertical_alignment => G_ITEM_REDO_TBL(l_index).vertical_alignment,
3161 p_horizontal_alignment => G_ITEM_REDO_TBL(l_index).horizontal_alignment,
3162 p_item_style => G_ITEM_REDO_TBL(l_index).item_style,
3163 p_object_attribute_flag =>G_ITEM_REDO_TBL(l_index).object_attribute_flag,
3164 p_icx_custom_call => G_ITEM_REDO_TBL(l_index).icx_custom_call,
3165 p_update_flag => G_ITEM_REDO_TBL(l_index).update_flag,
3166 p_required_flag => G_ITEM_REDO_TBL(l_index).required_flag,
3167 p_security_code => G_ITEM_REDO_TBL(l_index).security_code,
3168 p_default_value_varchar2 =>
3169 G_ITEM_REDO_TBL(l_index).default_value_varchar2,
3170 p_default_value_number =>
3171 G_ITEM_REDO_TBL(l_index).default_value_number,
3172 p_default_value_date =>
3173 G_ITEM_REDO_TBL(l_index).default_value_date,
3174 p_lov_region_application_id =>
3175 G_ITEM_REDO_TBL(l_index).lov_region_application_id,
3176 p_lov_region_code => G_ITEM_REDO_TBL(l_index).lov_region_code,
3177 p_lov_foreign_key_name => G_ITEM_REDO_TBL(l_index).lov_foreign_key_name,
3178 p_lov_attribute_application_id =>
3179 G_ITEM_REDO_TBL(l_index).lov_attribute_application_id,
3180 p_lov_attribute_code => G_ITEM_REDO_TBL(l_index).lov_attribute_code,
3181 p_lov_default_flag => G_ITEM_REDO_TBL(l_index).lov_default_flag,
3182 p_region_defaulting_api_pkg =>
3183 G_ITEM_REDO_TBL(l_index).region_defaulting_api_pkg,
3184 p_region_defaulting_api_proc =>
3185 G_ITEM_REDO_TBL(l_index).region_defaulting_api_proc,
3186 p_region_validation_api_pkg =>
3187 G_ITEM_REDO_TBL(l_index).region_validation_api_pkg,
3188 p_region_validation_api_proc =>
3189 G_ITEM_REDO_TBL(l_index).region_validation_api_proc,
3190 p_order_sequence => G_ITEM_REDO_TBL(l_index).order_sequence,
3191 p_order_direction => G_ITEM_REDO_TBL(l_index).order_direction,
3192 p_display_height => G_ITEM_REDO_TBL(l_index).display_height,
3193 p_submit => G_ITEM_REDO_TBL(l_index).submit,
3194 p_encrypt => G_ITEM_REDO_TBL(l_index).encrypt,
3195 p_css_class_name => G_ITEM_REDO_TBL(l_index).css_class_name,
3196 p_view_usage_name => G_ITEM_REDO_TBL(l_index).view_usage_name,
3197 p_view_attribute_name => G_ITEM_REDO_TBL(l_index).view_attribute_name,
3198 p_nested_region_appl_id => G_ITEM_REDO_TBL(l_index).nested_region_application_id,
3199 p_nested_region_code => G_ITEM_REDO_TBL(l_index).nested_region_code,
3200 p_url => G_ITEM_REDO_TBL(l_index).url,
3201 p_poplist_viewobject => G_ITEM_REDO_TBL(l_index).poplist_viewobject,
3202 p_poplist_display_attr => G_ITEM_REDO_TBL(l_index).poplist_display_attr,
3203 p_poplist_value_attr => G_ITEM_REDO_TBL(l_index).poplist_value_attr,
3204 p_image_file_name => G_ITEM_REDO_TBL(l_index).image_file_name,
3205 p_item_name => G_ITEM_REDO_TBL(l_index).description,
3206 p_css_label_class_name => G_ITEM_REDO_TBL(l_index).css_label_class_name,
3207 p_menu_name => G_ITEM_REDO_TBL(l_index).menu_name,
3208 p_flexfield_name => G_ITEM_REDO_TBL(l_index).flexfield_name,
3209 p_flexfield_application_id => G_ITEM_REDO_TBL(l_index).flexfield_application_id,
3210 p_tabular_function_code => G_ITEM_REDO_TBL(l_index).tabular_function_code,
3211 p_tip_type => G_ITEM_REDO_TBL(l_index).tip_type,
3212 p_tip_message_name => G_ITEM_REDO_TBL(l_index).tip_message_name,
3213 p_tip_message_application_id => G_ITEM_REDO_TBL(l_index).tip_message_application_id ,
3214 p_flex_segment_list => G_ITEM_REDO_TBL(l_index).flex_segment_list,
3215 p_entity_id => G_ITEM_REDO_TBL(l_index).entity_id ,
3216 p_anchor => G_ITEM_REDO_TBL(l_index).anchor,
3217 p_poplist_view_usage_name => G_ITEM_REDO_TBL(l_index).poplist_view_usage_name,
3218 p_user_customizable => G_ITEM_REDO_TBL(l_index).user_customizable,
3219 p_sortby_view_attribute_name => G_ITEM_REDO_TBL(l_index).sortby_view_attribute_name,
3220 p_admin_customizable => G_ITEM_REDO_TBL(l_index).admin_customizable,
3221 p_invoke_function_name => G_ITEM_REDO_TBL(l_index).invoke_function_name,
3222 p_expansion => G_ITEM_REDO_TBL(l_index).expansion,
3223 p_als_max_length => G_ITEM_REDO_TBL(l_index).als_max_length,
3224 p_initial_sort_sequence => G_ITEM_REDO_TBL(l_index).initial_sort_sequence,
3225 p_customization_application_id => G_ITEM_REDO_TBL(l_index).customization_application_id,
3226 p_customization_code => G_ITEM_REDO_TBL(l_index).customization_code,
3227 p_attribute_category => G_ITEM_REDO_TBL(l_index).attribute_category,
3228 p_attribute1 => G_ITEM_REDO_TBL(l_index).attribute1,
3229 p_attribute2 => G_ITEM_REDO_TBL(l_index).attribute2,
3230 p_attribute3 => G_ITEM_REDO_TBL(l_index).attribute3,
3231 p_attribute4 => G_ITEM_REDO_TBL(l_index).attribute4,
3232 p_attribute5 => G_ITEM_REDO_TBL(l_index).attribute5,
3233 p_attribute6 => G_ITEM_REDO_TBL(l_index).attribute6,
3234 p_attribute7 => G_ITEM_REDO_TBL(l_index).attribute7,
3235 p_attribute8 => G_ITEM_REDO_TBL(l_index).attribute8,
3236 p_attribute9 => G_ITEM_REDO_TBL(l_index).attribute9,
3237 p_attribute10 => G_ITEM_REDO_TBL(l_index).attribute10,
3238 p_attribute11 => G_ITEM_REDO_TBL(l_index).attribute11,
3239 p_attribute12 => G_ITEM_REDO_TBL(l_index).attribute12,
3240 p_attribute13 => G_ITEM_REDO_TBL(l_index).attribute13,
3241 p_attribute14 => G_ITEM_REDO_TBL(l_index).attribute14,
3242 p_attribute15 => G_ITEM_REDO_TBL(l_index).attribute15,
3243 p_attribute_label_long => G_ITEM_REDO_TBL(l_index).attribute_label_long,
3244 p_attribute_label_short =>G_ITEM_REDO_TBL(l_index).attribute_label_short,
3245 p_description => G_ITEM_REDO_TBL(l_index).description,
3246 p_created_by => G_ITEM_REDO_TBL(l_index).created_by,
3247 p_creation_date => G_ITEM_REDO_TBL(l_index).creation_date,
3248 p_last_updated_by => G_ITEM_REDO_TBL(l_index).last_updated_by,
3249 p_last_update_date => G_ITEM_REDO_TBL(l_index).last_update_date,
3250 p_last_update_login => G_ITEM_REDO_TBL(l_index).last_update_login,
3251 p_loader_timestamp => p_loader_timestamp,
3252 p_pass => p_pass,
3253 p_copy_redo_flag => l_copy_redo_flag
3254 );
3255 elsif ( AK_UPLOAD_GRP.G_NO_CUSTOM_UPDATE ) then
3256 select ari.last_updated_by, arit.last_updated_by,
3257 ari.last_update_date, arit.last_update_date
3258 into l_user_id1, l_user_id2, l_update1, l_update2
3259 from ak_region_items ari, ak_region_items_tl arit
3260 where ari.region_code = G_ITEM_REDO_TBL(l_index).region_code
3261 and ari.region_application_id = G_ITEM_REDO_TBL(l_index).region_application_id
3262 and ari.attribute_code = G_ITEM_REDO_TBL(l_index).attribute_code
3263 and ari.attribute_application_id = G_ITEM_REDO_TBL(l_index).attribute_application_id
3264 and ari.region_code = arit.region_code
3265 and ari.region_application_id = arit.region_application_id
3266 and ari.attribute_code = arit.attribute_code
3267 and ari.attribute_application_id = arit.attribute_application_id
3268 and arit.language = userenv('LANG');
3269 /*if (( l_user_id1 = 1 or l_user_id1 = 2) and
3270 ( l_user_id2 = 1 or l_user_id2 = 2 )) then*/
3271 if (AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
3272 p_loader_timestamp => p_loader_timestamp,
3273 p_created_by => G_ITEM_REDO_TBL(l_index).created_by,
3274 p_creation_date => G_ITEM_REDO_TBL(l_index).creation_date,
3275 p_last_updated_by => G_ITEM_REDO_TBL(l_index).last_updated_by,
3276 p_db_last_updated_by => l_user_id1,
3277 p_last_update_date => G_ITEM_REDO_TBL(l_index).last_update_date,
3278 p_db_last_update_date => l_update1,
3279 p_last_update_login => G_ITEM_REDO_TBL(l_index).last_update_login,
3280 p_create_or_update => 'UPDATE') and
3281
3282 AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
3283 p_loader_timestamp => p_loader_timestamp,
3284 p_created_by => G_ITEM_REDO_TBL(l_index).created_by,
3285 p_creation_date => G_ITEM_REDO_TBL(l_index).creation_date,
3286 p_last_updated_by => G_ITEM_REDO_TBL(l_index).last_updated_by,
3287 p_db_last_updated_by => l_user_id2,
3288 p_last_update_date => G_ITEM_REDO_TBL(l_index).last_update_date,
3289 p_db_last_update_date => l_update2,
3290 p_last_update_login => G_ITEM_REDO_TBL(l_index).last_update_login,
3291 p_create_or_update => 'UPDATE')) then
3292
3293 AK_REGION_PVT.UPDATE_ITEM (
3294 p_validation_level => p_validation_level,
3295 p_api_version_number => 1.0,
3296 p_msg_count => l_msg_count,
3297 p_msg_data => l_msg_data,
3298 p_return_status => l_return_status,
3299 p_region_application_id =>G_ITEM_REDO_TBL(l_index).region_application_id,
3300 p_region_code => G_ITEM_REDO_TBL(l_index).region_code,
3301 p_attribute_application_id =>
3302 G_ITEM_REDO_TBL(l_index).attribute_application_id,
3303 p_attribute_code => G_ITEM_REDO_TBL(l_index).attribute_code,
3304 p_display_sequence => G_ITEM_REDO_TBL(l_index).display_sequence,
3305 p_node_display_flag => G_ITEM_REDO_TBL(l_index).node_display_flag,
3306 p_node_query_flag => G_ITEM_REDO_TBL(l_index).node_query_flag,
3307 p_attribute_label_length =>
3308 G_ITEM_REDO_TBL(l_index).attribute_label_length,
3309 p_display_value_length =>
3310 G_ITEM_REDO_TBL(l_index).display_value_length,
3311 p_bold => G_ITEM_REDO_TBL(l_index).bold,
3312 p_italic => G_ITEM_REDO_TBL(l_index).italic,
3313 p_vertical_alignment => G_ITEM_REDO_TBL(l_index).vertical_alignment,
3314 p_horizontal_alignment => G_ITEM_REDO_TBL(l_index).horizontal_alignment,
3315 p_item_style => G_ITEM_REDO_TBL(l_index).item_style,
3316 p_object_attribute_flag =>G_ITEM_REDO_TBL(l_index).object_attribute_flag,
3317 p_icx_custom_call => G_ITEM_REDO_TBL(l_index).icx_custom_call,
3318 p_update_flag => G_ITEM_REDO_TBL(l_index).update_flag,
3319 p_required_flag => G_ITEM_REDO_TBL(l_index).required_flag,
3320 p_security_code => G_ITEM_REDO_TBL(l_index).security_code,
3321 p_default_value_varchar2 =>
3322 G_ITEM_REDO_TBL(l_index).default_value_varchar2,
3323 p_default_value_number =>
3324 G_ITEM_REDO_TBL(l_index).default_value_number,
3325 p_default_value_date =>
3326 G_ITEM_REDO_TBL(l_index).default_value_date,
3327 p_lov_region_application_id =>
3328 G_ITEM_REDO_TBL(l_index).lov_region_application_id,
3329 p_lov_region_code => G_ITEM_REDO_TBL(l_index).lov_region_code,
3330 p_lov_foreign_key_name => G_ITEM_REDO_TBL(l_index).lov_foreign_key_name,
3331 p_lov_attribute_application_id =>
3332 G_ITEM_REDO_TBL(l_index).lov_attribute_application_id,
3333 p_lov_attribute_code => G_ITEM_REDO_TBL(l_index).lov_attribute_code,
3334 p_lov_default_flag => G_ITEM_REDO_TBL(l_index).lov_default_flag,
3335 p_region_defaulting_api_pkg =>
3336 G_ITEM_REDO_TBL(l_index).region_defaulting_api_pkg,
3337 p_region_defaulting_api_proc =>
3338 G_ITEM_REDO_TBL(l_index).region_defaulting_api_proc,
3339 p_region_validation_api_pkg =>
3340 G_ITEM_REDO_TBL(l_index).region_validation_api_pkg,
3341 p_region_validation_api_proc =>
3342 G_ITEM_REDO_TBL(l_index).region_validation_api_proc,
3343 p_order_sequence => G_ITEM_REDO_TBL(l_index).order_sequence,
3344 p_order_direction => G_ITEM_REDO_TBL(l_index).order_direction,
3345 p_display_height => G_ITEM_REDO_TBL(l_index).display_height,
3346 p_submit => G_ITEM_REDO_TBL(l_index).submit,
3347 p_encrypt => G_ITEM_REDO_TBL(l_index).encrypt,
3348 p_css_class_name => G_ITEM_REDO_TBL(l_index).css_class_name,
3349 p_view_usage_name => G_ITEM_REDO_TBL(l_index).view_usage_name,
3350 p_view_attribute_name => G_ITEM_REDO_TBL(l_index).view_attribute_name,
3351 p_nested_region_appl_id => G_ITEM_REDO_TBL(l_index).nested_region_application_id,
3352 p_nested_region_code => G_ITEM_REDO_TBL(l_index).nested_region_code,
3353 p_url => G_ITEM_REDO_TBL(l_index).url,
3354 p_poplist_viewobject => G_ITEM_REDO_TBL(l_index).poplist_viewobject,
3355 p_poplist_display_attr => G_ITEM_REDO_TBL(l_index).poplist_display_attr,
3356 p_poplist_value_attr => G_ITEM_REDO_TBL(l_index).poplist_value_attr,
3357 p_image_file_name => G_ITEM_REDO_TBL(l_index).image_file_name,
3358 p_item_name => G_ITEM_REDO_TBL(l_index).item_name,
3359 p_css_label_class_name => G_ITEM_REDO_TBL(l_index).css_label_class_name,
3360 p_menu_name => G_ITEM_REDO_TBL(l_index).menu_name,
3361 p_flexfield_name => G_ITEM_REDO_TBL(l_index).flexfield_name,
3362 p_flexfield_application_id => G_ITEM_REDO_TBL(l_index).flexfield_application_id,
3363 p_tabular_function_code => G_ITEM_REDO_TBL(l_index).tabular_function_code,
3364 p_tip_type => G_ITEM_REDO_TBL(l_index).tip_type,
3365 p_tip_message_name => G_ITEM_REDO_TBL(l_index).tip_message_name,
3366 p_tip_message_application_id => G_ITEM_REDO_TBL(l_index).tip_message_application_id ,
3367 p_flex_segment_list => G_ITEM_REDO_TBL(l_index).flex_segment_list,
3368 p_entity_id => G_ITEM_REDO_TBL(l_index).entity_id ,
3369 p_anchor => G_ITEM_REDO_TBL(l_index).anchor,
3370 p_poplist_view_usage_name => G_ITEM_REDO_TBL(l_index).poplist_view_usage_name,
3371 p_user_customizable => G_ITEM_REDO_TBL(l_index).user_customizable,
3372 p_sortby_view_attribute_name => G_ITEM_REDO_TBL(l_index).sortby_view_attribute_name,
3373 p_admin_customizable => G_ITEM_REDO_TBL(l_index).admin_customizable,
3374 p_invoke_function_name => G_ITEM_REDO_TBL(l_index).invoke_function_name,
3375 p_expansion => G_ITEM_REDO_TBL(l_index).expansion,
3376 p_als_max_length => G_ITEM_REDO_TBL(l_index).als_max_length,
3377 p_initial_sort_sequence => G_ITEM_REDO_TBL(l_index).initial_sort_sequence,
3378 p_customization_application_id => G_ITEM_REDO_TBL(l_index).customization_application_id,
3379 p_customization_code => G_ITEM_REDO_TBL(l_index).customization_code,
3380 p_attribute_category => G_ITEM_REDO_TBL(l_index).attribute_category,
3381 p_attribute1 => G_ITEM_REDO_TBL(l_index).attribute1,
3382 p_attribute2 => G_ITEM_REDO_TBL(l_index).attribute2,
3383 p_attribute3 => G_ITEM_REDO_TBL(l_index).attribute3,
3384 p_attribute4 => G_ITEM_REDO_TBL(l_index).attribute4,
3385 p_attribute5 => G_ITEM_REDO_TBL(l_index).attribute5,
3386 p_attribute6 => G_ITEM_REDO_TBL(l_index).attribute6,
3387 p_attribute7 => G_ITEM_REDO_TBL(l_index).attribute7,
3388 p_attribute8 => G_ITEM_REDO_TBL(l_index).attribute8,
3389 p_attribute9 => G_ITEM_REDO_TBL(l_index).attribute9,
3390 p_attribute10 => G_ITEM_REDO_TBL(l_index).attribute10,
3391 p_attribute11 => G_ITEM_REDO_TBL(l_index).attribute11,
3392 p_attribute12 => G_ITEM_REDO_TBL(l_index).attribute12,
3393 p_attribute13 => G_ITEM_REDO_TBL(l_index).attribute13,
3394 p_attribute14 => G_ITEM_REDO_TBL(l_index).attribute14,
3395 p_attribute15 => G_ITEM_REDO_TBL(l_index).attribute15,
3396 p_attribute_label_long => G_ITEM_REDO_TBL(l_index).attribute_label_long,
3397 p_attribute_label_short =>G_ITEM_REDO_TBL(l_index).attribute_label_short,
3398 p_description => G_ITEM_REDO_TBL(l_index).description,
3399 p_created_by => G_ITEM_REDO_TBL(l_index).created_by,
3400 p_creation_date => G_ITEM_REDO_TBL(l_index).creation_date,
3401 p_last_updated_by => G_ITEM_REDO_TBL(l_index).last_updated_by,
3402 p_last_update_date => G_ITEM_REDO_TBL(l_index).last_update_date,
3403 p_last_update_login => G_ITEM_REDO_TBL(l_index).last_update_login,
3404 p_loader_timestamp => p_loader_timestamp,
3405 p_pass => p_pass,
3406 p_copy_redo_flag => l_copy_redo_flag
3407 );
3408 end if; -- /* if l_user_id1 = 1 and l_user_id2 = 1 */
3409 end if; -- /* if G_UPDATE_MODE G_NO_CUSTOM_UPDATE*/
3410 else
3411 AK_REGION_PVT.CREATE_ITEM (
3412 p_validation_level => p_validation_level,
3413 p_api_version_number => 1.0,
3414 p_msg_count => l_msg_count,
3415 p_msg_data => l_msg_data,
3416 p_return_status => l_return_status,
3417 p_region_application_id =>G_ITEM_REDO_TBL(l_index).region_application_id,
3418 p_region_code => G_ITEM_REDO_TBL(l_index).region_code,
3419 p_attribute_application_id =>
3420 G_ITEM_REDO_TBL(l_index).attribute_application_id,
3421 p_attribute_code => G_ITEM_REDO_TBL(l_index).attribute_code,
3422 p_display_sequence => G_ITEM_REDO_TBL(l_index).display_sequence,
3423 p_node_display_flag => G_ITEM_REDO_TBL(l_index).node_display_flag,
3424 p_node_query_flag => G_ITEM_REDO_TBL(l_index).node_query_flag,
3425 p_attribute_label_length =>
3426 G_ITEM_REDO_TBL(l_index).attribute_label_length,
3427 p_display_value_length =>
3428 G_ITEM_REDO_TBL(l_index).display_value_length,
3429 p_bold => G_ITEM_REDO_TBL(l_index).bold,
3430 p_italic => G_ITEM_REDO_TBL(l_index).italic,
3431 p_vertical_alignment => G_ITEM_REDO_TBL(l_index).vertical_alignment,
3432 p_horizontal_alignment => G_ITEM_REDO_TBL(l_index).horizontal_alignment,
3433 p_item_style => G_ITEM_REDO_TBL(l_index).item_style,
3434 p_object_attribute_flag =>G_ITEM_REDO_TBL(l_index).object_attribute_flag,
3435 p_icx_custom_call => G_ITEM_REDO_TBL(l_index).icx_custom_call,
3436 p_update_flag => G_ITEM_REDO_TBL(l_index).update_flag,
3437 p_required_flag => G_ITEM_REDO_TBL(l_index).required_flag,
3438 p_security_code => G_ITEM_REDO_TBL(l_index).security_code,
3439 p_default_value_varchar2 =>
3440 G_ITEM_REDO_TBL(l_index).default_value_varchar2,
3441 p_default_value_number =>
3442 G_ITEM_REDO_TBL(l_index).default_value_number,
3443 p_default_value_date =>
3444 G_ITEM_REDO_TBL(l_index).default_value_date,
3445 p_lov_region_application_id =>
3446 G_ITEM_REDO_TBL(l_index).lov_region_application_id,
3447 p_lov_region_code => G_ITEM_REDO_TBL(l_index).lov_region_code,
3448 p_lov_foreign_key_name => G_ITEM_REDO_TBL(l_index).lov_foreign_key_name,
3449 p_lov_attribute_application_id =>
3450 G_ITEM_REDO_TBL(l_index).lov_attribute_application_id,
3451 p_lov_attribute_code => G_ITEM_REDO_TBL(l_index).lov_attribute_code,
3452 p_lov_default_flag => G_ITEM_REDO_TBL(l_index).lov_default_flag,
3453 p_region_defaulting_api_pkg =>
3454 G_ITEM_REDO_TBL(l_index).region_defaulting_api_pkg,
3455 p_region_defaulting_api_proc =>
3456 G_ITEM_REDO_TBL(l_index).region_defaulting_api_proc,
3457 p_region_validation_api_pkg =>
3458 G_ITEM_REDO_TBL(l_index).region_validation_api_pkg,
3459 p_region_validation_api_proc =>
3460 G_ITEM_REDO_TBL(l_index).region_validation_api_proc,
3461 p_order_sequence => G_ITEM_REDO_TBL(l_index).order_sequence,
3462 p_order_direction => G_ITEM_REDO_TBL(l_index).order_direction,
3463 p_display_height => G_ITEM_REDO_TBL(l_index).display_height,
3464 p_submit => G_ITEM_REDO_TBL(l_index).submit,
3465 p_encrypt => G_ITEM_REDO_TBL(l_index).encrypt,
3466 p_css_class_name => G_ITEM_REDO_TBL(l_index).css_class_name,
3467 p_view_usage_name => G_ITEM_REDO_TBL(l_index).view_usage_name,
3468 p_view_attribute_name => G_ITEM_REDO_TBL(l_index).view_attribute_name,
3469 p_nested_region_appl_id => G_ITEM_REDO_TBL(l_index).nested_region_application_id,
3470 p_nested_region_code => G_ITEM_REDO_TBL(l_index).nested_region_code,
3471 p_url => G_ITEM_REDO_TBL(l_index).url,
3472 p_poplist_viewobject => G_ITEM_REDO_TBL(l_index).poplist_viewobject,
3473 p_poplist_display_attr => G_ITEM_REDO_TBL(l_index).poplist_display_attr,
3474 p_poplist_value_attr => G_ITEM_REDO_TBL(l_index).poplist_value_attr,
3475 p_image_file_name => G_ITEM_REDO_TBL(l_index).image_file_name,
3476 p_css_label_class_name => G_ITEM_REDO_TBL(l_index).css_label_class_name,
3477 p_menu_name => G_ITEM_REDO_TBL(l_index).menu_name,
3478 p_flexfield_name => G_ITEM_REDO_TBL(l_index).flexfield_name,
3479 p_flexfield_application_id => G_ITEM_REDO_TBL(l_index).flexfield_application_id,
3480 p_tabular_function_code => G_ITEM_REDO_TBL(l_index).tabular_function_code,
3481 p_tip_type => G_ITEM_REDO_TBL(l_index).tip_type,
3482 p_tip_message_name => G_ITEM_REDO_TBL(l_index).tip_message_name,
3483 p_tip_message_application_id => G_ITEM_REDO_TBL(l_index).tip_message_application_id ,
3484 p_flex_segment_list => G_ITEM_REDO_TBL(l_index).flex_segment_list,
3485 p_entity_id => G_ITEM_REDO_TBL(l_index).entity_id ,
3486 p_anchor => G_ITEM_REDO_TBL(l_index).anchor,
3487 p_poplist_view_usage_name => G_ITEM_REDO_TBL(l_index).poplist_view_usage_name,
3488 p_user_customizable => G_ITEM_REDO_TBL(l_index).user_customizable,
3489 p_sortby_view_attribute_name => G_ITEM_REDO_TBL(l_index).sortby_view_attribute_name,
3490 p_admin_customizable => G_ITEM_REDO_TBL(l_index).admin_customizable,
3491 p_invoke_function_name => G_ITEM_REDO_TBL(l_index).invoke_function_name,
3492 p_expansion => G_ITEM_REDO_TBL(l_index).expansion,
3493 p_als_max_length => G_ITEM_REDO_TBL(l_index).als_max_length,
3494 p_initial_sort_sequence => G_ITEM_REDO_TBL(l_index).initial_sort_sequence,
3495 p_customization_application_id => G_ITEM_REDO_TBL(l_index).customization_application_id,
3496 p_customization_code => G_ITEM_REDO_TBL(l_index).customization_code,
3497 p_attribute_category => G_ITEM_REDO_TBL(l_index).attribute_category,
3498 p_attribute1 => G_ITEM_REDO_TBL(l_index).attribute1,
3499 p_attribute2 => G_ITEM_REDO_TBL(l_index).attribute2,
3500 p_attribute3 => G_ITEM_REDO_TBL(l_index).attribute3,
3501 p_attribute4 => G_ITEM_REDO_TBL(l_index).attribute4,
3502 p_attribute5 => G_ITEM_REDO_TBL(l_index).attribute5,
3503 p_attribute6 => G_ITEM_REDO_TBL(l_index).attribute6,
3504 p_attribute7 => G_ITEM_REDO_TBL(l_index).attribute7,
3505 p_attribute8 => G_ITEM_REDO_TBL(l_index).attribute8,
3506 p_attribute9 => G_ITEM_REDO_TBL(l_index).attribute9,
3507 p_attribute10 => G_ITEM_REDO_TBL(l_index).attribute10,
3508 p_attribute11 => G_ITEM_REDO_TBL(l_index).attribute11,
3509 p_attribute12 => G_ITEM_REDO_TBL(l_index).attribute12,
3510 p_attribute13 => G_ITEM_REDO_TBL(l_index).attribute13,
3511 p_attribute14 => G_ITEM_REDO_TBL(l_index).attribute14,
3512 p_attribute15 => G_ITEM_REDO_TBL(l_index).attribute15,
3513 p_attribute_label_long => G_ITEM_REDO_TBL(l_index).attribute_label_long,
3514 p_attribute_label_short =>G_ITEM_REDO_TBL(l_index).attribute_label_short,
3515 p_description => G_ITEM_REDO_TBL(l_index).description,
3516 p_created_by => G_ITEM_REDO_TBL(l_index).created_by,
3517 p_creation_date => G_ITEM_REDO_TBL(l_index).creation_date,
3518 p_last_updated_by => G_ITEM_REDO_TBL(l_index).last_updated_by,
3519 p_last_update_date => G_ITEM_REDO_TBL(l_index).lasT_update_date,
3520 p_last_update_login => G_ITEM_REDO_TBL(l_index).last_update_login,
3521 p_loader_timestamp => p_loader_timestamp,
3522 p_pass => p_pass,
3523 p_copy_redo_flag => l_copy_redo_flag
3524 );
3525 end if; -- /* if ITEM_EXISTS */
3526 --
3527 -- If API call returns with an error status, upload aborts
3528 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
3529 (l_return_status = FND_API.G_RET_STS_ERROR) then
3530 RAISE FND_API.G_EXC_ERROR;
3531 end if; -- /* if l_return_status */
3532 end if; -- /* if G_ITEM_REDO_TBL.exists */
3533 end loop;
3534 G_ITEM_REDO_INDEX := 0;
3535 G_ITEM_REDO_TBL.DELETE;
3536 end if;
3537
3538 --
3539 -- create or update all region lov relations to the database
3540 --
3541 if (G_LOV_RELATION_REDO_INDEX > 0) then
3542 for l_index in G_LOV_RELATION_REDO_TBL.FIRST .. G_LOV_RELATION_REDO_TBL.LAST loop
3543 if (G_LOV_RELATION_REDO_TBL.exists(l_index)) then
3544 if ( G_LOV_RELATION_REDO_TBL(l_index).base_region_appl_id is null ) then
3545 G_LOV_RELATION_REDO_TBL(l_index).base_region_appl_id := G_LOV_RELATION_REDO_TBL(l_index).region_application_id;
3546 end if;
3547 if ( G_LOV_RELATION_REDO_TBL(l_index).base_region_code is null ) then
3548 G_LOV_RELATION_REDO_TBL(l_index).base_region_code := G_LOV_RELATION_REDO_TBL(l_index).region_code;
3549 end if;
3550
3551 if AK_REGION2_PVT.LOV_RELATION_EXISTS (
3552 p_api_version_number => 1.0,
3553 p_return_status => l_return_status,
3554 p_region_application_id =>
3555 G_LOV_RELATION_REDO_TBL(l_index).region_application_id,
3556 p_region_code => G_LOV_RELATION_REDO_TBL(l_index).region_code,
3557 p_attribute_application_id =>
3558 G_LOV_RELATION_REDO_TBL(l_index).attribute_application_id,
3559 p_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).attribute_code,
3560 p_lov_region_appl_id => G_LOV_RELATION_REDO_TBL(l_index).lov_region_appl_id,
3561 p_lov_region_code => G_LOV_RELATION_REDO_TBL(l_index).lov_region_code,
3562 p_lov_attribute_appl_id =>
3563 G_LOV_RELATION_REDO_TBL(l_index).lov_attribute_appl_id,
3564 p_lov_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).lov_attribute_code,
3565 p_base_attribute_appl_id => G_LOV_RELATION_REDO_TBL(l_index).base_attribute_appl_id,
3566 p_base_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).base_attribute_code,
3567 p_direction_flag => G_LOV_RELATION_REDO_TBL(l_index).direction_flag,
3568 p_base_region_appl_id => G_LOV_RELATION_REDO_TBL(l_index).base_region_appl_id,
3569 p_base_region_code => G_LOV_RELATION_REDO_TBL(l_index).base_region_code) then
3570 AK_REGION2_PVT.UPDATE_LOV_RELATION (
3571 p_validation_level => p_validation_level,
3572 p_api_version_number => 1.0,
3573 p_msg_count => l_msg_count,
3574 p_msg_data => l_msg_data,
3575 p_return_status => l_return_status,
3576 p_region_application_id =>
3577 G_LOV_RELATION_REDO_TBL(l_index).region_application_id,
3578 p_region_code => G_LOV_RELATION_REDO_TBL(l_index).region_code,
3579 p_attribute_application_id =>
3580 G_LOV_RELATION_REDO_TBL(l_index).attribute_application_id,
3581 p_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).attribute_code,
3582 p_lov_region_appl_id => G_LOV_RELATION_REDO_TBL(l_index).lov_region_appl_id,
3583 p_lov_region_code => G_LOV_RELATION_REDO_TBL(l_index).lov_region_code,
3584 p_lov_attribute_appl_id => G_LOV_RELATION_REDO_TBL(l_index).lov_attribute_appl_id,
3585 p_lov_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).lov_attribute_code,
3586 p_base_attribute_appl_id => G_LOV_RELATION_REDO_TBL(l_index).base_attribute_appl_id,
3587 p_base_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).base_attribute_code,
3588 p_direction_flag => G_LOV_RELATION_REDO_TBL(l_index).direction_flag,
3589 p_base_region_appl_id => G_LOV_RELATION_REDO_TBL(l_index).base_region_appl_id,
3590 p_base_region_code => G_LOV_RELATION_REDO_TBL(l_index).base_region_code,
3591 p_required_flag => G_LOV_RELATION_REDO_TBL(l_index).required_flag,
3592 p_loader_timestamp => p_loader_timestamp,
3593 p_pass => p_pass,
3594 p_copy_redo_flag => l_copy_redo_flag
3595 );
3596 else
3597 AK_REGION2_PVT.CREATE_LOV_RELATION (
3598 p_validation_level => p_validation_level,
3599 p_api_version_number => 1.0,
3600 p_msg_count => l_msg_count,
3601 p_msg_data => l_msg_data,
3602 p_return_status => l_return_status,
3603 p_region_application_id =>
3604 G_LOV_RELATION_REDO_TBL(l_index).region_application_id,
3605 p_region_code => G_LOV_RELATION_REDO_TBL(l_index).region_code,
3606 p_attribute_application_id =>
3607 G_LOV_RELATION_REDO_TBL(l_index).attribute_application_id,
3608 p_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).attribute_code,
3609 p_lov_region_appl_id => G_LOV_RELATION_REDO_TBL(l_index).lov_region_appl_id,
3610 p_lov_region_code => G_LOV_RELATION_REDO_TBL(l_index).lov_region_code,
3611 p_lov_attribute_appl_id => G_LOV_RELATION_REDO_TBL(l_index).lov_attribute_appl_id,
3612 p_lov_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).lov_attribute_code,
3613 p_base_attribute_appl_id => G_LOV_RELATION_REDO_TBL(l_index).base_attribute_appl_id,
3614 p_base_attribute_code => G_LOV_RELATION_REDO_TBL(l_index).base_attribute_code,
3615 p_direction_flag => G_LOV_RELATION_REDO_TBL(l_index).direction_flag,
3616 p_base_region_appl_id => G_LOV_RELATION_REDO_TBL(l_index).base_region_appl_id,
3617 p_base_region_code => G_LOV_RELATION_REDO_TBL(l_index).base_region_code,
3618 p_required_flag => G_LOV_RELATION_REDO_TBL(l_index).required_flag,
3619 p_created_by => G_LOV_RELATION_REDO_TBL(l_index).created_by,
3620 p_creation_date => G_LOV_RELATION_REDO_TBL(l_index).creation_date,
3621 p_last_updated_by => G_LOV_RELATION_REDO_TBL(l_index).last_updated_by,
3622 p_last_update_date => G_LOV_RELATION_REDO_TBL(l_index).last_update_date,
3623 p_last_update_login => G_LOV_RELATION_REDO_TBL(l_index).last_update_login,
3624 p_loader_timestamp => p_loader_timestamp,
3625 p_pass => p_pass,
3626 p_copy_redo_flag => l_copy_redo_flag
3627 );
3628 end if; -- /* if LOV_RELATION_EXISTS */
3629 --
3630 -- If API call returns with an error status, upload aborts
3631 if (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) or
3632 (l_return_status = FND_API.G_RET_STS_ERROR) then
3633 RAISE FND_API.G_EXC_ERROR;
3634 end if; -- /* if l_return_status */
3635 end if; -- /* if G_LOV_RELATION_REDO_TBL.exists(l_index) */
3636 end loop;
3637 G_LOV_RELATION_REDO_INDEX := 0;
3638 G_LOV_RELATION_REDO_TBL.DELETE;
3639 end if; -- /* if G_LOV_RELATION_REDO_INDEX > 0 */
3640
3641 p_return_status := FND_API.G_RET_STS_SUCCESS;
3642
3643 EXCEPTION
3644 WHEN FND_API.G_EXC_ERROR THEN
3645 p_return_status := FND_API.G_RET_STS_ERROR;
3646 FND_MSG_PUB.Count_And_Get (
3647 p_count => l_msg_count,
3648 p_data => l_msg_data);
3649 G_REGION_REDO_INDEX := 0;
3650 G_ITEM_REDO_INDEX := 0;
3651 G_LOV_RELATION_REDO_INDEX := 0;
3652 G_REGION_REDO_TBL.DELETE;
3653 G_ITEM_REDO_TBL.DELETE;
3654 G_LOV_RELATION_REDO_TBL.DELETE;
3655 WHEN OTHERS THEN
3656 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3657 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
3658 SUBSTR (SQLERRM, 1, 240) );
3659 FND_MSG_PUB.Count_And_Get (
3660 p_count => l_msg_count,
3661 p_data => l_msg_data);
3662 G_REGION_REDO_INDEX := 0;
3663 G_ITEM_REDO_INDEX := 0;
3664 G_LOV_RELATION_REDO_INDEX := 0;
3665 G_REGION_REDO_TBL.DELETE;
3666 G_ITEM_REDO_TBL.DELETE;
3667 G_LOV_RELATION_REDO_TBL.DELETE;
3668 end UPLOAD_REGION_SECOND;
3669
3670 --=======================================================
3671 -- Procedure CHECK_DISPLAY_SEQUENCE
3672 --
3673 -- Usage Private API for making sure that the
3674 -- display sequence is unique for a given region
3675 -- code.
3676 --
3677 -- Desc This API updates a region item, if necessary
3678 --
3679 -- Results The API returns the standard p_return_status parameter
3680 -- indicating one of the standard return statuses :
3681 -- * Unexpected error
3682 -- * Error
3683 -- * Success
3684 -- Parameters Region Item columns
3685 --
3686 -- Version Initial version number = 1.0
3687 -- History Current version number = 1.0
3688 --=======================================================
3689 procedure CHECK_DISPLAY_SEQUENCE (
3690 p_validation_level IN NUMBER,
3691 p_region_code IN VARCHAR2,
3692 p_region_application_id IN NUMBER,
3693 p_attribute_code IN VARCHAR2,
3694 p_attribute_application_id IN NUMBER,
3695 p_display_sequence IN NUMBER,
3696 p_return_status OUT NOCOPY VARCHAR2,
3697 p_msg_count OUT NOCOPY NUMBER,
3698 p_msg_data OUT NOCOPY VARCHAR2,
3699 p_pass IN NUMBER,
3700 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
3701 ) is
3702 cursor l_ri_csr ( region_code_param IN VARCHAR2,
3703 region_application_id_param IN NUMBER,
3704 display_sequence_param IN NUMBER) is
3705 select *
3706 from ak_region_items
3707 where region_code = region_code_param
3708 and region_application_id = region_application_id_param
3709 and display_sequence = display_sequence_param;
3710
3711 cursor l_ri_tl_csr ( region_code_param IN VARCHAR2,
3712 region_application_id_param IN NUMBER,
3713 attribute_code_param IN VARCHAR2,
3714 attribute_application_id_param IN NUMBER,
3715 lang_param IN VARCHAR2) is
3716 select *
3717 from ak_region_items_tl
3718 where region_code = region_code_param
3719 and region_application_id = region_application_id_param
3720 and attribute_code = attribute_code_param
3721 and attribute_application_id = attribute_application_id_param
3722 and language = lang_param;
3723
3724 l_lang varchar2(30);
3725 l_api_name CONSTANT varchar2(30) := 'Check_Display_Sequence';
3726 l_new_display_sequence NUMBER;
3727 l_return_status VARCHAR2(1);
3728 l_ri_rec ak_region_items%ROWTYPE;
3729 l_orig_ri_rec ak_region_items%ROWTYPE;
3730 l_ri_tl_rec ak_region_items_tl%ROWTYPE;
3731
3732 begin
3733 l_return_status := FND_API.G_RET_STS_SUCCESS;
3734 open l_ri_csr( p_region_code,
3735 p_region_application_id,
3736 p_display_sequence);
3737 fetch l_ri_csr into l_ri_rec;
3738
3739 --** Does it exists?
3740 if (l_ri_csr%found) then
3741 if ((l_ri_rec.attribute_code <> p_attribute_code) or
3742 (l_ri_rec.attribute_application_id <> p_attribute_application_id)) then
3743 --** Save it.
3744 l_orig_ri_rec := l_ri_rec;
3745
3746 --** Get the TL entry
3747 select userenv('LANG') into l_lang from dual;
3748 open l_ri_tl_csr( p_region_code,
3749 p_region_application_id,
3750 l_ri_rec.attribute_code,
3751 l_ri_rec.attribute_application_id,
3752 l_lang);
3753 fetch l_ri_tl_csr into l_ri_tl_rec;
3754
3755 --** Bump up the display sequence value of the region item record
3756 l_new_display_sequence := p_display_sequence + 1000000;
3757 close l_ri_csr;
3758 open l_ri_csr( p_region_code,
3759 p_region_application_id,
3760 l_new_display_sequence);
3761 fetch l_ri_csr into l_ri_rec;
3762
3763 --** Keep looping until you can't find a record.
3764 while (l_ri_csr%found) loop
3765 close l_ri_csr;
3766 l_new_display_sequence := l_new_display_sequence + 1;
3767 open l_ri_csr( p_region_code,
3768 p_region_application_id,
3769 l_new_display_sequence);
3770 fetch l_ri_csr into l_ri_rec;
3771 end loop;
3772
3773 --** ASSUMPTION: You have found a unique sequence number for this region.
3774 AK_REGION_PVT.UPDATE_ITEM (
3775 p_validation_level => p_validation_level,
3776 p_api_version_number => 1.0,
3777 p_msg_count => p_msg_count,
3778 p_msg_data => p_msg_data,
3779 p_return_status => l_return_status,
3780 p_region_application_id =>l_orig_ri_rec.region_application_id,
3781 p_region_code => l_orig_ri_rec.region_code,
3782 p_attribute_application_id => l_orig_ri_rec.attribute_application_id,
3783 p_attribute_code => l_orig_ri_rec.attribute_code,
3784 p_display_sequence => l_new_display_sequence,
3785 p_node_display_flag => l_orig_ri_rec.node_display_flag,
3786 p_node_query_flag => l_orig_ri_rec.node_query_flag,
3787 p_attribute_label_length => l_orig_ri_rec.attribute_label_length,
3788 p_display_value_length => l_orig_ri_rec.display_value_length,
3789 p_bold => l_orig_ri_rec.bold,
3790 p_italic => l_orig_ri_rec.italic,
3791 p_vertical_alignment => l_orig_ri_rec.vertical_alignment,
3792 p_horizontal_alignment => l_orig_ri_rec.horizontal_alignment,
3793 p_item_style => l_orig_ri_rec.item_style,
3794 p_object_attribute_flag =>l_orig_ri_rec.object_attribute_flag,
3795 p_icx_custom_call => l_orig_ri_rec.icx_custom_call,
3796 p_update_flag => l_orig_ri_rec.update_flag,
3797 p_required_flag => l_orig_ri_rec.required_flag,
3798 p_security_code => l_orig_ri_rec.security_code,
3799 p_default_value_varchar2 => l_orig_ri_rec.default_value_varchar2,
3800 p_default_value_number => l_orig_ri_rec.default_value_number,
3801 p_default_value_date => l_orig_ri_rec.default_value_date,
3802 p_lov_region_application_id => l_orig_ri_rec.lov_region_application_id,
3803 p_lov_region_code => l_orig_ri_rec.lov_region_code,
3804 p_lov_foreign_key_name => l_orig_ri_rec.lov_foreign_key_name,
3805 p_lov_attribute_application_id => l_orig_ri_rec.lov_attribute_application_id,
3806 p_lov_attribute_code => l_orig_ri_rec.lov_attribute_code,
3807 p_lov_default_flag => l_orig_ri_rec.lov_default_flag,
3808 p_region_defaulting_api_pkg => l_orig_ri_rec.region_defaulting_api_pkg,
3809 p_region_defaulting_api_proc => l_orig_ri_rec.region_defaulting_api_proc,
3810 p_region_validation_api_pkg => l_orig_ri_rec.region_validation_api_pkg,
3811 p_region_validation_api_proc => l_orig_ri_rec.region_validation_api_proc,
3812 p_order_sequence => l_orig_ri_rec.order_sequence,
3813 p_order_direction => l_orig_ri_rec.order_direction,
3814 p_display_height => l_orig_ri_rec.display_height,
3815 p_submit => l_orig_ri_rec.submit,
3816 p_encrypt => l_orig_ri_rec.encrypt,
3817 p_css_class_name => l_orig_ri_rec.css_class_name,
3818 p_view_usage_name =>l_orig_ri_rec.view_usage_name,
3819 p_view_attribute_name =>l_orig_ri_rec.view_attribute_name,
3820 p_nested_region_appl_id =>l_orig_ri_rec.nested_region_application_id,
3821 p_nested_region_code =>l_orig_ri_rec.nested_region_code,
3822 p_url =>l_orig_ri_rec.url,
3823 p_poplist_viewobject =>l_orig_ri_rec.poplist_viewobject,
3824 p_poplist_display_attr =>l_orig_ri_rec.poplist_display_attribute,
3825 p_poplist_value_attr =>l_orig_ri_rec.poplist_value_attribute,
3826 p_image_file_name =>l_orig_ri_rec.image_file_name,
3827 p_item_name => l_orig_ri_rec.item_name,
3828 p_css_label_class_name => l_orig_ri_rec.css_label_class_name,
3829 p_menu_name => l_orig_ri_rec.menu_name,
3830 p_flexfield_name => l_orig_ri_rec.flexfield_name,
3831 p_flexfield_application_id => l_orig_ri_rec.flexfield_application_id,
3832 p_tabular_function_code => l_orig_ri_rec.tabular_function_code,
3833 p_tip_type => l_orig_ri_rec.tip_type,
3834 p_tip_message_name => l_orig_ri_rec.tip_message_name,
3835 p_tip_message_application_id => l_orig_ri_rec.tip_message_application_id ,
3836 p_flex_segment_list => l_orig_ri_rec.flex_segment_list,
3837 p_entity_id => l_orig_ri_rec.entity_id,
3838 p_anchor => l_orig_ri_rec.anchor,
3839 p_poplist_view_usage_name => l_orig_ri_rec.poplist_view_usage_name,
3840 p_user_customizable => l_orig_ri_rec.user_customizable,
3841 p_sortby_view_attribute_name => l_orig_ri_rec.sortby_view_attribute_name,
3842 p_admin_customizable => l_orig_ri_rec.admin_customizable,
3843 p_invoke_function_name => l_orig_ri_rec.invoke_function_name,
3844 p_expansion => l_orig_ri_rec.expansion,
3845 p_als_max_length => l_orig_ri_rec.als_max_length,
3846 p_initial_sort_sequence => l_orig_ri_rec.initial_sort_sequence,
3847 p_customization_application_id => l_orig_ri_rec.customization_application_id,
3848 p_customization_code => l_orig_ri_rec.customization_code,
3849 p_attribute_category => l_orig_ri_rec.attribute_category,
3850 p_attribute1 => l_orig_ri_rec.attribute1,
3851 p_attribute2 => l_orig_ri_rec.attribute2,
3852 p_attribute3 => l_orig_ri_rec.attribute3,
3853 p_attribute4 => l_orig_ri_rec.attribute4,
3854 p_attribute5 => l_orig_ri_rec.attribute5,
3855 p_attribute6 => l_orig_ri_rec.attribute6,
3856 p_attribute7 => l_orig_ri_rec.attribute7,
3857 p_attribute8 => l_orig_ri_rec.attribute8,
3858 p_attribute9 => l_orig_ri_rec.attribute9,
3859 p_attribute10 => l_orig_ri_rec.attribute10,
3860 p_attribute11 => l_orig_ri_rec.attribute11,
3861 p_attribute12 => l_orig_ri_rec.attribute12,
3862 p_attribute13 => l_orig_ri_rec.attribute13,
3863 p_attribute14 => l_orig_ri_rec.attribute14,
3864 p_attribute15 => l_orig_ri_rec.attribute15,
3865 p_attribute_label_long => l_ri_tl_rec.attribute_label_long,
3866 p_attribute_label_short =>l_ri_tl_rec.attribute_label_short,
3867 p_description => l_ri_tl_rec.description,
3868 p_created_by => l_ri_tl_rec.created_by,
3869 p_creation_date => l_ri_tl_rec.creation_date,
3870 p_last_updated_by => l_ri_tl_rec.last_updated_by,
3871 p_last_update_date => l_ri_tl_rec.last_update_date,
3872 p_last_update_login => l_ri_tl_rec.last_update_login,
3873 p_pass => p_pass,
3874 p_copy_redo_flag => p_copy_redo_flag
3875 );
3876 end if;
3877 end if;
3878
3879 p_return_status := l_return_status;
3880 close l_ri_csr;
3881
3882 EXCEPTION
3883 WHEN FND_API.G_EXC_ERROR THEN
3884 p_return_status := FND_API.G_RET_STS_ERROR;
3885 WHEN OTHERS THEN
3886 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3887 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
3888 SUBSTR (SQLERRM, 1, 240) );
3889 FND_MSG_PUB.Add;
3890
3891 end CHECK_DISPLAY_SEQUENCE;
3892
3893 /*
3894 --=======================================================
3895 -- Function GRAPH_COLUMN_EXISTS
3896 --
3897 -- Usage Private API for checking for the existence of
3898 -- a region graph column with the given key values. This
3899 -- API should only be called by other APIs that are
3900 -- owned by the Core Modules Team (AK).
3901 --
3902 -- Desc This API check to see if a region graph column record
3903 -- exists with the given key values.
3904 --
3905 -- Results The API returns the standard p_return_status parameter
3906 -- indicating one of the standard return statuses :
3907 -- * Unexpected error
3908 -- * Error
3909 -- * Success
3910 -- This function will return TRUE if such an object
3911 -- attribute exists, or FALSE otherwise.
3912 -- Parameters Region Graph Column key columns
3913 --
3914 -- Version Initial version number = 1.0
3915 -- History Current version number = 1.0
3916 --=======================================================
3917 FUNCTION GRAPH_COLUMN_EXISTS (
3918 p_api_version_number IN NUMBER,
3919 p_return_status OUT NOCOPY VARCHAR2,
3920 p_region_application_id IN NUMBER,
3921 p_region_code IN VARCHAR2,
3922 p_attribute_application_id IN NUMBER,
3923 p_attribute_code IN VARCHAR2,
3924 p_graph_number IN NUMBER
3925 ) return boolean is
3926 cursor l_check_graph_column_csr is
3927 select 1
3928 from AK_REGION_GRAPH_COLUMNS
3929 where region_application_id = p_region_application_id
3930 and region_code = p_region_code
3931 and attribute_application_id = p_attribute_application_id
3932 and attribute_code = p_attribute_code
3933 and graph_number = p_graph_number;
3934
3935 l_api_version_number CONSTANT number := 1.0;
3936 l_api_name CONSTANT varchar2(30) := 'Graph_Column_Exists';
3937 l_dummy number;
3938 begin
3939 IF NOT FND_API.Compatible_API_Call (
3940 l_api_version_number, p_api_version_number, l_api_name,
3941 G_PKG_NAME) then
3942 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3943 return FALSE;
3944 END IF;
3945
3946 open l_check_graph_column_csr;
3947 fetch l_check_graph_column_csr into l_dummy;
3948 if (l_check_graph_column_csr%notfound) then
3949 close l_check_graph_column_csr;
3950 p_return_status := FND_API.G_RET_STS_SUCCESS;
3951 return FALSE;
3952 else
3953 close l_check_graph_column_csr;
3954 p_return_status := FND_API.G_RET_STS_SUCCESS;
3955 return TRUE;
3956 end if;
3957
3958 EXCEPTION
3959 WHEN FND_API.G_EXC_ERROR THEN
3960 p_return_status := FND_API.G_RET_STS_ERROR;
3961 return FALSE;
3962 WHEN OTHERS THEN
3963 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3964 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
3965 SUBSTR (SQLERRM, 1, 240) );
3966 FND_MSG_PUB.Add;
3967 return FALSE;
3968 end GRAPH_COLUMN_EXISTS;
3969 */
3970
3971 --=======================================================
3972 -- Function LOV_RELATION_EXISTS
3973 --
3974 -- Usage Private API for checking for the existence of
3975 -- a region lov relation with the given key values. This
3976 -- API should only be called by other APIs that are
3977 -- owned by the Core Modules Team (AK).
3978 --
3979 -- Desc This API check to see if a region lov relation record
3980 -- exists with the given key values.
3981 --
3982 -- Results The API returns the standard p_return_status parameter
3983 -- indicating one of the standard return statuses :
3984 -- * Unexpected error
3985 -- * Error
3986 -- * Success
3987 -- This function will return TRUE if such an object
3988 -- attribute exists, or FALSE otherwise.
3989 -- Parameters Region Lov Relation key columns
3990 --
3991 -- Version Initial version number = 1.0
3992 -- History Current version number = 1.0
3993 --=======================================================
3994 FUNCTION LOV_RELATION_EXISTS (
3995 p_api_version_number IN NUMBER,
3996 p_return_status OUT NOCOPY VARCHAR2,
3997 p_region_application_id IN NUMBER,
3998 p_region_code IN VARCHAR2,
3999 p_attribute_application_id IN NUMBER,
4000 p_attribute_code IN VARCHAR2,
4001 p_lov_region_appl_id IN NUMBER,
4002 p_lov_region_code IN VARCHAR2,
4003 p_lov_attribute_appl_id IN NUMBER,
4004 p_lov_attribute_code IN VARCHAR2,
4005 p_base_attribute_appl_id IN NUMBER,
4006 p_base_attribute_code IN VARCHAR2,
4007 p_direction_flag IN VARCHAR2,
4008 p_base_region_appl_id IN NUMBER,
4009 p_base_region_code IN VARCHAR2
4010 ) return boolean is
4011 cursor l_check_lov_relation_csr is
4012 select 1
4013 from AK_REGION_LOV_RELATIONS
4014 where region_application_id = p_region_application_id
4015 and region_code = p_region_code
4016 and attribute_application_id = p_attribute_application_id
4017 and attribute_code = p_attribute_code
4018 and lov_region_appl_id = p_lov_region_appl_id
4019 and lov_region_code = p_lov_region_code
4020 and lov_attribute_appl_id = p_lov_attribute_appl_id
4021 and lov_attribute_code = p_lov_attribute_code
4022 and base_attribute_appl_id = p_base_attribute_appl_id
4023 and base_attribute_code = p_base_attribute_code
4024 and direction_flag = p_direction_flag
4025 and base_region_appl_id = p_base_region_appl_id
4026 and base_region_code = p_base_region_code;
4027
4028 l_api_version_number CONSTANT number := 1.0;
4029 l_api_name CONSTANT varchar2(30) := 'Lov_Relation_Exists';
4030 l_dummy number;
4031 begin
4032 IF NOT FND_API.Compatible_API_Call (
4033 l_api_version_number, p_api_version_number, l_api_name,
4034 G_PKG_NAME) then
4035 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4036 return FALSE;
4037 END IF;
4038
4039 open l_check_lov_relation_csr;
4040 fetch l_check_lov_relation_csr into l_dummy;
4041 if (l_check_lov_relation_csr%notfound) then
4042 close l_check_lov_relation_csr;
4043 p_return_status := FND_API.G_RET_STS_SUCCESS;
4044 return FALSE;
4045 else
4046 close l_check_lov_relation_csr;
4047 p_return_status := FND_API.G_RET_STS_SUCCESS;
4048 return TRUE;
4049 end if;
4050
4051 EXCEPTION
4052 WHEN FND_API.G_EXC_ERROR THEN
4053 p_return_status := FND_API.G_RET_STS_ERROR;
4054 return FALSE;
4055 WHEN OTHERS THEN
4056 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4057 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
4058 SUBSTR (SQLERRM, 1, 240) );
4059 FND_MSG_PUB.Add;
4060 return FALSE;
4061 end LOV_RELATION_EXISTS;
4062
4063 /*
4064 --=======================================================
4065 -- Function VALIDATE_GRAPH_COLUMN
4066 --
4067 -- Usage Private API for validating a region graph column. This
4068 -- API should only be called by other APIs that are
4069 -- owned by the Core Modules Team (AK).
4070 --
4071 -- Desc Perform validation on a region graph column record.
4072 --
4073 -- Results The API returns the standard p_return_status parameter
4074 -- indicating one of the standard return statuses :
4075 -- * Unexpected error
4076 -- * Error
4077 -- * Success
4078 -- In addition, this function returns TRUE if all
4079 -- validation tests are passed, or FALSE otherwise.
4080 -- Parameters Region graph column columns
4081 -- p_caller : IN required
4082 -- Must be one of the following values defined
4083 -- in package AK_ON_OBJECTS_PVT:
4084 -- - G_CREATE (if calling from the Create API)
4085 -- - G_DOWNLOAD (if calling from the Download API)
4086 -- - G_UPDATE (if calling from the Update API)
4087 --
4088 -- Note This API is intended for performing record-level
4089 -- validation. It is not designed for item-level
4090 -- validation.
4091 --
4092 -- Version Initial version number = 1.1
4093 --=======================================================
4094 FUNCTION VALIDATE_GRAPH_COLUMN (
4095 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4096 p_api_version_number IN NUMBER,
4097 p_return_status OUT NOCOPY VARCHAR2,
4098 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
4099 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4100 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
4101 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4102 p_graph_number IN NUMBER := FND_API.G_MISS_NUM,
4103 p_pass IN NUMBER := 2,
4104 p_caller IN VARCHAR2
4105 ) return boolean is
4106 cursor l_check_region_graph_csr (param_region_code in varchar2,
4107 param_region_appl_id in number, param_graph_number in number) is
4108 select 1
4109 from AK_REGION_GRAPHS
4110 where region_application_id = param_region_appl_id
4111 and region_code = param_region_code
4112 and graph_number = param_graph_number;
4113
4114 cursor l_check_region_item_csr (param_region_code in varchar2,
4115 param_region_appl_id in number, param_attr_appl_id in number,
4116 param_attr_code in varchar2) is
4117 select 1
4118 from AK_REGION_ITEMS
4119 where region_application_id = param_region_appl_id
4120 and region_code = param_region_code
4121 and attribute_application_id = param_attr_appl_id
4122 and attribute_code = param_attr_code;
4123
4124 l_api_version_number CONSTANT number := 1.0;
4125 l_api_name CONSTANT varchar2(30) := 'validate_graph_column';
4126
4127 l_dummy NUMBER;
4128 l_error BOOLEAN;
4129 l_return_status VARCHAR2(1);
4130 begin
4131
4132 IF NOT FND_API.Compatible_API_Call (
4133 l_api_version_number, p_api_version_number, l_api_name,
4134 G_PKG_NAME) then
4135 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4136 return FALSE;
4137 END IF;
4138
4139 l_error := FALSE;
4140
4141 --** if validation level is none, no validation is necessary
4142 if (p_validation_level = FND_API.G_VALID_LEVEL_NONE) then
4143 p_return_status := FND_API.G_RET_STS_SUCCESS;
4144 return TRUE;
4145 end if;
4146
4147 --** check that key columns are not null and not missing **
4148 if ((p_region_application_id is null) or
4149 (p_region_application_id = FND_API.G_MISS_NUM)) then
4150 l_error := TRUE;
4151 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4152 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4153 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_APPLICATION_ID');
4154 FND_MSG_PUB.Add;
4155 end if;
4156 end if;
4157
4158 if ((p_region_code is null) or
4159 (p_region_code = FND_API.G_MISS_CHAR)) then
4160 l_error := TRUE;
4161 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4162 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4163 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_CODE');
4164 FND_MSG_PUB.Add;
4165 end if;
4166 end if;
4167
4168 if ((p_attribute_application_id is null) or
4169 (p_attribute_application_id = FND_API.G_MISS_NUM)) then
4170 l_error := TRUE;
4171 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4172 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4173 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_APPLICATION_ID');
4174 FND_MSG_PUB.Add;
4175 end if;
4176 end if;
4177
4178 if ((p_attribute_code is null) or
4179 (p_attribute_code = FND_API.G_MISS_CHAR)) then
4180 l_error := TRUE;
4181 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4182 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4183 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_CODE');
4184 FND_MSG_PUB.Add;
4185 end if;
4186 end if;
4187
4188 if ((p_graph_number is null) or
4189 (p_graph_number = FND_API.G_MISS_NUM)) then
4190 l_error := TRUE;
4191 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4192 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4193 FND_MESSAGE.SET_TOKEN('COLUMN', 'GRAPH_NUMBER');
4194 FND_MSG_PUB.Add;
4195 end if;
4196 end if;
4197
4198 -- - Check that the parent region item exists
4199 open l_check_region_item_csr(p_region_code, p_region_application_id, p_attribute_application_id, p_attribute_code);
4200 fetch l_check_region_item_csr into l_dummy;
4201 if (l_check_region_item_csr%notfound) then
4202 l_error := TRUE;
4203 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4204 FND_MESSAGE.SET_NAME('AK','AK_INVALID_REG_ITEM_REFERENCE');
4205 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
4206 ' ' || p_region_code ||' '||
4207 to_char(p_attribute_application_id) || ' '||
4208 p_attribute_code);
4209 FND_MSG_PUB.Add;
4210 end if;
4211 end if;
4212 close l_check_region_item_csr;
4213
4214 -- - Check that the parent region graph exists
4215 open l_check_region_graph_csr(p_region_code, p_region_application_id, p_graph_number);
4216 fetch l_check_Region_graph_csr into l_dummy;
4217 if (l_check_region_graph_csr%notfound) then
4218 l_error := TRUE;
4219 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4220 FND_MESSAGE.SET_NAME('AK','AK_INVALID_REG_GRAPH_REFERENCE');
4221 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
4222 ' ' || p_region_code ||' '||
4223 p_graph_number);
4224 FND_MSG_PUB.Add;
4225 end if;
4226 end if;
4227 close l_check_region_graph_csr;
4228
4229 -- return true if no error, false otherwise
4230 p_return_status := FND_API.G_RET_STS_SUCCESS;
4231 return (not l_error);
4232
4233 EXCEPTION
4234 WHEN FND_API.G_EXC_ERROR THEN
4235 p_return_status := FND_API.G_RET_STS_ERROR;
4236 return FALSE;
4237 WHEN OTHERS THEN
4238 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4239 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
4240 SUBSTR (SQLERRM, 1, 240) );
4241 FND_MSG_PUB.Add;
4242 return FALSE;
4243
4244 end VALIDATE_GRAPH_COLUMN;
4245 */
4246
4247 --=======================================================
4248 -- Function VALIDATE_LOV_RELATION
4249 --
4250 -- Usage Private API for validating a region lov relation. This
4251 -- API should only be called by other APIs that are
4252 -- owned by the Core Modules Team (AK).
4253 --
4254 -- Desc Perform validation on a region lov relation record.
4255 --
4256 -- Results The API returns the standard p_return_status parameter
4257 -- indicating one of the standard return statuses :
4258 -- * Unexpected error
4259 -- * Error
4260 -- * Success
4261 -- In addition, this function returns TRUE if all
4262 -- validation tests are passed, or FALSE otherwise.
4263 -- Parameters Region lov relation columns
4264 -- p_caller : IN required
4265 -- Must be one of the following values defined
4266 -- in package AK_ON_OBJECTS_PVT:
4267 -- - G_CREATE (if calling from the Create API)
4268 -- - G_DOWNLOAD (if calling from the Download API)
4269 -- - G_UPDATE (if calling from the Update API)
4270 --
4271 -- Note This API is intended for performing record-level
4272 -- validation. It is not designed for item-level
4273 -- validation.
4274 --
4275 -- Version Initial version number = 1.1
4276 --=======================================================
4277 FUNCTION VALIDATE_LOV_RELATION (
4278 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4279 p_api_version_number IN NUMBER,
4280 p_return_status OUT NOCOPY VARCHAR2,
4281 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
4282 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4283 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
4284 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4285 p_lov_region_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4286 p_lov_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4287 p_lov_attribute_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4288 p_lov_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4289 p_base_attribute_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4290 p_base_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4291 p_direction_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
4292 p_base_region_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4293 p_base_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4294 p_caller IN VARCHAR2,
4295 p_pass IN NUMBER := 2
4296 ) return boolean is
4297 cursor l_check_region_csr (param_region_code in varchar2, param_region_appl_id in number) is
4298 select 1
4299 from AK_REGIONS
4300 where region_application_id = param_region_appl_id
4301 and region_code = param_region_code;
4302
4303 cursor l_check_region_item_csr (param_region_code in varchar2, param_region_appl_id in number,
4304 param_attr_code in varchar2, param_attr_appl_id number) is
4305 select 1
4306 from AK_REGION_ITEMS
4307 where region_application_id = param_region_appl_id
4308 and region_code = param_region_code
4309 and attribute_application_id = param_attr_appl_id;
4310
4311 l_api_version_number CONSTANT number := 1.0;
4312 l_api_name CONSTANT varchar2(30) := 'validate_lov_relation';
4313
4314 l_dummy NUMBER;
4315 l_error BOOLEAN;
4316 l_return_status VARCHAR2(1);
4317 begin
4318
4319 IF NOT FND_API.Compatible_API_Call (
4320 l_api_version_number, p_api_version_number, l_api_name,
4321 G_PKG_NAME) then
4322 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4323 return FALSE;
4324 END IF;
4325
4326 l_error := FALSE;
4327
4328 --** if validation level is none, no validation is necessary
4329 if (p_validation_level = FND_API.G_VALID_LEVEL_NONE) then
4330 p_return_status := FND_API.G_RET_STS_SUCCESS;
4331 return TRUE;
4332 end if;
4333
4334 --** check that key columns are not null and not missing **
4335 if ((p_region_application_id is null) or
4336 (p_region_application_id = FND_API.G_MISS_NUM)) then
4337 l_error := TRUE;
4338 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4339 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4340 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_APPLICATION_ID');
4341 FND_MSG_PUB.Add;
4342 end if;
4343 end if;
4344
4345 if ((p_region_code is null) or
4346 (p_region_code = FND_API.G_MISS_CHAR)) then
4347 l_error := TRUE;
4348 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4349 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4350 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_CODE');
4351 FND_MSG_PUB.Add;
4352 end if;
4353 end if;
4354
4355 if ((p_attribute_application_id is null) or
4356 (p_attribute_application_id = FND_API.G_MISS_NUM)) then
4357 l_error := TRUE;
4358 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4359 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4360 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_APPLICATION_ID');
4361 FND_MSG_PUB.Add;
4362 end if;
4363 end if;
4364
4365 if ((p_attribute_code is null) or
4366 (p_attribute_code = FND_API.G_MISS_CHAR)) then
4367 l_error := TRUE;
4368 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4369 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4370 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_CODE');
4371 FND_MSG_PUB.Add;
4372 end if;
4373 end if;
4374
4375 if ((p_lov_region_appl_id is null) or
4376 (p_lov_region_appl_id = FND_API.G_MISS_NUM)) then
4377 l_error := TRUE;
4378 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4379 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4380 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_APPLICATION_ID');
4381 FND_MSG_PUB.Add;
4382 end if;
4383 end if;
4384
4385 if ((p_lov_region_code is null) or
4386 (p_lov_region_code = FND_API.G_MISS_CHAR)) then
4387 l_error := TRUE;
4388 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4389 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4390 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_CODE');
4391 FND_MSG_PUB.Add;
4392 end if;
4393 end if;
4394
4395 if ((p_lov_attribute_appl_id is null) or
4396 (p_lov_attribute_appl_id = FND_API.G_MISS_NUM)) then
4397 l_error := TRUE;
4398 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4399 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4400 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_APPLICATION_ID');
4401 FND_MSG_PUB.Add;
4402 end if;
4403 end if;
4404
4405 if ((p_lov_attribute_code is null) or
4406 (p_lov_attribute_code = FND_API.G_MISS_CHAR)) then
4407 l_error := TRUE;
4408 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4409 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4410 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_CODE');
4411 FND_MSG_PUB.Add;
4412 end if;
4413 end if;
4414
4415 -- do not raise an error for now, there are ppl who has an old jlt file and upload
4416 -- it manually to a database which contains this patch
4417 /**
4418 if ((p_base_region_appl_id is null) or
4419 (p_base_region_appl_id = FND_API.G_MISS_NUM)) then
4420
4421 l_error := TRUE;
4422 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4423 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4424 FND_MESSAGE.SET_TOKEN('COLUMN', 'BASE_REGION_APPL_ID');
4425 FND_MSG_PUB.Add;
4426 end if;
4427 end if;
4428 **/
4429
4430 -- do not raise an error for now, there are ppl who has an old jlt file and upload
4431 -- it manually to a database which contains this patch
4432 /**
4433 if ((p_base_region_code is null) or
4434 (p_base_region_code = FND_API.G_MISS_CHAR)) then
4435 l_error := TRUE;
4436 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4437 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4438 FND_MESSAGE.SET_TOKEN('COLUMN', 'BASE_REGION_CODE');
4439 FND_MSG_PUB.Add;
4440 end if;
4441 end if;
4442 **/
4443
4444 -- these two columns are not part of primary key but cannot be null
4445 --
4446 if ((p_base_attribute_appl_id is null) or
4447 (p_base_attribute_appl_id = FND_API.G_MISS_NUM)) then
4448 l_error := TRUE;
4449 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4450 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4451 FND_MESSAGE.SET_TOKEN('COLUMN', 'BASE_ATTRIBUTE_APPL_ID');
4452 FND_MSG_PUB.Add;
4453 end if;
4454 end if;
4455
4456 if ((p_base_attribute_code is null) or
4457 (p_base_attribute_code = FND_API.G_MISS_CHAR)) then
4458 l_error := TRUE;
4459 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4460 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4461 FND_MESSAGE.SET_TOKEN('COLUMN', 'BASE_ATTRIBUTE_CODE');
4462 FND_MSG_PUB.Add;
4463 end if;
4464 end if;
4465
4466 -- - Check that the parent region item exists
4467 open l_check_region_item_csr(p_region_code, p_region_application_id,
4468 p_attribute_code, p_attribute_application_id);
4469 fetch l_check_region_item_csr into l_dummy;
4470 if (l_check_region_item_csr%notfound) then
4471 l_error := TRUE;
4472 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4473 FND_MESSAGE.SET_NAME('AK','AK_INVALID_REG_ITEM_REFERENCE');
4474 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
4475 ' ' || p_region_code ||' '||
4476 to_char(p_attribute_application_id)||' '||p_attribute_code);
4477 FND_MSG_PUB.Add;
4478 end if;
4479 end if;
4480 close l_check_region_item_csr;
4481
4482 -- - Check that the lov region exists
4483 open l_check_region_csr(p_lov_region_code, p_lov_region_appl_id);
4484 fetch l_check_region_csr into l_dummy;
4485 if (l_check_region_csr%notfound) then
4486 l_error := TRUE;
4487 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4488 FND_MESSAGE.SET_NAME('AK','AK_INVALID_LOV_REG_REFERENCE');
4489 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_lov_region_appl_id) ||
4490 ' ' || p_lov_region_code );
4491 FND_MSG_PUB.Add;
4492 end if;
4493 end if;
4494 close l_check_region_csr;
4495
4496 -- - Check that the lov region item exists
4497 open l_check_region_item_csr(p_lov_region_code, p_lov_region_appl_id,
4498 p_lov_attribute_code, p_lov_attribute_appl_id);
4499 fetch l_check_region_item_csr into l_dummy;
4500 if (l_check_region_item_csr%notfound) then
4501 l_error := TRUE;
4502 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4503 FND_MESSAGE.SET_NAME('AK','AK_INVALID_LOV_ITEM_REFERENCE');
4504 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_lov_region_appl_id) ||
4505 ' ' || p_lov_region_code ||' '||
4506 to_char(p_lov_attribute_appl_id)||' '||p_lov_attribute_code);
4507 FND_MSG_PUB.Add;
4508 end if;
4509 end if;
4510 close l_check_region_item_csr;
4511
4512 -- - Check that the base region item exists
4513 open l_check_region_item_csr(p_base_region_code, p_base_region_appl_id,
4514 p_base_attribute_code, p_base_attribute_appl_id);
4515 fetch l_check_region_item_csr into l_dummy;
4516 if (l_check_region_item_csr%notfound) then
4517 l_error := TRUE;
4518 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4519 FND_MESSAGE.SET_NAME('AK','AK_INVALID_BASE_ITEM_REF');
4520 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_lov_region_appl_id) ||
4521 ' ' || p_lov_region_code ||' '||
4522 to_char(p_base_attribute_appl_id)||' '||p_base_attribute_code);
4523 FND_MSG_PUB.Add;
4524 end if;
4525 end if;
4526 close l_check_region_item_csr;
4527
4528 -- direction_flag
4529 if ( (p_direction_flag <> FND_API.G_MISS_CHAR) and
4530 (p_direction_flag is not null) )then
4531 if (NOT AK_ON_OBJECTS_PVT.VALID_LOOKUP_CODE (
4532 p_api_version_number => 1.0,
4533 p_return_status => l_return_status,
4534 p_lookup_type => 'LOV_DIRECTION',
4535 p_lookup_code => p_direction_flag)) then
4536 l_error := TRUE;
4537 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4538 FND_MESSAGE.SET_NAME('AK','AK_INVALID_COLUMN_VALUE');
4539 FND_MESSAGE.SET_TOKEN('COLUMN','DIRECTION_FLAG');
4540 FND_MSG_PUB.Add;
4541 end if;
4542 end if;
4543 else
4544 l_error := TRUE;
4545 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
4546 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
4547 FND_MESSAGE.SET_TOKEN('COLUMN', 'DIRECTION_FLAG');
4548 FND_MSG_PUB.Add;
4549 end if;
4550 end if;
4551
4552 -- return true if no error, false otherwise
4553 p_return_status := FND_API.G_RET_STS_SUCCESS;
4554 return (not l_error);
4555
4556 EXCEPTION
4557 WHEN FND_API.G_EXC_ERROR THEN
4558 p_return_status := FND_API.G_RET_STS_ERROR;
4559 return FALSE;
4560 WHEN OTHERS THEN
4561 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4562 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
4563 SUBSTR (SQLERRM, 1, 240) );
4564 FND_MSG_PUB.Add;
4565 return FALSE;
4566
4567 end VALIDATE_LOV_RELATION;
4568
4569 /*
4570 --=======================================================
4571 -- Procedure CREATE_GRAPH_COLUMN
4572 --
4573 -- Usage Private API for creating a region graph column. This
4574 -- API should only be called by other APIs that are
4575 -- owned by the Core Modules Team (AK).
4576 --
4577 -- Desc Creates a region graph column using the given info.
4578 -- This API should only be called by other APIs that are
4579 -- owned by the Core Modules Team (AK).
4580 --
4581 -- Results The API returns the standard p_return_status parameter
4582 -- indicating one of the standard return statuses :
4583 -- * Unexpected error
4584 -- * Error
4585 -- * Success
4586 -- Parameters Region columns
4587 -- p_loader_timestamp : IN optional
4588 -- If a timestamp is passed, the API will create the
4589 -- record using this timestamp. Only the upload API
4590 -- should call with this parameter loaded.
4591 --
4592 -- Version Initial version number = 1.1
4593 --=======================================================
4594 PROCEDURE CREATE_GRAPH_COLUMN (
4595 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4596 p_api_version_number IN NUMBER,
4597 p_init_msg_tbl IN BOOLEAN := FALSE,
4598 p_msg_count OUT NOCOPY NUMBER,
4599 p_msg_data OUT NOCOPY VARCHAR2,
4600 p_return_status OUT NOCOPY VARCHAR2,
4601 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
4602 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4603 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
4604 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4605 p_graph_number IN NUMBER := FND_API.G_MISS_NUM,
4606 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
4607 p_creation_date IN DATE := FND_API.G_MISS_DATE,
4608 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
4609 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
4610 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
4611 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
4612 p_pass IN NUMBER,
4613 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
4614 ) is
4615
4616 l_api_version_number CONSTANT number := 1.0;
4617 l_api_name CONSTANT varchar2(30) := 'Create_Graph_Column';
4618 l_created_by number;
4619 l_creation_date date;
4620 l_last_update_date date;
4621 l_last_update_login number;
4622 l_last_updated_by number;
4623 l_return_status varchar2(1);
4624
4625 begin
4626
4627 IF NOT FND_API.Compatible_API_Call (
4628 l_api_version_number, p_api_version_number, l_api_name,
4629 G_PKG_NAME) then
4630 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4631 return;
4632 END IF;
4633
4634 -- Initialize the message table if requested.
4635
4636 if p_init_msg_tbl then
4637 FND_MSG_PUB.initialize;
4638 end if;
4639
4640 savepoint start_create_graph_column;
4641
4642 --** check to see if row already exists **
4643 if AK_REGION2_PVT.GRAPH_COLUMN_EXISTS (
4644 p_api_version_number => 1.0,
4645 p_return_status => l_return_status,
4646 p_region_application_id => p_region_application_id,
4647 p_region_code => p_region_code,
4648 p_attribute_application_id => p_attribute_application_id,
4649 p_attribute_code => p_attribute_code,
4650 p_graph_number => p_graph_number) then
4651 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
4652 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_EXISTS');
4653 FND_MSG_PUB.Add;
4654 end if;
4655 raise FND_API.G_EXC_ERROR;
4656 end if;
4657
4658 --** validate table columns passed in **
4659 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
4660 if not AK_REGION2_PVT.VALIDATE_GRAPH_COLUMN (
4661 p_validation_level => p_validation_level,
4662 p_api_version_number => 1.0,
4663 p_return_status => l_return_status,
4664 p_region_application_id => p_region_application_id,
4665 p_region_code => p_region_code,
4666 p_attribute_application_id => p_attribute_application_id,
4667 p_attribute_code => p_attribute_code,
4668 p_graph_number => p_graph_number,
4669 p_caller => AK_ON_OBJECTS_PVT.G_CREATE,
4670 p_pass => p_pass
4671 ) then
4672 -- Do not raise an error if it's the first pass
4673 if (p_pass = 1) then
4674 p_copy_redo_flag := TRUE;
4675 else
4676 raise FND_API.G_EXC_ERROR;
4677 end if;
4678 end if;
4679 end if;
4680
4681 -- Create record if no validation error was found
4682
4683 -- Set WHO columns
4684 AK_UPLOAD_GRP.G_UPLOAD_DATE := p_last_update_date;
4685 AK_ON_OBJECTS_PVT.SET_WHO (
4686 p_return_status => l_return_status,
4687 p_loader_timestamp => p_loader_timestamp,
4688 p_created_by => l_created_by,
4689 p_creation_date => l_creation_date,
4690 p_last_updated_by => l_last_updated_by,
4691 p_last_update_date => l_last_update_date,
4692 p_last_update_login => l_last_update_login);
4693
4694 if (AK_UPLOAD_GRP.G_NON_SEED_DATA) then
4695 l_created_by := p_created_by;
4696 l_last_updated_by := p_last_updated_by;
4697 l_last_update_login := p_last_update_login;
4698 end if;
4699
4700 insert into AK_REGION_GRAPH_COLUMNS (
4701 REGION_APPLICATION_ID,
4702 REGION_CODE,
4703 ATTRIBUTE_APPLICATION_ID,
4704 ATTRIBUTE_CODE,
4705 GRAPH_NUMBER,
4706 CREATION_DATE,
4707 CREATED_BY,
4708 LAST_UPDATE_DATE,
4709 LAST_UPDATED_BY,
4710 LAST_UPDATE_LOGIN
4711 ) values (
4712 p_region_application_id,
4713 p_region_code,
4714 p_attribute_application_id,
4715 p_attribute_code,
4716 p_graph_number,
4717 l_creation_date,
4718 l_created_by,
4719 l_last_update_date,
4720 l_last_updated_by,
4721 l_last_update_login
4722 );
4723
4724 -- ** commit the insert **
4725 -- commit;
4726
4727 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
4728 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_CREATED');
4729 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' ' ||
4730 p_region_code||' '||
4731 to_char(p_attribute_application_id)||
4732 ' '||p_attribute_code||' '||
4733 to_char(p_graph_number));
4734 FND_MSG_PUB.Add;
4735 end if;
4736
4737 p_return_status := FND_API.G_RET_STS_SUCCESS;
4738
4739 FND_MSG_PUB.Count_And_Get (
4740 p_count => p_msg_count,
4741 p_data => p_msg_data);
4742
4743 EXCEPTION
4744 WHEN VALUE_ERROR THEN
4745 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
4746 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_VALUE_ERROR');
4747 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
4748 p_region_code||' '||
4749 to_char(p_attribute_application_id)||
4750 ' '||p_attribute_code||' '||
4751 to_char(p_graph_number));
4752 FND_MSG_PUB.Add;
4753 end if;
4754 p_return_status := FND_API.G_RET_STS_ERROR;
4755 rollback to start_create_graph_column;
4756 FND_MSG_PUB.Count_And_Get (
4757 p_count => p_msg_count,
4758 p_data => p_msg_data);
4759 WHEN OTHERS THEN
4760 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4761 rollback to start_create_graph_column;
4762 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
4763 SUBSTR (SQLERRM, 1, 240) );
4764 FND_MSG_PUB.Add;
4765 FND_MSG_PUB.Count_And_Get (
4766 p_count => p_msg_count,
4767 p_data => p_msg_data);
4768
4769 end CREATE_GRAPH_COLUMN;
4770 */
4771
4772 --=======================================================
4773 -- Procedure CREATE_LOV_RELATION
4774 --
4775 -- Usage Private API for creating a region lov relation. This
4776 -- API should only be called by other APIs that are
4777 -- owned by the Core Modules Team (AK).
4778 --
4779 -- Desc Creates a region lov relation using the given info.
4780 -- This API should only be called by other APIs that are
4781 -- owned by the Core Modules Team (AK).
4782 --
4783 -- Results The API returns the standard p_return_status parameter
4784 -- indicating one of the standard return statuses :
4785 -- * Unexpected error
4786 -- * Error
4787 -- * Success
4788 -- Parameters Region columns
4789 -- p_loader_timestamp : IN optional
4790 -- If a timestamp is passed, the API will create the
4791 -- record using this timestamp. Only the upload API
4792 -- should call with this parameter loaded.
4793 --
4794 -- Version Initial version number = 1.1
4795 --=======================================================
4796 PROCEDURE CREATE_LOV_RELATION (
4797 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4798 p_api_version_number IN NUMBER,
4799 p_init_msg_tbl IN BOOLEAN := FALSE,
4800 p_msg_count OUT NOCOPY NUMBER,
4801 p_msg_data OUT NOCOPY VARCHAR2,
4802 p_return_status OUT NOCOPY VARCHAR2,
4803 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
4804 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4805 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
4806 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4807 p_lov_region_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4808 p_lov_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4809 p_lov_attribute_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4810 p_lov_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4811 p_base_attribute_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4812 p_base_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4813 p_direction_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
4814 p_base_region_appl_id IN NUMBER := FND_API.G_MISS_NUM,
4815 p_base_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
4816 p_required_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
4817 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
4818 p_creation_date IN DATE := FND_API.G_MISS_DATE,
4819 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
4820 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
4821 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
4822 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
4823 p_pass IN NUMBER,
4824 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
4825 ) is
4826
4827 l_api_version_number CONSTANT number := 1.0;
4828 l_api_name CONSTANT varchar2(30) := 'Create_Lov_Relation';
4829 l_created_by number;
4830 l_creation_date date;
4831 l_direction_flag VARCHAR2(30) := null;
4832 l_required_flag VARCHAR2(1) := 'N';
4833 l_last_update_date date;
4834 l_last_update_login number;
4835 l_last_updated_by number;
4836 l_return_status varchar2(1);
4837
4838 begin
4839
4840 IF NOT FND_API.Compatible_API_Call (
4841 l_api_version_number, p_api_version_number, l_api_name,
4842 G_PKG_NAME) then
4843 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4844 return;
4845 END IF;
4846
4847 -- Initialize the message table if requested.
4848
4849 if p_init_msg_tbl then
4850 FND_MSG_PUB.initialize;
4851 end if;
4852
4853 savepoint start_create_lov_relation;
4854
4855 --** check to see if row already exists **
4856 if AK_REGION2_PVT.LOV_RELATION_EXISTS (
4857 p_api_version_number => 1.0,
4858 p_return_status => l_return_status,
4859 p_region_application_id => p_region_application_id,
4860 p_region_code => p_region_code,
4861 p_attribute_application_id => p_attribute_application_id,
4862 p_attribute_code => p_attribute_code,
4863 p_lov_region_appl_id => p_lov_region_appl_id,
4864 p_lov_region_code => p_lov_region_code,
4865 p_lov_attribute_appl_id => p_lov_attribute_appl_id,
4866 p_lov_attribute_code => p_lov_attribute_code,
4867 p_base_attribute_appl_id => p_base_attribute_appl_id,
4868 p_base_attribute_code => p_base_attribute_code,
4869 p_direction_flag => p_direction_flag,
4870 p_base_region_appl_id => p_base_region_appl_id,
4871 p_base_region_code => p_base_region_code) then
4872 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
4873 FND_MESSAGE.SET_NAME('AK','AK_LOV_RELATION_EXISTS');
4874 FND_MSG_PUB.Add;
4875 end if;
4876 raise FND_API.G_EXC_ERROR;
4877 end if;
4878
4879 --** validate table columns passed in **
4880 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
4881 if not AK_REGION2_PVT.VALIDATE_LOV_RELATION (
4882 p_validation_level => p_validation_level,
4883 p_api_version_number => 1.0,
4884 p_return_status => l_return_status,
4885 p_region_application_id => p_region_application_id,
4886 p_region_code => p_region_code,
4887 p_attribute_application_id => p_attribute_application_id,
4888 p_attribute_code => p_attribute_code,
4889 p_lov_region_appl_id => p_lov_region_appl_id,
4890 p_lov_region_code => p_lov_region_code,
4891 p_lov_attribute_appl_id => p_lov_attribute_appl_id,
4892 p_lov_attribute_code => p_lov_attribute_code,
4893 p_base_attribute_appl_id => p_base_attribute_appl_id,
4894 p_base_attribute_code => p_base_attribute_code,
4895 p_direction_flag => p_direction_flag,
4896 p_base_region_appl_id => p_base_region_appl_id,
4897 p_base_region_code => p_base_region_code,
4898 p_caller => AK_ON_OBJECTS_PVT.G_CREATE,
4899 p_pass => p_pass
4900 ) then
4901 -- Do not raise an error if it's the first pass
4902 if (p_pass = 1) then
4903 p_copy_redo_flag := TRUE;
4904 else
4905 raise FND_API.G_EXC_ERROR;
4906 end if;
4907 end if;
4908 end if;
4909
4910 -- Do not insert if fails validation ie. p_copy_redo_flag = true
4911 if (not p_copy_redo_flag) then
4912
4913 -- default a value for required_flag column if no value is given
4914 if ( p_required_flag <> FND_API.G_MISS_CHAR and p_required_flag is not null ) then
4915 l_required_flag := p_required_flag;
4916 end if;
4917
4918 if (p_created_by <> FND_API.G_MISS_NUM) then
4919 l_created_by := p_created_by;
4920 end if;
4921
4922 if (p_creation_date <> FND_API.G_MISS_DATE) then
4923 l_creation_date := p_creation_date;
4924 end if;
4925
4926 if (p_last_updated_by <> FND_API.G_MISS_NUM) then
4927 l_last_updated_by := p_last_updated_by;
4928 end if;
4929
4930 if (p_last_update_date <> FND_API.G_MISS_DATE) then
4931 l_last_update_date := p_last_update_date;
4932 end if;
4933
4934 if (p_last_update_login <> FND_API.G_MISS_NUM) then
4935 l_last_update_login := p_last_update_login;
4936 end if;
4937
4938
4939 -- Create record if no validation error was found
4940 -- NOTE - Calling IS_UPDATEABLE for backward compatibility
4941 -- old jlt files didn't have who columns and IS_UPDATEABLE
4942 -- calls SET_WHO which populates those columns, for later
4943 -- jlt files IS_UPDATEABLE will always return TRUE for CREATE
4944
4945 if AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
4946 p_loader_timestamp => p_loader_timestamp,
4947 p_created_by => l_created_by,
4948 p_creation_date => l_creation_date,
4949 p_last_updated_by => l_last_updated_by,
4950 p_db_last_updated_by => null,
4951 p_last_update_date => l_last_update_date,
4952 p_db_last_update_date => null,
4953 p_last_update_login => l_last_update_login,
4954 p_create_or_update => 'CREATE') then
4955 null;
4956 end if;
4957
4958 insert into AK_REGION_LOV_RELATIONS (
4959 REGION_APPLICATION_ID,
4960 REGION_CODE,
4961 ATTRIBUTE_APPLICATION_ID,
4962 ATTRIBUTE_CODE,
4963 LOV_REGION_APPL_ID,
4964 LOV_REGION_CODE,
4965 LOV_ATTRIBUTE_APPL_ID,
4966 LOV_ATTRIBUTE_CODE,
4967 BASE_ATTRIBUTE_APPL_ID,
4968 BASE_ATTRIBUTE_CODE,
4969 DIRECTION_FLAG,
4970 BASE_REGION_APPL_ID,
4971 BASE_REGION_CODE,
4972 REQUIRED_FLAG,
4973 CREATION_DATE,
4974 CREATED_BY,
4975 LAST_UPDATE_DATE,
4976 LAST_UPDATED_BY,
4977 LAST_UPDATE_LOGIN
4978 ) values (
4979 p_region_application_id,
4980 p_region_code,
4981 p_attribute_application_id,
4982 p_attribute_code,
4983 p_lov_region_appl_id,
4984 p_lov_region_code,
4985 p_lov_attribute_appl_id,
4986 p_lov_attribute_code,
4987 p_base_attribute_appl_id,
4988 p_base_attribute_code,
4989 p_direction_flag,
4990 p_base_region_appl_id,
4991 p_base_region_code,
4992 l_required_flag,
4993 l_creation_date,
4994 l_created_by,
4995 l_last_update_date,
4996 l_last_updated_by,
4997 l_last_update_login
4998 );
4999
5000 -- /** commit the insert **/
5001 -- commit;
5002
5003 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
5004 FND_MESSAGE.SET_NAME('AK','AK_LOV_RELATION_CREATED');
5005 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' ' ||
5006 p_region_code||' '||to_char(p_attribute_application_id)||
5007 ' '||p_attribute_code||' '||
5008 to_char(p_lov_region_appl_id)||' '||p_lov_region_code||
5009 ' '||to_char(p_lov_attribute_appl_id)||' '||
5010 p_lov_region_code||' '||to_char(p_base_attribute_appl_id)||
5011 ' '||p_base_attribute_code);
5012 FND_MSG_PUB.Add;
5013 end if;
5014
5015 end if; -- /* if not p_copy_redo_flag */
5016
5017 p_return_status := FND_API.G_RET_STS_SUCCESS;
5018
5019 FND_MSG_PUB.Count_And_Get (
5020 p_count => p_msg_count,
5021 p_data => p_msg_data);
5022
5023 EXCEPTION
5024 WHEN VALUE_ERROR THEN
5025 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5026 FND_MESSAGE.SET_NAME('AK','AK_REGION_VALUE_ERROR');
5027 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
5028 p_region_code||' '||to_char(p_attribute_application_id)||
5029 ' '||p_attribute_code||' '||
5030 to_char(p_lov_region_appl_id)||' '||p_lov_region_code||
5031 ' '||to_char(p_lov_attribute_appl_id)||' '||
5032 p_lov_region_code||' '||to_char(p_base_attribute_appl_id)||
5033 ' '||p_base_attribute_code);
5034 FND_MSG_PUB.Add;
5035 end if;
5036 p_return_status := FND_API.G_RET_STS_ERROR;
5037 rollback to start_create_lov_relation;
5038 FND_MSG_PUB.Count_And_Get (
5039 p_count => p_msg_count,
5040 p_data => p_msg_data);
5041 WHEN FND_API.G_EXC_ERROR THEN
5042 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5043 FND_MESSAGE.SET_NAME('AK','AK_REGION_NOT_CREATED');
5044 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
5045 p_region_code||' '||to_char(p_attribute_application_id)||
5046 ' '||p_attribute_code||' '||
5047 to_char(p_lov_region_appl_id)||' '||p_lov_region_code||
5048 ' '||to_char(p_lov_attribute_appl_id)||' '||
5049 p_lov_region_code||' '||to_char(p_base_attribute_appl_id)||
5050 ' '||p_base_attribute_code);
5051 FND_MSG_PUB.Add;
5052 end if;
5053 p_return_status := FND_API.G_RET_STS_ERROR;
5054 rollback to start_create_lov_relation;
5055 FND_MSG_PUB.Count_And_Get (
5056 p_count => p_msg_count,
5057 p_data => p_msg_data);
5058 WHEN OTHERS THEN
5059 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5060 rollback to start_create_region;
5061 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
5062 SUBSTR (SQLERRM, 1, 240) );
5063 FND_MSG_PUB.Add;
5064 FND_MSG_PUB.Count_And_Get (
5065 p_count => p_msg_count,
5066 p_data => p_msg_data);
5067
5068 end CREATE_LOV_RELATION;
5069
5070 /*
5071 --=======================================================
5072 -- Procedure UPDATE_GRAPH_COLUMN
5073 --
5074 -- Usage Private API for updating a region graph column.
5075 -- This API should only be called by other APIs
5076 -- that are owned by the Core Modules Team (AK).
5077 --
5078 -- Desc This API updates a region graph column using the given info
5079 --
5080 -- Results The API returns the standard p_return_status parameter
5081 -- indicating one of the standard return statuses :
5082 -- * Unexpected error
5083 -- * Error
5084 -- * Success
5085 -- Parameters Region graph column columns
5086 -- p_loader_timestamp : IN optional
5087 -- If a timestamp is passed, the API will update the
5088 -- record using this timestamp. Only the upload API
5089 -- should call with this parameter loaded.
5090 --
5091 -- Version Initial version number = 1.0
5092 -- History Current version number = 1.0
5093 --=======================================================
5094 PROCEDURE UPDATE_GRAPH_COLUMN (
5095 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
5096 p_api_version_number IN NUMBER,
5097 p_init_msg_tbl IN BOOLEAN := FALSE,
5098 p_msg_count OUT NOCOPY NUMBER,
5099 p_msg_data OUT NOCOPY VARCHAR2,
5100 p_return_status OUT NOCOPY VARCHAR2,
5101 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
5102 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5103 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
5104 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5105 p_graph_number IN NUMBER := FND_API.G_MISS_NUM,
5106 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
5107 p_creation_date IN DATE := FND_API.G_MISS_DATE,
5108 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
5109 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
5110 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
5111 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
5112 p_pass IN NUMBER,
5113 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
5114 ) is
5115 cursor l_get_row_csr is
5116 select *
5117 from AK_REGION_GRAPH_COLUMNS
5118 where REGION_APPLICATION_ID = p_region_application_id
5119 and REGION_CODE = p_region_code
5120 and ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
5121 and ATTRIBUTE_CODE = p_attribute_code
5122 and GRAPH_NUMBER = p_graph_number
5123 for update of GRAPH_NUMBER;
5124 l_api_version_number CONSTANT number := 1.0;
5125 l_api_name CONSTANT varchar2(30) := 'Update_Graph_Column';
5126 l_created_by number;
5127 l_creation_date date;
5128 l_graph_column_rec AK_REGION_GRAPH_COLUMNS%ROWTYPE;
5129 l_last_update_date date;
5130 l_last_update_login number;
5131 l_last_updated_by number;
5132 l_return_status varchar2(1);
5133 begin
5134 IF NOT FND_API.Compatible_API_Call (
5135 l_api_version_number, p_api_version_number, l_api_name,
5136 G_PKG_NAME) then
5137 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5138 return;
5139 END IF;
5140
5141 -- Initialize the message table if requested.
5142
5143 if p_init_msg_tbl then
5144 FND_MSG_PUB.initialize;
5145 end if;
5146
5147 savepoint start_update_graph_columns;
5148
5149 --** retrieve ak_region_graph_columns row if it exists **
5150 open l_get_row_csr;
5151 fetch l_get_row_csr into l_graph_column_rec;
5152 if (l_get_row_csr%notfound) then
5153 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
5154 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_DOES_NOT_EXIST');
5155 FND_MSG_PUB.Add;
5156 end if;
5157 --dbms_output.put_line(l_api_name || 'Error - Row does not exist');
5158 close l_get_row_csr;
5159 raise FND_API.G_EXC_ERROR;
5160 end if;
5161 close l_get_row_csr;
5162
5163 --** validate table columns passed in **
5164 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
5165 if not AK_REGION2_PVT.VALIDATE_GRAPH_COLUMN (
5166 p_validation_level => p_validation_level,
5167 p_api_version_number => 1.0,
5168 p_return_status => l_return_status,
5169 p_region_application_id => p_region_application_id,
5170 p_region_code => p_region_code,
5171 p_attribute_application_id => p_attribute_application_id,
5172 p_attribute_code => p_attribute_code,
5173 p_graph_number => p_graph_number,
5174 p_caller => AK_ON_OBJECTS_PVT.G_UPDATE,
5175 p_pass => p_pass
5176 ) then
5177 --dbms_output.put_line(l_api_name || 'validation failed');
5178 -- Do not raise an error if it's the first pass
5179 if (p_pass = 1) then
5180 p_copy_redo_flag := TRUE;
5181 else
5182 raise FND_API.G_EXC_ERROR;
5183 end if; -- if p_pass
5184 end if;
5185 end if;
5186
5187 --** Load record to be updated to the database **
5188 --** - first load nullable columns **
5189
5190
5191 --** - next, load non-null, non-key columns **
5192
5193 -- Set WHO columns
5194 AK_UPLOAD_GRP.G_UPLOAD_DATE := p_last_update_date;
5195 AK_ON_OBJECTS_PVT.SET_WHO (
5196 p_return_status => l_return_status,
5197 p_loader_timestamp => p_loader_timestamp,
5198 p_created_by => l_created_by,
5199 p_creation_date => l_creation_date,
5200 p_last_updated_by => l_last_updated_by,
5201 p_last_update_date => l_last_update_date,
5202 p_last_update_login => l_last_update_login);
5203
5204 if (AK_UPLOAD_GRP.G_NON_SEED_DATA) then
5205 l_created_by := p_created_by;
5206 l_last_updated_by := p_last_updated_by;
5207 l_last_update_login := p_last_update_login;
5208 end if;
5209
5210 update AK_REGION_GRAPH_COLUMNS set
5211 LAST_UPDATE_DATE = l_last_update_date,
5212 LAST_UPDATED_BY = l_last_updated_by,
5213 LAST_UPDATE_LOGIN = l_last_update_login
5214 where REGION_APPLICATION_ID = p_region_application_id
5215 and REGION_CODE = p_region_code
5216 and ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
5217 and ATTRIBUTE_CODE = p_attribute_code
5218 and GRAPH_NUMBER = p_graph_number;
5219 if (sql%notfound) then
5220 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5221 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_UPDATE_FAILED');
5222 FND_MSG_PUB.Add;
5223 end if;
5224 raise FND_API.G_EXC_ERROR;
5225 end if;
5226
5227 -- ** commit the update **
5228 -- commit;
5229
5230 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
5231 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_UPDATED');
5232 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
5233 ' ' || p_region_code);
5234 FND_MSG_PUB.Add;
5235 end if;
5236
5237 p_return_status := FND_API.G_RET_STS_SUCCESS;
5238
5239 FND_MSG_PUB.Count_And_Get (
5240 p_count => p_msg_count,
5241 p_data => p_msg_data);
5242
5243 EXCEPTION
5244 WHEN VALUE_ERROR THEN
5245 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5246 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_VALUE_ERROR');
5247 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
5248 p_region_code||' '||
5249 to_char(p_attribute_application_id)||
5250 ' '||p_attribute_code||' '||
5251 to_char(p_graph_number));
5252 FND_MSG_PUB.Add;
5253 end if;
5254 rollback to start_update_graph_column;
5255 p_return_status := FND_API.G_RET_STS_ERROR;
5256 FND_MSG_PUB.Count_And_Get (
5257 p_count => p_msg_count,
5258 p_data => p_msg_data);
5259 WHEN FND_API.G_EXC_ERROR THEN
5260 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5261 FND_MESSAGE.SET_NAME('AK','AK_GRAPH_COLUMN_NOT_UPDATED');
5262 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
5263 p_region_code||' '||
5264 to_char(p_attribute_application_id)||
5265 ' '||p_attribute_code||' '||
5266 to_char(p_graph_number));
5267 FND_MSG_PUB.Add;
5268 end if;
5269 p_return_status := FND_API.G_RET_STS_ERROR;
5270 rollback to start_update_graph_column;
5271 FND_MSG_PUB.Count_And_Get (
5272 p_count => p_msg_count,
5273 p_data => p_msg_data);
5274 WHEN OTHERS THEN
5275 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5276 rollback to start_update_graph_column;
5277 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
5278 SUBSTR (SQLERRM, 1, 240) );
5279 FND_MSG_PUB.Add;
5280 FND_MSG_PUB.Count_And_Get (
5281 p_count => p_msg_count,
5282 p_data => p_msg_data);
5283 FND_MSG_PUB.Count_And_Get (
5284 p_count => p_msg_count,
5285 p_data => p_msg_data);
5286
5287 end UPDATE_GRAPH_COLUMN;
5288 */
5289
5290 --=======================================================
5291 -- Procedure UPDATE_LOV_RELATION
5292 --
5293 -- Usage Private API for updating a region lov relation.
5294 -- This API should only be called by other APIs
5295 -- that are owned by the Core Modules Team (AK).
5296 --
5297 -- Desc This API updates a region lov relation using the given info
5298 --
5299 -- Results The API returns the standard p_return_status parameter
5300 -- indicating one of the standard return statuses :
5301 -- * Unexpected error
5302 -- * Error
5303 -- * Success
5304 -- Parameters Region lov relation columns
5305 -- p_loader_timestamp : IN optional
5306 -- If a timestamp is passed, the API will update the
5307 -- record using this timestamp. Only the upload API
5308 -- should call with this parameter loaded.
5309 --
5310 -- Version Initial version number = 1.0
5311 -- History Current version number = 1.0
5312 --=======================================================
5313 PROCEDURE UPDATE_LOV_RELATION (
5314 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
5315 p_api_version_number IN NUMBER,
5316 p_init_msg_tbl IN BOOLEAN := FALSE,
5317 p_msg_count OUT NOCOPY NUMBER,
5318 p_msg_data OUT NOCOPY VARCHAR2,
5319 p_return_status OUT NOCOPY VARCHAR2,
5320 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
5321 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5322 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
5323 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5324 p_lov_region_appl_id IN NUMBER := FND_API.G_MISS_NUM,
5325 p_lov_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5326 p_lov_attribute_appl_id IN NUMBER := FND_API.G_MISS_NUM,
5327 p_lov_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5328 p_base_attribute_appl_id IN NUMBER := FND_API.G_MISS_NUM,
5329 p_base_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5330 p_direction_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
5331 p_base_region_appl_id IN NUMBER := FND_API.G_MISS_NUM,
5332 p_base_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5333 p_required_flag IN VARCHAR2 := FND_API.G_MISS_CHAR,
5334 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
5335 p_creation_date IN DATE := FND_API.G_MISS_DATE,
5336 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
5337 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
5338 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
5339 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
5340 p_pass IN NUMBER,
5341 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
5342 ) is
5343 cursor l_get_row_csr is
5344 select *
5345 from AK_REGION_LOV_RELATIONS
5346 where REGION_APPLICATION_ID = p_region_application_id
5347 and REGION_CODE = p_region_code
5348 and ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
5349 and ATTRIBUTE_CODE = p_attribute_code
5350 and LOV_REGION_APPL_ID = p_lov_region_appl_id
5351 and LOV_REGION_CODE = p_lov_region_code
5352 and LOV_ATTRIBUTE_APPL_ID = p_lov_attribute_appl_id
5353 and LOV_ATTRIBUTE_CODE = p_lov_attribute_code
5354 and BASE_ATTRIBUTE_APPL_ID = p_base_attribute_appl_id
5355 and BASE_ATTRIBUTE_CODE = p_base_attribute_code
5356 and DIRECTION_FLAG =p_direction_flag
5357 and BASE_REGION_APPL_ID = p_base_region_appl_id
5358 and BASE_REGION_CODE = p_base_region_code
5359 for update of REQUIRED_FLAG;
5360 l_api_version_number CONSTANT number := 1.0;
5361 l_api_name CONSTANT varchar2(30) := 'Update_Lov_Relation';
5362 l_created_by number;
5363 l_creation_date date;
5364 l_lov_relation_rec AK_REGION_LOV_RELATIONS%ROWTYPE;
5365 l_required_flag varchar2(1) := 'N';
5366 l_last_update_date date;
5367 l_last_update_login number;
5368 l_last_updated_by number;
5369 l_return_status varchar2(1);
5370 begin
5371 IF NOT FND_API.Compatible_API_Call (
5372 l_api_version_number, p_api_version_number, l_api_name,
5373 G_PKG_NAME) then
5374 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5375 return;
5376 END IF;
5377
5378 -- Initialize the message table if requested.
5379
5380 if p_init_msg_tbl then
5381 FND_MSG_PUB.initialize;
5382 end if;
5383
5384 savepoint start_update_lov_relation;
5385
5386 --** retrieve ak_region_lov_relations row if it exists **
5387 open l_get_row_csr;
5388 fetch l_get_row_csr into l_lov_relation_rec;
5389 if (l_get_row_csr%notfound) then
5390 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
5391 FND_MESSAGE.SET_NAME('AK','AK_LOV_REGION_DOES_NOT_EXIST');
5392 FND_MSG_PUB.Add;
5393 end if;
5394 --dbms_output.put_line(l_api_name || 'Error - Row does not exist');
5395 close l_get_row_csr;
5396 raise FND_API.G_EXC_ERROR;
5397 end if;
5398 close l_get_row_csr;
5399
5400 --** validate table columns passed in **
5401 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
5402 if not AK_REGION2_PVT.VALIDATE_LOV_RELATION (
5403 p_validation_level => p_validation_level,
5404 p_api_version_number => 1.0,
5405 p_return_status => l_return_status,
5406 p_region_application_id => p_region_application_id,
5407 p_region_code => p_region_code,
5408 p_attribute_application_id => p_attribute_application_id,
5409 p_attribute_code => p_attribute_code,
5410 p_lov_region_appl_id => p_lov_region_appl_id,
5411 p_lov_region_code => p_lov_region_code,
5412 p_lov_attribute_appl_id => p_lov_attribute_appl_id,
5413 p_lov_attribute_code => p_lov_attribute_code,
5414 p_base_attribute_appl_id => p_base_attribute_appl_id,
5415 p_base_attribute_code => p_base_attribute_code,
5416 p_direction_flag => p_direction_flag,
5417 p_base_region_appl_id => p_base_region_appl_id,
5418 p_base_region_code => p_base_region_code,
5419 p_caller => AK_ON_OBJECTS_PVT.G_UPDATE,
5420 p_pass => p_pass
5421 ) then
5422 --dbms_output.put_line(l_api_name || 'validation failed');
5423 -- Do not raise an error if it's the first pass
5424 if (p_pass = 1) then
5425 p_copy_redo_flag := TRUE;
5426 else
5427 raise FND_API.G_EXC_ERROR;
5428 end if; -- /* if p_pass */
5429 end if;
5430 end if;
5431
5432 -- Do not update if fails validation ie. p_copy_redo_flag = true
5433 if (not p_copy_redo_flag) then
5434
5435 --** Load record to be updated to the database **
5436 --** - first load nullable columns **
5437
5438
5439 --** - next, load non-null, non-key columns **
5440
5441 -- default a value for required_flag column if no value is given
5442 if ( p_required_flag <> FND_API.G_MISS_CHAR and p_required_flag is not null ) then
5443 l_lov_relation_rec.required_flag := p_required_flag;
5444 else
5445 l_lov_relation_rec.required_flag := l_required_flag;
5446 end if;
5447
5448 if (p_created_by <> FND_API.G_MISS_NUM) then
5449 l_created_by := p_created_by;
5450 end if;
5451
5452 if (p_creation_date <> FND_API.G_MISS_DATE) then
5453 l_creation_date := p_creation_date;
5454 end if;
5455
5456 if (p_last_updated_by <> FND_API.G_MISS_NUM) then
5457 l_last_updated_by := p_last_updated_by;
5458 end if;
5459
5460 if (p_last_update_date <> FND_API.G_MISS_DATE) then
5461 l_last_update_date := p_last_update_date;
5462 end if;
5463
5464 if (p_last_update_login <> FND_API.G_MISS_NUM) then
5465 l_last_update_login := p_last_update_login;
5466 end if;
5467
5468 -- Set WHO columns
5469 if AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
5470 p_loader_timestamp => p_loader_timestamp,
5471 p_created_by => l_created_by,
5472 p_creation_date => l_creation_date,
5473 p_last_updated_by => l_last_updated_by,
5474 p_db_last_updated_by => l_lov_relation_rec.last_updated_by,
5475 p_last_update_date => l_last_update_date,
5476 p_db_last_update_date => l_lov_relation_rec.last_update_date,
5477 p_last_update_login => l_last_update_login,
5478 p_create_or_update => 'UPDATE') then
5479
5480 update AK_REGION_LOV_RELATIONS set
5481 REQUIRED_FLAG = l_lov_relation_rec.required_flag,
5482 LAST_UPDATE_DATE = l_last_update_date,
5483 LAST_UPDATED_BY = l_last_updated_by,
5484 LAST_UPDATE_LOGIN = l_last_update_login
5485 where REGION_APPLICATION_ID = p_region_application_id
5486 and REGION_CODE = p_region_code
5487 and ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
5488 and ATTRIBUTE_CODE = p_attribute_code
5489 and LOV_REGION_APPL_ID = p_lov_region_appl_id
5490 and LOV_REGION_CODE = p_lov_region_code
5491 and LOV_ATTRIBUTE_APPL_ID = p_lov_attribute_appl_id
5492 and LOV_ATTRIBUTE_CODE = p_lov_attribute_code
5493 and BASE_ATTRIBUTE_APPL_ID = p_base_attribute_appl_id
5494 and BASE_ATTRIBUTE_CODE = p_base_attribute_code
5495 and DIRECTION_FLAG = p_direction_flag
5496 and BASE_REGION_APPL_ID = p_base_region_appl_id
5497 and BASE_REGION_CODE = p_base_region_code;
5498 if (sql%notfound) then
5499 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5500 FND_MESSAGE.SET_NAME('AK','AK_LOV_RELATION_UPDATE_FAILED');
5501 FND_MSG_PUB.Add;
5502 end if;
5503 raise FND_API.G_EXC_ERROR;
5504 end if;
5505
5506 -- /** commit the update **/
5507 -- commit;
5508
5509 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
5510 FND_MESSAGE.SET_NAME('AK','AK_LOV_RELATION_UPDATED');
5511 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
5512 ' ' || p_region_code);
5513 FND_MSG_PUB.Add;
5514 end if;
5515
5516 end if;
5517
5518 end if; -- /* if not p_copy_redo_flag */
5519
5520 p_return_status := FND_API.G_RET_STS_SUCCESS;
5521
5522 FND_MSG_PUB.Count_And_Get (
5523 p_count => p_msg_count,
5524 p_data => p_msg_data);
5525
5526 EXCEPTION
5527 WHEN VALUE_ERROR THEN
5528 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5529 FND_MESSAGE.SET_NAME('AK','AK_LOV_RELATION_VALUE_ERROR');
5530 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
5531 p_region_code||' '||to_char(p_attribute_application_id)||
5532 ' '||p_attribute_code||' '||
5533 to_char(p_lov_region_appl_id)||' '||p_lov_region_code||
5534 ' '||to_char(p_lov_attribute_appl_id)||' '||
5535 p_lov_region_code||' '||to_char(p_base_attribute_appl_id)||
5536 ' '||p_base_attribute_code||' '||p_direction_flag ||
5537 ' '||to_char(p_base_region_appl_id)||' '||p_base_region_code);
5538 FND_MSG_PUB.Add;
5539 end if;
5540 rollback to start_update_lov_relation;
5541 p_return_status := FND_API.G_RET_STS_ERROR;
5542 FND_MSG_PUB.Count_And_Get (
5543 p_count => p_msg_count,
5544 p_data => p_msg_data);
5545 WHEN FND_API.G_EXC_ERROR THEN
5546 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
5547 FND_MESSAGE.SET_NAME('AK','AK_LOV_RELATION_NOT_UPDATED');
5548 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
5549 p_region_code||' '||to_char(p_attribute_application_id)||
5550 ' '||p_attribute_code||' '||
5551 to_char(p_lov_region_appl_id)||' '||p_lov_region_code||
5552 ' '||to_char(p_lov_attribute_appl_id)||' '||
5553 p_lov_region_code||' '||to_char(p_base_attribute_appl_id)||
5554 ' '||p_base_attribute_code);
5555 FND_MSG_PUB.Add;
5556 end if;
5557 p_return_status := FND_API.G_RET_STS_ERROR;
5558 rollback to start_update_lov_relation;
5559 FND_MSG_PUB.Count_And_Get (
5560 p_count => p_msg_count,
5561 p_data => p_msg_data);
5562 WHEN OTHERS THEN
5563 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5564 rollback to start_update_lov_relation;
5565 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
5566 SUBSTR (SQLERRM, 1, 240) );
5567 FND_MSG_PUB.Add;
5568 FND_MSG_PUB.Count_And_Get (
5569 p_count => p_msg_count,
5570 p_data => p_msg_data);
5571 FND_MSG_PUB.Count_And_Get (
5572 p_count => p_msg_count,
5573 p_data => p_msg_data);
5574
5575 end UPDATE_LOV_RELATION;
5576
5577 --=======================================================
5578 -- Function CATEGORY_USAGE_EXISTS
5579 --
5580 -- Usage Private API for checking for the existence of
5581 -- a region item category usage with the given key values. This
5582 -- API should only be called by other APIs that are
5583 -- owned by the Core Modules Team (AK).
5584 --
5585 -- Desc This API check to see if a region item category usage record
5586 -- exists with the given key values.
5587 --
5588 -- Results The API returns the standard p_return_status parameter
5589 -- indicating one of the standard return statuses :
5590 -- * Unexpected error
5591 -- * Error
5592 -- * Success
5593 -- This function will return TRUE if such an object
5594 -- attribute exists, or FALSE otherwise.
5595 -- Parameters Region Lov Relation key columns
5596 --
5597 -- Version Initial version number = 1.0
5598 -- History Current version number = 1.0
5599 --=======================================================
5600 FUNCTION CATEGORY_USAGE_EXISTS (
5601 p_api_version_number IN NUMBER,
5602 p_return_status OUT NOCOPY VARCHAR2,
5603 p_region_application_id IN NUMBER,
5604 p_region_code IN VARCHAR2,
5605 p_attribute_application_id IN NUMBER,
5606 p_attribute_code IN VARCHAR2,
5607 p_category_name IN VARCHAR2
5608 ) return boolean is
5609 cursor l_check_category_usage_csr is
5610 select 1
5611 from AK_CATEGORY_USAGES
5612 where region_application_id = p_region_application_id
5613 and region_code = p_region_code
5614 and attribute_application_id = p_attribute_application_id
5615 and attribute_code = p_attribute_code
5616 and category_name = p_category_name;
5617 l_api_version_number CONSTANT number := 1.0;
5618 l_api_name CONSTANT varchar2(30) := 'Category_Usage_Exists';
5619 l_dummy number;
5620 begin
5621 IF NOT FND_API.Compatible_API_Call (
5622 l_api_version_number, p_api_version_number, l_api_name,
5623 G_PKG_NAME) then
5624 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5625 return FALSE;
5626 END IF;
5627
5628 open l_check_category_usage_csr;
5629 fetch l_check_category_usage_csr into l_dummy;
5630 if (l_check_category_usage_csr%notfound) then
5631 close l_check_category_usage_csr;
5632 p_return_status := FND_API.G_RET_STS_SUCCESS;
5633 return FALSE;
5634 else
5635 close l_check_category_usage_csr;
5636 p_return_status := FND_API.G_RET_STS_SUCCESS;
5637 return TRUE;
5638 end if;
5639
5640 EXCEPTION
5641 WHEN FND_API.G_EXC_ERROR THEN
5642 p_return_status := FND_API.G_RET_STS_ERROR;
5643 return FALSE;
5644 WHEN OTHERS THEN
5645 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5646 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
5647 SUBSTR (SQLERRM, 1, 240) );
5648 FND_MSG_PUB.Add;
5649 return FALSE;
5650 end CATEGORY_USAGE_EXISTS;
5651
5652 --=======================================================
5653 -- Function VALIDATE_CATEGORY_USAGE
5654 --
5655 -- Usage Private API for validating a region item category usage. This
5656 -- API should only be called by other APIs that are
5657 -- owned by the Core Modules Team (AK).
5658 --
5659 -- Desc Perform validation on a region lov relation record.
5660 --
5661 -- Results The API returns the standard p_return_status parameter
5662 -- indicating one of the standard return statuses :
5663 -- * Unexpected error
5664 -- * Error
5665 -- * Success
5666 -- In addition, this function returns TRUE if all
5667 -- validation tests are passed, or FALSE otherwise.
5668 -- Parameters Region lov relation columns
5669 -- p_caller : IN required
5670 -- Must be one of the following values defined
5671 -- in package AK_ON_OBJECTS_PVT:
5672 -- - G_CREATE (if calling from the Create API)
5673 -- - G_DOWNLOAD (if calling from the Download API)
5674 -- - G_UPDATE (if calling from the Update API)
5675 --
5676 -- Note This API is intended for performing record-level
5677 -- validation. It is not designed for item-level
5678 -- validation.
5679 --
5680 -- Version Initial version number = 1.1
5681 --=======================================================
5682 FUNCTION VALIDATE_CATEGORY_USAGE (
5683 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
5684 p_api_version_number IN NUMBER,
5685 p_return_status OUT NOCOPY VARCHAR2,
5686 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
5687 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5688 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
5689 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5690 p_category_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
5691 p_category_id IN NUMBER := FND_API.G_MISS_NUM,
5692 p_application_id IN NUMBER := FND_API.G_MISS_NUM,
5693 p_show_all IN VARCHAR2 := FND_API.G_MISS_CHAR,
5694 p_caller IN VARCHAR2,
5695 p_pass IN NUMBER := 2
5696 ) return boolean is
5697
5698 cursor l_check_region_item_csr (param_region_code in varchar2, param_region_appl_id in number,
5699 param_attr_code in varchar2, param_attr_appl_id number) is
5700 select item_style
5701 from AK_REGION_ITEMS
5702 where region_application_id = param_region_appl_id
5703 and region_code = param_region_code
5704 and attribute_application_id = param_attr_appl_id
5705 and attribute_code = param_attr_code;
5706
5707 cursor l_check_category_csr (param_category_name in varchar2) is
5708 select 1
5709 from fnd_document_categories_vl
5710 where name = param_category_name;
5711
5712 l_api_version_number CONSTANT number := 1.0;
5713 l_api_name CONSTANT varchar2(30) := 'validate_category_usage';
5714
5715 l_item_style VARCHAR2(30);
5716 l_dummy NUMBER;
5717 l_error BOOLEAN;
5718 l_return_status VARCHAR2(1);
5719 begin
5720
5721 IF NOT FND_API.Compatible_API_Call (
5722 l_api_version_number, p_api_version_number, l_api_name,
5723 G_PKG_NAME) then
5724 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5725 return FALSE;
5726 END IF;
5727
5728 l_error := FALSE;
5729
5730 --** if validation level is none, no validation is necessary
5731 if (p_validation_level = FND_API.G_VALID_LEVEL_NONE) then
5732 p_return_status := FND_API.G_RET_STS_SUCCESS;
5733 return TRUE;
5734 end if;
5735
5736 --** check that key columns are not null and not missing **
5737 if ((p_region_application_id is null) or
5738 (p_region_application_id = FND_API.G_MISS_NUM)) then
5739 l_error := TRUE;
5740 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5741 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
5742 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_APPLICATION_ID');
5743 FND_MSG_PUB.Add;
5744 end if;
5745 end if;
5746
5747 if ((p_region_code is null) or
5748 (p_region_code = FND_API.G_MISS_CHAR)) then
5749 l_error := TRUE;
5750 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5751 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
5752 FND_MESSAGE.SET_TOKEN('COLUMN', 'REGION_CODE');
5753 FND_MSG_PUB.Add;
5754 end if;
5755 end if;
5756
5757 if ((p_attribute_application_id is null) or
5758 (p_attribute_application_id = FND_API.G_MISS_NUM)) then
5759 l_error := TRUE;
5760 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5761 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
5762 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_APPLICATION_ID');
5763 FND_MSG_PUB.Add;
5764 end if;
5765 end if;
5766
5767 if ((p_attribute_code is null) or
5768 (p_attribute_code = FND_API.G_MISS_CHAR)) then
5769 l_error := TRUE;
5770 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5771 FND_MESSAGE.SET_NAME('AK','AK_CANNOT_BE_NULL');
5772 FND_MESSAGE.SET_TOKEN('COLUMN', 'ATTRIBUTE_CODE');
5773 FND_MSG_PUB.Add;
5774 end if;
5775 end if;
5776
5777 -- - Check that the parent region item exists
5778 open l_check_region_item_csr(p_region_code, p_region_application_id,
5779 p_attribute_code, p_attribute_application_id);
5780 fetch l_check_region_item_csr into l_item_style;
5781 if (l_check_region_item_csr%notfound) then
5782 l_error := TRUE;
5783 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5784 FND_MESSAGE.SET_NAME('AK','AK_INVALID_REG_ITEM_REFERENCE');
5785 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
5786 ' ' || p_region_code ||' '||
5787 to_char(p_attribute_application_id)||' '||p_attribute_code);
5788 FND_MSG_PUB.Add;
5789 end if;
5790 else
5791 if ( l_item_style <> 'ATTACHMENT_LINK' AND l_item_style <> 'ATTACHMENT_IMAGE' AND
5792 l_item_style <> 'ATTACHMENT_TABLE') then
5793 l_error := TRUE;
5794 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5795 FND_MESSAGE.SET_NAME('AK','AK_INVALID_ITEM_STYLE');
5796 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
5797 ' ' || p_region_code ||' '||
5798 to_char(p_attribute_application_id)||' '||p_attribute_code||' '||l_item_style);
5799 FND_MSG_PUB.Add;
5800 end if;
5801 end if; -- l_item_style <> 'ATTACHMENT%'
5802 end if;
5803 close l_check_region_item_csr;
5804
5805 -- - Check that the category exists
5806 open l_check_category_csr(p_category_name);
5807 fetch l_check_category_csr into l_dummy;
5808 if (l_check_category_csr%notfound) then
5809 l_error := TRUE;
5810 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) and (p_pass = 2) then
5811 FND_MESSAGE.SET_NAME('AK','AK_INVALID_CATEGORY_REFERENCE');
5812 FND_MESSAGE.SET_TOKEN('KEY', p_category_name);
5813 FND_MSG_PUB.Add;
5814 end if;
5815 end if;
5816 close l_check_category_csr;
5817
5818 -- return true if no error, false otherwise
5819 p_return_status := FND_API.G_RET_STS_SUCCESS;
5820 return (not l_error);
5821
5822 EXCEPTION
5823 WHEN FND_API.G_EXC_ERROR THEN
5824 p_return_status := FND_API.G_RET_STS_ERROR;
5825 return FALSE;
5826 WHEN OTHERS THEN
5827 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5828 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
5829 SUBSTR (SQLERRM, 1, 240) );
5830 FND_MSG_PUB.Add;
5831 return FALSE;
5832
5833 end VALIDATE_CATEGORY_USAGE;
5834
5835 --=======================================================
5836 -- Procedure CREATE_CATEGORY_USAGE
5837 --
5838 -- Usage Private API for creating a region item category usage. This
5839 -- API should only be called by other APIs that are
5840 -- owned by the Core Modules Team (AK).
5841 --
5842 -- Desc Creates a region item category usage using the given info.
5843 -- This API should only be called by other APIs that are
5844 -- owned by the Core Modules Team (AK).
5845 --
5846 -- Results The API returns the standard p_return_status parameter
5847 -- indicating one of the standard return statuses :
5848 -- * Unexpected error
5849 -- * Error
5850 -- * Success
5851 -- Parameters Region columns
5852 -- p_loader_timestamp : IN optional
5853 -- If a timestamp is passed, the API will create the
5854 -- record using this timestamp. Only the upload API
5855 -- should call with this parameter loaded.
5856 --
5857 -- Version Initial version number = 1.1
5858 --=======================================================
5859 PROCEDURE CREATE_CATEGORY_USAGE (
5860 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
5861 p_api_version_number IN NUMBER,
5862 p_init_msg_tbl IN BOOLEAN := FALSE,
5863 p_msg_count OUT NOCOPY NUMBER,
5864 p_msg_data OUT NOCOPY VARCHAR2,
5865 p_return_status OUT NOCOPY VARCHAR2,
5866 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
5867 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5868 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
5869 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
5870 p_category_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
5871 p_category_id IN NUMBER := FND_API.G_MISS_NUM,
5872 p_application_id IN NUMBER := FND_API.G_MISS_NUM,
5873 p_show_all IN VARCHAR2 := FND_API.G_MISS_CHAR,
5874 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
5875 p_creation_date IN DATE := FND_API.G_MISS_DATE,
5876 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
5877 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
5878 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
5879 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
5880 p_pass IN NUMBER,
5881 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
5882 ) is
5883
5884 l_api_version_number CONSTANT number := 1.0;
5885 l_api_name CONSTANT varchar2(30) := 'Create_Category_Usage';
5886 l_created_by number;
5887 l_creation_date date;
5888 l_last_update_date date;
5889 l_last_update_login number;
5890 l_last_updated_by number;
5891 l_return_status varchar2(1);
5892
5893 begin
5894
5895 IF NOT FND_API.Compatible_API_Call (
5896 l_api_version_number, p_api_version_number, l_api_name,
5897 G_PKG_NAME) then
5898 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
5899 return;
5900 END IF;
5901
5902 -- Initialize the message table if requested.
5903
5904 if p_init_msg_tbl then
5905 FND_MSG_PUB.initialize;
5906 end if;
5907
5908 savepoint start_create_category_usage;
5909
5910 --** check to see if row already exists **
5911 if AK_REGION2_PVT.CATEGORY_USAGE_EXISTS (
5912 p_api_version_number => 1.0,
5913 p_return_status => l_return_status,
5914 p_region_application_id => p_region_application_id,
5915 p_region_code => p_region_code,
5916 p_attribute_application_id => p_attribute_application_id,
5917 p_attribute_code => p_attribute_code,
5918 p_category_name => p_category_name) then
5919 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
5920 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_USAGE_EXISTS');
5921 FND_MSG_PUB.Add;
5922 end if;
5923 raise FND_API.G_EXC_ERROR;
5924 end if;
5925
5926 --** validate table columns passed in **
5927 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
5928 if not AK_REGION2_PVT.VALIDATE_CATEGORY_USAGE (
5929 p_validation_level => p_validation_level,
5930 p_api_version_number => 1.0,
5931 p_return_status => l_return_status,
5932 p_region_application_id => p_region_application_id,
5933 p_region_code => p_region_code,
5934 p_attribute_application_id => p_attribute_application_id,
5935 p_attribute_code => p_attribute_code,
5936 p_category_name => p_category_name,
5937 p_category_id => p_category_id,
5938 p_application_id => p_application_id,
5939 p_show_all => p_show_all,
5940 p_caller => AK_ON_OBJECTS_PVT.G_CREATE,
5941 p_pass => p_pass
5942 ) then
5943 -- Do not raise an error if it's the first pass
5944 if (p_pass = 1) then
5945 p_copy_redo_flag := TRUE;
5946 else
5947 raise FND_API.G_EXC_ERROR;
5948 end if;
5949 end if;
5950 end if;
5951
5952 -- Do not insert if fails validation ie. p_copy_redo_flag = true
5953 if (not p_copy_redo_flag) then
5954
5955 if (p_created_by <> FND_API.G_MISS_NUM) then
5956 l_created_by := p_created_by;
5957 end if;
5958
5959 if (p_creation_date <> FND_API.G_MISS_DATE) then
5960 l_creation_date := p_creation_date;
5961 end if;
5962
5963 if (p_last_updated_by <> FND_API.G_MISS_NUM) then
5964 l_last_updated_by := p_last_updated_by;
5965 end if;
5966
5967 if (p_last_update_date <> FND_API.G_MISS_DATE) then
5968 l_last_update_date := p_last_update_date;
5969 end if;
5970
5971 if (p_last_update_login <> FND_API.G_MISS_NUM) then
5972 l_last_update_login := p_last_update_login;
5973 end if;
5974
5975 -- Create record if no validation error was found
5976 -- NOTE - Calling IS_UPDATEABLE for backward compatibility
5977 -- old jlt files didn't have who columns and IS_UPDATEABLE
5978 -- calls SET_WHO which populates those columns, for later
5979 -- jlt files IS_UPDATEABLE will always return TRUE for CREATE
5980
5981 if AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
5982 p_loader_timestamp => p_loader_timestamp,
5983 p_created_by => l_created_by,
5984 p_creation_date => l_creation_date,
5985 p_last_updated_by => l_last_updated_by,
5986 p_db_last_updated_by => null,
5987 p_last_update_date => l_last_update_date,
5988 p_db_last_update_date => null,
5989 p_last_update_login => l_last_update_login,
5990 p_create_or_update => 'CREATE') then
5991 null;
5992 end if;
5993
5994 insert into AK_CATEGORY_USAGES (
5995 REGION_APPLICATION_ID,
5996 REGION_CODE,
5997 ATTRIBUTE_APPLICATION_ID,
5998 ATTRIBUTE_CODE,
5999 CATEGORY_NAME,
6000 CATEGORY_ID,
6001 APPLICATION_ID,
6002 SHOW_ALL,
6003 CREATION_DATE,
6004 CREATED_BY,
6005 LAST_UPDATE_DATE,
6006 LAST_UPDATED_BY,
6007 LAST_UPDATE_LOGIN
6008 ) values (
6009 p_region_application_id,
6010 p_region_code,
6011 p_attribute_application_id,
6012 p_attribute_code,
6013 p_category_name,
6014 p_category_id,
6015 p_application_id,
6016 p_show_all,
6017 l_creation_date,
6018 l_created_by,
6019 l_last_update_date,
6020 l_last_updated_by,
6021 l_last_update_login
6022 );
6023
6024 -- /** commit the insert **/
6025 -- commit;
6026
6027 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
6028 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_USAGE_CREATED');
6029 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' ' ||
6030 p_region_code||' '||to_char(p_attribute_application_id)||
6031 ' '||p_attribute_code||' '||
6032 p_category_name);
6033 FND_MSG_PUB.Add;
6034 end if;
6035
6036 end if; -- /* if not p_copy_redo_flag */
6037
6038 p_return_status := FND_API.G_RET_STS_SUCCESS;
6039
6040 FND_MSG_PUB.Count_And_Get (
6041 p_count => p_msg_count,
6042 p_data => p_msg_data);
6043
6044 EXCEPTION
6045 WHEN VALUE_ERROR THEN
6046 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
6047 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_USAGE_VALUE_ERROR');
6048 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
6049 p_region_code||' '||to_char(p_attribute_application_id)||
6050 ' '||p_attribute_code||' '||
6051 p_category_name);
6052 FND_MSG_PUB.Add;
6053 end if;
6054 p_return_status := FND_API.G_RET_STS_ERROR;
6055 rollback to start_create_category_usage;
6056 FND_MSG_PUB.Count_And_Get (
6057 p_count => p_msg_count,
6058 p_data => p_msg_data);
6059 WHEN FND_API.G_EXC_ERROR THEN
6060 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
6061 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_USAGE_NOT_CREATED');
6062 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
6063 p_region_code||' '||to_char(p_attribute_application_id)||
6064 ' '||p_attribute_code||' '||
6065 p_category_name);
6066 FND_MSG_PUB.Add;
6067 end if;
6068 p_return_status := FND_API.G_RET_STS_ERROR;
6069 rollback to start_create_category_usage;
6070 FND_MSG_PUB.Count_And_Get (
6071 p_count => p_msg_count,
6072 p_data => p_msg_data);
6073 WHEN OTHERS THEN
6074 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6075 rollback to start_create_category_usage;
6076 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
6077 SUBSTR (SQLERRM, 1, 240) );
6078 FND_MSG_PUB.Add;
6079 FND_MSG_PUB.Count_And_Get (
6080 p_count => p_msg_count,
6081 p_data => p_msg_data);
6082
6083 end CREATE_CATEGORY_USAGE;
6084
6085 --=======================================================
6086 -- Procedure UPDATE_CATEGORY_USAGE
6087 --
6088 -- Usage Private API for updating category usage.
6089 -- This API should only be called by other APIs
6090 -- that are owned by the Core Modules Team (AK).
6091 --
6092 -- Desc This API updates a region lov relation using the given info
6093 --
6094 -- Results The API returns the standard p_return_status parameter
6095 -- indicating one of the standard return statuses :
6096 -- * Unexpected error
6097 -- * Error
6098 -- * Success
6099 -- Parameters Category usage columns
6100 -- p_loader_timestamp : IN optional
6101 -- If a timestamp is passed, the API will update the
6102 -- record using this timestamp. Only the upload API
6103 -- should call with this parameter loaded.
6104 --
6105 -- Version Initial version number = 1.0
6106 -- History Current version number = 1.0
6107 --=======================================================
6108 PROCEDURE UPDATE_CATEGORY_USAGE (
6109 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
6110 p_api_version_number IN NUMBER,
6111 p_init_msg_tbl IN BOOLEAN := FALSE,
6112 p_msg_count OUT NOCOPY NUMBER,
6113 p_msg_data OUT NOCOPY VARCHAR2,
6114 p_return_status OUT NOCOPY VARCHAR2,
6115 p_region_application_id IN NUMBER := FND_API.G_MISS_NUM,
6116 p_region_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
6117 p_attribute_application_id IN NUMBER := FND_API.G_MISS_NUM,
6118 p_attribute_code IN VARCHAR2 := FND_API.G_MISS_CHAR,
6119 p_category_name IN VARCHAR2 := FND_API.G_MISS_CHAR,
6120 p_category_id IN NUMBER := FND_API.G_MISS_NUM,
6121 p_application_id IN NUMBER := FND_API.G_MISS_NUM,
6122 p_show_all IN VARCHAR2 := FND_API.G_MISS_CHAR,
6123 p_created_by IN NUMBER := FND_API.G_MISS_NUM,
6124 p_creation_date IN DATE := FND_API.G_MISS_DATE,
6125 p_last_updated_by IN NUMBER := FND_API.G_MISS_NUM,
6126 p_last_update_date IN DATE := FND_API.G_MISS_DATE,
6127 p_last_update_login IN NUMBER := FND_API.G_MISS_NUM,
6128 p_loader_timestamp IN DATE := FND_API.G_MISS_DATE,
6129 p_pass IN NUMBER,
6130 p_copy_redo_flag IN OUT NOCOPY BOOLEAN
6131 ) is
6132 cursor l_get_row_csr is
6133 select *
6134 from AK_CATEGORY_USAGES
6135 where REGION_APPLICATION_ID = p_region_application_id
6136 and REGION_CODE = p_region_code
6137 and ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
6138 and ATTRIBUTE_CODE = p_attribute_code
6139 and CATEGORY_NAME = p_category_name;
6140 l_api_version_number CONSTANT number := 1.0;
6141 l_api_name CONSTANT varchar2(30) := 'Update_Category_Usage';
6142 l_created_by number;
6143 l_creation_date date;
6144 l_category_usage_rec AK_CATEGORY_USAGES%ROWTYPE;
6145 l_last_update_date date;
6146 l_last_update_login number;
6147 l_last_updated_by number;
6148 l_return_status varchar2(1);
6149 begin
6150 IF NOT FND_API.Compatible_API_Call (
6151 l_api_version_number, p_api_version_number, l_api_name,
6152 G_PKG_NAME) then
6153 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6154 return;
6155 END IF;
6156
6157 -- Initialize the message table if requested.
6158
6159 if p_init_msg_tbl then
6160 FND_MSG_PUB.initialize;
6161 end if;
6162
6163 savepoint start_update_category_usage;
6164
6165 --** retrieve ak_category_usage row if it exists **
6166 open l_get_row_csr;
6167 fetch l_get_row_csr into l_category_usage_rec;
6168 if (l_get_row_csr%notfound) then
6169 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) then
6170 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_DOES_NOT_EXIST');
6171 FND_MESSAGE.SET_TOKEN('KEY', (to_char(p_region_application_id) ||' '||
6172 p_region_code ||' '|| to_char(p_attribute_application_id)||' '||
6173 p_attribute_code ||' '|| p_category_name ||' '||
6174 to_char(p_application_id)));
6175 FND_MSG_PUB.Add;
6176 FND_MSG_PUB.Add;
6177 end if;
6178 --dbms_output.put_line(l_api_name || 'Error - Row does not exist');
6179 close l_get_row_csr;
6180 raise FND_API.G_EXC_ERROR;
6181 end if;
6182 close l_get_row_csr;
6183
6184 --** validate table columns passed in **
6185 if p_validation_level <> FND_API.G_VALID_LEVEL_NONE then
6186 if not AK_REGION2_PVT.VALIDATE_CATEGORY_USAGE (
6187 p_validation_level => p_validation_level,
6188 p_api_version_number => 1.0,
6189 p_return_status => l_return_status,
6190 p_region_application_id => p_region_application_id,
6191 p_region_code => p_region_code,
6192 p_attribute_application_id => p_attribute_application_id,
6193 p_attribute_code => p_attribute_code,
6194 p_category_name => p_category_name,
6195 p_category_id => p_category_id,
6196 p_application_id => p_application_id,
6197 p_show_all => p_show_all,
6198 p_caller => AK_ON_OBJECTS_PVT.G_UPDATE,
6199 p_pass => p_pass
6200 ) then
6201 -- Do not raise an error if it's the first pass
6202 if (p_pass = 1) then
6203 p_copy_redo_flag := TRUE;
6204 else
6205 raise FND_API.G_EXC_ERROR;
6206 end if;
6207 end if;
6208 end if;
6209
6210 -- Do not update if fails validation ie. p_copy_redo_flag = true
6211 if (not p_copy_redo_flag) then
6212
6213 if (p_created_by <> FND_API.G_MISS_NUM) then
6214 l_created_by := p_created_by;
6215 end if;
6216 if (p_creation_date <> FND_API.G_MISS_DATE) then
6217 l_creation_date := p_creation_date;
6218 end if;
6219 if (p_last_updated_by <> FND_API.G_MISS_NUM) then
6220 l_last_updated_by := p_last_updated_by;
6221 end if;
6222 if (p_last_update_date <> FND_API.G_MISS_DATE) then
6223 l_last_update_date := p_last_update_date;
6224 end if;
6225 if (p_last_update_login <> FND_API.G_MISS_NUM) then
6226 l_last_update_login := p_last_update_login;
6227 end if;
6228
6229 --** Load record to be updated to the database **
6230
6231 if AK_ON_OBJECTS_PVT.IS_UPDATEABLE(
6232 p_loader_timestamp => p_loader_timestamp,
6233 p_created_by => l_created_by,
6234 p_creation_date => l_creation_date,
6235 p_last_updated_by => l_last_updated_by,
6236 p_db_last_updated_by => l_category_usage_rec.last_updated_by,
6237 p_last_update_date => l_last_update_date,
6238 p_db_last_update_date => l_category_usage_rec.last_update_date,
6239 p_last_update_login => l_last_update_login,
6240 p_create_or_update => 'UPDATE') then
6241
6242 update AK_CATEGORY_USAGES set
6243 SHOW_ALL = p_show_all,
6244 APPLICATION_ID = p_application_id,
6245 LAST_UPDATE_DATE = l_last_update_date,
6246 LAST_UPDATED_BY = l_last_updated_by,
6247 LAST_UPDATE_LOGIN = l_last_update_login
6248 where REGION_APPLICATION_ID = p_region_application_id
6249 and REGION_CODE = p_region_code
6250 and ATTRIBUTE_APPLICATION_ID = p_attribute_application_id
6251 and ATTRIBUTE_CODE = p_attribute_code
6252 and CATEGORY_NAME = p_category_name;
6253 if (sql%notfound) then
6254 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
6255 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_UPDATE_FAILED');
6256 FND_MSG_PUB.Add;
6257 end if;
6258 raise FND_API.G_EXC_ERROR;
6259 end if;
6260
6261 -- /** commit the update **/
6262 -- commit;
6263
6264 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_SUCCESS) THEN
6265 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_UPDATED');
6266 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||
6267 ' ' || p_region_code);
6268 FND_MSG_PUB.Add;
6269 end if;
6270
6271 end if;
6272
6273 end if; -- /* if not p_copy_redo_flag */
6274
6275 p_return_status := FND_API.G_RET_STS_SUCCESS;
6276
6277 FND_MSG_PUB.Count_And_Get (
6278 p_count => p_msg_count,
6279 p_data => p_msg_data);
6280
6281 EXCEPTION
6282 WHEN VALUE_ERROR THEN
6283 if FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
6284 FND_MESSAGE.SET_NAME('AK','AK_CATEGORY_VALUE_ERROR');
6285 FND_MESSAGE.SET_TOKEN('KEY', to_char(p_region_application_id) ||' '||
6286 p_region_code||' '||to_char(p_attribute_application_id)||' '||
6287 p_attribute_code||' '|| p_category_name ||' '||
6288 to_char(p_application_id));
6289 FND_MSG_PUB.Add;
6290 end if;
6291 p_return_status := FND_API.G_RET_STS_ERROR;
6292 rollback to start_update_category_usage;
6293 FND_MSG_PUB.Count_And_Get (
6294 p_count => p_msg_count,
6295 p_data => p_msg_data);
6296 WHEN OTHERS THEN
6297 p_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
6298 rollback to start_update_category_usage;
6299 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
6300 SUBSTR (SQLERRM, 1, 240) );
6301 FND_MSG_PUB.Add;
6302 FND_MSG_PUB.Build_Exc_Msg( G_PKG_NAME, l_api_name,
6303 'PK = '||to_char(p_region_application_id) ||' '||
6304 p_region_code||' '||to_char(p_attribute_application_id)||' '||
6305 p_attribute_code||' '|| p_category_name ||' '||
6306 to_char(p_application_id) );
6307 FND_MSG_PUB.Add;
6308 FND_MSG_PUB.Count_And_Get (
6309 p_count => p_msg_count,
6310 p_data => p_msg_data);
6311 FND_MSG_PUB.Count_And_Get (
6312 p_count => p_msg_count,
6313 p_data => p_msg_data);
6314
6315 end UPDATE_CATEGORY_USAGE;
6316
6317 end AK_REGION2_PVT;