1 PACKAGE BODY OE_CNCL_Validate_Line_Adj AS
2 /* $Header: OEXVCLAB.pls 120.0 2005/06/01 01:09:59 appldev noship $ */
3
4 -- Global constant holding the package name
5
6 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_CNCL_Validate_Line_Adj';
7
8 -- Procedure Entity
9
10
11 PROCEDURE Entity
12 ( x_return_status OUT NOCOPY VARCHAR2 /* file.sql.39 change */
13 , p_Line_Adj_rec IN OE_Order_PUB.Line_Adj_Rec_Type
14 )
15 IS
16 l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
17 l_price_adj_error VARCHAR2(30):= NULL;
18 l_tmp_string VARCHAR2(30):= NULL;
19 l_agr_type_code VARCHAR2(30):= NULL;
20 l_attribute_name VARCHAR2(50):= NULL;
21 l_agreement_id NUMBER ;
22 -- This change is required since we are dropping the profile SO_ORGANIZATION -- _ID. Change made by Esha.
23 l_organization_id NUMBER := To_number(OE_Sys_Parameters.VALUE
24 ('MASTER_ORGANIZATION_ID'));
25 /* l_organization_id NUMBER := To_number(FND_PROFILE.VALUE
26 ('SO_ORGANIZATION_ID'));*/
27 BEGIN
28
29 -- Check required attributes.
30
31 /* IF p_Line_Adj_rec.price_adjustment_id IS NULL
32 THEN
33
34 l_return_status := FND_API.G_RET_STS_ERROR;
35
36 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
37 THEN
38
39 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
40 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','price_adjustment');
41 OE_MSG_PUB.Add;
42
43 END IF;
44
45 END IF;
46
47 -- Check the header_id on the record.
48
49 IF p_Line_Adj_rec.header_id IS NULL
50 THEN
51
52 l_return_status := FND_API.G_RET_STS_ERROR;
53
54 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
55 THEN
56
57 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
58 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
59 OE_Order_UTIL.Get_Attribute_Name('HEADER_ID'));
60 OE_MSG_PUB.Add;
61
62 END IF;
63
64 END IF;
65 */
66
67 IF p_Line_adj_rec.list_line_type_code not in ('COST','TAX')and
68 p_Line_adj_rec.list_header_id is null
69 THEN
70
71 l_return_status := FND_API.G_RET_STS_ERROR;
72
73 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
74 THEN
75
76 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
77 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','List_header');
78 OE_MSG_PUB.Add;
79
80 END IF;
81
82 END IF;
83
84 IF p_Line_adj_rec.list_header_id is not null and
85 p_Line_adj_rec.list_line_id IS NULL THEN
86
87 l_return_status := FND_API.G_RET_STS_ERROR;
88
89 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
90 THEN
91
92 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
93 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','List_Line');
94 OE_MSG_PUB.Add;
95
96 END IF;
97
98 END IF;
99
100
101 IF p_Line_adj_rec.list_header_id is not null and
102 p_Line_adj_rec.list_line_type_code IS NULL THEN
103
104 l_return_status := FND_API.G_RET_STS_ERROR;
105
106 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
107 THEN
108
109 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
110 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','List_line_type_code');
111 OE_MSG_PUB.Add;
112
113 END IF;
114
115 END IF;
116
117 IF p_Line_adj_rec.list_line_type_code in ('COST','TAX')
118 --and p_Line_adj_rec.line_id is null
119 THEN
120
121 l_return_status := FND_API.G_RET_STS_ERROR;
122
123 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
124 THEN
125
126 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
127 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
128 OE_Order_UTIL.Get_Attribute_Name('LINE_ID'));
129 OE_MSG_PUB.Add;
130
131 END IF;
132
133 END IF;
134
135 --
136 -- Check rest of required attributes here.
137 --
138
139 -- Return Error if a required attribute is missing.
140
141 IF l_return_status = FND_API.G_RET_STS_ERROR THEN
142
143 RAISE FND_API.G_EXC_ERROR;
144
145 ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
146
147 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
148
149 END IF;
150
151
152
153 --
154 -- Check conditionally required attributes here.
155 --
156
157 /* Added Validation check for the AETC flexfield */
158
159 IF p_Line_adj_rec.ac_attribute1 IS NOT NULL OR
160 p_Line_adj_rec.ac_attribute2 IS NOT NULL OR
161 p_Line_adj_rec.ac_attribute3 IS NOT NULL OR
162 p_Line_adj_rec.ac_attribute4 IS NOT NULL OR
163 p_Line_adj_rec.ac_attribute5 IS NOT NULL OR
164 p_Line_adj_rec.ac_attribute6 IS NOT NULL
165 THEN
166 l_attribute_name := NULL;
167 IF p_Line_adj_rec.ac_attribute4 IS NULL THEN
168 l_attribute_name := 'AETC Number';
169 END IF;
170 IF p_Line_adj_rec.ac_attribute5 IS NULL THEN
171 l_attribute_name := 'AETC Responsibility Code';
172 END IF;
173 IF p_Line_adj_rec.ac_attribute6 IS NULL THEN
174 l_attribute_name := 'AETC Reason Code';
175 END IF;
176 IF l_attribute_name IS NOT NULL THEN
177 l_return_status := FND_API.G_RET_STS_ERROR;
178
179 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
180 THEN
181
182 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
183 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',l_attribute_name);
184 OE_MSG_PUB.Add;
185
186 END IF;
187 END IF;
188
189 END IF;
190
191
192 IF upper(p_Line_adj_rec.updated_flag) ='Y' and
193 p_Line_adj_rec.change_reason_code is null THEN
194
195 l_return_status := FND_API.G_RET_STS_ERROR;
196
197 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
198 THEN
199
200 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
201 FND_MESSAGE.SET_TOKEN('ATTRIBUTE','change_reason_code');
202 OE_MSG_PUB.Add;
203
204 END IF;
205
206 END IF;
207
208 IF p_Line_adj_rec.list_line_type_code = 'FREIGHT_CHARGE' and
209 p_Line_adj_rec.charge_type_code IS NULL THEN
210
211 l_return_status := FND_API.G_RET_STS_ERROR;
212
213 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
214 THEN
215
216 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
217 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
218 OE_Order_UTIL.Get_Attribute_Name('CHARGE_TYPE_CODE'));
219 OE_MSG_PUB.Add;
220
221 END IF;
222
223 END IF;
224
225 IF p_Line_adj_rec.list_line_type_code = 'TAX' and
226 p_Line_adj_rec.tax_code IS NULL THEN
227
228 l_return_status := FND_API.G_RET_STS_ERROR;
229
230 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
231 THEN
232
233 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
234 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
235 OE_Order_UTIL.Get_Attribute_Name('TAX_CODE'));
236 OE_MSG_PUB.Add;
237
238 END IF;
239
240 END IF;
241
242 IF p_Line_adj_rec.list_line_type_code = 'COST' and
243 p_Line_adj_rec.cost_id IS NULL THEN
244
245 l_return_status := FND_API.G_RET_STS_ERROR;
246
247 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
248 THEN
249
250 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
251 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
252 OE_Order_UTIL.Get_Attribute_Name('COST_ID'));
253 OE_MSG_PUB.Add;
254
255 END IF;
256
257 END IF;
258
259 IF p_Line_adj_rec.list_line_type_code in ('COST','TAX','FREIGHT_CHARGE') AND
260 p_Line_adj_rec.adjusted_amount IS NULL
261 THEN
262
263 l_return_status := FND_API.G_RET_STS_ERROR;
264
265 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
266 THEN
267
268 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
269 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
270 OE_Order_UTIL.Get_Attribute_Name('ADJUSTED_AMOUNT'));
271 OE_MSG_PUB.Add;
272
273 END IF;
274 END IF;
275
276 IF p_Line_adj_rec.list_line_type_code in ('TAX','FREIGHT_CHARGE') AND
277 p_Line_adj_rec.operand IS NULL
278 THEN
279
280 l_return_status := FND_API.G_RET_STS_ERROR;
281
282 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
283 THEN
284
285 FND_MESSAGE.SET_NAME('ONT','OE_ATTRIBUTE_REQUIRED');
286 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
287 OE_Order_UTIL.Get_Attribute_Name('OPERAND'));
288 OE_MSG_PUB.Add;
289
290 END IF;
291 END IF;
292
293
294 /*
295
296 --
297 -- Validate the price adjustment
298 --
299
300 -- Selecting the agreement_type_code from so_agreements
301 -- At this point the agreement_id on line should either be
302 -- valid/active or null.
303
304 -- The following code is not joined to the discount select
305 -- because there might be no rows in so_agreements table
306 -- (a cartesian product of NO_ROWS with any table
307 -- results in NO_ROWS)
308
309 BEGIN
310
311 SELECT soagr.agreement_type_code
312 INTO l_agr_type_code
313 FROM oe_agreements soagr,
314 oe_order_lines oeordl
315 WHERE soarg.agreement_id = oeordl.agreement_id
316 AND oeordl.line_id = p_line_adj_rec.line_id;
317
318 EXCEPTION
319 WHEN NO_DATA_FOUND
320 THEN
321 l_agr_type_code := NULL;
322
323 END;
324
325 -- Changed site_use_id to site_org_id
326 -- site_use_id :: site_org_id
327
328 SELECT 'IMP_DISCOUNT'
329 INTO l_price_adj_error
330 FROM DUAL
331 WHERE NOT EXISTS
332 (SELECT NULL
333 FROM oe_discounts sodsc,
334 oe_discount_lines sodls,
335 oe_price_break_lines sopbl,
336 oe_order_lines oeordl,
337 o_order_header oeordh
338 WHERE NVL(decode(sign(p_line_adj_rec.discount_line_id), -1, null,
339 p_line_adj_rec.discount_line_id), -99)=
340 NVL(sodls.discount_line_id(+),-99)
341 AND p_line_adj_rec.discount_id = sodsc.discount_id
342 AND ((p_percent =
343 nvl(sodsc.amount / oeordl.unit_list_price * 100,
344 nvl(sodsc.percent,
345 nvl((oeordl.unit_list_price - sodls.price ) /
346 oeordl.unit_list_price * 100,
347 nvl(sodls.amount / oeordl.unit_list_price * 100,
348 nvl(sodls.percent,
349 nvl((oeordl.unit_list_price - sopbl.price ) /
350 oeordl.unit_list_price * 100,
351 nvl(sopbl.amount / oeordl.unit_list_price
352 * 100,
353 nvl( sopbl.percent, 0 )))))))))
354 OR
355 (sodsc.override_allowed_flag = 'Y'))
356 AND oeordl.line_id = p_line_adj_rec.line_id
357 AND oeordl.header_id = oeordh.header_id
358 AND sodsc.price_list_id = oeordl.price_list_id
359 AND sodsc.discount_type_code = 'LINE_ITEM'
360 AND sodls.discount_id(+) = sodsc.discount_id
361 AND NVL(sodls.entity_value, 'X' ) =
362 DECODE(sodls.entity_id,
363 1007, TO_CHAR(oeordh.order_type_id),
364 1001, TO_CHAR(oeordl.inventory_item_id),
365 1005, l_agr_type_code,
366 1006, TO_CHAR(oeordl.agreement_id),
367 1010, oeordl.pricing_attribute1,
368 1011, oeordl.pricing_attribute2,
369 1012, oeordl.pricing_attribute3,
370 1013, oeordl.pricing_attribute4,
371 1014, oeordl.pricing_attribute5,
372 1015, oeordl.pricing_attribute6,
373 1016, oeordl.pricing_attribute7,
374 1017, oeordl.pricing_attribute8,
375 1018, oeordl.pricing_attribute9,
376 1019, oeordl.pricing_attribute10,
377 1020, oeordl.pricing_attribute11,
378 1021, oeordl.pricing_attribute12,
379 1022, oeordl.pricing_attribute13,
380 1023, oeordl.pricing_attribute14,
381 1024, oeordl.pricing_attribute15,
382 1045, sodls.entity_value,
383 'X' )
384 AND decode (sodls.ENTITY_ID,
385 1045, oe_adj_privilege.check_item_category
386 (oeordl.inventory_item_id,
387 SODLS.ENTITY_VALUE,
388 l_organization_id)
389 ,'Y') = 'Y'
390 AND sopbl.discount_line_id(+) = sodls.discount_line_id
391
392 AND DECODE( sopbl.method_type_code,
393 'UNITS', oeordl.quantity_ordered,
394 'DOLLARS', oeordl.quantity_ordered *
395 oeordl.unit_list_price, 0 )
396 BETWEEN NVL( sopbl.price_break_lines_low_range,
397 DECODE( sopbl.method_type_code,
398 'UNITS', oeordl.quantity_ordered,
399 'DOLLARS', oeordl.quantity_ordered *
400 oeordl.unit_list_price, 0 ))
401 AND NVL( sopbl.price_break_lines_high_range,
402 DECODE( sopbl.method_type_code,
403 'UNITS', oeordl.quantity_ordered,
404 'DOLLARS', oeordl.quantity_ordered *
405 oeordl.unit_list_price, 0 ))
406 AND (NOT EXISTS
407 (SELECT NULL
408 FROM oe_discount_customers sodcs
409 WHERE sodcs.discount_id = sodsc.discount_id )
410 OR
411 (EXISTS
412 (SELECT NULL
413 FROM oe_discount_customers sodcs
414 WHERE sodcs.discount_id = sodsc.discount_id
415 AND (sodcs.sold_to_org_id = oeordh.sold_to_org_id
416 OR
417 (sodcs.sold_to_org_id IS NULL
418 AND
419 sodcs.customer_class_code IS NULL))
420 AND (Nvl(sodcs.site_use_id, oeordh.ship_to_org_id)=
421 oeordh.ship_to_org_id
422 OR
423 NVL(sodcs.site_use_id, oeordh.invoice_to_org_id)=
424 oeordh.invoice_to_org_id )
425
426 )
427 OR
428 EXISTS (SELECT NULL
429 FROM oe_discount_customers oecst,
430 HZ_CUST_ACCOUNTS CUST_ACCT
431 -- Replaced ra_customers with hz_cust_accounts to fix the bug 1888440
432 WHERE oecst.discount_id = sodsc.discount_id
433 AND CUST_ACCT.CUST_ACCOUNT_ID = oeordh.sold_to_org_id
434 AND CUST_ACCT.CUSTOMER_CLASS_CODE =
435 oecst.customer_class_code
436 AND oecst.sold_to_org_id IS NULL
437 AND oecst.site_use_id IS NULL
438
439 )
440 )
441 );
442
443
444
445 -- The price adjustment check above failed
446
447 IF l_price_adj_error = 'IMP_DISCOUNT'
448 THEN
449
450 l_return_status := FND_API.G_RET_STS_ERROR;
451
452 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
453 THEN
454
455 FND_MESSAGE.SET_NAME('OE', 'IMP_DISCOUNT');
456 OE_MSG_PUB.Add;
457
458 END IF;
459
460 RAISE FND_API.G_EXC_ERROR;
461
462 END IF;
463 */
464
465 oe_debug_pub.add('line_type_code ' || p_Line_Adj_rec.list_line_type_code, 2);
466 oe_debug_pub.add('charge_type_code ' || p_Line_Adj_rec.charge_type_code, 2);
467 oe_debug_pub.add('charge_type_code ' || p_Line_Adj_rec.charge_subtype_code, 2);
468
469 --
470 -- Validate attribute dependencies here.
471 --
472
473 IF p_Line_adj_rec.list_line_type_code = 'FREIGHT_CHARGE' AND
474 p_Line_adj_rec.charge_type_code IS NOT NULL AND
475 p_Line_adj_rec.charge_subtype_code IS NOT NULL
476 THEN
477 oe_debug_pub.add('charge_type_code ' || p_Line_Adj_rec.charge_type_code, 2);
478 oe_debug_pub.add('charge_type_code ' || p_Line_Adj_rec.charge_subtype_code, 2);
479
480 BEGIN
481 SELECT 'VALID'
482 INTO l_tmp_string
483 FROM QP_LOOKUPS
484 WHERE LOOKUP_TYPE = p_Line_Adj_rec.charge_type_code
485 AND LOOKUP_CODE = p_Line_Adj_rec.charge_subtype_code
486 --AND ENABLED_FLAG = 'Y'
487 AND ROWNUM =1;
488 EXCEPTION
489
490 WHEN NO_DATA_FOUND THEN
491 l_return_status := FND_API.G_RET_STS_ERROR;
492 FND_MESSAGE.SET_NAME('ONT','OE_INVALID_ATTRIBUTE');
493 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
494 OE_Order_Util.Get_Attribute_Name('CHARGE_SUBTYPE_CODE'));
495 OE_MSG_PUB.Add;
496
497 WHEN OTHERS THEN
498 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
499 THEN
500 OE_MSG_PUB.Add_Exc_Msg
501 ( G_PKG_NAME ,
502 'Record - Charge Type/Subtype validation'
503 );
504 END IF;
505 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
506 END;
507 END IF;
508
509 IF (p_Line_adj_rec.list_line_type_code in ('COST','TAX')and
510 p_Line_adj_rec.arithmetic_operator <> 'AMT') OR
511 (p_Line_adj_rec.list_line_type_code = 'FREIGHT_CHARGE' and
512 p_Line_adj_rec.arithmetic_operator NOT IN ('AMT','LUMPSUM','%'))
513 THEN
514
515 l_return_status := FND_API.G_RET_STS_ERROR;
516
517 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_ERROR)
518 THEN
519
520 FND_MESSAGE.SET_NAME('ONT','OE_INVALID_ATTRIBUTE');
521 FND_MESSAGE.SET_TOKEN('ATTRIBUTE',
522 OE_Order_Util.Get_Attribute_Name('ARITHMETIC_OPERATOR'));
523 OE_MSG_PUB.Add;
524
525 END IF;
526
527 END IF;
528
529
530 -- Validate that the total percentage on the header has not exceeded
531 /*
532 -- 100%. LOG A DELAYED REQUEST TO EXECUTE LATER.
533 oe_delayed_requests_pvt.
534 log_request(p_entity_code => OE_GLOBALS.G_ENTITY_LINE_ADJ,
535 p_entity_id => p_line_adj_rec.line_id,
536 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE_ADJ,
537 p_requesting_entity_id => p_line_adj_rec.price_adjustment_id,
538 p_request_type => OE_GLOBALS.G_CHECK_PERCENTAGE,
539 p_param1 => p_line_adj_rec.header_id,
540 x_return_status => l_return_status);
541
542 */
543
544 -- Return
545
546 x_return_status := l_return_status;
547
548 EXCEPTION
549
550 WHEN FND_API.G_EXC_ERROR THEN
551
552 x_return_status := FND_API.G_RET_STS_ERROR;
553
554 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
555
556 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
557
558 WHEN OTHERS THEN
559
560 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
561
562 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
563 THEN
564 OE_MSG_PUB.Add_Exc_Msg
565 ( G_PKG_NAME
566 , 'Entity'
567 );
568 END IF;
569
570 END Entity;
571
572 -- Procedure Attributes
573
574 PROCEDURE Attributes
575 ( x_return_status OUT NOCOPY VARCHAR2 /* file.sql.39 change */
576 , p_Line_Adj_rec IN OE_Order_PUB.Line_Adj_Rec_Type
577 )
578 IS
579 BEGIN
580 oe_debug_pub.add('Entering OE_CNCL_Validate_Line_Adjs');
581 x_return_status := FND_API.G_RET_STS_SUCCESS;
582
583 -- Validate Line_Adj attributes
584
585 /* IF p_Line_Adj_rec.price_adjustment_id IS NOT NULL
586 THEN
587 IF NOT OE_CNCL_Validate_Adj.Price_Adjustment(p_Line_Adj_rec.price_adjustment_id) THEN
588 x_return_status := FND_API.G_RET_STS_ERROR;
589 END IF;
590 END IF;
591 */
592
593 IF p_Line_Adj_rec.creation_date IS NOT NULL
594 THEN
595 IF NOT OE_CNCL_Validate_Adj.Creation_Date(p_Line_Adj_rec.creation_date) THEN
596 x_return_status := FND_API.G_RET_STS_ERROR;
597 END IF;
598 END IF;
599
600 IF p_Line_Adj_rec.created_by IS NOT NULL
601 THEN
602 IF NOT OE_CNCL_Validate_Adj.Created_By(p_Line_Adj_rec.created_by) THEN
603 x_return_status := FND_API.G_RET_STS_ERROR;
604 END IF;
605 END IF;
606
607 IF p_Line_Adj_rec.last_update_date IS NOT NULL
608 THEN
609 IF NOT OE_CNCL_Validate_Adj.Last_Update_Date(p_Line_Adj_rec.last_update_date) THEN
610 x_return_status := FND_API.G_RET_STS_ERROR;
611 END IF;
612 END IF;
613
614 IF p_Line_Adj_rec.last_updated_by IS NOT NULL
615 THEN
616 IF NOT OE_CNCL_Validate_Adj.Last_Updated_By(p_Line_Adj_rec.last_updated_by) THEN
617 x_return_status := FND_API.G_RET_STS_ERROR;
618 END IF;
619 END IF;
620
621 IF p_Line_Adj_rec.last_update_login IS NOT NULL
622 THEN
623 IF NOT OE_CNCL_Validate_Adj.Last_Update_Login(p_Line_Adj_rec.last_update_login) THEN
624 x_return_status := FND_API.G_RET_STS_ERROR;
625 END IF;
626 END IF;
627
628 IF p_Line_Adj_rec.program_application_id IS NOT NULL
629 THEN
630 IF NOT OE_CNCL_Validate_Adj.Program_Application(p_Line_Adj_rec.program_application_id) THEN
631 x_return_status := FND_API.G_RET_STS_ERROR;
632 END IF;
633 END IF;
634
635 IF p_Line_Adj_rec.program_id IS NOT NULL
636 THEN
637 IF NOT OE_CNCL_Validate_Adj.Program(p_Line_Adj_rec.program_id) THEN
638 x_return_status := FND_API.G_RET_STS_ERROR;
639 END IF;
640 END IF;
641
642 IF p_Line_Adj_rec.program_update_date IS NOT NULL
643 THEN
644 IF NOT OE_CNCL_Validate_Adj.Program_Update_Date(p_Line_Adj_rec.program_update_date) THEN
645 x_return_status := FND_API.G_RET_STS_ERROR;
646 END IF;
647 END IF;
648
649 IF p_Line_Adj_rec.request_id IS NOT NULL
650 THEN
651 IF NOT OE_CNCL_Validate_Adj.Request(p_Line_Adj_rec.request_id) THEN
652 x_return_status := FND_API.G_RET_STS_ERROR;
653 END IF;
654 END IF;
655
656 /* IF p_Line_Adj_rec.header_id IS NOT NULL
657 THEN
658 IF NOT OE_CNCL_Validate_Adj.Header(p_Line_Adj_rec.header_id) THEN
659 x_return_status := FND_API.G_RET_STS_ERROR;
660 END IF;
661 END IF;
662 */
663
664 IF p_Line_Adj_rec.discount_id IS NOT NULL
665 THEN
666 IF NOT OE_CNCL_Validate_Adj.Discount(p_Line_Adj_rec.discount_id) THEN
667 x_return_status := FND_API.G_RET_STS_ERROR;
668 END IF;
669 END IF;
670
671 IF p_Line_Adj_rec.discount_line_id IS NOT NULL
672 THEN
673 IF NOT OE_CNCL_Validate_Adj.Discount_Line(p_Line_Adj_rec.discount_line_id) THEN
674 x_return_status := FND_API.G_RET_STS_ERROR;
675 END IF;
676 END IF;
677
678 IF p_Line_Adj_rec.automatic_flag IS NOT NULL
679 THEN
680 IF NOT OE_CNCL_Validate_Adj.Automatic(p_Line_Adj_rec.automatic_flag) THEN
681 x_return_status := FND_API.G_RET_STS_ERROR;
682 END IF;
683 END IF;
684
685 IF p_Line_Adj_rec.percent IS NOT NULL
686 THEN
687 IF NOT OE_CNCL_Validate_Adj.Percent(p_Line_Adj_rec.percent) THEN
688 x_return_status := FND_API.G_RET_STS_ERROR;
689 END IF;
690 END IF;
691
692 /* IF p_Line_Adj_rec.line_id IS NOT NULL
693 THEN
694 IF NOT OE_CNCL_Validate_Adj.Line(p_Line_Adj_rec.line_id) THEN
695 x_return_status := FND_API.G_RET_STS_ERROR;
696 END IF;
697 END IF;
698 */
699
700 IF p_Line_Adj_rec.list_line_no IS NOT NULL
701 THEN
702 IF NOT OE_CNCL_Validate_Adj.List_Line_No(p_Line_Adj_rec.list_line_no) THEN
703 x_return_status := FND_API.G_RET_STS_ERROR;
704 END IF;
705 END IF;
706
707 IF p_Line_Adj_rec.source_system_code IS NOT NULL
708 THEN
709 IF NOT OE_CNCL_Validate_Adj.source_system_code(p_Line_Adj_rec.source_system_code) THEN
710 x_return_status := FND_API.G_RET_STS_ERROR;
711 END IF;
712 END IF;
713
714 IF p_Line_Adj_rec.benefit_qty IS NOT NULL
715 THEN
716 IF NOT OE_CNCL_Validate_Adj.benefit_qty(p_Line_Adj_rec.benefit_qty) THEN
717 x_return_status := FND_API.G_RET_STS_ERROR;
718 END IF;
719 END IF;
720
721 IF p_Line_Adj_rec.benefit_uom_code IS NOT NULL
722 THEN
723 IF NOT OE_CNCL_Validate_Adj.benefit_uom_code(p_Line_Adj_rec.benefit_uom_code) THEN
724 x_return_status := FND_API.G_RET_STS_ERROR;
725 END IF;
726 END IF;
727
728 IF p_Line_Adj_rec.print_on_invoice_flag IS NOT NULL
729 THEN
730 IF NOT OE_CNCL_Validate_Adj.print_on_invoice_flag(p_Line_Adj_rec.print_on_invoice_flag) THEN
731 x_return_status := FND_API.G_RET_STS_ERROR;
732 END IF;
733 END IF;
734
735 IF p_Line_Adj_rec.expiration_date IS NOT NULL
736 THEN
737 IF NOT OE_CNCL_Validate_Adj.expiration_date(p_Line_Adj_rec.expiration_date) THEN
738 x_return_status := FND_API.G_RET_STS_ERROR;
739 END IF;
740 END IF;
741
742 IF p_Line_Adj_rec.rebate_transaction_type_code IS NOT NULL
743 THEN
744 IF NOT OE_CNCL_Validate_Adj.rebate_transaction_type_code(p_Line_Adj_rec.rebate_transaction_type_code) THEN
745 x_return_status := FND_API.G_RET_STS_ERROR;
746 END IF;
747 END IF;
748
749
750 IF p_Line_Adj_rec.rebate_transaction_reference IS NOT NULL
751 THEN
752 IF NOT OE_CNCL_Validate_Adj.rebate_transaction_reference(p_Line_Adj_rec.rebate_transaction_reference) THEN
753 x_return_status := FND_API.G_RET_STS_ERROR;
754 END IF;
755 END IF;
756
757 IF p_Line_Adj_rec.rebate_payment_system_code IS NOT NULL
758 THEN
759 IF NOT OE_CNCL_Validate_Adj.rebate_payment_system_code(p_Line_Adj_rec.rebate_payment_system_code) THEN
760 x_return_status := FND_API.G_RET_STS_ERROR;
761 END IF;
762 END IF;
763
764 IF p_Line_Adj_rec.Redeemed_Date IS NOT NULL
765 THEN
766 IF NOT OE_CNCL_Validate_Adj.Redeemed_Date(p_Line_Adj_rec.Redeemed_Date) THEN
767 x_return_status := FND_API.G_RET_STS_ERROR;
768 END IF;
769 END IF;
770
771 IF p_Line_Adj_rec.redeemed_flag IS NOT NULL
772 THEN
773 IF NOT OE_CNCL_Validate_Adj.Redeemed_Flag(p_Line_Adj_rec.redeemed_flag) THEN
774 x_return_status := FND_API.G_RET_STS_ERROR;
775 END IF;
776 END IF;
777
778 IF p_Line_Adj_rec.accrual_flag IS NOT NULL
779 THEN
780 IF NOT OE_CNCL_Validate_Adj.Accrual_Flag(p_Line_Adj_rec.accrual_flag) THEN
781 x_return_status := FND_API.G_RET_STS_ERROR;
782 END IF;
783 END IF;
784
785 IF p_Line_Adj_rec.list_header_id IS NOT NULL
786 THEN
787 IF NOT OE_CNCL_Validate_Adj.list_header_id(p_Line_Adj_rec.list_header_id) THEN
788 x_return_status := FND_API.G_RET_STS_ERROR;
789 END IF;
790 END IF;
791
792 IF p_Line_Adj_rec.list_line_id IS NOT NULL
793 THEN
794 IF NOT OE_CNCL_Validate_Adj.list_line_id(p_Line_Adj_rec.list_line_id) THEN
795 x_return_status := FND_API.G_RET_STS_ERROR;
796 END IF;
797 END IF;
798
799 IF p_Line_Adj_rec.list_line_type_code IS NOT NULL
800 THEN
801 IF NOT OE_CNCL_Validate_Adj.list_line_type_code(p_Line_Adj_rec.list_line_type_code) THEN
802 x_return_status := FND_API.G_RET_STS_ERROR;
803 END IF;
804 END IF;
805
806 IF p_Line_Adj_rec.modified_from IS NOT NULL
807 THEN
808 IF NOT OE_CNCL_Validate_Adj.modified_from(p_Line_Adj_rec.modified_from) THEN
809 x_return_status := FND_API.G_RET_STS_ERROR;
810 END IF;
811 END IF;
812
813 IF p_Line_Adj_rec.modified_to IS NOT NULL
814 THEN
815 IF NOT OE_CNCL_Validate_Adj.modified_to(p_Line_Adj_rec.modified_to) THEN
816 x_return_status := FND_API.G_RET_STS_ERROR;
817 END IF;
818 END IF;
819
820 IF p_Line_Adj_rec.updated_flag IS NOT NULL
821 THEN
822 IF NOT OE_CNCL_Validate_Adj.updated_flag(p_Line_Adj_rec.updated_flag) THEN
823 x_return_status := FND_API.G_RET_STS_ERROR;
824 END IF;
825 END IF;
826
827 IF p_Line_Adj_rec.update_allowed IS NOT NULL
828 THEN
829 IF NOT OE_CNCL_Validate_Adj.update_allowed(p_Line_Adj_rec.update_allowed) THEN
830 x_return_status := FND_API.G_RET_STS_ERROR;
831 END IF;
832 END IF;
833
834 IF p_Line_Adj_rec.applied_flag IS NOT NULL
835 THEN
836 IF NOT OE_CNCL_Validate_Adj.applied_flag(p_Line_Adj_rec.applied_flag) THEN
837 x_return_status := FND_API.G_RET_STS_ERROR;
838 END IF;
839 END IF;
840
841 IF p_Line_Adj_rec.change_reason_code IS NOT NULL
842 THEN
843 IF NOT OE_CNCL_Validate_Adj.change_reason_code(p_Line_Adj_rec.change_reason_code) THEN
844 x_return_status := FND_API.G_RET_STS_ERROR;
845 END IF;
846 END IF;
847
848 IF p_Line_Adj_rec.change_reason_text IS NOT NULL
849 THEN
850 IF NOT OE_CNCL_Validate_Adj.change_reason_text(p_Line_Adj_rec.change_reason_text) THEN
851 x_return_status := FND_API.G_RET_STS_ERROR;
852 END IF;
853 END IF;
854
855 IF p_Line_Adj_rec.adjusted_amount IS NOT NULL
856 THEN
857 IF NOT OE_CNCL_Validate_Adj.Adjusted_Amount(p_Line_Adj_rec.adjusted_amount)
858 THEN
859 x_return_status := FND_API.G_RET_STS_ERROR;
860 END IF;
861 END IF;
862
863 IF p_Line_Adj_rec.pricing_phase_id IS NOT NULL
864 THEN
865 IF NOT OE_CNCL_Validate_Adj.Pricing_Phase_id(p_Line_Adj_rec.pricing_phase_id) THEN
866 x_return_status := FND_API.G_RET_STS_ERROR;
867 END IF;
868 END IF;
869
870 IF p_Line_Adj_rec.operand IS NOT NULL
871 THEN
872 IF NOT OE_CNCL_Validate_Adj.operand(p_Line_Adj_rec.operand) THEN
873 x_return_status := FND_API.G_RET_STS_ERROR;
874 END IF;
875 END IF;
876
877 IF p_Line_Adj_rec.arithmetic_operator IS NOT NULL
878 THEN
879 IF NOT OE_CNCL_Validate_Adj.arithmetic_operator(p_Line_Adj_rec.arithmetic_operator) THEN
880 x_return_status := FND_API.G_RET_STS_ERROR;
881 END IF;
882 END IF;
883
884 IF p_Line_Adj_rec.range_break_quantity IS NOT NULL
885 THEN
886 IF NOT OE_CNCL_Validate_Adj.range_break_quantity(p_Line_Adj_rec.range_break_quantity) THEN
887 x_return_status := FND_API.G_RET_STS_ERROR;
888 END IF;
889 END IF;
890
891 IF p_Line_Adj_rec.accrual_conversion_rate IS NOT NULL
892 THEN
893 IF NOT OE_CNCL_Validate_Adj.accrual_conversion_rate(p_Line_Adj_rec.accrual_conversion_rate) THEN
894 x_return_status := FND_API.G_RET_STS_ERROR;
895 END IF;
896 END IF;
897
898 IF p_Line_Adj_rec.pricing_group_sequence IS NOT NULL
899 THEN
900 IF NOT OE_CNCL_Validate_Adj.pricing_group_sequence(p_Line_Adj_rec.pricing_group_sequence) THEN
901 x_return_status := FND_API.G_RET_STS_ERROR;
902 END IF;
903 END IF;
904
905 IF p_Line_Adj_rec.modifier_level_code IS NOT NULL
906 THEN
907 IF NOT OE_CNCL_Validate_Adj.modifier_level_code(p_Line_Adj_rec.modifier_level_code) THEN
908 x_return_status := FND_API.G_RET_STS_ERROR;
909 END IF;
910 END IF;
911
912 IF p_Line_Adj_rec.price_break_type_code IS NOT NULL
913 THEN
914 IF NOT OE_CNCL_Validate_Adj.price_break_type_code(p_Line_Adj_rec.price_break_type_code) THEN
915 x_return_status := FND_API.G_RET_STS_ERROR;
916 END IF;
917 END IF;
918
919 IF p_Line_Adj_rec.substitution_attribute IS NOT NULL
920 THEN
921 IF NOT OE_CNCL_Validate_Adj.substitution_attribute(p_Line_Adj_rec.substitution_attribute) THEN
922 x_return_status := FND_API.G_RET_STS_ERROR;
923 END IF;
924 END IF;
925
926 IF p_Line_Adj_rec.proration_type_code IS NOT NULL
927 THEN
928 IF NOT OE_CNCL_Validate_Adj.proration_type_code(p_Line_Adj_rec.proration_type_code) THEN
929 x_return_status := FND_API.G_RET_STS_ERROR;
930 END IF;
931 END IF;
932
933 IF p_Line_Adj_rec.credit_or_charge_flag IS NOT NULL
934 THEN
935 IF NOT OE_CNCL_Validate.credit_or_charge_flag(p_Line_Adj_rec.credit_or_charge_flag) THEN
936 x_return_status := FND_API.G_RET_STS_ERROR;
937 END IF;
938 END IF;
939
940 IF p_Line_Adj_rec.cost_id IS NOT NULL
941 THEN
942 IF NOT OE_CNCL_Validate.cost_id(p_Line_Adj_rec.cost_id) THEN
943 x_return_status := FND_API.G_RET_STS_ERROR;
944 END IF;
945 END IF;
946
947 IF p_Line_Adj_rec.charge_type_code IS NOT NULL
948 THEN
949 IF NOT OE_CNCL_Validate.charge_type_code(p_Line_Adj_rec.charge_type_code) THEN
950 x_return_status := FND_API.G_RET_STS_ERROR;
951 END IF;
952 END IF;
953
954 IF p_Line_Adj_rec.charge_subtype_code IS NOT NULL
955 THEN
956 IF NOT OE_CNCL_Validate.charge_subtype_code(p_Line_Adj_rec.charge_subtype_code) THEN
957 x_return_status := FND_API.G_RET_STS_ERROR;
958 END IF;
959 END IF;
960
961 IF p_Line_Adj_rec.estimated_flag IS NOT NULL
962 THEN
963 IF NOT OE_CNCL_Validate.estimated(p_Line_Adj_rec.estimated_flag) THEN
964 x_return_status := FND_API.G_RET_STS_ERROR;
965 END IF;
966 END IF;
967
968 IF p_Line_Adj_rec.invoiced_flag IS NOT NULL
969 THEN
970 IF NOT OE_CNCL_Validate.invoiced(p_Line_Adj_rec.invoiced_flag) THEN
971 x_return_status := FND_API.G_RET_STS_ERROR;
972 END IF;
973 END IF;
974
975 IF p_Line_Adj_rec.context IS NOT NULL
976 OR p_Line_Adj_rec.attribute1 IS NOT NULL
977 OR p_Line_Adj_rec.attribute2 IS NOT NULL
978 OR p_Line_Adj_rec.attribute3 IS NOT NULL
979 OR p_Line_Adj_rec.attribute4 IS NOT NULL
980 OR p_Line_Adj_rec.attribute5 IS NOT NULL
981 OR p_Line_Adj_rec.attribute6 IS NOT NULL
982 OR p_Line_Adj_rec.attribute7 IS NOT NULL
983 OR p_Line_Adj_rec.attribute8 IS NOT NULL
984 OR p_Line_Adj_rec.attribute9 IS NOT NULL
985 OR p_Line_Adj_rec.attribute10 IS NOT NULL
986 OR p_Line_Adj_rec.attribute11 IS NOT NULL
987 OR p_Line_Adj_rec.attribute12 IS NOT NULL
988 OR p_Line_Adj_rec.attribute13 IS NOT NULL
989 OR p_Line_Adj_rec.attribute14 IS NOT NULL
990 OR p_Line_Adj_rec.attribute15 IS NOT NULL
991 THEN
992
993 oe_debug_pub.add('Before calling Line Adjustment Price_Adj_Desc_Flex');
994 IF NOT OE_CNCL_Validate_Adj.Price_Adj_Desc_Flex
995 (p_context => p_Line_Adj_rec.context
996 ,p_attribute1 => p_Line_Adj_rec.attribute1
997 ,p_attribute2 => p_Line_Adj_rec.attribute2
998 ,p_attribute3 => p_Line_Adj_rec.attribute3
999 ,p_attribute4 => p_Line_Adj_rec.attribute4
1000 ,p_attribute5 => p_Line_Adj_rec.attribute5
1001 ,p_attribute6 => p_Line_Adj_rec.attribute6
1002 ,p_attribute7 => p_Line_Adj_rec.attribute7
1003 ,p_attribute8 => p_Line_Adj_rec.attribute8
1004 ,p_attribute9 => p_Line_Adj_rec.attribute9
1005 ,p_attribute10 => p_Line_Adj_rec.attribute10
1006 ,p_attribute11 => p_Line_Adj_rec.attribute11
1007 ,p_attribute12 => p_Line_Adj_rec.attribute12
1008 ,p_attribute13 => p_Line_Adj_rec.attribute13
1009 ,p_attribute14 => p_Line_Adj_rec.attribute14
1010 ,p_attribute15 => p_Line_Adj_rec.attribute15) THEN
1011
1012
1013 x_return_status := FND_API.G_RET_STS_ERROR;
1014
1015 END IF;
1016
1017 oe_debug_pub.add('After Line Adjustment desc_flex ' || x_return_status);
1018
1019
1020
1021 END IF;
1022
1023 -- Done validating attributes
1024 oe_debug_pub.add('Exiting OE_CNCL_Validate_Line_Adjs');
1025 EXCEPTION
1026
1027 WHEN FND_API.G_EXC_ERROR THEN
1028
1029 x_return_status := FND_API.G_RET_STS_ERROR;
1030
1031 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1032
1033 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1034
1035 WHEN OTHERS THEN
1036
1037 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1038
1039 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1040 THEN
1041 OE_MSG_PUB.Add_Exc_Msg
1042 ( G_PKG_NAME
1043 , 'Attributes'
1044 );
1045 END IF;
1046
1047 END Attributes;
1048
1049
1050 END OE_CNCL_Validate_Line_Adj;