根据ccid取得账户,更改某段值再创建账户,返回新的ccid

标签: ebsCCID账户
1126人阅读 评论(0) 收藏 举报
分类:
CREATE OR REPLACE PACKAGE cux_cuxaprebate_utl IS

 
  * ===============================================
  *   PROGRAM NAME:
  *          cux_price_utl_pkg
  *   DESCRIPTION:
  *          CUX:应付发票平台返利开发FORM 工具包
  *   HISTORY:
  *        1.00 2013-12-01 cxy
  * ==============================================*/
  /* =============================================
  *   FUNCTION / PROCEDURE
  *       create_account
  *   DESCRIPTION:
  *       根据ccid取得账户,更改某段值再创建账户,返回新的ccid
  *   ARGUMENT:
          p_sql_stmt :动态SQL语句
  *   RETURN:
  *        N/A
  *   HISTORY:
  *        1.00 2013-12-01 cxy
  * =============================================*/
  PROCEDURE create_account(p_org_id IN NUMBER,
                           p_ccid   IN NUMBER,
                           x_ccid   OUT NUMBER);

END cux_cuxaprebate_utl;
/
CREATE OR REPLACE PACKAGE BODY cux_cuxaprebate_utl IS
  -- Constant Variable
  g_pkg_name        CONSTANT VARCHAR2(30) := 'cux_CUXAPREBATE_utl';
  g_conc_request_id CONSTANT NUMBER := fnd_global.conc_request_id;
  g_login_id     NUMBER := fnd_global.conc_login_id;
  g_user_id      NUMBER := fnd_global.user_id;
  g_prog_appl_id NUMBER := fnd_global.prog_appl_id;
  g_prog_id      NUMBER := fnd_global.conc_program_id;
  g_request_id      CONSTANT NUMBER := fnd_global.conc_request_id;
  g_conc_program_id CONSTANT NUMBER := fnd_global.conc_program_id;
  -- Global constant variable
  g_debug_flag VARCHAR2(1) := nvl(fnd_profile.value('AFLOG_ENABLED'), 'N');
  g_bg_id CONSTANT NUMBER := fnd_profile.value('PER_BUSINESS_GROUP_ID');
  TYPE account_type IS TABLE OF VARCHAR2(20) INDEX BY BINARY_INTEGER;
  v_account_type account_type;
 /* =============================================
  *   FUNCTION / PROCEDURE
  *       create_account
  *   DESCRIPTION:
  *       根据ccid取得账户,更改某段值再创建账户,返回新的ccid
  *   ARGUMENT:
          p_org_id :OU ID
	  p_ccid   :原ccid
 	  x_ccid   :生成新的ccid
  *   RETURN:
  *        N/A
  *   HISTORY:
  *        1.00 2013-12-01 cxy
  * =============================================*/
  PROCEDURE create_account(p_org_id IN NUMBER,
                           p_ccid   IN NUMBER,
                           x_ccid   OUT NUMBER) IS
    comma_location NUMBER := 0;
    v_location     VARCHAR2(100);
    v_count        NUMBER := 0;
    account        VARCHAR2(100) := '06.0.212101.0.0.0.0';
    account_adj    VARCHAR2(100);
    prev_location  NUMBER := 0;
    v_account      VARCHAR2(100);
    x_account      VARCHAR2(100);
  
    p_segment1 VARCHAR2(30);
    p_segment2 VARCHAR2(30);
    p_segment3 VARCHAR2(30);
    p_segment4 VARCHAR2(30);
    p_segment5 VARCHAR2(30);
    p_segment6 VARCHAR2(30);
    p_segment7 VARCHAR2(30);
    --x_ccid    NUMBER;
    v_segment3 VARCHAR2(30);
  BEGIN
    --在最后一个段后面加一个点
    account     := cux_flex_pkg.get_gl_flexfields(p_ccid   => p_ccid,
                                                  p_return => 'A');
    account_adj := account || '.';
    LOOP
      v_count        := v_count + 1;
      comma_location := instr(account_adj, '.', comma_location + 1);
      EXIT WHEN comma_location = 0;
      v_location := substr(account_adj,
                           prev_location + 1,
                           comma_location - prev_location - 1);
      prev_location := comma_location;
      v_account_type(v_account_type.count + 1) := v_location;
    
    END LOOP;
    SELECT attribute1
      INTO v_segment3
      FROM cux_lookup_codes v
     WHERE v.lookup_type = 'CUX_PUBLIC_ACCOUNT_DEFINE'
       AND v.enabled_flag = 'Y'
       AND v.lookup_code = 'AP_REBATE_MD';
    v_account_type(3) := v_segment3;
    FOR i IN v_account_type.first .. v_account_type.last LOOP
      IF i = 1 THEN
        p_segment1 := v_account_type(i);
      ELSIF i = 2 THEN
        p_segment2 := v_account_type(i);
      ELSIF i = 3 THEN
        p_segment3 := v_account_type(i);
      ELSIF i = 4 THEN
        p_segment4 := v_account_type(i);
      ELSIF i = 5 THEN
        p_segment5 := v_account_type(i);
      ELSIF i = 6 THEN
        p_segment6 := v_account_type(i);
      ELSIF i = 7 THEN
        p_segment7 := v_account_type(i);
      END IF;
    END LOOP;
  
    x_ccid := cux_gl_public_pkg.get_code_combination_id(p_org_id   => 101,
                                                        p_segment1 => p_segment1,
                                                        p_segment2 => p_segment2,
                                                        p_segment3 => p_segment3,
                                                        p_segment4 => p_segment4,
                                                        p_segment5 => p_segment5,
                                                        p_segment6 => p_segment6,
                                                        p_segment7 => p_segment7);
    /* dbms_output.put_line(x_ccid);*/
  END;

END cux_cuxaprebate_utl;
/

1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1037643次
    • 积分:14153
    • 等级:
    • 排名:第863名
    • 原创:348篇
    • 转载:260篇
    • 译文:0篇
    • 评论:21条
    ★★★★★★★交流方式★★★★★★
    Mail:xingyun.cai@qq.com
    个人书籍
    《深入浅出Oracle Form开发》.电子工业出版社
    最新评论