[Home] [Help]
Skip to content
TYPE BODY: APPS.PO_LINES_REC_TYPE
Source
1 TYPE BODY po_lines_rec_type AS
2
3 /**
4 * Name: create_object
5 * Function:
6 * Creates a PO_LINES_REC_TYPE object based on the given tables of
7 * field values. These tables must all be the same size.
8 * To create an empty object, pass in NULL for p_po_line_id.
9 */
10 STATIC FUNCTION create_object (
11 p_po_line_id po_tbl_number,
12 p_unit_price po_tbl_number,
13 p_vendor_product_num po_tbl_varchar30,
14 p_quantity po_tbl_number,
15 p_start_date po_tbl_date,
16 p_expiration_date po_tbl_date,
17 p_amount po_tbl_number,
18 p_request_unit_of_measure po_tbl_varchar30,
19 p_secondary_quantity po_tbl_number,
20 p_request_secondary_uom po_tbl_varchar30,
21 p_delete_record po_tbl_varchar1,
22 p_delete_price_adjs po_tbl_varchar1, --Enhanced Pricing
23 p_preferred_grade po_tbl_varchar240 --INVCONV sschinch
24 ) RETURN po_lines_rec_type
25 IS
26 c NUMBER;
27 l_line_changes PO_LINES_REC_TYPE;
28 BEGIN
29 l_line_changes := po_lines_rec_type (
30 po_line_id => po_tbl_number(),
31 unit_price => po_tbl_number(),
32 vendor_product_num => po_tbl_varchar30(),
33 quantity => po_tbl_number(),
34 start_date => po_tbl_date(),
35 expiration_date => po_tbl_date(),
36 amount => po_tbl_number(),
37 request_unit_of_measure => po_tbl_varchar30(),
38 secondary_quantity => po_tbl_number(),
39 request_secondary_uom => po_tbl_varchar30(),
40 delete_record => po_tbl_varchar1(),
41 delete_price_adjs => po_tbl_varchar1(), --Enhanced Pricing
42 preferred_grade => po_tbl_varchar240(), --INVCONV sschinch
43 /** Cached fields: **/
44 c_quantity => po_tbl_number(),
45 c_unit_meas_lookup_code => po_tbl_varchar30(),
46 c_item_id => po_tbl_number(),
47 c_from_header_id => po_tbl_number(),
48 c_from_line_id => po_tbl_number(),
49 c_has_ga_reference => po_tbl_varchar1(),
50 c_cancel_flag => po_tbl_varchar1(),
51 c_closed_code => po_tbl_varchar30(),
52 c_value_basis => po_tbl_varchar30(),
53 c_purchase_basis => po_tbl_varchar30(),
54 c_amount => po_tbl_number(),
55 c_start_date => po_tbl_date(),
56 c_expiration_date => po_tbl_date(),
57 c_unit_price => po_tbl_number(),
58 c_from_line_location_id => po_tbl_number(),
59 c_secondary_quantity => po_tbl_number(),
60 c_secondary_uom => po_tbl_varchar30(),
61 c_item_number => po_tbl_varchar40(),
62 c_preferred_grade => po_tbl_varchar240(), --INVCONV sschinch
63 /** Temporary fields: **/
64 t_from_price_break => po_tbl_varchar1(),
65 t_from_line_location_id => po_tbl_number(),
66 -- <FPJ Advanced Price>
67 t_base_unit_price => po_tbl_number(),
68 -- <Manual Price Override FPJ>
69 t_manual_price_change_flag => po_tbl_varchar1(),
70 t_new_secondary_uom => po_tbl_varchar30() --INVCONV sschinch
71 );
72
73 /**
74 * If the caller passed in values for p_po_line_id, copy them to the object.
75 **/
76 IF (p_po_line_id IS NOT NULL) THEN
77 l_line_changes.po_line_id := p_po_line_id;
78 END IF;
79 c := l_line_changes.po_line_id.COUNT;
80
81 /**
82 * Extend all the other fields to the same size as po_line_id.
83 **/
84 l_line_changes.extend_fields(c);
85
86 /**
87 * If the caller passed in values for a field, copy them to the object.
88 **/
89 IF (p_unit_price IS NOT NULL) THEN
90 l_line_changes.unit_price := p_unit_price;
91 END IF;
92 IF (p_vendor_product_num IS NOT NULL) THEN
93 l_line_changes.vendor_product_num := p_vendor_product_num;
94 END IF;
95 IF (p_quantity IS NOT NULL) THEN
96 l_line_changes.quantity := p_quantity;
97 END IF;
98 IF (p_start_date IS NOT NULL) THEN
99 l_line_changes.start_date := p_start_date;
100 END IF;
101 IF (p_expiration_date IS NOT NULL) THEN
102 l_line_changes.expiration_date := p_expiration_date;
103 END IF;
104 IF (p_amount IS NOT NULL) THEN
105 l_line_changes.amount := p_amount;
106 END IF;
107 IF (p_request_unit_of_measure IS NOT NULL) THEN
108 l_line_changes.request_unit_of_measure := p_request_unit_of_measure;
109 END IF;
110 IF (p_secondary_quantity IS NOT NULL) THEN
111 l_line_changes.secondary_quantity := p_secondary_quantity;
112 END IF;
113 IF (p_request_secondary_uom IS NOT NULL) THEN
114 l_line_changes.request_secondary_uom := p_request_secondary_uom;
115 END IF;
116 IF (p_delete_record IS NOT NULL) THEN
117 l_line_changes.delete_record := p_delete_record;
118 END IF;
119
120 /* Enhanced Pricing Start*/
121 IF (p_delete_price_adjs IS NOT NULL) THEN
122 l_line_changes.delete_price_adjs := p_delete_price_adjs;
123 END IF;
124 /* Enhanced Pricing End*/
125
126 /* sschinch INVCONV */
127 IF (p_preferred_grade IS NOT NULL) THEN
128 l_line_changes.preferred_grade := p_preferred_grade;
129 END IF;
130 /* sschinch INVCONV */
131
132 RETURN l_line_changes;
133 END;
134
135 /**
136 * Name: add_change
137 * Function:
138 * Adds the given change to this object.
139 */
140 MEMBER PROCEDURE add_change (
141 p_po_line_id NUMBER,
142 p_unit_price NUMBER,
143 p_vendor_product_num VARCHAR2,
144 p_quantity NUMBER,
145 p_start_date DATE,
146 p_expiration_date DATE,
147 p_amount NUMBER,
148 p_request_unit_of_measure VARCHAR2,
149 p_secondary_quantity NUMBER,
150 p_request_secondary_uom VARCHAR2,
151 p_delete_record VARCHAR2,
152 p_delete_price_adjs VARCHAR2, --Enhanced Pricing
153 p_preferred_grade VARCHAR2 --INVCONV sschinch
154 ) IS
155 c NUMBER;
156 BEGIN
157 SELF.po_line_id.extend;
158 c := SELF.po_line_id.COUNT;
159 SELF.po_line_id(c) := p_po_line_id;
160
161 /**
162 * Extend all the other fields by 1.
163 **/
164 extend_fields (1);
165
166 /**
167 * Copy the passed-in values to the object.
168 **/
169 SELF.unit_price(c) := p_unit_price;
170 SELF.vendor_product_num(c) := p_vendor_product_num;
171 SELF.quantity(c) := p_quantity;
172 SELF.start_date(c) := p_start_date;
173 SELF.expiration_date(c) := p_expiration_date;
174 SELF.amount(c) := p_amount;
175 SELF.request_unit_of_measure(c) := p_request_unit_of_measure;
176 SELF.secondary_quantity(c) := p_secondary_quantity;
177 SELF.request_secondary_uom(c) := p_request_secondary_uom;
178 SELF.delete_record(c) := p_delete_record;
179 SELF.delete_price_adjs(c) := p_delete_price_adjs; --Enhanced Pricing
180 SELF.preferred_grade(c) := p_preferred_grade; --INVCONV sschinch
181 END add_change;
182
183 /**
184 * Name: extend_fields (INTERNAL)
185 * Function:
186 * Extends the PL/SQL table for each of the fields by the given size.
187 * Notes:
188 * Do not call this method.
189 * It is only for internal use by other methods in this object.
190 */
191 MEMBER PROCEDURE extend_fields (
192 l_extend_size NUMBER
193 ) IS
194 BEGIN
195 unit_price.extend ( l_extend_size );
196 vendor_product_num.extend ( l_extend_size );
197 quantity.extend ( l_extend_size );
198 start_date.extend ( l_extend_size );
199 expiration_date.extend ( l_extend_size );
200 amount.extend ( l_extend_size );
201 request_unit_of_measure.extend ( l_extend_size );
202 secondary_quantity.extend ( l_extend_size );
203 request_secondary_uom.extend ( l_extend_size );
204 delete_record.extend ( l_extend_size );
205 delete_price_adjs.extend ( l_extend_size ); --Enhanced Pricing
206 preferred_grade.extend(l_extend_size); --INVCONV sschinch
207 c_quantity.extend ( l_extend_size );
208 c_unit_meas_lookup_code.extend ( l_extend_size );
209 c_item_id.extend ( l_extend_size );
210 c_from_header_id.extend ( l_extend_size );
211 c_from_line_id.extend ( l_extend_size );
212 c_has_ga_reference.extend ( l_extend_size );
213 c_cancel_flag.extend ( l_extend_size );
214 c_closed_code.extend ( l_extend_size );
215 c_value_basis.extend ( l_extend_size );
216 c_purchase_basis.extend ( l_extend_size );
217 c_amount.extend ( l_extend_size );
218 c_start_date.extend ( l_extend_size );
219 c_expiration_date.extend ( l_extend_size );
220 c_unit_price.extend ( l_extend_size );
221 c_from_line_location_id.extend ( l_extend_size );
222 c_secondary_quantity.extend ( l_extend_size );
223 c_secondary_uom.extend ( l_extend_size );
224 c_item_number.extend ( l_extend_size );
225 c_preferred_grade.extend(l_extend_size); --INVCONV sschinch
226 t_from_price_break.extend ( l_extend_size );
227 t_from_line_location_id.extend ( l_extend_size );
228 -- <FPJ Advanced Price>
229 t_base_unit_price.extend ( l_extend_size );
230 -- <Manual Price Override FPJ>
231 t_manual_price_change_flag.extend ( l_extend_size );
232 t_new_secondary_uom.extend(l_extend_size); --INVCONV
233 END;
234
235 /**
236 * Name: get_count
237 * Function:
238 * Returns the number of changes in this object.
239 */
240 MEMBER FUNCTION get_count RETURN NUMBER IS
241 BEGIN
242 RETURN SELF.po_line_id.COUNT;
243 END;
244
245 /**
246 * Name: set_unit_price
247 * Function:
248 * Sets the unit price on the given line change.
249 */
250 MEMBER PROCEDURE set_unit_price (
251 p_index NUMBER,
252 p_unit_price NUMBER
253 ) IS BEGIN
254 SELF.unit_price(p_index) := p_unit_price;
255 END;
256
257 /**
258 * Name: set_quantity
259 * Function:
260 * Sets the quantity on the given line change.
261 */
262 MEMBER PROCEDURE set_quantity (
263 p_index NUMBER,
264 p_quantity NUMBER
265 ) IS BEGIN
266 SELF.quantity(p_index) := p_quantity;
267 END;
268
269 /**
270 * Name: set_amount
271 * Function:
272 * Sets the amount on the given line change.
273 */
274 MEMBER PROCEDURE set_amount (
275 p_index NUMBER,
276 p_amount NUMBER
277 ) IS BEGIN
278 SELF.amount(p_index) := p_amount;
279 END;
280
281 /**
282 * Name: dump_to_log
283 * Function:
284 * Writes the contents of this object to the FND log.
285 * Notes:
286 * This procedure is for debugging purposes only.
287 */
288 MEMBER PROCEDURE dump_to_log
289 IS
290 l_msg VARCHAR2(2000);
291 BEGIN
292 FOR i IN 1..get_count LOOP
293 l_msg := 'Line change ' || i || ': ';
294 l_msg := substrb(l_msg || 'po_line_id ' || po_line_id(i) , 1, 2000);
295 l_msg := substrb(l_msg || '; quantity ' || quantity(i) , 1, 2000);
296 l_msg := substrb(l_msg || '; unit_price ' || unit_price(i) , 1, 2000);
297 l_msg := substrb(l_msg || '; vendor_product_num ' || vendor_product_num(i) , 1, 2000);
298 l_msg := substrb(l_msg || '; start_date ' || start_date(i) , 1, 2000);
299 l_msg := substrb(l_msg || '; expiration_date ' || expiration_date(i) , 1, 2000);
300 l_msg := substrb(l_msg || '; amount ' || amount(i) , 1, 2000);
301 l_msg := substrb(l_msg || '; request_unit_of_measure ' || request_unit_of_measure(i) , 1, 2000);
302 l_msg := substrb(l_msg || '; secondary_quantity ' || secondary_quantity(i) , 1, 2000);
303 l_msg := substrb(l_msg || '; request_secondary_uom ' || request_secondary_uom(i) , 1, 2000);
304 l_msg := substrb(l_msg || '; delete_record ' || delete_record(i) , 1, 2000);
305 l_msg := substrb(l_msg || '; delete_price_adjs ' || delete_price_adjs(i) , 1, 2000); --Enhanced Pricing
306 FND_LOG.string( FND_LOG.LEVEL_STATEMENT,
307 'po.plsql.PO_LINES_REC_TYPE.dump_to_log',
308 l_msg );
309 FND_LOG.string( FND_LOG.LEVEL_STATEMENT,
310 'po.plsql.PO_LINES_REC_TYPE.dump_to_log',
311 l_msg );
312 END LOOP;
313 END dump_to_log;
314
315 END;