64: x_return_status := fnd_api.g_ret_sts_success;
65: IF(p_geo_type is null OR p_geo_name is null
66: OR p_geo_code is null OR p_country_code is null) THEN
67: x_return_status := fnd_api.g_ret_sts_error;
68: fnd_message.set_name('JTF', 'JTF_TTY_NOT_NULL');
69: x_error_msg := fnd_message.Get();
70: -- check if parent geo is there
71: elsif (p_geo_type_exists_flag = 'N') THEN
72: x_return_status := fnd_api.g_ret_sts_error;
65: IF(p_geo_type is null OR p_geo_name is null
66: OR p_geo_code is null OR p_country_code is null) THEN
67: x_return_status := fnd_api.g_ret_sts_error;
68: fnd_message.set_name('JTF', 'JTF_TTY_NOT_NULL');
69: x_error_msg := fnd_message.Get();
70: -- check if parent geo is there
71: elsif (p_geo_type_exists_flag = 'N') THEN
72: x_return_status := fnd_api.g_ret_sts_error;
73: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
69: x_error_msg := fnd_message.Get();
70: -- check if parent geo is there
71: elsif (p_geo_type_exists_flag = 'N') THEN
72: x_return_status := fnd_api.g_ret_sts_error;
73: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
74: fnd_message.set_token('p_geo_type',p_geo_type);
75: x_error_msg := fnd_message.Get();
76: elsif (p_geo_type = 'STATE') THEN
77: BEGIN
70: -- check if parent geo is there
71: elsif (p_geo_type_exists_flag = 'N') THEN
72: x_return_status := fnd_api.g_ret_sts_error;
73: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
74: fnd_message.set_token('p_geo_type',p_geo_type);
75: x_error_msg := fnd_message.Get();
76: elsif (p_geo_type = 'STATE') THEN
77: BEGIN
78: SELECT 'Y'
71: elsif (p_geo_type_exists_flag = 'N') THEN
72: x_return_status := fnd_api.g_ret_sts_error;
73: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
74: fnd_message.set_token('p_geo_type',p_geo_type);
75: x_error_msg := fnd_message.Get();
76: elsif (p_geo_type = 'STATE') THEN
77: BEGIN
78: SELECT 'Y'
79: into p_parent_exists_flag
86: p_parent_exists_flag := 'N';
87: END;
88: if (p_parent_exists_flag = 'N') then
89: x_return_status := fnd_api.g_ret_sts_error;
90: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
91: fnd_message.set_token('p_geo_code',p_geo_code);
92: fnd_message.set_token('p_geo_type',p_geo_type);
93: fnd_message.set_token('p_country_code',p_country_code);
94: fnd_message.set_token('p_geo_name',p_geo_name);
87: END;
88: if (p_parent_exists_flag = 'N') then
89: x_return_status := fnd_api.g_ret_sts_error;
90: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
91: fnd_message.set_token('p_geo_code',p_geo_code);
92: fnd_message.set_token('p_geo_type',p_geo_type);
93: fnd_message.set_token('p_country_code',p_country_code);
94: fnd_message.set_token('p_geo_name',p_geo_name);
95: x_error_msg := fnd_message.Get();
88: if (p_parent_exists_flag = 'N') then
89: x_return_status := fnd_api.g_ret_sts_error;
90: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
91: fnd_message.set_token('p_geo_code',p_geo_code);
92: fnd_message.set_token('p_geo_type',p_geo_type);
93: fnd_message.set_token('p_country_code',p_country_code);
94: fnd_message.set_token('p_geo_name',p_geo_name);
95: x_error_msg := fnd_message.Get();
96: end if;
89: x_return_status := fnd_api.g_ret_sts_error;
90: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
91: fnd_message.set_token('p_geo_code',p_geo_code);
92: fnd_message.set_token('p_geo_type',p_geo_type);
93: fnd_message.set_token('p_country_code',p_country_code);
94: fnd_message.set_token('p_geo_name',p_geo_name);
95: x_error_msg := fnd_message.Get();
96: end if;
97: BEGIN
90: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
91: fnd_message.set_token('p_geo_code',p_geo_code);
92: fnd_message.set_token('p_geo_type',p_geo_type);
93: fnd_message.set_token('p_country_code',p_country_code);
94: fnd_message.set_token('p_geo_name',p_geo_name);
95: x_error_msg := fnd_message.Get();
96: end if;
97: BEGIN
98: SELECT 'Y'
91: fnd_message.set_token('p_geo_code',p_geo_code);
92: fnd_message.set_token('p_geo_type',p_geo_type);
93: fnd_message.set_token('p_country_code',p_country_code);
94: fnd_message.set_token('p_geo_name',p_geo_name);
95: x_error_msg := fnd_message.Get();
96: end if;
97: BEGIN
98: SELECT 'Y'
99: into p_exists_flag
107: p_exists_flag := 'N';
108: END;
109: if (p_exists_flag = 'Y') then
110: x_return_status := fnd_api.g_ret_sts_error;
111: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
112: -- fnd_message.set_token('p_geo_code',p_geo_code);
113: -- fnd_message.set_token('p_geo_type',p_geo_type);
114: -- fnd_message.set_token('p_country_code',p_country_code);
115: -- fnd_message.set_token('p_geo_name',p_geo_name);
108: END;
109: if (p_exists_flag = 'Y') then
110: x_return_status := fnd_api.g_ret_sts_error;
111: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
112: -- fnd_message.set_token('p_geo_code',p_geo_code);
113: -- fnd_message.set_token('p_geo_type',p_geo_type);
114: -- fnd_message.set_token('p_country_code',p_country_code);
115: -- fnd_message.set_token('p_geo_name',p_geo_name);
116: x_error_msg := fnd_message.Get();
109: if (p_exists_flag = 'Y') then
110: x_return_status := fnd_api.g_ret_sts_error;
111: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
112: -- fnd_message.set_token('p_geo_code',p_geo_code);
113: -- fnd_message.set_token('p_geo_type',p_geo_type);
114: -- fnd_message.set_token('p_country_code',p_country_code);
115: -- fnd_message.set_token('p_geo_name',p_geo_name);
116: x_error_msg := fnd_message.Get();
117: end if;
110: x_return_status := fnd_api.g_ret_sts_error;
111: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
112: -- fnd_message.set_token('p_geo_code',p_geo_code);
113: -- fnd_message.set_token('p_geo_type',p_geo_type);
114: -- fnd_message.set_token('p_country_code',p_country_code);
115: -- fnd_message.set_token('p_geo_name',p_geo_name);
116: x_error_msg := fnd_message.Get();
117: end if;
118: elsif (p_geo_type = 'PROVINCE') THEN
111: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
112: -- fnd_message.set_token('p_geo_code',p_geo_code);
113: -- fnd_message.set_token('p_geo_type',p_geo_type);
114: -- fnd_message.set_token('p_country_code',p_country_code);
115: -- fnd_message.set_token('p_geo_name',p_geo_name);
116: x_error_msg := fnd_message.Get();
117: end if;
118: elsif (p_geo_type = 'PROVINCE') THEN
119: BEGIN
112: -- fnd_message.set_token('p_geo_code',p_geo_code);
113: -- fnd_message.set_token('p_geo_type',p_geo_type);
114: -- fnd_message.set_token('p_country_code',p_country_code);
115: -- fnd_message.set_token('p_geo_name',p_geo_name);
116: x_error_msg := fnd_message.Get();
117: end if;
118: elsif (p_geo_type = 'PROVINCE') THEN
119: BEGIN
120: SELECT 'Y'
128: p_parent_exists_flag := 'N';
129: END;
130: if (p_parent_exists_flag = 'N') then
131: x_return_status := fnd_api.g_ret_sts_error;
132: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
133: fnd_message.set_token('p_geo_code',p_geo_code);
134: fnd_message.set_token('p_geo_type',p_geo_type);
135: fnd_message.set_token('p_country_code',p_country_code);
136: fnd_message.set_token('p_geo_name',p_geo_name);
129: END;
130: if (p_parent_exists_flag = 'N') then
131: x_return_status := fnd_api.g_ret_sts_error;
132: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
133: fnd_message.set_token('p_geo_code',p_geo_code);
134: fnd_message.set_token('p_geo_type',p_geo_type);
135: fnd_message.set_token('p_country_code',p_country_code);
136: fnd_message.set_token('p_geo_name',p_geo_name);
137: x_error_msg := fnd_message.Get();
130: if (p_parent_exists_flag = 'N') then
131: x_return_status := fnd_api.g_ret_sts_error;
132: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
133: fnd_message.set_token('p_geo_code',p_geo_code);
134: fnd_message.set_token('p_geo_type',p_geo_type);
135: fnd_message.set_token('p_country_code',p_country_code);
136: fnd_message.set_token('p_geo_name',p_geo_name);
137: x_error_msg := fnd_message.Get();
138: end if;
131: x_return_status := fnd_api.g_ret_sts_error;
132: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
133: fnd_message.set_token('p_geo_code',p_geo_code);
134: fnd_message.set_token('p_geo_type',p_geo_type);
135: fnd_message.set_token('p_country_code',p_country_code);
136: fnd_message.set_token('p_geo_name',p_geo_name);
137: x_error_msg := fnd_message.Get();
138: end if;
139: BEGIN
132: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
133: fnd_message.set_token('p_geo_code',p_geo_code);
134: fnd_message.set_token('p_geo_type',p_geo_type);
135: fnd_message.set_token('p_country_code',p_country_code);
136: fnd_message.set_token('p_geo_name',p_geo_name);
137: x_error_msg := fnd_message.Get();
138: end if;
139: BEGIN
140: SELECT 'Y'
133: fnd_message.set_token('p_geo_code',p_geo_code);
134: fnd_message.set_token('p_geo_type',p_geo_type);
135: fnd_message.set_token('p_country_code',p_country_code);
136: fnd_message.set_token('p_geo_name',p_geo_name);
137: x_error_msg := fnd_message.Get();
138: end if;
139: BEGIN
140: SELECT 'Y'
141: into p_exists_flag
149: p_exists_flag := 'N';
150: END;
151: if (p_exists_flag = 'Y') then
152: x_return_status := fnd_api.g_ret_sts_error;
153: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
154: -- fnd_message.set_token('p_geo_code',p_geo_code);
155: -- fnd_message.set_token('p_geo_type',p_geo_type);
156: -- fnd_message.set_token('p_country_code',p_country_code);
157: -- fnd_message.set_token('p_geo_name',p_geo_name);
150: END;
151: if (p_exists_flag = 'Y') then
152: x_return_status := fnd_api.g_ret_sts_error;
153: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
154: -- fnd_message.set_token('p_geo_code',p_geo_code);
155: -- fnd_message.set_token('p_geo_type',p_geo_type);
156: -- fnd_message.set_token('p_country_code',p_country_code);
157: -- fnd_message.set_token('p_geo_name',p_geo_name);
158: x_error_msg := fnd_message.Get();
151: if (p_exists_flag = 'Y') then
152: x_return_status := fnd_api.g_ret_sts_error;
153: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
154: -- fnd_message.set_token('p_geo_code',p_geo_code);
155: -- fnd_message.set_token('p_geo_type',p_geo_type);
156: -- fnd_message.set_token('p_country_code',p_country_code);
157: -- fnd_message.set_token('p_geo_name',p_geo_name);
158: x_error_msg := fnd_message.Get();
159: end if;
152: x_return_status := fnd_api.g_ret_sts_error;
153: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
154: -- fnd_message.set_token('p_geo_code',p_geo_code);
155: -- fnd_message.set_token('p_geo_type',p_geo_type);
156: -- fnd_message.set_token('p_country_code',p_country_code);
157: -- fnd_message.set_token('p_geo_name',p_geo_name);
158: x_error_msg := fnd_message.Get();
159: end if;
160: elsif (p_geo_type = 'COUNTY') THEN
153: fnd_message.set_name('JTF', 'JTF_TTY_GEO_UNIQUE');
154: -- fnd_message.set_token('p_geo_code',p_geo_code);
155: -- fnd_message.set_token('p_geo_type',p_geo_type);
156: -- fnd_message.set_token('p_country_code',p_country_code);
157: -- fnd_message.set_token('p_geo_name',p_geo_name);
158: x_error_msg := fnd_message.Get();
159: end if;
160: elsif (p_geo_type = 'COUNTY') THEN
161: BEGIN
154: -- fnd_message.set_token('p_geo_code',p_geo_code);
155: -- fnd_message.set_token('p_geo_type',p_geo_type);
156: -- fnd_message.set_token('p_country_code',p_country_code);
157: -- fnd_message.set_token('p_geo_name',p_geo_name);
158: x_error_msg := fnd_message.Get();
159: end if;
160: elsif (p_geo_type = 'COUNTY') THEN
161: BEGIN
162: IF (p_state_code is not NULL) THEN
181: p_parent_exists_flag := 'N';
182: END;
183: if (p_parent_exists_flag = 'N') then
184: x_return_status := fnd_api.g_ret_sts_error;
185: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
186: fnd_message.set_token('p_geo_code',p_geo_code);
187: fnd_message.set_token('p_geo_type',p_geo_type);
188: fnd_message.set_token('p_country_code',p_country_code);
189: fnd_message.set_token('p_geo_name',p_geo_name);
182: END;
183: if (p_parent_exists_flag = 'N') then
184: x_return_status := fnd_api.g_ret_sts_error;
185: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
186: fnd_message.set_token('p_geo_code',p_geo_code);
187: fnd_message.set_token('p_geo_type',p_geo_type);
188: fnd_message.set_token('p_country_code',p_country_code);
189: fnd_message.set_token('p_geo_name',p_geo_name);
190: x_error_msg := fnd_message.Get();
183: if (p_parent_exists_flag = 'N') then
184: x_return_status := fnd_api.g_ret_sts_error;
185: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
186: fnd_message.set_token('p_geo_code',p_geo_code);
187: fnd_message.set_token('p_geo_type',p_geo_type);
188: fnd_message.set_token('p_country_code',p_country_code);
189: fnd_message.set_token('p_geo_name',p_geo_name);
190: x_error_msg := fnd_message.Get();
191: end if;
184: x_return_status := fnd_api.g_ret_sts_error;
185: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
186: fnd_message.set_token('p_geo_code',p_geo_code);
187: fnd_message.set_token('p_geo_type',p_geo_type);
188: fnd_message.set_token('p_country_code',p_country_code);
189: fnd_message.set_token('p_geo_name',p_geo_name);
190: x_error_msg := fnd_message.Get();
191: end if;
192: elsif (p_geo_type = 'CITY') THEN
185: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
186: fnd_message.set_token('p_geo_code',p_geo_code);
187: fnd_message.set_token('p_geo_type',p_geo_type);
188: fnd_message.set_token('p_country_code',p_country_code);
189: fnd_message.set_token('p_geo_name',p_geo_name);
190: x_error_msg := fnd_message.Get();
191: end if;
192: elsif (p_geo_type = 'CITY') THEN
193: BEGIN
186: fnd_message.set_token('p_geo_code',p_geo_code);
187: fnd_message.set_token('p_geo_type',p_geo_type);
188: fnd_message.set_token('p_country_code',p_country_code);
189: fnd_message.set_token('p_geo_name',p_geo_name);
190: x_error_msg := fnd_message.Get();
191: end if;
192: elsif (p_geo_type = 'CITY') THEN
193: BEGIN
194: SELECT 'Y'
210: p_parent_exists_flag := 'N';
211: END;
212: if (p_parent_exists_flag = 'N') then
213: x_return_status := fnd_api.g_ret_sts_error;
214: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
215: fnd_message.set_token('p_geo_code',p_geo_code);
216: fnd_message.set_token('p_geo_type',p_geo_type);
217: fnd_message.set_token('p_country_code',p_country_code);
218: fnd_message.set_token('p_geo_name',p_geo_name);
211: END;
212: if (p_parent_exists_flag = 'N') then
213: x_return_status := fnd_api.g_ret_sts_error;
214: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
215: fnd_message.set_token('p_geo_code',p_geo_code);
216: fnd_message.set_token('p_geo_type',p_geo_type);
217: fnd_message.set_token('p_country_code',p_country_code);
218: fnd_message.set_token('p_geo_name',p_geo_name);
219: x_error_msg := fnd_message.Get();
212: if (p_parent_exists_flag = 'N') then
213: x_return_status := fnd_api.g_ret_sts_error;
214: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
215: fnd_message.set_token('p_geo_code',p_geo_code);
216: fnd_message.set_token('p_geo_type',p_geo_type);
217: fnd_message.set_token('p_country_code',p_country_code);
218: fnd_message.set_token('p_geo_name',p_geo_name);
219: x_error_msg := fnd_message.Get();
220: end if;
213: x_return_status := fnd_api.g_ret_sts_error;
214: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
215: fnd_message.set_token('p_geo_code',p_geo_code);
216: fnd_message.set_token('p_geo_type',p_geo_type);
217: fnd_message.set_token('p_country_code',p_country_code);
218: fnd_message.set_token('p_geo_name',p_geo_name);
219: x_error_msg := fnd_message.Get();
220: end if;
221: elsif (p_geo_type = 'POSTAL_CODE') THEN
214: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
215: fnd_message.set_token('p_geo_code',p_geo_code);
216: fnd_message.set_token('p_geo_type',p_geo_type);
217: fnd_message.set_token('p_country_code',p_country_code);
218: fnd_message.set_token('p_geo_name',p_geo_name);
219: x_error_msg := fnd_message.Get();
220: end if;
221: elsif (p_geo_type = 'POSTAL_CODE') THEN
222: BEGIN
215: fnd_message.set_token('p_geo_code',p_geo_code);
216: fnd_message.set_token('p_geo_type',p_geo_type);
217: fnd_message.set_token('p_country_code',p_country_code);
218: fnd_message.set_token('p_geo_name',p_geo_name);
219: x_error_msg := fnd_message.Get();
220: end if;
221: elsif (p_geo_type = 'POSTAL_CODE') THEN
222: BEGIN
223: SELECT 'Y'
244: p_parent_exists_flag := 'N';
245: END;
246: if (p_parent_exists_flag = 'N') then
247: x_return_status := fnd_api.g_ret_sts_error;
248: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
249: fnd_message.set_token('p_geo_code',p_geo_code);
250: fnd_message.set_token('p_geo_type',p_geo_type);
251: fnd_message.set_token('p_country_code',p_country_code);
252: fnd_message.set_token('p_geo_name',p_geo_name);
245: END;
246: if (p_parent_exists_flag = 'N') then
247: x_return_status := fnd_api.g_ret_sts_error;
248: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
249: fnd_message.set_token('p_geo_code',p_geo_code);
250: fnd_message.set_token('p_geo_type',p_geo_type);
251: fnd_message.set_token('p_country_code',p_country_code);
252: fnd_message.set_token('p_geo_name',p_geo_name);
253: x_error_msg := fnd_message.Get();
246: if (p_parent_exists_flag = 'N') then
247: x_return_status := fnd_api.g_ret_sts_error;
248: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
249: fnd_message.set_token('p_geo_code',p_geo_code);
250: fnd_message.set_token('p_geo_type',p_geo_type);
251: fnd_message.set_token('p_country_code',p_country_code);
252: fnd_message.set_token('p_geo_name',p_geo_name);
253: x_error_msg := fnd_message.Get();
254: end if;
247: x_return_status := fnd_api.g_ret_sts_error;
248: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
249: fnd_message.set_token('p_geo_code',p_geo_code);
250: fnd_message.set_token('p_geo_type',p_geo_type);
251: fnd_message.set_token('p_country_code',p_country_code);
252: fnd_message.set_token('p_geo_name',p_geo_name);
253: x_error_msg := fnd_message.Get();
254: end if;
255: END IF;
248: fnd_message.set_name('JTF', 'JTF_TTY_GEO_PARENT_NOTEXIST');
249: fnd_message.set_token('p_geo_code',p_geo_code);
250: fnd_message.set_token('p_geo_type',p_geo_type);
251: fnd_message.set_token('p_country_code',p_country_code);
252: fnd_message.set_token('p_geo_name',p_geo_name);
253: x_error_msg := fnd_message.Get();
254: end if;
255: END IF;
256: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
249: fnd_message.set_token('p_geo_code',p_geo_code);
250: fnd_message.set_token('p_geo_type',p_geo_type);
251: fnd_message.set_token('p_country_code',p_country_code);
252: fnd_message.set_token('p_geo_name',p_geo_name);
253: x_error_msg := fnd_message.Get();
254: end if;
255: END IF;
256: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
257: RAISE fnd_api.g_exc_error;
298: WHEN fnd_api.g_exc_error THEN
299: x_return_status := fnd_api.g_ret_sts_error;
300:
301: WHEN OTHERS THEN
302: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
303: fnd_message.set_token('P_SQLCODE', SQLCODE);
304: fnd_message.set_token('P_SQLERRM', SQLERRM);
305: fnd_message.set_token('P_API_NAME', l_api_name);
306: x_error_msg := fnd_message.Get();
299: x_return_status := fnd_api.g_ret_sts_error;
300:
301: WHEN OTHERS THEN
302: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
303: fnd_message.set_token('P_SQLCODE', SQLCODE);
304: fnd_message.set_token('P_SQLERRM', SQLERRM);
305: fnd_message.set_token('P_API_NAME', l_api_name);
306: x_error_msg := fnd_message.Get();
307: -- FND_MSG_PUB.add;
300:
301: WHEN OTHERS THEN
302: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
303: fnd_message.set_token('P_SQLCODE', SQLCODE);
304: fnd_message.set_token('P_SQLERRM', SQLERRM);
305: fnd_message.set_token('P_API_NAME', l_api_name);
306: x_error_msg := fnd_message.Get();
307: -- FND_MSG_PUB.add;
308: x_return_status := fnd_api.g_ret_sts_unexp_error;
301: WHEN OTHERS THEN
302: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
303: fnd_message.set_token('P_SQLCODE', SQLCODE);
304: fnd_message.set_token('P_SQLERRM', SQLERRM);
305: fnd_message.set_token('P_API_NAME', l_api_name);
306: x_error_msg := fnd_message.Get();
307: -- FND_MSG_PUB.add;
308: x_return_status := fnd_api.g_ret_sts_unexp_error;
309:
302: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
303: fnd_message.set_token('P_SQLCODE', SQLCODE);
304: fnd_message.set_token('P_SQLERRM', SQLERRM);
305: fnd_message.set_token('P_API_NAME', l_api_name);
306: x_error_msg := fnd_message.Get();
307: -- FND_MSG_PUB.add;
308: x_return_status := fnd_api.g_ret_sts_unexp_error;
309:
310: END create_geo;
332: x_return_status := fnd_api.g_ret_sts_success;
333: IF (p_geo_id is null OR p_geo_name is null) THEN
334: x_return_status := fnd_api.g_ret_sts_error;
335: x_return_status := fnd_api.g_ret_sts_error;
336: fnd_message.set_name('JTF', 'JTF_TTY_UPDATE_NOT_ENOUGHVALUES');
337: x_error_msg := fnd_message.Get();
338: END IF;
339: BEGIN
340: SELECT 'Y'
333: IF (p_geo_id is null OR p_geo_name is null) THEN
334: x_return_status := fnd_api.g_ret_sts_error;
335: x_return_status := fnd_api.g_ret_sts_error;
336: fnd_message.set_name('JTF', 'JTF_TTY_UPDATE_NOT_ENOUGHVALUES');
337: x_error_msg := fnd_message.Get();
338: END IF;
339: BEGIN
340: SELECT 'Y'
341: into p_exists_flag
346: p_exists_flag := 'N';
347: END;
348: IF (p_exists_flag = 'N') THEN
349: x_return_status := fnd_api.g_ret_sts_error;
350: fnd_message.set_name('JTF', 'JTF_TTY_GEOID_NOTEXIST');
351: fnd_message.set_token('p_geo_id',p_geo_id);
352: fnd_message.set_token('p_action_type','updated');
353: x_error_msg := fnd_message.Get();
354: END IF;
347: END;
348: IF (p_exists_flag = 'N') THEN
349: x_return_status := fnd_api.g_ret_sts_error;
350: fnd_message.set_name('JTF', 'JTF_TTY_GEOID_NOTEXIST');
351: fnd_message.set_token('p_geo_id',p_geo_id);
352: fnd_message.set_token('p_action_type','updated');
353: x_error_msg := fnd_message.Get();
354: END IF;
355: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
348: IF (p_exists_flag = 'N') THEN
349: x_return_status := fnd_api.g_ret_sts_error;
350: fnd_message.set_name('JTF', 'JTF_TTY_GEOID_NOTEXIST');
351: fnd_message.set_token('p_geo_id',p_geo_id);
352: fnd_message.set_token('p_action_type','updated');
353: x_error_msg := fnd_message.Get();
354: END IF;
355: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
356: RAISE fnd_api.g_exc_error;
349: x_return_status := fnd_api.g_ret_sts_error;
350: fnd_message.set_name('JTF', 'JTF_TTY_GEOID_NOTEXIST');
351: fnd_message.set_token('p_geo_id',p_geo_id);
352: fnd_message.set_token('p_action_type','updated');
353: x_error_msg := fnd_message.Get();
354: END IF;
355: IF (x_return_status <> fnd_api.g_ret_sts_success) THEN
356: RAISE fnd_api.g_exc_error;
357: END IF;
370: WHEN fnd_api.g_exc_error THEN
371: x_return_status := fnd_api.g_ret_sts_error;
372:
373: WHEN OTHERS THEN
374: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
375: fnd_message.set_token('P_SQLCODE', SQLCODE);
376: fnd_message.set_token('P_SQLERRM', SQLERRM);
377: fnd_message.set_token('P_API_NAME', l_api_name);
378: x_error_msg := fnd_message.Get();
371: x_return_status := fnd_api.g_ret_sts_error;
372:
373: WHEN OTHERS THEN
374: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
375: fnd_message.set_token('P_SQLCODE', SQLCODE);
376: fnd_message.set_token('P_SQLERRM', SQLERRM);
377: fnd_message.set_token('P_API_NAME', l_api_name);
378: x_error_msg := fnd_message.Get();
379: x_return_status := fnd_api.g_ret_sts_unexp_error;
372:
373: WHEN OTHERS THEN
374: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
375: fnd_message.set_token('P_SQLCODE', SQLCODE);
376: fnd_message.set_token('P_SQLERRM', SQLERRM);
377: fnd_message.set_token('P_API_NAME', l_api_name);
378: x_error_msg := fnd_message.Get();
379: x_return_status := fnd_api.g_ret_sts_unexp_error;
380: END update_geo;
373: WHEN OTHERS THEN
374: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
375: fnd_message.set_token('P_SQLCODE', SQLCODE);
376: fnd_message.set_token('P_SQLERRM', SQLERRM);
377: fnd_message.set_token('P_API_NAME', l_api_name);
378: x_error_msg := fnd_message.Get();
379: x_return_status := fnd_api.g_ret_sts_unexp_error;
380: END update_geo;
381:
374: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
375: fnd_message.set_token('P_SQLCODE', SQLCODE);
376: fnd_message.set_token('P_SQLERRM', SQLERRM);
377: fnd_message.set_token('P_API_NAME', l_api_name);
378: x_error_msg := fnd_message.Get();
379: x_return_status := fnd_api.g_ret_sts_unexp_error;
380: END update_geo;
381:
382: /***********************************************************
440: x_return_status := fnd_api.g_ret_sts_success;
441: IF(p_geo_type is null
442: OR p_geo_code is null OR p_country_code is null) THEN
443: x_return_status := fnd_api.g_ret_sts_error;
444: fnd_message.set_name('JTF', 'JTF_TTY_NOT_NULL');
445: x_error_msg := fnd_message.Get();
446: elsif(p_exists_flag = 'N') THEN
447: x_return_status := fnd_api.g_ret_sts_error;
448: fnd_message.set_name('JTF', 'JTF_TTY_GEO_NOTEXIST');
441: IF(p_geo_type is null
442: OR p_geo_code is null OR p_country_code is null) THEN
443: x_return_status := fnd_api.g_ret_sts_error;
444: fnd_message.set_name('JTF', 'JTF_TTY_NOT_NULL');
445: x_error_msg := fnd_message.Get();
446: elsif(p_exists_flag = 'N') THEN
447: x_return_status := fnd_api.g_ret_sts_error;
448: fnd_message.set_name('JTF', 'JTF_TTY_GEO_NOTEXIST');
449: x_error_msg := fnd_message.Get();
444: fnd_message.set_name('JTF', 'JTF_TTY_NOT_NULL');
445: x_error_msg := fnd_message.Get();
446: elsif(p_exists_flag = 'N') THEN
447: x_return_status := fnd_api.g_ret_sts_error;
448: fnd_message.set_name('JTF', 'JTF_TTY_GEO_NOTEXIST');
449: x_error_msg := fnd_message.Get();
450: -- check if parent geo is there
451: elsif (p_geo_type_exists_flag = 'N') THEN
452: x_return_status := fnd_api.g_ret_sts_error;
445: x_error_msg := fnd_message.Get();
446: elsif(p_exists_flag = 'N') THEN
447: x_return_status := fnd_api.g_ret_sts_error;
448: fnd_message.set_name('JTF', 'JTF_TTY_GEO_NOTEXIST');
449: x_error_msg := fnd_message.Get();
450: -- check if parent geo is there
451: elsif (p_geo_type_exists_flag = 'N') THEN
452: x_return_status := fnd_api.g_ret_sts_error;
453: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
449: x_error_msg := fnd_message.Get();
450: -- check if parent geo is there
451: elsif (p_geo_type_exists_flag = 'N') THEN
452: x_return_status := fnd_api.g_ret_sts_error;
453: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
454: fnd_message.set_token('p_geo_type',p_geo_type);
455: x_error_msg := fnd_message.Get();
456: elsif (p_geo_type = 'COUNTRY') THEN
457: if (p_delete_cascade_flag = 'N') THEN
450: -- check if parent geo is there
451: elsif (p_geo_type_exists_flag = 'N') THEN
452: x_return_status := fnd_api.g_ret_sts_error;
453: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
454: fnd_message.set_token('p_geo_type',p_geo_type);
455: x_error_msg := fnd_message.Get();
456: elsif (p_geo_type = 'COUNTRY') THEN
457: if (p_delete_cascade_flag = 'N') THEN
458: BEGIN
451: elsif (p_geo_type_exists_flag = 'N') THEN
452: x_return_status := fnd_api.g_ret_sts_error;
453: fnd_message.set_name('JTF', 'JTF_TTY_GEO_TYPE_INVALID');
454: fnd_message.set_token('p_geo_type',p_geo_type);
455: x_error_msg := fnd_message.Get();
456: elsif (p_geo_type = 'COUNTRY') THEN
457: if (p_delete_cascade_flag = 'N') THEN
458: BEGIN
459: SELECT 'Y'
467: p_child_exists_flag := 'N';
468: END;
469: if (p_child_exists_flag = 'Y') then
470: x_return_status := fnd_api.g_ret_sts_error;
471: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
472: x_error_msg := fnd_message.Get();
473: end if;
474: end if;
475: elsif (p_geo_type = 'STATE') THEN
468: END;
469: if (p_child_exists_flag = 'Y') then
470: x_return_status := fnd_api.g_ret_sts_error;
471: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
472: x_error_msg := fnd_message.Get();
473: end if;
474: end if;
475: elsif (p_geo_type = 'STATE') THEN
476: if (p_delete_cascade_flag = 'N') THEN
489: p_child_exists_flag := 'N';
490: END;
491: if (p_child_exists_flag = 'Y') then
492: x_return_status := fnd_api.g_ret_sts_error;
493: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
494: x_error_msg := fnd_message.Get();
495: end if;
496: end if;
497: elsif (p_geo_type = 'PROVINCE') THEN
490: END;
491: if (p_child_exists_flag = 'Y') then
492: x_return_status := fnd_api.g_ret_sts_error;
493: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
494: x_error_msg := fnd_message.Get();
495: end if;
496: end if;
497: elsif (p_geo_type = 'PROVINCE') THEN
498: if (p_delete_cascade_flag = 'N') THEN
511: p_child_exists_flag := 'N';
512: END;
513: if (p_child_exists_flag = 'Y') then
514: x_return_status := fnd_api.g_ret_sts_error;
515: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
516: x_error_msg := fnd_message.Get();
517: end if;
518: end if;
519: elsif (p_geo_type = 'COUNTY') THEN
512: END;
513: if (p_child_exists_flag = 'Y') then
514: x_return_status := fnd_api.g_ret_sts_error;
515: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
516: x_error_msg := fnd_message.Get();
517: end if;
518: end if;
519: elsif (p_geo_type = 'COUNTY') THEN
520: if (p_delete_cascade_flag = 'N') THEN
534: p_child_exists_flag := 'N';
535: END;
536: if (p_child_exists_flag = 'Y') then
537: x_return_status := fnd_api.g_ret_sts_error;
538: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
539: x_error_msg := fnd_message.Get();
540: end if;
541: end if;
542: elsif (p_geo_type = 'CITY') THEN
535: END;
536: if (p_child_exists_flag = 'Y') then
537: x_return_status := fnd_api.g_ret_sts_error;
538: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
539: x_error_msg := fnd_message.Get();
540: end if;
541: end if;
542: elsif (p_geo_type = 'CITY') THEN
543: if (p_delete_cascade_flag = 'N') THEN
558: p_child_exists_flag := 'N';
559: END;
560: if (p_child_exists_flag = 'Y') then
561: x_return_status := fnd_api.g_ret_sts_error;
562: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
563: x_error_msg := fnd_message.Get();
564: end if;
565: end if;
566: elsif (p_geo_type = 'POSTAL_CODE') THEN
559: END;
560: if (p_child_exists_flag = 'Y') then
561: x_return_status := fnd_api.g_ret_sts_error;
562: fnd_message.set_name('JTF', 'JTF_TTY_GEO_CHILDEXIST');
563: x_error_msg := fnd_message.Get();
564: end if;
565: end if;
566: elsif (p_geo_type = 'POSTAL_CODE') THEN
567: null;
592: WHEN fnd_api.g_exc_error THEN
593: x_return_status := fnd_api.g_ret_sts_error;
594:
595: WHEN OTHERS THEN
596: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
597: fnd_message.set_token('P_SQLCODE', SQLCODE);
598: fnd_message.set_token('P_SQLERRM', SQLERRM);
599: fnd_message.set_token('P_API_NAME', l_api_name);
600: x_error_msg := fnd_message.Get();
593: x_return_status := fnd_api.g_ret_sts_error;
594:
595: WHEN OTHERS THEN
596: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
597: fnd_message.set_token('P_SQLCODE', SQLCODE);
598: fnd_message.set_token('P_SQLERRM', SQLERRM);
599: fnd_message.set_token('P_API_NAME', l_api_name);
600: x_error_msg := fnd_message.Get();
601: -- FND_MSG_PUB.add;
594:
595: WHEN OTHERS THEN
596: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
597: fnd_message.set_token('P_SQLCODE', SQLCODE);
598: fnd_message.set_token('P_SQLERRM', SQLERRM);
599: fnd_message.set_token('P_API_NAME', l_api_name);
600: x_error_msg := fnd_message.Get();
601: -- FND_MSG_PUB.add;
602: x_return_status := fnd_api.g_ret_sts_unexp_error;
595: WHEN OTHERS THEN
596: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
597: fnd_message.set_token('P_SQLCODE', SQLCODE);
598: fnd_message.set_token('P_SQLERRM', SQLERRM);
599: fnd_message.set_token('P_API_NAME', l_api_name);
600: x_error_msg := fnd_message.Get();
601: -- FND_MSG_PUB.add;
602: x_return_status := fnd_api.g_ret_sts_unexp_error;
603:
596: fnd_message.set_name('JTF', 'JTF_TTY_GEO_API_OTHERS');
597: fnd_message.set_token('P_SQLCODE', SQLCODE);
598: fnd_message.set_token('P_SQLERRM', SQLERRM);
599: fnd_message.set_token('P_API_NAME', l_api_name);
600: x_error_msg := fnd_message.Get();
601: -- FND_MSG_PUB.add;
602: x_return_status := fnd_api.g_ret_sts_unexp_error;
603:
604: END delete_geo;