[Home] [Help]
PACKAGE BODY: APPS.PO_LINE_LOCATIONS_PKG_S2
Source
1 PACKAGE BODY PO_LINE_LOCATIONS_PKG_S2 as
2 /* $Header: POXP3PSB.pls 120.9 2006/11/29 17:52:12 nipagarw noship $ */
3
4 PROCEDURE Update_Row(X_Rowid VARCHAR2,
5 X_Line_Location_Id NUMBER,
6 X_Last_Update_Date DATE,
7 X_Last_Updated_By NUMBER,
8 X_Po_Header_Id NUMBER,
9 X_Po_Line_Id NUMBER,
10 X_Last_Update_Login NUMBER,
11 X_Quantity NUMBER,
12 X_Quantity_Received NUMBER,
13 X_Quantity_Accepted NUMBER,
14 X_Quantity_Rejected NUMBER,
15 X_Quantity_Billed NUMBER,
16 X_Quantity_Cancelled NUMBER,
17 X_Unit_Meas_Lookup_Code VARCHAR2,
18 X_Po_Release_Id NUMBER,
19 X_Ship_To_Location_Id NUMBER,
20 X_Ship_Via_Lookup_Code VARCHAR2,
21 X_Need_By_Date DATE,
22 X_Promised_Date DATE,
23 X_Last_Accept_Date DATE,
24 X_Price_Override NUMBER,
25 X_Encumbered_Flag VARCHAR2,
26 X_Encumbered_Date DATE,
27 X_Fob_Lookup_Code VARCHAR2,
28 X_Freight_Terms_Lookup_Code VARCHAR2,
29 X_Taxable_Flag VARCHAR2,
30 X_Tax_Code_Id NUMBER,
31 X_Tax_User_Override_Flag VARCHAR2,
32 X_Calculate_Tax_Flag VARCHAR2,
33 X_From_Header_Id NUMBER,
34 X_From_Line_Id NUMBER,
35 X_From_Line_Location_Id NUMBER,
36 X_Start_Date DATE,
37 X_End_Date DATE,
38 X_Lead_Time NUMBER,
39 X_Lead_Time_Unit VARCHAR2,
40 X_Price_Discount NUMBER,
41 X_Terms_Id NUMBER,
42 X_Approved_Flag VARCHAR2,
43 X_Approved_Date DATE,
44 X_Closed_Flag VARCHAR2,
45 X_Cancel_Flag VARCHAR2,
46 X_Cancelled_By NUMBER,
47 X_Cancel_Date DATE,
48 X_Cancel_Reason VARCHAR2,
49 X_Firm_Status_Lookup_Code VARCHAR2,
50 X_Attribute_Category VARCHAR2,
51 X_Attribute1 VARCHAR2,
52 X_Attribute2 VARCHAR2,
53 X_Attribute3 VARCHAR2,
54 X_Attribute4 VARCHAR2,
55 X_Attribute5 VARCHAR2,
56 X_Attribute6 VARCHAR2,
57 X_Attribute7 VARCHAR2,
58 X_Attribute8 VARCHAR2,
59 X_Attribute9 VARCHAR2,
60 X_Attribute10 VARCHAR2,
61 X_Attribute11 VARCHAR2,
62 X_Attribute12 VARCHAR2,
63 X_Attribute13 VARCHAR2,
64 X_Attribute14 VARCHAR2,
65 X_Attribute15 VARCHAR2,
66 X_Inspection_Required_Flag VARCHAR2,
67 X_Receipt_Required_Flag VARCHAR2,
68 X_Qty_Rcv_Tolerance NUMBER,
69 X_Qty_Rcv_Exception_Code VARCHAR2,
70 X_Enforce_Ship_To_Location VARCHAR2,
71 X_Allow_Substitute_Receipts VARCHAR2,
72 X_Days_Early_Receipt_Allowed NUMBER,
73 X_Days_Late_Receipt_Allowed NUMBER,
74 X_Receipt_Days_Exception_Code VARCHAR2,
75 X_Invoice_Close_Tolerance NUMBER,
76 X_Receive_Close_Tolerance NUMBER,
77 X_Ship_To_Organization_Id NUMBER,
78 X_Shipment_Num NUMBER,
79 X_Source_Shipment_Id NUMBER,
80 X_Shipment_Type VARCHAR2,
81 X_Closed_Code VARCHAR2,
82 X_Ussgl_Transaction_Code VARCHAR2,
83 X_Government_Context VARCHAR2,
84 X_Receiving_Routing_Id NUMBER,
85 X_Accrue_On_Receipt_Flag VARCHAR2,
86 X_Closed_Reason VARCHAR2,
87 X_Closed_Date DATE,
88 X_Closed_By NUMBER,
89 X_Global_Attribute_Category VARCHAR2,
90 X_Global_Attribute1 VARCHAR2,
91 X_Global_Attribute2 VARCHAR2,
92 X_Global_Attribute3 VARCHAR2,
93 X_Global_Attribute4 VARCHAR2,
94 X_Global_Attribute5 VARCHAR2,
95 X_Global_Attribute6 VARCHAR2,
96 X_Global_Attribute7 VARCHAR2,
97 X_Global_Attribute8 VARCHAR2,
98 X_Global_Attribute9 VARCHAR2,
99 X_Global_Attribute10 VARCHAR2,
100 X_Global_Attribute11 VARCHAR2,
101 X_Global_Attribute12 VARCHAR2,
102 X_Global_Attribute13 VARCHAR2,
103 X_Global_Attribute14 VARCHAR2,
104 X_Global_Attribute15 VARCHAR2,
105 X_Global_Attribute16 VARCHAR2,
106 X_Global_Attribute17 VARCHAR2,
107 X_Global_Attribute18 VARCHAR2,
108 X_Global_Attribute19 VARCHAR2,
109 X_Global_Attribute20 VARCHAR2,
110 X_Country_of_Origin_Code VARCHAR2,
111 X_Invoice_Match_Option VARCHAR2, --bgu, Dec. 7, 98
112 --togeorge 10/03/2000
113 --added note to receiver
114 X_note_to_receiver VARCHAR2,
115 -- Mahesh Chandak(GML) Add 7 process related fields.
116 -- start of Bug# 1548597
117 X_Secondary_Unit_Of_Measure VARCHAR2,
118 X_Secondary_Quantity NUMBER,
119 X_Preferred_Grade VARCHAR2,
120 X_Secondary_Quantity_Received NUMBER,
121 X_Secondary_Quantity_Accepted NUMBER,
122 X_Secondary_Quantity_Rejected NUMBER,
123 X_Secondary_Quantity_Cancelled NUMBER,
124 -- end of Bug# 1548597
125 X_Consigned_Flag VARCHAR2, /* CONSIGNED FPI */
126 X_amount NUMBER, -- <SERVICES FPJ>
127 p_transaction_flow_header_id NUMBER,
128 p_manual_price_change_flag VARCHAR2 default null --< Manual Price Override FPJ >
129 ) IS
130 l_tax_attribute_update_code PO_LINE_LOCATIONS_ALL.tax_attribute_update_code%type;--<eTax Integration R12>
131 BEGIN
132
133 --<eTax Integration R12 Start>
134 IF X_Shipment_Type in ('STANDARD', 'PLANNED', 'BLANKET', 'SCHEDULED') AND
135 PO_TAX_INTERFACE_PVT.any_tax_attributes_updated(
136 p_doc_type => 'PO',
137 p_doc_level => 'SHIPMENT',
138 p_doc_level_id => X_Line_Location_Id,
139 p_qty => X_Quantity,
140 p_price_override => X_Price_Override, --Bug 5647417
141 p_amt => X_amount,
142 p_ship_to_org => X_Ship_To_Organization_Id,
143 p_ship_to_loc => X_Ship_To_Location_Id,
144 p_need_by_date => X_Need_By_Date
145 ) THEN
146 l_tax_attribute_update_code := 'UPDATE';
147 END IF;
148 --<eTax Integration R12 End>
149
150
151 UPDATE PO_LINE_LOCATIONS
152 SET
153 line_location_id = X_Line_Location_Id,
154 last_update_date = X_Last_Update_Date,
155 last_updated_by = X_Last_Updated_By,
156 po_header_id = X_Po_Header_Id,
157 po_line_id = X_Po_Line_Id,
158 last_update_login = X_Last_Update_Login,
159 quantity = X_Quantity,
160 quantity_received = X_Quantity_Received,
161 quantity_accepted = X_Quantity_Accepted,
162 quantity_rejected = X_Quantity_Rejected,
163 quantity_billed = X_Quantity_Billed,
164 quantity_cancelled = X_Quantity_Cancelled,
165 unit_meas_lookup_code = X_Unit_Meas_Lookup_Code,
166 po_release_id = X_Po_Release_Id,
167 ship_to_location_id = X_Ship_To_Location_Id,
168 ship_via_lookup_code = X_Ship_Via_Lookup_Code,
169 need_by_date = X_Need_By_Date,
170 promised_date = X_Promised_Date,
171 last_accept_date = X_Last_Accept_Date,
172 price_override = X_Price_Override,
173 encumbered_flag = X_Encumbered_Flag,
174 encumbered_date = X_Encumbered_Date,
175 fob_lookup_code = X_Fob_Lookup_Code,
176 freight_terms_lookup_code = X_Freight_Terms_Lookup_Code,
177 from_header_id = X_From_Header_Id,
178 from_line_id = X_From_Line_Id,
179 from_line_location_id = X_From_Line_Location_Id,
180 start_date = X_Start_Date,
181 end_date = X_End_Date,
182 lead_time = X_Lead_Time,
183 lead_time_unit = X_Lead_Time_Unit,
184 price_discount = X_Price_Discount,
185 terms_id = X_Terms_Id,
186 approved_flag = X_Approved_Flag,
187 approved_date = X_Approved_Date,
188 closed_flag = X_Closed_Flag,
189 cancel_flag = X_Cancel_Flag,
190 cancelled_by = X_Cancelled_By,
191 cancel_date = X_Cancel_Date,
192 cancel_reason = X_Cancel_Reason,
193 firm_status_lookup_code = X_Firm_Status_Lookup_Code,
194 attribute_category = X_Attribute_Category,
195 attribute1 = X_Attribute1,
196 attribute2 = X_Attribute2,
197 attribute3 = X_Attribute3,
198 attribute4 = X_Attribute4,
199 attribute5 = X_Attribute5,
200 attribute6 = X_Attribute6,
201 attribute7 = X_Attribute7,
202 attribute8 = X_Attribute8,
203 attribute9 = X_Attribute9,
204 attribute10 = X_Attribute10,
205 attribute11 = X_Attribute11,
206 attribute12 = X_Attribute12,
207 attribute13 = X_Attribute13,
208 attribute14 = X_Attribute14,
209 attribute15 = X_Attribute15,
210 inspection_required_flag = X_Inspection_Required_Flag,
211 receipt_required_flag = X_Receipt_Required_Flag,
212 qty_rcv_tolerance = X_Qty_Rcv_Tolerance,
213 qty_rcv_exception_code = X_Qty_Rcv_Exception_Code,
214 enforce_ship_to_location_code = X_Enforce_Ship_To_Location,
215 allow_substitute_receipts_flag = X_Allow_Substitute_Receipts,
216 days_early_receipt_allowed = X_Days_Early_Receipt_Allowed,
217 days_late_receipt_allowed = X_Days_Late_Receipt_Allowed,
218 receipt_days_exception_code = X_Receipt_Days_Exception_Code,
219 invoice_close_tolerance = X_Invoice_Close_Tolerance,
220 receive_close_tolerance = X_Receive_Close_Tolerance,
221 ship_to_organization_id = X_Ship_To_Organization_Id,
222 shipment_num = X_Shipment_Num,
223 source_shipment_id = X_Source_Shipment_Id,
224 shipment_type = X_Shipment_Type,
225 closed_code = X_Closed_Code,
226 government_context = X_Government_Context,
227 receiving_routing_id = X_Receiving_Routing_Id,
228 accrue_on_receipt_flag = X_Accrue_On_Receipt_Flag,
229 closed_reason = X_Closed_Reason,
230 closed_date = X_Closed_Date,
231 closed_by = X_Closed_By,
232 global_attribute_category = X_Global_Attribute_Category,
233 global_attribute1 = X_Global_Attribute1,
234 global_attribute2 = X_Global_Attribute2,
235 global_attribute3 = X_Global_Attribute3,
236 global_attribute4 = X_Global_Attribute4,
237 global_attribute5 = X_Global_Attribute5,
238 global_attribute6 = X_Global_Attribute6,
239 global_attribute7 = X_Global_Attribute7,
240 global_attribute8 = X_Global_Attribute8,
241 global_attribute9 = X_Global_Attribute9,
242 global_attribute10 = X_Global_Attribute10,
243 global_attribute11 = X_Global_Attribute11,
244 global_attribute12 = X_Global_Attribute12,
245 global_attribute13 = X_Global_Attribute13,
246 global_attribute14 = X_Global_Attribute14,
247 global_attribute15 = X_Global_Attribute15,
248 global_attribute16 = X_Global_Attribute16,
249 global_attribute17 = X_Global_Attribute17,
250 global_attribute18 = X_Global_Attribute18,
251 global_attribute19 = X_Global_Attribute19,
252 global_attribute20 = X_Global_Attribute20,
253 country_of_origin_code = X_Country_of_Origin_Code,
254 match_option = X_Invoice_Match_Option, --bgu, Dec. 7, 98
255 --togeorge 10/03/2000
256 --added note to receiver
257 note_to_receiver = X_note_to_receiver,
258 -- Mahesh Bug# 1548597 added process fields in the update clause. 15-feb-2001
259 -- start of 1548597
260 secondary_unit_of_measure = X_Secondary_Unit_Of_Measure,
261 secondary_quantity = X_Secondary_Quantity,
262 preferred_grade = X_preferred_grade,
263 secondary_quantity_received = X_Secondary_Quantity_Received,
264 secondary_quantity_accepted = X_Secondary_Quantity_Accepted,
265 secondary_quantity_rejected = X_Secondary_Quantity_Rejected,
266 secondary_quantity_cancelled = X_Secondary_Quantity_Cancelled,
267
268 -- end of 1548597
269 consigned_flag = X_Consigned_Flag, /* CONSIGNED FPI */
270 amount = X_amount, -- <SERVICES FPJ>
271 transaction_flow_header_id = p_transaction_flow_header_id, --< Shared Proc FPJ >
272 manual_price_change_flag = p_manual_price_change_flag, --< Manual Price Override FPJ >
273 tax_attribute_update_code = NVL(tax_attribute_update_code, --<eTax Integration R12>
274 l_tax_attribute_update_code)
275 WHERE rowid = X_rowid;
276
277 if (SQL%NOTFOUND) then
278 Raise NO_DATA_FOUND;
279 end if;
280
281 END Update_Row;
282
283 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
284 --<R12 eTax Integration Start>
285 l_transaction_line_rec_type ZX_API_PUB.transaction_line_rec_type;
286 l_return_status VARCHAR2(1);
287 l_msg_count NUMBER;
288 l_msg_data VARCHAR2(2000);
289 l_po_header_id PO_LINE_LOCATIONS_ALL.po_header_id%TYPE;
290 l_po_release_id PO_LINE_LOCATIONS_ALL.po_release_id%TYPE;
291 l_line_location_id PO_LINE_LOCATIONS_ALL.line_location_id%TYPE;
292 l_shipment_type PO_LINE_LOCATIONS_ALL.shipment_type%TYPE;
293 l_org_id PO_LINE_LOCATIONS_ALL.org_id%type;
294 --<R12 eTax Integration End>
295
296 BEGIN
297 DELETE FROM PO_LINE_LOCATIONS
298 WHERE rowid = X_Rowid
299 --<R12 eTax Integration>
300 RETURNING shipment_type, po_header_id, po_release_id, line_location_id,org_id
301 INTO l_shipment_type, l_po_header_id, l_po_release_id, l_line_location_id,l_org_id;
302
303
304 if (SQL%NOTFOUND) then
305 Raise NO_DATA_FOUND;
306 end if;
307
308 --<R12 eTax Integration Start>
309 IF l_shipment_type in ('STANDARD','PLANNED','BLANKET','SCHEDULED') THEN
310
311 l_transaction_line_rec_type.internal_organization_id := l_org_id;
312 l_transaction_line_rec_type.application_id := FND_GLOBAL.resp_appl_id;
313 l_transaction_line_rec_type.entity_code := PO_CONSTANTS_SV.PO_ENTITY_CODE ;
314 l_transaction_line_rec_type.event_class_code := PO_CONSTANTS_SV.PO_EVENT_CLASS_CODE;
315 l_transaction_line_rec_type.event_type_code := PO_CONSTANTS_SV.PO_ADJUSTED;
316 l_transaction_line_rec_type.trx_id := NVL(l_po_release_id, l_po_header_id);
317 l_transaction_line_rec_type.trx_level_type := 'SHIPMENT';
318 l_transaction_line_rec_type.trx_line_id := l_line_location_id;
319
320 -- Call eTax API to delete corresponding tax lines and distributions
321 ZX_API_PUB.del_tax_line_and_distributions(
322 p_api_version => 1.0,
323 p_init_msg_list => FND_API.G_TRUE,
324 p_commit => FND_API.G_FALSE,
325 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
326 x_return_status => l_return_status,
327 x_msg_count => l_msg_count,
328 x_msg_data => l_msg_data,
329 p_transaction_line_rec => l_transaction_line_rec_type
330 );
331 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
332 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
333 END IF;
334 END IF;
335 --<R12 eTax Integration End>
336
337 END Delete_Row;
338
339 END PO_LINE_LOCATIONS_PKG_S2;