DBA Data[Home] [Help]

TYPE BODY: APPS.PO_SHIPMENTS_REC_TYPE

Source


1 TYPE BODY po_shipments_rec_type AS
2 
3   /**
4   * Name: PO_SHIPMENTS_REC_TYPE
5   * Function:
6   *   Creates a PO_SHIPMENTS_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_location_id.
9   */
10   STATIC FUNCTION create_object (
11     p_po_line_location_id      po_tbl_number,
12     p_quantity                 po_tbl_number,
13     p_promised_date            po_tbl_date,
14     p_price_override           po_tbl_number,
15     p_parent_line_location_id  po_tbl_number,
16     p_split_shipment_num       po_tbl_number,
17     p_need_by_date             po_tbl_date,
18     p_ship_to_location_id      po_tbl_number,
19     p_sales_order_update_date  po_tbl_date,
20     p_amount                   po_tbl_number,
21     p_request_unit_of_measure  po_tbl_varchar30,
22     p_secondary_quantity       po_tbl_number,
23     p_request_secondary_uom    po_tbl_varchar30,
24     p_delete_record            po_tbl_varchar1,
25      /* << Complex work changes for R12 >>*/
26     p_payment_type             po_tbl_varchar30 ,
27     p_description              po_tbl_varchar240,
28     p_new_supp_order_line_no   po_tbl_varchar25
29   ) RETURN po_shipments_rec_type
30   IS
31     c NUMBER;
32     l_shipment_changes PO_SHIPMENTS_REC_TYPE;
33   BEGIN
34     l_shipment_changes := po_shipments_rec_type (
35       po_line_location_id      => po_tbl_number(),
36       quantity                 => po_tbl_number(),
37       promised_date            => po_tbl_date(),
38       price_override           => po_tbl_number(),
39       parent_line_location_id  => po_tbl_number(),
40       split_shipment_num       => po_tbl_number(),
41       need_by_date             => po_tbl_date(),
42       ship_to_location_id      => po_tbl_number(),
43       sales_order_update_date  => po_tbl_date(),
44       amount                   => po_tbl_number(),
45       request_unit_of_measure  => po_tbl_varchar30(),
46       secondary_quantity       => po_tbl_number(),
47       request_secondary_uom    => po_tbl_varchar30(),
48       delete_record            => po_tbl_varchar1(),
49       preferred_grade          => po_tbl_varchar240(), --INVCONV sschinch
50       /* << Complex work changes for R12 >>*/
51       payment_type             => po_tbl_varchar30(),
52       description              => po_tbl_varchar240(),
53       new_supp_order_line_no   => po_tbl_varchar25(),
54       /** Cached fields: **/
55       c_po_line_id             => po_tbl_number(),
56       c_quantity               => po_tbl_number(),
57       c_unit_meas_lookup_code  => po_tbl_varchar30(),
58       c_cancel_flag            => po_tbl_varchar1(),
59       c_closed_code            => po_tbl_varchar30(),
60       c_item_id                => po_tbl_number(),
61       c_ship_to_organization_id => po_tbl_number(),
62       c_drop_ship_flag         => po_tbl_varchar1(),
63       c_quantity_received      => po_tbl_number(),
64       c_quantity_billed        => po_tbl_number(),
65 
66 
67 
68       c_amount_billed          => po_tbl_number(),
69       c_amount_received        => po_tbl_number(),
70       c_accrue_on_receipt_flag => po_tbl_varchar1(),
71       c_value_basis            => po_tbl_varchar30(),
72       c_purchase_basis         => po_tbl_varchar30(),
73       c_amount                 => po_tbl_number(),
74       c_price_override         => po_tbl_number(),
75       c_parent_quantity        => po_tbl_number(),
76       c_parent_amount          => po_tbl_number(),
77       c_secondary_quantity     => po_tbl_number(),
78       c_secondary_uom          => po_tbl_varchar30(),
79 
80 
81 
82       c_item_number            => po_tbl_varchar40(),
83       c_approved_date          => po_tbl_date(),
84       c_encumbered_flag        => po_tbl_varchar1(),
85       c_shipment_type          => po_tbl_varchar30(),
86       c_quantity_shipped       => po_tbl_number(),
87       c_preferred_grade        => po_tbl_varchar240(),  -- INVCONV
88       c_payment_type           => po_tbl_varchar30(),
89       /** Temporary fields: **/
90       t_from_price_break       => po_tbl_varchar1(),
91       -- <Manual Price Override FPJ>
92       t_manual_price_change_flag => po_tbl_varchar1(),
93       t_sec_qty_grade_change_only => po_tbl_varchar1()  --INVCONV
94 
95 
96 
97 
98     );
99 
100     /**
101     * If the caller passed in values for p_po_line_location_id, copy them
102     * to the object.
103     **/
104     IF (p_po_line_location_id IS NOT NULL) THEN
105       l_shipment_changes.po_line_location_id := p_po_line_location_id;
106     END IF;
107     c := l_shipment_changes.po_line_location_id.COUNT;
108 
109 
110 
111 
112     /**
113     * Extend all the other fields to the same size as po_line_location_id.
114     **/
115     l_shipment_changes.extend_fields(c);
116 
117     /**
118     * If the caller passed in values for a field, copy them to the object.
119     **/
120     IF (p_quantity IS NOT NULL) THEN
121       l_shipment_changes.quantity := p_quantity;
122 
123 
124 
125     END IF;
126     IF (p_promised_date IS NOT NULL) THEN
127       l_shipment_changes.promised_date := p_promised_date;
128     END IF;
129     IF (p_price_override IS NOT NULL) THEN
130       l_shipment_changes.price_override := p_price_override;
131     END IF;
132     IF (p_parent_line_location_id IS NOT NULL) THEN
133       l_shipment_changes.parent_line_location_id := p_parent_line_location_id;
134     END IF;
135     IF (p_split_shipment_num IS NOT NULL) THEN
136 
137 
138 
139       l_shipment_changes.split_shipment_num := p_split_shipment_num;
140     END IF;
141     IF (p_need_by_date IS NOT NULL) THEN
142       l_shipment_changes.need_by_date := p_need_by_date;
143     END IF;
144     IF (p_ship_to_location_id IS NOT NULL) THEN
145       l_shipment_changes.ship_to_location_id := p_ship_to_location_id;
146     END IF;
147     IF (p_sales_order_update_date IS NOT NULL) THEN
148       l_shipment_changes.sales_order_update_date := p_sales_order_update_date;
149     END IF;
150 
151     IF (p_new_supp_order_line_no IS NOT NULL) THEN
152       l_shipment_changes.new_supp_order_line_no :=p_new_supp_order_line_no;
153     END IF;
154 
155 
156     IF (p_amount IS NOT NULL) THEN
157       l_shipment_changes.amount := p_amount;
158     END IF;
159     IF (p_request_unit_of_measure IS NOT NULL) THEN
160       l_shipment_changes.request_unit_of_measure := p_request_unit_of_measure;
161     END IF;
162     IF (p_secondary_quantity IS NOT NULL) THEN
163       l_shipment_changes.secondary_quantity := p_secondary_quantity;
164     END IF;
165     IF (p_request_secondary_uom IS NOT NULL) THEN
166       l_shipment_changes.request_secondary_uom := p_request_secondary_uom;
167     END IF;
168     IF (p_delete_record IS NOT NULL) THEN
169       l_shipment_changes.delete_record := p_delete_record;
170     END IF;
171 /* << Complex work changes for R12 >>*/
172     IF (p_payment_type IS NOT NULL) THEN
173         l_shipment_changes.payment_type := p_payment_type;
174     END IF;
175 
176     IF (p_description IS NOT NULL) THEN
177         l_shipment_changes.description := p_description;
178     END IF;
179 
180 
181     RETURN l_shipment_changes;
182   END;
183 
184   /**
185   * Name: add_change
186   * Function:
187 
188 
189 
190   *   Adds the given change to this object.
191   */
192   MEMBER PROCEDURE add_change (
193     p_po_line_location_id     NUMBER,
194     p_quantity                NUMBER,
195     p_promised_date           DATE,
196     p_price_override          NUMBER,
197     p_parent_line_location_id NUMBER,
198     p_split_shipment_num      NUMBER,
199     p_need_by_date            DATE,
200     p_ship_to_location_id     NUMBER,
201     p_sales_order_update_date DATE,
202     p_amount                  NUMBER,
203     p_request_unit_of_measure VARCHAR2,
204     p_secondary_quantity      NUMBER,
205     p_request_secondary_uom   VARCHAR2,
206     p_delete_record           VARCHAR2,
207     p_preferred_grade         VARCHAR2,  -- INVCONV sschinch
208     p_payment_type            VARCHAR2,
209     p_description             VARCHAR2,
210     p_new_supp_order_line_no  VARCHAR2
211   ) IS
212     c NUMBER;
213   BEGIN
214     SELF.po_line_location_id.extend;
215 
216 
217 
218     c := SELF.po_line_location_id.COUNT;
219     SELF.po_line_location_id(c) := p_po_line_location_id;
220 
221     /**
222     * Extend all the other fields by 1.
223     **/
224     extend_fields (1);
225 
226     /**
227 
228     /**
229     * Copy the passed-in values to the object.
230     **/
231 
232 
233     SELF.quantity(c) := p_quantity;
234     SELF.promised_date(c) := p_promised_date;
235     SELF.price_override(c) := p_price_override;
236     SELF.parent_line_location_id(c) := p_parent_line_location_id;
237     SELF.split_shipment_num(c) := p_split_shipment_num;
238     SELF.need_by_date(c) := p_need_by_date;
239     SELF.ship_to_location_id(c) := p_ship_to_location_id;
240     SELF.sales_order_update_date(c) := p_sales_order_update_date;
241     SELF.amount(c) := p_amount;
242     SELF.request_unit_of_measure(c) := p_request_unit_of_measure;
243     SELF.secondary_quantity(c) := p_secondary_quantity;
244     SELF.request_secondary_uom(c) := p_request_secondary_uom;
245     SELF.delete_record(c) := p_delete_record;
246     SELF.preferred_grade(c) := p_preferred_grade;   -- INVCONV sschinch
247     SELF.payment_type(c) :=p_payment_type;
248     SELF.description(c) :=p_description;
249     SELF.new_supp_order_line_no(c) :=p_new_supp_order_line_no;
250   END add_change;
251 
252   /**
253   * Name: extend_fields (INTERNAL)
254   * Function:
255   *   Extends the PL/SQL table for each of the fields by the given size.
256   * Notes:
257   *   Do not call this method.
258 
259 
260 
261   *   It is only for internal use by other methods in this object.
262   */
263   MEMBER PROCEDURE extend_fields (
264     l_extend_size NUMBER
265   ) IS
266   BEGIN
267     quantity.extend ( l_extend_size );
268     promised_date.extend ( l_extend_size );
269     price_override.extend ( l_extend_size );
270     parent_line_location_id.extend ( l_extend_size );
271     split_shipment_num.extend ( l_extend_size );
272 
273 
274 
275     need_by_date.extend ( l_extend_size );
276     ship_to_location_id.extend ( l_extend_size );
277     sales_order_update_date.extend ( l_extend_size );
278     amount.extend ( l_extend_size );
279     request_unit_of_measure.extend ( l_extend_size );
280     secondary_quantity.extend ( l_extend_size );
281     request_secondary_uom.extend ( l_extend_size );
282     delete_record.extend ( l_extend_size );
283     preferred_grade.extend(l_extend_size);  -- INVCONV
284     payment_type.extend(l_extend_size);
285     description.extend(l_extend_size);
286     new_supp_order_line_no.extend(l_extend_size);
287     c_po_line_id.extend ( l_extend_size );
288     c_quantity.extend ( l_extend_size );
289     c_unit_meas_lookup_code.extend ( l_extend_size );
290     c_cancel_flag.extend ( l_extend_size );
291     c_closed_code.extend ( l_extend_size );
292     c_item_id.extend ( l_extend_size );
293     c_ship_to_organization_id.extend ( l_extend_size );
294     c_drop_ship_flag.extend ( l_extend_size );
295     c_quantity_received.extend ( l_extend_size );
296     c_quantity_billed.extend ( l_extend_size );
297     c_amount_received.extend ( l_extend_size );
298     c_amount_billed.extend ( l_extend_size );
299     c_accrue_on_receipt_flag.extend ( l_extend_size );
300     c_value_basis.extend ( l_extend_size );
301     c_purchase_basis.extend ( l_extend_size );
302     c_amount.extend ( l_extend_size );
303     c_price_override.extend ( l_extend_size );
304     c_parent_quantity.extend ( l_extend_size );
305     c_parent_amount.extend ( l_extend_size );
306     c_secondary_quantity.extend ( l_extend_size );
307     c_secondary_uom.extend ( l_extend_size );
308     c_item_number.extend ( l_extend_size );
309     c_approved_date.extend ( l_extend_size );
310     c_encumbered_flag.extend ( l_extend_size );
311     c_shipment_type.extend ( l_extend_size );
312     c_quantity_shipped.extend ( l_extend_size );
313     c_preferred_grade.extend(l_extend_size);  --INVCONV
314 
315     t_from_price_break.extend ( l_extend_size );
316     -- <Manual Price Override FPJ>
317     t_manual_price_change_flag.extend ( l_extend_size );
318     t_sec_qty_grade_change_only.extend(l_extend_size);  -- INVCONV
319   END;
320   /**
321   * Name: get_count
322   * Function:
323   *   Returns the number of changes in this object.
324   */
325   MEMBER FUNCTION get_count RETURN NUMBER IS
326   BEGIN
327     RETURN SELF.po_line_location_id.COUNT;
328   END;
329 
330   /**
331 
332   * Name: set_quantity
333   * Function:
334   *   Sets the quantity on the given shipment change.
335   */
336   MEMBER PROCEDURE set_quantity (
337     p_index              NUMBER,
338     p_quantity           NUMBER
339   ) IS BEGIN
340     SELF.quantity(p_index) := p_quantity;
341   END;
342   /**
343   * Name: set_price_override
344   * Function:
345   *   Sets the price on the given shipment change.
346   */
347   MEMBER PROCEDURE set_price_override (
348     p_index              NUMBER,
349     p_price_override     NUMBER
350   ) IS BEGIN
351     SELF.price_override(p_index) := p_price_override;
352   END;
353 
354   /**
355   * Name: set_amount
356   * Function:
357   *   Sets the amount on the given shipment change.
358   */
359   MEMBER PROCEDURE set_amount (
360     p_index              NUMBER,
361     p_amount           NUMBER
362   ) IS BEGIN
363     SELF.amount(p_index) := p_amount;
364   END;
365 
366   MEMBER PROCEDURE set_grade_flag (
367     p_index              NUMBER,
368     p_flag             VARCHAR2
369   )IS BEGIN
370     SELF.t_sec_qty_grade_change_only(p_index) := p_flag;
371   END;
372 
373   /**
374   * Name: dump_to_log
375   * Function:
376   *   Writes the contents of this object to the FND log.
377   * Notes:
378   *  This procedure is for debugging purposes only.
379   */
380   MEMBER PROCEDURE dump_to_log
381   IS
382     l_msg VARCHAR2(2000);
383   BEGIN
384     FOR i IN 1..get_count LOOP
385       l_msg := 'Shipment change ' || i || ': ';
386       l_msg := substrb(l_msg || 'po_line_location_id ' || po_line_location_id(i)
387  , 1, 2000);
388 
389       l_msg := substrb(l_msg || '; new_supp_order_line_no' || new_supp_order_line_no(i) , 1, 2000);
390 
391       l_msg := substrb(l_msg || '; quantity ' || quantity(i) , 1, 2000);
392       l_msg := substrb(l_msg || '; price_override ' || price_override(i) , 1, 2000);
393 
394       l_msg := substrb(l_msg || '; promised_date ' || promised_date(i) , 1, 2000
395 );
396       l_msg := substrb(l_msg || '; parent_line_location_id ' || parent_line_location_id(i) , 1, 2000);
397 
398       l_msg := substrb(l_msg || '; split_shipment_num ' || split_shipment_num(i), 1, 2000);
399 
400       l_msg := substrb(l_msg || '; need_by_date ' || need_by_date(i) , 1, 2000);
401 
402 
403       l_msg := substrb(l_msg || '; ship_to_location_id ' || ship_to_location_id(i) , 1, 2000);
404 
405       l_msg := substrb(l_msg || '; sales_order_update_date ' || sales_order_update_date(i) , 1, 2000);
406 
407       l_msg := substrb(l_msg || '; amount ' || amount(i) , 1, 2000);
408       l_msg := substrb(l_msg || '; request_unit_of_measure ' || request_unit_of_measure(i) , 1, 2000);
409 
410       l_msg := substrb(l_msg || '; secondary_quantity ' || secondary_quantity(i), 1, 2000);
411 
412       l_msg := substrb(l_msg || '; request_secondary_uom ' || request_secondary_uom(i) , 1, 2000);
413 
414       l_msg := substrb(l_msg || '; delete_record ' || delete_record(i) , 1, 2000);
415 
416       FND_LOG.string( FND_LOG.LEVEL_STATEMENT,
417                       'po.plsql.PO_SHIPMENTS_REC_TYPE.dump_to_log',l_msg );
418     END LOOP;
419   END dump_to_log;
420 
421 END;