1: PACKAGE BODY PO_LINES_SV as
2: /* $Header: POXPOL1B.pls 120.6 2007/12/04 09:23:48 bisdas ship $ */
3:
4: /*============================= PO_LINES_SV ===============================*/
5:
1: PACKAGE BODY PO_LINES_SV as
2: /* $Header: POXPOL1B.pls 120.6 2007/12/04 09:23:48 bisdas ship $ */
3:
4: /*============================= PO_LINES_SV ===============================*/
5:
6:
7: /*===========================================================================
8:
24: x_progress := '010';
25: --
26: -- If the calling source is HTML then we need not do the validations as we
27: -- would have already performed these validations in
28: -- PO_LINES_SV.check_deletion_allowed
29: IF p_skip_validation = 'Y' THEN
30: x_allow_delete := 'Y';
31: ELSE
32: /*
35: SELECT line_num,
36: po_header_id
37: INTO X_po_line_num,
38: X_po_header_id
39: FROM po_lines pol
40: WHERE po_line_id = X_po_line_id;
41:
42: /*
43: ** Verify a line can be deleted
85: END IF;
86: Exception when others THEN
87: l_type_name := X_type_lookup_code;
88: End;
89: po_lines_sv.val_line_delete(X_po_line_id => X_po_line_id,
90: X_allow_delete => X_allow_delete,
91: p_token => 'DOCUMENT_TYPE',
92: p_token_value => l_type_name);
93:
102: */
103: IF (x_allow_delete = 'Y') THEN
104:
105: /* call the ATTACHMENTS PKG to delete all attachments*/
106: fnd_attached_documents2_pkg.delete_attachments('PO_LINES',
107: x_po_line_id,
108: '', '', '', '', 'Y');
109:
110:
111: /*
112: ** Delete all children of the selected line.
113: */
114:
115: po_lines_sv.delete_children(X_type_lookup_code, X_po_line_id);
116: --dbms_output.put_line('after delete children');
117:
118: /*
119: ** Delete the Line.
118: /*
119: ** Delete the Line.
120: */
121:
122: po_lines_pkg_sud.delete_row(X_row_id);
123: --dbms_output.put_line('after call to delete row');
124:
125:
126: END IF;
147: X_po_line_id NUMBER := '';
148:
149: CURSOR C_LINE is
150: SELECT po_line_id
151: FROM po_lines_all /*Bug6632095: using base table instead of view */
152: WHERE po_header_id = X_po_header_id;
153:
154:
155: BEGIN
163:
164: FETCH C_LINE INTO x_po_line_id;
165: EXIT WHEN C_LINE%notfound;
166:
167: fnd_attached_documents2_pkg.delete_attachments('PO_LINES',
168: x_po_line_id,
169: '', '', '', '', 'Y');
170:
171: --
188: );
189: --
190:
191: --dbms_output.put_line('Before delete all lines');
192: DELETE FROM PO_LINES_ALL /*Bug6632095: using base table instead of view */
193: WHERE po_header_id = X_po_header_id;
194:
195: EXCEPTION
196: WHEN OTHERS THEN
262: BEGIN
263:
264: --dbms_output.put_line('Before_call');
265:
266: po_lines_sv.val_line_delete(X_po_line_id, X_allow_delete);
267:
268: --dbms_output.put_line('After call');
269: --dbms_output.put_line('Allow Delete = '||X_allow_delete);
270:
295: l_approved_flag PO_HEADERS_ALL.approved_flag%type;
296: l_po_header_id PO_HEADERS_ALL.po_header_id%type;
297: l_approved_date PO_HEADERS_ALL.approved_date%type;
298:
299: l_line_creation_date PO_LINES_ALL.creation_date%type;
300: BEGIN
301: x_progress := '010';
302:
303: -- Get type lookup code and approval status. Variables are used in later checks
311: l_po_header_id,
312: l_approved_date,
313: l_line_creation_date
314: FROM po_headers_all POH,
315: po_lines_all POL
316: WHERE POH.po_header_id = POL.po_header_id
317: AND POL.po_line_id = X_po_line_id;
318:
319: -- Following check is in key_delrec and not in val_line_delete
383:
384: SELECT POH.type_lookup_code
385: INTO l_type_lookup_code
386: FROM PO_HEADERS_ALL POH,
387: PO_LINES_ALL POL
388: WHERE POH.po_header_id = POL.po_header_id
389: AND POL.po_line_id = x_po_line_id;
390:
391: X_allow_delete := 'Y';
475: ** If it does, display message and prevent deletion.
476: */
477:
478: --
479: -- Only check for reserved distributions for Standard and Planned PO lines.
480:
481: SELECT POH.type_lookup_code
482: INTO l_type_lookup_code
483: FROM PO_HEADERS_ALL POH
480:
481: SELECT POH.type_lookup_code
482: INTO l_type_lookup_code
483: FROM PO_HEADERS_ALL POH
484: , PO_LINES_ALL POL
485: WHERE POH.po_header_id = POL.po_header_id
486: AND POL.po_line_id = x_po_line_id
487: ;
488:
618: BEGIN
619:
620: --dbms_output.put_line('before call');
621:
622: IF po_lines_sv.val_approval_status
623: (X_po_line_id ,
624: X_type_lookup_code ,
625: X_unit_price ,
626: X_line_num ,
718: --dbms_output.put_line('Not to Exceed Price = '||X_not_to_exceed_price);
719:
720: SELECT 'Y'
721: INTO X_approval_status_changed
722: FROM po_lines pol
723: WHERE pol.po_line_id = X_po_line_id
724: AND ((pol.unit_price <> X_unit_price)
725: OR (pol.unit_price is NULL
726: AND
933: BEGIN
934:
935: SELECT 'Y'
936: INTO X_approval_status_changed
937: FROM po_lines pol
938: WHERE pol.po_line_id = X_po_line_id
939: AND ((pol.unit_price <> X_unit_price)
940: OR (pol.unit_price is NULL
941: AND
1053: IF X_approval_status_changed <> 'Y' THEN
1054:
1055: SELECT 'Y'
1056: INTO X_approval_status_changed
1057: FROM po_lines pol
1058: WHERE pol.po_line_id = X_po_line_id
1059: AND (
1060: (pol.note_to_vendor <> X_note_to_vendor)
1061: OR (pol.note_to_vendor is NULL
1157: BEGIN
1158:
1159: x_progress := '010';
1160:
1161: /* Bug# 3104460 - PO_LINES.QUANTITY should not be updated. */
1162: IF (X_shipment_type = 'BLANKET') THEN
1163:
1164: IF (X_event = 'INSERT') THEN
1165:
1162: IF (X_shipment_type = 'BLANKET') THEN
1163:
1164: IF (X_event = 'INSERT') THEN
1165:
1166: UPDATE PO_LINES
1167: SET closed_code = 'OPEN'
1168: WHERE po_line_id = X_po_line_id
1169: -- Bug 3202973 Should not update quantity for Services lines:
1170: AND order_type_lookup_code NOT IN ('RATE', 'FIXED PRICE');
1178: po_message_s.sql_error('update_released_quantity', x_progress, sqlcode);
1179: raise;
1180: END update_released_quantity;
1181:
1182: END PO_LINES_SV;