欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

EBS动态创建账户组合实现

程序员文章站 2024-01-22 00:00:16
...

目的:使用程序动态创建账户组合。如果账户组合存在的话,返回存在的ID,不存在的话就动态创建账户组合并返回id。 实现步骤: 1. 得到账簿的CHART_OF_ACCOUNTS_ID 2. 得到账户弹性域分隔符 3. 调用标准的API得到账户组合id 具体实现如下: 1. 得到账簿的CHAR

目的:使用程序动态创建账户组合。如果账户组合存在的话,返回存在的ID,不存在的话就动态创建账户组合并返回id。

实现步骤:

1. 得到账簿的CHART_OF_ACCOUNTS_ID

2. 得到账户弹性域分隔符

3. 调用标准的API得到账户组合id

具体实现如下:

1. 得到账簿的CHART_OF_ACCOUNTS_ID实现code:

SELECT sob.chart_of_accounts_id  
  INTO l_id_flex_num  
  FROM financials_system_params_all fsp, gl_sets_of_books sob  
 WHERE org_id = p_org_id  
   AND sob.set_of_books_id = fsp.set_of_books_id;  


2. 得到账户弹性域分隔符实现code:

SELECT concatenated_segment_delimiter  
  INTO l_segment_delimiter  
  FROM fnd_id_flex_structures  
 WHERE application_id = 101  
   AND id_flex_code = 'GL#'  
   AND id_flex_num = l_id_flex_num;


3. 调用标准的API得到账户组合id实现code:

l_concatenated_segments := l_segment1 || l_segment_delimiter ||  
                             p_segment2 || l_segment_delimiter ||  
                             p_segment3 || l_segment_delimiter ||  
                             l_segment4 || l_segment_delimiter ||  
                             l_segment5 || l_segment_delimiter ||  
                             l_segment6 || l_segment_delimiter ||  
                             l_segment7 || l_segment_delimiter ||  
                             l_segment8 || l_segment_delimiter ||  
                             l_segment9 || l_segment_delimiter ||  
                             l_segment10 || l_segment_delimiter ||  
                             l_segment11 || l_segment_delimiter ||  
                             l_segment12 || l_segment_delimiter ||  
                             l_segment13 || l_segment_delimiter ||  
                             l_segment14 || l_segment_delimiter ||  
                             l_segment15 || l_segment_delimiter ||  
                             l_segment16 || l_segment_delimiter ||  
                             l_segment17 || l_segment_delimiter ||  
                             l_segment18 || l_segment_delimiter ||  
                             l_segment19 || l_segment_delimiter ||  
                             l_segment20 || l_segment_delimiter ||  
                             l_segment21 || l_segment_delimiter ||  
                             l_segment22 || l_segment_delimiter ||  
                             l_segment23 || l_segment_delimiter ||  
                             l_segment24 || l_segment_delimiter ||  
                             l_segment25 || l_segment_delimiter ||  
                             l_segment26 || l_segment_delimiter ||  
                             l_segment27 || l_segment_delimiter ||  
                             l_segment28 || l_segment_delimiter ||  
                             l_segment29 || l_segment_delimiter ||  
                             l_segment30 || l_segment_delimiter;  
  l_gcc_account_id := apps.fnd_flex_ext.get_ccid(application_short_name => 'SQLGL',  
                                                 key_flex_code          => 'GL#',  
                                                 structure_number       => l_id_flex_num,  
                                                 validation_date        => to_char(SYSDATE,  
                                                                                   apps.fnd_flex_ext.DATE_FORMAT),  
                                                 concatenated_segments  => x_concatenated_seg);  
  fnd_file.PUT_LINE(fnd_file.log,  
                    'l_gcc_account_id:' || l_gcc_account_id);  
  IF l_gcc_account_id = 0 THEN  
    RETURN NULL;  
  END IF;  

注意 :如果账户ID返回0,表示没有创建成功。

错误原因:传入的参数不正确或者账户组合没有通过验证。