Using FND_FLEX_ KEYVAL.VALIDATE_SEGS you can create GL Account Code Combination in Oracle Apps.
FND_FLEX_ KEYVAL.VALIDATE_SEGS:
1.Finds combination from given segment values.
2.Segments are passed in as a concatenated string in increasing
order of segment_number (display order).
Operation is one of:
'FIND_COMBINATION' - Combination must already exist.
'CREATE_COMBINATION' - Combination is created if doesn't exist.
'CREATE_COMB_NO_AT' - same as create_combination but does not
use an autonomous transaction.
'CHECK_COMBINATION' - Checks if combination valid, doesn't create.
'DEFAULT_COMBINATION' - Returns minimal default combination.
'CHECK_SEGMENTS' - Validates segments individually.
If validation date is NULL checks all cross-validation rules.
Returns TRUE if combination valid,or FALSE and sets error message on server if invalid
CREATE OR REPLACE FUNCTION xx_create_ccid (p_concat_segs VARCHAR2)
RETURN VARCHAR2
IS
-- pragma autonomous_transaction; -- if you need autonomy!
l_keyval_status BOOLEAN;
l_coa_id NUMBER;
l_sob NUMBER;
BEGIN
l_sob := fnd_profile.VALUE ('GL_SET_OF_BKS_ID');
BEGIN
SELECT chart_of_accounts_id
INTO l_coa_id
FROM gl_sets_of_books
WHERE set_of_books_id = l_sob;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line (
'Chart of Accounts ID not found from profile option GL_SET_OF_BKS_ID');
DBMS_OUTPUT.put_line (
'Try setting up your environment with fnd_global.apps_initialize');
RAISE;
END;
-- keyval_mode can be one of CREATE_COMBINATION CHECK_COMBINATION FIND_COMBINATION
-- create will only work if dynamic inserts on and cross validation rules not broken
l_keyval_status :=
fnd_flex_keyval.validate_segs ('CREATE_COMBINATION',
'SQLGL',
'GL#',
l_coa_id,
p_concat_segs,
'V',
SYSDATE,
'ALL',
NULL,
NULL,
NULL,
NULL,
FALSE,
FALSE,
NULL,
NULL,
NULL);
IF l_keyval_status
THEN
RETURN 'S';
ELSE
RETURN 'F';
END IF;
END xx_create_ccid;
FND_FLEX_ KEYVAL.VALIDATE_SEGS:
1.Finds combination from given segment values.
2.Segments are passed in as a concatenated string in increasing
order of segment_number (display order).
Operation is one of:
'FIND_COMBINATION' - Combination must already exist.
'CREATE_COMBINATION' - Combination is created if doesn't exist.
'CREATE_COMB_NO_AT' - same as create_combination but does not
use an autonomous transaction.
'CHECK_COMBINATION' - Checks if combination valid, doesn't create.
'DEFAULT_COMBINATION' - Returns minimal default combination.
'CHECK_SEGMENTS' - Validates segments individually.
If validation date is NULL checks all cross-validation rules.
Returns TRUE if combination valid,or FALSE and sets error message on server if invalid
CREATE OR REPLACE FUNCTION xx_create_ccid (p_concat_segs VARCHAR2)
RETURN VARCHAR2
IS
-- pragma autonomous_transaction; -- if you need autonomy!
l_keyval_status BOOLEAN;
l_coa_id NUMBER;
l_sob NUMBER;
BEGIN
l_sob := fnd_profile.VALUE ('GL_SET_OF_BKS_ID');
BEGIN
SELECT chart_of_accounts_id
INTO l_coa_id
FROM gl_sets_of_books
WHERE set_of_books_id = l_sob;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line (
'Chart of Accounts ID not found from profile option GL_SET_OF_BKS_ID');
DBMS_OUTPUT.put_line (
'Try setting up your environment with fnd_global.apps_initialize');
RAISE;
END;
-- keyval_mode can be one of CREATE_COMBINATION CHECK_COMBINATION FIND_COMBINATION
-- create will only work if dynamic inserts on and cross validation rules not broken
l_keyval_status :=
fnd_flex_keyval.validate_segs ('CREATE_COMBINATION',
'SQLGL',
'GL#',
l_coa_id,
p_concat_segs,
'V',
SYSDATE,
'ALL',
NULL,
NULL,
NULL,
NULL,
FALSE,
FALSE,
NULL,
NULL,
NULL);
IF l_keyval_status
THEN
RETURN 'S';
ELSE
RETURN 'F';
END IF;
END xx_create_ccid;
No comments:
Post a Comment