DBA Data[Home] [Help]

PACKAGE BODY: APPS.PO_REQUISITION_LINES_PKG1

Source


1 PACKAGE BODY PO_REQUISITION_LINES_PKG1 as
2 /* $Header: POXRIL2B.pls 120.1 2005/06/27 04:48:16 sjadhav noship $ */
3 
4 
5   PROCEDURE Lock1_Row(X_Rowid                         VARCHAR2,
6                      X_Requisition_Line_Id            NUMBER,
7                      X_Requisition_Header_Id          NUMBER,
8                      X_Line_Num                       NUMBER,
9                      X_Line_Type_Id                   NUMBER,
10                      X_Category_Id                    NUMBER,
11                      X_Item_Description               VARCHAR2,
12                      X_Unit_Meas_Lookup_Code          VARCHAR2,
13                      X_Unit_Price                     NUMBER,
14                      X_Quantity                       NUMBER,
15                      X_Amount                         NUMBER, -- <SERVICES FPJ>
16                      X_Deliver_To_Location_Id         NUMBER,
17                      X_To_Person_Id                   NUMBER,
18                      X_Source_Type_Code               VARCHAR2,
19                      X_Item_Id                        NUMBER,
20          X_Tax_Code_Id      NUMBER,
21          X_Tax_User_Override_Flag   VARCHAR2,
22 -- MC bug# 1548597.. Add 3 process related columns.unit_of_measure,quantity and grade.
23 -- start of 1548597
24                        X_Secondary_Unit_Of_Measure      VARCHAR2 default null,
25                        X_Secondary_Quantity             NUMBER default null,
26                        X_Preferred_Grade                VARCHAR2 default null
27 -- end of 1548597
28   ) IS
29 
30     CURSOR C IS
31         SELECT *
32         FROM   PO_REQUISITION_LINES
33         WHERE  rowid = X_Rowid
34         FOR UPDATE of Requisition_Line_Id NOWAIT;
35 
36     Recinfo C%ROWTYPE;
37   BEGIN
38     OPEN C;
39     FETCH C INTO Recinfo;
40     if (C%NOTFOUND) then
41       CLOSE C;
42       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
43       APP_EXCEPTION.Raise_Exception;
44       -- raise app_exception.record_lock_exception;
45     end if;
46     CLOSE C;
47     if (
48 
49                (Recinfo.requisition_line_id = X_Requisition_Line_Id)
50            AND (Recinfo.requisition_header_id = X_Requisition_Header_Id)
51            AND (Recinfo.line_num = X_Line_Num)
52            AND (Recinfo.line_type_id = X_Line_Type_Id)
53            AND (Recinfo.category_id = X_Category_Id)
54            AND (Recinfo.item_description = X_Item_Description)
55 
56            -- <SERVICES FPJ START>
57            AND (   ( recinfo.unit_meas_lookup_code = x_unit_meas_lookup_code )
58                OR  (   ( recinfo.unit_meas_lookup_code IS NULL )
59                    AND ( x_unit_meas_lookup_code IS NULL ) ) )
60 
61            AND (   ( recinfo.unit_price = x_unit_price )
62                OR  (   ( recinfo.unit_price IS NULL )
63                    AND ( x_unit_price IS NULL ) ) )
64 
65            AND (   ( recinfo.quantity = x_quantity )
66                OR  (   ( recinfo.quantity IS NULL )
67                    AND ( x_quantity IS NULL ) ) )
68 
69            AND (   ( recinfo.amount = x_amount )
70                OR  (   ( recinfo.amount IS NULL )
71                    AND ( x_amount IS NULL ) ) )
72            -- <SERVICES FPJ END>
73 
74            AND (Recinfo.deliver_to_location_id = X_Deliver_To_Location_Id)
75            AND (Recinfo.to_person_id = X_To_Person_Id)
76            AND (Recinfo.source_type_code = X_Source_Type_Code)
77            AND (   (Recinfo.item_id = X_Item_Id)
78                 OR (    (Recinfo.item_id IS NULL)
79                     AND (X_Item_Id IS NULL)))
80 -- start of 1548597
81            AND ((Recinfo.secondary_unit_of_measure = X_Secondary_Unit_Of_Measure)
82                 OR (    (Recinfo.secondary_unit_of_measure IS NULL)
83                     AND (X_Secondary_Unit_Of_Measure IS NULL)))
84            AND ((Recinfo.secondary_quantity = X_Secondary_Quantity)
85                 OR (    (Recinfo.secondary_quantity IS NULL)
86                     AND (X_Secondary_quantity IS NULL)))
87            AND ((Recinfo.preferred_grade = X_Preferred_Grade)
88                 OR (    (Recinfo.preferred_grade IS NULL)
89                     AND (X_Preferred_Grade IS NULL)))
90 -- end of 1548597
91             ) then
92       return;
93     else
94       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
95       APP_EXCEPTION.RAISE_EXCEPTION;
96       --raise app_exception.record_lock_exception;
97     end if;
98   END Lock1_Row;
99 
100 
101 
102   PROCEDURE Delete_Row(X_Rowid        VARCHAR2,
103            X_transferred_to_oe_flag     OUT NOCOPY VARCHAR2) IS
104   x_progress VARCHAR2(3) := NULL;
105   x_requisition_header_id NUMBER;
106 
107   BEGIN
108 
109     x_progress := '010';
110 
111     SELECT requisition_header_id
112     INTO   x_requisition_header_id
113     FROM   po_requisition_lines
114     WHERE  rowid = X_rowid;
115 
116     if (SQL%NOTFOUND) then
117       Raise NO_DATA_FOUND;
118     end if;
119 
120     x_progress := '020';
121 
122     DELETE FROM PO_REQUISITION_LINES
123     WHERE  rowid = X_Rowid;
124 
125     if (SQL%NOTFOUND) then
126       Raise NO_DATA_FOUND;
127     end if;
128 
129 
130     x_progress := '030';
131     --dbms_output.put_line ('Before call to update_transferred...');
132 
133     po_req_lines_sv.update_transferred_to_oe_flag (X_requisition_header_id,
134              X_transferred_to_oe_flag);
135 
136 
137    EXCEPTION
138     WHEN OTHERS then
139       po_message_s.sql_error('DELETE_ROW',x_progress,sqlcode);
140 
141   END Delete_Row;
142 
143 
144 END PO_REQUISITION_LINES_PKG1;