DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_LINE_LOCATIONS_PKG_S0

Source


1 PACKAGE BODY PO_LINE_LOCATIONS_PKG_S0 as
2 /* $Header: POXP1PSB.pls 120.6 2005/08/29 00:26:09 vsanjay noship $ */
3 
4 PROCEDURE Insert_Row
5 (
6     X_Rowid                   IN OUT NOCOPY VARCHAR2,
7     X_Line_Location_Id        IN OUT NOCOPY NUMBER,
8     X_Last_Update_Date               DATE,
9     X_Last_Updated_By                NUMBER,
10     X_Po_Header_Id                   NUMBER,
11     X_Po_Line_Id                     NUMBER,
12     X_Last_Update_Login              NUMBER,
13     X_Creation_Date                  DATE,
14     X_Created_By                     NUMBER,
15     X_Quantity                       NUMBER,
16     X_Quantity_Received              NUMBER,
17     X_Quantity_Accepted              NUMBER,
18     X_Quantity_Rejected              NUMBER,
19     X_Quantity_Billed                NUMBER,
20     X_Quantity_Cancelled             NUMBER,
21     X_Unit_Meas_Lookup_Code          VARCHAR2,
22     X_Po_Release_Id                  NUMBER,
23     X_Ship_To_Location_Id            NUMBER,
24     X_Ship_Via_Lookup_Code           VARCHAR2,
25     X_Need_By_Date                   DATE,
26     X_Promised_Date                  DATE,
27     X_Last_Accept_Date               DATE,
28     X_Price_Override                 NUMBER,
29     X_Encumbered_Flag                VARCHAR2,
30     X_Encumbered_Date                DATE,
31     X_Fob_Lookup_Code                VARCHAR2,
32     X_Freight_Terms_Lookup_Code      VARCHAR2,
33     X_Taxable_Flag                   VARCHAR2,
34     X_Tax_Code_ID                    NUMBER,
35     X_Tax_User_Override_Flag         VARCHAR2,
36     X_Calculate_Tax_Flag             VARCHAR2,
37     X_From_Header_Id                 NUMBER,
38     X_From_Line_Id                   NUMBER,
39     X_From_Line_Location_Id          NUMBER,
40     X_Start_Date                     DATE,
41     X_End_Date                       DATE,
42     X_Lead_Time                      NUMBER,
43     X_Lead_Time_Unit                 VARCHAR2,
44     X_Price_Discount                 NUMBER,
45     X_Terms_Id                       NUMBER,
46     X_Approved_Flag                  VARCHAR2,
47     X_Approved_Date                  DATE,
48     X_Closed_Flag                    VARCHAR2,
49     X_Cancel_Flag                    VARCHAR2,
50     X_Cancelled_By                   NUMBER,
51     X_Cancel_Date                    DATE,
52     X_Cancel_Reason                  VARCHAR2,
53     X_Firm_Status_Lookup_Code        VARCHAR2,
54     X_Attribute_Category             VARCHAR2,
55     X_Attribute1                     VARCHAR2,
56     X_Attribute2                     VARCHAR2,
57     X_Attribute3                     VARCHAR2,
58     X_Attribute4                     VARCHAR2,
59     X_Attribute5                     VARCHAR2,
60     X_Attribute6                     VARCHAR2,
61     X_Attribute7                     VARCHAR2,
62     X_Attribute8                     VARCHAR2,
63     X_Attribute9                     VARCHAR2,
64     X_Attribute10                    VARCHAR2,
65     X_Attribute11                    VARCHAR2,
66     X_Attribute12                    VARCHAR2,
67     X_Attribute13                    VARCHAR2,
68     X_Attribute14                    VARCHAR2,
69     X_Attribute15                    VARCHAR2,
70     X_Inspection_Required_Flag       VARCHAR2,
71     X_Receipt_Required_Flag          VARCHAR2,
72     X_Qty_Rcv_Tolerance              NUMBER,
73     X_Qty_Rcv_Exception_Code         VARCHAR2,
74     X_Enforce_Ship_To_Location       VARCHAR2,
75     X_Allow_Substitute_Receipts      VARCHAR2,
76     X_Days_Early_Receipt_Allowed     NUMBER,
77     X_Days_Late_Receipt_Allowed      NUMBER,
78     X_Receipt_Days_Exception_Code    VARCHAR2,
79     X_Invoice_Close_Tolerance        NUMBER,
80     X_Receive_Close_Tolerance        NUMBER,
81     X_Ship_To_Organization_Id        NUMBER,
82     X_Shipment_Num                   NUMBER,
83     X_Source_Shipment_Id             NUMBER,
84     X_Shipment_Type                  VARCHAR2,
85     X_Closed_Code                    VARCHAR2,
86     X_Ussgl_Transaction_Code         VARCHAR2,
87     X_Government_Context             VARCHAR2,
88     X_Receiving_Routing_Id           NUMBER,
89     X_Accrue_On_Receipt_Flag         VARCHAR2,
90     X_Closed_Reason                  VARCHAR2,
91     X_Closed_Date                    DATE,
92     X_Closed_By                      NUMBER,
93     X_Global_Attribute_Category      VARCHAR2,
94     X_Global_Attribute1              VARCHAR2,
95     X_Global_Attribute2              VARCHAR2,
96     X_Global_Attribute3              VARCHAR2,
97     X_Global_Attribute4              VARCHAR2,
98     X_Global_Attribute5              VARCHAR2,
99     X_Global_Attribute6              VARCHAR2,
100     X_Global_Attribute7              VARCHAR2,
101     X_Global_Attribute8              VARCHAR2,
102     X_Global_Attribute9              VARCHAR2,
103     X_Global_Attribute10             VARCHAR2,
104     X_Global_Attribute11             VARCHAR2,
105     X_Global_Attribute12             VARCHAR2,
106     X_Global_Attribute13             VARCHAR2,
107     X_Global_Attribute14             VARCHAR2,
108     X_Global_Attribute15             VARCHAR2,
109     X_Global_Attribute16             VARCHAR2,
110     X_Global_Attribute17             VARCHAR2,
111     X_Global_Attribute18             VARCHAR2,
112     X_Global_Attribute19             VARCHAR2,
113     X_Global_Attribute20             VARCHAR2,
114     X_Country_of_Origin_Code         VARCHAR2,
115     X_Invoice_Match_Option           VARCHAR2, -- bgu, Dec. 7, 98
116     p_value_basis               IN   VARCHAR2, -- <Complex Work R12>
117     p_matching_basis            IN   VARCHAR2, -- <Complex Work R12>
118     --togeorge 10/03/2000
119     --added note to receiver
120     X_note_to_receiver               VARCHAR2,
121     -- Mahesh Chandak(GML) Add 7 process related fields.
122     -- start of Bug# 1548597
123     X_Secondary_Unit_Of_Measure      VARCHAR2,
124     X_Secondary_Quantity             NUMBER,
125     X_Preferred_Grade                VARCHAR2,
126     X_Secondary_Quantity_Received    NUMBER,
127     X_Secondary_Quantity_Accepted    NUMBER,
128     X_Secondary_Quantity_Rejected    NUMBER,
129     X_Secondary_Quantity_Cancelled   NUMBER,
130     -- end of Bug# 1548597
131     X_Consigned_Flag                 VARCHAR2,  /* CONSIGNED FPI */
132     X_amount                         NUMBER,  -- <SERVICES FPJ>
133     p_transaction_flow_header_id     NUMBER,  --< Shared Proc FPJ >
134     p_manual_price_change_flag       VARCHAR2, --< Manual Price Override FPJ >
135     p_org_id                       IN NUMBER,          -- <R12.MOAC>
136     p_outsourced_assembly          IN NUMBER default 2 --<SHIKYU R12>
137 )
138 IS
139      CURSOR C IS SELECT rowid FROM PO_LINE_LOCATIONS
140                  WHERE line_location_id = X_Line_Location_Id;
141 
142       CURSOR C2 IS SELECT po_line_locations_s.nextval FROM sys.dual;
143       l_tax_attribute_update_code PO_LINE_LOCATIONS_ALL.tax_attribute_update_code%type; --<eTax Integration R12>
144 
145     BEGIN
146       if (X_Line_Location_Id is NULL) then
147         OPEN C2;
148         FETCH C2 INTO X_Line_Location_Id;
149         CLOSE C2;
150       end if;
151        --<eTax Integration  R12>
152       IF X_Shipment_Type in ('STANDARD', 'PLANNED', 'BLANKET', 'SCHEDULED') THEN
153             l_tax_attribute_update_code := 'CREATE';
154       END IF;
155 
156        INSERT INTO PO_LINE_LOCATIONS(
157                line_location_id,
158                last_update_date,
159                last_updated_by,
160                po_header_id,
161                po_line_id,
162                last_update_login,
163                creation_date,
164                created_by,
165                quantity,
166                quantity_received,
167                quantity_accepted,
168                quantity_rejected,
169                quantity_billed,
170                quantity_cancelled,
171                unit_meas_lookup_code,
172                po_release_id,
173                ship_to_location_id,
174                ship_via_lookup_code,
175                need_by_date,
176                promised_date,
177                last_accept_date,
178                price_override,
179                encumbered_flag,
180                encumbered_date,
181                fob_lookup_code,
182                freight_terms_lookup_code,
183                taxable_flag,
184 	       calculate_tax_flag,
185                from_header_id,
186                from_line_id,
187                from_line_location_id,
188                start_date,
189                end_date,
190                lead_time,
191                lead_time_unit,
192                price_discount,
193                terms_id,
194                approved_flag,
195                approved_date,
196                closed_flag,
197                cancel_flag,
198                cancelled_by,
199                cancel_date,
200                cancel_reason,
201                firm_status_lookup_code,
202                attribute_category,
203                attribute1,
204                attribute2,
205                attribute3,
206                attribute4,
207                attribute5,
208                attribute6,
209                attribute7,
210                attribute8,
211                attribute9,
212                attribute10,
213                attribute11,
214                attribute12,
215                attribute13,
216                attribute14,
217                attribute15,
218                inspection_required_flag,
219                receipt_required_flag,
220                qty_rcv_tolerance,
221                qty_rcv_exception_code,
222                enforce_ship_to_location_code,
223                allow_substitute_receipts_flag,
224                days_early_receipt_allowed,
225                days_late_receipt_allowed,
226                receipt_days_exception_code,
227                invoice_close_tolerance,
228                receive_close_tolerance,
229                ship_to_organization_id,
230                shipment_num,
231                source_shipment_id,
232                shipment_type,
233                closed_code,
234                government_context,
235                receiving_routing_id,
236                accrue_on_receipt_flag,
237                closed_reason,
238                closed_date,
239                closed_by,
240 		global_attribute_category,
241 		global_attribute1,
242 		global_attribute2,
243 		global_attribute3,
244 		global_attribute4,
245 		global_attribute5,
246 		global_attribute6,
247 		global_attribute7,
248 		global_attribute8,
249 		global_attribute9,
250 		global_attribute10,
251 		global_attribute11,
252 		global_attribute12,
253 		global_attribute13,
254 		global_attribute14,
255 		global_attribute15,
256 		global_attribute16,
257 		global_attribute17,
258 		global_attribute18,
259 		global_attribute19,
260 		global_attribute20,
261 	 	country_of_origin_code,
262 	        match_option, --bgu, Dec. 7, 98
263 		--togeorge 10/03/2000
264 		--added note to receiver
265 		note_to_receiver,
266 --Start of 1548597.Add 7 fields in the insert clause
267                 secondary_unit_of_measure,
268                 secondary_quantity,
269                 preferred_grade,
270                 secondary_quantity_received,
271                 secondary_quantity_accepted,
272                 secondary_quantity_rejected,
273                 secondary_quantity_cancelled,
274 --end of 1548597
275                 consigned_flag,  /* CONSIGNED FPI */
276                 amount,  -- <SERVICES FPJ>
277                 transaction_flow_header_id,  --< Shared Proc FPJ >
278                 manual_price_change_flag  --<  Manual Price Override FPJ >
279                   --<DBI Req Fulfillment 11.5.11 Start >
280                 ,shipment_closed_date
281                 ,closed_for_receiving_date
282                 ,closed_for_invoice_date
283                 --<DBI Req Fulfillment 11.5.11 End >
284 		,Org_Id                -- <R12.MOAC>
285                 , value_basis    -- <Complex Work R12>
286                 , matching_basis -- <Complex Work R12>
287                 , outsourced_assembly --<SHIKYU R12>
288                 , tax_attribute_update_code --<eTax Integration R12>
289              ) VALUES (
290                X_Line_Location_Id,
291                X_Last_Update_Date,
292                X_Last_Updated_By,
293                X_Po_Header_Id,
294                X_Po_Line_Id,
295                X_Last_Update_Login,
296                X_Creation_Date,
297                X_Created_By,
298                X_Quantity,
299                X_Quantity_Received,
300                X_Quantity_Accepted,
301                X_Quantity_Rejected,
302                X_Quantity_Billed,
303                X_Quantity_Cancelled,
304                X_Unit_Meas_Lookup_Code,
305                X_Po_Release_Id,
306                X_Ship_To_Location_Id,
307                X_Ship_Via_Lookup_Code,
308                X_Need_By_Date,
309                X_Promised_Date,
310                X_Last_Accept_Date,
311                X_Price_Override,
312                X_Encumbered_Flag,
313                X_Encumbered_Date,
314                X_Fob_Lookup_Code,
315                X_Freight_Terms_Lookup_Code,
316                X_Taxable_Flag,
317 	       X_Calculate_Tax_Flag,
318                X_From_Header_Id,
319                X_From_Line_Id,
320                X_From_Line_Location_Id,
321                X_Start_Date,
322                X_End_Date,
323                X_Lead_Time,
324                X_Lead_Time_Unit,
325                X_Price_Discount,
326                X_Terms_Id,
327                X_Approved_Flag,
328                X_Approved_Date,
329                X_Closed_Flag,
330                X_Cancel_Flag,
331                X_Cancelled_By,
332                X_Cancel_Date,
333                X_Cancel_Reason,
334                X_Firm_Status_Lookup_Code,
335                X_Attribute_Category,
336                X_Attribute1,
337                X_Attribute2,
338                X_Attribute3,
339                X_Attribute4,
340                X_Attribute5,
341                X_Attribute6,
342                X_Attribute7,
343                X_Attribute8,
344                X_Attribute9,
345                X_Attribute10,
346                X_Attribute11,
347                X_Attribute12,
348                X_Attribute13,
349                X_Attribute14,
350                X_Attribute15,
351                X_Inspection_Required_Flag,
352                X_Receipt_Required_Flag,
353                X_Qty_Rcv_Tolerance,
354                X_Qty_Rcv_Exception_Code,
355                X_Enforce_Ship_To_Location,
356                X_Allow_Substitute_Receipts,
357                X_Days_Early_Receipt_Allowed,
358                X_Days_Late_Receipt_Allowed,
359                X_Receipt_Days_Exception_Code,
360                X_Invoice_Close_Tolerance,
361                X_Receive_Close_Tolerance,
362                X_Ship_To_Organization_Id,
363                X_Shipment_Num,
364                X_Source_Shipment_Id,
365                X_Shipment_Type,
366                X_Closed_Code,
367                X_Government_Context,
368                X_Receiving_Routing_Id,
369                X_Accrue_On_Receipt_Flag,
370                X_Closed_Reason,
371                X_Closed_Date,
372                X_Closed_By,
373                X_Global_Attribute_Category,
374                X_Global_Attribute1,
375                X_Global_Attribute2,
376                X_Global_Attribute3,
377                X_Global_Attribute4,
378                X_Global_Attribute5,
379                X_Global_Attribute6,
380                X_Global_Attribute7,
384                X_Global_Attribute11,
381                X_Global_Attribute8,
382                X_Global_Attribute9,
383                X_Global_Attribute10,
385                X_Global_Attribute12,
386                X_Global_Attribute13,
387                X_Global_Attribute14,
388                X_Global_Attribute15,
389                X_Global_Attribute16,
390                X_Global_Attribute17,
391                X_Global_Attribute18,
392                X_Global_Attribute19,
393                X_Global_Attribute20,
394 	       X_Country_of_Origin_Code,
395 	       X_Invoice_Match_Option,  --bgu, Dec. 7, 98
396 	       --togeorge 10/03/2000
397 	       --added note to receiver
398 	       X_note_to_receiver,
399 --Start of Bug# 1548597.
400                X_Secondary_Unit_Of_Measure,
401                X_Secondary_Quantity,
402                X_Preferred_Grade,
403                X_Secondary_Quantity_Received,
404                X_Secondary_Quantity_Accepted,
405                X_Secondary_Quantity_Rejected,
406                X_Secondary_Quantity_Cancelled,
407 -- end of Bug# 1548597
408                X_Consigned_Flag,  /* CONSIGNED FPI */
409                X_amount,  -- <SERVICES FPJ>
410                p_transaction_flow_header_id,  --< Shared Proc FPJ >
411                p_manual_price_change_flag  --< Manual Price Override FPJ >
412                --<DBI Req Fulfillment 11.5.11 Start >
413               ,decode(X_Closed_code,'CLOSED',
414 	             nvl(X_closed_date,sysdate), null)      ---- Shipment_closed_date
415               , decode(X_Closed_code,'CLOSED',nvl(X_closed_date,sysdate),
416                  'CLOSED FOR RECEIVING',sysdate,null)     --- Closed_for_receiving
417               , decode(X_Closed_code,'CLOSED',nvl(X_closed_date,sysdate),
418                  'CLOSED FOR INVOICE',sysdate,null)      -- closed_for_invoice_date
419               --<DBI Req Fulfillment 11.5.11 End >
420 	      ,p_org_id                -- <R12.MOAC>
421               , p_value_basis     -- <Complex Work R12>
422               , p_matching_basis  -- <Complex Work R12>
423               , p_outsourced_assembly --<SHIKYU R12>
424               ,l_tax_attribute_update_code --<eTax integration R12>
425 	);
426 
427     OPEN C;
428     FETCH C INTO X_Rowid;
429     if (C%NOTFOUND) then
430       CLOSE C;
431       Raise NO_DATA_FOUND;
432     end if;
433     CLOSE C;
434   END Insert_Row;
435 END PO_LINE_LOCATIONS_PKG_S0;