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