[Home] [Help]
PACKAGE BODY: APPS.OE_OE_FORM_LINE_ADJ
Source
1 PACKAGE BODY OE_OE_Form_Line_Adj AS
2 /* $Header: OEXFLADB.pls 120.2 2006/07/25 11:47:16 ppnair noship $ */
3
4 -- Global constant holding the package name
5
6 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_OE_Form_Line_Adj';
7
8 -- Global variables holding cached record.
9
10 g_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type
11 := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
12 g_db_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type
13 := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
14
15 -- Forward declaration of procedures maintaining entity record cache.
16
17 PROCEDURE Write_Line_Adj
18 ( p_Line_Adj_rec IN OE_Order_PUB.Line_Adj_Rec_Type
19 , p_db_record IN BOOLEAN := FALSE
20 );
21
22 PROCEDURE Get_Line_Adj
23 ( p_db_record IN BOOLEAN := FALSE
24 , p_price_adjustment_id IN NUMBER
25 , x_Line_Adj_rec IN OUT NOCOPY OE_Order_PUB.Line_Adj_Rec_Type
26 );
27
28 Procedure Get_Option_Service_Lines(p_top_model_line_id In Number,
29 p_service_line_id In Number Default null,
30 p_mode In VARCHAR2 Default 'SERVICE',
31 x_line_id_tbl out nocopy Oe_Order_Adj_Pvt.Index_Tbl_Type);
32
33
34 Procedure Process_Adj(p_parent_adj_rec In Oe_Order_Pub.Line_Adj_Rec_Type,
35 p_line_id_tbl In Oe_Order_Adj_Pvt.Index_Tbl_Type,
36 p_delete_flag In Varchar2 default 'N',
37 p_create_adj_no_validate In Boolean Default FALSE);
38
39 PROCEDURE Clear_Line_Adj;
40
41 -- Global variable holding performed operations.
42
43 g_opr__tbl OE_Order_PUB.Line_Adj_Tbl_Type;
44
45 -- Procedure : Default_Attributes
46 --
47
48 PROCEDURE Default_Attributes
49 ( x_return_status OUT NOCOPY VARCHAR2
50
51 , x_msg_count OUT NOCOPY NUMBER
52
53 , x_msg_data OUT NOCOPY VARCHAR2
54
55 , p_header_id IN NUMBER
56 , p_line_id IN NUMBER
57 , x_price_adjustment_id OUT NOCOPY NUMBER
58
59 , x_header_id OUT NOCOPY NUMBER
60
61 , x_discount_id OUT NOCOPY NUMBER
62
63 , x_discount_line_id OUT NOCOPY NUMBER
64
65 , x_automatic_flag OUT NOCOPY VARCHAR2
66
67 , x_percent OUT NOCOPY NUMBER
68
69 , x_line_id OUT NOCOPY NUMBER
70
71 , x_context OUT NOCOPY VARCHAR2
72
73 , x_attribute1 OUT NOCOPY VARCHAR2
74
75 , x_attribute2 OUT NOCOPY VARCHAR2
76
77 , x_attribute3 OUT NOCOPY VARCHAR2
78
79 , x_attribute4 OUT NOCOPY VARCHAR2
80
81 , x_attribute5 OUT NOCOPY VARCHAR2
82
83 , x_attribute6 OUT NOCOPY VARCHAR2
84
85 , x_attribute7 OUT NOCOPY VARCHAR2
86
87 , x_attribute8 OUT NOCOPY VARCHAR2
88
89 , x_attribute9 OUT NOCOPY VARCHAR2
90
91 , x_attribute10 OUT NOCOPY VARCHAR2
92
93 , x_attribute11 OUT NOCOPY VARCHAR2
94
95 , x_attribute12 OUT NOCOPY VARCHAR2
96
97 , x_attribute13 OUT NOCOPY VARCHAR2
98
99 , x_attribute14 OUT NOCOPY VARCHAR2
100
101 , x_attribute15 OUT NOCOPY VARCHAR2
102
103 , x_discount OUT NOCOPY VARCHAR2
104
105 , x_list_header_id OUT NOCOPY NUMBER
106
107 , x_list_line_id OUT NOCOPY NUMBER
108
109 , x_list_line_type_code OUT NOCOPY VARCHAR2
110
111 , x_modifier_mechanism_type_code OUT NOCOPY VARCHAR2
112
113 , x_updated_flag OUT NOCOPY VARCHAR2
114
115 , x_update_allowed OUT NOCOPY VARCHAR2
116
117 , x_applied_flag OUT NOCOPY VARCHAR2
118
119 , x_change_reason_code OUT NOCOPY VARCHAR2
120
121 , x_change_reason_text OUT NOCOPY VARCHAR2
122
123 , x_modified_from OUT NOCOPY VARCHAR2
124
125 , x_modified_to OUT NOCOPY VARCHAR2
126
127 , x_operand OUT NOCOPY NUMBER
128
129 , x_arithmetic_operator OUT NOCOPY VARCHAR2
130
131 , x_adjusted_amount OUT NOCOPY NUMBER
132
133 , x_pricing_phase_id OUT NOCOPY NUMBER
134
135 , x_list_line_no OUT NOCOPY varchar2
136
137 , x_source_system_code OUT NOCOPY varchar2
138
139 , x_benefit_qty OUT NOCOPY NUMBER
140
141 , x_benefit_uom_code OUT NOCOPY varchar2
142
143 , x_print_on_invoice_flag OUT NOCOPY varchar2
144
145 , x_expiration_date OUT NOCOPY DATE
146
147 , x_rebate_transaction_type_code OUT NOCOPY varchar2
148
149 , x_rebate_transaction_reference OUT NOCOPY varchar2
150
151 , x_rebate_payment_system_code OUT NOCOPY varchar2
152
153 , x_redeemed_date OUT NOCOPY DATE
154
155 , x_redeemed_flag OUT NOCOPY varchar2
156
157 , x_accrual_flag OUT NOCOPY varchar2
158
159 , x_invoiced_flag OUT NOCOPY varchar2
160
161 , x_estimated_flag OUT NOCOPY varchar2
162
163 , x_credit_or_charge_flag OUT NOCOPY varchar2
164
165 , x_include_on_returns_flag OUT NOCOPY varchar2
166
167 , x_charge_type_code OUT NOCOPY varchar2
168
169 , x_charge_subtype_code OUT NOCOPY varchar2
170
171 , x_ac_context OUT NOCOPY VARCHAR2
172
173 , x_ac_attribute1 OUT NOCOPY VARCHAR2
174
175 , x_ac_attribute2 OUT NOCOPY VARCHAR2
176
177 , x_ac_attribute3 OUT NOCOPY VARCHAR2
178
179 , x_ac_attribute4 OUT NOCOPY VARCHAR2
180
181 , x_ac_attribute5 OUT NOCOPY VARCHAR2
182
183 , x_ac_attribute6 OUT NOCOPY VARCHAR2
184
185 , x_ac_attribute7 OUT NOCOPY VARCHAR2
186
187 , x_ac_attribute8 OUT NOCOPY VARCHAR2
188
189 , x_ac_attribute9 OUT NOCOPY VARCHAR2
190
191 , x_ac_attribute10 OUT NOCOPY VARCHAR2
192
193 , x_ac_attribute11 OUT NOCOPY VARCHAR2
194
195 , x_ac_attribute12 OUT NOCOPY VARCHAR2
196
197 , x_ac_attribute13 OUT NOCOPY VARCHAR2
198
199 , x_ac_attribute14 OUT NOCOPY VARCHAR2
200
201 , x_ac_attribute15 OUT NOCOPY VARCHAR2
202
203 --uom begin
204 , x_operand_per_pqty OUT NOCOPY NUMBER
205
206 , x_adjusted_amount_per_pqty OUT NOCOPY NUMBER
207
208 --uom end
209 )
210 IS
211 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
212 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
213 l_Line_Adj_val_rec OE_Order_PUB.Line_Adj_Val_Rec_Type;
214 l_control_rec OE_GLOBALS.Control_Rec_Type;
215 l_return_status VARCHAR2(1);
216 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
217 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
218 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
219 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
220 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
221 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
222 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
223 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
224 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
225 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
226 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
227 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
228 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
229 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
230 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
231 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
232
233 --New out parameters
234 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
235 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
236 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
237
238 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
239 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
240 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
241
242 --
243 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
244 --
245 BEGIN
246
247 IF l_debug_level > 0 THEN
248 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.DEFAULT_ATTRIBUTES' , 1 ) ;
249 END IF;
250
251 -- Set the UI flag
252 OE_GLOBALS.G_UI_FLAG := TRUE;
253
254 -- Set control flags.
255 l_control_rec.controlled_operation := TRUE;
256 l_control_rec.check_security := TRUE;
257 l_control_rec.default_attributes := TRUE;
258 l_control_rec.change_attributes := TRUE;
259
260 l_control_rec.clear_dependents := FALSE;
261 l_control_rec.validate_entity := FALSE;
262 l_control_rec.write_to_DB := FALSE;
263 l_control_rec.process := FALSE;
264
265 -- Instruct API to retain its caches
266 l_control_rec.clear_api_cache := FALSE;
267 l_control_rec.clear_api_requests := FALSE;
268
269 l_x_old_line_adj_rec := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
270 l_x_line_adj_rec := OE_ORDER_PUB.G_MISS_LINE_ADJ_REC;
271
272 -- Load IN parameters if any exist
273 l_x_Line_adj_rec.header_id := p_header_id;
274 l_x_Line_adj_rec.line_id := p_line_id;
275
276
277 -- Defaulting of flex values is currently done by the form.
278 -- Set flex attributes to NULL in order to avoid defaulting them.
279 l_x_Line_Adj_rec.context := NULL;
280 l_x_Line_Adj_rec.attribute1 := NULL;
281 l_x_Line_Adj_rec.attribute2 := NULL;
282 l_x_Line_Adj_rec.attribute3 := NULL;
283 l_x_Line_Adj_rec.attribute4 := NULL;
284 l_x_Line_Adj_rec.attribute5 := NULL;
285 l_x_Line_Adj_rec.attribute6 := NULL;
286 l_x_Line_Adj_rec.attribute7 := NULL;
287 l_x_Line_Adj_rec.attribute8 := NULL;
288 l_x_Line_Adj_rec.attribute9 := NULL;
289 l_x_Line_Adj_rec.attribute10 := NULL;
290 l_x_Line_Adj_rec.attribute11 := NULL;
291 l_x_Line_Adj_rec.attribute12 := NULL;
292 l_x_Line_Adj_rec.attribute13 := NULL;
293 l_x_Line_Adj_rec.attribute14 := NULL;
294 l_x_Line_Adj_rec.attribute15 := NULL;
295 l_x_Line_Adj_rec.ac_context := NULL;
296 l_x_Line_Adj_rec.ac_attribute1 := NULL;
297 l_x_Line_Adj_rec.ac_attribute2 := NULL;
298 l_x_Line_Adj_rec.ac_attribute3 := NULL;
299 l_x_Line_Adj_rec.ac_attribute4 := NULL;
300 l_x_Line_Adj_rec.ac_attribute5 := NULL;
301 l_x_Line_Adj_rec.ac_attribute6 := NULL;
302 l_x_Line_Adj_rec.ac_attribute7 := NULL;
303 l_x_Line_Adj_rec.ac_attribute8 := NULL;
304 l_x_Line_Adj_rec.ac_attribute9 := NULL;
305 l_x_Line_Adj_rec.ac_attribute10 := NULL;
306 l_x_Line_Adj_rec.ac_attribute11 := NULL;
307 l_x_Line_Adj_rec.ac_attribute12 := NULL;
308 l_x_Line_Adj_rec.ac_attribute13 := NULL;
309 l_x_Line_Adj_rec.ac_attribute14 := NULL;
310 l_x_Line_Adj_rec.ac_attribute15 := NULL;
311 /*
312 l_x_Line_Adj_rec.list_line_id :=NULL;
313 l_x_Line_Adj_rec.list_line_type_code :=NULL;
314 l_x_Line_Adj_rec.modifier_mechanism_type_code :=NULL;
315 l_x_Line_Adj_rec.updated_flag :=NULL;
316 l_x_Line_Adj_rec.update_allowed :=NULL;
317 l_x_Line_Adj_rec.applied_flag :=NULL;
318 l_x_Line_Adj_rec.change_reason_code :=NULL;
319 l_x_Line_Adj_rec.change_reason_text :=NULL;
320 l_x_Line_Adj_rec.modified_from :=NULL;
321 l_x_Line_Adj_rec.modified_to :=NULL;
322 l_x_Line_Adj_rec.operand :=NULL;
323 l_x_Line_Adj_rec.arithmetic_operator :=NULL;
324 */
325
326
327 -- Set Operation to Create
328 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_CREATE;
329
330 -- Populate Line_Adj table
331 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
332 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
333
334 -- Call Oe_Order_Adj_Pvt.Line_Adj
335 oe_order_adj_pvt.Line_Adjs
336 ( p_init_msg_list => FND_API.G_TRUE
337 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
338 , p_control_rec => l_control_rec
339 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
340 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
341 );
342
343 /*****************************************************************
344 ** commented out nocopy for performance changes **
345
346 -- Call OE_Order_PVT.Process_order
347 OE_Order_PVT.Process_order
348 ( p_api_version_number => 1.0
349 , p_init_msg_list => FND_API.G_TRUE
350 , x_return_status => l_return_status
351 , x_msg_count => x_msg_count
352 , x_msg_data => x_msg_data
353 , p_control_rec => l_control_rec
354 , p_Line_Adj_tbl => l_Line_Adj_tbl
355 , x_header_rec => l_x_header_rec
356 , x_Header_Adj_tbl => l_x_Header_Adj_tbl
357
358 -- New Parameters
359 , x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
360 , x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
361 , x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
362
363 , x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
364 , x_line_tbl => l_x_line_tbl
365 , x_Line_Adj_tbl => l_x_Line_Adj_tbl
366 -- New Parameters
367 , x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
368 , x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
369 , x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
370
371 , x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
372 , x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
373 , x_action_request_tbl => l_action_request_tbl
374 );
375
376 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
377 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
378 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
379 RAISE FND_API.G_EXC_ERROR;
380 END IF;
381 ***********************************************************************/
382
383 -- Unload out tbl
384 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
385
386 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
387 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
388 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
389 RAISE FND_API.G_EXC_ERROR;
390 END IF;
391
392 -- Load OUT parameters.
393 x_price_adjustment_id := l_x_Line_Adj_rec.price_adjustment_id;
394 x_header_id := l_x_Line_Adj_rec.header_id;
395 x_discount_id := l_x_Line_Adj_rec.discount_id;
396 x_discount_line_id := l_x_Line_Adj_rec.discount_line_id;
397 x_automatic_flag := l_x_Line_Adj_rec.automatic_flag;
398 x_percent := l_x_Line_Adj_rec.percent;
399 x_line_id := l_x_Line_Adj_rec.line_id;
400 x_context := l_x_Line_Adj_rec.context;
401 x_attribute1 := l_x_Line_Adj_rec.attribute1;
402 x_attribute2 := l_x_Line_Adj_rec.attribute2;
403 x_attribute3 := l_x_Line_Adj_rec.attribute3;
404 x_attribute4 := l_x_Line_Adj_rec.attribute4;
405 x_attribute5 := l_x_Line_Adj_rec.attribute5;
406 x_attribute6 := l_x_Line_Adj_rec.attribute6;
407 x_attribute7 := l_x_Line_Adj_rec.attribute7;
408 x_attribute8 := l_x_Line_Adj_rec.attribute8;
409 x_attribute9 := l_x_Line_Adj_rec.attribute9;
410 x_attribute10 := l_x_Line_Adj_rec.attribute10;
411 x_attribute11 := l_x_Line_Adj_rec.attribute11;
412 x_attribute12 := l_x_Line_Adj_rec.attribute12;
413 x_attribute13 := l_x_Line_Adj_rec.attribute13;
414 x_attribute14 := l_x_Line_Adj_rec.attribute14;
415 x_attribute15 := l_x_Line_Adj_rec.attribute15;
416 x_ac_context := l_x_Line_Adj_rec.ac_context;
417 x_ac_attribute1 := l_x_Line_Adj_rec.ac_attribute1;
418 x_ac_attribute2 := l_x_Line_Adj_rec.ac_attribute2;
419 x_ac_attribute3 := l_x_Line_Adj_rec.ac_attribute3;
420 x_ac_attribute4 := l_x_Line_Adj_rec.ac_attribute4;
421 x_ac_attribute5 := l_x_Line_Adj_rec.ac_attribute5;
422 x_ac_attribute6 := l_x_Line_Adj_rec.ac_attribute6;
423 x_ac_attribute7 := l_x_Line_Adj_rec.ac_attribute7;
424 x_ac_attribute8 := l_x_Line_Adj_rec.ac_attribute8;
425 x_ac_attribute9 := l_x_Line_Adj_rec.ac_attribute9;
426 x_ac_attribute10 := l_x_Line_Adj_rec.ac_attribute10;
427 x_ac_attribute11 := l_x_Line_Adj_rec.ac_attribute11;
428 x_ac_attribute12 := l_x_Line_Adj_rec.ac_attribute12;
429 x_ac_attribute13 := l_x_Line_Adj_rec.ac_attribute13;
430 x_ac_attribute14 := l_x_Line_Adj_rec.ac_attribute14;
431 x_ac_attribute15 := l_x_Line_Adj_rec.ac_attribute15;
432 x_list_header_id := l_x_Line_Adj_rec.list_header_id;
433 x_list_line_id := l_x_Line_Adj_rec.list_line_id;
434 x_list_line_type_code := l_x_Line_Adj_rec.list_line_type_code;
435 x_modifier_mechanism_type_code :=
436 l_x_Line_Adj_rec.modifier_mechanism_type_code;
437 x_updated_flag := l_x_Line_Adj_rec.updated_flag;
438 x_update_allowed := l_x_Line_Adj_rec.update_allowed;
439 x_applied_flag := l_x_Line_Adj_rec.applied_flag;
440 x_change_reason_code := l_x_Line_Adj_rec.change_reason_code;
441 x_change_reason_text := l_x_Line_Adj_rec.change_reason_text;
442 x_modified_from := l_x_Line_Adj_rec.modified_from;
443 x_modified_to := l_x_Line_Adj_rec.modified_to;
444 x_operand := l_x_Line_Adj_rec.operand;
445 x_arithmetic_operator := l_x_Line_Adj_rec.arithmetic_operator;
446 x_adjusted_amount := l_x_Line_Adj_rec.adjusted_amount;
447 x_pricing_phase_id := l_x_Line_Adj_rec.pricing_phase_id;
448 x_list_line_no := l_x_Line_Adj_rec.list_line_no;
449 x_source_system_code := l_x_Line_Adj_rec.source_system_code;
450 x_benefit_qty := l_x_Line_Adj_rec.benefit_qty;
451 x_benefit_uom_code := l_x_Line_Adj_rec.benefit_uom_code;
452 x_print_on_invoice_flag := l_x_Line_Adj_rec.print_on_invoice_flag;
453 x_expiration_date := l_x_Line_Adj_rec.expiration_date;
454 x_rebate_transaction_type_code := l_x_Line_Adj_rec.rebate_transaction_type_code;
455 x_rebate_transaction_reference := l_x_Line_Adj_rec.rebate_transaction_reference;
456 x_rebate_payment_system_code := l_x_Line_Adj_rec.rebate_payment_system_code;
457 x_redeemed_date := l_x_Line_Adj_rec.redeemed_date;
458 x_redeemed_flag := l_x_Line_Adj_rec.redeemed_flag;
459 x_accrual_flag := l_x_Line_Adj_rec.accrual_flag;
460 x_estimated_flag := l_x_Line_Adj_rec.estimated_flag;
461 x_invoiced_flag := l_x_Line_Adj_rec.invoiced_flag;
462 x_charge_type_code := l_x_Line_Adj_rec.charge_type_code;
463 x_charge_subtype_code := l_x_Line_Adj_rec.charge_subtype_code;
464 x_credit_or_charge_flag := l_x_Line_Adj_rec.credit_or_charge_flag;
465 x_include_on_returns_flag := l_x_Line_Adj_rec.include_on_returns_flag;
466 --uom begin
467 x_operand_per_pqty := l_x_line_adj_rec.operand_per_pqty;
468 x_adjusted_amount_per_pqty:= l_x_line_adj_rec.adjusted_amount_per_pqty;
469 --uom end
470
471 -- Load display out parameters if any
472
473
474 l_Line_Adj_val_rec := OE_Line_Adj_Util.Get_Values
475 ( p_Line_Adj_rec => l_x_Line_Adj_rec
476 );
477 x_discount := l_Line_Adj_val_rec.discount;
478
479 -- Write to cache.
480 -- Set db_flag to False before writing to cache
481
482 l_x_Line_Adj_rec.db_flag := FND_API.G_FALSE;
483
484 Write_Line_Adj
485 ( p_Line_Adj_rec => l_x_Line_Adj_rec
486 );
487
488 -- Re-set the UI flag to FALSE
489 OE_GLOBALS.G_UI_FLAG := FALSE;
490
491 -- Set return status.
492
493 x_return_status := FND_API.G_RET_STS_SUCCESS;
494
495 -- Get message count and data
496
497 OE_MSG_PUB.Count_And_Get
498 ( p_count => x_msg_count
499 , p_data => x_msg_data
500 );
501
502 IF l_debug_level > 0 THEN
503 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.DEFAULT_ATTRIBUTES' , 1 ) ;
504 END IF;
505
506 EXCEPTION
507
508 WHEN FND_API.G_EXC_ERROR THEN
509
510 OE_GLOBALS.G_UI_FLAG := FALSE;
511
512 x_return_status := FND_API.G_RET_STS_ERROR;
513
514 -- Get message count and data
515
516 OE_MSG_PUB.Count_And_Get
517 ( p_count => x_msg_count
518 , p_data => x_msg_data
519 );
520
521 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
522
523 OE_GLOBALS.G_UI_FLAG := FALSE;
524
525 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
526
527 -- Get message count and data
528
529 OE_MSG_PUB.Count_And_Get
530 ( p_count => x_msg_count
531 , p_data => x_msg_data
532 );
533
534 WHEN OTHERS THEN
535
536 OE_GLOBALS.G_UI_FLAG := FALSE;
537
538 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
539
540 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
541 THEN
542 OE_MSG_PUB.Add_Exc_Msg
543 ( G_PKG_NAME
544 , 'Default_Attributes'
545 );
546 END IF;
547
548 -- Get message count and data
549
550 OE_MSG_PUB.Count_And_Get
551 ( p_count => x_msg_count
552 , p_data => x_msg_data
553 );
554
555 END Default_Attributes;
556
557 -- Procedure : Change_Attributes
558 --
559
560 PROCEDURE Change_Attributes
561 ( x_return_status OUT NOCOPY VARCHAR2
562
563 , x_msg_count OUT NOCOPY NUMBER
564
565 , x_msg_data OUT NOCOPY VARCHAR2
566
567 , p_price_adjustment_id IN NUMBER
568 , p_attr_id IN NUMBER
569 , p_attr_value1 IN VARCHAR2
570 , p_attr_value2 IN VARCHAR2 DEFAULT FND_API.G_MISS_CHAR
571 , p_context IN VARCHAR2
572 , p_attribute1 IN VARCHAR2
573 , p_attribute2 IN VARCHAR2
574 , p_attribute3 IN VARCHAR2
575 , p_attribute4 IN VARCHAR2
576 , p_attribute5 IN VARCHAR2
577 , p_attribute6 IN VARCHAR2
578 , p_attribute7 IN VARCHAR2
579 , p_attribute8 IN VARCHAR2
580 , p_attribute9 IN VARCHAR2
581 , p_attribute10 IN VARCHAR2
582 , p_attribute11 IN VARCHAR2
583 , p_attribute12 IN VARCHAR2
584 , p_attribute13 IN VARCHAR2
585 , p_attribute14 IN VARCHAR2
586 , p_attribute15 IN VARCHAR2
587 , p_ac_context IN VARCHAR2
588 , p_ac_attribute1 IN VARCHAR2
589 , p_ac_attribute2 IN VARCHAR2
590 , p_ac_attribute3 IN VARCHAR2
591 , p_ac_attribute4 IN VARCHAR2
592 , p_ac_attribute5 IN VARCHAR2
593 , p_ac_attribute6 IN VARCHAR2
594 , p_ac_attribute7 IN VARCHAR2
595 , p_ac_attribute8 IN VARCHAR2
596 , p_ac_attribute9 IN VARCHAR2
597 , p_ac_attribute10 IN VARCHAR2
598 , p_ac_attribute11 IN VARCHAR2
599 , p_ac_attribute12 IN VARCHAR2
600 , p_ac_attribute13 IN VARCHAR2
601 , p_ac_attribute14 IN VARCHAR2
602 , p_ac_attribute15 IN VARCHAR2
603 , x_price_adjustment_id OUT NOCOPY NUMBER
604
605 , x_header_id OUT NOCOPY NUMBER
606
607 , x_discount_id OUT NOCOPY NUMBER
608
609 , x_discount_line_id OUT NOCOPY NUMBER
610
611 , x_automatic_flag OUT NOCOPY VARCHAR2
612
613 , x_percent OUT NOCOPY NUMBER
614
615 , x_line_id OUT NOCOPY NUMBER
616
617 , x_context OUT NOCOPY VARCHAR2
618
619 , x_attribute1 OUT NOCOPY VARCHAR2
620
621 , x_attribute2 OUT NOCOPY VARCHAR2
622
623 , x_attribute3 OUT NOCOPY VARCHAR2
624
625 , x_attribute4 OUT NOCOPY VARCHAR2
626
627 , x_attribute5 OUT NOCOPY VARCHAR2
628
629 , x_attribute6 OUT NOCOPY VARCHAR2
630
631 , x_attribute7 OUT NOCOPY VARCHAR2
632
633 , x_attribute8 OUT NOCOPY VARCHAR2
634
635 , x_attribute9 OUT NOCOPY VARCHAR2
636
637 , x_attribute10 OUT NOCOPY VARCHAR2
638
639 , x_attribute11 OUT NOCOPY VARCHAR2
640
641 , x_attribute12 OUT NOCOPY VARCHAR2
642
643 , x_attribute13 OUT NOCOPY VARCHAR2
644
645 , x_attribute14 OUT NOCOPY VARCHAR2
646
647 , x_attribute15 OUT NOCOPY VARCHAR2
648
649 , x_ac_context OUT NOCOPY VARCHAR2
650
651 , x_ac_attribute1 OUT NOCOPY VARCHAR2
652
653 , x_ac_attribute2 OUT NOCOPY VARCHAR2
654
655 , x_ac_attribute3 OUT NOCOPY VARCHAR2
656
657 , x_ac_attribute4 OUT NOCOPY VARCHAR2
658
659 , x_ac_attribute5 OUT NOCOPY VARCHAR2
660
661 , x_ac_attribute6 OUT NOCOPY VARCHAR2
662
663 , x_ac_attribute7 OUT NOCOPY VARCHAR2
664
665 , x_ac_attribute8 OUT NOCOPY VARCHAR2
666
667 , x_ac_attribute9 OUT NOCOPY VARCHAR2
668
669 , x_ac_attribute10 OUT NOCOPY VARCHAR2
670
671 , x_ac_attribute11 OUT NOCOPY VARCHAR2
672
673 , x_ac_attribute12 OUT NOCOPY VARCHAR2
674
675 , x_ac_attribute13 OUT NOCOPY VARCHAR2
676
677 , x_ac_attribute14 OUT NOCOPY VARCHAR2
678
679 , x_ac_attribute15 OUT NOCOPY VARCHAR2
680
681 , x_discount OUT NOCOPY VARCHAR2
682
683 , p_enforce_fixed_price IN VARCHAR2
684
685 -- New code added
686 , x_list_header_id OUT NOCOPY NUMBER
687
688 , x_list_line_id OUT NOCOPY NUMBER
689
690 , x_list_line_type_code OUT NOCOPY VARCHAR2
691
692 , x_modifier_mechanism_type_code OUT NOCOPY VARCHAR2
693
694 , x_updated_flag OUT NOCOPY VARCHAR2
695
696 , x_update_allowed OUT NOCOPY VARCHAR2
697
698 , x_applied_flag OUT NOCOPY VARCHAR2
699
700 , x_change_reason_code OUT NOCOPY VARCHAR2
701
702 , x_change_reason_text OUT NOCOPY VARCHAR2
703
704 , x_modified_from OUT NOCOPY VARCHAR2
705
706 , x_modified_to OUT NOCOPY VARCHAR2
707
708 , x_operand OUT NOCOPY NUMBER
709
710 , x_arithmetic_operator OUT NOCOPY VARCHAR2
711
712 , x_adjusted_amount OUT NOCOPY NUMBER
713
714 , x_pricing_phase_id OUT NOCOPY NUMBER
715
716 , x_list_line_no OUT NOCOPY varchar2
717
718 , x_source_system_code OUT NOCOPY varchar2
719
720 , x_benefit_qty OUT NOCOPY NUMBER
721
722 , x_benefit_uom_code OUT NOCOPY varchar2
723
724 , x_print_on_invoice_flag OUT NOCOPY varchar2
725
726 , x_expiration_date OUT NOCOPY DATE
727
728 , x_rebate_transaction_type_code OUT NOCOPY varchar2
729
730 , x_rebate_transaction_reference OUT NOCOPY varchar2
731
732 , x_rebate_payment_system_code OUT NOCOPY varchar2
733
734 , x_redeemed_date OUT NOCOPY DATE
735
736 , x_redeemed_flag OUT NOCOPY varchar2
737
738 , x_accrual_flag OUT NOCOPY varchar2
739
740 , x_invoiced_flag OUT NOCOPY varchar2
741
742 , x_estimated_flag OUT NOCOPY varchar2
743
744 , x_credit_or_charge_flag OUT NOCOPY varchar2
745
746 , x_include_on_returns_flag OUT NOCOPY varchar2
747
748 , x_charge_type_code OUT NOCOPY varchar2
749
750 , x_charge_subtype_code OUT NOCOPY varchar2
751
752 --uom begin
753 , x_operand_per_pqty OUT NOCOPY NUMBER
754
755 , x_adjusted_amount_per_pqty OUT NOCOPY NUMBER
756
757 --uom end
758 )
759 IS
760 l_request_rec OE_Order_Pub.Request_Rec_Type;
761 l_request_tbl OE_Order_Pub.Request_Tbl_Type;
762 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
763 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
764 l_Line_Adj_val_rec OE_Order_PUB.Line_Adj_Val_Rec_Type;
765 l_control_rec OE_GLOBALS.Control_Rec_Type;
766 l_return_status VARCHAR2(1);
767 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
768 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
769 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
770 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
771 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
772 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
773 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
774 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
775 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
776 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
777 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
778 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
779 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
780 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
781 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
782 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
783
784 --New out parameters
785 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
786 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
787 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
788
789 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
790 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
791 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
792
793 --1790502
794 l_line_rec OE_Order_Pub.Line_Rec_Type;
795 l_line_id_tbl OE_Order_Adj_Pvt.Index_Tbl_Type;
796 l_top_model_line_id Number;
797
798 l_profile_cascade_adjustments Varchar2(1):= NVL(FND_PROFILE.VALUE('ONT_CASCADE_ADJUSTMENTS'),'N');
799 l_orcl_customization Varchar2(1):= NVL(FND_PROFILE.VALUE('ONT_ACTIVATE_ORACLE_CUSTOMIZATION'),'N');
800 l_date_format Varchar2(22) := 'DD-MON-YYYY HH24:MI:SS';
801 --
802 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
803 --
804 BEGIN
805
806 IF l_debug_level > 0 THEN
807 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.CHANGE_ATTRIBUTES' , 1 ) ;
808 END IF;
809
810 --initialize record.
811 l_line_rec.line_id := NULL;
812 l_line_id_tbl.delete;
813
814 -- Set the UI flag
815 OE_GLOBALS.G_UI_FLAG := TRUE;
816
817 -- Set control flags.
818
819 l_control_rec.controlled_operation := TRUE;
820 l_control_rec.check_security := TRUE;
821 l_control_rec.clear_dependents := TRUE;
822 l_control_rec.default_attributes := TRUE;
823 l_control_rec.change_attributes := TRUE;
824
825 l_control_rec.validate_entity := FALSE;
826 l_control_rec.write_to_DB := FALSE;
827 l_control_rec.process := FALSE;
828 l_control_rec.process_entity := OE_GLOBALS.G_ENTITY_LINE_ADJ;
829
830 -- Instruct API to retain its caches
831
832 l_control_rec.clear_api_cache := FALSE;
833 l_control_rec.clear_api_requests := FALSE;
834
835 -- Save point to rollback to if there were
836 -- any errors
837 SAVEPOINT change_attributes;
838
839 -- Read Line_Adj from cache
840
841 Get_Line_Adj
842 ( p_db_record => FALSE
843 , p_price_adjustment_id => p_price_adjustment_id
844 , x_Line_Adj_rec => l_x_Line_Adj_rec
845 );
846
847 l_x_old_Line_Adj_rec := l_x_Line_Adj_rec;
848
849 IF p_attr_id = OE_Line_Adj_Util.G_PRICE_ADJUSTMENT THEN
850 l_x_Line_Adj_rec.price_adjustment_id := TO_NUMBER(p_attr_value1);
851 ELSIF p_attr_id = OE_Line_Adj_Util.G_HEADER THEN
852 l_x_Line_Adj_rec.header_id := TO_NUMBER(p_attr_value1);
853
854
855 -- The following has been done because a discount can only
856 -- be uniquely identified with a discount_id and discount_line_id
857 --
858 -- The form will now be sending in both attribute_values
859 --
860 -- It ATTR_ID is discount_id then
861 -- ATTR_VALUE1 is discount_id
862 -- ATTR_VALUE2 is discount_line_id
863 ELSIF p_attr_id = OE_Line_Adj_Util.G_DISCOUNT THEN
864 l_x_Line_Adj_rec.discount_id := TO_NUMBER(p_attr_value1);
865 l_x_Line_Adj_rec.discount_line_id := TO_NUMBER(p_attr_value2);
866
867 -- It ATTR_ID is discount_line_id then
868 -- ATTR_VALUE1 is discount_line_id
869 -- ATTR_VALUE2 is discount_id
870 ELSIF p_attr_id = OE_Line_Adj_Util.G_DISCOUNT_LINE THEN
871 l_x_Line_Adj_rec.discount_line_id := TO_NUMBER(p_attr_value1);
872 l_x_Line_Adj_rec.discount_id := TO_NUMBER(p_attr_value2);
873
874 -- New column changes
875 -- New code Added :: Column Changes
876 ELSIF p_attr_id = OE_Line_Adj_Util.G_LIST_HEADER_ID then
877 l_x_Line_Adj_rec.list_header_id := to_number(p_attr_value1) ;
878 ELSIF p_attr_id = OE_Line_Adj_Util.G_LIST_LINE_ID then
879 l_x_Line_Adj_rec.list_line_id := to_number(p_attr_value1) ;
880 ELSIF p_attr_id = OE_Line_Adj_Util.G_LIST_LINE_TYPE_CODE then
881 l_x_Line_Adj_rec.list_line_type_code := p_attr_value1 ;
882
883 IF l_x_Line_Adj_rec.list_line_type_code = 'PBH'
884 AND nvl(l_x_Line_Adj_rec.list_line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM THEN
885 BEGIN
886 SELECT ldets.line_quantity
887 INTO l_x_Line_Adj_rec.range_break_quantity
888 FROM qp_preq_ldets_tmp ldets,
889 qp_preq_lines_tmp lin
890 WHERE ldets.created_from_list_line_id = l_x_Line_Adj_rec.list_line_id
891 AND ldets.pricing_status_code = 'N'
892 AND lin.line_index = ldets.line_index
893 AND nvl(lin.line_id,l_x_Line_Adj_rec.line_id) = l_x_Line_Adj_rec.line_id
894 AND rownum = 1;
895 EXCEPTION WHEN OTHERS THEN
896 IF l_debug_level > 0 THEN
897 oe_debug_pub.add( ' IN OE_OE_FORM_LINE_ADJ:'||SQLERRM ) ;
898 END IF;
899 END;
900 END IF;
901 ELSIF p_attr_id = OE_Line_Adj_Util.G_MODIFIER_MECHANISM_TYPE_CODE then
902 l_x_Line_Adj_rec.modifier_mechanism_type_code := p_attr_value1 ;
903 ELSIF p_attr_id = OE_Line_Adj_Util.G_MODIFIED_FROM then
904 l_x_Line_Adj_rec.modified_from := p_attr_value1;
905 ELSIF p_attr_id = OE_Line_Adj_Util.G_MODIFIED_TO then
906 l_x_Line_Adj_rec.modified_to := p_attr_value1;
907 ELSIF p_attr_id = OE_Line_Adj_Util.G_UPDATE_ALLOWED then
908 l_x_Line_Adj_rec.update_allowed := p_attr_value1 ;
909 ELSIF p_attr_id = OE_Line_Adj_Util.G_UPDATED_FLAG then
910 l_x_Line_Adj_rec.updated_flag := p_attr_value1 ;
911 ELSIF p_attr_id = OE_Line_Adj_Util.G_APPLIED_FLAG then
912 l_x_Line_Adj_rec.applied_flag := p_attr_value1 ;
913 ELSIF p_attr_id = OE_Line_Adj_Util.G_CHANGE_REASON_CODE then
914 l_x_Line_Adj_rec.change_reason_code := p_attr_value1 ;
915 ELSIF p_attr_id = OE_Line_Adj_Util.G_CHANGE_REASON_TEXT then
916 l_x_Line_Adj_rec.change_reason_text := p_attr_value1 ;
917 ELSIF p_attr_id = OE_Line_Adj_Util.G_OPERAND then
918 l_x_Line_Adj_rec.operand := p_attr_value1 ;
919 ELSIF p_attr_id = OE_Line_Adj_Util.G_ARITHMETIC_OPERATOR then
920 l_x_Line_Adj_rec.arithmetic_operator := p_attr_value1 ;
921
922 ELSIF p_attr_id = OE_Line_Adj_Util.G_ADJUSTED_AMOUNT then
923 l_x_Line_Adj_rec.adjusted_amount := p_attr_value1 ;
924 ELSIF p_attr_id = OE_Line_Adj_Util.G_PRICING_PHASE_ID then
925 l_x_Line_Adj_rec.pricing_phase_id := p_attr_value1 ;
926 ELSIF p_attr_id = OE_Line_Adj_Util.G_LIST_LINE_NO then
927 l_x_Line_Adj_rec.list_line_no := p_attr_value1 ;
928 ELSIF p_attr_id = OE_Line_Adj_Util.G_SOURCE_SYSTEM_CODE then
929 l_x_Line_Adj_rec.source_system_code := p_attr_value1;
930 ELSIF p_attr_id = OE_Line_Adj_Util.G_BENEFIT_QTY then
931 l_x_Line_Adj_rec.benefit_qty := TO_NUMBER(p_attr_value1);
932 ELSIF p_attr_id = OE_Line_Adj_Util.G_BENEFIT_UOM_CODE then
933 l_x_Line_Adj_rec.benefit_uom_code := p_attr_value1;
934 ELSIF p_attr_id = OE_Line_Adj_Util.G_PRINT_ON_INVOICE_FLAG then
935 l_x_Line_Adj_rec.print_on_invoice_flag := p_attr_value1;
936 ELSIF p_attr_id = OE_Line_Adj_Util.G_EXPIRATION_DATE then
937 -- l_x_Line_Adj_rec.expiration_date := TO_DATE(p_attr_value1, l_date_format);
938 l_x_Line_Adj_rec.expiration_date := fnd_date.string_TO_DATE(p_attr_value1, l_date_format); --bug5402396
939 ELSIF p_attr_id = OE_Line_Adj_Util.G_REBATE_TRANSACTION_TYPE_CODE then
940 l_x_Line_Adj_rec.rebate_transaction_type_code := p_attr_value1;
941 ELSIF p_attr_id = OE_Line_Adj_Util.G_REBATE_TRANSACTION_REFERENCE then
942 l_x_Line_Adj_rec.rebate_transaction_reference := p_attr_value1;
943 ELSIF p_attr_id = OE_Line_Adj_Util.G_REBATE_PAYMENT_SYSTEM_CODE then
944 l_x_Line_Adj_rec.rebate_payment_system_code := p_attr_value1;
945 ELSIF p_attr_id = OE_Line_Adj_Util.G_REDEEMED_DATE then
946 -- l_x_Line_Adj_rec.redeemed_date := TO_DATE(p_attr_value1, l_date_format);
947 l_x_Line_Adj_rec.redeemed_date := fnd_date.string_TO_DATE(p_attr_value1, l_date_format); --bug5402396
948 ELSIF p_attr_id = OE_Line_Adj_Util.G_REDEEMED_FLAG then
949 l_x_Line_Adj_rec.redeemed_flag := p_attr_value1;
950 ELSIF p_attr_id = OE_Line_Adj_Util.G_ACCRUAL_FLAG then
951 l_x_Line_Adj_rec.accrual_flag := p_attr_value1;
952 ELSIF p_attr_id = OE_Line_Adj_Util.G_AUTOMATIC THEN
953 l_x_Line_Adj_rec.automatic_flag := p_attr_value1;
954 ELSIF p_attr_id = OE_Line_Adj_Util.G_PERCENT THEN
955 l_x_Line_Adj_rec.percent := TO_NUMBER(p_attr_value1);
956 --Manual Begin
957 ELSIF p_attr_id = OE_Line_Adj_Util.G_LINE THEN
958 If p_attr_value1 Is Not Null Then
959 l_x_Line_Adj_rec.line_id := TO_NUMBER(p_attr_value1);
960 Else
961 l_x_Line_Adj_rec.line_id := NULL;
962 End If;
963 --Manual End
964 ELSIF p_attr_id = OE_Line_Adj_Util.G_ESTIMATED_FLAG THEN
965 l_x_Line_Adj_rec.estimated_flag := p_attr_value1;
966 ELSIF p_attr_id = OE_Line_Adj_Util.G_INVOICED_FLAG THEN
967 l_x_Line_Adj_rec.INVOICED_FLAG := p_attr_value1;
968 ELSIF p_attr_id = OE_Line_Adj_Util.G_CHARGE_TYPE_CODE THEN
969 l_x_Line_Adj_rec.CHARGE_TYPE_CODE := p_attr_value1;
970 ELSIF p_attr_id = OE_Line_Adj_Util.G_CHARGE_SUBTYPE_CODE THEN
971 l_x_Line_Adj_rec.CHARGE_SUBTYPE_CODE := p_attr_value1;
972 ELSIF p_attr_id = OE_Line_Adj_Util.G_CREDIT_OR_CHARGE_FLAG THEN
973 l_x_Line_Adj_rec.CREDIT_OR_CHARGE_FLAG := p_attr_value1;
974 ELSIF p_attr_id = OE_Line_Adj_Util.G_INCLUDE_ON_RETURNS_FLAG THEN
975 l_x_Line_Adj_rec.INCLUDE_ON_RETURNS_FLAG := p_attr_value1;
976 --Manual Begin
977 ELSIF p_attr_id = OE_LINE_Adj_Util.G_modifier_level_code Then
978 l_x_Line_Adj_rec.modifier_level_code := p_attr_value1;
979 ELSIF p_attr_id = OE_LINE_Adj_Util.G_OVERRIDE_ALLOWED_FLAG Then
980 l_x_Line_Adj_rec.update_allowed:= p_attr_value1;
981 --Manual end
982 --uom begin
983 ELSIF p_attr_id = OE_Line_Adj_Util.G_OPERAND_PER_PQTY THEN
984 l_x_Line_Adj_rec.OPERAND_PER_PQTY := p_attr_value1;
985 ELSIF p_attr_id = OE_Line_Adj_Util.G_ADJUSTED_AMOUNT_PER_PQTY THEN
986 l_x_Line_Adj_rec.ADJUSTED_AMOUNT_PER_PQTY := p_attr_value1;
987 --uom end
988 ELSIF p_attr_id = OE_LINE_Adj_Util.G_RANGE_BREAK_QUANTITY THEN
989 l_x_Line_Adj_rec.range_break_quantity := p_attr_value1;
990 ELSIF p_attr_id = OE_Line_Adj_Util.G_CONTEXT
991 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE1
992 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE2
993 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE3
994 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE4
995 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE5
996 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE6
997 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE7
998 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE8
999 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE9
1000 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE10
1001 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE11
1002 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE12
1003 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE13
1004 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE14
1005 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE15
1006 THEN
1007
1008 l_x_Line_Adj_rec.context := p_context;
1009 l_x_Line_Adj_rec.attribute1 := p_attribute1;
1010 l_x_Line_Adj_rec.attribute2 := p_attribute2;
1011 l_x_Line_Adj_rec.attribute3 := p_attribute3;
1012 l_x_Line_Adj_rec.attribute4 := p_attribute4;
1013 l_x_Line_Adj_rec.attribute5 := p_attribute5;
1014 l_x_Line_Adj_rec.attribute6 := p_attribute6;
1015 l_x_Line_Adj_rec.attribute7 := p_attribute7;
1016 l_x_Line_Adj_rec.attribute8 := p_attribute8;
1017 l_x_Line_Adj_rec.attribute9 := p_attribute9;
1018 l_x_Line_Adj_rec.attribute10 := p_attribute10;
1019 l_x_Line_Adj_rec.attribute11 := p_attribute11;
1020 l_x_Line_Adj_rec.attribute12 := p_attribute12;
1021 l_x_Line_Adj_rec.attribute13 := p_attribute13;
1022 l_x_Line_Adj_rec.attribute14 := p_attribute14;
1023 l_x_Line_Adj_rec.attribute15 := p_attribute15;
1024 ELSIF p_attr_id = OE_Line_Adj_Util.G_AC_CONTEXT
1025 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE1
1026 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE2
1027 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE3
1028 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE4
1029 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE5
1030 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE6
1031 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE7
1032 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE8
1033 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE9
1034 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE10
1035 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE11
1036 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE12
1037 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE13
1038 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE14
1039 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE15
1040 THEN
1041
1042 l_x_Line_Adj_rec.ac_context := p_ac_context;
1043 l_x_Line_Adj_rec.ac_attribute1 := p_ac_attribute1;
1044 l_x_Line_Adj_rec.ac_attribute2 := p_ac_attribute2;
1045 l_x_Line_Adj_rec.ac_attribute3 := p_ac_attribute3;
1046 l_x_Line_Adj_rec.ac_attribute4 := p_ac_attribute4;
1047 l_x_Line_Adj_rec.ac_attribute5 := p_ac_attribute5;
1048 l_x_Line_Adj_rec.ac_attribute6 := p_ac_attribute6;
1049 l_x_Line_Adj_rec.ac_attribute7 := p_ac_attribute7;
1050 l_x_Line_Adj_rec.ac_attribute8 := p_ac_attribute8;
1051 l_x_Line_Adj_rec.ac_attribute9 := p_ac_attribute9;
1052 l_x_Line_Adj_rec.ac_attribute10 := p_ac_attribute10;
1053 l_x_Line_Adj_rec.ac_attribute11 := p_ac_attribute11;
1054 l_x_Line_Adj_rec.ac_attribute12 := p_ac_attribute12;
1055 l_x_Line_Adj_rec.ac_attribute13 := p_ac_attribute13;
1056 l_x_Line_Adj_rec.ac_attribute14 := p_ac_attribute14;
1057 l_x_Line_Adj_rec.ac_attribute15 := p_ac_attribute15;
1058
1059 ELSE
1060
1061 -- Unexpected error, unrecognized attribute
1062
1063 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1064 THEN
1065 OE_MSG_PUB.Add_Exc_Msg
1066 ( G_PKG_NAME
1067 , 'Change_Attributes'
1068 , 'Unrecognized attribute'
1069 );
1070 END IF;
1071
1072 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1073
1074 END IF;
1075
1076 IF l_debug_level > 0 THEN
1077 oe_debug_pub.add( 'RL:ADJUSTED AMT = ' || L_X_LINE_ADJ_REC.ADJUSTED_AMOUNT ) ;
1078 END IF;
1079 IF l_debug_level > 0 THEN
1080 oe_debug_pub.add( 'RL:ADJ PQTY = ' || L_X_LINE_ADJ_REC.ADJUSTED_AMOUNT_PER_PQTY ) ;
1081 END IF;
1082
1083 -- Set Operation.
1084
1085 IF FND_API.To_Boolean(l_x_Line_Adj_rec.db_flag) THEN
1086 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
1087 ELSE
1088 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_CREATE;
1089 END IF;
1090
1091 --Bug 1790502
1092 --For cascading adjustments to service lines
1093 --Only applicable to Service lines reference to options of a Model line
1094 --Only applicable to % arithmetic_operator
1095
1096 /*Legend:
1097 Top model line has prefix of T
1098 Option line has prefix of O
1099 Service line has prefix of S
1100 Adjustment has prefix of A
1101 Adjustment for service lines has prefix of AS
1102
1103 T1--A1
1104 |--S1----AS2
1105 |
1106 |
1107 |--O1--A3
1108 | |-----S2----AS4
1109 |
1110 |--O2--A5
1111 |-----S3----AS6
1112
1113 Top model line T1 has adjusment A1 and Service line S1. Service line S1
1114 (service line for top model) has adjustment AS2. If you make % change
1115 on AS2, the same change will propagate the change to AS4 and AS6 which are the
1116 adjustments for option service lines S2 and S3. It will not propagate the
1117 same adjustment to A3 and A5 (because these are adjustments for Option lines
1118 not for service lines). */
1119
1120 IF l_debug_level > 0 THEN
1121 oe_debug_pub.add( ' ARITHMETIC_OPERATOR:'||L_X_LINE_ADJ_REC.ARITHMETIC_OPERATOR ) ;
1122 END IF;
1123 IF l_debug_level > 0 THEN
1124 oe_debug_pub.add( ' P_ATTR_ID:'|| P_ATTR_ID ) ;
1125 END IF;
1126 IF l_debug_level > 0 THEN
1127 oe_debug_pub.add( ' G_OPERAND_PER_PQTY:'||OE_LINE_ADJ_UTIL.G_OPERAND_PER_PQTY ) ;
1128 END IF;
1129
1130
1131 If (l_x_line_adj_rec.arithmetic_operator = '%' and
1132 p_attr_id = OE_Line_Adj_Util.G_OPERAND_PER_PQTY)
1133 or p_attr_id = OE_Line_Adj_Util.G_CHANGE_REASON_CODE
1134 Then
1135 IF l_debug_level > 0 THEN
1136 oe_debug_pub.add( ' CS BEFORE GETTING LINE' ) ;
1137 END IF;
1138 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
1139 x_line_rec=>l_line_rec);
1140 End If;
1141
1142 --Cascading adjustments for service lines
1143 IF l_debug_level > 0 THEN
1144 oe_debug_pub.add( ' CS QUERIED LINE_ID:'||L_LINE_REC.LINE_ID ) ;
1145 END IF;
1146 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
1147 l_line_rec.service_reference_line_id Is Not Null --make sure is adjustment for a service line
1148 Then
1149 --To determine if this is an adjustment for service line of a top model line
1150 Begin
1151 Select line_id
1152 Into l_top_model_line_id
1153 From Oe_Order_Lines_All
1154 Where line_id = l_line_rec.service_reference_line_id
1155 and top_model_line_id = line_id;
1156
1157 --This is a service line of a top model line, need to cascade the change to adjustments
1158 --for service lines of option items.
1159 get_option_service_lines(p_top_model_line_id=>l_top_model_line_id,
1160 p_service_line_id=>l_line_rec.line_id,
1161 x_line_id_tbl=>l_line_id_tbl);
1162
1163 --setting p_create_adj_no_validation to TRUE to maintain
1164 --behavior of bug 1790502 in which adjustment for service option line are not being validated
1165 If l_line_id_tbl.first is Not Null Then
1166 IF l_debug_level > 0 THEN
1167 oe_debug_pub.add( 'CS CREATING OR CHANGING' ) ;
1168 END IF;
1169 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
1170 p_line_id_tbl => l_line_id_tbl,
1171 p_create_adj_no_validate => TRUE);
1172 End If;
1173
1174 Exception when no_data_found Then
1175 Null;
1176 IF l_debug_level > 0 THEN
1177 oe_debug_pub.add( ' CS THIS IS NOT A ADJUSTMENT FOR TOP SERVICE LINE' ) ;
1178 END IF;
1179 --No data found, this is not an adjustment for service line for top model line item.
1180 End;
1181 End If;
1182
1183 If l_orcl_customization = 'Y' Then
1184 IF l_debug_level > 0 THEN
1185 oe_debug_pub.add( ' CS BEFORE CHECKING TOP MODEL LINE' ) ;
1186 END IF;
1187 IF l_debug_level > 0 THEN
1188 oe_debug_pub.add( ' TOP MODEL LINE ID:'||L_LINE_REC.TOP_MODEL_LINE_ID ) ;
1189 END IF;
1190 --Cascading adjustments from top model to option lines
1191 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
1192 l_line_rec.line_id = l_line_rec.top_model_line_id --to make sure this is a top model line
1193 Then
1194 get_option_service_lines(p_top_model_line_id=>l_line_rec.top_model_line_id,
1195 p_mode => 'OPTION',
1196 x_line_id_tbl=>l_line_id_tbl);
1197
1198 IF l_debug_level > 0 THEN
1199 oe_debug_pub.add( ' LINE ID COUNT:'||L_LINE_ID_TBL.COUNT ) ;
1200 END IF;
1201 If l_line_id_tbl.first is Not Null Then
1202 IF l_debug_level > 0 THEN
1203 oe_debug_pub.add( 'CS CASCADING OPTION ADJUSTMENTS' ) ;
1204 END IF;
1205 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
1206 p_line_id_tbl => l_line_id_tbl);
1207 End If;
1208
1209 End If;
1210
1211 --we will need to cascade change reason code too, if it got changed
1212 If p_attr_id = OE_Line_Adj_Util.G_CHANGE_REASON_CODE Then
1213
1214 --If no line queried, requery again else just use this to
1215 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) = FND_API.G_MISS_NUM Then
1216 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
1217 x_line_rec=>l_line_rec);
1218 End If;
1219
1220 --Only do that for top model line
1221 If l_line_rec.line_id = l_line_rec.top_model_line_id Then
1222 get_option_service_lines(p_top_model_line_id=>l_line_rec.top_model_line_id,
1223 p_mode => 'OPTION',
1224 x_line_id_tbl=>l_line_id_tbl);
1225
1226 If l_line_id_tbl.first is Not Null Then
1227 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
1228 p_line_id_tbl => l_line_id_tbl);
1229 End If;
1230 End If;
1231
1232 End If;
1233
1234
1235 End If; --cascade adjustment lines
1236
1237 --Reset l_line_rec.line_id after used
1238 l_line_rec.line_id := NULL;
1239 l_line_id_tbl.delete;
1240
1241 -- Populate Line_Adj table
1242 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
1243 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
1244
1245 -- Call Oe_Order_Adj_Pvt.Line_Adj
1246 l_Line_Adj_rec := l_x_Line_Adj_rec;
1247
1248 oe_order_adj_pvt.Line_Adjs
1249 ( p_init_msg_list => FND_API.G_TRUE
1250 , p_validation_level => FND_API.G_VALID_LEVEL_NONE
1251 , p_control_rec => l_control_rec
1252 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
1253 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
1254 );
1255
1256 /************************************************************************
1257 -- Call OE_Order_PVT.Process_order
1258 OE_Order_PVT.Process_order
1259 ( p_api_version_number => 1.0
1260 , p_init_msg_list => FND_API.G_TRUE
1261 , p_validation_level => FND_API.G_VALID_LEVEL_NONE
1262 , x_return_status => l_return_status
1263 , x_msg_count => x_msg_count
1264 , x_msg_data => x_msg_data
1265 , p_control_rec => l_control_rec
1266 , p_action_request_tbl => l_request_tbl
1267 , p_Line_Adj_tbl => l_Line_Adj_tbl
1268 , p_old_Line_Adj_tbl => l_old_Line_Adj_tbl
1269 , x_header_rec => l_x_header_rec
1270 , x_Header_Adj_tbl => l_x_Header_Adj_tbl
1271
1272 -- New Parameters
1273 , x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
1274 , x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
1275 , x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
1276
1277
1278 , x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
1279 , x_line_tbl => l_x_line_tbl
1280 , x_Line_Adj_tbl => l_x_Line_Adj_tbl
1281
1282 -- New Parameters
1283 , x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
1284 , x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
1285 , x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
1286
1287
1288 , x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
1289 , x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
1290 , x_action_request_tbl => l_action_request_tbl
1291 );
1292
1293 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1294 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1295 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1296 RAISE FND_API.G_EXC_ERROR;
1297 END IF;
1298 ******************************************************************/
1299
1300 -- Unload out tbl
1301 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
1302
1303 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1304 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1305 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
1306 RAISE FND_API.G_EXC_ERROR;
1307 END IF;
1308
1309 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
1310 (p_request_type => OE_GLOBALS.G_CHECK_DUPLICATE
1311 ,p_delete => FND_API.G_TRUE
1312 ,x_return_status => l_return_status
1313 );
1314 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1315 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1316 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1317 RAISE FND_API.G_EXC_ERROR;
1318 END IF;
1319
1320 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
1321 (p_request_type => OE_GLOBALS.G_CHECK_FIXED_PRICE
1322 ,p_delete => FND_API.G_TRUE
1323 ,x_return_status => l_return_status
1324 );
1325 IF p_enforce_fixed_price = 'YES' THEN
1326 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1327 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1328 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1329 RAISE FND_API.G_EXC_ERROR;
1330 END IF;
1331 ELSE
1332 l_return_status := FND_API.G_RET_STS_SUCCESS;
1333 END IF;
1334
1335
1336 -- Init OUT parameters to missing.
1337
1338 x_price_adjustment_id := FND_API.G_MISS_NUM;
1339 x_header_id := FND_API.G_MISS_NUM;
1340 x_discount_id := FND_API.G_MISS_NUM;
1341 x_discount := FND_API.G_MISS_CHAR;
1342 x_discount_line_id := FND_API.G_MISS_NUM;
1343 x_automatic_flag := FND_API.G_MISS_CHAR;
1344 x_percent := FND_API.G_MISS_NUM;
1345 x_line_id := FND_API.G_MISS_NUM;
1346 x_context := FND_API.G_MISS_CHAR;
1347 x_attribute1 := FND_API.G_MISS_CHAR;
1348 x_attribute2 := FND_API.G_MISS_CHAR;
1349 x_attribute3 := FND_API.G_MISS_CHAR;
1350 x_attribute4 := FND_API.G_MISS_CHAR;
1351 x_attribute5 := FND_API.G_MISS_CHAR;
1352 x_attribute6 := FND_API.G_MISS_CHAR;
1353 x_attribute7 := FND_API.G_MISS_CHAR;
1354 x_attribute8 := FND_API.G_MISS_CHAR;
1355 x_attribute9 := FND_API.G_MISS_CHAR;
1356 x_attribute10 := FND_API.G_MISS_CHAR;
1357 x_attribute11 := FND_API.G_MISS_CHAR;
1358 x_attribute12 := FND_API.G_MISS_CHAR;
1359 x_attribute13 := FND_API.G_MISS_CHAR;
1360 x_attribute14 := FND_API.G_MISS_CHAR;
1361 x_attribute15 := FND_API.G_MISS_CHAR;
1362 x_ac_context := FND_API.G_MISS_CHAR;
1363 x_ac_attribute1 := FND_API.G_MISS_CHAR;
1364 x_ac_attribute2 := FND_API.G_MISS_CHAR;
1365 x_ac_attribute3 := FND_API.G_MISS_CHAR;
1366 x_ac_attribute4 := FND_API.G_MISS_CHAR;
1367 x_ac_attribute5 := FND_API.G_MISS_CHAR;
1368 x_ac_attribute6 := FND_API.G_MISS_CHAR;
1369 x_ac_attribute7 := FND_API.G_MISS_CHAR;
1370 x_ac_attribute8 := FND_API.G_MISS_CHAR;
1371 x_ac_attribute9 := FND_API.G_MISS_CHAR;
1372 x_ac_attribute10 := FND_API.G_MISS_CHAR;
1373 x_ac_attribute11 := FND_API.G_MISS_CHAR;
1374 x_ac_attribute12 := FND_API.G_MISS_CHAR;
1375 x_ac_attribute13 := FND_API.G_MISS_CHAR;
1376 x_ac_attribute14 := FND_API.G_MISS_CHAR;
1377 x_ac_attribute15 := FND_API.G_MISS_CHAR;
1378
1379 -- New columns names added
1380 x_list_header_id := FND_API.G_MISS_NUM;
1381 x_list_line_id := FND_API.G_MISS_NUM;
1382 x_list_line_type_code := FND_API.G_MISS_CHAR;
1383 x_modifier_mechanism_type_code := FND_API.G_MISS_CHAR;
1384 x_modified_from := FND_API.G_MISS_CHAR;
1385 x_modified_to := FND_API.G_MISS_CHAR;
1386 x_update_allowed := FND_API.G_MISS_CHAR;
1387 x_updated_flag := FND_API.G_MISS_CHAR;
1388 x_applied_flag := FND_API.G_MISS_CHAR;
1389 x_change_reason_code := FND_API.G_MISS_CHAR;
1390 x_change_reason_text := FND_API.G_MISS_CHAR;
1391 x_operand := FND_API.G_MISS_NUM;
1392 x_arithmetic_operator := FND_API.G_MISS_CHAR;
1393
1394 x_adjusted_amount := FND_API.G_MISS_NUM;
1395 x_pricing_phase_id := FND_API.G_MISS_NUM;
1396 x_list_line_no := FND_API.G_MISS_CHAR;
1397 x_source_system_code := FND_API.G_MISS_CHAR;
1398 x_benefit_qty := FND_API.G_MISS_NUM;
1399 x_benefit_uom_code := FND_API.G_MISS_CHAR;
1400 x_print_on_invoice_flag := FND_API.G_MISS_CHAR;
1401 x_expiration_date := FND_API.G_MISS_DATE;
1402 x_rebate_transaction_type_code := FND_API.G_MISS_CHAR;
1403 x_rebate_transaction_reference := FND_API.G_MISS_CHAR;
1404 x_rebate_payment_system_code := FND_API.G_MISS_CHAR;
1405 x_redeemed_date := FND_API.G_MISS_DATE;
1406 x_redeemed_flag := FND_API.G_MISS_CHAR;
1407 x_accrual_flag := FND_API.G_MISS_CHAR;
1408 x_estimated_flag := FND_API.G_MISS_CHAR;
1409 x_invoiced_flag := FND_API.G_MISS_CHAR;
1410 x_charge_type_code := FND_API.G_MISS_CHAR;
1411 x_charge_subtype_code := FND_API.G_MISS_CHAR;
1412 x_credit_or_charge_flag := FND_API.G_MISS_CHAR;
1413 x_include_on_returns_flag := FND_API.G_MISS_CHAR;
1414 --uom begin
1415 x_operand_per_pqty := FND_API.G_MISS_NUM;
1416 x_adjusted_amount_per_pqty := FND_API.G_MISS_NUM;
1417 --uom end
1418
1419 -- Load display out parameters if any
1420
1421 l_Line_Adj_val_rec := OE_Line_Adj_Util.Get_Values
1422 ( p_Line_Adj_rec =>l_x_Line_Adj_rec
1423 , p_old_Line_Adj_rec => l_Line_Adj_rec
1424 );
1425
1426 -- New Column changes
1427
1428 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.adjusted_amount, l_Line_Adj_rec.adjusted_amount)
1429 THEN
1430 x_adjusted_amount := l_x_Line_Adj_rec.adjusted_amount;
1431 END IF;
1432
1433 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.pricing_phase_id, l_Line_Adj_rec.pricing_phase_id)
1434 THEN
1435 x_pricing_phase_id := l_x_Line_Adj_rec.pricing_phase_id;
1436 END IF;
1437
1438 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_line_no, l_Line_Adj_rec.list_line_no)
1439 THEN
1440 x_list_line_no := l_x_Line_Adj_rec.list_line_no;
1441 END IF;
1442
1443 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.source_system_code, l_Line_Adj_rec.source_system_code)
1444 THEN
1445 x_source_system_code := l_x_Line_Adj_rec.source_system_code;
1446 END IF;
1447
1448 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.benefit_qty, l_Line_Adj_rec.benefit_qty)
1449 THEN
1450 x_benefit_qty := l_x_Line_Adj_rec.benefit_qty;
1451 END IF;
1452
1453 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.benefit_uom_code, l_Line_Adj_rec.benefit_uom_code)
1454 THEN
1455 x_benefit_uom_code := l_x_Line_Adj_rec.benefit_uom_code;
1456 END IF;
1457
1458 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.print_on_invoice_flag, l_Line_Adj_rec.print_on_invoice_flag)
1459 THEN
1460 x_print_on_invoice_flag := l_x_Line_Adj_rec.print_on_invoice_flag;
1461 END IF;
1462
1463 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.expiration_date, l_Line_Adj_rec.expiration_date)
1464 THEN
1465 x_expiration_date := l_x_Line_Adj_rec.expiration_date;
1466 END IF;
1467
1468 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.rebate_transaction_type_code, l_Line_Adj_rec.rebate_transaction_type_code)
1469 THEN
1470 x_rebate_transaction_type_code := l_x_Line_Adj_rec.rebate_transaction_type_code;
1471 END IF;
1472
1473 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.rebate_transaction_reference, l_Line_Adj_rec.rebate_transaction_reference)
1474 THEN
1475 x_rebate_transaction_reference := l_x_Line_Adj_rec.rebate_transaction_reference;
1476 END IF;
1477
1478 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.rebate_payment_system_code, l_Line_Adj_rec.rebate_payment_system_code)
1479 THEN
1480 x_rebate_payment_system_code := l_x_Line_Adj_rec.rebate_payment_system_code;
1481 END IF;
1482
1483 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.redeemed_date, l_Line_Adj_rec.redeemed_date)
1484 THEN
1485 x_redeemed_date := l_x_Line_Adj_rec.redeemed_date;
1486 END IF;
1487
1488 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.redeemed_flag, l_Line_Adj_rec.redeemed_flag)
1489 THEN
1490 x_redeemed_flag := l_x_Line_Adj_rec.redeemed_flag;
1491 END IF;
1492
1493 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.accrual_flag, l_Line_Adj_rec.accrual_flag)
1494 THEN
1495 x_accrual_flag := l_x_Line_Adj_rec.accrual_flag;
1496 END IF;
1497
1498 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_header_id, l_Line_Adj_rec.list_header_id)
1499 THEN
1500 x_list_header_id := l_x_Line_Adj_rec.list_header_id;
1501 END IF;
1502
1503 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_line_id,l_Line_Adj_rec.list_line_id)
1504 THEN
1505 x_list_line_id := l_x_Line_Adj_rec.list_line_id;
1506 END IF;
1507
1508 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_line_type_code,
1509 l_Line_Adj_rec.list_line_type_code)
1510 THEN
1511 x_list_line_type_code := l_x_Line_Adj_rec.list_line_type_code;
1512 END IF;
1513
1514 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.modifier_mechanism_type_code,
1515 l_Line_Adj_rec.modifier_mechanism_type_code)
1516 THEN
1517 x_modifier_mechanism_type_code :=
1518 l_x_Line_Adj_rec.modifier_mechanism_type_code;
1519 END IF;
1520
1521 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.update_allowed,
1522 l_Line_Adj_rec.update_allowed)
1523 THEN
1524 x_update_allowed := l_x_Line_Adj_rec.update_allowed;
1525 END IF;
1526
1527 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.updated_flag, l_Line_Adj_rec.updated_flag)
1528 THEN
1529 x_updated_flag := l_x_Line_Adj_rec.updated_flag;
1530 END IF;
1531
1532 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.modified_from, l_Line_Adj_rec.modified_from)
1533 THEN
1534 x_modified_from := l_x_Line_Adj_rec.modified_from;
1535 END IF;
1536
1537 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.modified_to, l_Line_Adj_rec.modified_to)
1538 THEN
1539 x_modified_to := l_x_Line_Adj_rec.modified_to;
1540 END IF;
1541
1542 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.applied_flag, l_Line_Adj_rec.applied_flag)
1543 THEN
1544 x_applied_flag := l_x_Line_Adj_rec.applied_flag;
1545 END IF;
1546
1547 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.change_reason_code, l_Line_Adj_rec.change_reason_code)
1548 THEN
1549 x_change_reason_code := l_x_Line_Adj_rec.change_reason_code;
1550 END IF;
1551
1552 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.change_reason_text, l_Line_Adj_rec.change_reason_text)
1553 THEN
1554 x_change_reason_text := l_x_Line_Adj_rec.change_reason_text;
1555 END IF;
1556 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.operand, l_Line_Adj_rec.operand)
1557 THEN
1558 x_operand := l_x_Line_Adj_rec.operand;
1559 END IF;
1560 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.arithmetic_operator, l_Line_Adj_rec.arithmetic_operator)
1561 THEN
1562 x_arithmetic_operator := l_x_Line_Adj_rec.arithmetic_operator;
1563 END IF;
1564
1565
1566 -- Return changed attributes.
1567
1568 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute1,
1569 l_Line_Adj_rec.attribute1)
1570 THEN
1571 x_attribute1 := l_x_Line_Adj_rec.attribute1;
1572 END IF;
1573
1574 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute10,
1575 l_Line_Adj_rec.attribute10)
1576 THEN
1577 x_attribute10 := l_x_Line_Adj_rec.attribute10;
1578 END IF;
1579
1580 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute11,
1581 l_Line_Adj_rec.attribute11)
1582 THEN
1583 x_attribute11 := l_x_Line_Adj_rec.attribute11;
1584 END IF;
1585
1586 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute12,
1587 l_Line_Adj_rec.attribute12)
1588 THEN
1589 x_attribute12 := l_x_Line_Adj_rec.attribute12;
1590 END IF;
1591
1592 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute13,
1593 l_Line_Adj_rec.attribute13)
1594 THEN
1595 x_attribute13 := l_x_Line_Adj_rec.attribute13;
1596 END IF;
1597
1598 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute14,
1599 l_Line_Adj_rec.attribute14)
1600 THEN
1601 x_attribute14 := l_x_Line_Adj_rec.attribute14;
1602 END IF;
1603
1604 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute15,
1605 l_Line_Adj_rec.attribute15)
1606 THEN
1607 x_attribute15 := l_x_Line_Adj_rec.attribute15;
1608 END IF;
1609
1610 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute2,
1611 l_Line_Adj_rec.attribute2)
1612 THEN
1613 x_attribute2 := l_x_Line_Adj_rec.attribute2;
1614 END IF;
1615
1616 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute3,
1617 l_Line_Adj_rec.attribute3)
1618 THEN
1619 x_attribute3 := l_x_Line_Adj_rec.attribute3;
1620 END IF;
1621
1622 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute4,
1623 l_Line_Adj_rec.attribute4)
1624 THEN
1625 x_attribute4 := l_x_Line_Adj_rec.attribute4;
1626 END IF;
1627
1628 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute5,
1629 l_Line_Adj_rec.attribute5)
1630 THEN
1631 x_attribute5 := l_x_Line_Adj_rec.attribute5;
1632 END IF;
1633
1634 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute6,
1635 l_Line_Adj_rec.attribute6)
1636 THEN
1637 x_attribute6 := l_x_Line_Adj_rec.attribute6;
1638 END IF;
1639
1640 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute7,
1641 l_Line_Adj_rec.attribute7)
1642 THEN
1643 x_attribute7 := l_x_Line_Adj_rec.attribute7;
1644 END IF;
1645
1646 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute8,
1647 l_Line_Adj_rec.attribute8)
1648 THEN
1649 x_attribute8 := l_x_Line_Adj_rec.attribute8;
1650 END IF;
1651
1652 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute9,
1653 l_Line_Adj_rec.attribute9)
1654 THEN
1655 x_attribute9 := l_x_Line_Adj_rec.attribute9;
1656 END IF;
1657
1658 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.automatic_flag,
1659 l_Line_Adj_rec.automatic_flag)
1660 THEN
1661 x_automatic_flag := l_x_Line_Adj_rec.automatic_flag;
1662 END IF;
1663
1664 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.context,
1665 l_Line_Adj_rec.context)
1666 THEN
1667 x_context := l_x_Line_Adj_rec.context;
1668 END IF;
1669
1670 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.discount_id,
1671 l_Line_Adj_rec.discount_id)
1672 THEN
1673 x_discount_id := l_x_Line_Adj_rec.discount_id;
1674 x_discount := l_Line_Adj_val_rec.discount;
1675 END IF;
1676
1677 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.discount_line_id,
1678 l_Line_Adj_rec.discount_line_id)
1679 THEN
1680 x_discount_line_id := l_x_Line_Adj_rec.discount_line_id;
1681 END IF;
1682
1683 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.header_id,
1684 l_Line_Adj_rec.header_id)
1685 THEN
1686 x_header_id := l_x_Line_Adj_rec.header_id;
1687 END IF;
1688
1689 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.line_id,
1690 l_Line_Adj_rec.line_id)
1691 THEN
1692 x_line_id := l_x_Line_Adj_rec.line_id;
1693 END IF;
1694
1695 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.percent,
1696 l_Line_Adj_rec.percent)
1697 THEN
1698 x_percent := l_x_Line_Adj_rec.percent;
1699 END IF;
1700
1701 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.price_adjustment_id,
1702 l_Line_Adj_rec.price_adjustment_id)
1703 THEN
1704 x_price_adjustment_id := l_x_Line_Adj_rec.price_adjustment_id;
1705 END IF;
1706
1707 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.invoiced_flag,
1708 l_Line_Adj_rec.invoiced_flag)
1709 THEN
1710 x_invoiced_flag := l_x_Line_Adj_rec.invoiced_flag;
1711 END IF;
1712
1713 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.estimated_flag,
1714 l_Line_Adj_rec.estimated_flag)
1715 THEN
1716 x_estimated_flag := l_x_Line_Adj_rec.estimated_flag;
1717 END IF;
1718
1719 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.charge_type_code,
1720 l_Line_Adj_rec.charge_type_code)
1721 THEN
1722 x_charge_type_code := l_x_Line_Adj_rec.charge_type_code;
1723 END IF;
1724
1725 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.charge_subtype_code,
1726 l_Line_Adj_rec.charge_subtype_code)
1727 THEN
1728 x_charge_subtype_code := l_x_Line_Adj_rec.charge_subtype_code;
1729 END IF;
1730
1731 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.credit_or_charge_flag,
1732 l_Line_Adj_rec.credit_or_charge_flag)
1733 THEN
1734 x_credit_or_charge_flag := l_x_Line_Adj_rec.credit_or_charge_flag;
1735 END IF;
1736
1737 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.include_on_returns_flag,
1738 l_Line_Adj_rec.include_on_returns_flag)
1739 THEN
1740 x_include_on_returns_flag := l_x_Line_Adj_rec.include_on_returns_flag;
1741 END IF;
1742
1743 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute1,
1744 l_Line_Adj_rec.ac_attribute1)
1745 THEN
1746 x_ac_attribute1 := l_x_Line_Adj_rec.ac_attribute1;
1747 END IF;
1748
1749 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute10,
1750 l_Line_Adj_rec.ac_attribute10)
1751 THEN
1752 x_ac_attribute10 := l_x_Line_Adj_rec.ac_attribute10;
1753 END IF;
1754
1755 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute11,
1756 l_Line_Adj_rec.ac_attribute11)
1757 THEN
1758 x_ac_attribute11 := l_x_Line_Adj_rec.ac_attribute11;
1759 END IF;
1760
1761 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute12,
1762 l_Line_Adj_rec.ac_attribute12)
1763 THEN
1764 x_ac_attribute12 := l_x_Line_Adj_rec.ac_attribute12;
1765 END IF;
1766
1767 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute13,
1768 l_Line_Adj_rec.ac_attribute13)
1769 THEN
1770 x_ac_attribute13 := l_x_Line_Adj_rec.ac_attribute13;
1771 END IF;
1772
1773 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute14,
1774 l_Line_Adj_rec.ac_attribute14)
1775 THEN
1776 x_ac_attribute14 := l_x_Line_Adj_rec.ac_attribute14;
1777 END IF;
1778
1779 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute15,
1780 l_Line_Adj_rec.ac_attribute15)
1781 THEN
1782 x_ac_attribute15 := l_x_Line_Adj_rec.ac_attribute15;
1783 END IF;
1784
1785 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute2,
1786 l_Line_Adj_rec.ac_attribute2)
1787 THEN
1788 x_ac_attribute2 := l_x_Line_Adj_rec.ac_attribute2;
1789 END IF;
1790
1791 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute3,
1792 l_Line_Adj_rec.ac_attribute3)
1793 THEN
1794 x_ac_attribute3 := l_x_Line_Adj_rec.ac_attribute3;
1795 END IF;
1796
1797 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute4,
1798 l_Line_Adj_rec.ac_attribute4)
1799 THEN
1800 x_ac_attribute4 := l_x_Line_Adj_rec.ac_attribute4;
1801 END IF;
1802
1803 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute5,
1804 l_Line_Adj_rec.ac_attribute5)
1805 THEN
1806 x_ac_attribute5 := l_x_Line_Adj_rec.ac_attribute5;
1807 END IF;
1808
1809 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute6,
1810 l_Line_Adj_rec.ac_attribute6)
1811 THEN
1812 x_ac_attribute6 := l_x_Line_Adj_rec.ac_attribute6;
1813 END IF;
1814
1815 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute7,
1816 l_Line_Adj_rec.ac_attribute7)
1817 THEN
1818 x_ac_attribute7 := l_x_Line_Adj_rec.ac_attribute7;
1819 END IF;
1820
1821 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute8,
1822 l_Line_Adj_rec.ac_attribute8)
1823 THEN
1824 x_ac_attribute8 := l_x_Line_Adj_rec.ac_attribute8;
1825 END IF;
1826
1827 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute9,
1828 l_Line_Adj_rec.ac_attribute9)
1829 THEN
1830 x_ac_attribute9 := l_x_Line_Adj_rec.ac_attribute9;
1831 END IF;
1832
1833 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_context,
1834 l_Line_Adj_rec.ac_context)
1835 THEN
1836 x_ac_context := l_x_Line_Adj_rec.ac_context;
1837 END IF;
1838 --uom begin
1839 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.operand_per_pqty,
1840 l_Line_Adj_rec.operand_per_pqty)
1841 THEN
1842 x_operand_per_pqty := l_x_Line_Adj_rec.operand_per_pqty;
1843 END IF;
1844
1845 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.adjusted_amount_per_pqty,
1846 l_Line_Adj_rec.adjusted_amount_per_pqty)
1847 THEN
1848 x_adjusted_amount_per_pqty := l_x_Line_Adj_rec.adjusted_amount_per_pqty;
1849 END IF;
1850 --uom end
1851
1852
1853
1854
1855 -- Write to cache.
1856 Write_Line_Adj
1857 ( p_Line_Adj_rec => l_x_Line_Adj_rec
1858 );
1859
1860 -- Re-set the UI flag to FALSE
1861 OE_GLOBALS.G_UI_FLAG := FALSE;
1862
1863 -- Set return status.
1864
1865 x_return_status := FND_API.G_RET_STS_SUCCESS;
1866
1867 -- Get message count and data
1868
1869 OE_MSG_PUB.Count_And_Get
1870 ( p_count => x_msg_count
1871 , p_data => x_msg_data
1872 );
1873
1874 IF l_debug_level > 0 THEN
1875 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.CHANGE_ATTRIBUTES' , 1 ) ;
1876 END IF;
1877
1878 EXCEPTION
1879
1880 WHEN FND_API.G_EXC_ERROR THEN
1881
1882 OE_GLOBALS.G_UI_FLAG := FALSE;
1883
1884 x_return_status := FND_API.G_RET_STS_ERROR;
1885
1886 -- Get message count and data
1887
1888 OE_MSG_PUB.Count_And_Get
1889 ( p_count => x_msg_count
1890 , p_data => x_msg_data
1891 );
1892
1893 ROLLBACK TO SAVEPOINT change_attributes;
1894
1895 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1896
1897 OE_GLOBALS.G_UI_FLAG := FALSE;
1898
1899 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1900
1901 -- Get message count and data
1902
1903 OE_MSG_PUB.Count_And_Get
1904 ( p_count => x_msg_count
1905 , p_data => x_msg_data
1906 );
1907
1908 ROLLBACK TO SAVEPOINT change_attributes;
1909
1910 WHEN OTHERS THEN
1911
1912 OE_GLOBALS.G_UI_FLAG := FALSE;
1913
1914 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1915
1916 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1917 THEN
1918 OE_MSG_PUB.Add_Exc_Msg
1919 ( G_PKG_NAME
1920 , 'Change_Attributes'
1921 );
1922 END IF;
1923
1924 -- Get message count and data
1925
1926 OE_MSG_PUB.Count_And_Get
1927 ( p_count => x_msg_count
1928 , p_data => x_msg_data
1929 );
1930
1931 ROLLBACK TO SAVEPOINT change_attributes;
1932
1933 END Change_Attributes;
1934
1935
1936
1937
1938 -- Procedure Validate_And_Write
1939 --
1940
1941 PROCEDURE Validate_And_Write
1942 ( x_return_status OUT NOCOPY VARCHAR2
1943
1944 , x_msg_count OUT NOCOPY NUMBER
1945
1946 , x_msg_data OUT NOCOPY VARCHAR2
1947
1948 , p_price_adjustment_id IN NUMBER
1949 , x_creation_date OUT NOCOPY DATE
1950
1951 , x_created_by OUT NOCOPY NUMBER
1952
1953 , x_last_update_date OUT NOCOPY DATE
1954
1955 , x_last_updated_by OUT NOCOPY NUMBER
1956
1957 , x_last_update_login OUT NOCOPY NUMBER
1958
1959 , p_ok_flag IN VARCHAR2
1960 , x_program_id OUT NOCOPY NUMBER
1961
1962 , x_program_application_id OUT NOCOPY NUMBER
1963
1964 , x_program_update_date OUT NOCOPY DATE
1965
1966 , x_request_id OUT NOCOPY NUMBER
1967
1968 , x_lock_control OUT NOCOPY NUMBER
1969
1970 )
1971 IS
1972 l_request_rec OE_Order_Pub.Request_Rec_Type;
1973 l_request_tbl OE_Order_Pub.Request_Tbl_Type;
1974 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
1975 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
1976 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
1977 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
1978 l_control_rec OE_GLOBALS.Control_Rec_Type;
1979 l_return_status VARCHAR2(1);
1980 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
1981 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
1982 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
1983 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
1984 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
1985 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
1986 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
1987 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
1988 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
1989 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
1990 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
1991 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
1992 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
1993 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
1994
1995
1996 --New out parameters
1997 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
1998 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
1999 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2000
2001 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2002 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2003 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2004
2005
2006 --
2007 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2008 --
2009 BEGIN
2010
2011 IF l_debug_level > 0 THEN
2012 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.VALIDATE_AND_WRITE' , 1 ) ;
2013 END IF;
2014
2015 -- Set the UI flag
2016 OE_GLOBALS.G_UI_FLAG := TRUE;
2017
2018 -- Set control flags.
2019 l_control_rec.controlled_operation := TRUE;
2020 l_control_rec.validate_entity := TRUE;
2021 l_control_rec.write_to_DB := TRUE;
2022
2023 l_control_rec.check_security := FALSE;
2024 l_control_rec.clear_dependents := FALSE;
2025 l_control_rec.default_attributes := FALSE;
2026 l_control_rec.change_attributes := FALSE;
2027 l_control_rec.process := FALSE;
2028 l_control_rec.process_entity := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2029
2030
2031 -- Instruct API to retain its caches
2032 l_control_rec.clear_api_cache := FALSE;
2033 l_control_rec.clear_api_requests := FALSE;
2034
2035
2036 -- Save point to rollback to if there were
2037 -- any errors
2038 SAVEPOINT validate_and_write;
2039
2040
2041 -- Read Line_Adj from cache
2042 Get_Line_Adj
2043 ( p_db_record => TRUE
2044 , p_price_adjustment_id => p_price_adjustment_id
2045 , x_Line_adj_rec => l_x_old_Line_Adj_rec
2046 );
2047
2048 Get_Line_Adj
2049 ( p_db_record => FALSE
2050 , p_price_adjustment_id => p_price_adjustment_id
2051 , x_Line_Adj_rec => l_x_Line_Adj_rec
2052 );
2053
2054
2055 -- Set Operation.
2056 -- IF FND_API.To_Boolean(l_Line_Adj_rec.db_flag) THEN
2057 IF FND_API.To_Boolean(l_x_Line_Adj_rec.db_flag) THEN
2058 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
2059 ELSE
2060 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_CREATE;
2061 END IF;
2062
2063
2064
2065 -- Populate Line_Adj table
2066 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
2067 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
2068 /* IF p_ok_flag = 'Y' THEN
2069
2070 l_request_rec.entity_code:= OE_GLOBALS.G_ENTITY_LINE_ADJ;
2071 l_request_rec.entity_id := l_line_adj_rec.line_id;
2072 l_request_rec.request_type := OE_GLOBALS.G_PRICE_ADJ;
2073 l_request_tbl(1) := l_request_rec;
2074
2075 END IF; */
2076
2077
2078 -- Call Oe_Order_Adj_Pvt.Line_Adj
2079 oe_order_adj_pvt.Line_Adjs
2080 ( p_init_msg_list => FND_API.G_TRUE
2081 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
2082 , p_control_rec => l_control_rec
2083 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
2084 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
2085 );
2086
2087 /*********************************************************************
2088 -- Call OE_Order_PVT.Process_order
2089 OE_Order_PVT.Process_order
2090 ( p_api_version_number => 1.0
2091 , p_init_msg_list => FND_API.G_TRUE
2092 , x_return_status => l_return_status
2093 , x_msg_count => x_msg_count
2094 , x_msg_data => x_msg_data
2095 , p_control_rec => l_control_rec
2096 , p_action_request_tbl => l_request_tbl
2097 , p_Line_Adj_tbl => l_Line_Adj_tbl
2098 , p_old_Line_Adj_tbl => l_old_Line_Adj_tbl
2099 , x_header_rec => l_x_header_rec
2100 , x_Header_Adj_tbl => l_x_Header_Adj_tbl
2101 -- New Parameters
2102 , x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
2103 , x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
2104 , x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
2105
2106 , x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
2107 , x_line_tbl => l_x_line_tbl
2108 , x_Line_Adj_tbl => l_x_Line_Adj_tbl
2109 -- New Parameters
2110 , x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
2111 , x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
2112 , x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
2113
2114 , x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
2115 , x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
2116 , x_action_request_tbl => l_action_request_tbl
2117 );
2118
2119 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2120 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2121 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2122 RAISE FND_API.G_EXC_ERROR;
2123 END IF;
2124 *************************************************************************/
2125
2126 -- Load OUT parameters.
2127 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
2128
2129 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2130 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2131 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
2132 RAISE FND_API.G_EXC_ERROR;
2133 END IF;
2134
2135 /*****
2136 Oe_Order_Pvt.Process_Requests_And_Notify
2137 ( p_process_requests => FALSE
2138 , p_notify => TRUE
2139 , p_line_adj_tbl => l_x_line_adj_tbl
2140 , p_old_line_adj_tbl => l_x_old_line_adj_tbl
2141 , x_return_status => l_return_status
2142 );
2143 ******/
2144
2145 x_lock_control := l_x_Line_Adj_rec.lock_control;
2146
2147 -- commented out by linda
2148 /****
2149 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2150 (p_request_type => OE_GLOBALS.G_CHECK_PERCENTAGE
2151 ,p_delete => FND_API.G_TRUE
2152 ,x_return_status => l_return_status
2153 );
2154 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2155 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2156 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2157 RAISE FND_API.G_EXC_ERROR;
2158 END IF;
2159 ***/
2160
2161 /***
2162 IF p_ok_flag = 'Y' THEN
2163 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2164 (p_request_type => OE_GLOBALS.G_PRICE_ADJ
2165 ,p_delete => FND_API.G_TRUE
2166 ,x_return_status => l_return_status
2167 );
2168 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2169 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2170 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2171 RAISE FND_API.G_EXC_ERROR;
2172 END IF;
2173 END IF;
2174 ***/
2175
2176 -- fixed bug 3271297
2177 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2178 (p_request_type => OE_GLOBALS.G_VERIFY_PAYMENT
2179 ,p_delete => FND_API.G_TRUE
2180 ,x_return_status => l_return_status
2181 );
2182 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2183 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2184 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2185 RAISE FND_API.G_EXC_ERROR;
2186 END IF;
2187
2188 x_creation_date := l_x_Line_Adj_rec.creation_date;
2189 x_created_by := l_x_Line_Adj_rec.created_by;
2190 x_last_update_date := l_x_Line_Adj_rec.last_update_date;
2191 x_last_updated_by := l_x_Line_Adj_rec.last_updated_by;
2192 x_last_update_login := l_x_Line_Adj_rec.last_update_login;
2193 x_program_id := l_x_Line_Adj_rec.program_id;
2194 x_program_application_id := l_x_Line_Adj_rec.program_application_id;
2195 x_program_update_date := l_x_Line_Adj_rec.program_update_date;
2196 x_request_id := l_x_Line_Adj_rec.request_id;
2197
2198
2199 -- Clear Line_Adj record cache
2200 Clear_Line_Adj;
2201
2202 -- Re-set the UI flag to FALSE
2203 OE_GLOBALS.G_UI_FLAG := FALSE;
2204
2205 -- Set return status.
2206
2207 x_return_status := FND_API.G_RET_STS_SUCCESS;
2208
2209 -- Get message count and data
2210
2211 OE_MSG_PUB.Count_And_Get
2212 ( p_count => x_msg_count
2213 , p_data => x_msg_data
2214 );
2215
2216 IF l_debug_level > 0 THEN
2217 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.VALIDATE_AND_WRITE' , 1 ) ;
2218 END IF;
2219
2220 EXCEPTION
2221
2222 WHEN FND_API.G_EXC_ERROR THEN
2223
2224 OE_GLOBALS.G_UI_FLAG := FALSE;
2225
2226 x_return_status := FND_API.G_RET_STS_ERROR;
2227
2228 -- Get message count and data
2229
2230 OE_MSG_PUB.Count_And_Get
2231 ( p_count => x_msg_count
2232 , p_data => x_msg_data
2233 );
2234
2235 ROLLBACK TO SAVEPOINT validate_and_write;
2236
2237 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2238
2239 OE_GLOBALS.G_UI_FLAG := FALSE;
2240
2241 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2242
2243 -- Get message count and data
2244
2245 OE_MSG_PUB.Count_And_Get
2246 ( p_count => x_msg_count
2247 , p_data => x_msg_data
2248 );
2249
2250 ROLLBACK TO SAVEPOINT validate_and_write;
2251
2252 WHEN OTHERS THEN
2253
2254 OE_GLOBALS.G_UI_FLAG := FALSE;
2255
2256 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2257
2258 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2259 THEN
2260 OE_MSG_PUB.Add_Exc_Msg
2261 ( G_PKG_NAME
2262 , 'Validate_And_Write'
2263 );
2264 END IF;
2265
2266 -- Get message count and data
2267
2268 OE_MSG_PUB.Count_And_Get
2269 ( p_count => x_msg_count
2270 , p_data => x_msg_data
2271 );
2272
2273 ROLLBACK TO SAVEPOINT validate_and_write;
2274
2275 END Validate_And_Write;
2276
2277 -- Procedure Delete_Row
2278 --
2279
2280 PROCEDURE Delete_Row
2281 ( x_return_status OUT NOCOPY VARCHAR2
2282
2283 , x_msg_count OUT NOCOPY NUMBER
2284
2285 , x_msg_data OUT NOCOPY VARCHAR2
2286
2287 , p_price_adjustment_id IN NUMBER
2288 , p_change_reason_code IN VARCHAR2 Default Null
2289 , p_change_comments IN VARCHAR2 Default Null
2290 )
2291 IS
2292 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2293 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2294 l_control_rec OE_GLOBALS.Control_Rec_Type;
2295 l_return_status VARCHAR2(1);
2296 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
2297 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
2298 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
2299 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
2300 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
2301 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
2302 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
2303 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
2304 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2305 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2306 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2307 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2308 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
2309 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
2310 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
2311 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
2312
2313 --New out parameters
2314
2315 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2316 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2317 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2318
2319 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2320 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2321 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2322
2323 --1790502
2324 l_line_rec OE_Order_Pub.Line_Rec_Type;
2325 l_line_id_tbl OE_Order_Adj_Pvt.Index_Tbl_Type;
2326 l_top_model_line_id Number;
2327 l_profile_cascade_adjustments Varchar2(1):= NVL(FND_PROFILE.VALUE('ONT_CASCADE_ADJUSTMENTS'),'N');
2328
2329 --
2330 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2331 --
2332 BEGIN
2333
2334 IF l_debug_level > 0 THEN
2335 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.DELETE_ROW' , 1 ) ;
2336 END IF;
2337
2338 -- Set the UI flag
2339 OE_GLOBALS.G_UI_FLAG := TRUE;
2340
2341 -- Set control flags.
2342
2343 l_control_rec.controlled_operation := TRUE;
2344 l_control_rec.check_security := TRUE;
2345 l_control_rec.validate_entity := TRUE;
2346 l_control_rec.write_to_DB := TRUE;
2347
2348 l_control_rec.clear_dependents := FALSE;
2349 l_control_rec.default_attributes := FALSE;
2350 l_control_rec.change_attributes := FALSE;
2351 l_control_rec.process := FALSE;
2352
2353 -- Instruct API to retain its caches
2354
2355 l_control_rec.clear_api_cache := FALSE;
2356 l_control_rec.clear_api_requests := FALSE;
2357
2358
2359 -- Read DB record from cache
2360 Get_Line_Adj
2361 ( p_db_record => TRUE
2362 , p_price_adjustment_id => p_price_adjustment_id
2363 , x_Line_adj_rec => l_x_Line_Adj_rec
2364 );
2365
2366
2367 -- Set Operation.
2368 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_DELETE;
2369
2370
2371 -- Populate Line_Adj table
2372 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
2373 l_x_Line_Adj_tbl(1).change_reason_code := p_change_reason_code;
2374 l_x_Line_Adj_tbl(1).change_reason_text := p_change_comments;
2375
2376
2377 -- Bug 1790502
2378 If l_x_line_adj_rec.arithmetic_operator = '%' Then
2379 IF l_debug_level > 0 THEN
2380 oe_debug_pub.add( ' CS BEFORE GETTING LINE' ) ;
2381 END IF;
2382 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
2383 x_line_rec=>l_line_rec);
2384
2385 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
2386 l_line_rec.service_reference_line_id Is Not Null --make sure is adjustment for a service line
2387 Then
2388 --To determine if this is an adjustment for service line of a top model line
2389 Begin
2390 Select line_id
2391 Into l_top_model_line_id
2392 From Oe_Order_Lines_All
2393 Where line_id = l_line_rec.service_reference_line_id
2394 and top_model_line_id = line_id;
2395
2396 --this is a top model line, need to cascade the change to adjustments
2397 --for service lines of option items.
2398 get_option_service_lines(p_top_model_line_id=>l_top_model_line_id,
2399 p_service_line_id=>l_line_rec.line_id,
2400 x_line_id_tbl=>l_line_id_tbl);
2401
2402 If l_line_id_tbl.first is Not Null Then
2403 IF l_debug_level > 0 THEN
2404 oe_debug_pub.add( ' CS DELETING CHILDREN OPTION SERVICE ADJUSTMENT LINES' ) ;
2405 END IF;
2406 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
2407 p_line_id_tbl => l_line_id_tbl,
2408 p_delete_flag => 'Y');
2409 End If;
2410
2411 Exception when no_data_found Then
2412 Null;
2413 IF l_debug_level > 0 THEN
2414 oe_debug_pub.add( ' CS THIS IS NOT A ADJUSTMENT FOR TOP SERVICE LINE' ) ;
2415 END IF;
2416 --No data found, this is not an adjustment for service line for top model line item.
2417 End;
2418
2419 If l_profile_cascade_adjustments = 'Y' Then
2420 --handling delete for adjustment for options of a top model
2421 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
2422 l_line_rec.top_model_line_id = l_line_rec.line_id
2423 Then
2424 get_option_service_lines(p_top_model_line_id =>l_line_rec.top_model_line_id,
2425 p_mode =>'OPTION',
2426 x_line_id_tbl =>l_line_id_tbl);
2427
2428 If l_line_id_tbl.first is Not Null Then
2429 IF l_debug_level > 0 THEN
2430 oe_debug_pub.add( ' CS DELETING CHILDREN OPTION ADJUSTMENT LINES' ) ;
2431 END IF;
2432 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
2433 p_line_id_tbl => l_line_id_tbl,
2434 p_delete_flag => 'Y');
2435 End If;
2436
2437 End If;
2438
2439
2440
2441
2442 End If; --l_profile_cascade_adjustments
2443
2444 End If;
2445
2446 End If;
2447
2448 -- Call Oe_Order_Adj_Pvt.Line_Adj
2449 oe_order_adj_pvt.Line_Adjs
2450 ( p_init_msg_list => FND_API.G_TRUE
2451 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
2452 , p_control_rec => l_control_rec
2453 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
2454 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
2455 );
2456
2457
2458 -- Load OUT parameters.
2459 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
2460
2461 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2462 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2463 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
2464 RAISE FND_API.G_EXC_ERROR;
2465 END IF;
2466
2467
2468 -- Clear Line_Adj record cache
2469 Clear_Line_Adj;
2470
2471 -- Re-set the UI flag to FALSE
2472 OE_GLOBALS.G_UI_FLAG := FALSE;
2473
2474 -- Set return status.
2475
2476 x_return_status := FND_API.G_RET_STS_SUCCESS;
2477
2478 -- Get message count and data
2479
2480 OE_MSG_PUB.Count_And_Get
2481 ( p_count => x_msg_count
2482 , p_data => x_msg_data
2483 );
2484
2485 IF l_debug_level > 0 THEN
2486 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.DELETE_ROW' , 1 ) ;
2487 END IF;
2488
2489 EXCEPTION
2490
2491 WHEN FND_API.G_EXC_ERROR THEN
2492
2493 OE_GLOBALS.G_UI_FLAG := FALSE;
2494
2495 x_return_status := FND_API.G_RET_STS_ERROR;
2496
2497 -- Get message count and data
2498
2499 OE_MSG_PUB.Count_And_Get
2500 ( p_count => x_msg_count
2501 , p_data => x_msg_data
2502 );
2503
2504 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2505
2506 OE_GLOBALS.G_UI_FLAG := FALSE;
2507
2508 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2509
2510 -- Get message count and data
2511
2512 OE_MSG_PUB.Count_And_Get
2513 ( p_count => x_msg_count
2514 , p_data => x_msg_data
2515 );
2516
2517 WHEN OTHERS THEN
2518
2519 OE_GLOBALS.G_UI_FLAG := FALSE;
2520
2521 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2522
2523 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2524 THEN
2525 OE_MSG_PUB.Add_Exc_Msg
2526 ( G_PKG_NAME
2527 , 'Delete_Row'
2528 );
2529 END IF;
2530
2531 -- Get message count and data
2532
2533 OE_MSG_PUB.Count_And_Get
2534 ( p_count => x_msg_count
2535 , p_data => x_msg_data
2536 );
2537
2538 END Delete_Row;
2539
2540
2541
2542 -- Procedure Process_Entity
2543 --
2544
2545 PROCEDURE Process_Delayed_Requests
2546 ( x_return_status OUT NOCOPY VARCHAR2
2547
2548 , x_msg_count OUT NOCOPY NUMBER
2549
2550 , x_msg_data OUT NOCOPY VARCHAR2
2551
2552 , p_header_id IN NUMBER
2553 , p_line_id IN NUMBER
2554 )
2555 IS
2556 l_control_rec OE_GLOBALS.Control_Rec_Type;
2557 l_return_status VARCHAR2(1);
2558 l_request_rec OE_Order_Pub.Request_Rec_Type;
2559 l_request_tbl OE_Order_Pub.Request_Tbl_Type;
2560 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
2561 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
2562 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
2563 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
2564 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
2565 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
2566 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
2567 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
2568 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2569 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2570 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
2571 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
2572 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
2573 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
2574
2575 --New out parameters
2576 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2577 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2578 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2579
2580 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2581 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2582 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2583
2584 --
2585 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2586 --
2587 BEGIN
2588
2589 IF l_debug_level > 0 THEN
2590 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.PROCESS_DELAYED_REQUESTS' , 1 ) ;
2591 END IF;
2592
2593 /*
2594 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2595 (p_request_type => OE_GLOBALS.G_PRICE_ADJ
2596 ,p_delete => FND_API.G_TRUE
2597 ,x_return_status => l_return_status
2598 );
2599 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2600 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2601 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2602 RAISE FND_API.G_EXC_ERROR;
2603 END IF;
2604
2605 -- process delayed requests for tax calculation.
2606 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2607 (p_request_type => OE_GLOBALS.G_TAX_LINE
2608 ,p_delete => FND_API.G_TRUE
2609 ,x_return_status => l_return_status
2610 );
2611 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2612 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2613 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2614 RAISE FND_API.G_EXC_ERROR;
2615 END IF;
2616
2617 IF OE_Commitment_Pvt.Do_Commitment_Sequencing THEN
2618 -- process delayed requests for commitment calculation.
2619 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2620 (p_request_type => OE_GLOBALS.G_CALCULATE_COMMITMENT
2621 ,p_delete => FND_API.G_TRUE
2622 ,x_return_status => l_return_status
2623 );
2624 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2625 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2626 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2627 RAISE FND_API.G_EXC_ERROR;
2628 END IF;
2629 END IF;
2630
2631 oe_debug_pub.ADD('Processing delayed request for Verify Payment for price adjustments changes.', 3);
2632 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2633 (p_request_type => OE_GLOBALS.G_VERIFY_PAYMENT
2634 ,p_delete => FND_API.G_TRUE
2635 ,x_return_status => l_return_status
2636 );
2637
2638 */
2639 --2366123: all requests should be executed
2640 Oe_Order_Pvt.Process_Requests_And_Notify
2641 ( p_process_requests => TRUE
2642 , p_notify => TRUE
2643 , p_process_ack => TRUE
2644 , x_return_status => l_return_status
2645 );
2646 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2647 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2648 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2649 RAISE FND_API.G_EXC_ERROR;
2650 END IF;
2651
2652 --btea begin fix bug 1398294
2653 OE_MSG_PUB.Count_And_Get
2654 ( p_count => x_msg_count
2655 , p_data => x_msg_data
2656 );
2657 --btea end fix bug 1398294
2658
2659 x_return_status := FND_API.G_RET_STS_SUCCESS;
2660
2661 Return;
2662
2663 /********************************************************************
2664 -- Set the UI flag
2665 OE_GLOBALS.G_UI_FLAG := TRUE;
2666
2667 -- Set control flags.
2668
2669 l_control_rec.controlled_operation := TRUE;
2670 l_control_rec.process := TRUE;
2671 l_control_rec.process_entity := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2672
2673 l_control_rec.check_security := FALSE;
2674 l_control_rec.clear_dependents := FALSE;
2675 l_control_rec.default_attributes := FALSE;
2676 l_control_rec.change_attributes := FALSE;
2677 l_control_rec.validate_entity := FALSE;
2678 l_control_rec.write_to_DB := FALSE;
2679
2680 -- Instruct API to clear its request table
2681
2682 l_control_rec.clear_api_cache := FALSE;
2683 l_control_rec.clear_api_requests := FALSE;
2684
2685
2686 -- Assign requests that are to be executed
2687 -- l_request_rec.request_type := OE_GLOBALS.G_CHECK_PERCENTAGE;
2688 -- l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2689 -- l_request_rec.entity_id := p_line_id;
2690 -- l_request_rec.param1 := p_header_id;
2691 -- l_request_tbl(1) := l_request_rec;
2692
2693 -- l_request_rec.request_type := OE_GLOBALS.G_PRICE_ADJ;
2694 -- l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2695 -- l_request_rec.entity_id := p_line_id;
2696 -- l_request_tbl(2) := l_request_rec;
2697
2698
2699 -- Call OE_Order_PVT.Process_order
2700
2701 OE_Order_PVT.Process_order
2702 ( p_api_version_number => 1.0
2703 , p_init_msg_list => FND_API.G_TRUE
2704 , x_return_status => l_return_status
2705 , x_msg_count => x_msg_count
2706 , x_msg_data => x_msg_data
2707 , p_control_rec => l_control_rec
2708 , p_action_request_tbl => l_request_tbl
2709 , p_x_header_rec => l_x_header_rec
2710 , p_x_Header_Adj_tbl => l_x_Header_Adj_tbl
2711 -- New Parameters
2712 , p_x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
2713 , p_x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
2714 , p_x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
2715
2716
2717 , p_x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
2718 , p_x_line_tbl => l_x_line_tbl
2719 , p_x_Line_Adj_tbl => l_x_Line_Adj_tbl
2720 -- New Parameters
2721 , p_x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
2722 , p_x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
2723 , p_x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
2724
2725 , p_x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
2726 , p_x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
2727 , p_x_action_request_tbl => l_action_request_tbl
2728 );
2729
2730 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2731 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2732 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2733 RAISE FND_API.G_EXC_ERROR;
2734 END IF;
2735
2736
2737 -- Re-set the UI flag to FALSE
2738 OE_GLOBALS.G_UI_FLAG := FALSE;
2739
2740 -- Set return status.
2741
2742 x_return_status := FND_API.G_RET_STS_SUCCESS;
2743
2744 -- Get message count and data
2745
2746 OE_MSG_PUB.Count_And_Get
2747 ( p_count => x_msg_count
2748 , p_data => x_msg_data
2749 );
2750
2751 oe_debug_pub.add('Exiting OE_OE_FORM_LINE_ADJ.PROCESS_DELAYED_REQUESTS', 1);
2752
2753 ****************************************************************/
2754
2755 EXCEPTION
2756
2757 WHEN FND_API.G_EXC_ERROR THEN
2758
2759 OE_GLOBALS.G_UI_FLAG := FALSE;
2760
2761 x_return_status := FND_API.G_RET_STS_ERROR;
2762
2763 -- Get message count and data
2764
2765 OE_MSG_PUB.Count_And_Get
2766 ( p_count => x_msg_count
2767 , p_data => x_msg_data
2768 );
2769
2770 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2771
2772 OE_GLOBALS.G_UI_FLAG := FALSE;
2773
2774 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2775
2776 -- Get message count and data
2777
2778 OE_MSG_PUB.Count_And_Get
2779 ( p_count => x_msg_count
2780 , p_data => x_msg_data
2781 );
2782
2783 WHEN OTHERS THEN
2784
2785 OE_GLOBALS.G_UI_FLAG := FALSE;
2786
2787 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2788
2789 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2790 THEN
2791 OE_MSG_PUB.Add_Exc_Msg
2792 ( G_PKG_NAME
2793 , 'Process_Entity'
2794 );
2795 END IF;
2796
2797 -- Get message count and data
2798
2799 OE_MSG_PUB.Count_And_Get
2800 ( p_count => x_msg_count
2801 , p_data => x_msg_data
2802 );
2803
2804 END Process_Delayed_Requests;
2805
2806
2807 PROCEDURE replace_attributes
2808 (x_return_status OUT NOCOPY VARCHAR2,
2809
2810 x_msg_count OUT NOCOPY NUMBER,
2811
2812 x_msg_data OUT NOCOPY VARCHAR2,
2813
2814 p_price_adjustment_id IN NUMBER,
2815 p_adjusted_amount IN NUMBER,
2816 p_adjusted_amount_per_pqty IN NUMBER DEFAULT NULL,
2817 p_arithmetic_operator IN VARCHAR2,
2818 p_operand IN NUMBER,
2819 p_operand_per_pqty IN NUMBER DEFAULT NULL,
2820 p_applied_flag IN VARCHAR2,
2821 p_updated_flag IN VARCHAR2,
2822 p_change_reason_code IN Varchar2 :=NULL,
2823 p_change_reason_text IN VARCHAR2 :=NULL
2824 )
2825 IS
2826 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2827 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2828 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2829 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2830 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2831 l_Line_Adj_val_rec OE_Order_PUB.Line_Adj_Val_Rec_Type;
2832 l_control_rec OE_GLOBALS.Control_Rec_Type;
2833 l_return_status VARCHAR2(1);
2834 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
2835 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
2836 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
2837 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
2838 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
2839 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2840 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
2841 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
2842 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
2843
2844
2845 --New out parameters
2846 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2847 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2848 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2849
2850 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2851 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2852 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2853
2854 l_line_rec Oe_Order_Pub.line_rec_type;
2855 --
2856 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2857 --
2858 BEGIN
2859
2860 IF l_debug_level > 0 THEN
2861 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.REPLACE_ATTRIBUTES' , 1 ) ;
2862 END IF;
2863
2864 -- Set the UI flag
2865 OE_GLOBALS.G_UI_FLAG := TRUE;
2866
2867 -- Set control flags.
2868 l_control_rec.controlled_operation := TRUE;
2869 l_control_rec.clear_dependents := FALSE;
2870 l_control_rec.change_attributes := TRUE;
2871 l_control_rec.default_attributes := TRUE;
2872 l_control_rec.validate_entity := FALSE;
2873 l_control_rec.write_to_DB := TRUE;
2874 l_control_rec.process := FALSE;
2875
2876
2877 -- Instruct API to retain its caches
2878 l_control_rec.clear_api_cache := FALSE;
2879 l_control_rec.clear_api_requests := FALSE;
2880
2881
2882 -- Save point to rollback to if there were
2883 -- any errors
2884 SAVEPOINT replace_attributes;
2885
2886 Get_Line_Adj
2887 ( p_db_record => FALSE
2888 , p_price_adjustment_id => p_price_adjustment_id
2889 , x_Line_Adj_rec => l_x_Line_Adj_rec
2890 );
2891 -- included to fix bug 1717501 begin
2892 l_x_old_Line_Adj_rec := l_x_Line_Adj_rec;
2893 -- included to fix bug 1717501 end
2894
2895 l_x_line_adj_rec.price_adjustment_id := p_price_adjustment_id;
2896 l_x_line_adj_rec.adjusted_amount := p_adjusted_amount;
2897
2898
2899 /* Bug 1944975 - dual UOMs
2900 We pass the per_pqty values also
2901 */
2902 IF (p_adjusted_amount_per_pqty is NOT NULL) Then
2903 IF l_debug_level > 0 THEN
2904 oe_debug_pub.add( 'NOT NULL ADJPQTY ' || P_ADJUSTED_AMOUNT_PER_PQTY ) ;
2905 END IF;
2906 l_x_line_adj_rec.adjusted_amount_per_pqty := p_adjusted_amount_per_pqty;
2907 END IF;
2908
2909 IF (p_operand_per_pqty is NOT NULL) Then
2910 IF l_debug_level > 0 THEN
2911 oe_debug_pub.add( 'NOT NULL OPQTY ' || P_OPERAND_PER_PQTY ) ;
2912 END IF;
2913 l_x_line_adj_rec.operand_per_pqty := p_operand_per_pqty;
2914 ELSE
2915 --IF (p_operand_per_pqty IS NULL) THEN
2916 If l_x_line_adj_rec.line_id is not Null
2917 and l_x_line_adj_rec.list_line_type_code <> 'LUMPSUM'
2918 Then
2919 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
2920 x_line_rec=>l_line_rec);
2921
2922 If nvl(l_line_rec.pricing_quantity,0) <> 0 Then
2923 l_x_line_adj_rec.adjusted_amount_per_pqty := (p_adjusted_amount * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
2924 End If;
2925 End If;
2926 --End If;
2927 END IF; -- if p_operand_per_pqty is NOT NULL
2928
2929
2930 If l_x_line_adj_rec.adjusted_amount_per_pqty is Null Then
2931 l_x_line_adj_rec.adjusted_amount_per_pqty := p_adjusted_amount;
2932 END IF;
2933
2934 l_x_line_adj_rec.arithmetic_operator := p_arithmetic_operator;
2935 l_x_line_adj_rec.operand := p_operand;
2936
2937 IF (p_operand_per_pqty IS NULL) THEN
2938 If l_x_line_adj_rec.line_id is not Null
2939 and l_x_line_adj_rec.list_line_type_code <> 'LUMPSUM'
2940 Then
2941 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
2942 x_line_rec=>l_line_rec);
2943
2944 If nvl(l_line_rec.pricing_quantity,0) <> 0 Then
2945 l_x_line_adj_rec.operand_per_pqty := (p_operand * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
2946 End If;
2947 End If;
2948 End If;
2949
2950 IF l_x_line_adj_rec.operand_per_pqty is Null THEN
2951 l_x_line_adj_rec.operand_per_pqty := p_operand;
2952 END IF;
2953
2954 l_x_line_adj_rec.applied_flag := p_applied_flag;
2955 l_x_line_adj_rec.updated_flag := p_updated_flag;
2956
2957 If p_change_reason_code Is Not Null Then
2958 l_x_line_adj_rec.change_reason_code := p_change_reason_code;
2959 End If;
2960
2961 If p_change_reason_text Is Not Null Then
2962 l_x_line_adj_rec.change_reason_text := p_change_reason_text;
2963 End If;
2964
2965 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
2966
2967 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
2968 -- commented to fix bug 1717501 Begin
2969 -- l_x_old_Line_Adj_rec := l_x_Line_Adj_rec;
2970 -- commented to fix bug 1717501 end
2971 l_x_old_line_adj_rec.operand := null;
2972 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
2973
2974 IF l_debug_level > 0 THEN
2975 oe_debug_pub.add( 'BEFORE EXECUTING PROCESS_ORDER...' , 1 ) ;
2976 END IF;
2977
2978 -- Call Oe_Order_Adj_Pvt.Line_Adj
2979 oe_order_adj_pvt.Line_Adjs
2980 ( p_init_msg_list => FND_API.G_TRUE
2981 , p_validation_level => FND_API.G_VALID_LEVEL_NONE
2982 , p_control_rec => l_control_rec
2983 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
2984 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
2985 );
2986
2987
2988
2989 -- Load OUT parameters.
2990 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
2991
2992 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2993 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2994 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
2995 RAISE FND_API.G_EXC_ERROR;
2996 END IF;
2997
2998 IF l_debug_level > 0 THEN
2999 oe_debug_pub.add( 'AFTER EXECUTING PROCESS_ORDER...' , 1 ) ;
3000 END IF;
3001
3002 -- Write to cache.
3003 Write_Line_Adj
3004 ( p_Line_Adj_rec => l_x_line_adj_tbl(1),
3005 p_db_record => TRUE
3006 );
3007
3008 -- Re-set the UI flag to FALSE
3009 OE_GLOBALS.G_UI_FLAG := FALSE;
3010
3011 -- Set return status.
3012
3013 x_return_status := FND_API.G_RET_STS_SUCCESS;
3014
3015 -- Get message count and data
3016
3017 OE_MSG_PUB.Count_And_Get
3018 ( p_count => x_msg_count
3019 , p_data => x_msg_data
3020 );
3021
3022 IF l_debug_level > 0 THEN
3023 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.REPLACE_ATTRIBUTES' , 1 ) ;
3024 END IF;
3025
3026 EXCEPTION
3027
3028 WHEN FND_API.G_EXC_ERROR THEN
3029
3030 OE_GLOBALS.G_UI_FLAG := FALSE;
3031
3032 x_return_status := FND_API.G_RET_STS_ERROR;
3033
3034 -- Get message count and data
3035
3036 OE_MSG_PUB.Count_And_Get
3037 ( p_count => x_msg_count
3038 , p_data => x_msg_data
3039 );
3040
3041 ROLLBACK TO SAVEPOINT replace_attributes;
3042
3043 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3044
3045 OE_GLOBALS.G_UI_FLAG := FALSE;
3046
3047 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3048
3049 -- Get message count and data
3050
3051 OE_MSG_PUB.Count_And_Get
3052 ( p_count => x_msg_count
3053 , p_data => x_msg_data
3054 );
3055
3056 ROLLBACK TO SAVEPOINT replace_attributes;
3057
3058 WHEN OTHERS THEN
3059
3060 OE_GLOBALS.G_UI_FLAG := FALSE;
3061
3062 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3063
3064 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3065 THEN
3066 OE_MSG_PUB.Add_Exc_Msg
3067 ( G_PKG_NAME
3068 , 'Replace_Attributes'
3069 );
3070 END IF;
3071
3072 -- Get message count and data
3073
3074 OE_MSG_PUB.Count_And_Get
3075 ( p_count => x_msg_count
3076 , p_data => x_msg_data
3077 );
3078
3079 ROLLBACK TO SAVEPOINT replace_attributes;
3080
3081 END replace_attributes;
3082
3083
3084
3085 -- Procedure lock_Row
3086 --
3087
3088 PROCEDURE Lock_Row
3089 ( x_return_status OUT NOCOPY VARCHAR2
3090
3091 , x_msg_count OUT NOCOPY NUMBER
3092
3093 , x_msg_data OUT NOCOPY VARCHAR2
3094
3095 , p_price_adjustment_id IN NUMBER
3096 , p_lock_control IN NUMBER
3097 )
3098 IS
3099 l_return_status VARCHAR2(1);
3100 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
3101 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
3102 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
3103 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
3104
3105 --
3106 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3107 --
3108 BEGIN
3109
3110 IF l_debug_level > 0 THEN
3111 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.LOCK_ROW' , 1 ) ;
3112 END IF;
3113
3114 -- Load Line_Adj record
3115
3116 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_LOCK;
3117 l_x_Line_Adj_rec.lock_control := p_lock_control;
3118 l_x_Line_Adj_rec.price_adjustment_id := p_price_adjustment_id;
3119
3120 OE_Line_Adj_Util.Lock_Row
3121 ( x_return_status => l_return_status
3122 , p_x_line_adj_rec => l_x_line_adj_rec
3123 );
3124
3125 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3126
3127 -- Set DB flag and write record to cache.
3128 l_x_Line_Adj_rec.db_flag := FND_API.G_TRUE;
3129
3130 Write_Line_Adj
3131 ( p_Line_Adj_rec => l_x_Line_Adj_rec
3132 , p_db_record => TRUE
3133 );
3134
3135 END IF;
3136
3137 -- Set return status.
3138
3139 x_return_status := l_return_status;
3140
3141 -- Get message count and data
3142
3143 OE_MSG_PUB.Count_And_Get
3144 ( p_count => x_msg_count
3145 , p_data => x_msg_data
3146 );
3147
3148 IF l_debug_level > 0 THEN
3149 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.LOCK_ROW' , 1 ) ;
3150 END IF;
3151
3152 EXCEPTION
3153
3154 WHEN OTHERS THEN
3155
3156 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3157 THEN
3158 OE_MSG_PUB.Add_Exc_Msg
3159 ( G_PKG_NAME
3160 , 'Lock_Row'
3161 );
3162 END IF;
3163
3164 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3165
3166 -- Get message count and data
3167
3168 OE_MSG_PUB.Count_And_Get
3169 ( p_count => x_msg_count
3170 , p_data => x_msg_data
3171 );
3172
3173
3174
3175 END Lock_Row;
3176
3177
3178
3179 -- Procedures maintaining Header_Adj record cache.
3180
3181 PROCEDURE Write_Line_Adj
3182 ( p_Line_Adj_rec IN OE_Order_PUB.Line_Adj_Rec_Type
3183 , p_db_record IN BOOLEAN := FALSE
3184 )
3185 IS
3186 --
3187 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3188 --
3189 BEGIN
3190
3191 IF l_debug_level > 0 THEN
3192 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.WRITE_LINE_ADJ' , 1 ) ;
3193 END IF;
3194
3195 g_Line_Adj_rec := p_Line_Adj_rec;
3196
3197 IF p_db_record THEN
3198
3199 g_db_Line_Adj_rec := p_Line_Adj_rec;
3200
3201 END IF;
3202
3203 IF l_debug_level > 0 THEN
3204 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.WRITE_LINE_ADJ' , 1 ) ;
3205 END IF;
3206
3207 END Write_Line_Adj;
3208
3209
3210 PROCEDURE Get_Line_Adj
3211 ( p_db_record IN BOOLEAN := FALSE
3212 , p_price_adjustment_id IN NUMBER
3213 , x_Line_Adj_rec IN OUT NOCOPY OE_Order_PUB.Line_Adj_Rec_Type
3214 )
3215 IS
3216 --
3217 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3218 --
3219 BEGIN
3220
3221 IF l_debug_level > 0 THEN
3222 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.GET_LINE_ADJ' , 1 ) ;
3223 END IF;
3224
3225 IF p_price_adjustment_id <> g_Line_Adj_rec.price_adjustment_id
3226 THEN
3227
3228 -- Query row from DB
3229
3230 OE_Line_Adj_Util.Query_Row
3231 ( p_price_adjustment_id => p_price_adjustment_id
3232 , x_Line_Adj_rec => g_Line_Adj_rec
3233 );
3234
3235 g_Line_Adj_rec.db_flag := FND_API.G_TRUE;
3236
3237 -- Load DB record
3238
3239 g_db_Line_Adj_rec := g_Line_Adj_rec;
3240
3241 END IF;
3242
3243 IF l_debug_level > 0 THEN
3244 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.GET_LINE_ADJ' , 1 ) ;
3245 END IF;
3246
3247 IF p_db_record THEN
3248
3249 -- RETURN g_db_Line_Adj_rec;
3250 x_Line_Adj_rec := g_db_Line_Adj_rec;
3251
3252 ELSE
3253
3254 -- RETURN g_Line_Adj_rec;
3255 x_Line_Adj_rec := g_Line_Adj_rec;
3256
3257 END IF;
3258
3259 END Get_Line_Adj;
3260
3261
3262 PROCEDURE Clear_Line_Adj
3263 IS
3264 --
3265 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3266 --
3267 BEGIN
3268
3269 IF l_debug_level > 0 THEN
3270 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.CLEAR_LINE_ADJ' , 1 ) ;
3271 END IF;
3272
3273 g_Line_Adj_rec := OE_Order_PUB.G_MISS_LINE_ADJ_REC;
3274 g_db_Line_Adj_rec := OE_Order_PUB.G_MISS_LINE_ADJ_REC;
3275
3276 IF l_debug_level > 0 THEN
3277 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.CLEAR_LINE_ADJ' , 1 ) ;
3278 END IF;
3279
3280 END Clear_Line_Adj;
3281
3282 --Manual Begin
3283 Procedure Insert_Row(p_line_adj_rec In Oe_Order_Pub.line_adj_rec_type
3284 ,x_return_status OUT NOCOPY VARCHAR2
3285
3286 ,x_msg_count OUT NOCOPY NUMBER
3287
3288 ,x_msg_data OUT NOCOPY VARCHAR2
3289
3290 ,x_price_adjustment_id OUT NOCOPY NUMBER) Is
3291
3292 l_Control_Rec OE_GLOBALS.Control_Rec_Type;
3293 l_line_adj_tbl Oe_Order_Pub.line_adj_tbl_type;
3294 l_line_rec Oe_Order_Pub.line_rec_type;
3295 l_dummy_tbl Oe_Order_Pub.line_adj_tbl_type;
3296 --
3297 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3298 --
3299 Begin
3300 l_line_adj_tbl(1) := p_line_adj_rec;
3301 l_control_rec.private_call := TRUE;
3302 l_control_rec.controlled_operation :=TRUE;
3303 l_control_rec.check_security := TRUE;
3304 l_control_rec.validate_entity := FALSE;
3305 l_control_rec.write_to_db := TRUE;
3306 --l_control_rec.change_attributes := FALSE;
3307 l_control_rec.change_attributes := TRUE;
3308
3309 -- lagrawal Bug 3673050
3310 OE_GLOBALS.G_UI_FLAG := TRUE;
3311
3312 If l_line_adj_tbl(1).operand_per_pqty is NULL Then
3313 If l_line_adj_tbl(1).line_id is not Null
3314 and l_line_adj_tbl(1).list_line_type_code Not In ('%','LUMPSUM')
3315 Then
3316 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_line_adj_tbl(1).line_id,
3317 x_line_rec=>l_line_rec);
3318
3319 If nvl(l_line_rec.pricing_quantity,0) <> 0 Then
3320 l_line_adj_tbl(1).operand_per_pqty := (l_line_adj_tbl(1).operand * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
3321 End If;
3322 End If;
3323
3324 If l_line_adj_tbl(1).operand_per_pqty is Null Then
3325 --still null after above deriviation
3326 l_line_adj_tbl(1).operand_per_pqty:=l_line_adj_tbl(1).operand;
3327 End If;
3328
3329 End If;
3330
3331 If l_line_adj_tbl(1).adjusted_amount_per_pqty is NULL Then
3332
3333 If l_line_rec.line_id Is Null and l_line_adj_tbl(1).line_id is not null Then
3334 --get line only if this line_rec does not exists
3335 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_line_adj_tbl(1).line_id,
3336 x_line_rec=>l_line_rec);
3337 End If;
3338
3339 If nvl(l_line_rec.pricing_quantity,0) <> 0
3340 and l_line_adj_tbl(1).list_line_type_code <> 'LUMPSUM' Then
3341 l_line_adj_tbl(1).adjusted_amount_per_pqty := (l_line_adj_tbl(1).adjusted_amount * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
3342 End If;
3343
3344 If l_line_adj_tbl(1).adjusted_amount_per_pqty is Null Then
3345 l_line_adj_tbl(1).adjusted_amount_per_pqty:=l_line_adj_tbl(1).adjusted_amount;
3346 End If;
3347 End If;
3348
3349 l_line_adj_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
3350
3351
3352 IF l_line_adj_tbl(1).range_break_quantity IS NULL
3353 AND l_line_adj_tbl(1).list_line_type_code = 'PBH'
3354 AND nvl(l_Line_Adj_Tbl(1).list_line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM
3355 THEN
3356
3357 IF l_line_adj_tbl(1).UPDATED_FLAG IS NULL THEN
3358 l_line_adj_tbl(1).UPDATED_FLAG := 'Y';
3359 END IF;
3360
3361 BEGIN
3362 SELECT line_quantity
3363 INTO l_Line_Adj_tbl(1).range_break_quantity
3364 FROM qp_preq_ldets_tmp
3365 WHERE created_from_list_line_id = l_Line_Adj_tbl(1).list_line_id
3366 AND pricing_status_code = 'N'
3367 AND rownum = 1;
3368
3369 EXCEPTION WHEN OTHERS THEN
3370 -- lagrawal bug 3673050
3371 OE_GLOBALS.G_UI_FLAG := FALSE;
3372 IF l_debug_level > 0 THEN
3373 oe_debug_pub.add( ' IN OE_OE_FORM_LINE_ADJ.INSER_ROW:'||SQLERRM ) ;
3374 END IF;
3375 END;
3376 END IF;
3377
3378 IF l_debug_level > 0 THEN
3379 oe_debug_pub.add(' FLADB:l_line_adj_tbl(1).automatic_flag:'||l_line_adj_tbl(1).automatic_flag);
3380 oe_debug_pub.add(' FLADB:l_line_adj_tbl(1).updated_flag IS:'||l_line_adj_tbl(1).updated_flag);
3381 END IF;
3382
3383 IF l_line_adj_tbl(1).applied_flag = 'Y'
3384 AND l_line_adj_tbl(1).updated_flag IS NULL THEN
3385 l_line_adj_tbl(1).updated_flag := 'Y';
3386 END IF;
3387
3388 IF l_line_adj_tbl(1).automatic_flag IS NULL THEN
3389 l_line_adj_tbl(1).automatic_flag:='N';
3390 END IF;
3391
3392 SELECT OE_PRICE_ADJUSTMENTS_S.NEXTVAL
3393 INTO l_line_adj_tbl(1).price_adjustment_id
3394 FROM Dual;
3395
3396
3397 Oe_Order_Adj_Pvt.Line_Adjs(p_validation_level => FND_API.G_VALID_LEVEL_NONE,
3398 p_control_rec => l_control_rec,
3399 p_x_line_adj_tbl => l_line_adj_tbl,
3400 p_x_old_line_adj_tbl => l_dummy_tbl);
3401 x_price_adjustment_id := l_line_adj_tbl(1).price_adjustment_id;
3402
3403 -- lagrawal bug 3673050
3404 OE_GLOBALS.G_UI_FLAG := FALSE;
3405 Exception
3406 WHEN OTHERS THEN
3407
3408 OE_GLOBALS.G_UI_FLAG := FALSE;
3409
3410 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3411
3412 OE_MSG_PUB.Add_Exc_Msg
3413 ( G_PKG_NAME
3414 , 'Oe_Oe_Form_Line_Adj.Insert_Row:'||SQLERRM
3415 );
3416 IF l_debug_level > 0 THEN
3417 oe_debug_pub.add( 'OE_OE_FORM_LINE_ADJ.INSERT_ROW:'||SQLERRM ) ;
3418 END IF;
3419 -- Get message count and data
3420
3421 OE_MSG_PUB.Count_And_Get
3422 ( p_count => x_msg_count
3423 , p_data => x_msg_data
3424 );
3425
3426 --ROLLBACK TO SAVEPOINT
3427
3428 End;
3429 --Manual End;
3430
3431
3432 --This procedure returns related line ids given a top_model_line_Id.
3433 --If p_mode is set to 'OPTION' it will return options for this top_model_line
3434 --If p_mode is set to 'SERVICE' it will return service lines for options line of a top_model_line
3435 Procedure Get_Option_Service_Lines(p_top_model_line_id In Number,
3436 p_service_line_id In Number Default null,
3437 p_mode In VARCHAR2 Default 'SERVICE',
3438 x_line_id_tbl out nocopy Oe_Order_Adj_Pvt.Index_Tbl_Type) Is
3439
3440 Cursor service_cur is
3441 Select b.line_id
3442 From oe_order_lines_all a,
3443 oe_order_lines_all b,
3444 oe_order_lines_all c
3445 Where a.top_model_line_id = p_top_model_line_id
3446 and a.line_id <> p_top_model_line_id
3447 and a.line_id = b.service_reference_line_id
3448 and c.line_id = p_service_line_id
3449 and c.inventory_item_id = b.inventory_item_id
3450 and nvl(c.service_start_date,SYSDATE) = nvl(b.service_start_date,SYSDATE)
3451 and nvl(c.service_end_date,SYSDATE) = nvl(b.service_end_date,SYSDATE)
3452 and nvl(c.service_duration,0) = nvl(b.service_duration,0);
3453
3454
3455
3456 Cursor option_cur is
3457 Select line_id
3458 From oe_order_lines_all
3459 Where top_model_line_id = p_top_model_line_id
3460 and line_id <> p_top_model_line_id;
3461
3462 j PLS_INTEGER := 1;
3463
3464 --
3465 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3466 --
3467 Begin
3468 IF l_debug_level > 0 THEN
3469 oe_debug_pub.add( ' P_MODE:'||P_MODE ) ;
3470 END IF;
3471 IF l_debug_level > 0 THEN
3472 oe_debug_pub.add( ' P_TOP_MODEL_LINE_ID:'||P_TOP_MODEL_LINE_ID ) ;
3473 END IF;
3474 IF l_debug_level > 0 THEN
3475 oe_debug_pub.add( ' P_SERVICE_LINE_ID:'||P_SERVICE_LINE_ID ) ;
3476 END IF;
3477
3478 If p_mode = 'SERVICE' Then
3479 For i in service_cur Loop
3480 x_line_id_tbl(j):= i.line_id;
3481 IF l_debug_level > 0 THEN
3482 oe_debug_pub.add( ' SERVICE CHILD LINES ID:'||I.LINE_ID ) ;
3483 END IF;
3484 j:=j+1;
3485 End Loop;
3486 Elsif p_mode = 'OPTION' Then
3487 For i in option_cur Loop
3488 IF l_debug_level > 0 THEN
3489 oe_debug_pub.add( ' LINE ID:'||I.LINE_ID ) ;
3490 END IF;
3491 x_line_id_tbl(j):= i.line_id;
3492 j:=j+1;
3493 End Loop;
3494 IF l_debug_level > 0 THEN
3495 oe_debug_pub.add( ' X_LINE_ID_TBL.COUNT:'|| X_LINE_ID_TBL.COUNT ) ;
3496 END IF;
3497 End If;
3498 Exception When Others Then
3499 IF l_debug_level > 0 THEN
3500 oe_debug_pub.add( ' EXECPTION IN OE_OE_FORM_LINE_ADJ:'||SQLERRM ) ;
3501 END IF;
3502 End;
3503
3504 --This Procedure will either change,create or delete adjustments
3505 --based on parent adjustment record
3506 Procedure Process_Adj(p_parent_adj_rec In Oe_Order_Pub.Line_Adj_Rec_Type,
3507 p_line_id_tbl In Oe_Order_Adj_Pvt.Index_Tbl_Type,
3508 p_delete_flag In Varchar2 Default 'N' ,
3509 p_create_adj_no_validate In Boolean Default FALSE) Is
3510
3511 Cursor adjustment_cur(p_list_line_id Number ,p_line_id Number) Is
3512 Select price_adjustment_id,operand,change_reason_code
3513 From oe_price_adjustments
3514 Where line_id = p_line_id
3515 and list_line_id = p_list_line_id;
3516
3517 i PLS_INTEGER;
3518 l_price_adjustment_id Number;
3519 l_operand Number;
3520 l_line_adj_rec Oe_Order_Pub.line_adj_rec_type;
3521 l_return_status VARCHAR2(5);
3522 l_msg_count Number;
3523 l_msg_data VARCHAR2(500);
3524 lx_price_adjustment_id Number;
3525 l_reason_code Varchar2(30);
3526 stmt Number;
3527 --
3528 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3529 --
3530 Begin
3531
3532 If nvl(p_parent_adj_rec.operand,FND_API.G_MISS_NUM) = FND_API.G_MISS_NUM Then
3533 IF l_debug_level > 0 THEN
3534 oe_debug_pub.add( ' CS PARENT OPERAND IS NULL' ) ;
3535 END IF;
3536 Return;
3537 End If;
3538
3539 i := p_line_id_tbl.First;
3540 While i is Not Null Loop
3541 stmt:=1;
3542 l_price_adjustment_id := Null;
3543 Open adjustment_cur(p_parent_adj_rec.list_line_id,p_line_id_tbl(i));
3544 Fetch adjustment_cur into l_price_adjustment_id,l_operand,l_reason_code;
3545
3546 IF l_debug_level > 0 THEN
3547 oe_debug_pub.add( ' CS PRICE ADJUSTMENT ID:'||L_PRICE_ADJUSTMENT_ID ) ;
3548 END IF;
3549 IF l_debug_level > 0 THEN
3550 oe_debug_pub.add( ' CS L_OPERAND:'||L_OPERAND ) ;
3551 END IF;
3552 IF l_debug_level > 0 THEN
3553 oe_debug_pub.add( ' CS PARENT OPERAND:'||P_PARENT_ADJ_REC.OPERAND ) ;
3554 END IF;
3555 IF l_debug_level > 0 THEN
3556 oe_debug_pub.add( ' CS SERVICE OPTION LINE ID:'|| P_LINE_ID_TBL ( I ) ) ;
3557 END IF;
3558 IF l_debug_level > 0 THEN
3559 oe_debug_pub.add( ' CS PARENT LIST_LINE_ID:'||P_PARENT_ADJ_REC.LIST_LINE_ID ) ;
3560 END IF;
3561 IF l_debug_level > 0 THEN
3562 oe_debug_pub.add( ' CS PARENT CHANGE REASON CODE:'||P_PARENT_ADJ_REC.CHANGE_REASON_CODE ) ;
3563 END IF;
3564 If p_delete_flag = 'N' Then
3565 If l_price_adjustment_id is Not Null Then
3566 --Update required, a same adjustment exists
3567 If l_operand <> p_parent_adj_rec.operand or
3568 nvl(l_reason_code,'NULLreasonCode+') <> p_parent_adj_rec.change_reason_code Then
3569
3570 If p_parent_adj_rec.change_reason_code is Null Then
3571 l_reason_code:='MISC';
3572 Else
3573 l_reason_code:=p_parent_adj_rec.change_reason_code;
3574 End If;
3575 stmt:=2;
3576 Replace_Attributes(x_return_status => l_return_status,
3577 x_msg_count => l_msg_count,
3578 x_msg_data => l_msg_data,
3579 p_price_adjustment_id => l_price_adjustment_id,
3580 p_adjusted_amount => p_parent_adj_rec.adjusted_amount,
3581 p_adjusted_amount_per_pqty =>p_parent_adj_rec.adjusted_amount_per_pqty,
3582 p_arithmetic_operator => p_parent_adj_rec.arithmetic_operator,
3583 p_operand => p_parent_adj_rec.operand,
3584 p_operand_per_pqty => p_parent_adj_rec.operand_per_pqty,
3585 p_applied_flag => 'Y',
3586 p_updated_flag => 'Y',
3587 p_change_reason_code => l_reason_code,
3588 p_change_reason_text => 'Top model line adjustments has been changed');
3589 End If;
3590 Else
3591 If p_create_adj_no_validate Then --just create adjustment without revalidation against engine
3592 --Create requiredx
3593 IF l_debug_level > 0 THEN
3594 oe_debug_pub.add( ' CS INSERTING NEW CHILDREN' ) ;
3595 END IF;
3596 l_line_adj_Rec := p_parent_adj_rec;
3597 l_line_adj_rec.line_id := p_line_id_tbl(i);
3598 stmt:=3;
3599 Insert_Row(l_line_adj_Rec,l_return_status,l_msg_count,l_msg_data,lx_price_adjustment_id);
3600 /* 1905650
3601 G_PRICE_ADJ request should be logged against LINE entity, not
3602 against LINE_ADJ entity
3603 */
3604 oe_delayed_requests_pvt.log_request(
3605 p_entity_code => OE_GLOBALS.G_ENTITY_LINE,
3606 p_entity_id => p_line_id_tbl(i),
3607 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE_ADJ,
3608 p_requesting_entity_id => p_line_id_tbl(i),
3609 p_request_type => OE_GLOBALS.G_PRICE_ADJ,
3610 x_return_status => l_return_status);
3611 End If; --end if for create_adj_no_validate
3612 End If;
3613 Elsif p_delete_flag = 'Y' Then
3614 If l_price_adjustment_id is not Null Then
3615 stmt:=4;
3616 OE_Header_Adj_Util.Delete_Row
3617 ( p_price_adjustment_id => l_price_adjustment_id
3618 );
3619
3620 /* 1905650
3621 G_PRICE_ADJ request should be logged against LINE entity,
3622 not against LINE_ADJ entity
3623 */
3624 oe_delayed_requests_pvt.log_request(
3625 p_entity_code => OE_GLOBALS.G_ENTITY_LINE,
3626 p_entity_id => p_line_id_tbl(i),
3627 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE_ADJ,
3628 p_requesting_entity_id => p_line_id_tbl(i),
3629 p_request_type => OE_GLOBALS.G_PRICE_ADJ,
3630 x_return_status => l_return_status);
3631
3632 End If;
3633 End If;
3634
3635
3636
3637
3638
3639 Close adjustment_cur;
3640 i:=p_line_id_tbl.next(i);
3641 End Loop;
3642
3643 Exception When Others Then
3644 IF l_debug_level > 0 THEN
3645 oe_debug_pub.add( 'IN OE_OE_FORM_LINE_ADJ.PROCESS_ADJ:'||SQLERRM||':'||STMT ) ;
3646 END IF;
3647 End;
3648
3649
3650 END OE_OE_Form_Line_Adj;