[Home] [Help]
TYPE BODY: APPS.PO_DISTRIBUTIONS_REC_TYPE
Source
1 TYPE BODY po_distributions_rec_type AS
2 /**
3 * Name: create_object
4 * Function:
5 * Creates a PO_DISTRIBUTIONS_REC_TYPE object based on the given tables of
6 * field values. These tables must all be the same size.
7 * To create an empty object, pass in NULL for p_po_distribution_id.
8 **/
9 STATIC FUNCTION create_object (
10 p_po_distribution_id po_tbl_number,
11 p_quantity_ordered po_tbl_number,
12 p_parent_distribution_id po_tbl_number,
13 p_split_shipment_num po_tbl_number,
14 p_amount_ordered po_tbl_number,
15 p_request_unit_of_measure po_tbl_varchar30,
16 p_delete_record po_tbl_varchar1
17 ) RETURN po_distributions_rec_type
18 IS
19 c NUMBER;
20 l_dist_changes PO_DISTRIBUTIONS_REC_TYPE;
21 BEGIN
22 l_dist_changes := po_distributions_rec_type (
23 po_distribution_id => po_tbl_number(),
24 quantity_ordered => po_tbl_number(),
25 parent_distribution_id => po_tbl_number(),
26 split_shipment_num => po_tbl_number(),
27 amount_ordered => po_tbl_number(),
28 request_unit_of_measure => po_tbl_varchar30(),
29 delete_record => po_tbl_varchar1(),
30 /** Cached fields: **/
31 c_po_line_id => po_tbl_number(),
32 c_line_location_id => po_tbl_number(),
33 c_quantity_ordered => po_tbl_number(),
34 c_unit_meas_lookup_code => po_tbl_varchar30(),
35 c_item_id => po_tbl_number(),
36 c_quantity_delivered => po_tbl_number(),
37 c_quantity_billed => po_tbl_number(),
38 c_amount_delivered => po_tbl_number(),
39 c_amount_billed => po_tbl_number(),
40 c_value_basis => po_tbl_varchar30(),
41 c_purchase_basis => po_tbl_varchar30(),
42 c_amount_ordered => po_tbl_number(),
43 c_parent_line_location_id => po_tbl_number(),
44 c_award_id => po_tbl_number(),
45 c_project_id => po_tbl_number(),
46 c_task_id => po_tbl_number(),
47 c_distribution_num => po_tbl_number(),
48 c_encumbered_flag => po_tbl_varchar1(),
49 c_req_distribution_id => po_tbl_number(),
50 c_creation_date => po_tbl_date()
51 );
52 /**
53 * If the caller passed in values for p_po_distribution_id, copy them
54 * to the object.
55 **/
56 IF (p_po_distribution_id IS NOT NULL) THEN
57 l_dist_changes.po_distribution_id := p_po_distribution_id;
58 END IF;
59 c := l_dist_changes.po_distribution_id.COUNT;
60
61 /**
62 * Extend all the other fields to the same size as po_distribution_id.
63 **/
64 l_dist_changes.extend_fields(c);
65
66 /**
67 * If the caller passed in values for a field, copy them to the object.
68 **/
69 IF (p_quantity_ordered IS NOT NULL) THEN
70 l_dist_changes.quantity_ordered := p_quantity_ordered;
71 END IF;
72 IF (p_parent_distribution_id IS NOT NULL) THEN
73 l_dist_changes.parent_distribution_id := p_parent_distribution_id;
74 END IF;
75 IF (p_split_shipment_num IS NOT NULL) THEN
76 l_dist_changes.split_shipment_num := p_split_shipment_num;
77 END IF;
78 IF (p_amount_ordered IS NOT NULL) THEN
79 l_dist_changes.amount_ordered := p_amount_ordered;
80 END IF;
81 IF (p_request_unit_of_measure IS NOT NULL) THEN
82 l_dist_changes.request_unit_of_measure := p_request_unit_of_measure;
83 END IF;
84 IF (p_delete_record IS NOT NULL) THEN
85 l_dist_changes.delete_record := p_delete_record;
86 END IF;
87
88 RETURN l_dist_changes;
89 END;
90
91 /**
92 * Name: add_change
93 * Function:
94 * Adds the given change to this object.
95 **/
96 MEMBER PROCEDURE add_change (
97 p_po_distribution_id NUMBER,
98 p_quantity_ordered NUMBER,
99 p_parent_distribution_id NUMBER,
100 p_split_shipment_num NUMBER,
101 p_amount_ordered NUMBER,
102 p_request_unit_of_measure VARCHAR2,
103 p_delete_record VARCHAR2
104 ) IS
105 c NUMBER;
106 BEGIN
107 SELF.po_distribution_id.extend;
108 c := SELF.po_distribution_id.COUNT;
109 SELF.po_distribution_id(c) := p_po_distribution_id;
110
111 /**
112 * Extend all the other fields by 1.
113 **/
114 extend_fields (1);
115
116 /**
117 * Copy the passed-in values to the object.
118 **/
119 SELF.quantity_ordered(c) := p_quantity_ordered;
120 SELF.parent_distribution_id(c) := p_parent_distribution_id;
121 SELF.split_shipment_num(c) := p_split_shipment_num;
122 SELF.amount_ordered(c) := p_amount_ordered;
123 SELF.request_unit_of_measure(c) := p_request_unit_of_measure;
124 SELF.delete_record(c) := p_delete_record;
125 END add_change;
126
127 /**
128 * Name: extend_fields (INTERNAL)
129 * Function:
130 * Extends the PL/SQL table for each of the fields by the given size.
131 * Notes:
132 * Do not call this method.
133 * It is only for internal use by other methods in this object.
134 **/
135 MEMBER PROCEDURE extend_fields (
136 l_extend_size NUMBER
137 ) IS
138 BEGIN
139 quantity_ordered.extend ( l_extend_size );
140 parent_distribution_id.extend ( l_extend_size );
141 split_shipment_num.extend ( l_extend_size );
142 amount_ordered.extend ( l_extend_size );
143 request_unit_of_measure.extend ( l_extend_size );
144 delete_record.extend ( l_extend_size );
145
146 c_po_line_id.extend ( l_extend_size );
147 c_line_location_id.extend ( l_extend_size );
148 c_quantity_ordered.extend ( l_extend_size );
149 c_unit_meas_lookup_code.extend ( l_extend_size );
150 c_item_id.extend ( l_extend_size );
151 c_quantity_delivered.extend ( l_extend_size );
152 c_quantity_billed.extend ( l_extend_size );
153 c_amount_delivered.extend ( l_extend_size );
154 c_amount_billed.extend ( l_extend_size );
155 c_value_basis.extend ( l_extend_size );
156 c_purchase_basis.extend ( l_extend_size );
157 c_amount_ordered.extend ( l_extend_size );
158 c_parent_line_location_id.extend ( l_extend_size );
159 c_award_id.extend ( l_extend_size );
160 c_project_id.extend ( l_extend_size );
161 c_task_id.extend ( l_extend_size );
162 c_distribution_num.extend ( l_extend_size );
163 c_encumbered_flag.extend ( l_extend_size );
164 c_req_distribution_id.extend ( l_extend_size );
165 c_creation_date.extend ( l_extend_size );
166 END;
167
168 /**
169 * Name: get_count
170 * Function:
171 * Returns the number of changes in this object.
172 **/
173 MEMBER FUNCTION get_count RETURN NUMBER IS
174 BEGIN
175 RETURN SELF.po_distribution_id.COUNT;
176 END;
177
178 /**
179 * Name: set_quantity_ordered
180 * Function:
181 * Sets the quantity on the given distribution change.
182 **/
183 MEMBER PROCEDURE set_quantity_ordered (
184 p_index NUMBER,
185 p_quantity_ordered NUMBER
186 ) IS BEGIN
187 SELF.quantity_ordered(p_index) := p_quantity_ordered;
188 END;
189
190 /**
191 * Name: set_amount_ordered
192 * Function:
193 * Sets the amount on the given distribution change.
194 **/
195 MEMBER PROCEDURE set_amount_ordered (
196 p_index NUMBER,
197 p_amount_ordered NUMBER
198 ) IS BEGIN
199 SELF.amount_ordered(p_index) := p_amount_ordered;
200 END;
201
202 /**
203 * Name: dump_to_log
204 * Function:
205 * Writes the contents of this object to the FND log.
206 * Notes:
207 * This procedure is for debugging purposes only.
208 **/
209 MEMBER PROCEDURE dump_to_log
210 IS
211 l_msg VARCHAR2(2000);
212 BEGIN
213 FOR i IN 1..get_count LOOP
214 l_msg := substrb(l_msg || '; parent_distribution_id ' || parent_distribution_id(i) , 1, 2000);
215 l_msg := substrb(l_msg || '; split_shipment_num ' || split_shipment_num(i) , 1, 2000);
216 l_msg := substrb(l_msg || '; amount_ordered ' || amount_ordered(i) , 1, 2000);
217 l_msg := substrb(l_msg || '; request_unit_of_measure ' || request_unit_of_measure(i) , 1, 2000);
218 l_msg := substrb(l_msg || '; delete_record ' || delete_record(i) , 1, 2000);
219 FND_LOG.string( FND_LOG.LEVEL_STATEMENT,
220 'po.plsql.PO_DISTRIBUTIONS_REC_TYPE.dump_to_log',
221 l_msg );
222 END LOOP;
223 END dump_to_log;
224
225 END;