/*借方科目组合*/
l_code_combination := rec_gl_1.segment1 || '.' || rec_gl_1.segment2 || '.' || rec_gl_1.segment3 || '.' || rec_kp.segment4 || '.' || '0' || '.' || rec_gl_1.segment6 || '.' || '0' || '.' || '0' || '.' || '0';
/*验证账户组合段是否符合交叉验证规则*/
l_validate_result := fnd_flex_keyval.validate_segs(operation => 'CHECK_SEGMENTS'
,appl_short_name => 'SQLGL'
,key_flex_code => 'GL#'
,structure_number => g_coa_id
,concat_segments => l_code_combination);
IF (l_validate_result) THEN
/*已存在的组合,返回CCID,不存在的组合,自动创建并返回CCID*/
l_dr_code_combination_id := fnd_flex_ext.get_ccid('SQLGL'
,'GL#'
,g_coa_id
,to_char(SYSDATE
,fnd_flex_ext.date_format)
,l_code_combination);
dbms_output.put_line('l_dr_code_combination_id => ' || l_dr_code_combination_id);
IF nvl(l_dr_code_combination_id
,-1) <= 0 THEN
x_return_status := 'E';
l_msg_data := 'err_code:' || '创建并返回CCID失败!';
RETURN;
END IF;
ELSE
x_return_status := 'E';
l_msg_data := l_msg_data || 'err_code:' || '验证账户组合段是否符合交叉验证规则!';
log('fnd_flex_keyval.error_message' || fnd_flex_keyval.error_message);
l_code_combination := rec_gl_1.segment1 || '.' || rec_gl_1.segment2 || '.' || rec_gl_1.segment3 || '.' || rec_kp.segment4 || '.' || '0' || '.' || rec_gl_1.segment6 || '.' || '0' || '.' || '0' || '.' || '0';
/*验证账户组合段是否符合交叉验证规则*/
l_validate_result := fnd_flex_keyval.validate_segs(operation => 'CHECK_SEGMENTS'
,appl_short_name => 'SQLGL'
,key_flex_code => 'GL#'
,structure_number => g_coa_id
,concat_segments => l_code_combination);
IF (l_validate_result) THEN
/*已存在的组合,返回CCID,不存在的组合,自动创建并返回CCID*/
l_dr_code_combination_id := fnd_flex_ext.get_ccid('SQLGL'
,'GL#'
,g_coa_id
,to_char(SYSDATE
,fnd_flex_ext.date_format)
,l_code_combination);
dbms_output.put_line('l_dr_code_combination_id => ' || l_dr_code_combination_id);
IF nvl(l_dr_code_combination_id
,-1) <= 0 THEN
x_return_status := 'E';
l_msg_data := 'err_code:' || '创建并返回CCID失败!';
RETURN;
END IF;
ELSE
x_return_status := 'E';
l_msg_data := l_msg_data || 'err_code:' || '验证账户组合段是否符合交叉验证规则!';
log('fnd_flex_keyval.error_message' || fnd_flex_keyval.error_message);
RETURN;
END IF;