DBA Data[Home] [Help]

PACKAGE BODY: APPS.OZF_CLAIM_TYPE_PVT

Source


1 PACKAGE BODY OZF_Claim_Type_PVT AS
2 /* $Header: ozfvclmb.pls 120.3 2005/12/22 23:29:13 sshivali ship $ */
3 
4 g_pkg_name   CONSTANT VARCHAR2(30):='OZF_Claim_Type_PVT';
5 
6 OZF_DEBUG_HIGH_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_high);
7 
8 ---------------------------------------------------------------------
9 -- PROCEDURE
10 --    Create_Claim_Type
11 --
12 -- HISTORY
13 --    06/27/2000  Michelle Chang  Create.
14 ---------------------------------------------------------------------
15 PROCEDURE Create_Claim_Type(
16    p_api_version       IN  NUMBER
17   ,p_init_msg_list     IN  VARCHAR2  := FND_API.g_false
18   ,p_commit            IN  VARCHAR2  := FND_API.g_false
19   ,p_validation_level  IN  NUMBER    := FND_API.g_valid_level_full
20 
21   ,x_return_status     OUT NOCOPY VARCHAR2
22   ,x_msg_count         OUT NOCOPY NUMBER
23   ,x_msg_data          OUT NOCOPY VARCHAR2
24 
25   ,p_claim_rec         IN  claim_rec_type
26   ,x_claim_type_id     OUT NOCOPY NUMBER
27 )
28 IS
29    l_api_version CONSTANT NUMBER       := 1.0;
30    l_api_name    CONSTANT VARCHAR2(30) := 'Create_Claim_Type';
31    l_full_name   CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
32 
33    l_return_status         VARCHAR2(1);
34    l_claim_rec             claim_rec_type := p_claim_rec;
35 
36    l_object_version_number NUMBER := 1;
37 
38    l_claim_check           VARCHAR2(10);
39 
40    l_rowid                 VARCHAR2(80);
41 
42    -- Cursor to get the sequence for claim_type_id
43    CURSOR c_claim_seq IS
44    SELECT ozf_claim_types_all_b_s.NEXTVAL
45      FROM DUAL;
46 
47    -- Cursor to validate the uniqueness of the claim_type_id
48    CURSOR c_claim_count(cv_claim_type_id IN NUMBER) IS
49    SELECT  'ANYTHING'
50      FROM  ozf_claim_types_VL
51      WHERE claim_type_id = cv_claim_type_id;
52 
53 BEGIN
54 
55    --------------------- initialize -----------------------
56    SAVEPOINT Create_Claim_Type;
57 
58    IF OZF_DEBUG_HIGH_ON THEN
59       OZF_Utility_PVT.debug_message(l_full_name||': start');
60    END IF;
61 
62    IF FND_API.to_boolean(p_init_msg_list) THEN
63       FND_MSG_PUB.initialize;
64    END IF;
65 
66    IF NOT FND_API.compatible_api_call(
67          l_api_version,
68          p_api_version,
69          l_api_name,
70          g_pkg_name
71    ) THEN
72       RAISE FND_API.g_exc_unexpected_error;
73    END IF;
74 
75    x_return_status := FND_API.g_ret_sts_success;
76 
77    ----------------------- validate -----------------------
78    IF OZF_DEBUG_HIGH_ON THEN
79       OZF_Utility_PVT.debug_message(l_full_name ||': validate');
80    END IF;
81 
82    Validate_Claim_Type(
83       p_api_version      => l_api_version,
84       p_init_msg_list    => p_init_msg_list,
85       p_validation_level => p_validation_level,
86       x_return_status    => l_return_status,
87       x_msg_count        => x_msg_count,
88       x_msg_data         => x_msg_data,
89       p_claim_rec        => l_claim_rec
90    );
91 
92 
93    IF l_return_status = FND_API.g_ret_sts_error THEN
94       RAISE FND_API.g_exc_error;
95    ELSIF l_return_status = FND_API.g_ret_sts_unexp_error THEN
96       RAISE FND_API.g_exc_unexpected_error;
97    END IF;
98 
99 
100   -------------------------- insert --------------------------
101   IF OZF_DEBUG_HIGH_ON THEN
102      OZF_Utility_PVT.debug_message(l_full_name ||': insert');
103   END IF;
104 
105   IF l_claim_rec.claim_type_id IS NULL THEN
106     LOOP
107       -- Get the identifier
108       OPEN  c_claim_seq;
109       FETCH c_claim_seq INTO l_claim_rec.claim_type_id;
110       CLOSE c_claim_seq;
111 
112       -- Check the uniqueness of the identifier
113       OPEN  c_claim_count(l_claim_rec.claim_type_id);
114       FETCH c_claim_count INTO l_claim_check;
115         -- Exit when the identifier uniqueness is established
116         EXIT WHEN c_claim_count%ROWCOUNT = 0;
117       CLOSE c_claim_count;
118    END LOOP;
119   END IF;
120 
121   BEGIN
122     OZF_claim_types_All_PKG.INSERT_ROW (
123       X_ROWID                   => l_rowid,
124       X_CLAIM_TYPE_ID           => l_claim_rec.claim_type_id,
125       X_OBJECT_VERSION_NUMBER   => l_object_version_number,
126       X_REQUEST_ID              => FND_GLOBAL.conc_request_id,
127       X_CREATED_FROM            => NULL,
128       X_CLAIM_CLASS             => l_claim_rec.claim_class,
129       X_SET_OF_BOOKS_ID         => l_claim_rec.set_of_books_id,
130       X_POST_TO_GL_FLAG         => l_claim_rec.post_to_gl_flag,
131       X_START_DATE              => l_claim_rec.start_date,
132       X_END_DATE                => l_claim_rec.end_date,
133       X_CREATION_SIGN           => l_claim_rec.creation_sign,
134       X_GL_ID_DED_ADJ           => l_claim_rec.gl_id_ded_adj,
135       X_GL_ID_DED_ADJ_CLEARING  => l_claim_rec.gl_id_ded_adj_clearing,
136       X_GL_ID_DED_CLEARING      => l_claim_rec.gl_id_ded_clearing,
137       X_GL_ID_ACCR_PROMO_LIAB   => l_claim_rec.gl_id_accr_promo_liab,
138       X_TRANSACTION_TYPE        => l_claim_rec.transaction_type,
139       X_CM_TRX_TYPE_ID          => l_claim_rec.cm_trx_type_id,
140       X_DM_TRX_TYPE_ID          => l_claim_rec.dm_trx_type_id,
141       X_CB_TRX_TYPE_ID          => l_claim_rec.cb_trx_type_id,
142       X_WO_REC_TRX_ID           => l_claim_rec.wo_rec_trx_id,
143       X_ADJ_REC_TRX_ID          => l_claim_rec.adj_rec_trx_id,
144       X_ATTRIBUTE_CATEGORY      => l_claim_rec.attribute_category,
145       X_ATTRIBUTE1              => l_claim_rec.attribute1,
146       X_ATTRIBUTE2              => l_claim_rec.attribute2,
147       X_ATTRIBUTE3              => l_claim_rec.attribute3,
148       X_ATTRIBUTE4              => l_claim_rec.attribute4,
149       X_ATTRIBUTE5              => l_claim_rec.attribute5,
150       X_ATTRIBUTE6              => l_claim_rec.attribute6,
151       X_ATTRIBUTE7              => l_claim_rec.attribute7,
152       X_ATTRIBUTE8              => l_claim_rec.attribute8,
153       X_ATTRIBUTE9              => l_claim_rec.attribute9,
154       X_ATTRIBUTE10             => l_claim_rec.attribute10,
155       X_ATTRIBUTE11             => l_claim_rec.attribute11,
156       X_ATTRIBUTE12             => l_claim_rec.attribute12,
157       X_ATTRIBUTE13             => l_claim_rec.attribute13,
158       X_ATTRIBUTE14             => l_claim_rec.attribute14,
159       X_ATTRIBUTE15             => l_claim_rec.attribute15,
160       X_NAME                    => l_claim_rec.name,
161       X_DESCRIPTION             => l_claim_rec.description,
162       X_CREATION_DATE           => SYSDATE,
163       X_CREATED_BY              => NVL(FND_GLOBAL.user_id, -1),
164       X_LAST_UPDATE_DATE        => SYSDATE,
165       X_LAST_UPDATED_BY         => NVL(FND_GLOBAL.user_id, -1),
166       X_LAST_UPDATE_LOGIN       => NVL(FND_GLOBAL.conc_login_id, -1),
167       x_adjustment_type         => l_claim_rec.adjustment_type,
168       X_ORDER_TYPE_ID          => l_claim_rec.order_type_id,
169       X_NEG_WO_REC_TRX_ID      => l_claim_rec.neg_wo_rec_trx_id,
170       X_GL_BALANCING_FLEX_VALUE      => l_claim_rec.gl_balancing_flex_value,
171       X_ORG_ID                      => l_claim_rec.org_id  -- R12 Enhancement
172     );
173   EXCEPTION
174     WHEN OTHERS THEN
175     RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
176   END;
177 
178 
179   ------------------------- finish -------------------------------
180   x_claim_type_id := l_claim_rec.claim_type_id;
181 
182   -- Check for commit
183     IF FND_API.to_boolean(p_commit) THEN
184       COMMIT;
185     END IF;
186 
187   FND_MSG_PUB.count_and_get(
188          p_encoded => FND_API.g_false,
189          p_count   => x_msg_count,
190          p_data    => x_msg_data
191   );
192 
193   IF OZF_DEBUG_HIGH_ON THEN
194      OZF_Utility_PVT.debug_message(l_full_name ||': end');
195   END IF;
196 
197 EXCEPTION
198 
199     WHEN FND_API.g_exc_error THEN
200       ROLLBACK TO Create_Claim_Type;
201       x_return_status := FND_API.g_ret_sts_error;
202       FND_MSG_PUB.count_and_get (
203            p_encoded => FND_API.g_false
204           ,p_count   => x_msg_count
205           ,p_data    => x_msg_data
206           );
207 
208     WHEN FND_API.g_exc_unexpected_error THEN
209       ROLLBACK TO Create_Claim_Type;
210       x_return_status := FND_API.g_ret_sts_unexp_error ;
211       FND_MSG_PUB.count_and_get (
212            p_encoded => FND_API.g_false
213           ,p_count   => x_msg_count
214           ,p_data    => x_msg_data
215           );
216 
217     WHEN OTHERS THEN
218       ROLLBACK TO Create_Claim_Type;
219       x_return_status := FND_API.g_ret_sts_unexp_error ;
220 
221       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
222     THEN
223          FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
224       END IF;
225 
226       FND_MSG_PUB.count_and_get(
227            p_encoded => FND_API.g_false
228           ,p_count   => x_msg_count
229           ,p_data    => x_msg_data
230           );
231 
232 END Create_Claim_Type;
233 
234 
235 ---------------------------------------------------------------
236 -- PROCEDURE
237 --    Delete_Claim_Type
238 --
239 -- HISTORY
240 --    06/27/2000  Michelle Chang  Create.
241 --    02/05/2001  MCHANG  Add checking: Claim Type can't be deleted if it
242 --                                      is using by an existing claim.
243 ---------------------------------------------------------------
244 PROCEDURE Delete_Claim_Type(
245    p_api_version       IN  NUMBER
246   ,p_init_msg_list     IN  VARCHAR2 := FND_API.g_false
247   ,p_commit            IN  VARCHAR2 := FND_API.g_false
248 
249   ,x_return_status     OUT NOCOPY VARCHAR2
250   ,x_msg_count         OUT NOCOPY NUMBER
251   ,x_msg_data          OUT NOCOPY VARCHAR2
252 
253   ,p_claim_type_id     IN  NUMBER
254   ,p_claim_org_id      IN  NUMBER
255   ,p_object_version    IN  NUMBER
256 )
257 IS
258 
259    l_api_version CONSTANT NUMBER       := 1.0;
260    l_api_name    CONSTANT VARCHAR2(30) := 'Delete_Claim_Type';
261    l_full_name   CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
262 
263    l_cLaim_check          VARCHAR2(10);
264    l_claim_using_check    NUMBER;
265    -- Cursor to validate the existing of the record to be deleted
266    CURSOR c_claim_count(cv_claim_type_id IN NUMBER, cv_obj_ver_num IN NUMBER) IS
267    SELECT  COUNT(claim_type_id)
268      FROM  ozf_claim_types_VL
269      WHERE claim_type_id = cv_claim_type_id
270      AND   object_version_number = cv_obj_ver_num;
271 
272    CURSOR c_claim_using(cv_claim_type_id IN NUMBER) IS
273    SELECT  claim_id
274      FROM  ozf_claims
275      WHERE claim_type_id = cv_claim_type_id;
276 
277    CURSOR c_adjustment_using(cv_adjustment_type_id IN NUMBER) IS
278    SELECT  utilization_id
279      FROM  ozf_funds_utilized_vl
280      WHERE adjustment_type_id = cv_adjustment_type_id;
281 
282    CURSOR c_approval_using(cv_claim_type_id IN VARCHAR2) IS
283    SELECT approval_detail_id
284    FROM   ams_approval_details
285    WHERE  approval_object_type = cv_claim_type_id
286      AND  approval_object IN ('FUND','CLAM')
287      AND  approval_type IN ('BUDGET','CLAIM');
288 BEGIN
289 
290    --------------------- initialize -----------------------
291    SAVEPOINT Delete_Claim_Type;
292 
293    IF OZF_DEBUG_HIGH_ON THEN
294       OZF_Utility_PVT.debug_message(l_full_name||': start');
295    END IF;
296 
297    IF FND_API.to_boolean(p_init_msg_list) THEN
298       FND_MSG_PUB.initialize;
299    END IF;
300 
301    IF NOT FND_API.compatible_api_call(
302          l_api_version,
303          p_api_version,
304          l_api_name,
305          g_pkg_name
306    ) THEN
307       RAISE FND_API.g_exc_unexpected_error;
308    END IF;
309 
310    x_return_status := FND_API.G_RET_STS_SUCCESS;
311 
312    ------------------------ delete ------------------------
313    IF OZF_DEBUG_HIGH_ON THEN
314       OZF_Utility_PVT.debug_message(l_full_name ||': delete');
315    END IF;
316 
317    -- Adjustment types cannot be deleted if the claim_type_id is less than 0
318    IF p_claim_type_id < 0 THEN
319      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
320        -- FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TYPE_NO_DEL');
321        FND_MESSAGE.set_name('OZF', 'OZF_ADJ_TYPE_NO_DEL');
322        FND_MSG_PUB.add;
323      END IF;
324      RAISE FND_API.g_exc_error;
325    END IF;
326 
327    IF OZF_DEBUG_HIGH_ON THEN
328       OZF_Utility_PVT.debug_message(p_claim_type_id ||': p_claim_type_id');
329       OZF_Utility_PVT.debug_message(p_object_version ||': p_object_version');
330    END IF;
331 
332    OPEN  c_claim_count(p_claim_type_id, p_object_version);
333    FETCH c_claim_count INTO l_claim_check;
334    IF (c_claim_count%ROWCOUNT = 0) THEN
335      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
336        FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
337        FND_MSG_PUB.add;
338      END IF;
339      CLOSE c_claim_count;
340      RAISE FND_API.g_exc_error;
341    END IF;
342    CLOSE c_claim_count;
343 
344    -- Claim Type cannot be deleted if it is using by an existing claim.
345    OPEN  c_claim_using(p_claim_type_id);
346    FETCH c_claim_using INTO l_claim_using_check;
347    IF (c_claim_using%ROWCOUNT > 0) THEN
348      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
349        FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TYPE_USED');
350        FND_MSG_PUB.add;
351      END IF;
352      CLOSE c_claim_using;
353      RAISE FND_API.g_exc_error;
354    END IF;
355    CLOSE c_claim_using;
356 
357    -- Adjustment Type cannot be deleted if it is using by an funds utilized rec.
358    OPEN c_adjustment_using(p_claim_type_id);
359    FETCH c_adjustment_using INTO l_claim_using_check;
360    IF (c_adjustment_using%ROWCOUNT > 0) THEN
361      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
362        FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TYPE_ADJ_USED');
363        FND_MSG_PUB.add;
364      END IF;
365      CLOSE c_adjustment_using;
366      RAISE FND_API.g_exc_error;
367    END IF;
368    CLOSE c_adjustment_using;
369 
370    -- Claim Types can not be deleted when used in approval rules.
371    OPEN c_approval_using(p_claim_type_id);
372    FETCH c_approval_using INTO l_claim_using_check;
373    IF (c_approval_using%ROWCOUNT > 0) THEN
374      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
375        FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TYPE_APPROVAL_USED');
376        FND_MSG_PUB.add;
377      END IF;
378      CLOSE c_approval_using;
379      RAISE FND_API.g_exc_error;
380    END IF;
381    CLOSE c_approval_using;
382 
383 
384   IF OZF_DEBUG_HIGH_ON THEN
385       OZF_Utility_PVT.debug_message(l_claim_using_check ||': not aaaa using by any claim');
386    END IF;
387 
388 
389    BEGIN
390        OZF_claim_types_All_PKG.DELETE_ROW (
391            X_CLAIM_TYPE_ID  => p_claim_type_id,
392 	   X_ORG_ID  => p_claim_org_id
393        );
394 
395 
396    IF OZF_DEBUG_HIGH_ON THEN
397       OZF_Utility_PVT.debug_message(': After deleting');
398    END IF;
399 
400    EXCEPTION
401      WHEN OTHERS THEN
402        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
403    END;
404 
405    -------------------- finish --------------------------
406    IF FND_API.to_boolean(p_commit) THEN
407       COMMIT;
408    END IF;
409 
410    FND_MSG_PUB.count_and_get(
411          p_encoded => FND_API.g_false,
412          p_count   => x_msg_count,
413          p_data    => x_msg_data
414    );
415 
416    IF OZF_DEBUG_HIGH_ON THEN
417       OZF_Utility_PVT.debug_message(l_full_name ||': end');
418    END IF;
419 
420 EXCEPTION
421 
422    WHEN FND_API.g_exc_error THEN
423       ROLLBACK TO Delete_Claim_Type;
424       x_return_status := FND_API.g_ret_sts_error;
425       FND_MSG_PUB.count_and_get(
426             p_encoded => FND_API.g_false,
427             p_count   => x_msg_count,
428             p_data    => x_msg_data
429       );
430 
431    WHEN FND_API.g_exc_unexpected_error THEN
432       ROLLBACK TO Delete_Claim_Type;
433       x_return_status := FND_API.g_ret_sts_unexp_error ;
434       FND_MSG_PUB.count_and_get(
435             p_encoded => FND_API.g_false,
436             p_count   => x_msg_count,
437             p_data    => x_msg_data
438       );
439 
440    WHEN OTHERS THEN
441       ROLLBACK TO Delete_Claim_Type;
442       x_return_status := FND_API.g_ret_sts_unexp_error ;
443 
444       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
445     THEN
446          FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
447       END IF;
448 
449       FND_MSG_PUB.count_and_get(
450             p_encoded => FND_API.g_false,
451             p_count   => x_msg_count,
452             p_data    => x_msg_data
453       );
454 
455 END Delete_Claim_Type;
456 
457 
458 ---------------------------------------------------------------------
459 -- PROCEDURE
460 --    Update_Claim_Type
461 --
462 -- HISTORY
463 --    06/27/2000  Michelle Chang  Create.
464 ----------------------------------------------------------------------
465 PROCEDURE Update_Claim_Type(
466    p_api_version       IN  NUMBER
467   ,p_init_msg_list     IN  VARCHAR2  := FND_API.g_false
468   ,p_commit            IN  VARCHAR2  := FND_API.g_false
469   ,p_validation_level  IN  NUMBER    := FND_API.g_valid_level_full
470 
471   ,x_return_status     OUT NOCOPY VARCHAR2
472   ,x_msg_count         OUT NOCOPY NUMBER
473   ,x_msg_data          OUT NOCOPY VARCHAR2
474 
475   ,p_claim_rec         IN  claim_rec_type
476   ,p_mode              IN  VARCHAR2 := 'UPDATE'
477   ,x_object_version    OUT NOCOPY NUMBER
478 )
479 IS
480 
481    l_api_version CONSTANT NUMBER := 1.0;
482    l_api_name    CONSTANT VARCHAR2(30) := 'Update_Claim_Type';
483    l_full_name   CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
484 
485    l_p_claim_rec     claim_rec_type  := p_claim_rec;
486    l_claim_rec       claim_rec_type;
487    l_return_status   VARCHAR2(1);
488    l_object_version  NUMBER;
489    l_claim_check          VARCHAR2(10);
490    -- Cursor to validate the existing of the record to be updated
491    CURSOR c_claim_count(cv_claim_type_id IN NUMBER, cv_obj_ver_num IN NUMBER) IS
492    SELECT  COUNT(claim_type_id)
493      FROM  ozf_claim_types_VL
494      WHERE claim_type_id = cv_claim_type_id
495      AND   object_version_number = cv_obj_ver_num;
496 
497 BEGIN
498 
499    -------------------- initialize -------------------------
500    SAVEPOINT Update_Claim_Type;
501 
502    IF OZF_DEBUG_HIGH_ON THEN
503       OZF_Utility_PVT.debug_message(l_full_name||': start');
504    END IF;
505 
506    IF FND_API.to_boolean(p_init_msg_list) THEN
507       FND_MSG_PUB.initialize;
508    END IF;
509 
510    IF NOT FND_API.compatible_api_call(
511          l_api_version,
512          p_api_version,
513          l_api_name,
514          g_pkg_name
515    ) THEN
516       RAISE FND_API.g_exc_unexpected_error;
517    END IF;
518 
519    x_return_status := FND_API.G_RET_STS_SUCCESS;
520 
521 
522 
523    ----------------------- validate ----------------------
524    IF OZF_DEBUG_HIGH_ON THEN
525       OZF_Utility_PVT.debug_message(l_full_name ||': validate');
526    END IF;
527 
528    OPEN  c_claim_count(p_claim_rec.claim_type_id, p_claim_rec.object_version_number);
529    FETCH c_claim_count INTO l_claim_check;
530    IF (c_claim_count%ROWCOUNT = 0) THEN
531        IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
532             FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
533             FND_MSG_PUB.add;
534        END IF;
535        CLOSE c_claim_count;
536        RAISE FND_API.g_exc_error;
537    END IF;
538    CLOSE c_claim_count;
539 
540    -- Adjustment types cannot be updated if the claim_type_id is less than 0
541    IF p_claim_rec.claim_type_id < 0 THEN
542      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
543        --FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TYPE_NO_UPDATE');
544        FND_MESSAGE.set_name('OZF', 'OZF_ADJ_TYPE_NO_UPDATE');
545        FND_MSG_PUB.add;
546      END IF;
547      RAISE FND_API.g_exc_error;
548    END IF;
549 
550    -- replace g_miss_char/num/date with current column values
551    Complete_Claim_Type_Rec(p_claim_rec, l_claim_rec);
552 
553    IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
554       Check_Claim_Type_Items(
555          p_claim_rec       => l_claim_rec,
556          p_validation_mode => JTF_PLSQL_API.g_update,
557          x_return_status   => l_return_status
558       );
559 
560       IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
561          RAISE FND_API.g_exc_unexpected_error;
562       ELSIF l_return_status = FND_API.g_ret_sts_error THEN
563          RAISE FND_API.g_exc_error;
564       END IF;
565    END IF;
566 
567 
568    IF p_validation_level >= JTF_PLSQL_API.g_valid_level_record THEN
569       Check_Claim_Type_Record(
570          p_claim_rec       => p_claim_rec,
571          p_complete_rec    => l_claim_rec,
572          x_return_status   => l_return_status
573       );
574 
575       IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
576          RAISE FND_API.g_exc_unexpected_error;
577       ELSIF l_return_status = FND_API.g_ret_sts_error THEN
578          RAISE FND_API.g_exc_error;
579       END IF;
580    END IF;
581 
582    l_object_version := l_claim_rec.object_version_number + 1;
583    -------------------------- update --------------------
584    IF OZF_DEBUG_HIGH_ON THEN
585       OZF_Utility_PVT.debug_message(l_full_name ||': KISH update');
586    END IF;
587 
588 
589    BEGIN
590        OZF_claim_types_All_PKG.UPDATE_ROW (
591           X_CLAIM_TYPE_ID          => l_claim_rec.claim_type_id,
592           X_OBJECT_VERSION_NUMBER  => l_object_version,
593           X_REQUEST_ID             => FND_GLOBAL.conc_request_id,
594           X_CREATED_FROM           => l_claim_rec.created_from,
595           X_CLAIM_CLASS            => l_claim_rec.claim_class,
596           X_SET_OF_BOOKS_ID        => l_claim_rec.set_of_books_id,
597           X_POST_TO_GL_FLAG        => l_claim_rec.post_to_gl_flag,
598           X_START_DATE             => l_claim_rec.start_date,
599           X_END_DATE               => l_claim_rec.end_date,
600           X_CREATION_SIGN          => l_claim_rec.creation_sign,
601           X_GL_ID_DED_ADJ          => l_claim_rec.gl_id_ded_adj,
602           X_GL_ID_DED_ADJ_CLEARING => l_claim_rec.gl_id_ded_adj_clearing,
603           X_GL_ID_DED_CLEARING     => l_claim_rec.gl_id_ded_clearing,
604           X_GL_ID_ACCR_PROMO_LIAB  => l_claim_rec.gl_id_accr_promo_liab,
605           X_TRANSACTION_TYPE       => l_claim_rec.transaction_type,
606           X_CM_TRX_TYPE_ID         => l_claim_rec.cm_trx_type_id,
607           X_DM_TRX_TYPE_ID         => l_claim_rec.dm_trx_type_id,
608           X_CB_TRX_TYPE_ID         => l_claim_rec.cb_trx_type_id,
609           X_WO_REC_TRX_ID          => l_claim_rec.wo_rec_trx_id,
610           X_ADJ_REC_TRX_ID         => l_claim_rec.adj_rec_trx_id,
611           X_ATTRIBUTE_CATEGORY     => l_claim_rec.attribute_category,
612           X_ATTRIBUTE1             => l_claim_rec.attribute1,
613           X_ATTRIBUTE2             => l_claim_rec.attribute2,
614           X_ATTRIBUTE3             => l_claim_rec.attribute3,
615           X_ATTRIBUTE4             => l_claim_rec.attribute4,
616           X_ATTRIBUTE5             => l_claim_rec.attribute5,
617           X_ATTRIBUTE6             => l_claim_rec.attribute6,
618           X_ATTRIBUTE7             => l_claim_rec.attribute7,
619           X_ATTRIBUTE8             => l_claim_rec.attribute8,
620           X_ATTRIBUTE9             => l_claim_rec.attribute9,
621           X_ATTRIBUTE10            => l_claim_rec.attribute10,
622           X_ATTRIBUTE11            => l_claim_rec.attribute11,
623           X_ATTRIBUTE12            => l_claim_rec.attribute12,
624           X_ATTRIBUTE13            => l_claim_rec.attribute13,
625           X_ATTRIBUTE14            => l_claim_rec.attribute14,
626           X_ATTRIBUTE15            => l_claim_rec.attribute15,
627           X_NAME                   => l_claim_rec.name,
628           X_DESCRIPTION            => l_claim_rec.description,
629           X_LAST_UPDATE_DATE       => SYSDATE,
630           X_LAST_UPDATED_BY        => NVL(FND_GLOBAL.user_id,-1),
631           X_LAST_UPDATE_LOGIN      => NVL(FND_GLOBAL.conc_login_id,-1),
632           x_adjustment_type        => l_claim_rec.adjustment_type,
633           X_ORDER_TYPE_ID         => l_claim_rec.order_type_id,
634 	  X_NEG_WO_REC_TRX_ID      => l_claim_rec.neg_wo_rec_trx_id,
635 	  X_GL_BALANCING_FLEX_VALUE  => l_claim_rec.gl_balancing_flex_value,
636 	  X_ORG_ID                  => l_claim_rec.org_id
637        );
638    EXCEPTION
639      WHEN OTHERS THEN
640        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
641    END;
642 
643    -------------------- finish --------------------------
644    x_object_version := l_object_version;
645 
646    -- Check for commit
647    IF FND_API.to_boolean(p_commit) THEN
648       COMMIT;
649    END IF;
650 
651    FND_MSG_PUB.count_and_get(
652          p_encoded => FND_API.g_false,
653          p_count   => x_msg_count,
654          p_data    => x_msg_data
655    );
656 
657    IF OZF_DEBUG_HIGH_ON THEN
658       OZF_Utility_PVT.debug_message(l_full_name ||': end');
659    END IF;
660 
661 EXCEPTION
662 
663    WHEN FND_API.g_exc_error THEN
664       ROLLBACK TO Update_Claim_Type;
665       x_return_status := FND_API.g_ret_sts_error;
666       FND_MSG_PUB.count_and_get(
667             p_encoded => FND_API.g_false,
668             p_count   => x_msg_count,
669             p_data    => x_msg_data
670       );
671 
672    WHEN FND_API.g_exc_unexpected_error THEN
673       ROLLBACK TO Update_Claim_Type;
674       x_return_status := FND_API.g_ret_sts_unexp_error ;
675       FND_MSG_PUB.count_and_get(
676             p_encoded => FND_API.g_false,
677             p_count   => x_msg_count,
678             p_data    => x_msg_data
679       );
680 
681    WHEN OTHERS THEN
682       ROLLBACK TO Update_Claim_Type;
683       x_return_status := FND_API.g_ret_sts_unexp_error ;
684 
685       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
686     THEN
687          FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
688       END IF;
689 
690       FND_MSG_PUB.count_and_get(
691             p_encoded => FND_API.g_false,
692             p_count   => x_msg_count,
693             p_data    => x_msg_data
694       );
695 
696 END Update_Claim_Type;
697 
698 
699 --------------------------------------------------------------------
700 -- PROCEDURE
701 --    Validate_Claim_Type
702 --
703 -- HISTORY
704 --    06/27/2000  Michelle Chang  Create.
705 --------------------------------------------------------------------
706 PROCEDURE Validate_Claim_Type(
707    p_api_version       IN  NUMBER
708   ,p_init_msg_list     IN  VARCHAR2  := FND_API.g_false
709   ,p_validation_level  IN  NUMBER    := FND_API.g_valid_level_full
710 
711   ,x_return_status     OUT NOCOPY VARCHAR2
712   ,x_msg_count         OUT NOCOPY NUMBER
713   ,x_msg_data          OUT NOCOPY VARCHAR2
714 
715   ,p_claim_rec         IN  claim_rec_type
716 )
717 IS
718 
719    l_api_version CONSTANT NUMBER       := 1.0;
720    l_api_name    CONSTANT VARCHAR2(30) := 'Validate_Claim_Type';
721    l_full_name   CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
722    l_return_status VARCHAR2(1);
723 
724 BEGIN
725 
726    ----------------------- initialize --------------------
727    IF OZF_DEBUG_HIGH_ON THEN
728       OZF_Utility_PVT.debug_message(l_full_name||': start');
729    END IF;
730 
731    IF FND_API.to_boolean(p_init_msg_list) THEN
732       FND_MSG_PUB.initialize;
733    END IF;
734 
735    IF NOT FND_API.compatible_api_call(
736          l_api_version,
737          p_api_version,
738          l_api_name,
739          g_pkg_name
740    ) THEN
741       RAISE FND_API.g_exc_unexpected_error;
742    END IF;
743 
744    x_return_status := FND_API.g_ret_sts_success;
745 
746    ---------------------- validate ------------------------
747    IF OZF_DEBUG_HIGH_ON THEN
748       OZF_Utility_PVT.debug_message(l_full_name||': check items');
749    END IF;
750 
751    IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
752       Check_Claim_Type_Items(
753          p_claim_rec       => p_claim_rec,
754          p_validation_mode => JTF_PLSQL_API.g_create,
755          x_return_status   => l_return_status
756       );
757 
758       IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
759          RAISE FND_API.g_exc_unexpected_error;
760       ELSIF l_return_status = FND_API.g_ret_sts_error THEN
761          RAISE FND_API.g_exc_error;
762       END IF;
763    END IF;
764 
765    IF OZF_DEBUG_HIGH_ON THEN
766       OZF_Utility_PVT.debug_message(l_full_name||': check record');
767    END IF;
768 
769    IF p_validation_level >= JTF_PLSQL_API.g_valid_level_record THEN
770       Check_Claim_Type_Record(
771          p_claim_rec       => p_claim_rec,
772          p_complete_rec    => NULL,
773          x_return_status   => l_return_status
774       );
775 
776       IF l_return_status = FND_API.g_ret_sts_unexp_error THEN
777          RAISE FND_API.g_exc_unexpected_error;
778       ELSIF l_return_status = FND_API.g_ret_sts_error THEN
779          RAISE FND_API.g_exc_error;
780       END IF;
781    END IF;
782 
783    -------------------- finish --------------------------
784    FND_MSG_PUB.count_and_get(
785          p_encoded => FND_API.g_false,
786          p_count   => x_msg_count,
787          p_data    => x_msg_data
788    );
789 
790    IF OZF_DEBUG_HIGH_ON THEN
791       OZF_Utility_PVT.debug_message(l_full_name ||': end');
792    END IF;
793 
794 EXCEPTION
795 
796    WHEN FND_API.g_exc_error THEN
797       x_return_status := FND_API.g_ret_sts_error;
798       FND_MSG_PUB.count_and_get(
799             p_encoded => FND_API.g_false,
800             p_count   => x_msg_count,
801             p_data    => x_msg_data
802       );
803 
804    WHEN FND_API.g_exc_unexpected_error THEN
805       x_return_status := FND_API.g_ret_sts_unexp_error ;
806       FND_MSG_PUB.count_and_get(
807             p_encoded => FND_API.g_false,
808             p_count   => x_msg_count,
809             p_data    => x_msg_data
810       );
811 
812    WHEN OTHERS THEN
813       x_return_status := FND_API.g_ret_sts_unexp_error;
814       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error)
815     THEN
816          FND_MSG_PUB.add_exc_msg(g_pkg_name, l_api_name);
817       END IF;
818 
819       FND_MSG_PUB.count_and_get(
820             p_encoded => FND_API.g_false,
821             p_count   => x_msg_count,
822             p_data    => x_msg_data
823       );
824 
825 END Validate_Claim_Type;
826 
827 
828 ---------------------------------------------------------------------
829 -- PROCEDURE
830 --    Check_Claim_Type_Req_Items
831 --
832 -- HISTORY
833 --    06/27/2000  Michelle Chang  Create.
834 ---------------------------------------------------------------------
835 PROCEDURE Check_Claim_Type_Req_Items(
836    p_claim_rec       IN  claim_rec_type
837   ,x_return_status   OUT NOCOPY VARCHAR2
838 )
839 IS
840 BEGIN
841 
842    x_return_status := FND_API.g_ret_sts_success;
843 
844    ------------------------ claim_class --------------------------
845    IF p_claim_rec.claim_class IS NULL THEN
846       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
847       THEN
848          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_MISSING_COLUMN');
849          FND_MESSAGE.Set_Token('COLUMN', 'CLAIM_CLASS');
850          FND_MSG_PUB.add;
851       END IF;
852 
853       x_return_status := FND_API.g_ret_sts_error;
854       RETURN;
855  ------------------------ Adjustment type--------------------------
856    ELSIF p_claim_rec.claim_class = 'ADJ' AND
857          p_claim_rec.adjustment_type IS NULL
858    THEN
859       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
860       THEN
861          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_MISSING_ADJTYPE');
862          FND_MESSAGE.Set_Token('COLUMN', 'ADJUSTMENT_TYPE');
863          FND_MSG_PUB.add;
864       END IF;
865 
866       x_return_status := FND_API.g_ret_sts_error;
867       RETURN;
868    ------------------------ set_of_books_id -------------------------------
869    ELSIF p_claim_rec.set_of_books_id IS NULL THEN
870       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
871       THEN
872          /*
873          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_MISSING_COLUMN');
874   		   FND_MESSAGE.Set_Token('COLUMN', 'SET_OF_BOOKS_ID');
875          FND_MSG_PUB.add;
876          */
877          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TYPE_NO_BOOKS');
878          FND_MSG_PUB.add;
879       END IF;
880 
881       x_return_status := FND_API.g_ret_sts_error;
882       RETURN;
883    ------------------------ post_to_gl_flag -------------------------------
884    ELSIF p_claim_rec.post_to_gl_flag IS NULL THEN
885       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
886       THEN
887          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_MISSING_COLUMN');
888          FND_MESSAGE.Set_Token('COLUMN', 'POST_TO_GL_GLAG');
889          FND_MSG_PUB.add;
890       END IF;
891 
892       x_return_status := FND_API.g_ret_sts_error;
893       RETURN;
894    ------------------------ start_date -------------------------------
895    ELSIF p_claim_rec.start_date IS NULL THEN
896       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
897       THEN
898          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_MISSING_COLUMN');
899          FND_MESSAGE.Set_Token('COLUMN', 'START_DATE');
900          FND_MSG_PUB.add;
901       END IF;
902 
903       x_return_status := FND_API.g_ret_sts_error;
904       RETURN;
905    ------------------------ name -------------------------------
906    ELSIF p_claim_rec.name IS NULL THEN
907       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
908       THEN
909          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_MISSING_COLUMN');
910          FND_MESSAGE.Set_Token('COLUMN', 'NAME');
911          FND_MSG_PUB.add;
912       END IF;
913 
914       x_return_status := FND_API.g_ret_sts_error;
915       RETURN;
916 
917    END IF;
918 
919 END Check_Claim_Type_Req_Items;
920 
921 
922 ---------------------------------------------------------------------
923 -- PROCEDURE
924 --    Check_Claim_Type_Uk_Items
925 --
926 -- HISTORY
927 --    06/27/2000  Michelle Chang  Create.
928 ---------------------------------------------------------------------
929 PROCEDURE Check_Claim_Type_Uk_Items(
930    p_claim_rec       IN  claim_rec_type
931   ,p_validation_mode IN  VARCHAR2 := JTF_PLSQL_API.g_create
932   ,x_return_status   OUT NOCOPY VARCHAR2
933 )
934 IS
935    l_valid_flag  VARCHAR2(1);
936 BEGIN
937 
938    x_return_status := FND_API.g_ret_sts_success;
939 
940    -- For Create_Claim_Type, when claim_type_id is passed in, we need to
941    -- check if this claim_type_id is unique.
942    IF p_validation_mode = JTF_PLSQL_API.g_create
943       AND p_claim_rec.claim_type_id IS NOT NULL
944    THEN
945       IF OZF_Utility_PVT.check_uniqueness(
946           'ozf_claim_types_VL',
947         'claim_type_id = ' || p_claim_rec.claim_type_id
948       ) = FND_API.g_false
949       THEN
950          IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
951          THEN
952             FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_DUPLICATE_VALUE');
953 				FND_MESSAGE.set_token('COLLUMN', 'CLAIM_TYPE_ID');
954             FND_MSG_PUB.add;
955          END IF;
956          x_return_status := FND_API.g_ret_sts_error;
957          RETURN;
958       END IF;
959    END IF;
960 
961    -- check other unique items
962 
963 END Check_Claim_Type_Uk_Items;
964 
965 
966 ---------------------------------------------------------------------
967 -- PROCEDURE
968 --    Check_Claim_Type_Fk_Items
969 --
970 -- HISTORY
971 --    06/27/2000  Michelle Chang  Create.
972 ---------------------------------------------------------------------
973 PROCEDURE Check_Claim_Type_Fk_Items(
974    p_claim_rec       IN  claim_rec_type
975   ,x_return_status   OUT NOCOPY VARCHAR2
976 )
977 IS
978 
979    l_dummy           NUMBER;
980    CURSOR  c_order_trx_type(cv_id NUMBER)
981    IS
982       SELECT 1
983       FROM oe_transaction_types_vl
984       WHERE transaction_type_id = cv_id;
985 
986 BEGIN
987 
988    x_return_status := FND_API.g_ret_sts_success;
989 
990    --Check the validity of OM Transaction type
991    IF p_claim_rec.order_type_id IS NOT NULL THEN
992       OPEN c_order_trx_type(p_claim_rec.order_type_id);
993       FETCH c_order_trx_type INTO l_dummy;
994       CLOSE c_order_trx_type;
995       IF l_dummy <> 1 THEN
996          FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_INVALID_OM_TRX_TYPE');
997          FND_MSG_PUB.add;
998          x_return_status := FND_API.G_RET_STS_ERROR;
999          RETURN;
1000       END IF;
1001     END IF;
1002 
1003    -- check other fk items
1004 
1005 END Check_Claim_Type_Fk_Items;
1006 
1007 
1008 ---------------------------------------------------------------------
1009 -- PROCEDURE
1010 --    Check_Claim_Type_Lookup_Items
1011 --
1012 -- HISTORY
1013 --    06/27/2000  Michelle Chang  Create.
1014 ---------------------------------------------------------------------
1015 PROCEDURE Check_Claim_Type_Lookup_Items(
1016    p_claim_rec       IN  claim_rec_type
1017   ,x_return_status   OUT NOCOPY VARCHAR2
1018 )
1019 IS
1020 BEGIN
1021 
1022    x_return_status := FND_API.g_ret_sts_success;
1023 
1024    ----------------------- claim_class ------------------------
1025    IF p_claim_rec.claim_class <> FND_API.g_miss_char AND
1026       p_claim_rec.claim_class <> 'ADJ' THEN
1027       IF OZF_Utility_PVT.check_lookup_exists(
1028             p_lookup_table_name => 'OZF_LOOKUPS',
1029             p_lookup_type => 'OZF_CLAIM_CLASS',
1030             p_lookup_code => p_claim_rec.claim_class
1031          ) = FND_API.g_false THEN
1032          IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1033             FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_BAD_CLASS');
1034             FND_MSG_PUB.add;
1035          END IF;
1036 
1037          x_return_status := FND_API.g_ret_sts_error;
1038          RETURN;
1039       END IF;
1040    END IF;
1041 
1042    ----------------------- creation_sign ------------------------
1043    IF p_claim_rec.creation_sign <> FND_API.g_miss_char THEN
1044       IF OZF_Utility_PVT.check_lookup_exists(
1045             p_lookup_table_name => 'OZF_LOOKUPS',
1046             p_lookup_type => 'OZF_CREATION_SIGN',
1047             p_lookup_code => p_claim_rec.creation_sign
1048          ) = FND_API.g_false
1049       THEN
1050          IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
1051          THEN
1052             FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_BAD_CREATION_SIGN');
1053             FND_MSG_PUB.add;
1054          END IF;
1055 
1056          x_return_status := FND_API.g_ret_sts_error;
1057          RETURN;
1058       END IF;
1059    END IF;
1060 
1061    -- check other lookup codes
1062 
1063 END Check_Claim_Type_Lookup_Items;
1064 
1065 
1066 ---------------------------------------------------------------------
1067 -- PROCEDURE
1068 --    Check_Claim_Type_Flag_Items
1069 --
1070 -- HISTORY
1071 --    06/27/2000  Michelle Chang  Create.
1072 ---------------------------------------------------------------------
1073 PROCEDURE Check_Claim_Type_Flag_Items(
1074    p_claim_rec       IN  claim_rec_type
1075   ,x_return_status   OUT NOCOPY VARCHAR2
1076 )
1077 IS
1078 BEGIN
1079 
1080    x_return_status := FND_API.g_ret_sts_success;
1081 
1082    ----------------------- post_to_gl_flag ------------------------
1083    /*
1084    IF p_claim_rec.post_to_gl_flag <> FND_API.g_miss_char
1085       AND p_claim_rec.post_to_gl_flag IS NOT NULL
1086    THEN
1087       IF p_claim_rec.post_to_gl_flag <> FND_API.g_true
1088         AND p_claim_rec.post_to_gl_flag <> FND_API.g_false
1089       THEN
1090          IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error)
1091          THEN
1092             FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_BAD_FLAG');
1093 				FND_MESSAGE.Set_Token('FLAG','POST_TO_GL_FLAG');
1094             FND_MSG_PUB.add;
1095          END IF;
1096 
1097          x_return_status := FND_API.g_ret_sts_error;
1098          RETURN;
1099       END IF;
1100    END IF;
1101 */
1102    -- check other flags
1103 
1104 END Check_Claim_Type_Flag_Items;
1105 
1106 
1107 ---------------------------------------------------------------------
1108 -- PROCEDURE
1109 --    Check_Claim_Type_Items
1110 --
1111 -- HISTORY
1112 --    06/27/2000  Michelle Chang  Create.
1113 ---------------------------------------------------------------------
1114 PROCEDURE Check_Claim_Type_Items(
1115    p_validation_mode IN  VARCHAR2 := JTF_PLSQL_API.g_create
1116   ,x_return_status   OUT NOCOPY VARCHAR2
1117   ,p_claim_rec       IN  claim_rec_type
1118 )
1119 IS
1120 BEGIN
1121 
1122    Check_Claim_Type_Req_Items(
1123       p_claim_rec       => p_claim_rec
1124      ,x_return_status   => x_return_status
1125    );
1126 
1127    IF x_return_status <> FND_API.g_ret_sts_success THEN
1128       RETURN;
1129    END IF;
1130 
1131    Check_Claim_Type_Uk_Items(
1132       p_claim_rec       => p_claim_rec
1133      ,p_validation_mode => p_validation_mode
1134      ,x_return_status   => x_return_status
1135    );
1136 
1137    IF x_return_status <> FND_API.g_ret_sts_success THEN
1138       RETURN;
1139    END IF;
1140 
1141    Check_Claim_Type_Fk_Items(
1142       p_claim_rec       => p_claim_rec
1143      ,x_return_status   => x_return_status
1144    );
1145 
1146    IF x_return_status <> FND_API.g_ret_sts_success THEN
1147       RETURN;
1148    END IF;
1149 
1150    Check_Claim_Type_Lookup_Items(
1151       p_claim_rec       => p_claim_rec
1152      ,x_return_status   => x_return_status
1153    );
1154 
1155    IF x_return_status <> FND_API.g_ret_sts_success THEN
1156       RETURN;
1157    END IF;
1158 
1159    Check_Claim_Type_Flag_Items(
1160       p_claim_rec       => p_claim_rec
1161      ,x_return_status   => x_return_status
1162    );
1163 
1164    IF x_return_status <> FND_API.g_ret_sts_success THEN
1165       RETURN;
1166    END IF;
1167 
1168 END Check_Claim_Type_Items;
1169 
1170 
1171 
1172 ---------------------------------------------------------------------
1173 -- PROCEDURE
1174 --    Check_Claim_Type_Record
1175 --
1176 -- HISTORY
1177 --    06/27/2000  Michelle Chang  Create.
1178 ---------------------------------------------------------------------
1179 PROCEDURE Check_Claim_Type_Record(
1180    p_claim_rec        IN  claim_rec_type
1181   ,p_complete_rec     IN  claim_rec_type := NULL
1182   ,x_return_status    OUT NOCOPY VARCHAR2
1183 )
1184 IS
1185 BEGIN
1186 
1187    x_return_status := FND_API.g_ret_sts_success;
1188 
1189    -- do other record level checkings
1190    -- End date validation.
1191    IF (p_claim_rec.end_date IS NOT NULL)
1192       AND (p_claim_rec.end_date <> FND_API.G_MISS_DATE) THEN
1193       IF p_claim_rec.start_date > p_claim_rec.end_date THEN
1194          FND_MESSAGE.Set_Name('OZF', 'OZF_CLAIM_TYPE_SD_GT_ED');
1195          FND_MSG_PUB.ADD;
1196          x_return_status := FND_API.G_RET_STS_ERROR;
1197       END IF;
1198    END IF;
1199 
1200 END Check_Claim_Type_Record;
1201 
1202 
1203 ---------------------------------------------------------------------
1204 -- PROCEDURE
1205 --    Init_Claim_Type_Rec
1206 --
1207 -- HISTORY
1208 --    06/27/2000  Michelle Chang  Create.
1209 ---------------------------------------------------------------------
1210 PROCEDURE Init_Claim_Type_Rec(
1211    x_claim_rec   OUT NOCOPY  claim_rec_type
1212 )
1213 IS
1214 BEGIN
1215 
1216 
1217    RETURN;
1218 END Init_Claim_Type_Rec;
1219 
1220 
1221 ---------------------------------------------------------------------
1222 -- PROCEDURE
1223 --    Complete_Claim_Type_Rec
1224 --
1225 -- HISTORY
1226 --    06/27/2000  Michelle Chang  Create.
1227 ---------------------------------------------------------------------
1228 PROCEDURE Complete_Claim_Type_Rec(
1229    p_claim_rec IN  claim_rec_type
1230   ,x_complete_rec    OUT NOCOPY claim_rec_type
1231 )
1232 IS
1233 
1234    CURSOR c_claim IS
1235    SELECT *
1236      FROM  ozf_claim_types_VL
1237      WHERE claim_type_id = p_claim_rec.claim_type_id;
1238 
1239    l_claim_rec  c_claim%ROWTYPE;
1240 
1241 BEGIN
1242 
1243    x_complete_rec := p_claim_rec;
1244 
1245    OPEN c_claim;
1246    FETCH c_claim INTO l_claim_rec;
1247    IF c_claim%NOTFOUND THEN
1248       CLOSE c_claim;
1249       IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
1250          FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1251          FND_MSG_PUB.add;
1252       END IF;
1253       RAISE FND_API.g_exc_error;
1254    END IF;
1255    CLOSE c_claim;
1256 
1257 
1258 IF p_claim_rec.object_version_number = FND_API.G_MISS_NUM  THEN
1259    x_complete_rec.object_version_number := NULL;
1260 END IF;
1261 IF p_claim_rec.object_version_number IS NULL THEN
1262    x_complete_rec.object_version_number := l_claim_rec.object_version_number;
1263 END IF;
1264 
1265 IF p_claim_rec.claim_class = FND_API.G_MISS_CHAR THEN
1266    x_complete_rec.claim_class := NULL;
1267 END IF;
1268 IF p_claim_rec.claim_class IS NULL THEN
1269    x_complete_rec.claim_class := l_claim_rec.claim_class;
1270 END IF;
1271 
1272 IF p_claim_rec.set_of_books_id = FND_API.G_MISS_NUM  THEN
1273    x_complete_rec.set_of_books_id := NULL;
1274 END IF;
1275 IF p_claim_rec.set_of_books_id IS NULL THEN
1276    x_complete_rec.set_of_books_id := l_claim_rec.set_of_books_id;
1277 END IF;
1278 
1279 IF p_claim_rec.post_to_gl_flag = FND_API.G_MISS_CHAR THEN
1280    x_complete_rec.post_to_gl_flag := NULL;
1281 END IF;
1282 IF p_claim_rec.post_to_gl_flag IS NULL THEN
1283    x_complete_rec.post_to_gl_flag := l_claim_rec.post_to_gl_flag;
1284 END IF;
1285 
1286 IF p_claim_rec.start_date = FND_API.G_MISS_DATE  THEN
1287    x_complete_rec.start_date := NULL;
1288 END IF;
1289 IF p_claim_rec.start_date IS NULL THEN
1290    x_complete_rec.start_date := l_claim_rec.start_date;
1291 END IF;
1292 
1293 IF p_claim_rec.end_date = FND_API.G_MISS_DATE THEN
1294    x_complete_rec.end_date := NULL;
1295 END IF;
1296 IF p_claim_rec.end_date IS NULL THEN
1297    x_complete_rec.end_date := l_claim_rec.end_date;
1298 END IF;
1299 
1300 IF p_claim_rec.creation_sign = FND_API.G_MISS_CHAR  THEN
1301    x_complete_rec.creation_sign := NULL;
1302 END IF;
1303 IF p_claim_rec.creation_sign IS NULL THEN
1304    x_complete_rec.creation_sign := l_claim_rec.creation_sign;
1305 END IF;
1306 
1307 IF p_claim_rec.gl_id_ded_adj = FND_API.G_MISS_NUM  THEN
1308    x_complete_rec.gl_id_ded_adj := NULL;
1309 END IF;
1310 IF p_claim_rec.gl_id_ded_adj IS NULL THEN
1311    x_complete_rec.gl_id_ded_adj := l_claim_rec.gl_id_ded_adj;
1312 END IF;
1313 
1314 IF p_claim_rec.gl_id_ded_adj_clearing = FND_API.G_MISS_NUM  THEN
1315    x_complete_rec.gl_id_ded_adj_clearing := NULL;
1316 END IF;
1317 IF p_claim_rec.gl_id_ded_adj_clearing IS NULL THEN
1318    x_complete_rec.gl_id_ded_adj_clearing := l_claim_rec.gl_id_ded_adj_clearing;
1319 END IF;
1320 
1321 IF p_claim_rec.gl_id_ded_clearing = FND_API.G_MISS_NUM  THEN
1322    x_complete_rec.gl_id_ded_clearing := NULL;
1323 END IF;
1324 IF p_claim_rec.gl_id_ded_clearing IS NULL THEN
1325    x_complete_rec.gl_id_ded_clearing := l_claim_rec.gl_id_ded_clearing;
1326 END IF;
1327 
1328 IF p_claim_rec.gl_id_accr_promo_liab = FND_API.G_MISS_NUM  THEN
1329    x_complete_rec.gl_id_accr_promo_liab := NULL;
1330 END IF;
1331 IF p_claim_rec.gl_id_accr_promo_liab IS NULL THEN
1332    x_complete_rec.gl_id_accr_promo_liab := l_claim_rec.gl_id_accr_promo_liab;
1333 END IF;
1334 
1335 IF p_claim_rec.transaction_type = FND_API.G_MISS_NUM THEN
1336    x_complete_rec.transaction_type := NULL;
1337 END IF;
1338 IF p_claim_rec.transaction_type IS NULL THEN
1339    x_complete_rec.transaction_type := l_claim_rec.transaction_type;
1340 END IF;
1341 
1342 IF p_claim_rec.cm_trx_type_id = FND_API.G_MISS_NUM THEN
1343    x_complete_rec.cm_trx_type_id := NULL;
1344 END IF;
1345 IF p_claim_rec.cm_trx_type_id IS NULL THEN
1346    x_complete_rec.cm_trx_type_id := l_claim_rec.cm_trx_type_id;
1347 END IF;
1348 
1349 IF p_claim_rec.dm_trx_type_id = FND_API.G_MISS_NUM THEN
1350    x_complete_rec.dm_trx_type_id := NULL;
1351 END IF;
1352 IF p_claim_rec.dm_trx_type_id IS NULL THEN
1353    x_complete_rec.dm_trx_type_id := l_claim_rec.dm_trx_type_id;
1354 END IF;
1355 
1356 IF p_claim_rec.cb_trx_type_id = FND_API.G_MISS_NUM THEN
1357    x_complete_rec.cb_trx_type_id := NULL;
1358 END IF;
1359 IF p_claim_rec.cb_trx_type_id IS NULL THEN
1360    x_complete_rec.cb_trx_type_id := l_claim_rec.cb_trx_type_id;
1361 END IF;
1362 
1363 IF p_claim_rec.wo_rec_trx_id = FND_API.G_MISS_NUM THEN
1364    x_complete_rec.wo_rec_trx_id := NULL;
1365 END IF;
1366 IF p_claim_rec.wo_rec_trx_id IS NULL THEN
1367    x_complete_rec.wo_rec_trx_id := l_claim_rec.wo_rec_trx_id;
1368 END IF;
1369 
1370 IF p_claim_rec.adj_rec_trx_id = FND_API.G_MISS_NUM THEN
1371    x_complete_rec.adj_rec_trx_id := NULL;
1372 END IF;
1373 IF p_claim_rec.adj_rec_trx_id IS NULL THEN
1374    x_complete_rec.adj_rec_trx_id := l_claim_rec.adj_rec_trx_id;
1375 END IF;
1376 
1377 IF p_claim_rec.attribute_category = FND_API.G_MISS_CHAR THEN
1378    x_complete_rec.attribute_category := NULL;
1379 END IF;
1380 IF p_claim_rec.attribute_category IS NULL THEN
1381    x_complete_rec.attribute_category := l_claim_rec.attribute_category;
1382 END IF;
1383 
1384 IF p_claim_rec.attribute1 = FND_API.G_MISS_CHAR THEN
1385    x_complete_rec.attribute1 := NULL;
1386 END IF;
1387 IF p_claim_rec.attribute1 IS NULL THEN
1388    x_complete_rec.attribute1 := l_claim_rec.attribute1;
1389 END IF;
1390 
1391 IF p_claim_rec.attribute2 = FND_API.G_MISS_CHAR THEN
1392    x_complete_rec.attribute2 := NULL;
1393 END IF;
1394 IF p_claim_rec.attribute2 IS NULL THEN
1395    x_complete_rec.attribute2 := l_claim_rec.attribute2;
1396 END IF;
1397 
1398 IF p_claim_rec.attribute3 = FND_API.G_MISS_CHAR THEN
1399    x_complete_rec.attribute3 := NULL;
1400 END IF;
1401 IF p_claim_rec.attribute3 IS NULL THEN
1402    x_complete_rec.attribute3 := l_claim_rec.attribute3;
1403 END IF;
1404 
1405 IF p_claim_rec.attribute4 = FND_API.G_MISS_CHAR THEN
1406    x_complete_rec.attribute4 := NULL;
1407 END IF;
1408 IF p_claim_rec.attribute4 IS NULL THEN
1409    x_complete_rec.attribute4 := l_claim_rec.attribute4;
1410 END IF;
1411 
1412 IF p_claim_rec.attribute5 = FND_API.G_MISS_CHAR THEN
1413    x_complete_rec.attribute5 := NULL;
1414 END IF;
1415 IF p_claim_rec.attribute5 IS NULL THEN
1416    x_complete_rec.attribute5 := l_claim_rec.attribute5;
1417 END IF;
1418 
1419 IF p_claim_rec.attribute6 = FND_API.G_MISS_CHAR THEN
1420    x_complete_rec.attribute6 := NULL;
1421 END IF;
1422 IF p_claim_rec.attribute6 IS NULL THEN
1423    x_complete_rec.attribute6 := l_claim_rec.attribute6;
1424 END IF;
1425 
1426 IF p_claim_rec.attribute7 = FND_API.G_MISS_CHAR THEN
1427    x_complete_rec.attribute7 := NULL;
1428 END IF;
1429 IF p_claim_rec.attribute7 IS NULL THEN
1430    x_complete_rec.attribute7 := l_claim_rec.attribute7;
1431 END IF;
1432 
1433 IF p_claim_rec.attribute8 = FND_API.G_MISS_CHAR THEN
1434    x_complete_rec.attribute8 := NULL;
1435 END IF;
1436 IF p_claim_rec.attribute8 IS NULL THEN
1437    x_complete_rec.attribute8 := l_claim_rec.attribute8;
1438 END IF;
1439 
1440 IF p_claim_rec.attribute9 = FND_API.G_MISS_CHAR THEN
1441    x_complete_rec.attribute9 := NULL;
1442 END IF;
1443 IF p_claim_rec.attribute9 IS NULL THEN
1444    x_complete_rec.attribute9 := l_claim_rec.attribute9;
1445 END IF;
1446 
1447 IF p_claim_rec.attribute10 = FND_API.G_MISS_CHAR THEN
1448    x_complete_rec.attribute10 := NULL;
1449 END IF;
1450 IF p_claim_rec.attribute10 IS NULL THEN
1451    x_complete_rec.attribute10 := l_claim_rec.attribute10;
1452 END IF;
1453 
1454 IF p_claim_rec.attribute11 = FND_API.G_MISS_CHAR THEN
1455    x_complete_rec.attribute11 := NULL;
1456 END IF;
1457 IF p_claim_rec.attribute11 IS NULL THEN
1458    x_complete_rec.attribute11 := l_claim_rec.attribute11;
1459 END IF;
1460 
1461 IF p_claim_rec.attribute12 = FND_API.G_MISS_CHAR THEN
1462    x_complete_rec.attribute12 := NULL;
1463 END IF;
1464 IF p_claim_rec.attribute12 IS NULL THEN
1465    x_complete_rec.attribute12 := l_claim_rec.attribute12;
1466 END IF;
1467 
1468 IF p_claim_rec.attribute13 = FND_API.G_MISS_CHAR THEN
1469    x_complete_rec.attribute13 := NULL;
1470 END IF;
1471 IF p_claim_rec.attribute13 IS NULL THEN
1472    x_complete_rec.attribute13 := l_claim_rec.attribute13;
1473 END IF;
1474 
1475 IF p_claim_rec.attribute14 = FND_API.G_MISS_CHAR THEN
1476    x_complete_rec.attribute14 := NULL;
1477 END IF;
1478 IF p_claim_rec.attribute14 IS NULL THEN
1479    x_complete_rec.attribute14 := l_claim_rec.attribute14;
1480 END IF;
1481 
1482 IF p_claim_rec.attribute15 = FND_API.G_MISS_CHAR THEN
1483    x_complete_rec.attribute15 := NULL;
1484 END IF;
1485 IF p_claim_rec.attribute15 IS NULL THEN
1486    x_complete_rec.attribute15 := l_claim_rec.attribute15;
1487 END IF;
1488 
1489 IF p_claim_rec.name = FND_API.G_MISS_CHAR THEN
1490    x_complete_rec.name := NULL;
1491 END IF;
1492 IF p_claim_rec.name IS NULL THEN
1493    x_complete_rec.name := l_claim_rec.name;
1494 END IF;
1495 
1496 IF p_claim_rec.description = FND_API.G_MISS_CHAR THEN
1497    x_complete_rec.description := NULL;
1498 END IF;
1499 IF p_claim_rec.description IS NULL THEN
1500    x_complete_rec.description := l_claim_rec.description;
1501 END IF;
1502 
1503 IF p_claim_rec.adjustment_type = FND_API.G_MISS_CHAR THEN
1504    x_complete_rec.adjustment_type := NULL;
1505 END IF;
1506 IF p_claim_rec.adjustment_type IS NULL THEN
1507    x_complete_rec.adjustment_type := l_claim_rec.adjustment_type;
1508 END IF;
1509 
1510 IF p_claim_rec.order_type_id = FND_API.G_MISS_NUM THEN
1511    x_complete_rec.order_type_id := NULL;
1512 END IF;
1513 IF p_claim_rec.order_type_id IS NULL THEN
1514    x_complete_rec.order_type_id := l_claim_rec.order_type_id;
1515 END IF;
1516 
1517 IF p_claim_rec.neg_wo_rec_trx_id = FND_API.G_MISS_NUM THEN
1518    x_complete_rec.neg_wo_rec_trx_id := NULL;
1519 END IF;
1520 IF p_claim_rec.neg_wo_rec_trx_id IS NULL THEN
1521    x_complete_rec.neg_wo_rec_trx_id := l_claim_rec.neg_wo_rec_trx_id;
1522 END IF;
1523 
1524 IF p_claim_rec.gl_balancing_flex_value = FND_API.G_MISS_CHAR THEN
1525    x_complete_rec.gl_balancing_flex_value := NULL;
1526 END IF;
1527 IF p_claim_rec.gl_balancing_flex_value IS NULL THEN
1528    x_complete_rec.gl_balancing_flex_value := l_claim_rec.gl_balancing_flex_value;
1529 END IF;
1530 
1531 
1532 END Complete_Claim_Type_Rec;
1533 
1534 
1535 END OZF_Claim_Type_PVT;