根据科目组合以及分类账等信息获取ccid,同时得到是否运行前台数据等信息。
FUNCTION
get_code_combination_id(p_concatenated_segments
IN
VARCHAR2,
p_chart_of_accounts_id
IN
NUMBER,
x_posting_allowed_flag
OUT
VARCHAR2)
RETURN
NUMBER
IS
l_code_combination_id
NUMBER
NULL;
BEGIN
l_code_combination_id := apps.fnd_flex_ext.get_ccid(application_short_name =>
'SQLGL',
key_flex_code =>
'GL#',
structure_number => p_chart_of_accounts_id,
validation_date => to_char(SYSDATE,
apps.fnd_flex_ext.date_format),
concatenated_segments => p_concatenated_segments);
BEGIN
SELECT
t.detail_posting_allowed
INTO
x_posting_allowed_flag
FROM
gl_code_combinations_kfv t
WHERE
t.code_combination_id = l_code_combination_id;
EXCEPTION
WHEN
OTHERS
THEN
x_posting_allowed_flag :=
'N';
END;
RETURN
nvl(l_code_combination_id, -1);
EXCEPTION
WHEN
OTHERS
THEN
IF
fnd_flex_keyval.validate_segs(operation =>
'CREATE_COMBINATION',
appl_short_name =>
'SQLGL',
key_flex_code =>
'GL#',
structure_number => p_chart_of_accounts_id,
concat_segments => p_concatenated_segments)
THEN
l_code_combination_id := fnd_flex_ext.get_ccid('SQLGL',
'GL#',
p_chart_of_accounts_id,
to_char(SYSDATE,
'YYYY-MM-DD'),
p_concatenated_segments);
BEGIN
SELECT
t.detail_posting_allowed
INTO
x_posting_allowed_flag
FROM
gl_code_combinations_kfv t
WHERE
t.code_combination_id = l_code_combination_id;
EXCEPTION
WHEN
OTHERS
THEN
x_posting_allowed_flag :=
'N';
END;
ELSE
l_code_combination_id := -1;
x_posting_allowed_flag :=
'N';
END
IF;
RETURN
l_code_combination_id;
END
get_code_combination_id;