[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.5 2011/09/27 09:58:22 nilegupt ship $ */
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_pricing_group_sequence THEN --bug 12895497
920 l_x_Line_Adj_rec.pricing_group_sequence := p_attr_value1; --bug 12895497
921 ELSIF p_attr_id = OE_Line_Adj_Util.G_ARITHMETIC_OPERATOR then
922 l_x_Line_Adj_rec.arithmetic_operator := p_attr_value1 ;
923
924 ELSIF p_attr_id = OE_Line_Adj_Util.G_ADJUSTED_AMOUNT then
925 l_x_Line_Adj_rec.adjusted_amount := p_attr_value1 ;
926 ELSIF p_attr_id = OE_Line_Adj_Util.G_PRICING_PHASE_ID then
927 l_x_Line_Adj_rec.pricing_phase_id := p_attr_value1 ;
928 ELSIF p_attr_id = OE_Line_Adj_Util.G_LIST_LINE_NO then
929 l_x_Line_Adj_rec.list_line_no := p_attr_value1 ;
930 ELSIF p_attr_id = OE_Line_Adj_Util.G_SOURCE_SYSTEM_CODE then
931 l_x_Line_Adj_rec.source_system_code := p_attr_value1;
932 ELSIF p_attr_id = OE_Line_Adj_Util.G_BENEFIT_QTY then
933 l_x_Line_Adj_rec.benefit_qty := TO_NUMBER(p_attr_value1);
934 ELSIF p_attr_id = OE_Line_Adj_Util.G_BENEFIT_UOM_CODE then
935 l_x_Line_Adj_rec.benefit_uom_code := p_attr_value1;
936 ELSIF p_attr_id = OE_Line_Adj_Util.G_PRINT_ON_INVOICE_FLAG then
937 l_x_Line_Adj_rec.print_on_invoice_flag := p_attr_value1;
938 ELSIF p_attr_id = OE_Line_Adj_Util.G_EXPIRATION_DATE then
939 -- l_x_Line_Adj_rec.expiration_date := TO_DATE(p_attr_value1, l_date_format);
940 l_x_Line_Adj_rec.expiration_date := fnd_date.string_TO_DATE(p_attr_value1, l_date_format); --bug5402396
941 ELSIF p_attr_id = OE_Line_Adj_Util.G_REBATE_TRANSACTION_TYPE_CODE then
942 l_x_Line_Adj_rec.rebate_transaction_type_code := p_attr_value1;
943 ELSIF p_attr_id = OE_Line_Adj_Util.G_REBATE_TRANSACTION_REFERENCE then
944 l_x_Line_Adj_rec.rebate_transaction_reference := p_attr_value1;
945 ELSIF p_attr_id = OE_Line_Adj_Util.G_REBATE_PAYMENT_SYSTEM_CODE then
946 l_x_Line_Adj_rec.rebate_payment_system_code := p_attr_value1;
947 ELSIF p_attr_id = OE_Line_Adj_Util.G_REDEEMED_DATE then
948 -- l_x_Line_Adj_rec.redeemed_date := TO_DATE(p_attr_value1, l_date_format);
949 l_x_Line_Adj_rec.redeemed_date := fnd_date.string_TO_DATE(p_attr_value1, l_date_format); --bug5402396
950 ELSIF p_attr_id = OE_Line_Adj_Util.G_REDEEMED_FLAG then
951 l_x_Line_Adj_rec.redeemed_flag := p_attr_value1;
952 ELSIF p_attr_id = OE_Line_Adj_Util.G_ACCRUAL_FLAG then
953 l_x_Line_Adj_rec.accrual_flag := p_attr_value1;
954 ELSIF p_attr_id = OE_Line_Adj_Util.G_AUTOMATIC THEN
955 l_x_Line_Adj_rec.automatic_flag := p_attr_value1;
956 ELSIF p_attr_id = OE_Line_Adj_Util.G_PERCENT THEN
957 l_x_Line_Adj_rec.percent := TO_NUMBER(p_attr_value1);
958 --Manual Begin
959 ELSIF p_attr_id = OE_Line_Adj_Util.G_LINE THEN
960 If p_attr_value1 Is Not Null Then
961 l_x_Line_Adj_rec.line_id := TO_NUMBER(p_attr_value1);
962 Else
963 l_x_Line_Adj_rec.line_id := NULL;
964 End If;
965 --Manual End
966 ELSIF p_attr_id = OE_Line_Adj_Util.G_ESTIMATED_FLAG THEN
967 l_x_Line_Adj_rec.estimated_flag := p_attr_value1;
968 ELSIF p_attr_id = OE_Line_Adj_Util.G_INVOICED_FLAG THEN
969 l_x_Line_Adj_rec.INVOICED_FLAG := p_attr_value1;
970 ELSIF p_attr_id = OE_Line_Adj_Util.G_CHARGE_TYPE_CODE THEN
971 l_x_Line_Adj_rec.CHARGE_TYPE_CODE := p_attr_value1;
972 ELSIF p_attr_id = OE_Line_Adj_Util.G_CHARGE_SUBTYPE_CODE THEN
973 l_x_Line_Adj_rec.CHARGE_SUBTYPE_CODE := p_attr_value1;
974 ELSIF p_attr_id = OE_Line_Adj_Util.G_CREDIT_OR_CHARGE_FLAG THEN
975 l_x_Line_Adj_rec.CREDIT_OR_CHARGE_FLAG := p_attr_value1;
976 ELSIF p_attr_id = OE_Line_Adj_Util.G_INCLUDE_ON_RETURNS_FLAG THEN
977 l_x_Line_Adj_rec.INCLUDE_ON_RETURNS_FLAG := p_attr_value1;
978 --Manual Begin
979 ELSIF p_attr_id = OE_LINE_Adj_Util.G_modifier_level_code Then
980 l_x_Line_Adj_rec.modifier_level_code := p_attr_value1;
981 ELSIF p_attr_id = OE_LINE_Adj_Util.G_OVERRIDE_ALLOWED_FLAG Then
982 l_x_Line_Adj_rec.update_allowed:= p_attr_value1;
983 --Manual end
984 --uom begin
985 ELSIF p_attr_id = OE_Line_Adj_Util.G_OPERAND_PER_PQTY THEN
986 l_x_Line_Adj_rec.OPERAND_PER_PQTY := p_attr_value1;
987 ELSIF p_attr_id = OE_Line_Adj_Util.G_ADJUSTED_AMOUNT_PER_PQTY THEN
988 l_x_Line_Adj_rec.ADJUSTED_AMOUNT_PER_PQTY := p_attr_value1;
989 --uom end
990 ELSIF p_attr_id = OE_LINE_Adj_Util.G_RANGE_BREAK_QUANTITY THEN
991 l_x_Line_Adj_rec.range_break_quantity := p_attr_value1;
992 ELSIF p_attr_id = OE_Line_Adj_Util.G_CONTEXT
993 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE1
994 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE2
995 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE3
996 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE4
997 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE5
998 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE6
999 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE7
1000 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE8
1001 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE9
1002 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE10
1003 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE11
1004 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE12
1005 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE13
1006 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE14
1007 OR p_attr_id = OE_Line_Adj_Util.G_ATTRIBUTE15
1008 THEN
1009
1010 l_x_Line_Adj_rec.context := p_context;
1011 l_x_Line_Adj_rec.attribute1 := p_attribute1;
1012 l_x_Line_Adj_rec.attribute2 := p_attribute2;
1013 l_x_Line_Adj_rec.attribute3 := p_attribute3;
1014 l_x_Line_Adj_rec.attribute4 := p_attribute4;
1015 l_x_Line_Adj_rec.attribute5 := p_attribute5;
1016 l_x_Line_Adj_rec.attribute6 := p_attribute6;
1017 l_x_Line_Adj_rec.attribute7 := p_attribute7;
1018 l_x_Line_Adj_rec.attribute8 := p_attribute8;
1019 l_x_Line_Adj_rec.attribute9 := p_attribute9;
1020 l_x_Line_Adj_rec.attribute10 := p_attribute10;
1021 l_x_Line_Adj_rec.attribute11 := p_attribute11;
1022 l_x_Line_Adj_rec.attribute12 := p_attribute12;
1023 l_x_Line_Adj_rec.attribute13 := p_attribute13;
1024 l_x_Line_Adj_rec.attribute14 := p_attribute14;
1025 l_x_Line_Adj_rec.attribute15 := p_attribute15;
1026 ELSIF p_attr_id = OE_Line_Adj_Util.G_AC_CONTEXT
1027 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE1
1028 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE2
1029 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE3
1030 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE4
1031 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE5
1032 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE6
1033 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE7
1034 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE8
1035 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE9
1036 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE10
1037 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE11
1038 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE12
1039 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE13
1040 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE14
1041 OR p_attr_id = OE_Line_Adj_Util.G_AC_ATTRIBUTE15
1042 THEN
1043
1044 l_x_Line_Adj_rec.ac_context := p_ac_context;
1045 l_x_Line_Adj_rec.ac_attribute1 := p_ac_attribute1;
1046 l_x_Line_Adj_rec.ac_attribute2 := p_ac_attribute2;
1047 l_x_Line_Adj_rec.ac_attribute3 := p_ac_attribute3;
1048 l_x_Line_Adj_rec.ac_attribute4 := p_ac_attribute4;
1049 l_x_Line_Adj_rec.ac_attribute5 := p_ac_attribute5;
1050 l_x_Line_Adj_rec.ac_attribute6 := p_ac_attribute6;
1051 l_x_Line_Adj_rec.ac_attribute7 := p_ac_attribute7;
1052 l_x_Line_Adj_rec.ac_attribute8 := p_ac_attribute8;
1053 l_x_Line_Adj_rec.ac_attribute9 := p_ac_attribute9;
1054 l_x_Line_Adj_rec.ac_attribute10 := p_ac_attribute10;
1055 l_x_Line_Adj_rec.ac_attribute11 := p_ac_attribute11;
1056 l_x_Line_Adj_rec.ac_attribute12 := p_ac_attribute12;
1057 l_x_Line_Adj_rec.ac_attribute13 := p_ac_attribute13;
1058 l_x_Line_Adj_rec.ac_attribute14 := p_ac_attribute14;
1059 l_x_Line_Adj_rec.ac_attribute15 := p_ac_attribute15;
1060
1061 ELSE
1062
1063 -- Unexpected error, unrecognized attribute
1064
1065 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1066 THEN
1067 OE_MSG_PUB.Add_Exc_Msg
1068 ( G_PKG_NAME
1069 , 'Change_Attributes'
1070 , 'Unrecognized attribute'
1071 );
1072 END IF;
1073
1074 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1075
1076 END IF;
1077
1078 IF l_debug_level > 0 THEN
1079 oe_debug_pub.add( 'RL:ADJUSTED AMT = ' || L_X_LINE_ADJ_REC.ADJUSTED_AMOUNT ) ;
1080 END IF;
1081 IF l_debug_level > 0 THEN
1082 oe_debug_pub.add( 'RL:ADJ PQTY = ' || L_X_LINE_ADJ_REC.ADJUSTED_AMOUNT_PER_PQTY ) ;
1083 END IF;
1084
1085 -- Set Operation.
1086
1087 IF FND_API.To_Boolean(l_x_Line_Adj_rec.db_flag) THEN
1088 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
1089 ELSE
1090 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_CREATE;
1091 END IF;
1092
1093 --Bug 1790502
1094 --For cascading adjustments to service lines
1095 --Only applicable to Service lines reference to options of a Model line
1096 --Only applicable to % arithmetic_operator
1097
1098 /*Legend:
1099 Top model line has prefix of T
1100 Option line has prefix of O
1101 Service line has prefix of S
1102 Adjustment has prefix of A
1103 Adjustment for service lines has prefix of AS
1104
1105 T1--A1
1106 |--S1----AS2
1107 |
1108 |
1109 |--O1--A3
1110 | |-----S2----AS4
1111 |
1112 |--O2--A5
1113 |-----S3----AS6
1114
1115 Top model line T1 has adjusment A1 and Service line S1. Service line S1
1116 (service line for top model) has adjustment AS2. If you make % change
1117 on AS2, the same change will propagate the change to AS4 and AS6 which are the
1118 adjustments for option service lines S2 and S3. It will not propagate the
1119 same adjustment to A3 and A5 (because these are adjustments for Option lines
1120 not for service lines). */
1121
1122 IF l_debug_level > 0 THEN
1123 oe_debug_pub.add( ' ARITHMETIC_OPERATOR:'||L_X_LINE_ADJ_REC.ARITHMETIC_OPERATOR ) ;
1124 END IF;
1125 IF l_debug_level > 0 THEN
1126 oe_debug_pub.add( ' P_ATTR_ID:'|| P_ATTR_ID ) ;
1127 END IF;
1128 IF l_debug_level > 0 THEN
1129 oe_debug_pub.add( ' G_OPERAND_PER_PQTY:'||OE_LINE_ADJ_UTIL.G_OPERAND_PER_PQTY ) ;
1130 END IF;
1131
1132
1133 If (l_x_line_adj_rec.arithmetic_operator = '%' and
1134 p_attr_id = OE_Line_Adj_Util.G_OPERAND_PER_PQTY)
1135 or p_attr_id = OE_Line_Adj_Util.G_CHANGE_REASON_CODE
1136 Then
1137 IF l_debug_level > 0 THEN
1138 oe_debug_pub.add( ' CS BEFORE GETTING LINE' ) ;
1139 END IF;
1140 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
1141 x_line_rec=>l_line_rec);
1142 End If;
1143
1144 --Cascading adjustments for service lines
1145 IF l_debug_level > 0 THEN
1146 oe_debug_pub.add( ' CS QUERIED LINE_ID:'||L_LINE_REC.LINE_ID ) ;
1147 END IF;
1148 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
1149 l_line_rec.service_reference_line_id Is Not Null --make sure is adjustment for a service line
1150 Then
1151 --To determine if this is an adjustment for service line of a top model line
1152 Begin
1153 Select line_id
1154 Into l_top_model_line_id
1155 From Oe_Order_Lines_All
1156 Where line_id = l_line_rec.service_reference_line_id
1157 and top_model_line_id = line_id;
1158
1159 --This is a service line of a top model line, need to cascade the change to adjustments
1160 --for service lines of option items.
1161 get_option_service_lines(p_top_model_line_id=>l_top_model_line_id,
1162 p_service_line_id=>l_line_rec.line_id,
1163 x_line_id_tbl=>l_line_id_tbl);
1164
1165 --setting p_create_adj_no_validation to TRUE to maintain
1166 --behavior of bug 1790502 in which adjustment for service option line are not being validated
1167 If l_line_id_tbl.first is Not Null Then
1168 IF l_debug_level > 0 THEN
1169 oe_debug_pub.add( 'CS CREATING OR CHANGING' ) ;
1170 END IF;
1171 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
1172 p_line_id_tbl => l_line_id_tbl,
1173 p_create_adj_no_validate => TRUE);
1174 End If;
1175
1176 Exception when no_data_found Then
1177 Null;
1178 IF l_debug_level > 0 THEN
1179 oe_debug_pub.add( ' CS THIS IS NOT A ADJUSTMENT FOR TOP SERVICE LINE' ) ;
1180 END IF;
1181 --No data found, this is not an adjustment for service line for top model line item.
1182 End;
1183 End If;
1184
1185 If l_orcl_customization = 'Y' Then
1186 IF l_debug_level > 0 THEN
1187 oe_debug_pub.add( ' CS BEFORE CHECKING TOP MODEL LINE' ) ;
1188 END IF;
1189 IF l_debug_level > 0 THEN
1190 oe_debug_pub.add( ' TOP MODEL LINE ID:'||L_LINE_REC.TOP_MODEL_LINE_ID ) ;
1191 END IF;
1192 --Cascading adjustments from top model to option lines
1193 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
1194 l_line_rec.line_id = l_line_rec.top_model_line_id --to make sure this is a top model line
1195 Then
1196 get_option_service_lines(p_top_model_line_id=>l_line_rec.top_model_line_id,
1197 p_mode => 'OPTION',
1198 x_line_id_tbl=>l_line_id_tbl);
1199
1200 IF l_debug_level > 0 THEN
1201 oe_debug_pub.add( ' LINE ID COUNT:'||L_LINE_ID_TBL.COUNT ) ;
1202 END IF;
1203 If l_line_id_tbl.first is Not Null Then
1204 IF l_debug_level > 0 THEN
1205 oe_debug_pub.add( 'CS CASCADING OPTION ADJUSTMENTS' ) ;
1206 END IF;
1207 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
1208 p_line_id_tbl => l_line_id_tbl);
1209 End If;
1210
1211 End If;
1212
1213 --we will need to cascade change reason code too, if it got changed
1214 If p_attr_id = OE_Line_Adj_Util.G_CHANGE_REASON_CODE Then
1215
1216 --If no line queried, requery again else just use this to
1217 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) = FND_API.G_MISS_NUM Then
1218 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
1219 x_line_rec=>l_line_rec);
1220 End If;
1221
1222 --Only do that for top model line
1223 If l_line_rec.line_id = l_line_rec.top_model_line_id Then
1224 get_option_service_lines(p_top_model_line_id=>l_line_rec.top_model_line_id,
1225 p_mode => 'OPTION',
1226 x_line_id_tbl=>l_line_id_tbl);
1227
1228 If l_line_id_tbl.first is Not Null Then
1229 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
1230 p_line_id_tbl => l_line_id_tbl);
1231 End If;
1232 End If;
1233
1234 End If;
1235
1236
1237 End If; --cascade adjustment lines
1238
1239 --Reset l_line_rec.line_id after used
1240 l_line_rec.line_id := NULL;
1241 l_line_id_tbl.delete;
1242
1243 -- Populate Line_Adj table
1244 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
1245 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
1246
1247 -- Call Oe_Order_Adj_Pvt.Line_Adj
1248 l_Line_Adj_rec := l_x_Line_Adj_rec;
1249
1250 oe_order_adj_pvt.Line_Adjs
1251 ( p_init_msg_list => FND_API.G_TRUE
1252 , p_validation_level => FND_API.G_VALID_LEVEL_NONE
1253 , p_control_rec => l_control_rec
1254 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
1255 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
1256 );
1257
1258 /************************************************************************
1259 -- Call OE_Order_PVT.Process_order
1260 OE_Order_PVT.Process_order
1261 ( p_api_version_number => 1.0
1262 , p_init_msg_list => FND_API.G_TRUE
1263 , p_validation_level => FND_API.G_VALID_LEVEL_NONE
1264 , x_return_status => l_return_status
1265 , x_msg_count => x_msg_count
1266 , x_msg_data => x_msg_data
1267 , p_control_rec => l_control_rec
1268 , p_action_request_tbl => l_request_tbl
1269 , p_Line_Adj_tbl => l_Line_Adj_tbl
1270 , p_old_Line_Adj_tbl => l_old_Line_Adj_tbl
1271 , x_header_rec => l_x_header_rec
1272 , x_Header_Adj_tbl => l_x_Header_Adj_tbl
1273
1274 -- New Parameters
1275 , x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
1276 , x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
1277 , x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
1278
1279
1280 , x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
1281 , x_line_tbl => l_x_line_tbl
1282 , x_Line_Adj_tbl => l_x_Line_Adj_tbl
1283
1284 -- New Parameters
1285 , x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
1286 , x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
1287 , x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
1288
1289
1290 , x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
1291 , x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
1292 , x_action_request_tbl => l_action_request_tbl
1293 );
1294
1295 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1296 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1297 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1298 RAISE FND_API.G_EXC_ERROR;
1299 END IF;
1300 ******************************************************************/
1301
1302 -- Unload out tbl
1303 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
1304
1305 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1306 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1307 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
1308 RAISE FND_API.G_EXC_ERROR;
1309 END IF;
1310
1311 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
1312 (p_request_type => OE_GLOBALS.G_CHECK_DUPLICATE
1313 ,p_delete => FND_API.G_TRUE
1314 ,x_return_status => l_return_status
1315 );
1316 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1317 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1318 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1319 RAISE FND_API.G_EXC_ERROR;
1320 END IF;
1321
1322 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
1323 (p_request_type => OE_GLOBALS.G_CHECK_FIXED_PRICE
1324 ,p_delete => FND_API.G_TRUE
1325 ,x_return_status => l_return_status
1326 );
1327 IF p_enforce_fixed_price = 'YES' THEN
1328 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1329 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1330 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
1331 RAISE FND_API.G_EXC_ERROR;
1332 END IF;
1333 ELSE
1334 l_return_status := FND_API.G_RET_STS_SUCCESS;
1335 END IF;
1336
1337
1338 -- Init OUT parameters to missing.
1339
1340 x_price_adjustment_id := FND_API.G_MISS_NUM;
1341 x_header_id := FND_API.G_MISS_NUM;
1342 x_discount_id := FND_API.G_MISS_NUM;
1343 x_discount := FND_API.G_MISS_CHAR;
1344 x_discount_line_id := FND_API.G_MISS_NUM;
1345 x_automatic_flag := FND_API.G_MISS_CHAR;
1346 x_percent := FND_API.G_MISS_NUM;
1347 x_line_id := FND_API.G_MISS_NUM;
1348 x_context := FND_API.G_MISS_CHAR;
1349 x_attribute1 := FND_API.G_MISS_CHAR;
1350 x_attribute2 := FND_API.G_MISS_CHAR;
1351 x_attribute3 := FND_API.G_MISS_CHAR;
1352 x_attribute4 := FND_API.G_MISS_CHAR;
1353 x_attribute5 := FND_API.G_MISS_CHAR;
1354 x_attribute6 := FND_API.G_MISS_CHAR;
1355 x_attribute7 := FND_API.G_MISS_CHAR;
1356 x_attribute8 := FND_API.G_MISS_CHAR;
1357 x_attribute9 := FND_API.G_MISS_CHAR;
1358 x_attribute10 := FND_API.G_MISS_CHAR;
1359 x_attribute11 := FND_API.G_MISS_CHAR;
1360 x_attribute12 := FND_API.G_MISS_CHAR;
1361 x_attribute13 := FND_API.G_MISS_CHAR;
1362 x_attribute14 := FND_API.G_MISS_CHAR;
1363 x_attribute15 := FND_API.G_MISS_CHAR;
1364 x_ac_context := FND_API.G_MISS_CHAR;
1365 x_ac_attribute1 := FND_API.G_MISS_CHAR;
1366 x_ac_attribute2 := FND_API.G_MISS_CHAR;
1367 x_ac_attribute3 := FND_API.G_MISS_CHAR;
1368 x_ac_attribute4 := FND_API.G_MISS_CHAR;
1369 x_ac_attribute5 := FND_API.G_MISS_CHAR;
1370 x_ac_attribute6 := FND_API.G_MISS_CHAR;
1371 x_ac_attribute7 := FND_API.G_MISS_CHAR;
1372 x_ac_attribute8 := FND_API.G_MISS_CHAR;
1373 x_ac_attribute9 := FND_API.G_MISS_CHAR;
1374 x_ac_attribute10 := FND_API.G_MISS_CHAR;
1375 x_ac_attribute11 := FND_API.G_MISS_CHAR;
1376 x_ac_attribute12 := FND_API.G_MISS_CHAR;
1377 x_ac_attribute13 := FND_API.G_MISS_CHAR;
1378 x_ac_attribute14 := FND_API.G_MISS_CHAR;
1379 x_ac_attribute15 := FND_API.G_MISS_CHAR;
1380
1381 -- New columns names added
1382 x_list_header_id := FND_API.G_MISS_NUM;
1383 x_list_line_id := FND_API.G_MISS_NUM;
1384 x_list_line_type_code := FND_API.G_MISS_CHAR;
1385 x_modifier_mechanism_type_code := FND_API.G_MISS_CHAR;
1386 x_modified_from := FND_API.G_MISS_CHAR;
1387 x_modified_to := FND_API.G_MISS_CHAR;
1388 x_update_allowed := FND_API.G_MISS_CHAR;
1389 x_updated_flag := FND_API.G_MISS_CHAR;
1390 x_applied_flag := FND_API.G_MISS_CHAR;
1391 x_change_reason_code := FND_API.G_MISS_CHAR;
1392 x_change_reason_text := FND_API.G_MISS_CHAR;
1393 x_operand := FND_API.G_MISS_NUM;
1394 x_arithmetic_operator := FND_API.G_MISS_CHAR;
1395
1396 x_adjusted_amount := FND_API.G_MISS_NUM;
1397 x_pricing_phase_id := FND_API.G_MISS_NUM;
1398 x_list_line_no := FND_API.G_MISS_CHAR;
1399 x_source_system_code := FND_API.G_MISS_CHAR;
1400 x_benefit_qty := FND_API.G_MISS_NUM;
1401 x_benefit_uom_code := FND_API.G_MISS_CHAR;
1402 x_print_on_invoice_flag := FND_API.G_MISS_CHAR;
1403 x_expiration_date := FND_API.G_MISS_DATE;
1404 x_rebate_transaction_type_code := FND_API.G_MISS_CHAR;
1405 x_rebate_transaction_reference := FND_API.G_MISS_CHAR;
1406 x_rebate_payment_system_code := FND_API.G_MISS_CHAR;
1407 x_redeemed_date := FND_API.G_MISS_DATE;
1408 x_redeemed_flag := FND_API.G_MISS_CHAR;
1409 x_accrual_flag := FND_API.G_MISS_CHAR;
1410 x_estimated_flag := FND_API.G_MISS_CHAR;
1411 x_invoiced_flag := FND_API.G_MISS_CHAR;
1412 x_charge_type_code := FND_API.G_MISS_CHAR;
1413 x_charge_subtype_code := FND_API.G_MISS_CHAR;
1414 x_credit_or_charge_flag := FND_API.G_MISS_CHAR;
1415 x_include_on_returns_flag := FND_API.G_MISS_CHAR;
1416 --uom begin
1417 x_operand_per_pqty := FND_API.G_MISS_NUM;
1418 x_adjusted_amount_per_pqty := FND_API.G_MISS_NUM;
1419 --uom end
1420
1421 -- Load display out parameters if any
1422
1423 l_Line_Adj_val_rec := OE_Line_Adj_Util.Get_Values
1424 ( p_Line_Adj_rec =>l_x_Line_Adj_rec
1425 , p_old_Line_Adj_rec => l_Line_Adj_rec
1426 );
1427
1428 -- New Column changes
1429
1430 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.adjusted_amount, l_Line_Adj_rec.adjusted_amount)
1431 THEN
1432 x_adjusted_amount := l_x_Line_Adj_rec.adjusted_amount;
1433 END IF;
1434
1435 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.pricing_phase_id, l_Line_Adj_rec.pricing_phase_id)
1436 THEN
1437 x_pricing_phase_id := l_x_Line_Adj_rec.pricing_phase_id;
1438 END IF;
1439
1440 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_line_no, l_Line_Adj_rec.list_line_no)
1441 THEN
1442 x_list_line_no := l_x_Line_Adj_rec.list_line_no;
1443 END IF;
1444
1445 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.source_system_code, l_Line_Adj_rec.source_system_code)
1446 THEN
1447 x_source_system_code := l_x_Line_Adj_rec.source_system_code;
1448 END IF;
1449
1450 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.benefit_qty, l_Line_Adj_rec.benefit_qty)
1451 THEN
1452 x_benefit_qty := l_x_Line_Adj_rec.benefit_qty;
1453 END IF;
1454
1455 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.benefit_uom_code, l_Line_Adj_rec.benefit_uom_code)
1456 THEN
1457 x_benefit_uom_code := l_x_Line_Adj_rec.benefit_uom_code;
1458 END IF;
1459
1460 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.print_on_invoice_flag, l_Line_Adj_rec.print_on_invoice_flag)
1461 THEN
1462 x_print_on_invoice_flag := l_x_Line_Adj_rec.print_on_invoice_flag;
1463 END IF;
1464
1465 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.expiration_date, l_Line_Adj_rec.expiration_date)
1466 THEN
1467 x_expiration_date := l_x_Line_Adj_rec.expiration_date;
1468 END IF;
1469
1470 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.rebate_transaction_type_code, l_Line_Adj_rec.rebate_transaction_type_code)
1471 THEN
1472 x_rebate_transaction_type_code := l_x_Line_Adj_rec.rebate_transaction_type_code;
1473 END IF;
1474
1475 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.rebate_transaction_reference, l_Line_Adj_rec.rebate_transaction_reference)
1476 THEN
1477 x_rebate_transaction_reference := l_x_Line_Adj_rec.rebate_transaction_reference;
1478 END IF;
1479
1480 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.rebate_payment_system_code, l_Line_Adj_rec.rebate_payment_system_code)
1481 THEN
1482 x_rebate_payment_system_code := l_x_Line_Adj_rec.rebate_payment_system_code;
1483 END IF;
1484
1485 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.redeemed_date, l_Line_Adj_rec.redeemed_date)
1486 THEN
1487 x_redeemed_date := l_x_Line_Adj_rec.redeemed_date;
1488 END IF;
1489
1490 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.redeemed_flag, l_Line_Adj_rec.redeemed_flag)
1491 THEN
1492 x_redeemed_flag := l_x_Line_Adj_rec.redeemed_flag;
1493 END IF;
1494
1495 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.accrual_flag, l_Line_Adj_rec.accrual_flag)
1496 THEN
1497 x_accrual_flag := l_x_Line_Adj_rec.accrual_flag;
1498 END IF;
1499
1500 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_header_id, l_Line_Adj_rec.list_header_id)
1501 THEN
1502 x_list_header_id := l_x_Line_Adj_rec.list_header_id;
1503 END IF;
1504
1505 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_line_id,l_Line_Adj_rec.list_line_id)
1506 THEN
1507 x_list_line_id := l_x_Line_Adj_rec.list_line_id;
1508 END IF;
1509
1510 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.list_line_type_code,
1511 l_Line_Adj_rec.list_line_type_code)
1512 THEN
1513 x_list_line_type_code := l_x_Line_Adj_rec.list_line_type_code;
1514 END IF;
1515
1516 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.modifier_mechanism_type_code,
1517 l_Line_Adj_rec.modifier_mechanism_type_code)
1518 THEN
1519 x_modifier_mechanism_type_code :=
1520 l_x_Line_Adj_rec.modifier_mechanism_type_code;
1521 END IF;
1522
1523 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.update_allowed,
1524 l_Line_Adj_rec.update_allowed)
1525 THEN
1526 x_update_allowed := l_x_Line_Adj_rec.update_allowed;
1527 END IF;
1528
1529 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.updated_flag, l_Line_Adj_rec.updated_flag)
1530 THEN
1531 x_updated_flag := l_x_Line_Adj_rec.updated_flag;
1532 END IF;
1533
1534 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.modified_from, l_Line_Adj_rec.modified_from)
1535 THEN
1536 x_modified_from := l_x_Line_Adj_rec.modified_from;
1537 END IF;
1538
1539 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.modified_to, l_Line_Adj_rec.modified_to)
1540 THEN
1541 x_modified_to := l_x_Line_Adj_rec.modified_to;
1542 END IF;
1543
1544 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.applied_flag, l_Line_Adj_rec.applied_flag)
1545 THEN
1546 x_applied_flag := l_x_Line_Adj_rec.applied_flag;
1547 END IF;
1548
1549 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.change_reason_code, l_Line_Adj_rec.change_reason_code)
1550 THEN
1551 x_change_reason_code := l_x_Line_Adj_rec.change_reason_code;
1552 END IF;
1553
1554 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.change_reason_text, l_Line_Adj_rec.change_reason_text)
1555 THEN
1556 x_change_reason_text := l_x_Line_Adj_rec.change_reason_text;
1557 END IF;
1558 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.operand, l_Line_Adj_rec.operand)
1559 THEN
1560 x_operand := l_x_Line_Adj_rec.operand;
1561 END IF;
1562 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.arithmetic_operator, l_Line_Adj_rec.arithmetic_operator)
1563 THEN
1564 x_arithmetic_operator := l_x_Line_Adj_rec.arithmetic_operator;
1565 END IF;
1566
1567
1568 -- Return changed attributes.
1569
1570 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute1,
1571 l_Line_Adj_rec.attribute1)
1572 THEN
1573 x_attribute1 := l_x_Line_Adj_rec.attribute1;
1574 END IF;
1575
1576 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute10,
1577 l_Line_Adj_rec.attribute10)
1578 THEN
1579 x_attribute10 := l_x_Line_Adj_rec.attribute10;
1580 END IF;
1581
1582 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute11,
1583 l_Line_Adj_rec.attribute11)
1584 THEN
1585 x_attribute11 := l_x_Line_Adj_rec.attribute11;
1586 END IF;
1587
1588 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute12,
1589 l_Line_Adj_rec.attribute12)
1590 THEN
1591 x_attribute12 := l_x_Line_Adj_rec.attribute12;
1592 END IF;
1593
1594 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute13,
1595 l_Line_Adj_rec.attribute13)
1596 THEN
1597 x_attribute13 := l_x_Line_Adj_rec.attribute13;
1598 END IF;
1599
1600 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute14,
1601 l_Line_Adj_rec.attribute14)
1602 THEN
1603 x_attribute14 := l_x_Line_Adj_rec.attribute14;
1604 END IF;
1605
1606 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute15,
1607 l_Line_Adj_rec.attribute15)
1608 THEN
1609 x_attribute15 := l_x_Line_Adj_rec.attribute15;
1610 END IF;
1611
1612 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute2,
1613 l_Line_Adj_rec.attribute2)
1614 THEN
1615 x_attribute2 := l_x_Line_Adj_rec.attribute2;
1616 END IF;
1617
1618 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute3,
1619 l_Line_Adj_rec.attribute3)
1620 THEN
1621 x_attribute3 := l_x_Line_Adj_rec.attribute3;
1622 END IF;
1623
1624 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute4,
1625 l_Line_Adj_rec.attribute4)
1626 THEN
1627 x_attribute4 := l_x_Line_Adj_rec.attribute4;
1628 END IF;
1629
1630 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute5,
1631 l_Line_Adj_rec.attribute5)
1632 THEN
1633 x_attribute5 := l_x_Line_Adj_rec.attribute5;
1634 END IF;
1635
1636 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute6,
1637 l_Line_Adj_rec.attribute6)
1638 THEN
1639 x_attribute6 := l_x_Line_Adj_rec.attribute6;
1640 END IF;
1641
1642 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute7,
1643 l_Line_Adj_rec.attribute7)
1644 THEN
1645 x_attribute7 := l_x_Line_Adj_rec.attribute7;
1646 END IF;
1647
1648 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute8,
1649 l_Line_Adj_rec.attribute8)
1650 THEN
1651 x_attribute8 := l_x_Line_Adj_rec.attribute8;
1652 END IF;
1653
1654 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.attribute9,
1655 l_Line_Adj_rec.attribute9)
1656 THEN
1657 x_attribute9 := l_x_Line_Adj_rec.attribute9;
1658 END IF;
1659
1660 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.automatic_flag,
1661 l_Line_Adj_rec.automatic_flag)
1662 THEN
1663 x_automatic_flag := l_x_Line_Adj_rec.automatic_flag;
1664 END IF;
1665
1666 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.context,
1667 l_Line_Adj_rec.context)
1668 THEN
1669 x_context := l_x_Line_Adj_rec.context;
1670 END IF;
1671
1672 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.discount_id,
1673 l_Line_Adj_rec.discount_id)
1674 THEN
1675 x_discount_id := l_x_Line_Adj_rec.discount_id;
1676 x_discount := l_Line_Adj_val_rec.discount;
1677 END IF;
1678
1679 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.discount_line_id,
1680 l_Line_Adj_rec.discount_line_id)
1681 THEN
1682 x_discount_line_id := l_x_Line_Adj_rec.discount_line_id;
1683 END IF;
1684
1685 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.header_id,
1686 l_Line_Adj_rec.header_id)
1687 THEN
1688 x_header_id := l_x_Line_Adj_rec.header_id;
1689 END IF;
1690
1691 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.line_id,
1692 l_Line_Adj_rec.line_id)
1693 THEN
1694 x_line_id := l_x_Line_Adj_rec.line_id;
1695 END IF;
1696
1697 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.percent,
1698 l_Line_Adj_rec.percent)
1699 THEN
1700 x_percent := l_x_Line_Adj_rec.percent;
1701 END IF;
1702
1703 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.price_adjustment_id,
1704 l_Line_Adj_rec.price_adjustment_id)
1705 THEN
1706 x_price_adjustment_id := l_x_Line_Adj_rec.price_adjustment_id;
1707 END IF;
1708
1709 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.invoiced_flag,
1710 l_Line_Adj_rec.invoiced_flag)
1711 THEN
1712 x_invoiced_flag := l_x_Line_Adj_rec.invoiced_flag;
1713 END IF;
1714
1715 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.estimated_flag,
1716 l_Line_Adj_rec.estimated_flag)
1717 THEN
1718 x_estimated_flag := l_x_Line_Adj_rec.estimated_flag;
1719 END IF;
1720
1721 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.charge_type_code,
1722 l_Line_Adj_rec.charge_type_code)
1723 THEN
1724 x_charge_type_code := l_x_Line_Adj_rec.charge_type_code;
1725 END IF;
1726
1727 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.charge_subtype_code,
1728 l_Line_Adj_rec.charge_subtype_code)
1729 THEN
1730 x_charge_subtype_code := l_x_Line_Adj_rec.charge_subtype_code;
1731 END IF;
1732
1733 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.credit_or_charge_flag,
1734 l_Line_Adj_rec.credit_or_charge_flag)
1735 THEN
1736 x_credit_or_charge_flag := l_x_Line_Adj_rec.credit_or_charge_flag;
1737 END IF;
1738
1739 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.include_on_returns_flag,
1740 l_Line_Adj_rec.include_on_returns_flag)
1741 THEN
1742 x_include_on_returns_flag := l_x_Line_Adj_rec.include_on_returns_flag;
1743 END IF;
1744
1745 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute1,
1746 l_Line_Adj_rec.ac_attribute1)
1747 THEN
1748 x_ac_attribute1 := l_x_Line_Adj_rec.ac_attribute1;
1749 END IF;
1750
1751 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute10,
1752 l_Line_Adj_rec.ac_attribute10)
1753 THEN
1754 x_ac_attribute10 := l_x_Line_Adj_rec.ac_attribute10;
1755 END IF;
1756
1757 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute11,
1758 l_Line_Adj_rec.ac_attribute11)
1759 THEN
1760 x_ac_attribute11 := l_x_Line_Adj_rec.ac_attribute11;
1761 END IF;
1762
1763 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute12,
1764 l_Line_Adj_rec.ac_attribute12)
1765 THEN
1766 x_ac_attribute12 := l_x_Line_Adj_rec.ac_attribute12;
1767 END IF;
1768
1769 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute13,
1770 l_Line_Adj_rec.ac_attribute13)
1771 THEN
1772 x_ac_attribute13 := l_x_Line_Adj_rec.ac_attribute13;
1773 END IF;
1774
1775 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute14,
1776 l_Line_Adj_rec.ac_attribute14)
1777 THEN
1778 x_ac_attribute14 := l_x_Line_Adj_rec.ac_attribute14;
1779 END IF;
1780
1781 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute15,
1782 l_Line_Adj_rec.ac_attribute15)
1783 THEN
1784 x_ac_attribute15 := l_x_Line_Adj_rec.ac_attribute15;
1785 END IF;
1786
1787 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute2,
1788 l_Line_Adj_rec.ac_attribute2)
1789 THEN
1790 x_ac_attribute2 := l_x_Line_Adj_rec.ac_attribute2;
1791 END IF;
1792
1793 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute3,
1794 l_Line_Adj_rec.ac_attribute3)
1795 THEN
1796 x_ac_attribute3 := l_x_Line_Adj_rec.ac_attribute3;
1797 END IF;
1798
1799 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute4,
1800 l_Line_Adj_rec.ac_attribute4)
1801 THEN
1802 x_ac_attribute4 := l_x_Line_Adj_rec.ac_attribute4;
1803 END IF;
1804
1805 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute5,
1806 l_Line_Adj_rec.ac_attribute5)
1807 THEN
1808 x_ac_attribute5 := l_x_Line_Adj_rec.ac_attribute5;
1809 END IF;
1810
1811 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute6,
1812 l_Line_Adj_rec.ac_attribute6)
1813 THEN
1814 x_ac_attribute6 := l_x_Line_Adj_rec.ac_attribute6;
1815 END IF;
1816
1817 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute7,
1818 l_Line_Adj_rec.ac_attribute7)
1819 THEN
1820 x_ac_attribute7 := l_x_Line_Adj_rec.ac_attribute7;
1821 END IF;
1822
1823 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute8,
1824 l_Line_Adj_rec.ac_attribute8)
1825 THEN
1826 x_ac_attribute8 := l_x_Line_Adj_rec.ac_attribute8;
1827 END IF;
1828
1829 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_attribute9,
1830 l_Line_Adj_rec.ac_attribute9)
1831 THEN
1832 x_ac_attribute9 := l_x_Line_Adj_rec.ac_attribute9;
1833 END IF;
1834
1835 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.ac_context,
1836 l_Line_Adj_rec.ac_context)
1837 THEN
1838 x_ac_context := l_x_Line_Adj_rec.ac_context;
1839 END IF;
1840 --uom begin
1841 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.operand_per_pqty,
1842 l_Line_Adj_rec.operand_per_pqty)
1843 THEN
1844 x_operand_per_pqty := l_x_Line_Adj_rec.operand_per_pqty;
1845 END IF;
1846
1847 IF NOT OE_GLOBALS.Equal(l_x_Line_Adj_rec.adjusted_amount_per_pqty,
1848 l_Line_Adj_rec.adjusted_amount_per_pqty)
1849 THEN
1850 x_adjusted_amount_per_pqty := l_x_Line_Adj_rec.adjusted_amount_per_pqty;
1851 END IF;
1852 --uom end
1853
1854
1855
1856
1857 -- Write to cache.
1858 Write_Line_Adj
1859 ( p_Line_Adj_rec => l_x_Line_Adj_rec
1860 );
1861
1862 -- Re-set the UI flag to FALSE
1863 OE_GLOBALS.G_UI_FLAG := FALSE;
1864
1865 -- Set return status.
1866
1867 x_return_status := FND_API.G_RET_STS_SUCCESS;
1868
1869 -- Get message count and data
1870
1871 OE_MSG_PUB.Count_And_Get
1872 ( p_count => x_msg_count
1873 , p_data => x_msg_data
1874 );
1875
1876 IF l_debug_level > 0 THEN
1877 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.CHANGE_ATTRIBUTES' , 1 ) ;
1878 END IF;
1879
1880 EXCEPTION
1881
1882 WHEN FND_API.G_EXC_ERROR THEN
1883
1884 OE_GLOBALS.G_UI_FLAG := FALSE;
1885
1886 x_return_status := FND_API.G_RET_STS_ERROR;
1887
1888 -- Get message count and data
1889
1890 OE_MSG_PUB.Count_And_Get
1891 ( p_count => x_msg_count
1892 , p_data => x_msg_data
1893 );
1894
1895 ROLLBACK TO SAVEPOINT change_attributes;
1896
1897 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1898
1899 OE_GLOBALS.G_UI_FLAG := FALSE;
1900
1901 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1902
1903 -- Get message count and data
1904
1905 OE_MSG_PUB.Count_And_Get
1906 ( p_count => x_msg_count
1907 , p_data => x_msg_data
1908 );
1909
1910 ROLLBACK TO SAVEPOINT change_attributes;
1911
1912 WHEN OTHERS THEN
1913
1914 OE_GLOBALS.G_UI_FLAG := FALSE;
1915
1916 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1917
1918 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1919 THEN
1920 OE_MSG_PUB.Add_Exc_Msg
1921 ( G_PKG_NAME
1922 , 'Change_Attributes'
1923 );
1924 END IF;
1925
1926 -- Get message count and data
1927
1928 OE_MSG_PUB.Count_And_Get
1929 ( p_count => x_msg_count
1930 , p_data => x_msg_data
1931 );
1932
1933 ROLLBACK TO SAVEPOINT change_attributes;
1934
1935 END Change_Attributes;
1936
1937
1938
1939
1940 -- Procedure Validate_And_Write
1941 --
1942
1943 PROCEDURE Validate_And_Write
1944 ( x_return_status OUT NOCOPY VARCHAR2
1945
1946 , x_msg_count OUT NOCOPY NUMBER
1947
1948 , x_msg_data OUT NOCOPY VARCHAR2
1949
1950 , p_price_adjustment_id IN NUMBER
1951 , x_creation_date OUT NOCOPY DATE
1952
1953 , x_created_by OUT NOCOPY NUMBER
1954
1955 , x_last_update_date OUT NOCOPY DATE
1956
1957 , x_last_updated_by OUT NOCOPY NUMBER
1958
1959 , x_last_update_login OUT NOCOPY NUMBER
1960
1961 , p_ok_flag IN VARCHAR2
1962 , x_program_id OUT NOCOPY NUMBER
1963
1964 , x_program_application_id OUT NOCOPY NUMBER
1965
1966 , x_program_update_date OUT NOCOPY DATE
1967
1968 , x_request_id OUT NOCOPY NUMBER
1969
1970 , x_lock_control OUT NOCOPY NUMBER
1971
1972 )
1973 IS
1974 l_request_rec OE_Order_Pub.Request_Rec_Type;
1975 l_request_tbl OE_Order_Pub.Request_Tbl_Type;
1976 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
1977 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
1978 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
1979 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
1980 l_control_rec OE_GLOBALS.Control_Rec_Type;
1981 l_return_status VARCHAR2(1);
1982 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
1983 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
1984 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
1985 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
1986 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
1987 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
1988 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
1989 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
1990 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
1991 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
1992 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
1993 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
1994 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
1995 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
1996
1997
1998 --New out parameters
1999 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2000 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2001 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2002
2003 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2004 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2005 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2006
2007
2008 --
2009 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2010 --
2011 BEGIN
2012
2013 IF l_debug_level > 0 THEN
2014 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.VALIDATE_AND_WRITE' , 1 ) ;
2015 END IF;
2016
2017 -- Set the UI flag
2018 OE_GLOBALS.G_UI_FLAG := TRUE;
2019
2020 -- Set control flags.
2021 l_control_rec.controlled_operation := TRUE;
2022 l_control_rec.validate_entity := TRUE;
2023 l_control_rec.write_to_DB := TRUE;
2024
2025 l_control_rec.check_security := FALSE;
2026 l_control_rec.clear_dependents := FALSE;
2027 l_control_rec.default_attributes := FALSE;
2028 l_control_rec.change_attributes := FALSE;
2029 l_control_rec.process := FALSE;
2030 l_control_rec.process_entity := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2031
2032
2033 -- Instruct API to retain its caches
2034 l_control_rec.clear_api_cache := FALSE;
2035 l_control_rec.clear_api_requests := FALSE;
2036
2037
2038 -- Save point to rollback to if there were
2039 -- any errors
2040 SAVEPOINT validate_and_write;
2041
2042
2043 -- Read Line_Adj from cache
2044 Get_Line_Adj
2045 ( p_db_record => TRUE
2046 , p_price_adjustment_id => p_price_adjustment_id
2047 , x_Line_adj_rec => l_x_old_Line_Adj_rec
2048 );
2049
2050 Get_Line_Adj
2051 ( p_db_record => FALSE
2052 , p_price_adjustment_id => p_price_adjustment_id
2053 , x_Line_Adj_rec => l_x_Line_Adj_rec
2054 );
2055
2056
2057 -- Set Operation.
2058 -- IF FND_API.To_Boolean(l_Line_Adj_rec.db_flag) THEN
2059 IF FND_API.To_Boolean(l_x_Line_Adj_rec.db_flag) THEN
2060 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
2061 ELSE
2062 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_CREATE;
2063 END IF;
2064
2065
2066
2067 -- Populate Line_Adj table
2068 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
2069 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
2070 /* IF p_ok_flag = 'Y' THEN
2071
2072 l_request_rec.entity_code:= OE_GLOBALS.G_ENTITY_LINE_ADJ;
2073 l_request_rec.entity_id := l_line_adj_rec.line_id;
2074 l_request_rec.request_type := OE_GLOBALS.G_PRICE_ADJ;
2075 l_request_tbl(1) := l_request_rec;
2076
2077 END IF; */
2078
2079
2080 -- Call Oe_Order_Adj_Pvt.Line_Adj
2081 oe_order_adj_pvt.Line_Adjs
2082 ( p_init_msg_list => FND_API.G_TRUE
2083 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
2084 , p_control_rec => l_control_rec
2085 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
2086 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
2087 );
2088
2089 /*********************************************************************
2090 -- Call OE_Order_PVT.Process_order
2091 OE_Order_PVT.Process_order
2092 ( p_api_version_number => 1.0
2093 , p_init_msg_list => FND_API.G_TRUE
2094 , x_return_status => l_return_status
2095 , x_msg_count => x_msg_count
2096 , x_msg_data => x_msg_data
2097 , p_control_rec => l_control_rec
2098 , p_action_request_tbl => l_request_tbl
2099 , p_Line_Adj_tbl => l_Line_Adj_tbl
2100 , p_old_Line_Adj_tbl => l_old_Line_Adj_tbl
2101 , x_header_rec => l_x_header_rec
2102 , x_Header_Adj_tbl => l_x_Header_Adj_tbl
2103 -- New Parameters
2104 , x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
2105 , x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
2106 , x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
2107
2108 , x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
2109 , x_line_tbl => l_x_line_tbl
2110 , x_Line_Adj_tbl => l_x_Line_Adj_tbl
2111 -- New Parameters
2112 , x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
2113 , x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
2114 , x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
2115
2116 , x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
2117 , x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
2118 , x_action_request_tbl => l_action_request_tbl
2119 );
2120
2121 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2122 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2123 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2124 RAISE FND_API.G_EXC_ERROR;
2125 END IF;
2126 *************************************************************************/
2127
2128 -- Load OUT parameters.
2129 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
2130
2131 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2132 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2133 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
2134 RAISE FND_API.G_EXC_ERROR;
2135 END IF;
2136
2137 /*****
2138 Oe_Order_Pvt.Process_Requests_And_Notify
2139 ( p_process_requests => FALSE
2140 , p_notify => TRUE
2141 , p_line_adj_tbl => l_x_line_adj_tbl
2142 , p_old_line_adj_tbl => l_x_old_line_adj_tbl
2143 , x_return_status => l_return_status
2144 );
2145 ******/
2146
2147 x_lock_control := l_x_Line_Adj_rec.lock_control;
2148
2149 -- commented out by linda
2150 /****
2151 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2152 (p_request_type => OE_GLOBALS.G_CHECK_PERCENTAGE
2153 ,p_delete => FND_API.G_TRUE
2154 ,x_return_status => l_return_status
2155 );
2156 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2157 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2158 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2159 RAISE FND_API.G_EXC_ERROR;
2160 END IF;
2161 ***/
2162
2163 /***
2164 IF p_ok_flag = 'Y' THEN
2165 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2166 (p_request_type => OE_GLOBALS.G_PRICE_ADJ
2167 ,p_delete => FND_API.G_TRUE
2168 ,x_return_status => l_return_status
2169 );
2170 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2171 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2172 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2173 RAISE FND_API.G_EXC_ERROR;
2174 END IF;
2175 END IF;
2176 ***/
2177
2178 --TaxER start
2179 IF nvl(FND_PROFILE.VALUE('ONT_DELAY_TAX_CALC'), 'N') = 'N' THEN
2180 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2181 (p_request_type => OE_GLOBALS.G_TAX_LINE
2182 ,p_delete => FND_API.G_TRUE
2183 ,x_return_status => l_return_status
2184 );
2185 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2186 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2187 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2188 RAISE FND_API.G_EXC_ERROR;
2189 END IF;
2190 END IF;
2191 --TaxER end
2192 -- fixed bug 3271297
2193 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2194 (p_request_type => OE_GLOBALS.G_VERIFY_PAYMENT
2195 ,p_delete => FND_API.G_TRUE
2196 ,x_return_status => l_return_status
2197 );
2198 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2199 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2200 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2201 RAISE FND_API.G_EXC_ERROR;
2202 END IF;
2203
2204
2205 x_creation_date := l_x_Line_Adj_rec.creation_date;
2206 x_created_by := l_x_Line_Adj_rec.created_by;
2207 x_last_update_date := l_x_Line_Adj_rec.last_update_date;
2208 x_last_updated_by := l_x_Line_Adj_rec.last_updated_by;
2209 x_last_update_login := l_x_Line_Adj_rec.last_update_login;
2210 x_program_id := l_x_Line_Adj_rec.program_id;
2211 x_program_application_id := l_x_Line_Adj_rec.program_application_id;
2212 x_program_update_date := l_x_Line_Adj_rec.program_update_date;
2213 x_request_id := l_x_Line_Adj_rec.request_id;
2214
2215
2216 -- Clear Line_Adj record cache
2217 Clear_Line_Adj;
2218
2219 -- Re-set the UI flag to FALSE
2220 OE_GLOBALS.G_UI_FLAG := FALSE;
2221
2222 -- Set return status.
2223
2224 x_return_status := FND_API.G_RET_STS_SUCCESS;
2225
2226 -- Get message count and data
2227
2228 OE_MSG_PUB.Count_And_Get
2229 ( p_count => x_msg_count
2230 , p_data => x_msg_data
2231 );
2232
2233 IF l_debug_level > 0 THEN
2234 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.VALIDATE_AND_WRITE' , 1 ) ;
2235 END IF;
2236
2237 EXCEPTION
2238
2239 WHEN FND_API.G_EXC_ERROR THEN
2240
2241 OE_GLOBALS.G_UI_FLAG := FALSE;
2242
2243 x_return_status := FND_API.G_RET_STS_ERROR;
2244
2245 -- Get message count and data
2246
2247 OE_MSG_PUB.Count_And_Get
2248 ( p_count => x_msg_count
2249 , p_data => x_msg_data
2250 );
2251
2252 ROLLBACK TO SAVEPOINT validate_and_write;
2253
2254 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2255
2256 OE_GLOBALS.G_UI_FLAG := FALSE;
2257
2258 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2259
2260 -- Get message count and data
2261
2262 OE_MSG_PUB.Count_And_Get
2263 ( p_count => x_msg_count
2264 , p_data => x_msg_data
2265 );
2266
2267 ROLLBACK TO SAVEPOINT validate_and_write;
2268
2269 WHEN OTHERS THEN
2270
2271 OE_GLOBALS.G_UI_FLAG := FALSE;
2272
2273 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2274
2275 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2276 THEN
2277 OE_MSG_PUB.Add_Exc_Msg
2278 ( G_PKG_NAME
2279 , 'Validate_And_Write'
2280 );
2281 END IF;
2282
2283 -- Get message count and data
2284
2285 OE_MSG_PUB.Count_And_Get
2286 ( p_count => x_msg_count
2287 , p_data => x_msg_data
2288 );
2289
2290 ROLLBACK TO SAVEPOINT validate_and_write;
2291
2292 END Validate_And_Write;
2293
2294 -- Procedure Delete_Row
2295 --
2296
2297 PROCEDURE Delete_Row
2298 ( x_return_status OUT NOCOPY VARCHAR2
2299
2300 , x_msg_count OUT NOCOPY NUMBER
2301
2302 , x_msg_data OUT NOCOPY VARCHAR2
2303
2304 , p_price_adjustment_id IN NUMBER
2305 , p_change_reason_code IN VARCHAR2 Default Null
2306 , p_change_comments IN VARCHAR2 Default Null
2307 )
2308 IS
2309 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2310 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2311 l_control_rec OE_GLOBALS.Control_Rec_Type;
2312 l_return_status VARCHAR2(1);
2313 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
2314 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
2315 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
2316 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
2317 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
2318 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
2319 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
2320 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
2321 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2322 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2323 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2324 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2325 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
2326 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
2327 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
2328 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
2329
2330 --New out parameters
2331
2332 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2333 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2334 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2335
2336 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2337 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2338 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2339
2340 --1790502
2341 l_line_rec OE_Order_Pub.Line_Rec_Type;
2342 l_line_id_tbl OE_Order_Adj_Pvt.Index_Tbl_Type;
2343 l_top_model_line_id Number;
2344 l_profile_cascade_adjustments Varchar2(1):= NVL(FND_PROFILE.VALUE('ONT_CASCADE_ADJUSTMENTS'),'N');
2345
2346 --
2347 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2348 --
2349 BEGIN
2350
2351 IF l_debug_level > 0 THEN
2352 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.DELETE_ROW' , 1 ) ;
2353 END IF;
2354
2355 -- Set the UI flag
2356 OE_GLOBALS.G_UI_FLAG := TRUE;
2357
2358 -- Set control flags.
2359
2360 l_control_rec.controlled_operation := TRUE;
2361 l_control_rec.check_security := TRUE;
2362 l_control_rec.validate_entity := TRUE;
2363 l_control_rec.write_to_DB := TRUE;
2364
2365 l_control_rec.clear_dependents := FALSE;
2366 l_control_rec.default_attributes := FALSE;
2367 l_control_rec.change_attributes := FALSE;
2368 l_control_rec.process := FALSE;
2369
2370 -- Instruct API to retain its caches
2371
2372 l_control_rec.clear_api_cache := FALSE;
2373 l_control_rec.clear_api_requests := FALSE;
2374
2375
2376 -- Read DB record from cache
2377 Get_Line_Adj
2378 ( p_db_record => TRUE
2379 , p_price_adjustment_id => p_price_adjustment_id
2380 , x_Line_adj_rec => l_x_Line_Adj_rec
2381 );
2382
2383
2384 -- Set Operation.
2385 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_DELETE;
2386
2387
2388 -- Populate Line_Adj table
2389 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
2390 l_x_Line_Adj_tbl(1).change_reason_code := p_change_reason_code;
2391 l_x_Line_Adj_tbl(1).change_reason_text := p_change_comments;
2392
2393
2394 -- Bug 1790502
2395 If l_x_line_adj_rec.arithmetic_operator = '%' Then
2396 IF l_debug_level > 0 THEN
2397 oe_debug_pub.add( ' CS BEFORE GETTING LINE' ) ;
2398 END IF;
2399 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
2400 x_line_rec=>l_line_rec);
2401
2402 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
2403 l_line_rec.service_reference_line_id Is Not Null --make sure is adjustment for a service line
2404 Then
2405 --To determine if this is an adjustment for service line of a top model line
2406 Begin
2407 Select line_id
2408 Into l_top_model_line_id
2409 From Oe_Order_Lines_All
2410 Where line_id = l_line_rec.service_reference_line_id
2411 and top_model_line_id = line_id;
2412
2413 --this is a top model line, need to cascade the change to adjustments
2414 --for service lines of option items.
2415 get_option_service_lines(p_top_model_line_id=>l_top_model_line_id,
2416 p_service_line_id=>l_line_rec.line_id,
2417 x_line_id_tbl=>l_line_id_tbl);
2418
2419 If l_line_id_tbl.first is Not Null Then
2420 IF l_debug_level > 0 THEN
2421 oe_debug_pub.add( ' CS DELETING CHILDREN OPTION SERVICE ADJUSTMENT LINES' ) ;
2422 END IF;
2423 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
2424 p_line_id_tbl => l_line_id_tbl,
2425 p_delete_flag => 'Y');
2426 End If;
2427
2428 Exception when no_data_found Then
2429 Null;
2430 IF l_debug_level > 0 THEN
2431 oe_debug_pub.add( ' CS THIS IS NOT A ADJUSTMENT FOR TOP SERVICE LINE' ) ;
2432 END IF;
2433 --No data found, this is not an adjustment for service line for top model line item.
2434 End;
2435
2436 If l_profile_cascade_adjustments = 'Y' Then
2437 --handling delete for adjustment for options of a top model
2438 If nvl(l_line_rec.line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM and
2439 l_line_rec.top_model_line_id = l_line_rec.line_id
2440 Then
2441 get_option_service_lines(p_top_model_line_id =>l_line_rec.top_model_line_id,
2442 p_mode =>'OPTION',
2443 x_line_id_tbl =>l_line_id_tbl);
2444
2445 If l_line_id_tbl.first is Not Null Then
2446 IF l_debug_level > 0 THEN
2447 oe_debug_pub.add( ' CS DELETING CHILDREN OPTION ADJUSTMENT LINES' ) ;
2448 END IF;
2449 Process_Adj(p_parent_adj_rec => l_x_line_adj_rec,
2450 p_line_id_tbl => l_line_id_tbl,
2451 p_delete_flag => 'Y');
2452 End If;
2453
2454 End If;
2455
2456
2457
2458
2459 End If; --l_profile_cascade_adjustments
2460
2461 End If;
2462
2463 End If;
2464
2465 -- Call Oe_Order_Adj_Pvt.Line_Adj
2466 oe_order_adj_pvt.Line_Adjs
2467 ( p_init_msg_list => FND_API.G_TRUE
2468 , p_validation_level => FND_API.G_VALID_LEVEL_FULL
2469 , p_control_rec => l_control_rec
2470 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
2471 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
2472 );
2473
2474
2475 -- Load OUT parameters.
2476 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
2477
2478 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2479 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2480 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
2481 RAISE FND_API.G_EXC_ERROR;
2482 END IF;
2483
2484
2485 -- Clear Line_Adj record cache
2486 Clear_Line_Adj;
2487
2488 -- Re-set the UI flag to FALSE
2489 OE_GLOBALS.G_UI_FLAG := FALSE;
2490
2491 -- Set return status.
2492
2493 x_return_status := FND_API.G_RET_STS_SUCCESS;
2494
2495 -- Get message count and data
2496
2497 OE_MSG_PUB.Count_And_Get
2498 ( p_count => x_msg_count
2499 , p_data => x_msg_data
2500 );
2501
2502 IF l_debug_level > 0 THEN
2503 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.DELETE_ROW' , 1 ) ;
2504 END IF;
2505
2506 EXCEPTION
2507
2508 WHEN FND_API.G_EXC_ERROR THEN
2509
2510 OE_GLOBALS.G_UI_FLAG := FALSE;
2511
2512 x_return_status := FND_API.G_RET_STS_ERROR;
2513
2514 -- Get message count and data
2515
2516 OE_MSG_PUB.Count_And_Get
2517 ( p_count => x_msg_count
2518 , p_data => x_msg_data
2519 );
2520
2521 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2522
2523 OE_GLOBALS.G_UI_FLAG := FALSE;
2524
2525 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2526
2527 -- Get message count and data
2528
2529 OE_MSG_PUB.Count_And_Get
2530 ( p_count => x_msg_count
2531 , p_data => x_msg_data
2532 );
2533
2534 WHEN OTHERS THEN
2535
2536 OE_GLOBALS.G_UI_FLAG := FALSE;
2537
2538 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2539
2540 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2541 THEN
2542 OE_MSG_PUB.Add_Exc_Msg
2543 ( G_PKG_NAME
2544 , 'Delete_Row'
2545 );
2546 END IF;
2547
2548 -- Get message count and data
2549
2550 OE_MSG_PUB.Count_And_Get
2551 ( p_count => x_msg_count
2552 , p_data => x_msg_data
2553 );
2554
2555 END Delete_Row;
2556
2557
2558
2559 -- Procedure Process_Entity
2560 --
2561
2562 PROCEDURE Process_Delayed_Requests
2563 ( x_return_status OUT NOCOPY VARCHAR2
2564
2565 , x_msg_count OUT NOCOPY NUMBER
2566
2567 , x_msg_data OUT NOCOPY VARCHAR2
2568
2569 , p_header_id IN NUMBER
2570 , p_line_id IN NUMBER
2571 )
2572 IS
2573 l_control_rec OE_GLOBALS.Control_Rec_Type;
2574 l_return_status VARCHAR2(1);
2575 l_request_rec OE_Order_Pub.Request_Rec_Type;
2576 l_request_tbl OE_Order_Pub.Request_Tbl_Type;
2577 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
2578 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
2579 l_x_Header_Adj_rec OE_Order_PUB.Header_Adj_Rec_Type;
2580 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
2581 l_x_Header_Scredit_rec OE_Order_PUB.Header_Scredit_Rec_Type;
2582 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
2583 l_x_line_rec OE_Order_PUB.Line_Rec_Type;
2584 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
2585 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2586 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2587 l_x_Line_Scredit_rec OE_Order_PUB.Line_Scredit_Rec_Type;
2588 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
2589 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
2590 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
2591
2592 --New out parameters
2593 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2594 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2595 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2596
2597 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2598 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2599 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2600
2601 --
2602 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2603 --
2604 BEGIN
2605
2606 IF l_debug_level > 0 THEN
2607 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.PROCESS_DELAYED_REQUESTS' , 1 ) ;
2608 END IF;
2609
2610 /*
2611 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2612 (p_request_type => OE_GLOBALS.G_PRICE_ADJ
2613 ,p_delete => FND_API.G_TRUE
2614 ,x_return_status => l_return_status
2615 );
2616 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2617 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2618 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2619 RAISE FND_API.G_EXC_ERROR;
2620 END IF;
2621
2622 -- process delayed requests for tax calculation.
2623 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2624 (p_request_type => OE_GLOBALS.G_TAX_LINE
2625 ,p_delete => FND_API.G_TRUE
2626 ,x_return_status => l_return_status
2627 );
2628 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2629 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2630 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2631 RAISE FND_API.G_EXC_ERROR;
2632 END IF;
2633
2634 IF OE_Commitment_Pvt.Do_Commitment_Sequencing THEN
2635 -- process delayed requests for commitment calculation.
2636 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2637 (p_request_type => OE_GLOBALS.G_CALCULATE_COMMITMENT
2638 ,p_delete => FND_API.G_TRUE
2639 ,x_return_status => l_return_status
2640 );
2641 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2642 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2643 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2644 RAISE FND_API.G_EXC_ERROR;
2645 END IF;
2646 END IF;
2647
2648 oe_debug_pub.ADD('Processing delayed request for Verify Payment for price adjustments changes.', 3);
2649 OE_DELAYED_REQUESTS_PVT.Process_Request_for_Reqtype
2650 (p_request_type => OE_GLOBALS.G_VERIFY_PAYMENT
2651 ,p_delete => FND_API.G_TRUE
2652 ,x_return_status => l_return_status
2653 );
2654
2655 */
2656 --2366123: all requests should be executed
2657 Oe_Order_Pvt.Process_Requests_And_Notify
2658 ( p_process_requests => TRUE
2659 , p_notify => TRUE
2660 , p_process_ack => TRUE
2661 , x_return_status => l_return_status
2662 );
2663 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2664 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2665 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2666 RAISE FND_API.G_EXC_ERROR;
2667 END IF;
2668
2669 --btea begin fix bug 1398294
2670 OE_MSG_PUB.Count_And_Get
2671 ( p_count => x_msg_count
2672 , p_data => x_msg_data
2673 );
2674 --btea end fix bug 1398294
2675
2676 x_return_status := FND_API.G_RET_STS_SUCCESS;
2677
2678 Return;
2679
2680 /********************************************************************
2681 -- Set the UI flag
2682 OE_GLOBALS.G_UI_FLAG := TRUE;
2683
2684 -- Set control flags.
2685
2686 l_control_rec.controlled_operation := TRUE;
2687 l_control_rec.process := TRUE;
2688 l_control_rec.process_entity := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2689
2690 l_control_rec.check_security := FALSE;
2691 l_control_rec.clear_dependents := FALSE;
2692 l_control_rec.default_attributes := FALSE;
2693 l_control_rec.change_attributes := FALSE;
2694 l_control_rec.validate_entity := FALSE;
2695 l_control_rec.write_to_DB := FALSE;
2696
2697 -- Instruct API to clear its request table
2698
2699 l_control_rec.clear_api_cache := FALSE;
2700 l_control_rec.clear_api_requests := FALSE;
2701
2702
2703 -- Assign requests that are to be executed
2704 -- l_request_rec.request_type := OE_GLOBALS.G_CHECK_PERCENTAGE;
2705 -- l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2706 -- l_request_rec.entity_id := p_line_id;
2707 -- l_request_rec.param1 := p_header_id;
2708 -- l_request_tbl(1) := l_request_rec;
2709
2710 -- l_request_rec.request_type := OE_GLOBALS.G_PRICE_ADJ;
2711 -- l_request_rec.entity_code := OE_GLOBALS.G_ENTITY_LINE_ADJ;
2712 -- l_request_rec.entity_id := p_line_id;
2713 -- l_request_tbl(2) := l_request_rec;
2714
2715
2716 -- Call OE_Order_PVT.Process_order
2717
2718 OE_Order_PVT.Process_order
2719 ( p_api_version_number => 1.0
2720 , p_init_msg_list => FND_API.G_TRUE
2721 , x_return_status => l_return_status
2722 , x_msg_count => x_msg_count
2723 , x_msg_data => x_msg_data
2724 , p_control_rec => l_control_rec
2725 , p_action_request_tbl => l_request_tbl
2726 , p_x_header_rec => l_x_header_rec
2727 , p_x_Header_Adj_tbl => l_x_Header_Adj_tbl
2728 -- New Parameters
2729 , p_x_Header_price_Att_tbl => l_x_Header_price_Att_tbl
2730 , p_x_Header_Adj_Att_tbl => l_x_Header_Adj_Att_tbl
2731 , p_x_Header_Adj_Assoc_tbl => l_x_Header_Adj_Assoc_tbl
2732
2733
2734 , p_x_Header_Scredit_tbl => l_x_Header_Scredit_tbl
2735 , p_x_line_tbl => l_x_line_tbl
2736 , p_x_Line_Adj_tbl => l_x_Line_Adj_tbl
2737 -- New Parameters
2738 , p_x_Line_price_Att_tbl => l_x_Line_price_Att_tbl
2739 , p_x_Line_Adj_Att_tbl => l_x_Line_Adj_Att_tbl
2740 , p_x_Line_Adj_Assoc_tbl => l_x_Line_Adj_Assoc_tbl
2741
2742 , p_x_Line_Scredit_tbl => l_x_Line_Scredit_tbl
2743 , p_x_Lot_Serial_tbl => l_x_Lot_Serial_tbl
2744 , p_x_action_request_tbl => l_action_request_tbl
2745 );
2746
2747 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2748 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2749 ELSIF l_return_status = FND_API.G_RET_STS_ERROR THEN
2750 RAISE FND_API.G_EXC_ERROR;
2751 END IF;
2752
2753
2754 -- Re-set the UI flag to FALSE
2755 OE_GLOBALS.G_UI_FLAG := FALSE;
2756
2757 -- Set return status.
2758
2759 x_return_status := FND_API.G_RET_STS_SUCCESS;
2760
2761 -- Get message count and data
2762
2763 OE_MSG_PUB.Count_And_Get
2764 ( p_count => x_msg_count
2765 , p_data => x_msg_data
2766 );
2767
2768 oe_debug_pub.add('Exiting OE_OE_FORM_LINE_ADJ.PROCESS_DELAYED_REQUESTS', 1);
2769
2770 ****************************************************************/
2771
2772 EXCEPTION
2773
2774 WHEN FND_API.G_EXC_ERROR THEN
2775
2776 OE_GLOBALS.G_UI_FLAG := FALSE;
2777
2778 x_return_status := FND_API.G_RET_STS_ERROR;
2779
2780 -- Get message count and data
2781
2782 OE_MSG_PUB.Count_And_Get
2783 ( p_count => x_msg_count
2784 , p_data => x_msg_data
2785 );
2786
2787 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2788
2789 OE_GLOBALS.G_UI_FLAG := FALSE;
2790
2791 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2792
2793 -- Get message count and data
2794
2795 OE_MSG_PUB.Count_And_Get
2796 ( p_count => x_msg_count
2797 , p_data => x_msg_data
2798 );
2799
2800 WHEN OTHERS THEN
2801
2802 OE_GLOBALS.G_UI_FLAG := FALSE;
2803
2804 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2805
2806 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2807 THEN
2808 OE_MSG_PUB.Add_Exc_Msg
2809 ( G_PKG_NAME
2810 , 'Process_Entity'
2811 );
2812 END IF;
2813
2814 -- Get message count and data
2815
2816 OE_MSG_PUB.Count_And_Get
2817 ( p_count => x_msg_count
2818 , p_data => x_msg_data
2819 );
2820
2821 END Process_Delayed_Requests;
2822
2823
2824 PROCEDURE replace_attributes
2825 (x_return_status OUT NOCOPY VARCHAR2,
2826
2827 x_msg_count OUT NOCOPY NUMBER,
2828
2829 x_msg_data OUT NOCOPY VARCHAR2,
2830
2831 p_price_adjustment_id IN NUMBER,
2832 p_adjusted_amount IN NUMBER,
2833 p_adjusted_amount_per_pqty IN NUMBER DEFAULT NULL,
2834 p_arithmetic_operator IN VARCHAR2,
2835 p_operand IN NUMBER,
2836 p_operand_per_pqty IN NUMBER DEFAULT NULL,
2837 p_applied_flag IN VARCHAR2,
2838 p_updated_flag IN VARCHAR2,
2839 p_change_reason_code IN Varchar2 :=NULL,
2840 p_change_reason_text IN VARCHAR2 :=NULL
2841 )
2842 IS
2843 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2844 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2845 l_x_old_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
2846 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2847 l_x_old_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2848 l_Line_Adj_val_rec OE_Order_PUB.Line_Adj_Val_Rec_Type;
2849 l_control_rec OE_GLOBALS.Control_Rec_Type;
2850 l_return_status VARCHAR2(1);
2851 l_action_request_tbl OE_Order_PUB.Request_Tbl_Type;
2852 l_x_header_rec OE_Order_PUB.Header_Rec_Type;
2853 l_x_Header_Adj_tbl OE_Order_PUB.Header_Adj_Tbl_Type;
2854 l_x_Header_Scredit_tbl OE_Order_PUB.Header_Scredit_Tbl_Type;
2855 l_x_line_tbl OE_Order_PUB.Line_Tbl_Type;
2856 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
2857 l_x_Line_Scredit_tbl OE_Order_PUB.Line_Scredit_Tbl_Type;
2858 l_x_Lot_Serial_rec OE_Order_PUB.Lot_Serial_Rec_Type;
2859 l_x_Lot_Serial_tbl OE_Order_PUB.Lot_Serial_Tbl_Type;
2860
2861
2862 --New out parameters
2863 l_x_Header_price_Att_tbl OE_Order_PUB.Header_Price_Att_Tbl_Type;
2864 l_x_Header_Adj_Att_tbl OE_Order_PUB.Header_Adj_Att_Tbl_Type;
2865 l_x_Header_Adj_Assoc_tbl OE_Order_PUB.Header_Adj_Assoc_Tbl_Type;
2866
2867 l_x_Line_price_Att_tbl OE_Order_PUB.Line_Price_Att_Tbl_Type;
2868 l_x_Line_Adj_Att_tbl OE_Order_PUB.Line_Adj_Att_Tbl_Type;
2869 l_x_Line_Adj_Assoc_tbl OE_Order_PUB.Line_Adj_Assoc_Tbl_Type;
2870
2871 l_line_rec Oe_Order_Pub.line_rec_type;
2872 --
2873 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
2874 --
2875 BEGIN
2876
2877 IF l_debug_level > 0 THEN
2878 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.REPLACE_ATTRIBUTES' , 1 ) ;
2879 END IF;
2880
2881 -- Set the UI flag
2882 OE_GLOBALS.G_UI_FLAG := TRUE;
2883
2884 -- Set control flags.
2885 l_control_rec.controlled_operation := TRUE;
2886 l_control_rec.clear_dependents := FALSE;
2887 l_control_rec.change_attributes := TRUE;
2888 l_control_rec.default_attributes := TRUE;
2889 l_control_rec.validate_entity := FALSE;
2890 l_control_rec.write_to_DB := TRUE;
2891 l_control_rec.process := FALSE;
2892
2893
2894 -- Instruct API to retain its caches
2895 l_control_rec.clear_api_cache := FALSE;
2896 l_control_rec.clear_api_requests := FALSE;
2897
2898
2899 -- Save point to rollback to if there were
2900 -- any errors
2901 SAVEPOINT replace_attributes;
2902
2903 Get_Line_Adj
2904 ( p_db_record => FALSE
2905 , p_price_adjustment_id => p_price_adjustment_id
2906 , x_Line_Adj_rec => l_x_Line_Adj_rec
2907 );
2908 -- included to fix bug 1717501 begin
2909 l_x_old_Line_Adj_rec := l_x_Line_Adj_rec;
2910 -- included to fix bug 1717501 end
2911
2912 l_x_line_adj_rec.price_adjustment_id := p_price_adjustment_id;
2913 l_x_line_adj_rec.adjusted_amount := p_adjusted_amount;
2914
2915
2916 /* Bug 1944975 - dual UOMs
2917 We pass the per_pqty values also
2918 */
2919 IF (p_adjusted_amount_per_pqty is NOT NULL) Then
2920 IF l_debug_level > 0 THEN
2921 oe_debug_pub.add( 'NOT NULL ADJPQTY ' || P_ADJUSTED_AMOUNT_PER_PQTY ) ;
2922 END IF;
2923 l_x_line_adj_rec.adjusted_amount_per_pqty := p_adjusted_amount_per_pqty;
2924 END IF;
2925
2926 IF (p_operand_per_pqty is NOT NULL) Then
2927 IF l_debug_level > 0 THEN
2928 oe_debug_pub.add( 'NOT NULL OPQTY ' || P_OPERAND_PER_PQTY ) ;
2929 END IF;
2930 l_x_line_adj_rec.operand_per_pqty := p_operand_per_pqty;
2931 ELSE
2932 --IF (p_operand_per_pqty IS NULL) THEN
2933 If l_x_line_adj_rec.line_id is not Null
2934 and l_x_line_adj_rec.list_line_type_code <> 'LUMPSUM'
2935 Then
2936 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
2937 x_line_rec=>l_line_rec);
2938
2939 If nvl(l_line_rec.pricing_quantity,0) <> 0 Then
2940 l_x_line_adj_rec.adjusted_amount_per_pqty := (p_adjusted_amount * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
2941 End If;
2942 End If;
2943 --End If;
2944 END IF; -- if p_operand_per_pqty is NOT NULL
2945
2946
2947 If l_x_line_adj_rec.adjusted_amount_per_pqty is Null Then
2948 l_x_line_adj_rec.adjusted_amount_per_pqty := p_adjusted_amount;
2949 END IF;
2950
2951 l_x_line_adj_rec.arithmetic_operator := p_arithmetic_operator;
2952 l_x_line_adj_rec.operand := p_operand;
2953
2954 IF (p_operand_per_pqty IS NULL) THEN
2955 If l_x_line_adj_rec.line_id is not Null
2956 and l_x_line_adj_rec.list_line_type_code <> 'LUMPSUM'
2957 Then
2958 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_x_line_adj_rec.line_id,
2959 x_line_rec=>l_line_rec);
2960
2961 If nvl(l_line_rec.pricing_quantity,0) <> 0 Then
2962 l_x_line_adj_rec.operand_per_pqty := (p_operand * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
2963 End If;
2964 End If;
2965 End If;
2966
2967 IF l_x_line_adj_rec.operand_per_pqty is Null THEN
2968 l_x_line_adj_rec.operand_per_pqty := p_operand;
2969 END IF;
2970
2971 l_x_line_adj_rec.applied_flag := p_applied_flag;
2972 l_x_line_adj_rec.updated_flag := p_updated_flag;
2973
2974 If p_change_reason_code Is Not Null Then
2975 l_x_line_adj_rec.change_reason_code := p_change_reason_code;
2976 End If;
2977
2978 If p_change_reason_text Is Not Null Then
2979 l_x_line_adj_rec.change_reason_text := p_change_reason_text;
2980 End If;
2981
2982 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
2983
2984 l_x_Line_Adj_tbl(1) := l_x_Line_Adj_rec;
2985 -- commented to fix bug 1717501 Begin
2986 -- l_x_old_Line_Adj_rec := l_x_Line_Adj_rec;
2987 -- commented to fix bug 1717501 end
2988 l_x_old_line_adj_rec.operand := null;
2989 l_x_old_Line_Adj_tbl(1) := l_x_old_Line_Adj_rec;
2990
2991 IF l_debug_level > 0 THEN
2992 oe_debug_pub.add( 'BEFORE EXECUTING PROCESS_ORDER...' , 1 ) ;
2993 END IF;
2994
2995 -- Call Oe_Order_Adj_Pvt.Line_Adj
2996 oe_order_adj_pvt.Line_Adjs
2997 ( p_init_msg_list => FND_API.G_TRUE
2998 , p_validation_level => FND_API.G_VALID_LEVEL_NONE
2999 , p_control_rec => l_control_rec
3000 , p_x_line_adj_tbl => l_x_Line_Adj_tbl
3001 , p_x_old_line_adj_tbl => l_x_old_Line_Adj_tbl
3002 );
3003
3004
3005
3006 -- Load OUT parameters.
3007 l_x_Line_Adj_rec := l_x_Line_Adj_tbl(1);
3008
3009 IF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3010 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3011 ELSIF l_x_Line_Adj_rec.return_status = FND_API.G_RET_STS_ERROR THEN
3012 RAISE FND_API.G_EXC_ERROR;
3013 END IF;
3014
3015 IF l_debug_level > 0 THEN
3016 oe_debug_pub.add( 'AFTER EXECUTING PROCESS_ORDER...' , 1 ) ;
3017 END IF;
3018
3019 -- Write to cache.
3020 Write_Line_Adj
3021 ( p_Line_Adj_rec => l_x_line_adj_tbl(1),
3022 p_db_record => TRUE
3023 );
3024
3025 -- Re-set the UI flag to FALSE
3026 OE_GLOBALS.G_UI_FLAG := FALSE;
3027
3028 -- Set return status.
3029
3030 x_return_status := FND_API.G_RET_STS_SUCCESS;
3031
3032 -- Get message count and data
3033
3034 OE_MSG_PUB.Count_And_Get
3035 ( p_count => x_msg_count
3036 , p_data => x_msg_data
3037 );
3038
3039 IF l_debug_level > 0 THEN
3040 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.REPLACE_ATTRIBUTES' , 1 ) ;
3041 END IF;
3042
3043 EXCEPTION
3044
3045 WHEN FND_API.G_EXC_ERROR THEN
3046
3047 OE_GLOBALS.G_UI_FLAG := FALSE;
3048
3049 x_return_status := FND_API.G_RET_STS_ERROR;
3050
3051 -- Get message count and data
3052
3053 OE_MSG_PUB.Count_And_Get
3054 ( p_count => x_msg_count
3055 , p_data => x_msg_data
3056 );
3057
3058 ROLLBACK TO SAVEPOINT replace_attributes;
3059
3060 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3061
3062 OE_GLOBALS.G_UI_FLAG := FALSE;
3063
3064 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3065
3066 -- Get message count and data
3067
3068 OE_MSG_PUB.Count_And_Get
3069 ( p_count => x_msg_count
3070 , p_data => x_msg_data
3071 );
3072
3073 ROLLBACK TO SAVEPOINT replace_attributes;
3074
3075 WHEN OTHERS THEN
3076
3077 OE_GLOBALS.G_UI_FLAG := FALSE;
3078
3079 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3080
3081 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3082 THEN
3083 OE_MSG_PUB.Add_Exc_Msg
3084 ( G_PKG_NAME
3085 , 'Replace_Attributes'
3086 );
3087 END IF;
3088
3089 -- Get message count and data
3090
3091 OE_MSG_PUB.Count_And_Get
3092 ( p_count => x_msg_count
3093 , p_data => x_msg_data
3094 );
3095
3096 ROLLBACK TO SAVEPOINT replace_attributes;
3097
3098 END replace_attributes;
3099
3100
3101
3102 -- Procedure lock_Row
3103 --
3104
3105 PROCEDURE Lock_Row
3106 ( x_return_status OUT NOCOPY VARCHAR2
3107
3108 , x_msg_count OUT NOCOPY NUMBER
3109
3110 , x_msg_data OUT NOCOPY VARCHAR2
3111
3112 , p_price_adjustment_id IN NUMBER
3113 , p_lock_control IN NUMBER
3114 )
3115 IS
3116 l_return_status VARCHAR2(1);
3117 l_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
3118 l_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
3119 l_x_Line_Adj_rec OE_Order_PUB.Line_Adj_Rec_Type;
3120 l_x_Line_Adj_tbl OE_Order_PUB.Line_Adj_Tbl_Type;
3121
3122 --
3123 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3124 --
3125 BEGIN
3126
3127 IF l_debug_level > 0 THEN
3128 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.LOCK_ROW' , 1 ) ;
3129 END IF;
3130
3131 -- Load Line_Adj record
3132
3133 l_x_Line_Adj_rec.operation := OE_GLOBALS.G_OPR_LOCK;
3134 l_x_Line_Adj_rec.lock_control := p_lock_control;
3135 l_x_Line_Adj_rec.price_adjustment_id := p_price_adjustment_id;
3136
3137 OE_Line_Adj_Util.Lock_Row
3138 ( x_return_status => l_return_status
3139 , p_x_line_adj_rec => l_x_line_adj_rec
3140 );
3141
3142 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3143
3144 -- Set DB flag and write record to cache.
3145 l_x_Line_Adj_rec.db_flag := FND_API.G_TRUE;
3146
3147 Write_Line_Adj
3148 ( p_Line_Adj_rec => l_x_Line_Adj_rec
3149 , p_db_record => TRUE
3150 );
3151
3152 END IF;
3153
3154 -- Set return status.
3155
3156 x_return_status := l_return_status;
3157
3158 -- Get message count and data
3159
3160 OE_MSG_PUB.Count_And_Get
3161 ( p_count => x_msg_count
3162 , p_data => x_msg_data
3163 );
3164
3165 IF l_debug_level > 0 THEN
3166 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.LOCK_ROW' , 1 ) ;
3167 END IF;
3168
3169 EXCEPTION
3170
3171 WHEN OTHERS THEN
3172
3173 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3174 THEN
3175 OE_MSG_PUB.Add_Exc_Msg
3176 ( G_PKG_NAME
3177 , 'Lock_Row'
3178 );
3179 END IF;
3180
3181 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3182
3183 -- Get message count and data
3184
3185 OE_MSG_PUB.Count_And_Get
3186 ( p_count => x_msg_count
3187 , p_data => x_msg_data
3188 );
3189
3190
3191
3192 END Lock_Row;
3193
3194
3195
3196 -- Procedures maintaining Header_Adj record cache.
3197
3198 PROCEDURE Write_Line_Adj
3199 ( p_Line_Adj_rec IN OE_Order_PUB.Line_Adj_Rec_Type
3200 , p_db_record IN BOOLEAN := FALSE
3201 )
3202 IS
3203 --
3204 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3205 --
3206 BEGIN
3207
3208 IF l_debug_level > 0 THEN
3209 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.WRITE_LINE_ADJ' , 1 ) ;
3210 END IF;
3211
3212 g_Line_Adj_rec := p_Line_Adj_rec;
3213
3214 IF p_db_record THEN
3215
3216 g_db_Line_Adj_rec := p_Line_Adj_rec;
3217
3218 END IF;
3219
3220 IF l_debug_level > 0 THEN
3221 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.WRITE_LINE_ADJ' , 1 ) ;
3222 END IF;
3223
3224 END Write_Line_Adj;
3225
3226
3227 PROCEDURE Get_Line_Adj
3228 ( p_db_record IN BOOLEAN := FALSE
3229 , p_price_adjustment_id IN NUMBER
3230 , x_Line_Adj_rec IN OUT NOCOPY OE_Order_PUB.Line_Adj_Rec_Type
3231 )
3232 IS
3233 --
3234 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3235 --
3236 BEGIN
3237
3238 IF l_debug_level > 0 THEN
3239 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.GET_LINE_ADJ' , 1 ) ;
3240 END IF;
3241
3242 IF p_price_adjustment_id <> g_Line_Adj_rec.price_adjustment_id
3243 THEN
3244
3245 -- Query row from DB
3246
3247 OE_Line_Adj_Util.Query_Row
3248 ( p_price_adjustment_id => p_price_adjustment_id
3249 , x_Line_Adj_rec => g_Line_Adj_rec
3250 );
3251
3252 g_Line_Adj_rec.db_flag := FND_API.G_TRUE;
3253
3254 -- Load DB record
3255
3256 g_db_Line_Adj_rec := g_Line_Adj_rec;
3257
3258 END IF;
3259
3260 IF l_debug_level > 0 THEN
3261 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.GET_LINE_ADJ' , 1 ) ;
3262 END IF;
3263
3264 IF p_db_record THEN
3265
3266 -- RETURN g_db_Line_Adj_rec;
3267 x_Line_Adj_rec := g_db_Line_Adj_rec;
3268
3269 ELSE
3270
3271 -- RETURN g_Line_Adj_rec;
3272 x_Line_Adj_rec := g_Line_Adj_rec;
3273
3274 END IF;
3275
3276 END Get_Line_Adj;
3277
3278
3279 PROCEDURE Clear_Line_Adj
3280 IS
3281 --
3282 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3283 --
3284 BEGIN
3285
3286 IF l_debug_level > 0 THEN
3287 oe_debug_pub.add( 'ENTERING OE_OE_FORM_LINE_ADJ.CLEAR_LINE_ADJ' , 1 ) ;
3288 END IF;
3289
3290 g_Line_Adj_rec := OE_Order_PUB.G_MISS_LINE_ADJ_REC;
3291 g_db_Line_Adj_rec := OE_Order_PUB.G_MISS_LINE_ADJ_REC;
3292
3293 IF l_debug_level > 0 THEN
3294 oe_debug_pub.add( 'EXITING OE_OE_FORM_LINE_ADJ.CLEAR_LINE_ADJ' , 1 ) ;
3295 END IF;
3296
3297 END Clear_Line_Adj;
3298
3299 --Manual Begin
3300 Procedure Insert_Row(p_line_adj_rec In Oe_Order_Pub.line_adj_rec_type
3301 ,x_return_status OUT NOCOPY VARCHAR2
3302
3303 ,x_msg_count OUT NOCOPY NUMBER
3304
3305 ,x_msg_data OUT NOCOPY VARCHAR2
3306
3307 ,x_price_adjustment_id OUT NOCOPY NUMBER) Is
3308
3309 l_Control_Rec OE_GLOBALS.Control_Rec_Type;
3310 l_line_adj_tbl Oe_Order_Pub.line_adj_tbl_type;
3311 l_line_rec Oe_Order_Pub.line_rec_type;
3312 l_dummy_tbl Oe_Order_Pub.line_adj_tbl_type;
3313 --
3314 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3315 --
3316 Begin
3317 l_line_adj_tbl(1) := p_line_adj_rec;
3318 l_control_rec.private_call := TRUE;
3319 l_control_rec.controlled_operation :=TRUE;
3320 l_control_rec.check_security := TRUE;
3321 l_control_rec.validate_entity := FALSE;
3322 l_control_rec.write_to_db := TRUE;
3323 --l_control_rec.change_attributes := FALSE;
3324 l_control_rec.change_attributes := TRUE;
3325
3326 -- lagrawal Bug 3673050
3327 OE_GLOBALS.G_UI_FLAG := TRUE;
3328
3329 If l_line_adj_tbl(1).operand_per_pqty is NULL Then
3330 If l_line_adj_tbl(1).line_id is not Null
3331 and l_line_adj_tbl(1).list_line_type_code Not In ('%','LUMPSUM')
3332 Then
3333 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_line_adj_tbl(1).line_id,
3334 x_line_rec=>l_line_rec);
3335
3336 If nvl(l_line_rec.pricing_quantity,0) <> 0 Then
3337 l_line_adj_tbl(1).operand_per_pqty := (l_line_adj_tbl(1).operand * l_line_rec.Ordered_Quantity)/l_line_rec.pricing_quantity;
3338 End If;
3339 End If;
3340
3341 If l_line_adj_tbl(1).operand_per_pqty is Null Then
3342 --still null after above deriviation
3343 l_line_adj_tbl(1).operand_per_pqty:=l_line_adj_tbl(1).operand;
3344 End If;
3345
3346 End If;
3347
3348 If l_line_adj_tbl(1).adjusted_amount_per_pqty is NULL Then
3349
3350 If l_line_rec.line_id Is Null and l_line_adj_tbl(1).line_id is not null Then
3351 --get line only if this line_rec does not exists
3352 Oe_Oe_Form_Line.Get_Line(p_line_id=>l_line_adj_tbl(1).line_id,
3353 x_line_rec=>l_line_rec);
3354 End If;
3355
3356 If nvl(l_line_rec.pricing_quantity,0) <> 0
3357 and l_line_adj_tbl(1).list_line_type_code <> 'LUMPSUM' Then
3358 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;
3359 End If;
3360
3361 If l_line_adj_tbl(1).adjusted_amount_per_pqty is Null Then
3362 l_line_adj_tbl(1).adjusted_amount_per_pqty:=l_line_adj_tbl(1).adjusted_amount;
3363 End If;
3364 End If;
3365
3366 l_line_adj_tbl(1).operation := OE_GLOBALS.G_OPR_CREATE;
3367
3368
3369 IF l_line_adj_tbl(1).range_break_quantity IS NULL
3370 AND l_line_adj_tbl(1).list_line_type_code = 'PBH'
3371 AND nvl(l_Line_Adj_Tbl(1).list_line_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM
3372 THEN
3373
3374 IF l_line_adj_tbl(1).UPDATED_FLAG IS NULL THEN
3375 l_line_adj_tbl(1).UPDATED_FLAG := 'Y';
3376 END IF;
3377
3378 BEGIN
3379 SELECT line_quantity
3380 INTO l_Line_Adj_tbl(1).range_break_quantity
3381 FROM qp_preq_ldets_tmp
3382 WHERE created_from_list_line_id = l_Line_Adj_tbl(1).list_line_id
3383 AND pricing_status_code = 'N'
3384 AND rownum = 1;
3385
3386 EXCEPTION WHEN OTHERS THEN
3387 -- lagrawal bug 3673050
3388 OE_GLOBALS.G_UI_FLAG := FALSE;
3389 IF l_debug_level > 0 THEN
3390 oe_debug_pub.add( ' IN OE_OE_FORM_LINE_ADJ.INSER_ROW:'||SQLERRM ) ;
3391 END IF;
3392 END;
3393 END IF;
3394
3395 IF l_debug_level > 0 THEN
3396 oe_debug_pub.add(' FLADB:l_line_adj_tbl(1).automatic_flag:'||l_line_adj_tbl(1).automatic_flag);
3397 oe_debug_pub.add(' FLADB:l_line_adj_tbl(1).updated_flag IS:'||l_line_adj_tbl(1).updated_flag);
3398 END IF;
3399
3400 IF l_line_adj_tbl(1).applied_flag = 'Y'
3401 AND l_line_adj_tbl(1).updated_flag IS NULL THEN
3402 l_line_adj_tbl(1).updated_flag := 'Y';
3403 END IF;
3404
3405 IF l_line_adj_tbl(1).automatic_flag IS NULL THEN
3406 l_line_adj_tbl(1).automatic_flag:='N';
3407 END IF;
3408
3409 SELECT OE_PRICE_ADJUSTMENTS_S.NEXTVAL
3410 INTO l_line_adj_tbl(1).price_adjustment_id
3411 FROM Dual;
3412
3413
3414 Oe_Order_Adj_Pvt.Line_Adjs(p_validation_level => FND_API.G_VALID_LEVEL_NONE,
3415 p_control_rec => l_control_rec,
3416 p_x_line_adj_tbl => l_line_adj_tbl,
3417 p_x_old_line_adj_tbl => l_dummy_tbl);
3418 x_price_adjustment_id := l_line_adj_tbl(1).price_adjustment_id;
3419
3420 -- lagrawal bug 3673050
3421 OE_GLOBALS.G_UI_FLAG := FALSE;
3422 Exception
3423 --Start for bug 12907745
3424 WHEN FND_API.G_EXC_ERROR THEN
3425
3426 OE_GLOBALS.G_UI_FLAG := FALSE;
3427 oe_debug_pub.add( 'IN FND_API.G_EXC_ERROR');
3428 x_return_status := FND_API.G_RET_STS_ERROR;
3429 -- Get message count and data
3430 OE_MSG_PUB.Count_And_Get
3431 ( p_count => x_msg_count
3432 , p_data => x_msg_data
3433 );
3434 -- end for bug 12907745
3435
3436 WHEN OTHERS THEN
3437
3438 OE_GLOBALS.G_UI_FLAG := FALSE;
3439
3440 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3441
3442 OE_MSG_PUB.Add_Exc_Msg
3443 ( G_PKG_NAME
3444 , 'Oe_Oe_Form_Line_Adj.Insert_Row:'||SQLERRM
3445 );
3446 IF l_debug_level > 0 THEN
3447 oe_debug_pub.add( 'OE_OE_FORM_LINE_ADJ.INSERT_ROW:'||SQLERRM ) ;
3448 END IF;
3449 -- Get message count and data
3450
3451 OE_MSG_PUB.Count_And_Get
3452 ( p_count => x_msg_count
3453 , p_data => x_msg_data
3454 );
3455
3456 --ROLLBACK TO SAVEPOINT
3457
3458 End;
3459 --Manual End;
3460
3461
3462 --This procedure returns related line ids given a top_model_line_Id.
3463 --If p_mode is set to 'OPTION' it will return options for this top_model_line
3464 --If p_mode is set to 'SERVICE' it will return service lines for options line of a top_model_line
3465 Procedure Get_Option_Service_Lines(p_top_model_line_id In Number,
3466 p_service_line_id In Number Default null,
3467 p_mode In VARCHAR2 Default 'SERVICE',
3468 x_line_id_tbl out nocopy Oe_Order_Adj_Pvt.Index_Tbl_Type) Is
3469
3470 Cursor service_cur is
3471 Select b.line_id
3472 From oe_order_lines_all a,
3473 oe_order_lines_all b,
3474 oe_order_lines_all c
3475 Where a.top_model_line_id = p_top_model_line_id
3476 and a.line_id <> p_top_model_line_id
3477 and a.line_id = b.service_reference_line_id
3478 and c.line_id = p_service_line_id
3479 and c.inventory_item_id = b.inventory_item_id
3480 and nvl(c.service_start_date,SYSDATE) = nvl(b.service_start_date,SYSDATE)
3481 and nvl(c.service_end_date,SYSDATE) = nvl(b.service_end_date,SYSDATE)
3482 and nvl(c.service_duration,0) = nvl(b.service_duration,0);
3483
3484
3485
3486 Cursor option_cur is
3487 Select line_id
3488 From oe_order_lines_all
3489 Where top_model_line_id = p_top_model_line_id
3490 and line_id <> p_top_model_line_id;
3491
3492 j PLS_INTEGER := 1;
3493
3494 --
3495 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3496 --
3497 Begin
3498 IF l_debug_level > 0 THEN
3499 oe_debug_pub.add( ' P_MODE:'||P_MODE ) ;
3500 END IF;
3501 IF l_debug_level > 0 THEN
3502 oe_debug_pub.add( ' P_TOP_MODEL_LINE_ID:'||P_TOP_MODEL_LINE_ID ) ;
3503 END IF;
3504 IF l_debug_level > 0 THEN
3505 oe_debug_pub.add( ' P_SERVICE_LINE_ID:'||P_SERVICE_LINE_ID ) ;
3506 END IF;
3507
3508 If p_mode = 'SERVICE' Then
3509 For i in service_cur Loop
3510 x_line_id_tbl(j):= i.line_id;
3511 IF l_debug_level > 0 THEN
3512 oe_debug_pub.add( ' SERVICE CHILD LINES ID:'||I.LINE_ID ) ;
3513 END IF;
3514 j:=j+1;
3515 End Loop;
3516 Elsif p_mode = 'OPTION' Then
3517 For i in option_cur Loop
3518 IF l_debug_level > 0 THEN
3519 oe_debug_pub.add( ' LINE ID:'||I.LINE_ID ) ;
3520 END IF;
3521 x_line_id_tbl(j):= i.line_id;
3522 j:=j+1;
3523 End Loop;
3524 IF l_debug_level > 0 THEN
3525 oe_debug_pub.add( ' X_LINE_ID_TBL.COUNT:'|| X_LINE_ID_TBL.COUNT ) ;
3526 END IF;
3527 End If;
3528 Exception When Others Then
3529 IF l_debug_level > 0 THEN
3530 oe_debug_pub.add( ' EXECPTION IN OE_OE_FORM_LINE_ADJ:'||SQLERRM ) ;
3531 END IF;
3532 End;
3533
3534 --This Procedure will either change,create or delete adjustments
3535 --based on parent adjustment record
3536 Procedure Process_Adj(p_parent_adj_rec In Oe_Order_Pub.Line_Adj_Rec_Type,
3537 p_line_id_tbl In Oe_Order_Adj_Pvt.Index_Tbl_Type,
3538 p_delete_flag In Varchar2 Default 'N' ,
3539 p_create_adj_no_validate In Boolean Default FALSE) Is
3540
3541 Cursor adjustment_cur(p_list_line_id Number ,p_line_id Number) Is
3542 Select price_adjustment_id,operand,change_reason_code
3543 From oe_price_adjustments
3544 Where line_id = p_line_id
3545 and list_line_id = p_list_line_id;
3546
3547 i PLS_INTEGER;
3548 l_price_adjustment_id Number;
3549 l_operand Number;
3550 l_line_adj_rec Oe_Order_Pub.line_adj_rec_type;
3551 l_return_status VARCHAR2(5);
3552 l_msg_count Number;
3553 l_msg_data VARCHAR2(500);
3554 lx_price_adjustment_id Number;
3555 l_reason_code Varchar2(30);
3556 stmt Number;
3557 --
3558 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
3559 --
3560 Begin
3561
3562 If nvl(p_parent_adj_rec.operand,FND_API.G_MISS_NUM) = FND_API.G_MISS_NUM Then
3563 IF l_debug_level > 0 THEN
3564 oe_debug_pub.add( ' CS PARENT OPERAND IS NULL' ) ;
3565 END IF;
3566 Return;
3567 End If;
3568
3569 i := p_line_id_tbl.First;
3570 While i is Not Null Loop
3571 stmt:=1;
3572 l_price_adjustment_id := Null;
3573 Open adjustment_cur(p_parent_adj_rec.list_line_id,p_line_id_tbl(i));
3574 Fetch adjustment_cur into l_price_adjustment_id,l_operand,l_reason_code;
3575
3576 IF l_debug_level > 0 THEN
3577 oe_debug_pub.add( ' CS PRICE ADJUSTMENT ID:'||L_PRICE_ADJUSTMENT_ID ) ;
3578 END IF;
3579 IF l_debug_level > 0 THEN
3580 oe_debug_pub.add( ' CS L_OPERAND:'||L_OPERAND ) ;
3581 END IF;
3582 IF l_debug_level > 0 THEN
3583 oe_debug_pub.add( ' CS PARENT OPERAND:'||P_PARENT_ADJ_REC.OPERAND ) ;
3584 END IF;
3585 IF l_debug_level > 0 THEN
3586 oe_debug_pub.add( ' CS SERVICE OPTION LINE ID:'|| P_LINE_ID_TBL ( I ) ) ;
3587 END IF;
3588 IF l_debug_level > 0 THEN
3589 oe_debug_pub.add( ' CS PARENT LIST_LINE_ID:'||P_PARENT_ADJ_REC.LIST_LINE_ID ) ;
3590 END IF;
3591 IF l_debug_level > 0 THEN
3592 oe_debug_pub.add( ' CS PARENT CHANGE REASON CODE:'||P_PARENT_ADJ_REC.CHANGE_REASON_CODE ) ;
3593 END IF;
3594 If p_delete_flag = 'N' Then
3595 If l_price_adjustment_id is Not Null Then
3596 --Update required, a same adjustment exists
3597 If l_operand <> p_parent_adj_rec.operand or
3598 nvl(l_reason_code,'NULLreasonCode+') <> p_parent_adj_rec.change_reason_code Then
3599
3600 If p_parent_adj_rec.change_reason_code is Null Then
3601 l_reason_code:='MISC';
3602 Else
3603 l_reason_code:=p_parent_adj_rec.change_reason_code;
3604 End If;
3605 stmt:=2;
3606 Replace_Attributes(x_return_status => l_return_status,
3607 x_msg_count => l_msg_count,
3608 x_msg_data => l_msg_data,
3609 p_price_adjustment_id => l_price_adjustment_id,
3610 p_adjusted_amount => p_parent_adj_rec.adjusted_amount,
3611 p_adjusted_amount_per_pqty =>p_parent_adj_rec.adjusted_amount_per_pqty,
3612 p_arithmetic_operator => p_parent_adj_rec.arithmetic_operator,
3613 p_operand => p_parent_adj_rec.operand,
3614 p_operand_per_pqty => p_parent_adj_rec.operand_per_pqty,
3615 p_applied_flag => 'Y',
3616 p_updated_flag => 'Y',
3617 p_change_reason_code => l_reason_code,
3618 p_change_reason_text => 'Top model line adjustments has been changed');
3619 End If;
3620 Else
3621 If p_create_adj_no_validate Then --just create adjustment without revalidation against engine
3622 --Create requiredx
3623 IF l_debug_level > 0 THEN
3624 oe_debug_pub.add( ' CS INSERTING NEW CHILDREN' ) ;
3625 END IF;
3626 l_line_adj_Rec := p_parent_adj_rec;
3627 l_line_adj_rec.line_id := p_line_id_tbl(i);
3628 stmt:=3;
3629 Insert_Row(l_line_adj_Rec,l_return_status,l_msg_count,l_msg_data,lx_price_adjustment_id);
3630 /* 1905650
3631 G_PRICE_ADJ request should be logged against LINE entity, not
3632 against LINE_ADJ entity
3633 */
3634 oe_delayed_requests_pvt.log_request(
3635 p_entity_code => OE_GLOBALS.G_ENTITY_LINE,
3636 p_entity_id => p_line_id_tbl(i),
3637 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE_ADJ,
3638 p_requesting_entity_id => p_line_id_tbl(i),
3639 p_request_type => OE_GLOBALS.G_PRICE_ADJ,
3640 x_return_status => l_return_status);
3641 End If; --end if for create_adj_no_validate
3642 End If;
3643 Elsif p_delete_flag = 'Y' Then
3644 If l_price_adjustment_id is not Null Then
3645 stmt:=4;
3646 OE_Header_Adj_Util.Delete_Row
3647 ( p_price_adjustment_id => l_price_adjustment_id
3648 );
3649
3650 /* 1905650
3651 G_PRICE_ADJ request should be logged against LINE entity,
3652 not against LINE_ADJ entity
3653 */
3654 oe_delayed_requests_pvt.log_request(
3655 p_entity_code => OE_GLOBALS.G_ENTITY_LINE,
3656 p_entity_id => p_line_id_tbl(i),
3657 p_requesting_entity_code => OE_GLOBALS.G_ENTITY_LINE_ADJ,
3658 p_requesting_entity_id => p_line_id_tbl(i),
3659 p_request_type => OE_GLOBALS.G_PRICE_ADJ,
3660 x_return_status => l_return_status);
3661
3662 End If;
3663 End If;
3664
3665
3666
3667
3668
3669 Close adjustment_cur;
3670 i:=p_line_id_tbl.next(i);
3671 End Loop;
3672
3673 Exception When Others Then
3674 IF l_debug_level > 0 THEN
3675 oe_debug_pub.add( 'IN OE_OE_FORM_LINE_ADJ.PROCESS_ADJ:'||SQLERRM||':'||STMT ) ;
3676 END IF;
3677 End;
3678
3679
3680 END OE_OE_Form_Line_Adj;