DBA Data[Home] [Help]

PACKAGE BODY: APPS.OZF_CLAIMS_INT_PVT

Source


1 PACKAGE BODY OZF_Claims_Int_PVT as
2 /* $Header: ozfvcinb.pls 120.4.12010000.2 2008/07/31 11:26:58 kpatro ship $ */
3 
4 G_DEDUCTION_CLASS      CONSTANT  VARCHAR2(20) := 'DEDUCTION';
5 G_CLAIM_CLASS          CONSTANT  VARCHAR2(20) := 'CLAIM';
6 G_OVERPAYMENT_CLASS    CONSTANT  VARCHAR2(20) := 'OVERPAYMENT';
7 G_CHARGE_CLASS          CONSTANT  VARCHAR2(20) := 'CHARGE';
8 G_DEDUC_OBJ_TYPE       CONSTANT  VARCHAR2(6)  := 'DEDU';
9 G_CLAIM_OBJECT_TYPE    CONSTANT  VARCHAR2(30) := 'CLAM';
10 G_CLAIM_STATUS  CONSTANT VARCHAR2(30) := 'OZF_CLAIM_STATUS';
11 G_OPEN_STATUS   CONSTANT VARCHAR2(30) := 'OPEN';
12 
13 
14 -- ===============================================================
15 -- Start of Comments
16 -- Package name
17 --          OZF_Claims_Int_PVT
18 -- Purpose
19 --
20 -- History
21 -- 02-Sep-2005  SSHIVALI   R12: Multi-Org Changes
22 -- 07-Oct-05    SSHIVALI   Bug#4648903: Added OU Info to Log and Output files
23 -- 20-Mar-06    Kishore    Bug#5104517 CLAIM IMPORT OZF_CLAIM_LINES_INT_PVT NOT IMPORTING ITEM_TYPE
24 -- NOTE
25 --
26 -- 29-Jul-2008  KPATRO   Fix for bug 7290916
27 -- End of Comments
28 -- ===============================================================
29 
30 G_PKG_NAME CONSTANT VARCHAR2(30):= 'OZF_Claims_Int_PVT';
31 G_FILE_NAME CONSTANT VARCHAR2(12) := 'ozfvcinb.pls';
32 
33 OZF_DEBUG_HIGH_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_high);
34 OZF_DEBUG_LOW_ON BOOLEAN := FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_debug_low);
35 
36 PROCEDURE Create_Claims_Int(
37     p_api_version_number   IN   NUMBER,
38     p_init_msg_list        IN   VARCHAR2     := FND_API.G_FALSE,
39     p_commit               IN   VARCHAR2     := FND_API.G_FALSE,
40     p_validation_level     IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
41 
42     x_return_status        OUT NOCOPY  VARCHAR2,
43     x_msg_count            OUT NOCOPY  NUMBER,
44     x_msg_data             OUT NOCOPY  VARCHAR2,
45 
46     p_claims_int_rec       IN   claims_int_rec_type  := g_miss_claims_int_rec,
47     x_interface_claim_id   OUT NOCOPY  NUMBER
48 )
49 IS
50 
51 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Create_Claims_Int';
52 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
53 l_return_status_full        VARCHAR2(1);
54 l_object_version_number     NUMBER := 1;
55 l_org_id                    NUMBER := FND_API.G_MISS_NUM;
56 l_INTERFACE_CLAIM_ID                  NUMBER;
57 l_dummy       NUMBER;
58 
59 --Added for 7290916
60 l_claim_int_rec     claims_int_rec_type := p_claims_int_rec;
61 
62 CURSOR c_id IS
63    SELECT OZF_CLAIMS_INT_ALL_s.NEXTVAL
64    FROM dual;
65 
66 CURSOR c_id_exists (l_id IN NUMBER) IS
67    SELECT 1 FROM dual
68    WHERE EXISTS (SELECT 1 FROM OZF_CLAIMS_INT_ALL
69               WHERE INTERFACE_CLAIM_ID = l_id);
70 
71 BEGIN
72    -- Standard Start of API savepoint
73    SAVEPOINT CREATE_Claims_Int_PVT;
74 
75    -- Standard call to check for call compatibility.
76    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
77                                         p_api_version_number,
78                                         l_api_name,
79                                         G_PKG_NAME)
80    THEN
81        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
82    END IF;
83 
84    -- Initialize message list if p_init_msg_list is set to TRUE.
85    IF FND_API.to_Boolean( p_init_msg_list )
86    THEN
87       FND_MSG_PUB.initialize;
88    END IF;
89 
90    -- Debug Message
91    IF OZF_DEBUG_HIGH_ON THEN
92       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
93    END IF;
94 
95    -- Initialize API return status to SUCCESS
96    x_return_status := FND_API.G_RET_STS_SUCCESS;
97 
98    -- Local variable initialization
99    IF p_claims_int_rec.INTERFACE_CLAIM_ID IS NULL OR
100       p_claims_int_rec.INTERFACE_CLAIM_ID = FND_API.g_miss_num
101    THEN
102       LOOP
103          l_dummy := NULL;
104          OPEN c_id;
105             FETCH c_id INTO l_INTERFACE_CLAIM_ID;
106          CLOSE c_id;
107 
108          OPEN c_id_exists(l_INTERFACE_CLAIM_ID);
109             FETCH c_id_exists INTO l_dummy;
110          CLOSE c_id_exists;
111          EXIT WHEN l_dummy IS NULL;
112       END LOOP;
113       --Added for 7290916
114       l_claim_int_rec.INTERFACE_CLAIM_ID := l_INTERFACE_CLAIM_ID;
115    END IF;
116 
117     -- Added for 7290916
118       l_INTERFACE_CLAIM_ID := l_claim_int_rec.INTERFACE_CLAIM_ID;
119 
120       OZF_UTILITY_PVT.debug_message('l_INTERFACE_CLAIM_ID :' || l_INTERFACE_CLAIM_ID);
121 
122    -- =========================================================================
123    -- Validate Environment
124    -- =========================================================================
125    IF FND_GLOBAL.User_Id IS NULL
126    THEN
127        OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_USER_PROFILE_MISSING');
128        RAISE FND_API.G_EXC_ERROR;
129    END IF;
130 
131    IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
132    THEN
133        -- Debug message
134        IF OZF_DEBUG_HIGH_ON THEN
135           OZF_UTILITY_PVT.debug_message('Private API: Validate_Claims_Int');
136        END IF;
137 
138        --Added for 7290916
139        -- Invoke validation procedures
140        Validate_claims_int(
141          p_api_version_number     => 1.0,
142          p_init_msg_list    => FND_API.G_FALSE,
143          p_validation_level => p_validation_level,
144          p_claims_int_rec  =>  l_claim_int_rec,
145          x_return_status    => x_return_status,
146          x_msg_count        => x_msg_count,
147          x_msg_data         => x_msg_data);
148    END IF;
149 
150    IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
151        RAISE FND_API.G_EXC_ERROR;
152    END IF;
153 
154    -- Debug Message
155    IF OZF_DEBUG_HIGH_ON THEN
156       OZF_UTILITY_PVT.debug_message( 'Private API: Calling create table handler');
157    END IF;
158 
159    -- Invoke table handler(OZF_CLAIMS_INT_PKG.Insert_Row)
160    OZF_CLAIMS_INT_PKG.Insert_Row(
161        px_interface_claim_id  => l_interface_claim_id,
162        px_object_version_number  => l_object_version_number,
163        p_last_update_date  => SYSDATE,
164        p_last_updated_by  => FND_GLOBAL.USER_ID,
165        p_creation_date  => SYSDATE,
166        p_created_by  => FND_GLOBAL.USER_ID,
167        p_last_update_login  => FND_GLOBAL.CONC_LOGIN_ID,
168        p_request_id  => p_claims_int_rec.request_id,
169        p_program_application_id  => p_claims_int_rec.program_application_id,
170        p_program_update_date  => p_claims_int_rec.program_update_date,
171        p_program_id  => p_claims_int_rec.program_id,
172        p_created_from  => p_claims_int_rec.created_from,
173        p_batch_id  => p_claims_int_rec.batch_id,
174        p_claim_id  => p_claims_int_rec.claim_id,
175        p_claim_number  => p_claims_int_rec.claim_number,
176        p_claim_type_id  => p_claims_int_rec.claim_type_id,
177        p_claim_class  => p_claims_int_rec.claim_class,
178        p_claim_date  => p_claims_int_rec.claim_date,
179        p_due_date  => p_claims_int_rec.due_date,
180        p_owner_id  => p_claims_int_rec.owner_id,
181        p_history_event  => p_claims_int_rec.history_event,
182        p_history_event_date  => p_claims_int_rec.history_event_date,
183        p_history_event_description  => p_claims_int_rec.history_event_description,
184        p_split_from_claim_id  => p_claims_int_rec.split_from_claim_id,
185        p_duplicate_claim_id  => p_claims_int_rec.duplicate_claim_id,
186        p_split_date  => p_claims_int_rec.split_date,
187        p_root_claim_id  => p_claims_int_rec.root_claim_id,
188        p_amount  => p_claims_int_rec.amount,
189        p_amount_adjusted  => p_claims_int_rec.amount_adjusted,
190        p_amount_remaining  => p_claims_int_rec.amount_remaining,
191        p_amount_settled  => p_claims_int_rec.amount_settled,
192        p_acctd_amount  => p_claims_int_rec.acctd_amount,
193        p_acctd_amount_remaining  => p_claims_int_rec.acctd_amount_remaining,
194        p_tax_amount  => p_claims_int_rec.tax_amount,
195        p_tax_code  => p_claims_int_rec.tax_code,
196        p_tax_calculation_flag  => p_claims_int_rec.tax_calculation_flag,
197        p_currency_code  => p_claims_int_rec.currency_code,
198        p_exchange_rate_type  => p_claims_int_rec.exchange_rate_type,
199        p_exchange_rate_date  => p_claims_int_rec.exchange_rate_date,
200        p_exchange_rate  => p_claims_int_rec.exchange_rate,
201        p_set_of_books_id  => p_claims_int_rec.set_of_books_id,
202        p_original_claim_date  => p_claims_int_rec.original_claim_date,
203        p_source_object_id  => p_claims_int_rec.source_object_id,
204        p_source_object_class  => p_claims_int_rec.source_object_class,
205        p_source_object_type_id  => p_claims_int_rec.source_object_type_id,
206        p_source_object_number  => p_claims_int_rec.source_object_number,
207        p_cust_account_id  => p_claims_int_rec.cust_account_id,
208        p_cust_billto_acct_site_id  => p_claims_int_rec.cust_billto_acct_site_id,
209        p_cust_shipto_acct_site_id  => p_claims_int_rec.cust_shipto_acct_site_id,
210        p_location_id  => p_claims_int_rec.location_id,
211        p_pay_related_account_flag  => p_claims_int_rec.pay_related_account_flag,
212        p_related_cust_account_id  => p_claims_int_rec.related_cust_account_id,
213        p_related_site_use_id  => p_claims_int_rec.related_site_use_id,
214        p_relationship_type  => p_claims_int_rec.relationship_type,
215        p_vendor_id  => p_claims_int_rec.vendor_id,
216        p_vendor_site_id  => p_claims_int_rec.vendor_site_id,
217        p_reason_type  => p_claims_int_rec.reason_type,
218        p_reason_code_id  => p_claims_int_rec.reason_code_id,
219        p_task_template_group_id  => p_claims_int_rec.task_template_group_id,
220        p_status_code  => p_claims_int_rec.status_code,
221        p_user_status_id  => p_claims_int_rec.user_status_id,
222        p_sales_rep_id  => p_claims_int_rec.sales_rep_id,
223        p_collector_id  => p_claims_int_rec.collector_id,
224        p_contact_id  => p_claims_int_rec.contact_id,
225        p_broker_id  => p_claims_int_rec.broker_id,
226        p_territory_id  => p_claims_int_rec.territory_id,
227        p_customer_ref_date  => p_claims_int_rec.customer_ref_date,
228        p_customer_ref_number  => p_claims_int_rec.customer_ref_number,
229        p_assigned_to  => p_claims_int_rec.assigned_to,
230        p_receipt_id  => p_claims_int_rec.receipt_id,
231        p_receipt_number  => p_claims_int_rec.receipt_number,
232        p_doc_sequence_id  => p_claims_int_rec.doc_sequence_id,
233        p_doc_sequence_value  => p_claims_int_rec.doc_sequence_value,
234        p_gl_date  => p_claims_int_rec.gl_date,
235        p_payment_method  => p_claims_int_rec.payment_method,
236        p_voucher_id  => p_claims_int_rec.voucher_id,
237        p_voucher_number  => p_claims_int_rec.voucher_number,
238        p_payment_reference_id  => p_claims_int_rec.payment_reference_id,
239        p_payment_reference_number  => p_claims_int_rec.payment_reference_number,
240        p_payment_reference_date  => p_claims_int_rec.payment_reference_date,
241        p_payment_status  => p_claims_int_rec.payment_status,
242        p_approved_flag  => p_claims_int_rec.approved_flag,
243        p_approved_date  => p_claims_int_rec.approved_date,
244        p_approved_by  => p_claims_int_rec.approved_by,
245        p_settled_date  => p_claims_int_rec.settled_date,
246        p_settled_by  => p_claims_int_rec.settled_by,
247        p_effective_date  => p_claims_int_rec.effective_date,
248        p_custom_setup_id  => p_claims_int_rec.custom_setup_id,
249        p_task_id  => p_claims_int_rec.task_id,
250        p_country_id  => p_claims_int_rec.country_id,
251        p_order_type_id  => p_claims_int_rec.order_type_id,
252        p_comments  => p_claims_int_rec.comments,
253        p_attribute_category  => p_claims_int_rec.attribute_category,
254        p_attribute1  => p_claims_int_rec.attribute1,
255        p_attribute2  => p_claims_int_rec.attribute2,
256        p_attribute3  => p_claims_int_rec.attribute3,
257        p_attribute4  => p_claims_int_rec.attribute4,
258        p_attribute5  => p_claims_int_rec.attribute5,
259        p_attribute6  => p_claims_int_rec.attribute6,
260        p_attribute7  => p_claims_int_rec.attribute7,
261        p_attribute8  => p_claims_int_rec.attribute8,
262        p_attribute9  => p_claims_int_rec.attribute9,
263        p_attribute10  => p_claims_int_rec.attribute10,
264        p_attribute11  => p_claims_int_rec.attribute11,
265        p_attribute12  => p_claims_int_rec.attribute12,
266        p_attribute13  => p_claims_int_rec.attribute13,
267        p_attribute14  => p_claims_int_rec.attribute14,
268        p_attribute15  => p_claims_int_rec.attribute15,
269        p_deduction_attribute_category  => p_claims_int_rec.deduction_attribute_category,
270        p_deduction_attribute1  => p_claims_int_rec.deduction_attribute1,
271        p_deduction_attribute2  => p_claims_int_rec.deduction_attribute2,
272        p_deduction_attribute3  => p_claims_int_rec.deduction_attribute3,
273        p_deduction_attribute4  => p_claims_int_rec.deduction_attribute4,
274        p_deduction_attribute5  => p_claims_int_rec.deduction_attribute5,
275        p_deduction_attribute6  => p_claims_int_rec.deduction_attribute6,
276        p_deduction_attribute7  => p_claims_int_rec.deduction_attribute7,
277        p_deduction_attribute8  => p_claims_int_rec.deduction_attribute8,
278        p_deduction_attribute9  => p_claims_int_rec.deduction_attribute9,
279        p_deduction_attribute10  => p_claims_int_rec.deduction_attribute10,
280        p_deduction_attribute11  => p_claims_int_rec.deduction_attribute11,
281        p_deduction_attribute12  => p_claims_int_rec.deduction_attribute12,
282        p_deduction_attribute13  => p_claims_int_rec.deduction_attribute13,
283        p_deduction_attribute14  => p_claims_int_rec.deduction_attribute14,
284        p_deduction_attribute15  => p_claims_int_rec.deduction_attribute15,
285        px_org_id  => l_org_id,
286        p_customer_reason  => p_claims_int_rec.customer_reason,
287        p_ship_to_cust_account_id  => p_claims_int_rec.ship_to_cust_account_id
288        );
289    IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
290        RAISE FND_API.G_EXC_ERROR;
291    END IF;
292    --
293    -- End of API body
294    --
295 
296    -- Standard check for p_commit
297    IF FND_API.to_Boolean( p_commit )
298    THEN
299       COMMIT WORK;
300    END IF;
301 
302    -- Debug Message
303    IF OZF_DEBUG_HIGH_ON THEN
304       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
305    END IF;
306 
307    -- Standard call to get message count and if count is 1, get message info.
308    FND_MSG_PUB.Count_And_Get
309      (p_count          =>   x_msg_count,
310       p_data           =>   x_msg_data
311    );
312 EXCEPTION
313    WHEN OZF_Utility_PVT.resource_locked THEN
314       x_return_status := FND_API.g_ret_sts_error;
315       OZF_Utility_PVT.Error_Message(p_message_name =>'OZF_API_RESOURCE_LOCKED');
316    WHEN FND_API.G_EXC_ERROR THEN
317       ROLLBACK TO CREATE_Claims_Int_PVT;
318       x_return_status := FND_API.G_RET_STS_ERROR;
319       -- Standard call to get message count and if count=1, get the message
320       FND_MSG_PUB.Count_And_Get (
321             p_encoded => FND_API.G_FALSE,
322             p_count   => x_msg_count,
323             p_data    => x_msg_data
324       );
325    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
326       ROLLBACK TO CREATE_Claims_Int_PVT;
327       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
328       -- Standard call to get message count and if count=1, get the message
329       FND_MSG_PUB.Count_And_Get (
330             p_encoded => FND_API.G_FALSE,
331             p_count => x_msg_count,
332             p_data  => x_msg_data
333       );
334    WHEN OTHERS THEN
335       ROLLBACK TO CREATE_Claims_Int_PVT;
336       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
337       IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
338       THEN
339          FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
340       END IF;
341       -- Standard call to get message count and if count=1, get the message
342       FND_MSG_PUB.Count_And_Get (
343             p_encoded => FND_API.G_FALSE,
344             p_count => x_msg_count,
345             p_data  => x_msg_data
346       );
347 End Create_Claims_Int;
348 
349 PROCEDURE Update_Claims_Int(
350     p_api_version_number     IN   NUMBER,
351     p_init_msg_list          IN   VARCHAR2     := FND_API.G_FALSE,
352     p_commit                 IN   VARCHAR2     := FND_API.G_FALSE,
353     p_validation_level       IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
354 
355     x_return_status          OUT NOCOPY  VARCHAR2,
356     x_msg_count              OUT NOCOPY  NUMBER,
357     x_msg_data               OUT NOCOPY  VARCHAR2,
358 
359     p_claims_int_rec         IN   claims_int_rec_type,
360     x_object_version_number  OUT NOCOPY  NUMBER
361 )
362 IS
363 
364 CURSOR c_get_claims_int(p_interface_claim_id NUMBER) IS
365     SELECT *
366     FROM   OZF_CLAIMS_INT_ALL
367     WHERE  interface_claim_id = p_interface_claim_id;
368 
369 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Update_Claims_Int';
370 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
371 
372 -- Local Variables
373 l_object_version_number     NUMBER;
374 l_INTERFACE_CLAIM_ID    NUMBER;
375 l_ref_claims_int_rec  c_get_Claims_Int%ROWTYPE ;
376 l_tar_claims_int_rec  OZF_Claims_Int_PVT.claims_int_rec_type := P_claims_int_rec;
377 l_rowid  ROWID;
378 BEGIN
379    -- Standard Start of API savepoint
380    SAVEPOINT UPDATE_Claims_Int_PVT;
381 
382    -- Standard call to check for call compatibility.
383    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
384                                         p_api_version_number,
385                                         l_api_name,
386                                         G_PKG_NAME)
387    THEN
388        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
389    END IF;
390 
391    -- Initialize message list if p_init_msg_list is set to TRUE.
392    IF FND_API.to_Boolean( p_init_msg_list )
393    THEN
394       FND_MSG_PUB.initialize;
395    END IF;
396 
397    -- Debug Message
398    IF OZF_DEBUG_HIGH_ON THEN
399       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
400    END IF;
401 
402    -- Initialize API return status to SUCCESS
403    x_return_status := FND_API.G_RET_STS_SUCCESS;
404 
405    -- Debug Message
406    IF OZF_DEBUG_HIGH_ON THEN
407       OZF_UTILITY_PVT.debug_message('Private API: - Open Cursor to Select');
408    END IF;
409 
410    /*
411    OPEN c_get_Claims_Int( l_tar_claims_int_rec.interface_claim_id);
412 
413    FETCH c_get_Claims_Int INTO l_ref_claims_int_rec  ;
414 
415    If ( c_get_Claims_Int%NOTFOUND) THEN
416         OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RECORD_NOT_FOUND');
417         RAISE FND_API.G_EXC_ERROR;
418    END IF;
419    -- Debug Message
420    IF OZF_DEBUG_HIGH_ON THEN
421       OZF_UTILITY_PVT.debug_message('Private API: - Close Cursor');
422    END IF;
423    CLOSE     c_get_Claims_Int;
424    */
425 
426    IF (l_tar_claims_int_rec.object_version_number IS NULL OR
427        l_tar_claims_int_rec.object_version_number = FND_API.G_MISS_NUM )
428    THEN
429        OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_NO_OBJ_VER_NUM');
430        raise FND_API.G_EXC_ERROR;
431    END IF;
432 
433    -- Check Whether record has been changed by someone else
434    IF (l_tar_claims_int_rec.object_version_number <> l_ref_claims_int_rec.object_version_number)
435    THEN
436        OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_API_RESOURCE_LOCKED');
437        raise FND_API.G_EXC_ERROR;
438    END IF;
439 
440    IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
441    THEN
442        -- Debug message
443        IF OZF_DEBUG_HIGH_ON THEN
444           OZF_UTILITY_PVT.debug_message('Private API: Validate_Claims_Int');
445        END IF;
446        -- Invoke validation procedures
447        Validate_claims_int(
448          p_api_version_number  => 1.0,
449          p_init_msg_list       => FND_API.G_FALSE,
450          p_validation_level    => p_validation_level,
451          p_claims_int_rec      =>  p_claims_int_rec,
452          x_return_status       => x_return_status,
453          x_msg_count           => x_msg_count,
454          x_msg_data            => x_msg_data);
455    END IF;
456 
457    IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
458        RAISE FND_API.G_EXC_ERROR;
459    END IF;
460 
461    -- Debug Message
462    IF OZF_DEBUG_HIGH_ON THEN
463       OZF_UTILITY_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW,
464                                  'Private API: Calling update table handler');
465    END IF;
466 
467    -- Invoke table handler(OZF_CLAIMS_INT_PKG.Update_Row)
468    OZF_CLAIMS_INT_PKG.Update_Row(
469        p_interface_claim_id  => p_claims_int_rec.interface_claim_id,
470        p_object_version_number  => p_claims_int_rec.object_version_number,
471        p_last_update_date  => SYSDATE,
472        p_last_updated_by  => FND_GLOBAL.USER_ID,
473        p_last_update_login  => FND_GLOBAL.CONC_LOGIN_ID,
474        p_request_id  => p_claims_int_rec.request_id,
475        p_program_application_id  => p_claims_int_rec.program_application_id,
476        p_program_update_date  => p_claims_int_rec.program_update_date,
477        p_program_id  => p_claims_int_rec.program_id,
478        p_created_from  => p_claims_int_rec.created_from,
479        p_batch_id  => p_claims_int_rec.batch_id,
480        p_claim_id  => p_claims_int_rec.claim_id,
481        p_claim_number  => p_claims_int_rec.claim_number,
482        p_claim_type_id  => p_claims_int_rec.claim_type_id,
483        p_claim_class  => p_claims_int_rec.claim_class,
484        p_claim_date  => p_claims_int_rec.claim_date,
485        p_due_date  => p_claims_int_rec.due_date,
486        p_owner_id  => p_claims_int_rec.owner_id,
487        p_history_event  => p_claims_int_rec.history_event,
488        p_history_event_date  => p_claims_int_rec.history_event_date,
489        p_history_event_description  => p_claims_int_rec.history_event_description,
490        p_split_from_claim_id  => p_claims_int_rec.split_from_claim_id,
491        p_duplicate_claim_id  => p_claims_int_rec.duplicate_claim_id,
492        p_split_date  => p_claims_int_rec.split_date,
493        p_root_claim_id  => p_claims_int_rec.root_claim_id,
494        p_amount  => p_claims_int_rec.amount,
495        p_amount_adjusted  => p_claims_int_rec.amount_adjusted,
496        p_amount_remaining  => p_claims_int_rec.amount_remaining,
497        p_amount_settled  => p_claims_int_rec.amount_settled,
498        p_acctd_amount  => p_claims_int_rec.acctd_amount,
499        p_acctd_amount_remaining  => p_claims_int_rec.acctd_amount_remaining,
500        p_tax_amount  => p_claims_int_rec.tax_amount,
501        p_tax_code  => p_claims_int_rec.tax_code,
502        p_tax_calculation_flag  => p_claims_int_rec.tax_calculation_flag,
503        p_currency_code  => p_claims_int_rec.currency_code,
504        p_exchange_rate_type  => p_claims_int_rec.exchange_rate_type,
505        p_exchange_rate_date  => p_claims_int_rec.exchange_rate_date,
506        p_exchange_rate  => p_claims_int_rec.exchange_rate,
507        p_set_of_books_id  => p_claims_int_rec.set_of_books_id,
508        p_original_claim_date  => p_claims_int_rec.original_claim_date,
509        p_source_object_id  => p_claims_int_rec.source_object_id,
510        p_source_object_class  => p_claims_int_rec.source_object_class,
511        p_source_object_type_id  => p_claims_int_rec.source_object_type_id,
512        p_source_object_number  => p_claims_int_rec.source_object_number,
513        p_cust_account_id  => p_claims_int_rec.cust_account_id,
514        p_cust_billto_acct_site_id  => p_claims_int_rec.cust_billto_acct_site_id,
515        p_cust_shipto_acct_site_id  => p_claims_int_rec.cust_shipto_acct_site_id,
516        p_location_id  => p_claims_int_rec.location_id,
517        p_pay_related_account_flag  => p_claims_int_rec.pay_related_account_flag,
518        p_related_cust_account_id  => p_claims_int_rec.related_cust_account_id,
519        p_related_site_use_id  => p_claims_int_rec.related_site_use_id,
520        p_relationship_type  => p_claims_int_rec.relationship_type,
521        p_vendor_id  => p_claims_int_rec.vendor_id,
522        p_vendor_site_id  => p_claims_int_rec.vendor_site_id,
523        p_reason_type  => p_claims_int_rec.reason_type,
524        p_reason_code_id  => p_claims_int_rec.reason_code_id,
525        p_task_template_group_id  => p_claims_int_rec.task_template_group_id,
526        p_status_code  => p_claims_int_rec.status_code,
527        p_user_status_id  => p_claims_int_rec.user_status_id,
528        p_sales_rep_id  => p_claims_int_rec.sales_rep_id,
529        p_collector_id  => p_claims_int_rec.collector_id,
530        p_contact_id  => p_claims_int_rec.contact_id,
531        p_broker_id  => p_claims_int_rec.broker_id,
532        p_territory_id  => p_claims_int_rec.territory_id,
533        p_customer_ref_date  => p_claims_int_rec.customer_ref_date,
534        p_customer_ref_number  => p_claims_int_rec.customer_ref_number,
535        p_assigned_to  => p_claims_int_rec.assigned_to,
536        p_receipt_id  => p_claims_int_rec.receipt_id,
537        p_receipt_number  => p_claims_int_rec.receipt_number,
538        p_doc_sequence_id  => p_claims_int_rec.doc_sequence_id,
539        p_doc_sequence_value  => p_claims_int_rec.doc_sequence_value,
540        p_gl_date  => p_claims_int_rec.gl_date,
541        p_payment_method  => p_claims_int_rec.payment_method,
542        p_voucher_id  => p_claims_int_rec.voucher_id,
543        p_voucher_number  => p_claims_int_rec.voucher_number,
544        p_payment_reference_id  => p_claims_int_rec.payment_reference_id,
545        p_payment_reference_number  => p_claims_int_rec.payment_reference_number,
546        p_payment_reference_date  => p_claims_int_rec.payment_reference_date,
547        p_payment_status  => p_claims_int_rec.payment_status,
548        p_approved_flag  => p_claims_int_rec.approved_flag,
549        p_approved_date  => p_claims_int_rec.approved_date,
550        p_approved_by  => p_claims_int_rec.approved_by,
551        p_settled_date  => p_claims_int_rec.settled_date,
552        p_settled_by  => p_claims_int_rec.settled_by,
553        p_effective_date  => p_claims_int_rec.effective_date,
554        p_custom_setup_id  => p_claims_int_rec.custom_setup_id,
555        p_task_id  => p_claims_int_rec.task_id,
556        p_country_id  => p_claims_int_rec.country_id,
557        p_order_type_id  => p_claims_int_rec.order_type_id,
558        p_comments  => p_claims_int_rec.comments,
559        p_attribute_category  => p_claims_int_rec.attribute_category,
560        p_attribute1  => p_claims_int_rec.attribute1,
561        p_attribute2  => p_claims_int_rec.attribute2,
562        p_attribute3  => p_claims_int_rec.attribute3,
563        p_attribute4  => p_claims_int_rec.attribute4,
564        p_attribute5  => p_claims_int_rec.attribute5,
565        p_attribute6  => p_claims_int_rec.attribute6,
566        p_attribute7  => p_claims_int_rec.attribute7,
567        p_attribute8  => p_claims_int_rec.attribute8,
568        p_attribute9  => p_claims_int_rec.attribute9,
569        p_attribute10  => p_claims_int_rec.attribute10,
570        p_attribute11  => p_claims_int_rec.attribute11,
571        p_attribute12  => p_claims_int_rec.attribute12,
572        p_attribute13  => p_claims_int_rec.attribute13,
573        p_attribute14  => p_claims_int_rec.attribute14,
574        p_attribute15  => p_claims_int_rec.attribute15,
575        p_deduction_attribute_category  => p_claims_int_rec.deduction_attribute_category,
576        p_deduction_attribute1  => p_claims_int_rec.deduction_attribute1,
577        p_deduction_attribute2  => p_claims_int_rec.deduction_attribute2,
578        p_deduction_attribute3  => p_claims_int_rec.deduction_attribute3,
579        p_deduction_attribute4  => p_claims_int_rec.deduction_attribute4,
580        p_deduction_attribute5  => p_claims_int_rec.deduction_attribute5,
581        p_deduction_attribute6  => p_claims_int_rec.deduction_attribute6,
582        p_deduction_attribute7  => p_claims_int_rec.deduction_attribute7,
583        p_deduction_attribute8  => p_claims_int_rec.deduction_attribute8,
584        p_deduction_attribute9  => p_claims_int_rec.deduction_attribute9,
585        p_deduction_attribute10  => p_claims_int_rec.deduction_attribute10,
586        p_deduction_attribute11  => p_claims_int_rec.deduction_attribute11,
587        p_deduction_attribute12  => p_claims_int_rec.deduction_attribute12,
588        p_deduction_attribute13  => p_claims_int_rec.deduction_attribute13,
589        p_deduction_attribute14  => p_claims_int_rec.deduction_attribute14,
590        p_deduction_attribute15  => p_claims_int_rec.deduction_attribute15,
591        p_org_id  => p_claims_int_rec.org_id,
592        p_customer_reason  => p_claims_int_rec.customer_reason,
593        p_ship_to_cust_account_id  => p_claims_int_rec.ship_to_cust_account_id
594        );
595    --
596    -- End of API body.
597    --
598 
599    -- Standard check for p_commit
600    IF FND_API.to_Boolean( p_commit )
601    THEN
602       COMMIT WORK;
603    END IF;
604 
605    -- Debug Message
606    IF OZF_DEBUG_HIGH_ON THEN
607       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
608    END IF;
609 
610    -- Standard call to get message count and if count is 1, get message info.
611    FND_MSG_PUB.Count_And_Get
612      (p_count          =>   x_msg_count,
613       p_data           =>   x_msg_data
614    );
615 EXCEPTION
616    WHEN OZF_Utility_PVT.resource_locked THEN
617       x_return_status := FND_API.g_ret_sts_error;
618       OZF_Utility_PVT.Error_Message(p_message_name =>'OZF_API_RESOURCE_LOCKED');
619    WHEN FND_API.G_EXC_ERROR THEN
620       ROLLBACK TO UPDATE_Claims_Int_PVT;
621       x_return_status := FND_API.G_RET_STS_ERROR;
622       -- Standard call to get message count and if count=1, get the message
623       FND_MSG_PUB.Count_And_Get (
624             p_encoded => FND_API.G_FALSE,
625             p_count   => x_msg_count,
626             p_data    => x_msg_data
627       );
628    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
629       ROLLBACK TO UPDATE_Claims_Int_PVT;
630       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
631       -- Standard call to get message count and if count=1, get the message
632       FND_MSG_PUB.Count_And_Get (
633             p_encoded => FND_API.G_FALSE,
634             p_count => x_msg_count,
635             p_data  => x_msg_data
636       );
637    WHEN OTHERS THEN
638       ROLLBACK TO UPDATE_Claims_Int_PVT;
639       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
640       IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
641       THEN
642          FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
643       END IF;
644       -- Standard call to get message count and if count=1, get the message
645       FND_MSG_PUB.Count_And_Get (
646             p_encoded => FND_API.G_FALSE,
647             p_count => x_msg_count,
648             p_data  => x_msg_data
649       );
650 End Update_Claims_Int;
651 
652 PROCEDURE Delete_Claims_Int(
653     p_api_version_number         IN   NUMBER,
654     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
655     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
656     p_validation_level           IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
657     x_return_status              OUT NOCOPY  VARCHAR2,
658     x_msg_count                  OUT NOCOPY  NUMBER,
659     x_msg_data                   OUT NOCOPY  VARCHAR2,
660     p_interface_claim_id         IN   NUMBER,
661     p_object_version_number      IN   NUMBER
662 )
663 IS
664 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Delete_Claims_Int';
665 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
666 l_object_version_number     NUMBER;
667 BEGIN
668    -- Standard Start of API savepoint
669    SAVEPOINT DELETE_Claims_Int_PVT;
670 
671    -- Standard call to check for call compatibility.
672    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
673                                         p_api_version_number,
674                                         l_api_name,
675                                         G_PKG_NAME)
676    THEN
677        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
678    END IF;
679 
680    -- Initialize message list if p_init_msg_list is set to TRUE.
681    IF FND_API.to_Boolean( p_init_msg_list )
682    THEN
683       FND_MSG_PUB.initialize;
684    END IF;
685 
686    -- Debug Message
687    IF OZF_DEBUG_HIGH_ON THEN
688       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
689    END IF;
690 
691    -- Initialize API return status to SUCCESS
692    x_return_status := FND_API.G_RET_STS_SUCCESS;
693 
694    --
695    -- Api body
696    --
697    -- Debug Message
698    IF OZF_DEBUG_HIGH_ON THEN
699       OZF_UTILITY_PVT.debug_message( 'Private API: Calling delete table handler');
700    END IF;
701 
702    -- Invoke table handler(OZF_CLAIMS_INT_PKG.Delete_Row)
703    OZF_CLAIMS_INT_PKG.Delete_Row(
704        p_INTERFACE_CLAIM_ID  => p_INTERFACE_CLAIM_ID);
705    --
706    -- End of API body
707    --
708 
709    -- Standard check for p_commit
710    IF FND_API.to_Boolean( p_commit )
711    THEN
712       COMMIT WORK;
713    END IF;
714 
715    -- Debug Message
716    IF OZF_DEBUG_HIGH_ON THEN
717       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
718    END IF;
719 
720    -- Standard call to get message count and if count is 1, get message info.
721    FND_MSG_PUB.Count_And_Get
722      (p_count          =>   x_msg_count,
723       p_data           =>   x_msg_data
724    );
725 EXCEPTION
726    WHEN OZF_Utility_PVT.resource_locked THEN
727       x_return_status := FND_API.g_ret_sts_error;
728       OZF_Utility_PVT.Error_Message(p_message_name =>'OZF_API_RESOURCE_LOCKED');
729    WHEN FND_API.G_EXC_ERROR THEN
730       ROLLBACK TO DELETE_Claims_Int_PVT;
731       x_return_status := FND_API.G_RET_STS_ERROR;
732       -- Standard call to get message count and if count=1, get the message
733       FND_MSG_PUB.Count_And_Get (
734             p_encoded => FND_API.G_FALSE,
735             p_count   => x_msg_count,
736             p_data    => x_msg_data
737       );
738    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
739       ROLLBACK TO DELETE_Claims_Int_PVT;
740       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
741       -- Standard call to get message count and if count=1, get the message
742       FND_MSG_PUB.Count_And_Get (
743             p_encoded => FND_API.G_FALSE,
744             p_count => x_msg_count,
745             p_data  => x_msg_data
746       );
747    WHEN OTHERS THEN
748       ROLLBACK TO DELETE_Claims_Int_PVT;
749       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
750       IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
751       THEN
752          FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
753       END IF;
754       -- Standard call to get message count and if count=1, get the message
755       FND_MSG_PUB.Count_And_Get (
756             p_encoded => FND_API.G_FALSE,
757             p_count => x_msg_count,
758             p_data  => x_msg_data
759       );
760 End Delete_Claims_Int;
761 
762 PROCEDURE Lock_Claims_Int(
763     p_api_version_number         IN   NUMBER,
764     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
765 
766     x_return_status              OUT NOCOPY  VARCHAR2,
767     x_msg_count                  OUT NOCOPY  NUMBER,
768     x_msg_data                   OUT NOCOPY  VARCHAR2,
769 
770     p_interface_claim_id         IN  NUMBER,
771     p_object_version             IN  NUMBER
772 )
773 IS
774 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Lock_Claims_Int';
775 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
776 L_FULL_NAME                 CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
777 l_INTERFACE_CLAIM_ID                  NUMBER;
778 
779 CURSOR c_Claims_Int IS
780    SELECT INTERFACE_CLAIM_ID
781    FROM OZF_CLAIMS_INT_ALL
782    WHERE INTERFACE_CLAIM_ID = p_INTERFACE_CLAIM_ID
783    AND object_version_number = p_object_version
784    FOR UPDATE NOWAIT;
785 BEGIN
786    -- Debug Message
787    IF OZF_DEBUG_HIGH_ON THEN
788       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
789    END IF;
790 
791    -- Initialize message list if p_init_msg_list is set to TRUE.
792    IF FND_API.to_Boolean( p_init_msg_list )
793    THEN
794       FND_MSG_PUB.initialize;
795    END IF;
796 
797    -- Standard call to check for call compatibility.
798    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
799                                         p_api_version_number,
800                                         l_api_name,
801                                         G_PKG_NAME)
802    THEN
803        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
804    END IF;
805 
806    -- Initialize API return status to SUCCESS
807    x_return_status := FND_API.G_RET_STS_SUCCESS;
808 
809    ------------------------ lock -------------------------
810    IF OZF_DEBUG_HIGH_ON THEN
811       OZF_Utility_PVT.debug_message(l_full_name||': start');
812    END IF;
813    OPEN c_Claims_Int;
814       FETCH c_Claims_Int INTO l_INTERFACE_CLAIM_ID;
815       IF (c_Claims_Int%NOTFOUND) THEN
816          CLOSE c_Claims_Int;
817 
818          IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
819             FND_MESSAGE.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
820             FND_MSG_PUB.add;
821          END IF;
822          RAISE FND_API.g_exc_error;
823       END IF;
824    CLOSE c_Claims_Int;
825    -------------------- finish --------------------------
826 
827    FND_MSG_PUB.count_and_get(
828       p_encoded => FND_API.g_false,
829       p_count   => x_msg_count,
830       p_data    => x_msg_data);
831    IF OZF_DEBUG_HIGH_ON THEN
832       OZF_Utility_PVT.debug_message(l_full_name ||': end');
833    END IF;
834 
835 EXCEPTION
836    WHEN OZF_Utility_PVT.resource_locked THEN
837       x_return_status := FND_API.g_ret_sts_error;
838       OZF_Utility_PVT.Error_Message(p_message_name =>'OZF_API_RESOURCE_LOCKED');
839    WHEN FND_API.G_EXC_ERROR THEN
840       ROLLBACK TO LOCK_Claims_Int_PVT;
841       x_return_status := FND_API.G_RET_STS_ERROR;
842       -- Standard call to get message count and if count=1, get the message
843       FND_MSG_PUB.Count_And_Get (
844             p_encoded => FND_API.G_FALSE,
845             p_count   => x_msg_count,
846             p_data    => x_msg_data
847       );
848    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
849       ROLLBACK TO LOCK_Claims_Int_PVT;
850       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
851       -- Standard call to get message count and if count=1, get the message
852       FND_MSG_PUB.Count_And_Get (
853             p_encoded => FND_API.G_FALSE,
854             p_count => x_msg_count,
855             p_data  => x_msg_data
856       );
857    WHEN OTHERS THEN
858       ROLLBACK TO LOCK_Claims_Int_PVT;
859       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
860       IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
861       THEN
862          FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
863       END IF;
864       -- Standard call to get message count and if count=1, get the message
865       FND_MSG_PUB.Count_And_Get (
866             p_encoded => FND_API.G_FALSE,
867             p_count => x_msg_count,
868             p_data  => x_msg_data
869       );
870 End Lock_Claims_Int;
871 
872 PROCEDURE check_claims_int_uk_items(
873     p_claims_int_rec               IN   claims_int_rec_type,
874     p_validation_mode            IN  VARCHAR2 := JTF_PLSQL_API.g_create,
875     x_return_status              OUT NOCOPY VARCHAR2)
876 IS
877 l_valid_flag  VARCHAR2(1);
878 
879 BEGIN
880    x_return_status := FND_API.g_ret_sts_success;
881    IF p_validation_mode = JTF_PLSQL_API.g_create THEN
882       l_valid_flag := OZF_Utility_PVT.check_uniqueness(
883       'OZF_CLAIMS_INT_ALL',
884       'INTERFACE_CLAIM_ID = ''' || p_claims_int_rec.INTERFACE_CLAIM_ID ||''''
885       );
886    ELSE
887       l_valid_flag := OZF_Utility_PVT.check_uniqueness(
888       'OZF_CLAIMS_INT_ALL',
889       'INTERFACE_CLAIM_ID = ''' || p_claims_int_rec.INTERFACE_CLAIM_ID ||
890       ''' AND INTERFACE_CLAIM_ID <> ' || p_claims_int_rec.INTERFACE_CLAIM_ID
891       );
892    END IF;
893 
894    IF l_valid_flag = FND_API.g_false THEN
895       OZF_Utility_PVT.Error_Message(p_message_name => 'OZF_INTERFACE_CLAIM_ID_DUP');
896       x_return_status := FND_API.g_ret_sts_error;
897       RETURN;
898    END IF;
899 END check_claims_int_uk_items;
900 
901 PROCEDURE check_claims_int_req_items(
902     p_claims_int_rec               IN  claims_int_rec_type,
903     p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
904     x_return_status	         OUT NOCOPY VARCHAR2
905 )
906 IS
907 BEGIN
908    x_return_status := FND_API.g_ret_sts_success;
909 
910    IF p_validation_mode = JTF_PLSQL_API.g_create THEN
911       IF p_claims_int_rec.interface_claim_id = FND_API.g_miss_num OR
912          p_claims_int_rec.interface_claim_id IS NULL
913       THEN
914          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'INTERFACE_CLAIM_ID' );
915          x_return_status := FND_API.g_ret_sts_error;
916          RETURN;
917       END IF;
918 
919       IF p_claims_int_rec.object_version_number = FND_API.g_miss_num OR
920          p_claims_int_rec.object_version_number IS NULL
921       THEN
922          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'OBJECT_VERSION_NUMBER' );
923          x_return_status := FND_API.g_ret_sts_error;
924          RETURN;
925       END IF;
926 
927       IF p_claims_int_rec.last_update_date = FND_API.g_miss_date OR
928          p_claims_int_rec.last_update_date IS NULL
929       THEN
930          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATE_DATE' );
931          x_return_status := FND_API.g_ret_sts_error;
932          RETURN;
933       END IF;
934 
935       IF p_claims_int_rec.last_updated_by = FND_API.g_miss_num OR
936          p_claims_int_rec.last_updated_by IS NULL THEN
937          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATED_BY' );
938          x_return_status := FND_API.g_ret_sts_error;
939          RETURN;
940       END IF;
941 
942       IF p_claims_int_rec.creation_date = FND_API.g_miss_date OR
943          p_claims_int_rec.creation_date IS NULL THEN
944          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATION_DATE' );
945          x_return_status := FND_API.g_ret_sts_error;
946          RETURN;
947       END IF;
948 
949       IF p_claims_int_rec.created_by = FND_API.g_miss_num OR
950          p_claims_int_rec.created_by IS NULL THEN
951          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATED_BY' );
952          x_return_status := FND_API.g_ret_sts_error;
953          RETURN;
954       END IF;
955 
956       IF p_claims_int_rec.claim_type_id = FND_API.g_miss_num OR
957          p_claims_int_rec.claim_type_id IS NULL THEN
958          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CLAIM_TYPE_ID' );
959          x_return_status := FND_API.g_ret_sts_error;
960          RETURN;
961       END IF;
962 
963       IF p_claims_int_rec.claim_date = FND_API.g_miss_date OR
964          p_claims_int_rec.claim_date IS NULL THEN
965          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CLAIM_DATE' );
966          x_return_status := FND_API.g_ret_sts_error;
967          RETURN;
968       END IF;
969 
970       IF p_claims_int_rec.cust_account_id = FND_API.g_miss_num OR
971          p_claims_int_rec.cust_account_id IS NULL THEN
972          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CUST_ACCOUNT_ID' );
973          x_return_status := FND_API.g_ret_sts_error;
974          RETURN;
975       END IF;
976    ELSE
977       IF p_claims_int_rec.interface_claim_id IS NULL THEN
978          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'INTERFACE_CLAIM_ID' );
979          x_return_status := FND_API.g_ret_sts_error;
980          RETURN;
981       END IF;
982 
983       IF p_claims_int_rec.object_version_number IS NULL THEN
984          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'OBJECT_VERSION_NUMBER' );
985          x_return_status := FND_API.g_ret_sts_error;
986          RETURN;
987       END IF;
988 
989       IF p_claims_int_rec.last_update_date IS NULL THEN
990          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATE_DATE' );
991          x_return_status := FND_API.g_ret_sts_error;
992          RETURN;
993       END IF;
994 
995       IF p_claims_int_rec.last_updated_by IS NULL THEN
996          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'LAST_UPDATED_BY' );
997          x_return_status := FND_API.g_ret_sts_error;
998          RETURN;
999       END IF;
1000 
1001       IF p_claims_int_rec.creation_date IS NULL THEN
1002          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATION_DATE' );
1003          x_return_status := FND_API.g_ret_sts_error;
1004          RETURN;
1005       END IF;
1006 
1007       IF p_claims_int_rec.created_by IS NULL THEN
1008          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CREATED_BY' );
1009          x_return_status := FND_API.g_ret_sts_error;
1010          RETURN;
1011       END IF;
1012 
1013 
1014       IF p_claims_int_rec.claim_type_id IS NULL THEN
1015          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CLAIM_TYPE_ID' );
1016          x_return_status := FND_API.g_ret_sts_error;
1017          RETURN;
1018       END IF;
1019 
1020       IF p_claims_int_rec.claim_date IS NULL THEN
1021          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CLAIM_DATE' );
1022          x_return_status := FND_API.g_ret_sts_error;
1023          RETURN;
1024       END IF;
1025 
1026       IF p_claims_int_rec.cust_account_id IS NULL THEN
1027          OZF_Utility_PVT.Error_Message('OZF_API_MISSING_FIELD', 'MISS_FIELD', 'CUST_ACCOUNT_ID' );
1028          x_return_status := FND_API.g_ret_sts_error;
1029          RETURN;
1030       END IF;
1031    END IF;
1032 
1033 END check_claims_int_req_items;
1034 
1035 PROCEDURE check_claims_int_FK_items(
1036     p_claims_int_rec IN claims_int_rec_type,
1037     x_return_status OUT NOCOPY VARCHAR2
1038 )
1039 IS
1040 BEGIN
1041    x_return_status := FND_API.g_ret_sts_success;
1042 
1043    -- Enter custom code here
1044 
1045 END check_claims_int_FK_items;
1046 
1047 PROCEDURE check_claims_int_Lk_items(
1048     p_claims_int_rec IN claims_int_rec_type,
1049     x_return_status OUT NOCOPY VARCHAR2
1050 )
1051 IS
1052 BEGIN
1053    x_return_status := FND_API.g_ret_sts_success;
1054 
1055    -- Enter custom code here
1056 
1057 END check_claims_int_Lk_items;
1058 
1059 PROCEDURE Check_claims_int_Items (
1060     P_claims_int_rec     IN    claims_int_rec_type,
1061     p_validation_mode  IN    VARCHAR2,
1062     x_return_status    OUT NOCOPY   VARCHAR2
1063     )
1064 IS
1065 BEGIN
1066 
1067    -- Check Items Uniqueness API calls
1068    check_claims_int_uk_items(
1069       p_claims_int_rec => p_claims_int_rec,
1070       p_validation_mode => p_validation_mode,
1071       x_return_status => x_return_status);
1072    IF x_return_status <> FND_API.g_ret_sts_success THEN
1073       RETURN;
1074    END IF;
1075 
1076    -- Check Items Required/NOT NULL API calls
1077    check_claims_int_req_items(
1078       p_claims_int_rec => p_claims_int_rec,
1079       p_validation_mode => p_validation_mode,
1080       x_return_status => x_return_status);
1081    IF x_return_status <> FND_API.g_ret_sts_success THEN
1082       RETURN;
1083    END IF;
1084 
1085    -- Check Items Foreign Keys API calls
1086    check_claims_int_FK_items(
1087       p_claims_int_rec => p_claims_int_rec,
1088       x_return_status => x_return_status);
1089    IF x_return_status <> FND_API.g_ret_sts_success THEN
1090       RETURN;
1091    END IF;
1092 
1093    -- Check Items Lookups
1094    check_claims_int_Lk_items(
1095       p_claims_int_rec => p_claims_int_rec,
1096       x_return_status => x_return_status);
1097    IF x_return_status <> FND_API.g_ret_sts_success THEN
1098       RETURN;
1099    END IF;
1100 
1101 END Check_claims_int_Items;
1102 
1103 PROCEDURE Complete_claims_int_Rec (
1104    p_claims_int_rec IN claims_int_rec_type,
1105    x_complete_rec OUT NOCOPY claims_int_rec_type)
1106 IS
1107 l_return_status  VARCHAR2(1);
1108 
1109 CURSOR c_complete IS
1110   SELECT *
1111   FROM ozf_claims_int_all
1112   WHERE interface_claim_id = p_claims_int_rec.interface_claim_id;
1113 
1114 l_claims_int_rec c_complete%ROWTYPE;
1115 BEGIN
1116    x_complete_rec := p_claims_int_rec;
1117 
1118    OPEN c_complete;
1119    FETCH c_complete INTO l_claims_int_rec;
1120    CLOSE c_complete;
1121 
1122    -- interface_claim_id
1123    IF p_claims_int_rec.interface_claim_id = FND_API.g_miss_num THEN
1124       x_complete_rec.interface_claim_id := NULL;
1125    END IF;
1126    IF p_claims_int_rec.interface_claim_id IS NULL THEN
1127       x_complete_rec.interface_claim_id := l_claims_int_rec.interface_claim_id;
1128    END IF;
1129 
1130    -- object_version_number
1131    IF p_claims_int_rec.object_version_number = FND_API.g_miss_num THEN
1132       x_complete_rec.object_version_number := NULL;
1133    END IF;
1134    IF p_claims_int_rec.object_version_number IS NULL THEN
1135       x_complete_rec.object_version_number := l_claims_int_rec.object_version_number;
1136    END IF;
1137 
1138    -- last_update_date
1139    IF p_claims_int_rec.last_update_date = FND_API.g_miss_date THEN
1140       x_complete_rec.last_update_date := NULL;
1141    END IF;
1142    IF p_claims_int_rec.last_update_date IS NULL THEN
1143       x_complete_rec.last_update_date := l_claims_int_rec.last_update_date;
1144    END IF;
1145 
1146    -- last_updated_by
1147    IF p_claims_int_rec.last_updated_by = FND_API.g_miss_num THEN
1148       x_complete_rec.last_updated_by := NULL;
1149    END IF;
1150    IF p_claims_int_rec.last_updated_by IS NULL THEN
1151       x_complete_rec.last_updated_by := l_claims_int_rec.last_updated_by;
1152    END IF;
1153 
1154    -- creation_date
1155    IF p_claims_int_rec.creation_date = FND_API.g_miss_date THEN
1156       x_complete_rec.creation_date := NULL;
1157    END IF;
1158    IF p_claims_int_rec.creation_date IS NULL THEN
1159       x_complete_rec.creation_date := l_claims_int_rec.creation_date;
1160    END IF;
1161 
1162    -- created_by
1163    IF p_claims_int_rec.created_by = FND_API.g_miss_num THEN
1164       x_complete_rec.created_by := NULL;
1165    END IF;
1166    IF p_claims_int_rec.created_by IS NULL THEN
1167       x_complete_rec.created_by := l_claims_int_rec.created_by;
1168    END IF;
1169 
1170    -- last_update_login
1171    IF p_claims_int_rec.last_update_login = FND_API.g_miss_num THEN
1172       x_complete_rec.last_update_login := NULL;
1173    END IF;
1174    IF p_claims_int_rec.last_update_login IS NULL THEN
1175       x_complete_rec.last_update_login := l_claims_int_rec.last_update_login;
1176    END IF;
1177 
1178    -- request_id
1179    IF p_claims_int_rec.request_id = FND_API.g_miss_num THEN
1180       x_complete_rec.request_id := NULL;
1181    END IF;
1182    IF p_claims_int_rec.request_id IS NULL THEN
1183       x_complete_rec.request_id := l_claims_int_rec.request_id;
1184    END IF;
1185 
1186    -- program_application_id
1187    IF p_claims_int_rec.program_application_id = FND_API.g_miss_num THEN
1188       x_complete_rec.program_application_id := NULL;
1189    END IF;
1190    IF p_claims_int_rec.program_application_id IS NULL THEN
1191       x_complete_rec.program_application_id := l_claims_int_rec.program_application_id;
1192    END IF;
1193 
1194    -- program_update_date
1195    IF p_claims_int_rec.program_update_date = FND_API.g_miss_date THEN
1196       x_complete_rec.program_update_date := NULL;
1197    END IF;
1198    IF p_claims_int_rec.program_update_date IS NULL THEN
1199       x_complete_rec.program_update_date := l_claims_int_rec.program_update_date;
1200    END IF;
1201 
1202    -- program_id
1203    IF p_claims_int_rec.program_id = FND_API.g_miss_num THEN
1204       x_complete_rec.program_id := NULL;
1205    END IF;
1206    IF p_claims_int_rec.program_id IS NULL THEN
1207       x_complete_rec.program_id := l_claims_int_rec.program_id;
1208    END IF;
1209 
1210    -- created_from
1211    IF p_claims_int_rec.created_from = FND_API.g_miss_char THEN
1212       x_complete_rec.created_from := NULL;
1213    END IF;
1214    IF p_claims_int_rec.created_from IS NULL THEN
1215       x_complete_rec.created_from := l_claims_int_rec.created_from;
1216    END IF;
1217 
1218    -- batch_id
1219    IF p_claims_int_rec.batch_id = FND_API.g_miss_num THEN
1220       x_complete_rec.batch_id := NULL;
1221    END IF;
1222    IF p_claims_int_rec.batch_id IS NULL THEN
1223       x_complete_rec.batch_id := l_claims_int_rec.batch_id;
1224    END IF;
1225 
1226    -- claim_id
1227    IF p_claims_int_rec.claim_id = FND_API.g_miss_num THEN
1228       x_complete_rec.claim_id := NULL;
1229    END IF;
1230    IF p_claims_int_rec.claim_id IS NULL THEN
1231       x_complete_rec.claim_id := l_claims_int_rec.claim_id;
1232    END IF;
1233 
1234    -- claim_number
1235    IF p_claims_int_rec.claim_number = FND_API.g_miss_char THEN
1236       x_complete_rec.claim_number := NULL;
1237    END IF;
1238    IF p_claims_int_rec.claim_number IS NULL THEN
1239       x_complete_rec.claim_number := l_claims_int_rec.claim_number;
1240    END IF;
1241 
1242    -- claim_type_id
1243    IF p_claims_int_rec.claim_type_id = FND_API.g_miss_num THEN
1244       x_complete_rec.claim_type_id := NULL;
1245    END IF;
1246    IF p_claims_int_rec.claim_type_id IS NULL THEN
1247       x_complete_rec.claim_type_id := l_claims_int_rec.claim_type_id;
1248    END IF;
1249 
1250    -- claim_class
1251    IF p_claims_int_rec.claim_class = FND_API.g_miss_char THEN
1252       x_complete_rec.claim_class := NULL;
1253    END IF;
1254    IF p_claims_int_rec.claim_class IS NULL THEN
1255       x_complete_rec.claim_class := l_claims_int_rec.claim_class;
1256    END IF;
1257 
1258    -- claim_date
1259    IF p_claims_int_rec.claim_date = FND_API.g_miss_date THEN
1260       x_complete_rec.claim_date := NULL;
1261    END IF;
1262    IF p_claims_int_rec.claim_date IS NULL THEN
1263       x_complete_rec.claim_date := l_claims_int_rec.claim_date;
1264    END IF;
1265 
1266    -- due_date
1267    IF p_claims_int_rec.due_date = FND_API.g_miss_date THEN
1268       x_complete_rec.due_date := NULL;
1269    END IF;
1270    IF p_claims_int_rec.due_date IS NULL THEN
1271       x_complete_rec.due_date := l_claims_int_rec.due_date;
1272    END IF;
1273 
1274    -- owner_id
1275    IF p_claims_int_rec.owner_id = FND_API.g_miss_num THEN
1276       x_complete_rec.owner_id := NULL;
1277    END IF;
1278    IF p_claims_int_rec.owner_id IS NULL THEN
1279       x_complete_rec.owner_id := l_claims_int_rec.owner_id;
1280    END IF;
1281 
1282    -- history_event
1283    IF p_claims_int_rec.history_event = FND_API.g_miss_char THEN
1284       x_complete_rec.history_event := NULL;
1285    END IF;
1286    IF p_claims_int_rec.history_event IS NULL THEN
1287       x_complete_rec.history_event := l_claims_int_rec.history_event;
1288    END IF;
1289 
1290    -- history_event_date
1291    IF p_claims_int_rec.history_event_date = FND_API.g_miss_date THEN
1292       x_complete_rec.history_event_date := NULL;
1293    END IF;
1294    IF p_claims_int_rec.history_event_date IS NULL THEN
1295       x_complete_rec.history_event_date := l_claims_int_rec.history_event_date;
1296    END IF;
1297 
1298    -- history_event_description
1299    IF p_claims_int_rec.history_event_description = FND_API.g_miss_char THEN
1300       x_complete_rec.history_event_description := NULL;
1301    END IF;
1302    IF p_claims_int_rec.history_event_description IS NULL THEN
1303       x_complete_rec.history_event_description := l_claims_int_rec.history_event_description;
1304    END IF;
1305 
1306    -- split_from_claim_id
1307    IF p_claims_int_rec.split_from_claim_id = FND_API.g_miss_num THEN
1308       x_complete_rec.split_from_claim_id := NULL;
1309    END IF;
1310    IF p_claims_int_rec.split_from_claim_id IS NULL THEN
1311       x_complete_rec.split_from_claim_id := l_claims_int_rec.split_from_claim_id;
1312    END IF;
1313 
1314    -- duplicate_claim_id
1315    IF p_claims_int_rec.duplicate_claim_id = FND_API.g_miss_num THEN
1316       x_complete_rec.duplicate_claim_id := NULL;
1317    END IF;
1318    IF p_claims_int_rec.duplicate_claim_id IS NULL THEN
1319       x_complete_rec.duplicate_claim_id := l_claims_int_rec.duplicate_claim_id;
1320    END IF;
1321 
1322    -- split_date
1323    IF p_claims_int_rec.split_date = FND_API.g_miss_date THEN
1324       x_complete_rec.split_date := NULL;
1325    END IF;
1326    IF p_claims_int_rec.split_date IS NULL THEN
1327       x_complete_rec.split_date := l_claims_int_rec.split_date;
1328    END IF;
1329 
1330    -- root_claim_id
1331    IF p_claims_int_rec.root_claim_id = FND_API.g_miss_num THEN
1332       x_complete_rec.root_claim_id := NULL;
1333    END IF;
1334    IF p_claims_int_rec.root_claim_id IS NULL THEN
1335       x_complete_rec.root_claim_id := l_claims_int_rec.root_claim_id;
1336    END IF;
1337 
1338    -- amount
1339    IF p_claims_int_rec.amount = FND_API.g_miss_num THEN
1340       x_complete_rec.amount := NULL;
1341    END IF;
1342    IF p_claims_int_rec.amount IS NULL THEN
1343       x_complete_rec.amount := l_claims_int_rec.amount;
1344    END IF;
1345 
1346    -- amount_adjusted
1347    IF p_claims_int_rec.amount_adjusted = FND_API.g_miss_num THEN
1348       x_complete_rec.amount_adjusted := NULL;
1349    END IF;
1350    IF p_claims_int_rec.amount_adjusted IS NULL THEN
1351       x_complete_rec.amount_adjusted := l_claims_int_rec.amount_adjusted;
1352    END IF;
1353 
1354    -- amount_remaining
1355    IF p_claims_int_rec.amount_remaining = FND_API.g_miss_num THEN
1356       x_complete_rec.amount_remaining := NULL;
1357    END IF;
1358    IF p_claims_int_rec.amount_remaining IS NULL THEN
1359       x_complete_rec.amount_remaining := l_claims_int_rec.amount_remaining;
1360    END IF;
1361 
1362    -- amount_settled
1363    IF p_claims_int_rec.amount_settled = FND_API.g_miss_num THEN
1364       x_complete_rec.amount_settled := NULL;
1365    END IF;
1366    IF p_claims_int_rec.amount_settled IS NULL THEN
1367       x_complete_rec.amount_settled := l_claims_int_rec.amount_settled;
1368    END IF;
1369 
1370    -- acctd_amount
1371    IF p_claims_int_rec.acctd_amount = FND_API.g_miss_num THEN
1372       x_complete_rec.acctd_amount := NULL;
1373    END IF;
1374    IF p_claims_int_rec.acctd_amount IS NULL THEN
1375       x_complete_rec.acctd_amount := l_claims_int_rec.acctd_amount;
1376    END IF;
1377 
1378    -- acctd_amount_remaining
1379    IF p_claims_int_rec.acctd_amount_remaining = FND_API.g_miss_num THEN
1380       x_complete_rec.acctd_amount_remaining := NULL;
1381    END IF;
1382    IF p_claims_int_rec.acctd_amount_remaining IS NULL THEN
1383       x_complete_rec.acctd_amount_remaining := l_claims_int_rec.acctd_amount_remaining;
1384    END IF;
1385 
1386    -- tax_amount
1387    IF p_claims_int_rec.tax_amount = FND_API.g_miss_num THEN
1388       x_complete_rec.tax_amount := NULL;
1389    END IF;
1390    IF p_claims_int_rec.tax_amount IS NULL THEN
1391       x_complete_rec.tax_amount := l_claims_int_rec.tax_amount;
1392    END IF;
1393 
1394    -- tax_code
1395    IF p_claims_int_rec.tax_code = FND_API.g_miss_char THEN
1396       x_complete_rec.tax_code := NULL;
1397    END IF;
1398    IF p_claims_int_rec.tax_code IS NULL THEN
1399       x_complete_rec.tax_code := l_claims_int_rec.tax_code;
1400    END IF;
1401 
1402    -- tax_calculation_flag
1403    IF p_claims_int_rec.tax_calculation_flag = FND_API.g_miss_char THEN
1404       x_complete_rec.tax_calculation_flag := NULL;
1405    END IF;
1406    IF p_claims_int_rec.tax_calculation_flag IS NULL THEN
1407       x_complete_rec.tax_calculation_flag := l_claims_int_rec.tax_calculation_flag;
1408    END IF;
1409 
1410    -- currency_code
1411    IF p_claims_int_rec.currency_code = FND_API.g_miss_char THEN
1412       x_complete_rec.currency_code := NULL;
1413    END IF;
1414    IF p_claims_int_rec.currency_code IS NULL THEN
1415       x_complete_rec.currency_code := l_claims_int_rec.currency_code;
1416    END IF;
1417 
1418    -- exchange_rate_type
1419    IF p_claims_int_rec.exchange_rate_type = FND_API.g_miss_char THEN
1420       x_complete_rec.exchange_rate_type := NULL;
1421    END IF;
1422    IF p_claims_int_rec.exchange_rate_type IS NULL THEN
1423       x_complete_rec.exchange_rate_type := l_claims_int_rec.exchange_rate_type;
1424    END IF;
1425 
1426    -- exchange_rate_date
1427    IF p_claims_int_rec.exchange_rate_date = FND_API.g_miss_date THEN
1428       x_complete_rec.exchange_rate_date := NULL;
1429    END IF;
1430    IF p_claims_int_rec.exchange_rate_date IS NULL THEN
1431       x_complete_rec.exchange_rate_date := l_claims_int_rec.exchange_rate_date;
1432    END IF;
1433 
1434    -- exchange_rate
1435    IF p_claims_int_rec.exchange_rate = FND_API.g_miss_num THEN
1436       x_complete_rec.exchange_rate := NULL;
1437    END IF;
1438    IF p_claims_int_rec.exchange_rate IS NULL THEN
1439       x_complete_rec.exchange_rate := l_claims_int_rec.exchange_rate;
1440    END IF;
1441 
1442    -- set_of_books_id
1443    IF p_claims_int_rec.set_of_books_id = FND_API.g_miss_num THEN
1444       x_complete_rec.set_of_books_id := NULL;
1445    END IF;
1446    IF p_claims_int_rec.set_of_books_id IS NULL THEN
1447       x_complete_rec.set_of_books_id := l_claims_int_rec.set_of_books_id;
1448    END IF;
1449 
1450    -- original_claim_date
1451    IF p_claims_int_rec.original_claim_date = FND_API.g_miss_date THEN
1452       x_complete_rec.original_claim_date := NULL;
1453    END IF;
1454    IF p_claims_int_rec.original_claim_date IS NULL THEN
1455       x_complete_rec.original_claim_date := l_claims_int_rec.original_claim_date;
1456    END IF;
1457 
1458    -- source_object_id
1459    IF p_claims_int_rec.source_object_id = FND_API.g_miss_num THEN
1460       x_complete_rec.source_object_id := NULL;
1461    END IF;
1462    IF p_claims_int_rec.source_object_id IS NULL THEN
1463       x_complete_rec.source_object_id := l_claims_int_rec.source_object_id;
1464    END IF;
1465 
1466    -- source_object_class
1467    IF p_claims_int_rec.source_object_class = FND_API.g_miss_char THEN
1468       x_complete_rec.source_object_class := NULL;
1469    END IF;
1470    IF p_claims_int_rec.source_object_class IS NULL THEN
1471       x_complete_rec.source_object_class := l_claims_int_rec.source_object_class;
1472    END IF;
1473 
1474    -- source_object_type_id
1475    IF p_claims_int_rec.source_object_type_id = FND_API.g_miss_num THEN
1476       x_complete_rec.source_object_type_id := NULL;
1477    END IF;
1478    IF p_claims_int_rec.source_object_type_id IS NULL THEN
1479       x_complete_rec.source_object_type_id := l_claims_int_rec.source_object_type_id;
1480    END IF;
1481 
1482    -- source_object_number
1483    IF p_claims_int_rec.source_object_number = FND_API.g_miss_char THEN
1484       x_complete_rec.source_object_number := NULL;
1485    END IF;
1486    IF p_claims_int_rec.source_object_number IS NULL THEN
1487       x_complete_rec.source_object_number := l_claims_int_rec.source_object_number;
1488    END IF;
1489 
1490    -- cust_account_id
1491    IF p_claims_int_rec.cust_account_id = FND_API.g_miss_num THEN
1492       x_complete_rec.cust_account_id := NULL;
1493    END IF;
1494    IF p_claims_int_rec.cust_account_id IS NULL THEN
1495       x_complete_rec.cust_account_id := l_claims_int_rec.cust_account_id;
1496    END IF;
1497 
1498    -- cust_billto_acct_site_id
1499    IF p_claims_int_rec.cust_billto_acct_site_id = FND_API.g_miss_num THEN
1500       x_complete_rec.cust_billto_acct_site_id := NULL;
1501    END IF;
1502    IF p_claims_int_rec.cust_billto_acct_site_id IS NULL THEN
1503       x_complete_rec.cust_billto_acct_site_id := l_claims_int_rec.cust_billto_acct_site_id;
1504    END IF;
1505 
1506    -- cust_shipto_acct_site_id
1507    IF p_claims_int_rec.cust_shipto_acct_site_id = FND_API.g_miss_num THEN
1508       x_complete_rec.cust_shipto_acct_site_id := NULL;
1509    END IF;
1510    IF p_claims_int_rec.cust_shipto_acct_site_id IS NULL THEN
1511       x_complete_rec.cust_shipto_acct_site_id := l_claims_int_rec.cust_shipto_acct_site_id;
1512    END IF;
1513 
1514    -- location_id
1515    IF p_claims_int_rec.location_id = FND_API.g_miss_num THEN
1516       x_complete_rec.location_id := NULL;
1517    END IF;
1518    IF p_claims_int_rec.location_id IS NULL THEN
1519       x_complete_rec.location_id := l_claims_int_rec.location_id;
1520    END IF;
1521 
1522    -- pay_related_account_flag
1523    IF p_claims_int_rec.pay_related_account_flag = FND_API.g_miss_char THEN
1524       x_complete_rec.pay_related_account_flag := NULL;
1525    END IF;
1526    IF p_claims_int_rec.pay_related_account_flag IS NULL THEN
1527       x_complete_rec.pay_related_account_flag := l_claims_int_rec.pay_related_account_flag;
1528    END IF;
1529 
1530    -- related_cust_account_id
1531    IF p_claims_int_rec.related_cust_account_id = FND_API.g_miss_num THEN
1532       x_complete_rec.related_cust_account_id := NULL;
1533    END IF;
1534    IF p_claims_int_rec.related_cust_account_id IS NULL THEN
1535       x_complete_rec.related_cust_account_id := l_claims_int_rec.related_cust_account_id;
1536    END IF;
1537 
1538    -- related_site_use_id
1539    IF p_claims_int_rec.related_site_use_id = FND_API.g_miss_num THEN
1540       x_complete_rec.related_site_use_id := NULL;
1541    END IF;
1542    IF p_claims_int_rec.related_site_use_id IS NULL THEN
1543       x_complete_rec.related_site_use_id := l_claims_int_rec.related_site_use_id;
1544    END IF;
1545 
1546    -- relationship_type
1547    IF p_claims_int_rec.relationship_type = FND_API.g_miss_char THEN
1548       x_complete_rec.relationship_type := NULL;
1549    END IF;
1550    IF p_claims_int_rec.relationship_type IS NULL THEN
1551       x_complete_rec.relationship_type := l_claims_int_rec.relationship_type;
1552    END IF;
1553 
1554    -- vendor_id
1555    IF p_claims_int_rec.vendor_id = FND_API.g_miss_num THEN
1556       x_complete_rec.vendor_id := NULL;
1557    END IF;
1558    IF p_claims_int_rec.vendor_id IS NULL THEN
1559       x_complete_rec.vendor_id := l_claims_int_rec.vendor_id;
1560    END IF;
1561 
1562    -- vendor_site_id
1563    IF p_claims_int_rec.vendor_site_id = FND_API.g_miss_num THEN
1564       x_complete_rec.vendor_site_id := NULL;
1565    END IF;
1566    IF p_claims_int_rec.vendor_site_id IS NULL THEN
1567       x_complete_rec.vendor_site_id := l_claims_int_rec.vendor_site_id;
1568    END IF;
1569 
1570    -- reason_type
1571    IF p_claims_int_rec.reason_type = FND_API.g_miss_char THEN
1572       x_complete_rec.reason_type := NULL;
1573    END IF;
1574    IF p_claims_int_rec.reason_type IS NULL THEN
1575       x_complete_rec.reason_type := l_claims_int_rec.reason_type;
1576    END IF;
1577 
1578    -- reason_code_id
1579    IF p_claims_int_rec.reason_code_id = FND_API.g_miss_num THEN
1580       x_complete_rec.reason_code_id := NULL;
1581    END IF;
1582    IF p_claims_int_rec.reason_code_id IS NULL THEN
1583       x_complete_rec.reason_code_id := l_claims_int_rec.reason_code_id;
1584    END IF;
1585 
1586    -- task_template_group_id
1587    IF p_claims_int_rec.task_template_group_id = FND_API.g_miss_num THEN
1588       x_complete_rec.task_template_group_id := NULL;
1589    END IF;
1590    IF p_claims_int_rec.task_template_group_id IS NULL THEN
1591       x_complete_rec.task_template_group_id := l_claims_int_rec.task_template_group_id;
1592    END IF;
1593 
1594    -- status_code
1595    IF p_claims_int_rec.status_code = FND_API.g_miss_char THEN
1596       x_complete_rec.status_code := NULL;
1597    END IF;
1598    IF p_claims_int_rec.status_code IS NULL THEN
1599       x_complete_rec.status_code := l_claims_int_rec.status_code;
1600    END IF;
1601 
1602    -- user_status_id
1603    IF p_claims_int_rec.user_status_id = FND_API.g_miss_num THEN
1604       x_complete_rec.user_status_id := NULL;
1605    END IF;
1606    IF p_claims_int_rec.user_status_id IS NULL THEN
1607       x_complete_rec.user_status_id := l_claims_int_rec.user_status_id;
1608    END IF;
1609 
1610    -- sales_rep_id
1611    IF p_claims_int_rec.sales_rep_id = FND_API.g_miss_num THEN
1612       x_complete_rec.sales_rep_id := NULL;
1613    END IF;
1614    IF p_claims_int_rec.sales_rep_id IS NULL THEN
1615       x_complete_rec.sales_rep_id := l_claims_int_rec.sales_rep_id;
1616    END IF;
1617 
1618    -- collector_id
1619    IF p_claims_int_rec.collector_id = FND_API.g_miss_num THEN
1620       x_complete_rec.collector_id := NULL;
1621    END IF;
1622    IF p_claims_int_rec.collector_id IS NULL THEN
1623       x_complete_rec.collector_id := l_claims_int_rec.collector_id;
1624    END IF;
1625 
1626    -- contact_id
1627    IF p_claims_int_rec.contact_id = FND_API.g_miss_num THEN
1628       x_complete_rec.contact_id := NULL;
1629    END IF;
1630    IF p_claims_int_rec.contact_id IS NULL THEN
1631       x_complete_rec.contact_id := l_claims_int_rec.contact_id;
1632    END IF;
1633 
1634    -- broker_id
1635    IF p_claims_int_rec.broker_id = FND_API.g_miss_num THEN
1636       x_complete_rec.broker_id := NULL;
1637    END IF;
1638    IF p_claims_int_rec.broker_id IS NULL THEN
1639       x_complete_rec.broker_id := l_claims_int_rec.broker_id;
1640    END IF;
1641 
1642    -- territory_id
1643    IF p_claims_int_rec.territory_id = FND_API.g_miss_num THEN
1644       x_complete_rec.territory_id := NULL;
1645    END IF;
1646    IF p_claims_int_rec.territory_id IS NULL THEN
1647       x_complete_rec.territory_id := l_claims_int_rec.territory_id;
1648    END IF;
1649 
1650    -- customer_ref_date
1651    IF p_claims_int_rec.customer_ref_date = FND_API.g_miss_date THEN
1652       x_complete_rec.customer_ref_date := NULL;
1653    END IF;
1654    IF p_claims_int_rec.customer_ref_date IS NULL THEN
1655       x_complete_rec.customer_ref_date := l_claims_int_rec.customer_ref_date;
1656    END IF;
1657 
1658    -- customer_ref_number
1659    IF p_claims_int_rec.customer_ref_number = FND_API.g_miss_char THEN
1660       x_complete_rec.customer_ref_number := NULL;
1661    END IF;
1662    IF p_claims_int_rec.customer_ref_number IS NULL THEN
1663       x_complete_rec.customer_ref_number := l_claims_int_rec.customer_ref_number;
1664    END IF;
1665 
1666    -- assigned_to
1667    IF p_claims_int_rec.assigned_to = FND_API.g_miss_num THEN
1668       x_complete_rec.assigned_to := NULL;
1669    END IF;
1670    IF p_claims_int_rec.assigned_to IS NULL THEN
1671       x_complete_rec.assigned_to := l_claims_int_rec.assigned_to;
1672    END IF;
1673 
1674    -- receipt_id
1675    IF p_claims_int_rec.receipt_id = FND_API.g_miss_num THEN
1676       x_complete_rec.receipt_id := NULL;
1677    END IF;
1678    IF p_claims_int_rec.receipt_id IS NULL THEN
1679       x_complete_rec.receipt_id := l_claims_int_rec.receipt_id;
1680    END IF;
1681 
1682    -- receipt_number
1683    IF p_claims_int_rec.receipt_number = FND_API.g_miss_char THEN
1684       x_complete_rec.receipt_number := NULL;
1685    END IF;
1686    IF p_claims_int_rec.receipt_number IS NULL THEN
1687       x_complete_rec.receipt_number := l_claims_int_rec.receipt_number;
1688    END IF;
1689 
1690    -- doc_sequence_id
1691    IF p_claims_int_rec.doc_sequence_id = FND_API.g_miss_num THEN
1692       x_complete_rec.doc_sequence_id := NULL;
1693    END IF;
1694    IF p_claims_int_rec.doc_sequence_id IS NULL THEN
1695       x_complete_rec.doc_sequence_id := l_claims_int_rec.doc_sequence_id;
1696    END IF;
1697 
1698    -- doc_sequence_value
1699    IF p_claims_int_rec.doc_sequence_value = FND_API.g_miss_num THEN
1700       x_complete_rec.doc_sequence_value := NULL;
1701    END IF;
1702    IF p_claims_int_rec.doc_sequence_value IS NULL THEN
1703       x_complete_rec.doc_sequence_value := l_claims_int_rec.doc_sequence_value;
1704    END IF;
1705 
1706    -- gl_date
1707    IF p_claims_int_rec.gl_date = FND_API.g_miss_date THEN
1708       x_complete_rec.gl_date := NULL;
1709    END IF;
1710    IF p_claims_int_rec.gl_date IS NULL THEN
1711       x_complete_rec.gl_date := l_claims_int_rec.gl_date;
1712    END IF;
1713 
1714    -- payment_method
1715    IF p_claims_int_rec.payment_method = FND_API.g_miss_char THEN
1716       x_complete_rec.payment_method := NULL;
1717    END IF;
1718    IF p_claims_int_rec.payment_method IS NULL THEN
1719       x_complete_rec.payment_method := l_claims_int_rec.payment_method;
1720    END IF;
1721 
1722    -- voucher_id
1723    IF p_claims_int_rec.voucher_id = FND_API.g_miss_num THEN
1724       x_complete_rec.voucher_id := NULL;
1725    END IF;
1726    IF p_claims_int_rec.voucher_id IS NULL THEN
1727       x_complete_rec.voucher_id := l_claims_int_rec.voucher_id;
1728    END IF;
1729 
1730    -- voucher_number
1731    IF p_claims_int_rec.voucher_number = FND_API.g_miss_char THEN
1732       x_complete_rec.voucher_number := NULL;
1733    END IF;
1734    IF p_claims_int_rec.voucher_number IS NULL THEN
1735       x_complete_rec.voucher_number := l_claims_int_rec.voucher_number;
1736    END IF;
1737 
1738    -- payment_reference_id
1739    IF p_claims_int_rec.payment_reference_id = FND_API.g_miss_num THEN
1740       x_complete_rec.payment_reference_id := NULL;
1741    END IF;
1742    IF p_claims_int_rec.payment_reference_id IS NULL THEN
1743       x_complete_rec.payment_reference_id := l_claims_int_rec.payment_reference_id;
1744    END IF;
1745 
1746    -- payment_reference_number
1747    IF p_claims_int_rec.payment_reference_number = FND_API.g_miss_char THEN
1748       x_complete_rec.payment_reference_number := NULL;
1749    END IF;
1750    IF p_claims_int_rec.payment_reference_number IS NULL THEN
1751       x_complete_rec.payment_reference_number := l_claims_int_rec.payment_reference_number;
1752    END IF;
1753 
1754    -- payment_reference_date
1755    IF p_claims_int_rec.payment_reference_date = FND_API.g_miss_date THEN
1756       x_complete_rec.payment_reference_date := NULL;
1757    END IF;
1758    IF p_claims_int_rec.payment_reference_date IS NULL THEN
1759       x_complete_rec.payment_reference_date := l_claims_int_rec.payment_reference_date;
1760    END IF;
1761 
1762    -- payment_status
1763    IF p_claims_int_rec.payment_status = FND_API.g_miss_char THEN
1764       x_complete_rec.payment_status := NULL;
1765    END IF;
1766    IF p_claims_int_rec.payment_status IS NULL THEN
1767       x_complete_rec.payment_status := l_claims_int_rec.payment_status;
1768    END IF;
1769 
1770    -- approved_flag
1771    IF p_claims_int_rec.approved_flag = FND_API.g_miss_char THEN
1772       x_complete_rec.approved_flag := NULL;
1773    END IF;
1774    IF p_claims_int_rec.approved_flag IS NULL THEN
1775       x_complete_rec.approved_flag := l_claims_int_rec.approved_flag;
1776    END IF;
1777 
1778    -- approved_date
1779    IF p_claims_int_rec.approved_date = FND_API.g_miss_date THEN
1780       x_complete_rec.approved_date := NULL;
1781    END IF;
1782    IF p_claims_int_rec.approved_date IS NULL THEN
1783       x_complete_rec.approved_date := l_claims_int_rec.approved_date;
1784    END IF;
1785 
1786    -- approved_by
1787    IF p_claims_int_rec.approved_by = FND_API.g_miss_num THEN
1788       x_complete_rec.approved_by := NULL;
1789    END IF;
1790    IF p_claims_int_rec.approved_by IS NULL THEN
1791       x_complete_rec.approved_by := l_claims_int_rec.approved_by;
1792    END IF;
1793 
1794    -- settled_date
1795    IF p_claims_int_rec.settled_date = FND_API.g_miss_date THEN
1796       x_complete_rec.settled_date := NULL;
1797    END IF;
1798    IF p_claims_int_rec.settled_date IS NULL THEN
1799       x_complete_rec.settled_date := l_claims_int_rec.settled_date;
1800    END IF;
1801 
1802    -- settled_by
1803    IF p_claims_int_rec.settled_by = FND_API.g_miss_num THEN
1804       x_complete_rec.settled_by := NULL;
1805    END IF;
1806    IF p_claims_int_rec.settled_by IS NULL THEN
1807       x_complete_rec.settled_by := l_claims_int_rec.settled_by;
1808    END IF;
1809 
1810    -- effective_date
1811    IF p_claims_int_rec.effective_date = FND_API.g_miss_date THEN
1812       x_complete_rec.effective_date := NULL;
1813    END IF;
1814    IF p_claims_int_rec.effective_date IS NULL THEN
1815       x_complete_rec.effective_date := l_claims_int_rec.effective_date;
1816    END IF;
1817 
1818    -- custom_setup_id
1819    IF p_claims_int_rec.custom_setup_id = FND_API.g_miss_num THEN
1820       x_complete_rec.custom_setup_id := NULL;
1821    END IF;
1822    IF p_claims_int_rec.custom_setup_id IS NULL THEN
1823       x_complete_rec.custom_setup_id := l_claims_int_rec.custom_setup_id;
1824    END IF;
1825 
1826    -- task_id
1827    IF p_claims_int_rec.task_id = FND_API.g_miss_num THEN
1828       x_complete_rec.task_id := NULL;
1829    END IF;
1830    IF p_claims_int_rec.task_id IS NULL THEN
1831       x_complete_rec.task_id := l_claims_int_rec.task_id;
1832    END IF;
1833 
1834    -- country_id
1835    IF p_claims_int_rec.country_id = FND_API.g_miss_num THEN
1836       x_complete_rec.country_id := NULL;
1837    END IF;
1838    IF p_claims_int_rec.country_id IS NULL THEN
1839       x_complete_rec.country_id := l_claims_int_rec.country_id;
1840    END IF;
1841 
1842    -- order_type_id
1843    IF p_claims_int_rec.order_type_id = FND_API.g_miss_num THEN
1844       x_complete_rec.order_type_id := NULL;
1845    END IF;
1846    IF p_claims_int_rec.order_type_id IS NULL THEN
1847       x_complete_rec.order_type_id := l_claims_int_rec.order_type_id;
1848    END IF;
1849 
1850    -- comments
1851    IF p_claims_int_rec.comments = FND_API.g_miss_char THEN
1852       x_complete_rec.comments := NULL;
1853    END IF;
1854    IF p_claims_int_rec.comments IS NULL THEN
1855       x_complete_rec.comments := l_claims_int_rec.comments;
1856    END IF;
1857 
1858    -- attribute_category
1859    IF p_claims_int_rec.attribute_category = FND_API.g_miss_char THEN
1860       x_complete_rec.attribute_category := NULL;
1861    END IF;
1862    IF p_claims_int_rec.attribute_category IS NULL THEN
1863       x_complete_rec.attribute_category := l_claims_int_rec.attribute_category;
1864    END IF;
1865 
1866    -- attribute1
1867    IF p_claims_int_rec.attribute1 = FND_API.g_miss_char THEN
1868       x_complete_rec.attribute1 := NULL;
1869    END IF;
1870    IF p_claims_int_rec.attribute1 IS NULL THEN
1871       x_complete_rec.attribute1 := l_claims_int_rec.attribute1;
1872    END IF;
1873 
1874    -- attribute2
1875    IF p_claims_int_rec.attribute2 = FND_API.g_miss_char THEN
1876       x_complete_rec.attribute2 := NULL;
1877    END IF;
1878    IF p_claims_int_rec.attribute2 IS NULL THEN
1879       x_complete_rec.attribute2 := l_claims_int_rec.attribute2;
1880    END IF;
1881 
1882    -- attribute3
1883    IF p_claims_int_rec.attribute3 = FND_API.g_miss_char THEN
1884       x_complete_rec.attribute3 := NULL;
1885    END IF;
1886    IF p_claims_int_rec.attribute3 IS NULL THEN
1887       x_complete_rec.attribute3 := l_claims_int_rec.attribute3;
1888    END IF;
1889 
1890    -- attribute4
1891    IF p_claims_int_rec.attribute4 = FND_API.g_miss_char THEN
1892       x_complete_rec.attribute4 := NULL;
1893    END IF;
1894    IF p_claims_int_rec.attribute4 IS NULL THEN
1895       x_complete_rec.attribute4 := l_claims_int_rec.attribute4;
1896    END IF;
1897 
1898    -- attribute5
1899    IF p_claims_int_rec.attribute5 = FND_API.g_miss_char THEN
1900       x_complete_rec.attribute5 := NULL;
1901    END IF;
1902    IF p_claims_int_rec.attribute5 IS NULL THEN
1903       x_complete_rec.attribute5 := l_claims_int_rec.attribute5;
1904    END IF;
1905 
1906    -- attribute6
1907    IF p_claims_int_rec.attribute6 = FND_API.g_miss_char THEN
1908       x_complete_rec.attribute6 := NULL;
1909    END IF;
1910    IF p_claims_int_rec.attribute6 IS NULL THEN
1911       x_complete_rec.attribute6 := l_claims_int_rec.attribute6;
1912    END IF;
1913 
1914    -- attribute7
1915    IF p_claims_int_rec.attribute7 = FND_API.g_miss_char THEN
1916       x_complete_rec.attribute7 := NULL;
1917    END IF;
1918    IF p_claims_int_rec.attribute7 IS NULL THEN
1919       x_complete_rec.attribute7 := l_claims_int_rec.attribute7;
1920    END IF;
1921 
1922    -- attribute8
1923    IF p_claims_int_rec.attribute8 = FND_API.g_miss_char THEN
1924       x_complete_rec.attribute8 := NULL;
1925    END IF;
1926    IF p_claims_int_rec.attribute8 IS NULL THEN
1927       x_complete_rec.attribute8 := l_claims_int_rec.attribute8;
1928    END IF;
1929 
1930    -- attribute9
1931    IF p_claims_int_rec.attribute9 = FND_API.g_miss_char THEN
1932       x_complete_rec.attribute9 := NULL;
1933    END IF;
1934    IF p_claims_int_rec.attribute9 IS NULL THEN
1935       x_complete_rec.attribute9 := l_claims_int_rec.attribute9;
1936    END IF;
1937 
1938    -- attribute10
1939    IF p_claims_int_rec.attribute10 = FND_API.g_miss_char THEN
1940       x_complete_rec.attribute10 := NULL;
1941    END IF;
1942    IF p_claims_int_rec.attribute10 IS NULL THEN
1943       x_complete_rec.attribute10 := l_claims_int_rec.attribute10;
1944    END IF;
1945 
1946    -- attribute11
1947    IF p_claims_int_rec.attribute11 = FND_API.g_miss_char THEN
1948       x_complete_rec.attribute11 := NULL;
1949    END IF;
1950    IF p_claims_int_rec.attribute11 IS NULL THEN
1951       x_complete_rec.attribute11 := l_claims_int_rec.attribute11;
1952    END IF;
1953 
1954    -- attribute12
1955    IF p_claims_int_rec.attribute12 = FND_API.g_miss_char THEN
1956       x_complete_rec.attribute12 := NULL;
1957    END IF;
1958    IF p_claims_int_rec.attribute12 IS NULL THEN
1959       x_complete_rec.attribute12 := l_claims_int_rec.attribute12;
1960    END IF;
1961 
1962    -- attribute13
1963    IF p_claims_int_rec.attribute13 = FND_API.g_miss_char THEN
1964       x_complete_rec.attribute13 := NULL;
1965    END IF;
1966    IF p_claims_int_rec.attribute13 IS NULL THEN
1967       x_complete_rec.attribute13 := l_claims_int_rec.attribute13;
1968    END IF;
1969 
1970    -- attribute14
1971    IF p_claims_int_rec.attribute14 = FND_API.g_miss_char THEN
1972       x_complete_rec.attribute14 := NULL;
1973    END IF;
1974    IF p_claims_int_rec.attribute14 IS NULL THEN
1975       x_complete_rec.attribute14 := l_claims_int_rec.attribute14;
1976    END IF;
1977 
1978    -- attribute15
1979    IF p_claims_int_rec.attribute15 = FND_API.g_miss_char THEN
1980       x_complete_rec.attribute15 := NULL;
1981    END IF;
1982    IF p_claims_int_rec.attribute15 IS NULL THEN
1983       x_complete_rec.attribute15 := l_claims_int_rec.attribute15;
1984    END IF;
1985 
1986    -- deduction_attribute_category
1987    IF p_claims_int_rec.deduction_attribute_category = FND_API.g_miss_char THEN
1988       x_complete_rec.deduction_attribute_category := NULL;
1989    END IF;
1990    IF p_claims_int_rec.deduction_attribute_category IS NULL THEN
1991       x_complete_rec.deduction_attribute_category := l_claims_int_rec.deduction_attribute_category;
1992    END IF;
1993 
1994    -- deduction_attribute1
1995    IF p_claims_int_rec.deduction_attribute1 = FND_API.g_miss_char THEN
1996       x_complete_rec.deduction_attribute1 := NULL;
1997    END IF;
1998    IF p_claims_int_rec.deduction_attribute1 IS NULL THEN
1999       x_complete_rec.deduction_attribute1 := l_claims_int_rec.deduction_attribute1;
2000    END IF;
2001 
2002    -- deduction_attribute2
2003    IF p_claims_int_rec.deduction_attribute2 = FND_API.g_miss_char THEN
2004       x_complete_rec.deduction_attribute2 := NULL;
2005    END IF;
2006    IF p_claims_int_rec.deduction_attribute2 IS NULL THEN
2007       x_complete_rec.deduction_attribute2 := l_claims_int_rec.deduction_attribute2;
2008    END IF;
2009 
2010    -- deduction_attribute3
2011    IF p_claims_int_rec.deduction_attribute3 = FND_API.g_miss_char THEN
2012       x_complete_rec.deduction_attribute3 := NULL;
2013    END IF;
2014    IF p_claims_int_rec.deduction_attribute3 IS NULL THEN
2015       x_complete_rec.deduction_attribute3 := l_claims_int_rec.deduction_attribute3;
2016    END IF;
2017 
2018    -- deduction_attribute4
2019    IF p_claims_int_rec.deduction_attribute4 = FND_API.g_miss_char THEN
2020       x_complete_rec.deduction_attribute4 := NULL;
2021    END IF;
2022    IF p_claims_int_rec.deduction_attribute4 IS NULL THEN
2023       x_complete_rec.deduction_attribute4 := l_claims_int_rec.deduction_attribute4;
2024    END IF;
2025 
2026    -- deduction_attribute5
2027    IF p_claims_int_rec.deduction_attribute5 = FND_API.g_miss_char THEN
2028       x_complete_rec.deduction_attribute5 := NULL;
2029    END IF;
2030    IF p_claims_int_rec.deduction_attribute5 IS NULL THEN
2031       x_complete_rec.deduction_attribute5 := l_claims_int_rec.deduction_attribute5;
2032    END IF;
2033 
2034    -- deduction_attribute6
2035    IF p_claims_int_rec.deduction_attribute6 = FND_API.g_miss_char THEN
2036       x_complete_rec.deduction_attribute6 := NULL;
2037    END IF;
2038    IF p_claims_int_rec.deduction_attribute6 IS NULL THEN
2039       x_complete_rec.deduction_attribute6 := l_claims_int_rec.deduction_attribute6;
2040    END IF;
2041 
2042    -- deduction_attribute7
2043    IF p_claims_int_rec.deduction_attribute7 = FND_API.g_miss_char THEN
2044       x_complete_rec.deduction_attribute7 := NULL;
2045    END IF;
2046    IF p_claims_int_rec.deduction_attribute7 IS NULL THEN
2047       x_complete_rec.deduction_attribute7 := l_claims_int_rec.deduction_attribute7;
2048    END IF;
2049 
2050    -- deduction_attribute8
2051    IF p_claims_int_rec.deduction_attribute8 = FND_API.g_miss_char THEN
2052       x_complete_rec.deduction_attribute8 := NULL;
2053    END IF;
2054    IF p_claims_int_rec.deduction_attribute8 IS NULL THEN
2055       x_complete_rec.deduction_attribute8 := l_claims_int_rec.deduction_attribute8;
2056    END IF;
2057 
2058    -- deduction_attribute9
2059    IF p_claims_int_rec.deduction_attribute9 = FND_API.g_miss_char THEN
2060       x_complete_rec.deduction_attribute9 := NULL;
2061    END IF;
2062    IF p_claims_int_rec.deduction_attribute9 IS NULL THEN
2063       x_complete_rec.deduction_attribute9 := l_claims_int_rec.deduction_attribute9;
2064    END IF;
2065 
2066    -- deduction_attribute10
2067    IF p_claims_int_rec.deduction_attribute10 = FND_API.g_miss_char THEN
2068       x_complete_rec.deduction_attribute10 := NULL;
2069    END IF;
2070    IF p_claims_int_rec.deduction_attribute10 IS NULL THEN
2071       x_complete_rec.deduction_attribute10 := l_claims_int_rec.deduction_attribute10;
2072    END IF;
2073 
2074    -- deduction_attribute11
2075    IF p_claims_int_rec.deduction_attribute11 = FND_API.g_miss_char THEN
2076       x_complete_rec.deduction_attribute11 := NULL;
2077    END IF;
2078    IF p_claims_int_rec.deduction_attribute11 IS NULL THEN
2079       x_complete_rec.deduction_attribute11 := l_claims_int_rec.deduction_attribute11;
2080    END IF;
2081 
2082    -- deduction_attribute12
2083    IF p_claims_int_rec.deduction_attribute12 = FND_API.g_miss_char THEN
2084       x_complete_rec.deduction_attribute12 := NULL;
2085    END IF;
2086    IF p_claims_int_rec.deduction_attribute12 IS NULL THEN
2087       x_complete_rec.deduction_attribute12 := l_claims_int_rec.deduction_attribute12;
2088    END IF;
2089 
2090    -- deduction_attribute13
2091    IF p_claims_int_rec.deduction_attribute13 = FND_API.g_miss_char THEN
2092       x_complete_rec.deduction_attribute13 := NULL;
2093    END IF;
2094    IF p_claims_int_rec.deduction_attribute13 IS NULL THEN
2095       x_complete_rec.deduction_attribute13 := l_claims_int_rec.deduction_attribute13;
2096    END IF;
2097 
2098    -- deduction_attribute14
2099    IF p_claims_int_rec.deduction_attribute14 = FND_API.g_miss_char THEN
2100       x_complete_rec.deduction_attribute14 := NULL;
2101    END IF;
2102    IF p_claims_int_rec.deduction_attribute14 IS NULL THEN
2103       x_complete_rec.deduction_attribute14 := l_claims_int_rec.deduction_attribute14;
2104    END IF;
2105 
2106    -- deduction_attribute15
2107    IF p_claims_int_rec.deduction_attribute15 = FND_API.g_miss_char THEN
2108       x_complete_rec.deduction_attribute15 := NULL;
2109    END IF;
2110    IF p_claims_int_rec.deduction_attribute15 IS NULL THEN
2111       x_complete_rec.deduction_attribute15 := l_claims_int_rec.deduction_attribute15;
2112    END IF;
2113 
2114    -- org_id
2115    IF p_claims_int_rec.org_id = FND_API.g_miss_num THEN
2116       x_complete_rec.org_id := NULL;
2117    END IF;
2118    IF p_claims_int_rec.org_id IS NULL THEN
2119       x_complete_rec.org_id := l_claims_int_rec.org_id;
2120    END IF;
2121 
2122    IF p_claims_int_rec.customer_reason = FND_API.g_miss_char THEN
2123       x_complete_rec.customer_reason := NULL;
2124    END IF;
2125    IF p_claims_int_rec.customer_reason IS NULL THEN
2126       x_complete_rec.customer_reason := l_claims_int_rec.customer_reason;
2127    END IF;
2128 
2129    IF p_claims_int_rec.ship_to_cust_account_id = FND_API.g_miss_num THEN
2130       x_complete_rec.ship_to_cust_account_id := NULL;
2131    END IF;
2132    IF p_claims_int_rec.ship_to_cust_account_id IS NULL THEN
2133       x_complete_rec.ship_to_cust_account_id := l_claims_int_rec.ship_to_cust_account_id;
2134    END IF;
2135 
2136 
2137 END Complete_claims_int_Rec;
2138 
2139 PROCEDURE Validate_claims_int(
2140     p_api_version_number         IN   NUMBER,
2141     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
2142     p_validation_level           IN   NUMBER := FND_API.G_VALID_LEVEL_FULL,
2143     p_claims_int_rec               IN   claims_int_rec_type,
2144     x_return_status              OUT NOCOPY  VARCHAR2,
2145     x_msg_count                  OUT NOCOPY  NUMBER,
2146     x_msg_data                   OUT NOCOPY  VARCHAR2
2147     )
2148 IS
2149 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Validate_Claims_Int';
2150 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
2151 l_object_version_number     NUMBER;
2152 l_claims_int_rec  OZF_Claims_Int_PVT.claims_int_rec_type;
2153 
2154 BEGIN
2155    -- Standard Start of API savepoint
2156    SAVEPOINT VALIDATE_Claims_Int_;
2157 
2158    -- Standard call to check for call compatibility.
2159    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
2160                                         p_api_version_number,
2161                                         l_api_name,
2162                                         G_PKG_NAME)
2163    THEN
2164        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2165    END IF;
2166 
2167    -- Initialize message list if p_init_msg_list is set to TRUE.
2168    IF FND_API.to_Boolean( p_init_msg_list )
2169    THEN
2170       FND_MSG_PUB.initialize;
2171    END IF;
2172    IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
2173            Check_claims_int_Items(
2174               p_claims_int_rec        => p_claims_int_rec,
2175               p_validation_mode   => JTF_PLSQL_API.g_update,
2176               x_return_status     => x_return_status
2177            );
2178 
2179            IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2180                RAISE FND_API.G_EXC_ERROR;
2181            ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2182                RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2183            END IF;
2184    END IF;
2185 
2186    Complete_claims_int_Rec(
2187       p_claims_int_rec        => p_claims_int_rec,
2188       x_complete_rec        => l_claims_int_rec
2189    );
2190 
2191    IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
2192       Validate_claims_int_Rec(
2193         p_api_version_number     => 1.0,
2194         p_init_msg_list          => FND_API.G_FALSE,
2195         x_return_status          => x_return_status,
2196         x_msg_count              => x_msg_count,
2197         x_msg_data               => x_msg_data,
2198         p_claims_int_rec           =>    l_claims_int_rec);
2199 
2200            IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2201               RAISE FND_API.G_EXC_ERROR;
2202            ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2203               RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2204            END IF;
2205    END IF;
2206 
2207    -- Debug Message
2208    IF OZF_DEBUG_HIGH_ON THEN
2209       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
2210    END IF;
2211 
2212    -- Initialize API return status to SUCCESS
2213    x_return_status := FND_API.G_RET_STS_SUCCESS;
2214 
2215    -- Debug Message
2216    IF OZF_DEBUG_HIGH_ON THEN
2217       OZF_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
2218    END IF;
2219 
2220    -- Standard call to get message count and if count is 1, get message info.
2221    FND_MSG_PUB.Count_And_Get
2222      (p_count          =>   x_msg_count,
2223       p_data           =>   x_msg_data
2224    );
2225 EXCEPTION
2226    WHEN OZF_Utility_PVT.resource_locked THEN
2227       x_return_status := FND_API.g_ret_sts_error;
2228       OZF_Utility_PVT.Error_Message(p_message_name =>'OZF_API_RESOURCE_LOCKED');
2229    WHEN FND_API.G_EXC_ERROR THEN
2230       ROLLBACK TO VALIDATE_Claims_Int_;
2231       x_return_status := FND_API.G_RET_STS_ERROR;
2232       -- Standard call to get message count and if count=1, get the message
2233       FND_MSG_PUB.Count_And_Get (
2234             p_encoded => FND_API.G_FALSE,
2235             p_count   => x_msg_count,
2236             p_data    => x_msg_data
2237       );
2238    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2239       ROLLBACK TO VALIDATE_Claims_Int_;
2240       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2241       -- Standard call to get message count and if count=1, get the message
2242       FND_MSG_PUB.Count_And_Get (
2243             p_encoded => FND_API.G_FALSE,
2244             p_count => x_msg_count,
2245             p_data  => x_msg_data
2246       );
2247    WHEN OTHERS THEN
2248       ROLLBACK TO VALIDATE_Claims_Int_;
2249       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2250       IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2251       THEN
2252          FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
2253       END IF;
2254       -- Standard call to get message count and if count=1, get the message
2255       FND_MSG_PUB.Count_And_Get (
2256             p_encoded => FND_API.G_FALSE,
2257             p_count => x_msg_count,
2258             p_data  => x_msg_data
2259       );
2260 End Validate_Claims_Int;
2261 
2262 PROCEDURE Validate_claims_int_rec(
2263     p_api_version_number         IN   NUMBER,
2264     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
2265     x_return_status              OUT NOCOPY  VARCHAR2,
2266     x_msg_count                  OUT NOCOPY  NUMBER,
2267     x_msg_data                   OUT NOCOPY  VARCHAR2,
2268     p_claims_int_rec               IN    claims_int_rec_type
2269     )
2270 IS
2271 BEGIN
2272    -- Initialize message list if p_init_msg_list is set to TRUE.
2273    IF FND_API.to_Boolean( p_init_msg_list )
2274    THEN
2275       FND_MSG_PUB.initialize;
2276    END IF;
2277 
2278    -- Initialize API return status to SUCCESS
2279    x_return_status := FND_API.G_RET_STS_SUCCESS;
2280 
2281    -- Hint: Validate data
2282    -- If data not valid
2283    -- THEN
2284    -- x_return_status := FND_API.G_RET_STS_ERROR;
2285 
2286    -- Debug Message
2287    IF OZF_DEBUG_HIGH_ON THEN
2288       OZF_UTILITY_PVT.debug_message('Private API: Validate_claims_int_rec');
2289    END IF;
2290    -- Standard call to get message count and if count is 1, get message info.
2291    FND_MSG_PUB.Count_And_Get
2292      (p_count          =>   x_msg_count,
2293       p_data           =>   x_msg_data
2294    );
2295 END Validate_claims_int_Rec;
2296 
2297 ---------------------------------------------------------------------
2298 --   PROCEDURE:  cleanup_claims
2299 --
2300 --   PURPOSE:
2301 --   This procedure purges records from ozf_claims_all and ozf_claim_lines_all tables
2302 --   for a given claim_id.
2303 --
2304 --   PARAMETERS:
2305 --   IN:
2306 --       p_claim_id number
2307 --   OUT:
2308 --       x_return_status VARCHAR2
2309 --   NOTES:
2310 --
2311 ---------------------------------------------------------------------
2312 
2313 PROCEDURE cleanup_claims (
2314     p_claim_id   in number,
2315     x_return_status OUT NOCOPY varchar2
2316 )
2317 IS
2318 BEGIN
2319    -- Debug Message
2320    IF OZF_DEBUG_HIGH_ON THEN
2321       OZF_UTILITY_PVT.debug_message('Private API: Clean up Claims');
2322    END IF;
2323    x_return_status := FND_API.G_RET_STS_SUCCESS;
2324 
2325    delete from ozf_claims_all where claim_id = p_claim_id;
2326    delete from ozf_claim_lines_all where claim_id = p_claim_id;
2327 
2328 EXCEPTION
2329   WHEN OTHERS THEN
2330      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2331      IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_unexp_error) THEN
2332         FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_DELETE_ERR');
2333         FND_MSG_PUB.add;
2334      END IF;
2335 END cleanup_claims;
2336 
2337 ---------------------------------------------------------------------
2338 --   PROCEDURE:  Start_Replicate
2339 --
2340 --   PURPOSE:
2341 --   This procedure reads information from ozf_claims_int_all table
2342 --   and inserts claims to ozf_claims_all table.
2343 --
2344 --   PARAMETERS:
2345 --
2346 --   OUT:
2347 --       ERRBUT VARCHAR2
2348 --       RETCODE NUMBER
2349 --   NOTES:
2350 --
2351 ---------------------------------------------------------------------
2352 PROCEDURE Start_Replicate (
2353     ERRBUF    OUT NOCOPY VARCHAR2,
2354     RETCODE   OUT NOCOPY NUMBER,
2355     p_org_id  IN  		 NUMBER DEFAULT NULL
2356 )
2357 IS
2358 l_claim_rec     OZF_CLAIM_PVT.claim_rec_type;
2359 l_x_claim_rec   OZF_CLAIM_PVT.claim_rec_type;
2360 l_line_rec      OZF_Claim_Line_PVT.claim_line_rec_type;
2361 l_claim_id      NUMBER;
2362 l_line_id       NUMBER;
2363 
2364 l_return_status     VARCHAR2(1);
2365 l_msg_data          VARCHAR2(200);
2366 l_msg_count         NUMBER;
2367 l_full_name varchar2(30) := 'Import API: Start Replicate';
2368 CURSOR c_claim_int IS
2369 SELECT *
2370 FROM ozf_claims_int_all
2371 WHERE claim_id is null;
2372 l_claim_int_rec c_claim_int%ROWTYPE;
2373 
2374 CURSOR c_claim_line_int(cv_claim_id IN NUMBER) IS
2375 SELECT *
2376 FROM ozf_claim_lines_int_all
2377 WHERE interface_claim_id = cv_claim_id;
2378 l_line_int_rec  c_claim_line_int%ROWTYPE;
2379 
2380 l_api_name          CONSTANT VARCHAR2(30) := 'Import_Claim';
2381 
2382 CURSOR object_class_csr(p_id in number) IS
2383 SELECT type
2384 FROM ra_cust_trx_types_all
2385 WHERE cust_trx_type_id = p_id;
2386 
2387 CURSOR claim_number_csr(p_id in number) IS
2388 SELECT claim_number
2389 FROM ozf_claims_all
2390 WHERE claim_id = p_id;
2391 l_claim_number   VARCHAR2(30);
2392 
2393 --Multiorg Changes
2394 CURSOR operating_unit_csr IS
2395     SELECT ou.organization_id   org_id
2396     FROM hr_operating_units ou
2397     WHERE mo_global.check_access(ou.organization_id) = 'Y';
2398 
2399 m NUMBER := 0;
2400 l_org_id     OZF_UTILITY_PVT.operating_units_tbl;
2401 
2402 BEGIN
2403    -- Debug Message
2404    IF OZF_DEBUG_LOW_ON THEN
2405       FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
2406       FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
2407       FND_MSG_PUB.Add;
2408    END IF;
2409    SAVEPOINT  Start_Replicate_IMP;
2410 
2411    ERRBUF  := null;
2412    RETCODE := 0;
2413 
2414 
2415 --Multiorg Changes
2416 MO_GLOBAL.init('OZF');
2417 
2418 IF p_org_id IS NULL THEN
2419 	MO_GLOBAL.set_policy_context('M',null);
2420     OPEN operating_unit_csr;
2421     LOOP
2422        FETCH operating_unit_csr into l_org_id(m);
2423        m := m + 1;
2424        EXIT WHEN operating_unit_csr%NOTFOUND;
2425     END LOOP;
2426     CLOSE operating_unit_csr;
2427 ELSE
2428     l_org_id(m) := p_org_id;
2429 END IF;
2430 
2431 --Multiorg Changes
2432 IF (l_org_id.COUNT > 0) THEN
2433     FOR m IN l_org_id.FIRST..l_org_id.LAST LOOP
2434        MO_GLOBAL.set_policy_context('S',l_org_id(m));
2435 	   -- Write OU info to OUT file
2436 	   FND_FILE.PUT_LINE(FND_FILE.OUTPUT,  'Operating Unit: ' || MO_GLOBAL.get_ou_name(l_org_id(m)));
2437 	   FND_FILE.PUT_LINE(FND_FILE.OUTPUT,  '-----------------------------------------------------');
2438 	   -- Write OU info to LOG file
2439 	   FND_FILE.PUT_LINE(FND_FILE.LOG,  'Operating Unit: ' || MO_GLOBAL.get_ou_name(l_org_id(m)));
2440 	   FND_FILE.PUT_LINE(FND_FILE.LOG,  '-----------------------------------------------------');
2441 
2442 	   OPEN c_claim_int;
2443 	   LOOP
2444 		  <<next_claim>>
2445 		  FETCH c_claim_int INTO l_claim_int_rec;
2446 		  EXIT WHEN c_claim_int%NOTFOUND;
2447 
2448 		  -- Default values for interface table
2449 		  --Get claim class
2450 		  IF l_claim_int_rec.claim_class IS NULL
2451 		  THEN
2452 			  if l_claim_int_rec.amount >0 then
2453 				 l_claim_int_rec.claim_class := G_CLAIM_CLASS;
2454 			  else
2455 				 l_claim_int_rec.claim_class := G_CHARGE_CLASS;
2456 			  end if;
2457 		  ELSE
2458 			 IF l_claim_int_rec.claim_class <> G_CLAIM_CLASS AND
2459 			  l_claim_int_rec.claim_class <> G_CHARGE_CLASS AND
2460 			  l_claim_int_rec.claim_class <> G_DEDUCTION_CLASS AND
2461 			  l_claim_int_rec.claim_class <> G_OVERPAYMENT_CLASS THEN
2462 			-- write a message 'Wrong claim class'
2463 				IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.g_msg_lvl_error) THEN
2464 				   FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_CLAIM_CLASS_WRG');
2465 					FND_MSG_PUB.Add;
2466 				   FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2467 				   FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2468 				   FND_MSG_PUB.Add;
2469 				  END IF;
2470 				 GOTO next_claim;
2471 		   END IF;
2472 		  END IF; --end if for line 2402
2473 
2474 		  -- Check deduction items if it's a deduction.
2475 		  IF (l_claim_int_rec.claim_class = G_DEDUCTION_CLASS AND
2476 			  ((l_claim_int_rec.cust_account_id is NULL OR
2477 		   l_claim_int_rec.cust_account_id = FND_API.G_MISS_NUM) OR
2478 			  (l_claim_int_rec.receipt_id is NULL OR
2479 		   l_claim_int_rec.receipt_id = FND_API.G_MISS_NUM) OR
2480 			  (l_claim_int_rec.receipt_number is NULL OR
2481 		   l_claim_int_rec.receipt_number = FND_API.G_MISS_CHAR) OR
2482 			  (l_claim_int_rec.currency_code is NULL OR
2483 		   l_claim_int_rec.currency_code = FND_API.G_MISS_CHAR) OR
2484 			  (l_claim_int_rec.amount is NULL OR
2485 		   l_claim_int_rec.amount = FND_API.G_MISS_NUM)))  THEN
2486 
2487 			  IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2488 				 FND_MESSAGE.Set_Name('OZF','OZF_REQUIRED_FIELDS_MISSING');
2489 				 FND_MSG_PUB.Add;
2490 				 FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2491 				 FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2492 				 FND_MSG_PUB.Add;
2493 			  END IF;
2494 			  GOTO next_claim;
2495 		  END IF;  --end if for line 2427
2496 
2497 		  -- Verify claim_class based on input
2498 		  IF l_claim_int_rec.claim_class <> G_CLAIM_CLASS
2499 		  AND l_claim_int_rec.claim_class <> G_CHARGE_CLASS
2500 		  THEN
2501 			 IF (l_claim_int_rec.SOURCE_OBJECT_ID <> FND_API.G_MISS_NUM OR
2502 				 l_claim_int_rec.SOURCE_OBJECT_ID is not NULL ) THEN
2503 
2504 				 IF (l_claim_int_rec.source_object_type_id is null) THEN
2505 					 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2506 						FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_SRC_INFO_MISSING');
2507 						FND_MSG_PUB.add;
2508 						 FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2509 						FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2510 						FND_MSG_PUB.Add;
2511 					 END IF;
2512 					 GOTO next_claim;
2513 				 ELSE
2514 					IF (l_claim_int_rec.amount < 0) THEN
2515 						IF l_claim_int_rec.claim_class <> G_OVERPAYMENT_CLASS THEN
2516 							 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2517 							  FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_AMT_NEG');
2518 							  FND_MSG_PUB.add;
2519 								 FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2520 							  FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2521 							  FND_MSG_PUB.Add;
2522 						   END IF;
2523 						   GOTO next_claim;
2524 					   END IF;
2525 					ELSE
2526 					   IF l_claim_int_rec.claim_class <> G_DEDUCTION_CLASS THEN
2527 						   IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2528 							  FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_AMT_POS_OPM');
2529 							  FND_MSG_PUB.add;
2530 							  FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2531 							  FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2532 							  FND_MSG_PUB.Add;
2533 						   END IF;
2534 						   GOTO next_claim;
2535 					   END IF;
2536 				   END IF; --end if for line 2466
2537 
2538 					OPEN object_class_csr(l_claim_int_rec.source_object_type_id);
2539 					FETCH object_class_csr INTO l_claim_int_rec.SOURCE_OBJECT_CLASS;
2540 					CLOSE object_class_csr;
2541 
2542 					IF l_claim_int_rec.SOURCE_OBJECT_CLASS = 'INV' THEN
2543 					   l_claim_int_rec.SOURCE_OBJECT_CLASS := 'INVOICE';
2544 					END IF;
2545 				 END IF; --end if for line 2456
2546 			 ELSE --else for if in line 2453
2547 			   IF (l_claim_int_rec.amount < 0) THEN
2548 				  l_claim_int_rec.amount := l_claim_int_rec.amount * -1;
2549 				  IF l_claim_int_rec.claim_class <> G_DEDUCTION_CLASS THEN
2550 						IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2551 						FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_NEG_AMT_WOR_DEDU');
2552 						FND_MSG_PUB.add;
2553 						 FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2554 						FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2555 						FND_MSG_PUB.Add;
2556 					 END IF;
2557 					 GOTO next_claim;
2558 				  END IF;
2559 			   ELSE
2560 				  l_claim_int_rec.amount := l_claim_int_rec.amount * -1;
2561 				   IF l_claim_int_rec.claim_class <> G_OVERPAYMENT_CLASS THEN
2562 					 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
2563 						FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_POS_AMT_WOR_OPM');
2564 						FND_MSG_PUB.add;
2565 						 FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2566 						FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2567 						FND_MSG_PUB.Add;
2568 					 END IF;
2569 					 GOTO next_claim;
2570 			   END IF;
2571 			   END IF; --end if for line 2499
2572 			 END IF; --end if for line 2453
2573 		  END IF; --end if for line 2451
2574 
2575 
2576 		  -- Set user_status_id as 'OPEN'
2577 		  l_claim_int_rec.user_status_id := to_number( ozf_utility_pvt.GET_DEFAULT_USER_STATUS(
2578 											  P_STATUS_TYPE=> G_CLAIM_STATUS,
2579 											  P_STATUS_CODE=> G_OPEN_STATUS
2580 										 )
2581 						);
2582 		  l_claim_int_rec.status_code       := 'OPEN';
2583 		  l_claim_rec.request_id           := FND_GLOBAL.conc_request_id;
2584 		  l_claim_rec.program_application_id := FND_GLOBAL.resp_appl_id;
2585 		  l_claim_rec.program_update_date   := sysdate;
2586 		  l_claim_rec.program_id            := FND_GLOBAL.conc_program_id;
2587 		  l_claim_rec.created_from          := l_api_name;
2588 		  l_claim_rec.batch_id              := l_claim_int_rec.batch_id;
2589 		  l_claim_rec.claim_number          := l_claim_int_rec.claim_number;
2590 		  l_claim_rec.claim_type_id         := l_claim_int_rec.claim_type_id;
2591 		  l_claim_rec.claim_class           := l_claim_int_rec.claim_class;
2592 		  l_claim_rec.claim_date            := l_claim_int_rec.claim_date;
2593 		  l_claim_rec.due_date              := l_claim_int_rec.due_date;
2594 		  l_claim_rec.amount                := l_claim_int_rec.amount;
2595 		  l_claim_rec.currency_code         := l_claim_int_rec.currency_code;
2596 		  l_claim_rec.exchange_rate_type    := l_claim_int_rec.exchange_rate_type;
2597 		  l_claim_rec.exchange_rate_date    := l_claim_int_rec.exchange_rate_date;
2598 		  l_claim_rec.exchange_rate         := l_claim_int_rec.exchange_rate;
2599 		  l_claim_rec.set_of_books_id       := l_claim_int_rec.set_of_books_id;
2600 		  l_claim_rec.source_object_id      := l_claim_int_rec.source_object_id;
2601 		  l_claim_rec.source_object_class   := l_claim_int_rec.source_object_class;
2602 		  l_claim_rec.source_object_type_id := l_claim_int_rec.source_object_type_id;
2603 		  l_claim_rec.source_object_number  := l_claim_int_rec.source_object_number;
2604 		  l_claim_rec.cust_account_id       := l_claim_int_rec.cust_account_id;
2605 		  l_claim_rec.cust_billto_acct_site_id := l_claim_int_rec.cust_billto_acct_site_id;
2606 		  l_claim_rec.cust_shipto_acct_site_id := l_claim_int_rec.cust_shipto_acct_site_id;
2607 		  l_claim_rec.pay_related_account_flag := l_claim_int_rec.pay_related_account_flag;
2608 		  l_claim_rec.related_cust_account_id  := l_claim_int_rec.related_cust_account_id;
2609 		  l_claim_rec.related_site_use_id   := l_claim_int_rec.related_site_use_id;
2610 		  l_claim_rec.relationship_type     := l_claim_int_rec.relationship_type;
2611 		  l_claim_rec.vendor_id             := l_claim_int_rec.vendor_id;
2612 		  l_claim_rec.vendor_site_id        := l_claim_int_rec.vendor_site_id;
2613 		  l_claim_rec.reason_code_id        := l_claim_int_rec.reason_code_id;
2614 		  l_claim_rec.task_template_group_id:= l_claim_int_rec.task_template_group_id;
2615 		  l_claim_rec.status_code           := l_claim_int_rec.status_code;
2616 		  l_claim_rec.user_status_id        := l_claim_int_rec.user_status_id;
2617 		  l_claim_rec.sales_rep_id          := l_claim_int_rec.sales_rep_id;
2618 		  l_claim_rec.contact_id            := l_claim_int_rec.contact_id;
2619 		  l_claim_rec.broker_id             := l_claim_int_rec.broker_id;
2620 		  l_claim_rec.customer_ref_date     := l_claim_int_rec.customer_ref_date;
2621 		  l_claim_rec.customer_ref_number   := l_claim_int_rec.customer_ref_number;
2622 		  l_claim_rec.receipt_id            := l_claim_int_rec.receipt_id;
2623 		  l_claim_rec.receipt_number        := l_claim_int_rec.receipt_number;
2624 		  l_claim_rec.gl_date               := l_claim_int_rec.gl_date;
2625 		  l_claim_rec.payment_method        := l_claim_int_rec.payment_method;
2626 		  l_claim_rec.effective_date        := l_claim_int_rec.effective_date;
2627 		  l_claim_rec.order_type_id         := l_claim_int_rec.order_type_id;
2628 		  l_claim_rec.comments              := l_claim_int_rec.comments;
2629 		  l_claim_rec.attribute_category    := l_claim_int_rec.attribute_category;
2630 		  l_claim_rec.attribute1            := l_claim_int_rec.attribute1;
2631 		  l_claim_rec.attribute2            := l_claim_int_rec.attribute2;
2632 		  l_claim_rec.attribute3            := l_claim_int_rec.attribute3;
2633 		  l_claim_rec.attribute4            := l_claim_int_rec.attribute4;
2634 		  l_claim_rec.attribute5            := l_claim_int_rec.attribute5;
2635 		  l_claim_rec.attribute6            := l_claim_int_rec.attribute6;
2636 		  l_claim_rec.attribute7            := l_claim_int_rec.attribute7;
2637 		  l_claim_rec.attribute8            := l_claim_int_rec.attribute8;
2638 		  l_claim_rec.attribute9            := l_claim_int_rec.attribute9;
2639 		  l_claim_rec.attribute10           := l_claim_int_rec.attribute10;
2640 		  l_claim_rec.attribute11           := l_claim_int_rec.attribute11;
2641 		  l_claim_rec.attribute12           := l_claim_int_rec.attribute12;
2642 		  l_claim_rec.attribute13           := l_claim_int_rec.attribute13;
2643 		  l_claim_rec.attribute14           := l_claim_int_rec.attribute14;
2644 		  l_claim_rec.attribute15           := l_claim_int_rec.attribute15;
2645 		  l_claim_rec.deduction_attribute_category    := l_claim_int_rec.deduction_attribute_category;
2646 		  l_claim_rec.deduction_attribute1            := l_claim_int_rec.deduction_attribute1;
2647 		  l_claim_rec.deduction_attribute2            := l_claim_int_rec.deduction_attribute2;
2648 		  l_claim_rec.deduction_attribute3            := l_claim_int_rec.deduction_attribute3;
2649 		  l_claim_rec.deduction_attribute4            := l_claim_int_rec.deduction_attribute4;
2650 		  l_claim_rec.deduction_attribute5            := l_claim_int_rec.deduction_attribute5;
2651 		  l_claim_rec.deduction_attribute6            := l_claim_int_rec.deduction_attribute6;
2652 		  l_claim_rec.deduction_attribute7            := l_claim_int_rec.deduction_attribute7;
2653 		  l_claim_rec.deduction_attribute8            := l_claim_int_rec.deduction_attribute8;
2654 		  l_claim_rec.deduction_attribute9            := l_claim_int_rec.deduction_attribute9;
2655 		  l_claim_rec.deduction_attribute10           := l_claim_int_rec.deduction_attribute10;
2656 		  l_claim_rec.deduction_attribute11           := l_claim_int_rec.deduction_attribute11;
2657 		  l_claim_rec.deduction_attribute12           := l_claim_int_rec.deduction_attribute12;
2658 		  l_claim_rec.deduction_attribute13           := l_claim_int_rec.deduction_attribute13;
2659 		  l_claim_rec.deduction_attribute14           := l_claim_int_rec.deduction_attribute14;
2660 		  l_claim_rec.deduction_attribute15           := l_claim_int_rec.deduction_attribute15;
2661 		  l_claim_rec.org_id                          := l_claim_int_rec.org_id;
2662 		  l_claim_rec.customer_reason                 := l_claim_int_rec.customer_reason;
2663 		  l_claim_rec.ship_to_cust_account_id         := l_claim_int_rec.ship_to_cust_account_id;
2664 
2665 
2666 
2667 
2668 		  -- Debug Message
2669 		  IF OZF_DEBUG_HIGH_ON THEN
2670 			 OZF_UTILITY_PVT.debug_message('Call check_claim_common_element');
2671 		  END IF;
2672 
2673 		  OZF_claim_PVT.Check_Claim_Common_Element (
2674 		   p_api_version      => 1.0,
2675 		   p_init_msg_list    => FND_API.G_FALSE,
2676 		   p_validation_level => FND_API.G_VALID_LEVEL_FULL,
2677 		   x_Return_Status      => l_return_status,
2678 		   x_Msg_Count          => l_msg_count,
2679 		   x_Msg_Data           => l_msg_data,
2680 		   p_claim              => l_claim_rec,
2681 		   x_claim              => l_x_claim_rec
2682 		  );
2683 		  -- Check return status from the above procedure call
2684 		  IF l_return_status = FND_API.G_RET_STS_ERROR OR
2685 			 l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2686 		 IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2687 				FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2688 				FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2689 				FND_MSG_PUB.Add;
2690 		 END IF;
2691 		 GOTO next_claim;
2692 		  END IF;
2693 		  l_claim_rec := l_x_claim_rec;
2694 
2695 		  -- Debug Message
2696 		  IF OZF_DEBUG_HIGH_ON THEN
2697 			 OZF_UTILITY_PVT.debug_message('Call create_claim');
2698 		  END IF;
2699 
2700 		  --------------------
2701 		  --  Create Claim  --
2702 		  --------------------
2703 		  OZF_CLAIM_PVT.Create_Claim (
2704 				p_api_version            => 1.0
2705 			   ,x_return_status          => l_return_status
2706 			   ,x_msg_data               => l_msg_data
2707 			   ,x_msg_count              => l_msg_count
2708 			   ,p_claim          	     => l_claim_rec
2709 			   ,x_claim_id         	     => l_claim_id
2710 		  );
2711 
2712 		  IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2713 			 -- Debug Message
2714 			 IF OZF_DEBUG_HIGH_ON THEN
2715 				OZF_UTILITY_PVT.debug_message('Create Claims for '|| l_claim_int_rec.interface_claim_id ||' failed');
2716 			 END IF;
2717 
2718 		 IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2719 				FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_IMPORT_ERR');
2720 				FND_MESSAGE.Set_Token('ID', l_claim_int_rec.interface_claim_id);
2721 				FND_MSG_PUB.Add;
2722 		 END IF;
2723 		 GOTO next_claim;
2724 		  END IF;
2725 
2726 		  IF (l_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2727 			 -----------------------------------------------
2728 			 -- Update claim_id in Claim Interface Table  --
2729 			 -----------------------------------------------
2730 
2731 			 OPEN c_claim_line_int(l_claim_int_rec.interface_claim_id);
2732 			 LOOP
2733 				FETCH c_claim_line_int INTO l_line_int_rec;
2734 				EXIT WHEN c_claim_line_int%NOTFOUND;
2735 
2736 			-- check line amount
2737 			IF (l_line_int_rec.claim_currency_amount is null OR
2738 				l_line_int_rec.claim_currency_amount = 0) THEN
2739 
2740 			   IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2741 					  FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_LINE_AMT_ERR');
2742 					  FND_MSG_PUB.Add;
2743 			   END IF;
2744 			   IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2745 					  FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_LINE_IMPORT_ERR');
2746 					  FND_MESSAGE.Set_Token('ID', l_line_int_rec.interface_claim_id);
2747 			  FND_MESSAGE.Set_Token('LINEID', l_line_int_rec.interface_claim_line_id);
2748 					  FND_MSG_PUB.Add;
2749 			   END IF;
2750 			   cleanup_claims (p_claim_id => l_claim_id,
2751 								   x_return_status => l_return_status);
2752 				   IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2753 				  RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2754 			   END IF;
2755 			   GOTO next_claim;
2756 			END IF;
2757 
2758 			-- Assign value to the local line record.
2759 
2760 				l_line_rec.request_id          := FND_GLOBAL.conc_request_id;
2761 				l_line_rec.program_application_id
2762 										:= FND_GLOBAL.resp_appl_id;
2763 				l_line_rec.program_update_date
2764 										:= sysdate;
2765 				l_line_rec.program_id          := FND_GLOBAL.conc_program_id;
2766 				l_line_rec.created_from        := l_api_name;
2767 				l_line_rec.claim_id            := l_claim_id;
2768 				l_line_rec.amount              := l_line_int_rec.amount;
2769 				l_line_rec.claim_currency_amount:= l_line_int_rec.claim_currency_amount;
2770 				l_line_rec.set_of_books_id     := l_line_int_rec.set_of_books_id;
2771 				l_line_rec.valid_flag          := l_line_int_rec.valid_flag;
2772 				l_line_rec.source_object_id    := l_line_int_rec.source_object_id;
2773 				l_line_rec.source_object_class:= l_line_int_rec.source_object_class;
2774 				l_line_rec.source_object_type_id
2775 									  := l_line_int_rec.source_object_type_id;
2776 			l_line_rec.source_object_line_id
2777 									  := l_line_int_rec.source_object_line_id;
2778 				l_line_rec.payment_status      := l_line_int_rec.payment_status;
2779 				l_line_rec.approved_flag       := l_line_int_rec.approved_flag;
2780 				l_line_rec.approved_date       := l_line_int_rec.approved_date;
2781 				l_line_rec.approved_by         := l_line_int_rec.approved_by;
2782 				l_line_rec.settled_date        := l_line_int_rec.settled_date;
2783 				l_line_rec.settled_by          := l_line_int_rec.settled_by;
2784 				l_line_rec.performance_complete_flag
2785 									  := l_line_int_rec.performance_complete_flag;
2786 				l_line_rec.performance_attached_flag
2787 									  := l_line_int_rec.performance_attached_flag;
2788 				l_line_rec.select_cust_children_flag
2789 									  := l_line_int_rec.select_cust_children_flag;
2790 				l_line_rec.item_id             := l_line_int_rec.item_id;
2791 				l_line_rec.item_description    := l_line_int_rec.item_description;
2792                 l_line_rec.item_type           := l_line_int_rec.item_type;
2793 				l_line_rec.quantity            := l_line_int_rec.quantity;
2794 				l_line_rec.quantity_uom        := l_line_int_rec.quantity_uom;
2795 				l_line_rec.rate                := l_line_int_rec.rate;
2796 				l_line_rec.activity_type       := l_line_int_rec.activity_type;
2797 				l_line_rec.activity_id         := l_line_int_rec.activity_id;
2798 				l_line_rec.related_cust_account_id:= l_line_int_rec.related_cust_account_id;
2799 				l_line_rec.relationship_type   := l_line_int_rec.relationship_type;
2800 				--l_line_rec.earnings_associated_flag
2801 				--                      := l_line_int_rec.earnings_associated_flag;
2802 				l_line_rec.comments            := l_line_int_rec.comments;
2803 				l_line_rec.tax_code            := l_line_int_rec.tax_code;
2804 				l_line_rec.credit_to           := l_line_int_rec.credit_to;
2805 				l_line_rec.attribute_category  := l_line_int_rec.attribute_category;
2806 				l_line_rec.attribute1          := l_line_int_rec.attribute1;
2807 				l_line_rec.attribute2          := l_line_int_rec.attribute2;
2808 				l_line_rec.attribute3          := l_line_int_rec.attribute3;
2809 				l_line_rec.attribute4          := l_line_int_rec.attribute4;
2810 				l_line_rec.attribute5          := l_line_int_rec.attribute5;
2811 				l_line_rec.attribute6          := l_line_int_rec.attribute6;
2812 				l_line_rec.attribute7          := l_line_int_rec.attribute7;
2813 				l_line_rec.attribute8          := l_line_int_rec.attribute8;
2814 				l_line_rec.attribute9          := l_line_int_rec.attribute9;
2815 				l_line_rec.attribute10         := l_line_int_rec.attribute10;
2816 				l_line_rec.attribute11         := l_line_int_rec.attribute11;
2817 				l_line_rec.attribute12         := l_line_int_rec.attribute12;
2818 				l_line_rec.attribute13         := l_line_int_rec.attribute13;
2819 				l_line_rec.attribute14         := l_line_int_rec.attribute14;
2820 				l_line_rec.attribute15         := l_line_int_rec.attribute15;
2821 				l_line_rec.org_id              := l_line_int_rec.org_id;
2822 				l_line_rec.exchange_rate_type  := l_line_int_rec.exchange_rate_type;
2823 				l_line_rec.exchange_rate_date  := l_line_int_rec.exchange_rate_date;
2824 				l_line_rec.exchange_rate       := l_line_int_rec.exchange_rate;
2825 				l_line_rec.currency_code       := l_line_int_rec.currency_code;
2826 
2827 			-------------------------
2828 				--  Create Claim_Line  --
2829 				-------------------------
2830 				OZF_Claim_Line_PVT.Create_Claim_Line(
2831 				   P_Api_Version        => 1.0,
2832 				   P_Init_Msg_List      => FND_API.G_FALSE,
2833 				   P_Commit             => FND_API.G_FALSE,
2834 				   P_Validation_Level   => FND_API.G_VALID_LEVEL_FULL,
2835 				   X_Return_Status      => l_return_status,
2836 				   X_Msg_Count          => l_msg_count,
2837 				   X_Msg_Data           => l_msg_data,
2838 				   p_claim_line_rec     => l_line_rec,
2839 				   x_claim_line_id      => l_line_id
2840 				);
2841 
2842 				IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
2843 				   IF OZF_DEBUG_HIGH_ON THEN
2844 					  OZF_UTILITY_PVT.debug_message('Claim line creation failed. ');
2845 				   END IF;
2846 
2847 			   IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
2848 					  FND_MESSAGE.Set_Name('OZF','OZF_CLAIM_LINE_IMPORT_ERR');
2849 					  FND_MESSAGE.Set_Token('ID', l_line_int_rec.interface_claim_id);
2850 			  FND_MESSAGE.Set_Token('LINEID', l_line_int_rec.interface_claim_line_id);
2851 					  FND_MSG_PUB.Add;
2852 			   END IF;
2853 			   cleanup_claims (p_claim_id => l_claim_id,
2854 								   x_return_status => l_return_status);
2855 				   IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2856 				  RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2857 			   END IF;
2858 			   GOTO next_claim;
2859 			END IF;
2860 
2861 			 END LOOP; -- for claim lines
2862 			 CLOSE c_claim_line_int;
2863 
2864 		 -- Now, I have created every lines for this claim without problem.
2865 		 -- I will update the claim interface table with the new claim id.
2866 		 IF OZF_DEBUG_HIGH_ON THEN
2867 			OZF_UTILITY_PVT.debug_message('Create Claims for '|| l_claim_int_rec.interface_claim_id ||' succeed');
2868 
2869 				OZF_UTILITY_PVT.debug_message('claim_id: ' || l_claim_id);
2870 			 END IF;
2871 
2872 		 UPDATE OZF_CLAIMS_INT_ALL
2873 			 SET CLAIM_ID = l_claim_id
2874 			 WHERE INTERFACE_CLAIM_ID = l_claim_int_rec.interface_claim_id;
2875 
2876 		  OPEN claim_number_csr(l_claim_id);
2877 		  FETCH claim_number_csr INTO l_claim_number;
2878 		  CLOSE claim_number_csr;
2879 
2880 		  FND_FILE.PUT_LINE(FND_FILE.LOG, 'Claim ' || l_claim_number || ' created successfully');
2881 
2882 		  END IF; -- for claim lines condition
2883 
2884 	   END LOOP;
2885 	   CLOSE c_claim_int;
2886 
2887 		-- Debug Message
2888 		IF OZF_DEBUG_LOW_ON THEN
2889 		   FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
2890 		   FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
2891 		   FND_MSG_PUB.Add;
2892 		END IF;
2893 
2894 	   -- Write all messages to a log
2895 	   OZF_UTILITY_PVT.Write_Conc_Log;
2896 
2897    END LOOP;
2898 END IF;
2899 
2900 EXCEPTION
2901   WHEN FND_API.g_exc_error THEN
2902     ROLLBACK TO Start_Replicate_IMP;
2903     FND_MSG_PUB.count_and_get (
2904          p_encoded => FND_API.g_false
2905         ,p_count   => l_msg_count
2906         ,p_data    => l_msg_data
2907     );
2908     ERRBUF  := fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'F');
2909     RETCODE := 2;
2910     -- Write all errors messages to a log
2911     OZF_UTILITY_PVT.Write_Conc_Log;
2912 
2913   WHEN FND_API.g_exc_unexpected_error THEN
2914     ROLLBACK TO Start_Replicate_IMP;
2915     FND_MSG_PUB.count_and_get (
2916          p_encoded => FND_API.g_false
2917         ,p_count   => l_msg_count
2918         ,p_data    => l_msg_data
2919     );
2920     ERRBUF  := fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'F');
2921     RETCODE := 2;
2922     -- Write all errors messages to a log
2923     OZF_UTILITY_PVT.Write_Conc_Log;
2924   WHEN OTHERS THEN
2925     ROLLBACK TO Start_Replicate_IMP;
2926     FND_MSG_PUB.count_and_get (
2927          p_encoded => FND_API.g_false
2928         ,p_count   => l_msg_count
2929         ,p_data    => l_msg_data
2930     );
2931     ERRBUF  := fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'F');
2932     RETCODE := 2;
2933     -- Write all errors messages to a log
2934    OZF_UTILITY_PVT.Write_Conc_Log;
2935 
2936 END Start_Replicate;
2937 
2938 ---------------------------------------------------------------------
2939 --   PROCEDURE:  Purge_Claim
2940 --
2941 --   PURPOSE:
2942 --   This procedure deletes processed records from ozf_claims_int_all, ozf_claim_lines_all table.
2943 --
2944 --   PARAMETERS:
2945 --
2946 --   OUT:
2947 --       ERRBUT VARCHAR2
2948 --       RETCODE NUMBER
2949 --   NOTES:
2950 --
2951 ---------------------------------------------------------------------
2952 PROCEDURE Purge_Claims (
2953     ERRBUF    OUT NOCOPY VARCHAR2,
2954     RETCODE   OUT NOCOPY NUMBER,
2955     p_org_id  IN  		 NUMBER DEFAULT NULL
2956 )
2957 IS
2958 l_full_name varchar2(30) := 'Import API: Purge Claims';
2959 l_return_status     VARCHAR2(1);
2960 l_msg_data          VARCHAR2(200);
2961 l_msg_count         NUMBER;
2962 
2963 BEGIN
2964 
2965    -- Debug Message
2966    IF OZF_DEBUG_HIGH_ON THEN
2967       OZF_UTILITY_PVT.debug_message('Private API: Purge Claims');
2968    END IF;
2969    IF OZF_DEBUG_LOW_ON THEN
2970       FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
2971       FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
2972       FND_MSG_PUB.Add;
2973    END IF;
2974    SAVEPOINT  PURGE_CLAIM_IMP;
2975    ERRBUF  := null;
2976    RETCODE := 0;
2977 
2978    -- Multiorg Changes
2979    MO_GLOBAL.init('OZF');
2980    IF(p_org_id is null) THEN
2981       MO_GLOBAL.set_policy_context('M',null);
2982    ELSE
2983       MO_GLOBAL.set_policy_context('S',p_org_id);
2984    END IF;
2985 
2986    -- Clean up lines table.
2987    delete FROM ozf_claim_lines_int_all a
2988    where exists
2989    (select 1 from ozf_claims_int_all b
2990     where b.claim_id is not null
2991     and b.interface_claim_id = a.interface_claim_id);
2992 
2993    delete from ozf_claims_int_all
2994    where claim_id is not null;
2995 
2996     -- Debug Message
2997     IF OZF_DEBUG_LOW_ON THEN
2998        FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
2999        FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
3000        FND_MSG_PUB.Add;
3001     END IF;
3002 
3003    -- Write all messages to a log
3004    OZF_UTILITY_PVT.Write_Conc_Log;
3005 EXCEPTION
3006   WHEN FND_API.g_exc_error THEN
3007     ROLLBACK TO PURGE_CLAIM_IMP;
3008     FND_MSG_PUB.count_and_get (
3009          p_encoded => FND_API.g_false
3010         ,p_count   => l_msg_count
3011         ,p_data    => l_msg_data
3012     );
3013     ERRBUF  := fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'F');
3014     RETCODE := 2;
3015     -- Write all errors messages to a log
3016     OZF_UTILITY_PVT.Write_Conc_Log;
3017 
3018   WHEN FND_API.g_exc_unexpected_error THEN
3019     ROLLBACK TO PURGE_CLAIM_IMP;
3020     FND_MSG_PUB.count_and_get (
3021          p_encoded => FND_API.g_false
3022         ,p_count   => l_msg_count
3023         ,p_data    => l_msg_data
3024     );
3025     ERRBUF  := fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'F');
3026     RETCODE := 2;
3027     -- Write all errors messages to a log
3028     OZF_UTILITY_PVT.Write_Conc_Log;
3029   WHEN OTHERS THEN
3030     ROLLBACK TO PURGE_CLAIM_IMP;
3031     FND_MSG_PUB.count_and_get (
3032          p_encoded => FND_API.g_false
3033         ,p_count   => l_msg_count
3034         ,p_data    => l_msg_data
3035     );
3036     ERRBUF  := fnd_msg_pub.get(p_msg_index => 1, p_encoded => 'F');
3037     RETCODE := 2;
3038     -- Write all errors messages to a log
3039    OZF_UTILITY_PVT.Write_Conc_Log;
3040 END Purge_Claims;
3041 
3042 END OZF_Claims_Int_PVT;