1 PACKAGE fnd_flex_ext AS
2 /* $Header: AFFFEXTS.pls 120.3.12010000.1 2008/07/25 14:14:00 appldev ship $ */
3 /*#
4 * Key FlexField server side validation functions.
5 * @rep:scope public
6 * @rep:product FND
7 * @rep:displayname Key Flexfield Validation Public
8 * @rep:lifecycle active
9 * @rep:compatibility S
10 * @rep:category BUSINESS_ENTITY FND_FLEX_KFF
11 */
12
13
14 --------
15 -- PUBLIC TYPES
16 --
17
18 TYPE SegmentArray IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
19
20
21 --------
22 -- PUBLIC CONSTANTS
23 --
24
25 MAX_SEG_SIZE CONSTANT NUMBER := 4000;
26 DATE_FORMAT CONSTANT VARCHAR2(44) := 'YYYY/MM/DD HH24:MI:SS';
27
28 --------
29 -- PUBLIC FUNCTIONS
30 --
31
32 /*#
33 * Gets the last error message in the current language of database.
34 * @return Returns the last error message in the current language of database.
35 * @rep:scope public
36 * @rep:displayname Get Error Message
37 * @rep:lifecycle active
38 * @rep:compatibility S
39 */
40 FUNCTION get_message RETURN VARCHAR2;
41
42 /*#
43 * Gets the last error message in the encoded format.
44 * @return Returns the last error message in the encoded format.
45 * @rep:scope public
46 * @rep:displayname Get Encoded Error Message
47 * @rep:lifecycle active
48 * @rep:compatibility S
49 */
50 FUNCTION get_encoded_message RETURN VARCHAR2;
51
52 /*#
53 * Concatenates segments from segment array to a string.
54 * Raises unhandled exception if any errors.
55 * @param n_segments Number of segments
56 * @param segments Input segment array
57 * @param delimiter Delimiter
58 * @return Returns the concatenated segment string.
59 * @rep:scope public
60 * @rep:displayname Get Concatenated Segment
61 * @rep:lifecycle active
62 * @rep:compatibility S
63 */
64 FUNCTION concatenate_segments(n_segments IN NUMBER,
65 segments IN SegmentArray,
66 delimiter IN VARCHAR2) RETURN VARCHAR2;
67
68 /*#
69 * Breaks up concatenated segments into segment array.
70 * Truncates segments longer than MAX_SEG_SIZE bytes.
71 * Raises unhandled exception if any errors.
72 * @param concatenated_segs Concatenated string
73 * @param delimiter Delimiter
74 * @param segments Segment array
75 * @return Returns the number of segments found.
76 * @rep:scope public
77 * @rep:displayname Breakup Segments
78 * @rep:lifecycle active
79 * @rep:compatibility S
80 */
81 FUNCTION breakup_segments(concatenated_segs IN VARCHAR2,
82 delimiter IN VARCHAR2,
83 segments OUT nocopy SegmentArray) RETURN NUMBER;
84
85 /*#
86 * Gets the character used as the segment delimiter for the
87 * specified key flexfield structure.
88 * Returns NULL and sets error on the server if structure not found.
89 * @param application_short_name Application Short Name
90 * @param key_flex_code Key Flexfield Code
91 * @param structure_number Structure number
92 * @return Returns the delimiter for the key flexfield structure.
93 * @rep:scope public
94 * @rep:displayname Get Flexfield Structure Delimiter
95 * @rep:lifecycle active
96 * @rep:compatibility S
97 */
98 FUNCTION get_delimiter(application_short_name IN VARCHAR2,
99 key_flex_code IN VARCHAR2,
100 structure_number IN NUMBER) RETURN VARCHAR2;
101
102 /*#
103 * Finds combination_id for given set of key flexfield segment values.
104 * Segment values must be input in segments(1) - segments(n_segments)
105 * in the order displayed. Must explicitly assign segments(n) := NULL
106 * if a segment is null or this will generate a "no data found" error.
107 * Creates a new combination if it is valid and the flexfield allows
108 * dynamic inserts and the combination does not already exist.
109 * Commit the transaction soon after calling this function since
110 * if a combination is created it will prevent other users creating
111 * similar combinations on any flexfield until a commit is issued.
112 * Performs all checks on values including security and
113 * cross-validation. Value security rules will be checked for the
114 * current user identified in the FND_GLOBAL package. This will be
115 * set up automatically if the database session this package is called
116 * from underlies a concurrent program or a form.
117 * The validation date is used to determine if values have expired,
118 * and determines if cross-validation rules are still in effect.
119 * Generally pass in SYSDATE for validation date. If validation
120 * date is null, this function considers expired values valid
121 * and checks all cross-validation rules even if they are outdated.
122 * Returns TRUE if combination valid, or FALSE and sets error
123 * message using FND_MESSAGE utility on error or if invalid.
124 * If this function returns FALSE, use GET_MESSAGE to get the
125 * text of the error message in the language of the database, or
126 * GET_ENCODED_MESSAGE to get the error message in a language-
127 * independent encoded format.
128 * Combination_id output may be NULL if combination is invalid.
129 * @param application_short_name Application Short Name
130 * @param key_flex_code Key Flexfield Code
131 * @param structure_number Structure number
132 * @param validation_date Validation date
133 * @param n_segments Number of segments
134 * @param segments Segment array
135 * @param combination_id Code Combination Id
136 * @param data_set Data set number
137 * @return Returns TRUE if combination is valid, FALSE otherwise.
138 * @rep:scope public
139 * @rep:displayname Get Code Combination Id
140 * @rep:lifecycle active
141 * @rep:compatibility S
142 */
143
144 FUNCTION get_combination_id(application_short_name IN VARCHAR2,
145 key_flex_code IN VARCHAR2,
146 structure_number IN NUMBER,
147 validation_date IN DATE,
148 n_segments IN NUMBER,
149 segments IN SegmentArray,
150 combination_id OUT nocopy NUMBER,
151 data_set IN NUMBER DEFAULT -1)
152 RETURN BOOLEAN;
153
154 /*#
155 * Returns segment values for the given combination id in the key
156 * flexfield specified. Does not check value security rules.
157 * Returns TRUE if combination found and places displayed segment
158 * values in segments(1) through segments(n_segments) inclusive.
159 * Returns FALSE, sets n_segments = 0, and sets global error message
160 * using the FND_MESSAGE utility on error or if combination not found.
161 * If this function returns FALSE, use GET_MESSAGE to get the
162 * text of the error message in the language of the database, or
163 * GET_ENCODED_MESSAGE to get the error message in a language-
164 * independent encoded format.
165 * @param application_short_name Application Short Name
166 * @param key_flex_code Key Flexfield Code
167 * @param structure_number Structure number
168 * @param combination_id Code Combination Id
169 * @param n_segments Number of segments
170 * @param segments Segment array
171 * @param data_set Data set number
172 * @return Returns TRUE if combination is valid, FALSE otherwise.
173 * @rep:scope public
174 * @rep:displayname Get Segments
175 * @rep:lifecycle active
176 * @rep:compatibility S
177 */
178
179 FUNCTION get_segments(application_short_name IN VARCHAR2,
180 key_flex_code IN VARCHAR2,
181 structure_number IN NUMBER,
182 combination_id IN NUMBER,
183 n_segments OUT nocopy NUMBER,
184 segments OUT nocopy SegmentArray,
185 data_set IN NUMBER DEFAULT -1)
186 RETURN BOOLEAN;
187
188 /*#
189 * Gets combination id for the specified key flexfield segments.
190 * Identical to get_combination_id() except this function takes
191 * segment values in a string concatenated by the segment
192 * delimiter for this flexfield, and returns a positive combination
193 * id if valid or 0 on error. Validation date must be passed in
194 * as a character string using the DATE_FORMAT format defined in
195 * this package.
196 * If this function returns 0, use GET_MESSAGE to get the
197 * text of the error message in the language of the database, or
198 * GET_ENCODED_MESSAGE to get the error message in a language-
199 * independent encoded format.
200 * @param application_short_name Application Short Name
201 * @param key_flex_code Key Flexfield Code
202 * @param structure_number Structure number
203 * @param validation_date Validation date
204 * @param concatenated_segments Concatenated segments
205 * @return Returns a positive combination id if valid or 0 on error.
206 * @rep:scope public
207 * @rep:displayname Get Code Combination Id
208 * @rep:lifecycle active
209 * @rep:compatibility S
210 */
211
212 FUNCTION get_ccid(application_short_name IN VARCHAR2,
213 key_flex_code IN VARCHAR2,
214 structure_number IN NUMBER,
215 validation_date IN VARCHAR2,
216 concatenated_segments IN VARCHAR2) RETURN NUMBER;
217
218 /*#
219 * Gets concatenated segment values for the specified key flexfield
220 * combination id.
221 * Identical to get_segments() except returns the concatenated
222 * segment values as a string or NULL if invalid or on error.
223 * Note that this function is incapable of distinguishing a valid
224 * combination with a single null segment from an error.
225 * Caller must provide VARCHAR2(2000) storage for the returned string.
226 * If this function returns NULL, use GET_MESSAGE to get the
227 * text of the error message in the language of the database, or
228 * GET_ENCODED_MESSAGE to get the error message in a language-
229 * independent encoded format.
230 * Note: NULL does not necessarily mean an error occured. May be it is
231 * a single segment keyflexfield with NULL value.
232 * @param application_short_name Application Short Name
233 * @param key_flex_code Key Flexfield Code
234 * @param structure_number Structure number
235 * @param combination_id Code Combination Id
236 * @return Returns concatenated segment value or NULL if invalid or on error.
237 * @rep:scope public
238 * @rep:displayname Get Concatenated Segment
239 * @rep:lifecycle active
240 * @rep:compatibility S
241 */
242
243 FUNCTION get_segs(application_short_name IN VARCHAR2,
244 key_flex_code IN VARCHAR2,
245 structure_number IN NUMBER,
246 combination_id IN NUMBER) RETURN VARCHAR2;
247
248 /* ------------------------------------------------------------------------ */
249
250 PROCEDURE clear_ccid_cache;
251
252 END fnd_flex_ext;