본문 바로가기
H4binbin/Programming

Oracle ERP - 쿼리로 Function 제외하는 방법(Exclude)

by UnoPorDia 2025. 3. 1.

여러 권한에 있는 특정 Function 을 쿼리문을 써서 제외하고자 할때는 다음 순서를 따른다. 화면에서 하려면 너무 많은 양 일 경우에 쓸 수 있다. Oracle ERP 에서 메뉴 컴파일로 장애가 일어나는 경우가 종종 있는데, 아래의 경우 메뉴 컴파일이 아니라 "Exclude" 즉, 메뉴를 안보이게만 처리하는 것이어서 비교적 안전하다.

1) Function 을 찾는다.

select * from fnd_form_functions_tl a where a.user_function_name = '&menu name';​

메뉴명은 Reponsibility 셋업화면에 Mapping 된 Top 메뉴를 찾고, 그 Sub Menu 들을 내려가면서 찾을 수 있지만 여기서는 다루지 않는다.

2) function 이 들어있는 Menu 를 가진 Responsibility 를 찾아서 메뉴를 제거(Exclude)한다.  

이 역시 수작업으로 셋업화면에서 할 수 있지만 다음과 같이 쿼리로도 할 수 있다.

- Who 컬럼(Last Update, Created 관련 컬럼) 에 들어갈 값은, PL/SQL 상에서 쿼리로 로그인 처리를 하면 fnd 함수를 몇개 써서 가져올 수 있지만 여기서는 생략한다. 날짜 정보도 국가별 설정을 고려하지 않고 system 의 날짜로 기재하였음에 유의.

- &function_id 는 첫번째 단계에서 찾아서 입력하고 &responsibility_key_value 는 속도 사유로 responsibility 별로 진행하기 위해 필요한 parameter 이다.

Insert into fnd_resp_functions
(application_id
, responsibility_id
, action_id /*function_id*/
, rule_type /*F*/
, last_update_date
, last_updated_by
, last_update_login
, creation_date
, created_by )
select fr.appllication_id
, fr.responsibility_id
&function_id
, 'F'
, SYSDATE
,-1  /* last_updated_by */
,-1  /* last_update_login */
,SYSDATE
,-1 /* created_by */
from fnd_responsibility fr , fnd_responsibility_tl frt
where fr.responsibility_id = frt.responsibility_id
and fr.responsibility_key like &responsibility_key_value
and fr.menu_id in (select menu_id from fnd_menu_entries 
                             connect by prior menu_id = sub_menuu_id
                              start with menu_id in (select menu_id from fnd_menu_entries where function_id = &function_id))
and not exists (select 1 from fnd_resp_functions z where reponsibility_id = fr.responsibility_id and rule_type = 'F'  and actin_id = &function_id and z.application_id = fr.application_id);

'H4binbin > Programming' 카테고리의 다른 글

Oracle ERP - User  (0) 2025.03.01
Oracle ERP - Concurrent  (0) 2025.03.01
Oracle ERP - DB Object 확인 쿼리  (0) 2025.03.01
Oracle ERP - Responsibility, Function, Menu table  (0) 2025.03.01