通过CCID获得各个段的描述的方法

gl_code_combination 是存放会计科目组合的键弹性域的表单。
该表单中没有字段的描述,一个段一个段的加描述太麻烦了。
我通常都是通过以下的方法来获得描述

sql语句上:
SELECT gl_flexfields_pkg.get_description_sql(&char_of_account_id,1,gcc.segment1) seg1,
       gl_flexfields_pkg.get_description_sql(&char_of_account_id,2,gcc.segment2) seg2,
       gl_flexfields_pkg.get_description_sql(&char_of_account_id,3,gcc.segment3) seg3,
       gl_flexfields_pkg.get_description_sql(&char_of_account_id,4,gcc.segment4) seg4,
       gl_flexfields_pkg.get_description_sql(&char_of_account_id,5,gcc.segment5) seg5,
       gl_flexfields_pkg.get_description_sql(&char_of_account_id,6,gcc.segment6) seg6
FROM gl_code_combinations gcc
WHERE gcc.code_combination_id = &code_combination_id;

form上:
  declare
          l_char_id number;
          l_account varchar2(300);
          l_desc varchar2(500);
          l_flex_return varchar2(480);
          l_num number;
  begin
      
       dbms_application_info.set_client_info(122);
        --==Get structure_number
            select gl.chart_of_accounts_id
              into l_char_id
              from gl_sets_of_books gl,            
                   fnd_currencies fnd,                   
                   ap_system_parameters asp,
                   gl_daily_conversion_types gdct,
                   financials_system_parameters fsp,
                   ap_terms  apt
             WHERE gl.set_of_books_id = asp.set_of_books_id
                   AND gl.currency_Code = fnd.currency_code
                   AND asp.default_exchange_rate_type = gdct.conversion_type(+)
                   AND asp.prepayment_terms_id = apt.term_id(+);
        --==Get the CCID
          l_account := '11.000000.212101.0000.0000.0000';
          l_num :=fnd_flex_ext.get_ccid(
                                        application_short_name => 'SQLGL',
                                        key_flex_code => 'GL#',
                                        structure_number => 101,
                                        validation_date => to_char(sysdate,'YYYY-MM-DD'),
                                        concatenated_segments => l_account
                                       );
          dbms_output.put_line(l_num);
       --==Get segment conbination
           l_flex_return := FND_FLEX_EXT.GET_SEGS(
                                       APPLICATION_SHORT_NAME => 'SQLGL',
                                      KEY_FLEX_CODE          => 'GL#',
                                      STRUCTURE_NUMBER       => l_char_id,
                                      COMBINATION_ID         => l_num);
          dbms_output.put_line(l_flex_return);
       --==Get segment description
           if (FND_FLEX_KEYVAL.validate_ccid(
                appl_short_name => 'SQLGL',
                key_flex_code => 'GL#',
                structure_number => l_char_id,
                                                    combination_id => l_num,
                                                    displayable         => 'ALL',
                                                    data_set        => NULL,
                                                    vrule                => NULL,
                                                    --security        => 'IGNORE',
                                                    get_columns        => NULL,
                                                    resp_appl_id        => NULL,
                                                    resp_id                => NULL,
                                                    user_id                => NULL)
               ) Then       
               l_desc := FND_FLEX_KEYVAL.concatenated_descriptions;
           end if;
          dbms_output.put_line(l_desc);
  end;

你可能感兴趣的:(Flex,application,Parameters,books,structure,combinations)