【EBS】菜单的复制脚本

不打扰是莪最后的温柔 提交于 2019-12-05 22:48:00
DECLARE
  l_error_flag        VARCHAR2(1);
  l_menu_rowid        VARCHAR2(100);
  l_menu_entity_rowid VARCHAR2(100);
  l_menu_id           NUMBER;
  l_cnt               NUMBER := 0;
  c_new_menu_code    CONSTANT VARCHAR2(50) := 'CUX_MDM_MENU_SYS_GROUP'; ----新的菜单简称
  c_new_menu_name    CONSTANT VARCHAR2(100) := 'CUX_MDM菜单_运维_集团'; --用户菜单名
  c_copied_menu_code CONSTANT VARCHAR2(50) := 'CUX_MDM_MENU_SYS'; --被复制的菜单名

  CURSOR csr_menu_entity IS
    SELECT DISTINCT fme.entry_sequence,
                    fme.sub_menu_id,
                    fme.function_id,
                    fme.grant_flag,
                    fmet.prompt,
                    fmet.description
      FROM fnd_menu_entries    fme,
           fnd_menu_entries_tl fmet,
           fnd_menus           fm
     WHERE fme.menu_id = fm.menu_id
       AND fmet.menu_id = fm.menu_id
       AND fmet.entry_sequence = fme.entry_sequence
       AND fm.menu_name = c_copied_menu_code;

BEGIN
  SELECT fnd_menus_s.nextval
    INTO l_menu_id
    FROM dual;
  l_error_flag := 'N';

  fnd_menus_pkg.insert_row(x_rowid             => l_menu_rowid,
                           x_menu_id           => l_menu_id,
                           x_menu_name         => c_new_menu_code,
                           x_user_menu_name    => c_new_menu_name,
                           x_menu_type         => NULL,
                           x_description       => NULL,
                           x_creation_date     => SYSDATE,
                           x_created_by        => fnd_global.user_id,
                           x_last_update_date  => SYSDATE,
                           x_last_updated_by   => fnd_global.user_id,
                           x_last_update_login => fnd_global.login_id);
  IF l_menu_rowid IS NULL THEN
    dbms_output.put_line('error:' || SQLERRM);
    l_error_flag := 'Y';
  ELSE
    FOR l_menu_entity_rec IN csr_menu_entity LOOP
    
      fnd_menu_entries_pkg.insert_row(x_rowid             => l_menu_entity_rowid,
                                      x_menu_id           => l_menu_id,
                                      x_entry_sequence    => l_menu_entity_rec.entry_sequence,
                                      x_sub_menu_id       => l_menu_entity_rec.sub_menu_id,
                                      x_function_id       => l_menu_entity_rec.function_id,
                                      x_grant_flag        => l_menu_entity_rec.grant_flag,
                                      x_prompt            => l_menu_entity_rec.prompt,
                                      x_description       => l_menu_entity_rec.description,
                                      x_creation_date     => SYSDATE,
                                      x_created_by        => fnd_global.user_id,
                                      x_last_update_date  => SYSDATE,
                                      x_last_updated_by   => fnd_global.user_id,
                                      x_last_update_login => fnd_global.login_id);
    
      IF l_menu_rowid IS NULL THEN
        dbms_output.put_line('error:' || SQLERRM);
        l_error_flag := 'Y';
      ELSE
        l_cnt := l_cnt + 1;
      END IF;
    END LOOP;
  END IF;

  IF l_error_flag = 'N' AND l_cnt > 0 THEN
    dbms_output.put_line('提交编译请求:' || fnd_menu_entries_pkg.submit_compile);
  END IF;
EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line(SQLCODE || ',' || SQLERRM);
END;

 

 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!