DBA Data[Home] [Help]

PACKAGE BODY: APPS.GMF_VALIDATE_ACCOUNT

Source


1 PACKAGE BODY gmf_validate_account AS
2 /* $Header: gmfactvb.pls 120.1 2006/07/11 19:30:08 rseshadr noship $ */
3 
4 
5     -- Function to log error message
6     FUNCTION msg_log(
7           p_message_name IN VARCHAR2,
8           p_value1       IN VARCHAR2,
9           p_value2       IN VARCHAR2,
10           p_value3       IN VARCHAR2,
11           p_value4       IN VARCHAR2,
12           p_value5       IN VARCHAR2
13           )
14     RETURN VARCHAR2;
15 
16 
17     -- Constant to identify from where cross-validation routine is called.
18     CONC_PROGRAM		CONSTANT VARCHAR2(2) := 'C' ;
19 
20 
21   /*#######################################################################
22   #  NAME
23   #    validate_segments
24   #
25   #  DESCRIPTION
26   #    Procedure to Cross-Validate concatenated segments of Acctg Unit and
27   #    Account segments of OPM.
28   #
29   #  NOTES
30   #
31   #  DEPENDENCIES
32   #
33   #  USAGE
34   #    This procedure will be called from Subledger update program
35   #    directly and from wrapper in this package.
36   #
37   #  HISTORY
38   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
39   #    11-Jul-2006 rseshadr Bug 5384550 - use GL# explicitly in queries
40   #      against fnd_id_flex_structures
41   ########################################################################*/
42 
43   PROCEDURE validate_segments(
44 		p_co_code		IN		gl_plcy_mst.co_code%TYPE,
45 		p_acctg_unit_id		IN		gl_accu_mst.acctg_unit_id%TYPE,
46 		p_acct_id		IN		gl_acct_mst.acct_id%TYPE,
47 		p_acctg_unit_no		IN		gl_accu_mst.acctg_unit_no%TYPE,
48 		p_acct_no		IN		gl_acct_mst.acct_no%TYPE,
49 		p_create_combination	IN		VARCHAR2 DEFAULT 'N',
50 		x_ccid			OUT NOCOPY	NUMBER,
51 		x_concat_seg		OUT NOCOPY	VARCHAR2,
52 		x_status		OUT NOCOPY	VARCHAR2,
53 		x_errmsg		OUT NOCOPY	VARCHAR2
54 		)
55   IS
56 
57 	--
58 	-- Selecting delimiter from plcy mst and flex struct as there is a chance that delimiter
59 	-- can be different at these two place. Using plcy delimiter to parse the concatenated
60 	-- segments and flex struct delimiter to pass to FND cross-validation routine.
61 	--
62 
63 	/**
64 	 * rs Bug 5384550 - use GL# explicitly
65 	 **/
66 	CURSOR c_struct_dtls (p_co_code		gl_plcy_mst.co_code%TYPE)
67 	IS
68 		SELECT
69 			flex.application_id,
70 		       	flex.id_flex_code,
71 			flex.id_flex_num,
72 			plcy.segment_delimiter,
73 			flex.CONCATENATED_SEGMENT_DELIMITER,
74 			sob.chart_of_accounts_id
75   		  FROM
76 			fnd_id_flex_structures flex,
77 		       	gl_sets_of_books sob,
78 			gl_plcy_mst plcy
79  		 WHERE
80 		   	flex.id_flex_num	= sob.chart_of_accounts_id
81 		   AND 	sob.set_of_books_id 	= plcy.sob_id
82 		   AND 	plcy.co_code	   	= p_co_code
83 		   AND  flex.id_flex_code       = 'GL#'
84 	;
85 
86 	l_acctg_unit_no			gl_accu_mst.acctg_unit_no%TYPE;
87 	l_acct_no			gl_acct_mst.acct_no%TYPE;
88 	l_coa_id			gl_sets_of_books.chart_of_accounts_id%TYPE;
89 
90 	l_concat_segs			VARCHAR2(4000);
91 	l_concat_segs1			VARCHAR2(4000);
92 	l_seg_delimiter			gl_plcy_mst.segment_delimiter%TYPE;
93 	l_Segment_array			fnd_flex_ext.SegmentArray;
94 	l_segment_count			PLS_INTEGER; -- Bug xxx
95 
96 	l_appl_id			fnd_application.application_id%TYPE;
97 	l_id_flex_code			fnd_id_flex_structures.id_flex_code%TYPE;
98 	l_id_flex_num			fnd_id_flex_structures.id_flex_num%TYPE;
99 	l_flexDelimiter			gl_plcy_mst.segment_delimiter%TYPE;
100 
101 	l_ccid				NUMBER := -1;
102 	e_acctg_unit_not_found		EXCEPTION;
103 	e_acct_not_found		EXCEPTION;
104 	e_validation_error		EXCEPTION;
105 
106 	l_operation			VARCHAR2(100);
107 
108 	l_of_segments			GMF_GET_MAPPINGS.A_segment;
109   BEGIN
110 
111 	-- uncomment the call below to write to a local file
112         -- FND_FILE.PUT_NAMES('gmfactmx.log','gmfactmx.out','/sqlcom/log/opm115m');
113 
114         --  Initialize API return status to success
115         x_status := FND_API.G_RET_STS_SUCCESS;
116 
117 	-- gmf_util.trace( 'Now processing Company : ' || p_co_code || '  Accu Id : ' || p_acctg_unit_id ||
118 			-- '  Acct Id : ' || p_acct_id, 1 );
119 
120 	-- Get structure details
121 	OPEN c_struct_dtls(p_co_code);
122 	FETCH c_struct_dtls INTO l_appl_id,
123 				 l_id_flex_code,
124 				 l_id_flex_num,
125 				 l_seg_delimiter,
126 				 l_flexDelimiter,
127 				 l_coa_id
128 	;
129 	CLOSE c_struct_dtls;
130 
131 	/*
132 	gmf_util.trace( '  Appl Short Name : '	|| 'SQLGL'	 	||
133 			'  Appl Id : ' 		|| l_appl_id 		||
134                         '  Flex Code : ' 	|| l_id_flex_code 	||
135                         '  Struct No : ' 	|| l_id_flex_num 	||
136                         '  Seg Delimiter : ' 	|| l_seg_delimiter 	||
137                         '  COA Id : ' 		|| l_coa_id, 3)
138 	; */
139 
140 	IF (p_acctg_unit_no IS NOT NULL) THEN
141 		l_acctg_unit_no := p_acctg_unit_no;
142 	ELSE
143 		-- Get Accouting Unit No
144 		l_acctg_unit_no := get_acctg_unit_no (p_co_code, p_acctg_unit_id);
145 
146 		IF (l_acctg_unit_no IS NULL) THEN
147 			raise e_acctg_unit_not_found;
148 		END IF;
149 	END IF;
150 
151 
152 	IF (p_acct_no IS NOT NULL) THEN
153 		l_acct_no := p_acct_no;
154 	ELSE
155 		-- Get Account No
156 		l_acct_no	:= get_acct_no (p_co_code, p_acct_id);
157 
158 		IF (l_acct_no IS NULL) THEN
159 			raise e_acct_not_found;
160 		END IF;
161 	END IF;
162 
163 
164 	-- Concatenate segments
165 	l_concat_segs := l_acctg_unit_no || l_seg_delimiter || l_acct_no;
166 
167 	-- gmf_util.trace( '  Concatenated Segments before parsing : ' || l_concat_segs, 2 );
168 
169 	-- Parse the OPM account to set the segments based on the segment
170         -- mapping of OPM and Oracle Financials
171 	/* Bug 2696526: replace with the next call
172         *GML_ACCT_GENERATE.parse_account(
173 	*			v_co_code	=> p_co_code,
174 	*			v_account	=> l_concat_segs,	-- Concatenated segments
175 	*			v_type		=> 2,			-- Type of segment
176 	*			v_offset	=> 0,			-- offset
177 	*			v_segment	=> l_Segment_array, 	-- parsed segments
178 	*			v_no_of_seg	=> l_segment_count)	-- # of segments
179 	*;
180 	*/
181 
182         GMF_GET_MAPPINGS.parse_account(p_co_code, l_concat_segs, l_of_segments);
183 
184 	for i in 1..l_of_segments.count loop
185 	  IF  l_of_segments(i) IS NOT NULL THEN
186 	    l_Segment_array(i) :=  l_of_segments(i) ;
187 	  END IF;
188 	end loop;
189 
190 	-- Concatenate the values in segment array to pass it for validation
191 
192 	l_concat_segs1 := FND_FLEX_EXT.concatenate_segments(
193 				n_segments	=> l_Segment_array.count, -- l_segment_count, Bug 2696526
194 				segments	=> l_Segment_array,       -- l_Segment_array, Bug 2696526
195 				delimiter	=> l_flexDelimiter
196 			  );
197 
198 	-- gmf_util.trace( '  Concatenated Segments after parsing : ' || l_concat_segs1, 2 );
199 
200 	--
201 	-- Set which operation to do. Operation should be one of these:
202 	--   'FIND_COMBINATION'		- Combination must already exist.
203 	--   'CREATE_COMBINATION'	- Combination is created if doesn't exist.
204 	--   'CHECK_COMBINATION'	- Checks if combination valid, doesn't create.
205 	--   'DEFAULT_COMBINATION'	- Returns minimal default combination.
206 	--   'CHECK_SEGMENTS'		- Validates segments individually.
207 	-- Right now we are doing following two operations.
208 	--
209 
210 	IF (p_create_combination = 'N') THEN
211 		l_operation := 'CHECK_COMBINATION';
212 	ELSIF (p_create_combination = 'Y') THEN
213 		l_operation := 'CREATE_COMBINATION';
214 	END IF;
215 
216 
217 	-- Now call fnd function to do cross validation
218 
219 	IF (FND_FLEX_KEYVAL.validate_segs(
220 				operation       	=> l_operation,
221 				appl_short_name 	=> 'SQLGL',
222 				key_flex_code   	=> l_id_flex_code,
223 				structure_number	=> l_coa_id,
224 				concat_segments 	=> l_concat_segs1,
225 				values_or_ids   	=> 'V',
226 				validation_date 	=> SYSDATE)
227 	   )
228 	THEN
229 
230 		l_ccid := FND_FLEX_KEYVAL.combination_id;
231 	ELSE
232 		raise e_validation_error;
233 	END IF;
234 
235 
236 	-- Populate output variables
237 
238 	x_ccid := l_ccid;
239 
240   EXCEPTION
241 	WHEN e_acctg_unit_not_found THEN
242 		x_status	:= FND_API.G_RET_STS_ERROR;
243 		x_errmsg	:= msg_log('GMF_CROSSVAL_ACCU_ERROR', p_acctg_unit_id, p_co_code,'','','');
244 	WHEN e_acct_not_found THEN
245 		x_status	:= FND_API.G_RET_STS_ERROR;
246 		x_errmsg	:= msg_log('GMF_CROSSVAL_ACCT_ERROR', p_acct_id, p_co_code,'','','');
247 	WHEN e_validation_error THEN
248       		x_status 	:= FND_API.G_RET_STS_ERROR;
249 		x_concat_seg	:= substrb(l_concat_segs, 1, 240);
250 		x_errmsg 	:= substrb(FND_FLEX_KEYVAL.error_message, 1, 240);
251 		-- gmf_util.trace('  INVALID.  Message = ' || FND_FLEX_KEYVAL.error_message, 2);
252   END validate_segments;
253 
254 
255   /*#######################################################################
256   #  NAME
257   #    cross_validate
258   #
259   #  DESCRIPTION
260   #    This procedure calls above Cross-Validation engine for each
261   #    combination of Acctg Unit and Account segments.
262   #
263   #  NOTES
264   #
265   #  DEPENDENCIES
266   #
267   #  USAGE
268   #    This procedure will be called from Account Mapping form and/or from
269   #    Concurrent process. In case of invalid combinations, error_messages
270   #    PL/sql table will be populated with error messages. Its the respon-
271   #    of the calling program to fetch and display these error messages.
272   #
273   #  HISTORY
274   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
275   #    14-Nov-2002  Uday Moogala  Bug xxx
276   #    	 Modified cursors query to go against gl_accu_map table to get the
277   #	 acctg_unit_id/no. Also passing acctg_unit_no to validate procedure
278   #	 to avoid call to get_accu_no function.
279   #    05-Aug-2003  Venkat Chukkapalli  Bug 3080232
280   #	  Added additional parameter p_acct_no to the procedure.
281   ########################################################################*/
282 
283   PROCEDURE cross_validate
284   (
285 	p_co_code		IN		gl_plcy_mst.co_code%TYPE,
286 	p_acct_id		IN		gl_acct_mst.acct_id%TYPE,
287 	p_called_from		IN		VARCHAR2,
288 	x_status		OUT NOCOPY	VARCHAR2,
289 	p_acct_no		IN		gl_acct_mst.acct_no%TYPE DEFAULT NULL
290   )
291   IS
292 
293 	CURSOR acctg_unit (p_co_code	gl_accu_mst.co_code%TYPE)
294 	IS
295 		SELECT DISTINCT mst.acctg_unit_id, mst.acctg_unit_no   -- Bug xxx
296 		  FROM gl_accu_mst mst, gl_accu_map map
297  		 WHERE mst.acctg_unit_id = map.acctg_unit_id
298 		   AND map.co_code = p_co_code
299 		   AND map.delete_mark = 0
300 		   AND mst.delete_mark = 0 ;
301 
302 	l_errmsg 		VARCHAR2(4000);
303 	l_status 		VARCHAR2(2);
304 
305 	l_concat_segs		VARCHAR2(4000);
306         l_msg_text      	VARCHAR2(2000);
307 	l_index	 		PLS_INTEGER DEFAULT 0;	-- Bug xxx
308 
309 	l_acctg_unit_no		gl_accu_mst.acctg_unit_no%TYPE;
310 	l_acct_no		gl_acct_mst.acct_no%TYPE;
311 
312   	error_stack		error_messages_RecType; -- will be used in concurrent program
313 	empty_acct_combination	acct_combination_TabType;
314 	empty_error_messages	error_messages_TabType;
315 
316 	l_ccid			NUMBER; -- variable to hold Code Combination Id
317 
318   BEGIN
319 
320 	-- uncomment the call below to write to a local file
321         -- FND_FILE.PUT_NAMES('gmfactmx.log','gmfactmx.out','/sqlcom/log/opm115m');
322 
323 	--  Initialize API return status to success
324 	x_status := FND_API.G_RET_STS_SUCCESS;
325 
326 	-- remove old rows and release memory.
327 	errors.acct_combination := empty_acct_combination;
328 	errors.error_messages	:= empty_error_messages;
329 
330   	-- gmf_util.trace(msg_log('GMF_CROSSVAL_BEGIN', p_co_code, get_acct_no(p_co_code, p_acct_id)), 1, 2);
331 
332 	FOR cur in acctg_unit (p_co_code)
333 	LOOP
334 
335 		-- Bug 3080232. Changed NULL to p_acct_no for argument p_acct_no
336 		GMF_VALIDATE_ACCOUNT.validate_segments(
337 			p_co_code		=> p_co_code,
338 			p_acctg_unit_id		=> cur.acctg_unit_id,
339 			p_acct_id		=> p_acct_id,
340 			p_acctg_unit_no		=> cur.acctg_unit_no,
341 			p_acct_no		=> p_acct_no,
342 			p_create_combination	=> 'N',
343 			x_ccid			=> l_ccid,
344 			x_concat_seg		=> l_concat_segs,
345 			x_status		=> l_status,
346 			x_errmsg		=> l_errmsg
347 		);
348 
349 		-- Invalid combination
350 		IF (l_status <> FND_API.G_RET_STS_SUCCESS) THEN 	-- Bug xxx
351 
352 			-- Index for message table
353 			l_index := l_index + 1;
354 
355 			-- Set status and load message into plsql record
356 			x_status 			 := l_status;
357 			errors.acct_combination(l_index) := l_concat_segs;
358 			errors.error_messages(l_index) 	 := msg_log('GMF_CROSSVAL_ERROR', l_errmsg,'','','','');
359 
360 			-- print messages to stack to print it later in one shot to output file
361 			/* used if concurrent process is used
362 			* IF (p_called_from = CONC_PROGRAM) THEN
363 			*	error_stack.acct_combination(l_index)	:= l_concat_segs;
364 			*	error_stack.error_messages(l_index) 	:= l_msg_text;
365 			* END IF;
366 			*/
367 
368 		END IF;
369 
370 	END LOOP;
371 
372 	-- Now print messages from message stack into output file
373 	/* used if concurrent process is used
374 	* IF (p_called_from = CONC_PROGRAM) THEN
375 	*	FOR i in 1..error_stack.error_messages.count LOOP
376   	*		gmf_util.trace( error_stack.acct_combination(i) || ' ' ||
377 	*				error_stack.error_messages(i), 1, 2 );
378 	*	END LOOP;
379 	* END IF;
380 	*/
381 
382   END cross_validate;
383 
384   /*#######################################################################
385   #  NAME
386   #    get_accu_acct_ids
387   #
388   #  DESCRIPTION
389   #
390   #    Procedure to validate the accu and acct combination.
391   #    If combination or accu/acct ids exits then returns respective ids. Otherwise,
392   #    if p_create_acct = 'Y', then tries to create code combination in GL tables and
393   #    creates the accu and acct in OPM tables (gl_accu_mst and gl_acct_mst)
394   #    and returns accu_id and acct_id.
395   #
396   #  Assumptions
397   #    Code Combination will be created only if dynamic inserts is ON.
398   #
399   #  DEPENDENCIES
400   #
401   #  USAGE
402   #
403   #  HISTORY
404   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
405   #    12-Nov-2002  Uday Moogala  Bug xxx
406   #	  1. changes to return proper error messages.
407   #	  2. Calling parse_ccid routine only if p_create_acct = Y and
408   #	     ccid is valid.
409   ########################################################################*/
410 
411   PROCEDURE get_accu_acct_ids
412   (
413 		p_co_code		IN		gl_plcy_mst.co_code%TYPE,
414 		p_acctg_unit_no		IN		gl_accu_mst.acctg_unit_no%TYPE,
415 		p_acct_no		IN		gl_acct_mst.acct_no%TYPE,
416 		p_create_acct		IN		VARCHAR2 DEFAULT 'N',
417 		x_acctg_unit_id		OUT NOCOPY	gl_accu_mst.acctg_unit_id%TYPE,
418 		x_acct_id		OUT NOCOPY	gl_acct_mst.acct_id%TYPE,
419 		x_ccid			OUT NOCOPY	NUMBER,
420 		x_status		OUT NOCOPY	VARCHAR2,
421 		x_errmsg		OUT NOCOPY	VARCHAR2
422   )
423   IS
424 
425 	l_errmsg 		VARCHAR2(4000);
426 	l_status 		VARCHAR2(2);
427 
428 	l_concat_segs		VARCHAR2(4000);
429 	l_ccid			NUMBER; 			-- variable to hold Code Combination Id
430 
431 	l_create_acct		PLS_INTEGER;
432 
433 	l_opm_account		GMF_GET_MAPPINGS.opm_account;	-- pl/sql to hold accu and acct ids
434 
435 	e_validation_error	EXCEPTION;
436 	e_invalid_combination	EXCEPTION;	-- Bug xxx
437 	e_invalid_parameters	EXCEPTION;	-- Bug xxx
438 
439   BEGIN
440 
441 	--  Initialize API return status to success
442 	x_status := FND_API.G_RET_STS_SUCCESS;
443 
444 	IF (p_co_code IS NULL) OR (p_acctg_unit_no IS NULL) OR (p_acct_no IS NULL) THEN
445 		raise e_invalid_parameters;	-- Bug xxx
446 	END IF;	-- Bug xxx: removed else block which was for the normal processing.
447 
448 	--
449 	-- validate the segments and
450 	-- if p_create_acct = 'Y', then create the code combination in GL and
451 	-- return ccid
452 	--
453 	GMF_VALIDATE_ACCOUNT.validate_segments(
454 		p_co_code		=> p_co_code,
455 		p_acctg_unit_id		=> '',
456 		p_acct_id		=> '',
457 		p_acctg_unit_no		=> p_acctg_unit_no,
458 		p_acct_no		=> p_acct_no,
459 		p_create_combination	=> p_create_acct,
460 		x_ccid			=> l_ccid,
461 		x_concat_seg		=> l_concat_segs,
462 		x_status		=> l_status,
463 		x_errmsg		=> l_errmsg
464 	);
465 
466 	-- Invalid combination
467 	IF (l_status <> FND_API.G_RET_STS_SUCCESS) THEN		-- Bug xxx
468 		raise e_validation_error;
469 	END IF;
470 
471 	/* Replaced the following sql with the if condition -- Bug xxx
472 	* SELECT decode(p_create_acct, 'Y', 1, 0)
473 	* INTO   l_create_acct
474 	* FROM   dual;
475 	*/
476 
477 	IF p_create_acct = 'Y' THEN
478 		l_create_acct := 1;
479 	ELSE
480 		l_create_acct := 0;
481 	END IF;
482 
483 	--
484 	-- Use the l_ccid to get accu and acct ids if exists in OPM.
485 	-- if p_create_acct = 'Y', then create accu and acct in OPM and
486 	-- return ids.
487 	--
488 	IF (l_ccid > 0 and l_create_acct = 1) THEN	-- Bug xxx
489 		l_opm_account :=  GMF_GET_MAPPINGS.parse_ccid(
490 					pi_co_code 		=> p_co_code,
491 					pi_code_combination_id 	=> l_ccid,
492 					pi_create_acct 		=> l_create_acct
493 				  );
494 
495 
496 		x_acctg_unit_id := l_opm_account.acctg_unit_id;
497 		x_acct_id 	:= l_opm_account.acct_id;
498 		x_ccid		:= l_ccid;
499 
500 		IF (l_opm_account.acctg_unit_id = -1) OR (l_opm_account.acct_id = -1) THEN
501 			raise e_invalid_combination;
502 		END IF;
503 	ELSIF (l_ccid <= 0 and l_create_acct = 1) THEN
504 		raise e_invalid_combination;
505 	END IF;
506 
507   EXCEPTION
508 	WHEN e_validation_error THEN
509 		x_acctg_unit_id := -1;
510 		x_acct_id 	:= -1;
511 		x_ccid		:= -1;
512 		x_status	:= l_status;
513 		x_errmsg	:= msg_log('GMF_CROSSVAL_ERROR', l_errmsg,'','','','');
514 	WHEN e_invalid_combination THEN
515 		x_status 	:= FND_API.G_RET_STS_ERROR;
516 		x_errmsg 	:= msg_log('GMF_CROSSVAL_INVALID_COMB', p_acct_no, p_acctg_unit_no, p_co_code,'','' );
517 	WHEN e_invalid_parameters THEN	-- Bug xxx
518 		x_status 	:= FND_API.G_RET_STS_ERROR;
519 		x_errmsg 	:= msg_log('GMF_CROSSVAL_INVALID_PARAMS', '', '', '', '', '');
520   END get_accu_acct_ids;
521 
522 
523   /*#######################################################################
524   #  NAME
525   #    get_acct_no
526   #
527   #  DESCRIPTION
528   #    Fetches the account no for the acct id passed.
529   #
530   #  NOTES
531   #
532   #  DEPENDENCIES
533   #
534   #  USAGE
535   #
536   #  HISTORY
537   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
538   ########################################################################*/
539 
540   FUNCTION get_acct_no
541   (
542 	p_co_code	gl_acct_mst.co_code%TYPE,
543 	p_acct_id	gl_acct_mst.acct_id%TYPE
544   )
545   RETURN VARCHAR2
546   IS
547 
548 	CURSOR acct_no 	(p_co_code	gl_acct_mst.co_code%TYPE,
549 			 p_acct_id	gl_accu_mst.acctg_unit_id%TYPE)
550 	IS
551 		SELECT
552 			acct_no
553 		  FROM
554 			gl_acct_mst
555 		 WHERE
556 			acct_id = p_acct_id
557 		   AND  co_code = p_co_code
558 	;
559 
560 	l_acct_no	gl_acct_mst.acct_no%TYPE;
561 
562   BEGIN
563 	OPEN acct_no (p_co_code, p_acct_id);
564 	FETCH acct_no INTO l_acct_no;
565 	CLOSE acct_no;
566 
567 	RETURN l_acct_no;
568 
569   END get_acct_no;
570 
571   /*#######################################################################
572   #  NAME
573   #    get_acctg_unit_no
574   #
575   #  DESCRIPTION
576   #    Fetches the acctg unit no for the acctg unit id passed.
577   #
578   #  NOTES
579   #
580   #  DEPENDENCIES
581   #
582   #  USAGE
583   #
584   #  HISTORY
585   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
586   ########################################################################*/
587 
588   FUNCTION get_acctg_unit_no
589   (
590 	p_co_code	gl_accu_mst.co_code%TYPE,
591 	p_acctg_unit_id	gl_accu_mst.acctg_unit_id%TYPE
592   )
593   RETURN VARCHAR2
594   IS
595 
596 	CURSOR accu_no 	(p_co_code		gl_accu_mst.co_code%TYPE,
597 			 p_acctg_unit_id	gl_accu_mst.acctg_unit_id%TYPE)
598 	IS
599 		SELECT
600 			acctg_unit_no
601 		  FROM
602 			gl_accu_mst
603 		 WHERE
604 			acctg_unit_id	= p_acctg_unit_id
605 		   AND  co_code		= p_co_code
606 	;
607 
608 	l_acctg_unit_no	gl_accu_mst.acctg_unit_no%TYPE;
609 
610   BEGIN
611 
612 	OPEN accu_no (p_co_code, p_acctg_unit_id);
613 	FETCH accu_no INTO l_acctg_unit_no;
614 	CLOSE accu_no;
615 
616 	RETURN l_acctg_unit_no;
617 
618   END get_acctg_unit_no;
619 
620   /*#######################################################################
621   #  NAME
622   #    get_error_messages
623   #
624   #  DESCRIPTION
625   #    Returns error message to forms, if any.
626   #
627   #  NOTES
628   #
629   #  DEPENDENCIES
630   #
631   #  USAGE
632   #
633   #  HISTORY
634   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
635   ########################################################################*/
636 
637   FUNCTION get_error_messages RETURN error_messages_RecType
638   IS
639   BEGIN
640 
641 	IF (GMF_VALIDATE_ACCOUNT.errors.error_messages.count > 0) THEN
642 		RETURN (GMF_VALIDATE_ACCOUNT.errors);
643 	END IF;
644 
645   END get_error_messages;
646 
647   /*#######################################################################
648   #  NAME
649   #    msg_log
650   #
651   #  DESCRIPTION
652   #    Retrieves the message from msg dictionary and substitutes the tokens
653   #    with the non-null values passed.
654   #
655   #  NOTES
656   #
657   #  DEPENDENCIES
658   #
659   #  USAGE
660   #
661   #  HISTORY
662   #    10-Jun-2002  Uday Moogala  Bug 2468906 - Created.
663   ########################################################################*/
664 
665   FUNCTION msg_log(
666           p_message_name IN VARCHAR2,
667           p_value1       IN VARCHAR2,
668           p_value2       IN VARCHAR2,
669           p_value3       IN VARCHAR2,
670           p_value4       IN VARCHAR2,
671           p_value5       IN VARCHAR2
672           )
673   RETURN VARCHAR2
674   IS
675 
676   BEGIN
677 
678           FND_MESSAGE.SET_NAME( 'GMF', p_message_name );
679 
680           IF( p_value1 IS NOT NULL ) THEN
681                   FND_MESSAGE.SET_TOKEN( 'S1', p_value1 );
682           END IF;
683 
684           IF( p_value2 IS NOT NULL ) THEN
685                   FND_MESSAGE.SET_TOKEN( 'S2', p_value2 );
686           END IF;
687 
688           IF( p_value3 IS NOT NULL ) THEN
689                   FND_MESSAGE.SET_TOKEN( 'S3', p_value3 );
690           END IF;
691 
692           IF( p_value4 IS NOT NULL ) THEN
693                   FND_MESSAGE.SET_TOKEN( 'S4', p_value4 );
694           END IF;
695 
696           IF( p_value5 IS NOT NULL ) THEN
697                   FND_MESSAGE.SET_TOKEN( 'S5', p_value5 );
698           END IF;
699 
700           RETURN (FND_MESSAGE.GET);
701 
702   END msg_log;
703 
704 END gmf_validate_account;