DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_REJECTED_LINES_ACK

Source


1 PACKAGE BODY OE_Rejected_Lines_Ack AS
2 /* $Header: OEXVRAKB.pls 115.13 2003/10/31 01:56:50 jjmcfarl ship $ */
3 
4 PROCEDURE Get_Rejected_Lines(
5    p_request_id			IN  NUMBER
6   ,p_order_source_id		IN  NUMBER
7   ,p_orig_sys_document_ref      IN  VARCHAR2
8   ,p_change_sequence            IN  VARCHAR2
9   ,x_rejected_line_tbl          IN OUT NOCOPY OE_Order_Pub.Line_Tbl_Type
10   ,x_rejected_line_val_tbl     OUT NOCOPY OE_Order_Pub.Line_Val_Tbl_Type
11   ,x_rejected_lot_serial_tbl    IN OUT NOCOPY OE_Order_Pub.Lot_Serial_Tbl_Type
12   ,x_return_status             OUT NOCOPY VARCHAR2
13   ,p_header_id                  IN NUMBER
14   ,p_sold_to_org                IN VARCHAR2
15   ,p_sold_to_org_id             IN NUMBER
16 ) is
17 
18   l_line_rec                    OE_Order_Pub.Line_Rec_Type;
19   l_line_tbl                    OE_Order_Pub.Line_Tbl_Type;
20   l_line_val_rec                OE_Order_Pub.Line_Val_Rec_Type;
21   l_line_val_tbl                OE_Order_Pub.Line_Val_Tbl_Type;
22   l_lot_serial_rec         	OE_Order_Pub.Lot_Serial_Rec_Type;
23   l_lot_serial_tbl         	OE_Order_Pub.Lot_Serial_Tbl_Type;
24 
25   l_request_id			NUMBER		:= p_request_id;
26   l_order_source_id		NUMBER		:= p_order_source_id;
27   l_orig_sys_document_ref	VARCHAR2(50) 	:= p_orig_sys_document_ref;
28   l_change_sequence		VARCHAR2(50) 	:= p_change_sequence;
29   l_orig_sys_line_ref		VARCHAR2(50);
30   l_orig_sys_shipment_ref	VARCHAR2(50);
31 
32   l_line_count                  NUMBER := 0;
33   l_lot_serial_count            NUMBER;
34 
35   -- Declared as part of fix 2922709
36   l_header_id                   NUMBER          := p_header_id;
37   l_segment_array  fnd_flex_ext.segmentarray;
38 
39   l_api_name           CONSTANT VARCHAR2(30) := 'Get_Rejected_Lines';
40   l_customer_key_profile        VARCHAR2(1) := 'N';
41 /* -----------------------------------------------------------
42    Lines cursor
43    -----------------------------------------------------------
44 */
45     CURSOR l_line_cursor IS
46     SELECT nvl(order_source_id,			FND_API.G_MISS_NUM)
47     	 , nvl(orig_sys_document_ref,		FND_API.G_MISS_CHAR)
48     	 , nvl(orig_sys_line_ref,		FND_API.G_MISS_CHAR)
49 	 , nvl(orig_sys_shipment_ref,		FND_API.G_MISS_CHAR)
50 	 , nvl(change_request_code,		FND_API.G_MISS_CHAR)
51 	 , nvl(org_id,				FND_API.G_MISS_NUM)
52 	 , nvl(line_number,			FND_API.G_MISS_NUM)
53 	 , nvl(shipment_number,			FND_API.G_MISS_NUM)
54 	 , nvl(line_id,				FND_API.G_MISS_NUM)
55 	 , nvl(line_type_id,			FND_API.G_MISS_NUM)
56 	 , line_type
57 	 , nvl(item_type_code,			FND_API.G_MISS_CHAR)
58 	 , nvl(inventory_item_id,		FND_API.G_MISS_NUM)
59 	 , inventory_item
60 	 , nvl(top_model_line_ref,		FND_API.G_MISS_CHAR)
61 	 , nvl(link_to_line_ref,		FND_API.G_MISS_CHAR)
62 	 , nvl(explosion_date,			FND_API.G_MISS_DATE)
63 	 , nvl(ato_line_id,			FND_API.G_MISS_NUM)
64 	 , nvl(component_sequence_id,		FND_API.G_MISS_NUM)
65 	 , nvl(component_code,			FND_API.G_MISS_CHAR)
66 	 , nvl(sort_order,			FND_API.G_MISS_CHAR)
67 	 , nvl(model_group_number,		FND_API.G_MISS_NUM)
68 	 , nvl(option_number,			FND_API.G_MISS_NUM)
69 	 , nvl(option_flag,			'N')
70 	 , nvl(ship_model_complete_flag,	FND_API.G_MISS_CHAR)
71 	 , nvl(source_type_code,		FND_API.G_MISS_CHAR)
72 	 , nvl(schedule_status_code,		FND_API.G_MISS_CHAR)
73 	 , nvl(schedule_ship_date,		FND_API.G_MISS_DATE)
74          , nvl(late_demand_penalty_factor,      FND_API.G_MISS_NUM)
75 	 , nvl(schedule_arrival_date,		FND_API.G_MISS_DATE)
76 	 , nvl(actual_arrival_date,		FND_API.G_MISS_DATE)
77   	 , nvl(request_date,			FND_API.G_MISS_DATE)
78 	 , nvl(promise_date,			FND_API.G_MISS_DATE)
79 	 , nvl(delivery_lead_time,		FND_API.G_MISS_NUM)
80 	 , nvl(ordered_quantity,		FND_API.G_MISS_NUM)
81 	 , nvl(order_quantity_uom ,		FND_API.G_MISS_CHAR)
82 	 , nvl(shipping_quantity,		FND_API.G_MISS_NUM)
83 	 , nvl(shipping_quantity_uom,		FND_API.G_MISS_CHAR)
84 	 , nvl(shipped_quantity,		FND_API.G_MISS_NUM)
85 	 , nvl(cancelled_quantity,		FND_API.G_MISS_NUM)
86 	 , nvl(fulfilled_quantity,		FND_API.G_MISS_NUM)
87    /* OPM variables */
88          , nvl(ordered_quantity2,               FND_API.G_MISS_NUM)
89          , nvl(ordered_quantity_uom2 ,          FND_API.G_MISS_CHAR)
90          , nvl(shipping_quantity2,              FND_API.G_MISS_NUM)
91          , nvl(shipping_quantity_uom2,          FND_API.G_MISS_CHAR)
92          , nvl(shipped_quantity2,               FND_API.G_MISS_NUM)
93          , nvl(cancelled_quantity2,             FND_API.G_MISS_NUM)
94          , nvl(fulfilled_quantity2,             FND_API.G_MISS_NUM)
95          , nvl(preferred_grade,                 FND_API.G_MISS_CHAR)
96    /* end of OPM variables */
97 	 , nvl(pricing_quantity,		FND_API.G_MISS_NUM)
98 	 , nvl(pricing_quantity_uom,		FND_API.G_MISS_CHAR)
99 	 , nvl(sold_from_org_id,		FND_API.G_MISS_NUM)
100 	 , sold_from_org
101 	 , nvl(sold_to_org_id ,			FND_API.G_MISS_NUM)
102 	 , sold_to_org
103 	 , nvl(ship_from_org_id,		FND_API.G_MISS_NUM)
104 	 , ship_from_org
105 	 , nvl(ship_to_org_id ,			FND_API.G_MISS_NUM)
106 	 , ship_to_org
107 	 , nvl(deliver_to_org_id,		FND_API.G_MISS_NUM)
108 	 , deliver_to_org
109 	 , nvl(invoice_to_org_id,		FND_API.G_MISS_NUM)
110 	 , invoice_to_org
111 	 , ship_to_address1
112 	 , ship_to_address2
113 	 , ship_to_address3
114 	 , ship_to_address4
115 	 , ship_to_city
116 	 , ship_to_state
117 	 , ship_to_postal_code
118 	 , ship_to_country
119 	 , nvl(ship_to_contact_id,		FND_API.G_MISS_NUM)
120 	 , ship_to_contact
121 	 , nvl(deliver_to_contact_id,		FND_API.G_MISS_NUM)
122 	 , deliver_to_contact
123 	 , nvl(invoice_to_contact_id,		FND_API.G_MISS_NUM)
124 	 , invoice_to_contact
125 	 , nvl(drop_ship_flag,			FND_API.G_MISS_CHAR)
126 	 , nvl(ship_tolerance_above,		FND_API.G_MISS_NUM)
127 	 , nvl(ship_tolerance_below,		FND_API.G_MISS_NUM)
128 	 , nvl(price_list_id,			FND_API.G_MISS_NUM)
129 	 , price_list
130 	 , nvl(pricing_date,			FND_API.G_MISS_DATE)
131 	 , nvl(unit_list_price,			FND_API.G_MISS_NUM)
132 	 , nvl(unit_selling_price,		FND_API.G_MISS_NUM)
133 	 , nvl(calculate_price_flag,		'Y')
134 	 , nvl(ship_set_id,			FND_API.G_MISS_NUM)
135 	 , nvl(ship_set_name,			FND_API.G_MISS_CHAR)
136 	 , nvl(arrival_set_id,			FND_API.G_MISS_NUM)
137 	 , nvl(arrival_set_name,		FND_API.G_MISS_CHAR)
138 	 , nvl(fulfillment_set_id,		FND_API.G_MISS_NUM)
139 	 , nvl(fulfillment_set_name,		FND_API.G_MISS_CHAR)
140 	 , nvl(tax_code,			FND_API.G_MISS_CHAR)
141 	 , nvl(tax_value,			FND_API.G_MISS_NUM)
142 	 , nvl(tax_date,			FND_API.G_MISS_DATE)
143 	 , nvl(tax_point_code,			FND_API.G_MISS_CHAR)
144 	 , tax_point
145 	 , nvl(tax_exempt_flag,			FND_API.G_MISS_CHAR)
146 	 , nvl(tax_exempt_number,		FND_API.G_MISS_CHAR)
147 	 , nvl(tax_exempt_reason_code,		FND_API.G_MISS_CHAR)
148 	 , tax_exempt_reason
149 	 , nvl(agreement_id,			FND_API.G_MISS_NUM)
150 	 , agreement
151 	 , nvl(invoicing_rule_id,		FND_API.G_MISS_NUM)
152 	 , invoicing_rule
153 	 , nvl(accounting_rule_id,		FND_API.G_MISS_NUM)
154 	 , nvl(accounting_rule_duration,	FND_API.G_MISS_NUM)
155 	 , accounting_rule
156 	 , nvl(payment_term_id,			FND_API.G_MISS_NUM)
157 	 , payment_term
158 	 , nvl(demand_class_code,		FND_API.G_MISS_CHAR)
159 	 , nvl(shipment_priority_code,		FND_API.G_MISS_CHAR)
160 	 , shipment_priority
161 	 , nvl(shipping_method_code,		FND_API.G_MISS_CHAR)
162 	 , nvl(shipping_instructions,		FND_API.G_MISS_CHAR)
163 	 , nvl(packing_instructions,		FND_API.G_MISS_CHAR)
164 	 , nvl(freight_carrier_code,		FND_API.G_MISS_CHAR)
165 	 , nvl(freight_terms_code,		FND_API.G_MISS_CHAR)
166 	 , freight_terms
167 	 , nvl(fob_point_code,			FND_API.G_MISS_CHAR)
168 	 , fob_point
169 	 , nvl(return_reason_code,		FND_API.G_MISS_CHAR)
170 	 , nvl(reference_type,			FND_API.G_MISS_CHAR)
171 	 , nvl(reference_header_id,		FND_API.G_MISS_NUM)
172 	 , nvl(reference_line_id,		FND_API.G_MISS_NUM)
173 	 , nvl(credit_invoice_line_id,		FND_API.G_MISS_NUM)
174 	 , nvl(customer_po_number,		FND_API.G_MISS_CHAR)
175 	 , nvl(customer_line_number,		FND_API.G_MISS_CHAR)
176 	 , nvl(customer_shipment_number,	FND_API.G_MISS_CHAR)
177 	 , nvl(customer_item_id,		FND_API.G_MISS_NUM)
178 	 , nvl(customer_item_id_type,		FND_API.G_MISS_CHAR)
179 	 , nvl(customer_item_name,		FND_API.G_MISS_CHAR)
180 --	 , nvl(customer_item_revision,		FND_API.G_MISS_CHAR)
181 	 , nvl(customer_item_net_price,		FND_API.G_MISS_NUM)
182 	 , nvl(customer_payment_term_id,	FND_API.G_MISS_NUM)
183 	 , customer_payment_term
184 	 , nvl(demand_bucket_type_code,		FND_API.G_MISS_CHAR)
185 	 , demand_bucket_type
186 	 , nvl(customer_dock_code,		FND_API.G_MISS_CHAR)
187 	 , nvl(customer_job,			FND_API.G_MISS_CHAR)
188 	 , nvl(customer_production_line,	FND_API.G_MISS_CHAR)
189 	 , nvl(cust_model_serial_number,	FND_API.G_MISS_CHAR)
190 	 , nvl(project_id,			FND_API.G_MISS_NUM)
191 	 , project
192 	 , nvl(task_id,				FND_API.G_MISS_NUM)
193 	 , task
194 	 , nvl(end_item_unit_number,		FND_API.G_MISS_CHAR)
195 	 , nvl(item_revision,			FND_API.G_MISS_CHAR)
196 	 , nvl(service_duration,		FND_API.G_MISS_NUM)
197 	 , nvl(service_period,			FND_API.G_MISS_CHAR)
198 	 , nvl(service_start_date,		FND_API.G_MISS_DATE)
199 	 , nvl(service_end_date,		FND_API.G_MISS_DATE)
200 	 , nvl(service_coterminate_flag,	FND_API.G_MISS_CHAR)
201 	 , nvl(unit_selling_percent,		FND_API.G_MISS_NUM)
202 	 , nvl(unit_list_percent,		FND_API.G_MISS_NUM)
203 	 , nvl(unit_percent_base_price,		FND_API.G_MISS_NUM)
204 	 , nvl(service_number,			FND_API.G_MISS_NUM)
205 --	 , nvl(fulfilled_flag,			FND_API.G_MISS_CHAR)--ToBeAdded
206 --	 , nvl(closed_flag,			FND_API.G_MISS_CHAR)
207 	 , nvl(cancelled_flag,			FND_API.G_MISS_CHAR)
208 	 , nvl(context,                         FND_API.G_MISS_CHAR)
209 	 , nvl(attribute1,			FND_API.G_MISS_CHAR)
210 	 , nvl(attribute2,			FND_API.G_MISS_CHAR)
211 	 , nvl(attribute3,			FND_API.G_MISS_CHAR)
212 	 , nvl(attribute4,			FND_API.G_MISS_CHAR)
213 	 , nvl(attribute5,			FND_API.G_MISS_CHAR)
214 	 , nvl(attribute6,			FND_API.G_MISS_CHAR)
215 	 , nvl(attribute7,			FND_API.G_MISS_CHAR)
216 	 , nvl(attribute8,			FND_API.G_MISS_CHAR)
217 	 , nvl(attribute9,			FND_API.G_MISS_CHAR)
218 	 , nvl(attribute10,			FND_API.G_MISS_CHAR)
219 	 , nvl(attribute11,			FND_API.G_MISS_CHAR)
220 	 , nvl(attribute12,			FND_API.G_MISS_CHAR)
221 	 , nvl(attribute13,			FND_API.G_MISS_CHAR)
222 	 , nvl(attribute14,			FND_API.G_MISS_CHAR)
223 	 , nvl(attribute15,			FND_API.G_MISS_CHAR)
224 	 , nvl(attribute16,			FND_API.G_MISS_CHAR)  -- for bug 2184255
225 	 , nvl(attribute17,			FND_API.G_MISS_CHAR)
226 	 , nvl(attribute18,			FND_API.G_MISS_CHAR)
227 	 , nvl(attribute19,			FND_API.G_MISS_CHAR)
228 	 , nvl(attribute20,			FND_API.G_MISS_CHAR)
229 	 , nvl(tp_context,			FND_API.G_MISS_CHAR)
230 	 , nvl(tp_attribute1,			FND_API.G_MISS_CHAR)
231 	 , nvl(tp_attribute2,			FND_API.G_MISS_CHAR)
232 	 , nvl(tp_attribute3,			FND_API.G_MISS_CHAR)
233 	 , nvl(tp_attribute4,			FND_API.G_MISS_CHAR)
234 	 , nvl(tp_attribute5,			FND_API.G_MISS_CHAR)
235 	 , nvl(tp_attribute6,			FND_API.G_MISS_CHAR)
236 	 , nvl(tp_attribute7,			FND_API.G_MISS_CHAR)
237 	 , nvl(tp_attribute8,			FND_API.G_MISS_CHAR)
238 	 , nvl(tp_attribute9,			FND_API.G_MISS_CHAR)
239 	 , nvl(tp_attribute10,			FND_API.G_MISS_CHAR)
240 	 , nvl(tp_attribute11,			FND_API.G_MISS_CHAR)
241 	 , nvl(tp_attribute12,			FND_API.G_MISS_CHAR)
242 	 , nvl(tp_attribute13,			FND_API.G_MISS_CHAR)
243 	 , nvl(tp_attribute14,			FND_API.G_MISS_CHAR)
244 	 , nvl(tp_attribute15,			FND_API.G_MISS_CHAR)
245 	 , nvl(industry_context,		FND_API.G_MISS_CHAR)
246 	 , nvl(industry_attribute1,		FND_API.G_MISS_CHAR)
247 	 , nvl(industry_attribute2,		FND_API.G_MISS_CHAR)
248 	 , nvl(industry_attribute3,		FND_API.G_MISS_CHAR)
249 	 , nvl(industry_attribute4,		FND_API.G_MISS_CHAR)
250 	 , nvl(industry_attribute5,		FND_API.G_MISS_CHAR)
251 	 , nvl(industry_attribute6,		FND_API.G_MISS_CHAR)
252 	 , nvl(industry_attribute7,		FND_API.G_MISS_CHAR)
253 	 , nvl(industry_attribute8,		FND_API.G_MISS_CHAR)
254 	 , nvl(industry_attribute9,		FND_API.G_MISS_CHAR)
255 	 , nvl(industry_attribute10,		FND_API.G_MISS_CHAR)
256 	 , nvl(industry_attribute11,		FND_API.G_MISS_CHAR)
257 	 , nvl(industry_attribute12,		FND_API.G_MISS_CHAR)
258 	 , nvl(industry_attribute13,		FND_API.G_MISS_CHAR)
259 	 , nvl(industry_attribute14,		FND_API.G_MISS_CHAR)
260 	 , nvl(industry_attribute15,		FND_API.G_MISS_CHAR)
261 	 , nvl(industry_attribute16,		FND_API.G_MISS_CHAR)
262 	 , nvl(industry_attribute17,		FND_API.G_MISS_CHAR)
263 	 , nvl(industry_attribute18,		FND_API.G_MISS_CHAR)
264 	 , nvl(industry_attribute19,		FND_API.G_MISS_CHAR)
265 	 , nvl(industry_attribute20,		FND_API.G_MISS_CHAR)
266 	 , nvl(industry_attribute21,		FND_API.G_MISS_CHAR)
267 	 , nvl(industry_attribute22,		FND_API.G_MISS_CHAR)
268 	 , nvl(industry_attribute23,		FND_API.G_MISS_CHAR)
269 	 , nvl(industry_attribute24,		FND_API.G_MISS_CHAR)
270 	 , nvl(industry_attribute25,		FND_API.G_MISS_CHAR)
271 	 , nvl(industry_attribute26,		FND_API.G_MISS_CHAR)
272 	 , nvl(industry_attribute27,		FND_API.G_MISS_CHAR)
273 	 , nvl(industry_attribute28,		FND_API.G_MISS_CHAR)
274 	 , nvl(industry_attribute29,		FND_API.G_MISS_CHAR)
275 	 , nvl(industry_attribute30,		FND_API.G_MISS_CHAR)
276 	 , nvl(pricing_context,			FND_API.G_MISS_CHAR)
277 	 , nvl(pricing_attribute1,		FND_API.G_MISS_CHAR)
278 	 , nvl(pricing_attribute2,		FND_API.G_MISS_CHAR)
279 	 , nvl(pricing_attribute3,		FND_API.G_MISS_CHAR)
280 	 , nvl(pricing_attribute4,		FND_API.G_MISS_CHAR)
281 	 , nvl(pricing_attribute5,		FND_API.G_MISS_CHAR)
282 	 , nvl(pricing_attribute6,		FND_API.G_MISS_CHAR)
283 	 , nvl(pricing_attribute7,		FND_API.G_MISS_CHAR)
284 	 , nvl(pricing_attribute8,		FND_API.G_MISS_CHAR)
285 	 , nvl(pricing_attribute9,		FND_API.G_MISS_CHAR)
286 	 , nvl(pricing_attribute10,		FND_API.G_MISS_CHAR)
287 	 , nvl(global_attribute_category,	FND_API.G_MISS_CHAR)
288 	 , nvl(global_attribute1,		FND_API.G_MISS_CHAR)
289 	 , nvl(global_attribute2,		FND_API.G_MISS_CHAR)
290 	 , nvl(global_attribute3,		FND_API.G_MISS_CHAR)
291 	 , nvl(global_attribute4,		FND_API.G_MISS_CHAR)
292 	 , nvl(global_attribute5,		FND_API.G_MISS_CHAR)
293 	 , nvl(global_attribute6,		FND_API.G_MISS_CHAR)
294 	 , nvl(global_attribute7,		FND_API.G_MISS_CHAR)
295 	 , nvl(global_attribute8,		FND_API.G_MISS_CHAR)
296 	 , nvl(global_attribute9,		FND_API.G_MISS_CHAR)
297 	 , nvl(global_attribute10,		FND_API.G_MISS_CHAR)
298 	 , nvl(global_attribute11,		FND_API.G_MISS_CHAR)
299 	 , nvl(global_attribute12,		FND_API.G_MISS_CHAR)
300 	 , nvl(global_attribute13,		FND_API.G_MISS_CHAR)
301 	 , nvl(global_attribute14,		FND_API.G_MISS_CHAR)
302 	 , nvl(global_attribute15,		FND_API.G_MISS_CHAR)
303 	 , nvl(global_attribute16,		FND_API.G_MISS_CHAR)
304 	 , nvl(global_attribute17,		FND_API.G_MISS_CHAR)
305 	 , nvl(global_attribute18,		FND_API.G_MISS_CHAR)
306 	 , nvl(global_attribute19,		FND_API.G_MISS_CHAR)
307 	 , nvl(global_attribute20,		FND_API.G_MISS_CHAR)
308 	 , nvl(return_context,                  FND_API.G_MISS_CHAR)
309 	 , nvl(return_attribute1,		FND_API.G_MISS_CHAR)
310 	 , nvl(return_attribute2,		FND_API.G_MISS_CHAR)
311 	 , nvl(return_attribute3,		FND_API.G_MISS_CHAR)
312 	 , nvl(return_attribute4,		FND_API.G_MISS_CHAR)
313 	 , nvl(return_attribute5,		FND_API.G_MISS_CHAR)
314 	 , nvl(return_attribute6,		FND_API.G_MISS_CHAR)
315 	 , nvl(return_attribute7,		FND_API.G_MISS_CHAR)
316 	 , nvl(return_attribute8,		FND_API.G_MISS_CHAR)
317 	 , nvl(return_attribute9,		FND_API.G_MISS_CHAR)
318 	 , nvl(return_attribute10,		FND_API.G_MISS_CHAR)
319 	 , nvl(return_attribute11,		FND_API.G_MISS_CHAR)
320 	 , nvl(return_attribute12,		FND_API.G_MISS_CHAR)
321 	 , nvl(return_attribute13,		FND_API.G_MISS_CHAR)
322 	 , nvl(return_attribute14,		FND_API.G_MISS_CHAR)
323 	 , nvl(return_attribute15,		FND_API.G_MISS_CHAR)
324          , request_id
325 	 , nvl(operation_code,			OE_GLOBALS.G_OPR_CREATE)
326 	 , nvl(status_flag,		        FND_API.G_MISS_CHAR)
327 	 , nvl(change_reason,			FND_API.G_MISS_CHAR)
328 	 , nvl(change_comments,			FND_API.G_MISS_CHAR)
329 	 , nvl(service_txn_reason_code,	        FND_API.G_MISS_CHAR)
330 	 , nvl(service_txn_comments,		FND_API.G_MISS_CHAR)
331 	 , nvl(service_reference_type_code,     FND_API.G_MISS_CHAR)
332 	 , nvl(service_reference_order,	        FND_API.G_MISS_CHAR)
333 	 , nvl(service_reference_line,	        FND_API.G_MISS_CHAR)
334 	 , nvl(service_reference_system,	FND_API.G_MISS_CHAR)
335 	 , INVENTORY_ITEM_SEGMENT_1
336 	 , INVENTORY_ITEM_SEGMENT_2
337 	 , INVENTORY_ITEM_SEGMENT_3
338 	 , INVENTORY_ITEM_SEGMENT_4
339 	 , INVENTORY_ITEM_SEGMENT_5
340 	 , INVENTORY_ITEM_SEGMENT_6
341 	 , INVENTORY_ITEM_SEGMENT_7
342 	 , INVENTORY_ITEM_SEGMENT_8
343 	 , INVENTORY_ITEM_SEGMENT_9
344 	 , INVENTORY_ITEM_SEGMENT_10
345 	 , INVENTORY_ITEM_SEGMENT_11
346 	 , INVENTORY_ITEM_SEGMENT_12
347 	 , INVENTORY_ITEM_SEGMENT_13
348 	 , INVENTORY_ITEM_SEGMENT_14
349 	 , INVENTORY_ITEM_SEGMENT_15
350 	 , INVENTORY_ITEM_SEGMENT_16
351 	 , INVENTORY_ITEM_SEGMENT_17
352 	 , INVENTORY_ITEM_SEGMENT_18
353 	 , INVENTORY_ITEM_SEGMENT_19
354 	 , INVENTORY_ITEM_SEGMENT_20
355 	 , commitment
356 	 , nvl(commitment_id,   		  FND_API.G_MISS_NUM)
357 -- aksingh subinventory
358          , nvl(subinventory,                      FND_API.G_MISS_CHAR)
359          , salesrep
360          , nvl(salesrep_id,                       FND_API.G_MISS_NUM)
361          , nvl(earliest_acceptable_date,          FND_API.G_MISS_DATE)
362          , nvl(latest_acceptable_date,            FND_API.G_MISS_DATE)
363          , split_from_line_ref --bsadri
364          , split_from_shipment_ref
365 	 , invoice_to_address1
366 	 , invoice_to_address2
367 	 , invoice_to_address3
368 	 , invoice_to_address4
369 	 , invoice_to_city
370 	 , invoice_to_state
371 	 , invoice_to_postal_code
372 	 , invoice_to_country
373       -- { Start add new columns to select for the Add Customer
374       -- , Orig_Ship_Address_Ref
375       -- , Orig_Bill_Address_Ref
376       -- , Orig_Deliver_Address_Ref
377       -- , Ship_to_Contact_Ref
378       -- , Bill_to_Contact_Ref
379       -- , Deliver_to_Contact_Ref
380       -- End add new columns to select for the Add Customer}
381          , nvl(Config_Header_Id,               FND_API.G_MISS_NUM)
382          , nvl(Config_Rev_Nbr,                 FND_API.G_MISS_NUM)
383          , nvl(Configuration_ID,               FND_API.G_MISS_NUM)
384          , ship_to_customer_name
385          , ship_to_customer_number
386          , nvl(ship_to_customer_id,	       FND_API.G_MISS_NUM)
387          , invoice_to_customer_name
388          , invoice_to_customer_number
389          , nvl(invoice_to_customer_id,	       FND_API.G_MISS_NUM)
390          , deliver_to_customer_name
391          , deliver_to_customer_number
392          , nvl(deliver_to_customer_id,	       FND_API.G_MISS_NUM)
393          , nvl(user_item_description,	       FND_API.G_MISS_CHAR)
394          , override_atp_date_code
395          , xml_transaction_type_code
396          , nvl(blanket_number,	               FND_API.G_MISS_NUM)
397          , nvl(blanket_line_number,	       FND_API.G_MISS_NUM)
398          , shipping_method
399       FROM oe_lines_interface
400      WHERE order_source_id              = l_order_source_id
401        AND orig_sys_document_ref 	= l_orig_sys_document_ref
402        AND  (decode(l_customer_key_profile, 'Y',
403              nvl(sold_to_org_id,                  -999), 1)
404              = decode(l_customer_key_profile, 'Y',
405              nvl(p_sold_to_org_id,                -999), 1)
406           OR decode(l_customer_key_profile, 'Y',
407              nvl(sold_to_org,                  ' '), '')
408              = decode(l_customer_key_profile, 'Y',
409              nvl(p_sold_to_org,                ' '), ''))
410        AND nvl(change_sequence,      	FND_API.G_MISS_CHAR)
411 	 = nvl(l_change_sequence,       FND_API.G_MISS_CHAR)
412        AND request_id		 	= l_request_id
413        AND nvl(rejected_flag, 'N')      = 'Y'
414 ;
415 
416 /* -----------------------------------------------------------
417    Line Lot Serials cursor
418    -----------------------------------------------------------
419 */
420     CURSOR l_lot_serial_cursor IS
421     SELECT nvl(orig_sys_lotserial_ref,	FND_API.G_MISS_CHAR)
422 	 , nvl(change_request_code,	FND_API.G_MISS_CHAR)
423 	 , nvl(lot_number,		FND_API.G_MISS_CHAR)
424 	 , nvl(from_serial_number,	FND_API.G_MISS_CHAR)
425 	 , nvl(to_serial_number,	FND_API.G_MISS_CHAR)
426 	 , nvl(quantity,		FND_API.G_MISS_NUM)
427 	 , nvl(context,			FND_API.G_MISS_CHAR)
428 	 , nvl(attribute1,		FND_API.G_MISS_CHAR)
429 	 , nvl(attribute2,		FND_API.G_MISS_CHAR)
430 	 , nvl(attribute3,		FND_API.G_MISS_CHAR)
431 	 , nvl(attribute4,		FND_API.G_MISS_CHAR)
432 	 , nvl(attribute5,		FND_API.G_MISS_CHAR)
433 	 , nvl(attribute6,		FND_API.G_MISS_CHAR)
434 	 , nvl(attribute7,		FND_API.G_MISS_CHAR)
435 	 , nvl(attribute8,		FND_API.G_MISS_CHAR)
436 	 , nvl(attribute9,		FND_API.G_MISS_CHAR)
437 	 , nvl(attribute10,		FND_API.G_MISS_CHAR)
438 	 , nvl(attribute11,		FND_API.G_MISS_CHAR)
439 	 , nvl(attribute12,		FND_API.G_MISS_CHAR)
440 	 , nvl(attribute13,		FND_API.G_MISS_CHAR)
441 	 , nvl(attribute14,		FND_API.G_MISS_CHAR)
442 	 , nvl(attribute15,		FND_API.G_MISS_CHAR)
443 	 , nvl(operation_code,		OE_GLOBALS.G_OPR_CREATE)
444       FROM oe_lotserials_interface
445      WHERE order_source_id         	= l_order_source_id
446        AND orig_sys_document_ref 	= l_orig_sys_document_ref
447        AND  (decode(l_customer_key_profile, 'Y',
448              nvl(sold_to_org_id,                  -999), 1)
449              = decode(l_customer_key_profile, 'Y',
450              nvl(p_sold_to_org_id,                -999), 1)
451           OR decode(l_customer_key_profile, 'Y',
452              nvl(sold_to_org,                  ' '), '')
453              = decode(l_customer_key_profile, 'Y',
454              nvl(p_sold_to_org,                ' '), ''))
455        AND nvl(change_sequence,      	FND_API.G_MISS_CHAR)
456 	 = nvl(l_change_sequence,       FND_API.G_MISS_CHAR)
457        AND orig_sys_line_ref 		= l_orig_sys_line_ref
458        AND nvl(orig_sys_shipment_ref,	FND_API.G_MISS_CHAR)
459 	 = nvl(l_orig_sys_shipment_ref,	FND_API.G_MISS_CHAR)
460        AND request_id		 	= p_request_id
461 ;
462 
463 --
464 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
465 --
466 BEGIN
467       IF l_debug_level  > 0 THEN
468           oe_debug_pub.add(  'BEFORE INITIALIZATION' ) ;
469       END IF;
470 
471       l_line_rec 		:= OE_Order_Pub.G_MISS_LINE_REC;
472       l_line_tbl 		:= OE_Order_Pub.G_MISS_LINE_TBL;
473       l_line_val_rec 		:= OE_Order_Pub.G_MISS_LINE_VAL_REC;
474       l_line_val_tbl 		:= OE_Order_Pub.G_MISS_LINE_VAL_TBL;
475       l_lot_serial_rec 		:= OE_Order_Pub.G_MISS_LOT_SERIAL_REC;
476       l_lot_serial_tbl 		:= OE_Order_Pub.G_MISS_LOT_SERIAL_TBL;
477 
478 
479  If OE_CODE_CONTROL.GET_CODE_RELEASE_LEVEL >= '110510' Then
480   fnd_profile.get('ONT_INCLUDE_CUST_IN_OI_KEY', l_customer_key_profile);
481   l_customer_key_profile := nvl(l_customer_key_profile, 'N');
482   IF l_debug_level  > 0 THEN
483       oe_debug_pub.add(  'CUSTOMER KEY PROFILE SETTING = '||l_customer_key_profile ) ;
484   END IF;
485  End If;
486 
487 
488 
489 /* -----------------------------------------------------------
490    Lines
491    -----------------------------------------------------------
492 */
493       IF l_debug_level  > 0 THEN
494           oe_debug_pub.add(  'BEFORE LINES LOOP' ) ;
495       END IF;
496 
497   OPEN l_line_cursor;
498   LOOP
499      FETCH l_line_cursor
500       INTO l_line_rec.order_source_id
501          , l_line_rec.orig_sys_document_ref
502          , l_line_rec.orig_sys_line_ref
503 	 , l_line_rec.orig_sys_shipment_ref
504 	 , l_line_rec.change_request_code
505 	 , l_line_rec.org_id
506 	 , l_line_rec.line_number
507 	 , l_line_rec.shipment_number
508 	 , l_line_rec.line_id
509 	 , l_line_rec.line_type_id
510 	 , l_line_val_rec.line_type
511 	 , l_line_rec.item_type_code
512 	 , l_line_rec.inventory_item_id
513 	 , l_line_val_rec.inventory_item
514 	 , l_line_rec.top_model_line_ref
515 	 , l_line_rec.link_to_line_ref
516 	 , l_line_rec.explosion_date
517 	 , l_line_rec.ato_line_id
518 	 , l_line_rec.component_sequence_id
519 	 , l_line_rec.component_code
520 	 , l_line_rec.sort_order
521 	 , l_line_rec.model_group_number
522 	 , l_line_rec.option_number
523 	 , l_line_rec.option_flag
524 	 , l_line_rec.ship_model_complete_flag
525 	 , l_line_rec.source_type_code
526 	 , l_line_rec.schedule_status_code
527 	 , l_line_rec.schedule_ship_date
528          , l_line_rec.late_demand_penalty_factor
529 	 , l_line_rec.schedule_arrival_date
530 	 , l_line_rec.actual_arrival_date
531   	 , l_line_rec.request_date
532 	 , l_line_rec.promise_date
533 	 , l_line_rec.delivery_lead_time
534 	 , l_line_rec.ordered_quantity
535 	 , l_line_rec.order_quantity_uom
536 	 , l_line_rec.shipping_quantity
537 	 , l_line_rec.shipping_quantity_uom
538 	 , l_line_rec.shipped_quantity
539 	 , l_line_rec.cancelled_quantity
540 	 , l_line_rec.fulfilled_quantity
541    /* OPM variables */
542          , l_line_rec.ordered_quantity2
543          , l_line_rec.ordered_quantity_uom2
544          , l_line_rec.shipping_quantity2
545          , l_line_rec.shipping_quantity_uom2
546          , l_line_rec.shipped_quantity2
547          , l_line_rec.cancelled_quantity2
548          , l_line_rec.fulfilled_quantity2
549          , l_line_rec.preferred_grade
550    /* end OPM vairables */
551 	 , l_line_rec.pricing_quantity
552 	 , l_line_rec.pricing_quantity_uom
553 	 , l_line_rec.sold_from_org_id
554 	 , l_line_val_rec.sold_from_org
555 	 , l_line_rec.sold_to_org_id
556 	 , l_line_val_rec.sold_to_org
557 	 , l_line_rec.ship_from_org_id
558 	 , l_line_val_rec.ship_from_org
559 	 , l_line_rec.ship_to_org_id
560 	 , l_line_val_rec.ship_to_org
561 	 , l_line_rec.deliver_to_org_id
562 	 , l_line_val_rec.deliver_to_org
563 	 , l_line_rec.invoice_to_org_id
564 	 , l_line_val_rec.invoice_to_org
565 	 , l_line_val_rec.ship_to_address1
566 	 , l_line_val_rec.ship_to_address2
567 	 , l_line_val_rec.ship_to_address3
568 	 , l_line_val_rec.ship_to_address4
569 	 , l_line_val_rec.ship_to_city
570 	 , l_line_val_rec.ship_to_state
571 	 , l_line_val_rec.ship_to_zip
572 	 , l_line_val_rec.ship_to_country
573 	 , l_line_rec.ship_to_contact_id
574 	 , l_line_val_rec.ship_to_contact
575 	 , l_line_rec.deliver_to_contact_id
576 	 , l_line_val_rec.deliver_to_contact
577 	 , l_line_rec.invoice_to_contact_id
578 	 , l_line_val_rec.invoice_to_contact
579 	 , l_line_rec.drop_ship_flag
580 	 , l_line_rec.ship_tolerance_above
581 	 , l_line_rec.ship_tolerance_below
582 	 , l_line_rec.price_list_id
583 	 , l_line_val_rec.price_list
584 	 , l_line_rec.pricing_date
585 	 , l_line_rec.unit_list_price
586 	 , l_line_rec.unit_selling_price
587 	 , l_line_rec.calculate_price_flag
588 	 , l_line_rec.ship_set_id
589 	 , l_line_rec.ship_set
590 	 , l_line_rec.arrival_set_id
591 	 , l_line_rec.arrival_set
592 	 , l_line_rec.fulfillment_set_id
593 	 , l_line_rec.fulfillment_set
594 	 , l_line_rec.tax_code
595 	 , l_line_rec.tax_value
596 	 , l_line_rec.tax_date
597 	 , l_line_rec.tax_point_code
598 	 , l_line_val_rec.tax_point
599 	 , l_line_rec.tax_exempt_flag
600 	 , l_line_rec.tax_exempt_number
601 	 , l_line_rec.tax_exempt_reason_code
602 	 , l_line_val_rec.tax_exempt_reason
603 	 , l_line_rec.agreement_id
604 	 , l_line_val_rec.agreement
605 	 , l_line_rec.invoicing_rule_id
606 	 , l_line_val_rec.invoicing_rule
607 	 , l_line_rec.accounting_rule_id
608 	 , l_line_rec.accounting_rule_duration
609 	 , l_line_val_rec.accounting_rule
610 	 , l_line_rec.payment_term_id
611 	 , l_line_val_rec.payment_term
612 	 , l_line_rec.demand_class_code
613 	 , l_line_rec.shipment_priority_code
614 	 , l_line_val_rec.shipment_priority
615 	 , l_line_rec.shipping_method_code
616 	 , l_line_rec.shipping_instructions
617 	 , l_line_rec.packing_instructions
618 	 , l_line_rec.freight_carrier_code
619 	 , l_line_rec.freight_terms_code
620 	 , l_line_val_rec.freight_terms
621 	 , l_line_rec.fob_point_code
622 	 , l_line_val_rec.fob_point
623 	 , l_line_rec.return_reason_code
624 	 , l_line_rec.reference_type
625 	 , l_line_rec.reference_header_id
626 	 , l_line_rec.reference_line_id
627 	 , l_line_rec.credit_invoice_line_id
628 	 , l_line_rec.cust_po_number
629 	 , l_line_rec.customer_line_number
630 	 , l_line_rec.customer_shipment_number
631 	 , l_line_rec.ordered_item_id
632 	 , l_line_rec.item_identifier_type
633 	 , l_line_rec.ordered_item
634 --	 , l_line_rec.customer_item_revision
635 	 , l_line_rec.customer_item_net_price
636 	 , l_line_rec.customer_payment_term_id
637 	 , l_line_val_rec.customer_payment_term
638 	 , l_line_rec.demand_bucket_type_code
639 	 , l_line_val_rec.demand_bucket_type
640 	 , l_line_rec.customer_dock_code
641 	 , l_line_rec.customer_job
642 	 , l_line_rec.customer_production_line
643 	 , l_line_rec.cust_model_serial_number
644 	 , l_line_rec.project_id
645 	 , l_line_val_rec.project
646 	 , l_line_rec.task_id
647 	 , l_line_val_rec.task
648 	 , l_line_rec.end_item_unit_number
649 	 , l_line_rec.item_revision
650 	 , l_line_rec.service_duration
651 	 , l_line_rec.service_period
652 	 , l_line_rec.service_start_date
653 	 , l_line_rec.service_end_date
654 	 , l_line_rec.service_coterminate_flag
655 	 , l_line_rec.unit_selling_percent
656 	 , l_line_rec.unit_list_percent
657 	 , l_line_rec.unit_percent_base_price
658 	 , l_line_rec.service_number
659 --	 , l_line_rec.fulfilled_flag	 -- To be added in Process Order
660 --	 , l_line_rec.closed_flag
661 	 , l_line_rec.cancelled_flag
662 	 , l_line_rec.context
663 	 , l_line_rec.attribute1
664 	 , l_line_rec.attribute2
665 	 , l_line_rec.attribute3
666 	 , l_line_rec.attribute4
667 	 , l_line_rec.attribute5
668 	 , l_line_rec.attribute6
669 	 , l_line_rec.attribute7
670 	 , l_line_rec.attribute8
671 	 , l_line_rec.attribute9
672 	 , l_line_rec.attribute10
673 	 , l_line_rec.attribute11
674 	 , l_line_rec.attribute12
675 	 , l_line_rec.attribute13
676 	 , l_line_rec.attribute14
677 	 , l_line_rec.attribute15
678 	 , l_line_rec.attribute16  -- For bug 2184255
679 	 , l_line_rec.attribute17
680 	 , l_line_rec.attribute18
681 	 , l_line_rec.attribute19
682 	 , l_line_rec.attribute20
683 	 , l_line_rec.tp_context
684 	 , l_line_rec.tp_attribute1
685 	 , l_line_rec.tp_attribute2
686 	 , l_line_rec.tp_attribute3
687 	 , l_line_rec.tp_attribute4
688 	 , l_line_rec.tp_attribute5
689 	 , l_line_rec.tp_attribute6
690 	 , l_line_rec.tp_attribute7
691 	 , l_line_rec.tp_attribute8
692 	 , l_line_rec.tp_attribute9
693 	 , l_line_rec.tp_attribute10
694 	 , l_line_rec.tp_attribute11
695 	 , l_line_rec.tp_attribute12
696 	 , l_line_rec.tp_attribute13
697 	 , l_line_rec.tp_attribute14
698 	 , l_line_rec.tp_attribute15
699 	 , l_line_rec.industry_context
700 	 , l_line_rec.industry_attribute1
701 	 , l_line_rec.industry_attribute2
702 	 , l_line_rec.industry_attribute3
703 	 , l_line_rec.industry_attribute4
704 	 , l_line_rec.industry_attribute5
705 	 , l_line_rec.industry_attribute6
706 	 , l_line_rec.industry_attribute7
707 	 , l_line_rec.industry_attribute8
708 	 , l_line_rec.industry_attribute9
709 	 , l_line_rec.industry_attribute10
710 	 , l_line_rec.industry_attribute11
711 	 , l_line_rec.industry_attribute12
712 	 , l_line_rec.industry_attribute13
713 	 , l_line_rec.industry_attribute14
714 	 , l_line_rec.industry_attribute15
715 	 , l_line_rec.industry_attribute16
716 	 , l_line_rec.industry_attribute17
717 	 , l_line_rec.industry_attribute18
718 	 , l_line_rec.industry_attribute19
719 	 , l_line_rec.industry_attribute20
720 	 , l_line_rec.industry_attribute21
721 	 , l_line_rec.industry_attribute22
722 	 , l_line_rec.industry_attribute23
723 	 , l_line_rec.industry_attribute24
724 	 , l_line_rec.industry_attribute25
725 	 , l_line_rec.industry_attribute26
726 	 , l_line_rec.industry_attribute27
727 	 , l_line_rec.industry_attribute28
728 	 , l_line_rec.industry_attribute29
729 	 , l_line_rec.industry_attribute30
730 	 , l_line_rec.pricing_context
731 	 , l_line_rec.pricing_attribute1
732 	 , l_line_rec.pricing_attribute2
733 	 , l_line_rec.pricing_attribute3
734 	 , l_line_rec.pricing_attribute4
735 	 , l_line_rec.pricing_attribute5
736 	 , l_line_rec.pricing_attribute6
737 	 , l_line_rec.pricing_attribute7
738 	 , l_line_rec.pricing_attribute8
739 	 , l_line_rec.pricing_attribute9
740 	 , l_line_rec.pricing_attribute10
741 	 , l_line_rec.global_attribute_category
742 	 , l_line_rec.global_attribute1
743 	 , l_line_rec.global_attribute2
744 	 , l_line_rec.global_attribute3
745 	 , l_line_rec.global_attribute4
746 	 , l_line_rec.global_attribute5
747 	 , l_line_rec.global_attribute6
748 	 , l_line_rec.global_attribute7
749 	 , l_line_rec.global_attribute8
750 	 , l_line_rec.global_attribute9
751 	 , l_line_rec.global_attribute10
752 	 , l_line_rec.global_attribute11
753 	 , l_line_rec.global_attribute12
754 	 , l_line_rec.global_attribute13
755 	 , l_line_rec.global_attribute14
756 	 , l_line_rec.global_attribute15
757 	 , l_line_rec.global_attribute16
758 	 , l_line_rec.global_attribute17
759 	 , l_line_rec.global_attribute18
760 	 , l_line_rec.global_attribute19
761 	 , l_line_rec.global_attribute20
762 	 , l_line_rec.return_context
763 	 , l_line_rec.return_attribute1
764 	 , l_line_rec.return_attribute2
765 	 , l_line_rec.return_attribute3
766 	 , l_line_rec.return_attribute4
767 	 , l_line_rec.return_attribute5
768 	 , l_line_rec.return_attribute6
769 	 , l_line_rec.return_attribute7
770 	 , l_line_rec.return_attribute8
771 	 , l_line_rec.return_attribute9
772 	 , l_line_rec.return_attribute10
773 	 , l_line_rec.return_attribute11
774 	 , l_line_rec.return_attribute12
775 	 , l_line_rec.return_attribute13
776 	 , l_line_rec.return_attribute14
777 	 , l_line_rec.return_attribute15
778       , l_line_rec.request_id
779 	 , l_line_rec.operation
780 	 , l_line_rec.status_flag
781 	 , l_line_rec.change_reason
782 	 , l_line_rec.change_comments
783 	 , l_line_rec.service_txn_reason_code
784 	 , l_line_rec.service_txn_comments
785 	 , l_line_rec.service_reference_type_code
786 	 , l_line_rec.service_reference_order
787 	 , l_line_rec.service_reference_line
788 	 , l_line_rec.service_reference_system
789 	 , l_segment_array(1)
790 	 , l_segment_array(2)
791 	 , l_segment_array(3)
792 	 , l_segment_array(4)
793 	 , l_segment_array(5)
794 	 , l_segment_array(6)
795 	 , l_segment_array(7)
796 	 , l_segment_array(8)
797 	 , l_segment_array(9)
798 	 , l_segment_array(10)
799 	 , l_segment_array(11)
800 	 , l_segment_array(12)
801 	 , l_segment_array(13)
802 	 , l_segment_array(14)
803 	 , l_segment_array(15)
804 	 , l_segment_array(16)
805 	 , l_segment_array(17)
806 	 , l_segment_array(18)
807 	 , l_segment_array(19)
808 	 , l_segment_array(20)
809          , l_line_val_rec.commitment
810          , l_line_rec.commitment_id
811 -- aksingh subinventory
812          , l_line_rec.subinventory
813          ,l_line_val_rec.salesrep
814          ,l_line_rec.salesrep_id
815          ,l_line_rec.earliest_acceptable_date
816          ,l_line_rec.latest_acceptable_date
817          , l_line_rec.split_from_line_ref
818          , l_line_rec.split_from_shipment_ref
819          ,l_line_val_rec.invoice_to_address1
820          ,l_line_val_rec.invoice_to_address2
821          ,l_line_val_rec.invoice_to_address3
822          ,l_line_val_rec.invoice_to_address4
823 	 ,l_line_val_rec.invoice_to_city
824 	 ,l_line_val_rec.invoice_to_state
825 	 ,l_line_val_rec.invoice_to_zip
826 	 ,l_line_val_rec.invoice_to_country
827       -- Not enabling these columns for the fix 2922709, will do it later
828       -- { Start add new columns to select for the Add Customer
829       -- , l_line_customer_rec.Orig_Ship_Address_Ref
830       -- , l_line_customer_rec.Orig_Bill_Address_Ref
831       -- , l_line_customer_rec.Orig_Deliver_Address_Ref
832       -- , l_line_customer_rec.Ship_to_Contact_Ref
833       -- , l_line_customer_rec.Bill_to_Contact_Ref
834       -- , l_line_customer_rec.Deliver_to_Contact_Ref
835       -- End add new columns to select for the Add Customer}
836          , l_line_rec.Config_Header_Id
837          , l_line_rec.Config_Rev_Nbr
838          , l_line_rec.Configuration_Id
839          , l_line_val_rec.ship_to_customer_name_oi
840          , l_line_val_rec.ship_to_customer_number_oi
841          , l_line_rec.ship_to_customer_id
842          , l_line_val_rec.invoice_to_customer_name_oi
843          , l_line_val_rec.invoice_to_customer_number_oi
844          , l_line_rec.invoice_to_customer_id
845          , l_line_val_rec.deliver_to_customer_name_oi
846          , l_line_val_rec.deliver_to_customer_number_oi
847          , l_line_rec.deliver_to_customer_id
848          , l_line_rec.user_item_description
849          , l_line_rec.override_atp_date_code
850          , l_line_rec.xml_transaction_type_code
851          , l_line_rec.blanket_number
852          , l_line_rec.blanket_line_number
853          , l_line_val_rec.shipping_method
854 ;
855       EXIT WHEN l_line_cursor%NOTFOUND;
856 
857       l_line_count := l_line_count + 1;
858       -- added part of bug 2922709
859       l_line_rec.header_id := l_header_id;
860       l_line_rec.reserved_quantity := NULL;
861       OE_Line_Util.Convert_Miss_To_Null (l_line_rec);
862     --OE_Line_Util.Convert_Miss_To_Null (l_line_val_rec);
863       l_line_tbl(l_line_count) := l_line_rec;
864       l_line_val_tbl(l_line_count) := l_line_val_rec;
865 
866       l_orig_sys_line_ref     := l_line_rec.orig_sys_line_ref;
867       l_orig_sys_shipment_ref := l_line_rec.orig_sys_shipment_ref;
868 
869       IF l_debug_level  > 0 THEN
870 	 oe_debug_pub.add('origsysline_ref ('||l_line_count||'):'|| l_line_tbl(l_line_count).orig_sys_line_ref ) ;
871          oe_debug_pub.add('origsysshipment_ref ('||l_line_count||'):'|| l_line_tbl(l_line_count).orig_sys_shipment_ref ) ;
872          oe_debug_pub.add('val table Sold_To_Org ('||l_line_count||'):'|| l_line_val_tbl(l_line_count).sold_to_org) ;
873       END IF;
874 
875 
876 /* -----------------------------------------------------------
877    Line Lot Serials
878    -----------------------------------------------------------
879 */
880    IF l_debug_level  > 0 THEN
881        oe_debug_pub.add(  'BEFORE LINE LOT SERIALS LOOP' ) ;
882    END IF;
883 
884   l_lot_serial_count := 0;
885   OPEN l_lot_serial_cursor;
886   LOOP
887      FETCH l_lot_serial_cursor
888       INTO l_lot_serial_rec.orig_sys_lotserial_ref
889 	 , l_lot_serial_rec.change_request_code
890 	 , l_lot_serial_rec.lot_number
891 	 , l_lot_serial_rec.from_serial_number
892 	 , l_lot_serial_rec.to_serial_number
893 	 , l_lot_serial_rec.quantity
894 	 , l_lot_serial_rec.context
895 	 , l_lot_serial_rec.attribute1
896 	 , l_lot_serial_rec.attribute2
897 	 , l_lot_serial_rec.attribute3
898 	 , l_lot_serial_rec.attribute4
899 	 , l_lot_serial_rec.attribute5
900 	 , l_lot_serial_rec.attribute6
901 	 , l_lot_serial_rec.attribute7
902 	 , l_lot_serial_rec.attribute8
903 	 , l_lot_serial_rec.attribute9
904 	 , l_lot_serial_rec.attribute10
905 	 , l_lot_serial_rec.attribute11
906 	 , l_lot_serial_rec.attribute12
907 	 , l_lot_serial_rec.attribute13
908 	 , l_lot_serial_rec.attribute14
909 	 , l_lot_serial_rec.attribute15
910 	 , l_lot_serial_rec.operation
911 ;
912       EXIT WHEN l_lot_serial_cursor%NOTFOUND;
913 
914        l_lot_serial_rec.line_index := l_line_count;
915 
916        l_lot_serial_count := l_lot_serial_count + 1;
917        l_lot_serial_tbl (l_lot_serial_count) := l_lot_serial_rec;
918 
919 	        IF l_debug_level  > 0 THEN
920 	            oe_debug_pub.add(  'LINE LOT SERIAL REF ( '||L_LOT_SERIAL_COUNT||' ) : '|| L_LOT_SERIAL_TBL ( L_LOT_SERIAL_COUNT ) .LOT_NUMBER ) ;
921 	        END IF;
922 
923   END LOOP;
924   CLOSE l_lot_serial_cursor;
925 
926   END LOOP;			/* Lines cursor */
927   CLOSE l_line_cursor;
928 
929   IF l_debug_level  > 0 THEN
930       oe_debug_pub.add(  'AFTER GETTING REJECTED RECORDS' ) ;
931   END IF;
932 
933 /* -----------------------------------------------------------
934    Return line and lot serial tables
935    -----------------------------------------------------------
936 */
937 
938   IF l_line_tbl.COUNT > 0 THEN
939      x_rejected_line_tbl :=  l_line_tbl;
940      x_rejected_line_val_tbl :=  l_line_val_tbl;
941 
942      IF l_lot_serial_tbl.COUNT > 0 THEN
943         x_rejected_lot_serial_tbl := l_lot_serial_tbl;
944      END IF;
945   END IF;
946 
947   x_return_status :=  FND_API.G_RET_STS_SUCCESS;
948 
949 
950 EXCEPTION
951   WHEN OTHERS THEN
952        IF l_debug_level  > 0 THEN
953            oe_debug_pub.add(  'ENCOUNTERED OTHERS ERROR EXCEPTION IN OE_REJECTED_LINES_ACK.GET_REJECTED_LINES: '||SQLERRM ) ;
954        END IF;
955 
956        x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
957 
958        IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
959        THEN
960          FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME, l_api_name);
961        END IF;
962 
963 END Get_Rejected_Lines;
964 
965 END OE_Rejected_Lines_Ack;