1-create Schema object Table and USER object
CREATE TABLE SCM_OBJECTS
(
OBJECT_ID VARCHAR2(100 BYTE),
OBJECT_TYPE VARCHAR2(1 BYTE),
PARENT_OBJECT_ID VARCHAR2(60 BYTE),
SEQUENCE_NUMBER NUMBER(4),
CLASSIFICATION VARCHAR2(2 BYTE),
OBJECT_DESC_A VARCHAR2(150 BYTE),
OBJECT_DESC_E VARCHAR2(150 BYTE),
A_OBJECT_NAME VARCHAR2(25 BYTE),
APPL_TYPE NUMBER,
OBJECT_PRVLG NUMBER,
ACCESS_MODE NUMBER,
REPT_PARAM VARCHAR2(300 BYTE),
PARENT_SEQUENCE NUMBER,
CHILD_SEQUENCE NUMBER,
ICON VARCHAR2(60 BYTE)
)
OBJECT_ID -forms name or report or menu name
OBJECT_TYPE -Forms or report or Menu
PARENT_OBJECT_ID ID -for PARENT
OBJECT_DESC_A Title in ARABIC
OBJECT_DESC_E Title IN ENGLISH
A_OBJECT_NAME Object name
PARENT_SEQUENCE -PARENT sequence represent the order of the PARENT
CHILD_SEQUENCE -CHILD sequence represent the order of the PARENT-CHILD order
ICON -ICON name should appear need to put all icon in gif using jar file
CREATE TABLE USER_OBJECTS
(
EMP_CODE NUMBER(6) NOT NULL,
OBJECT_ID VARCHAR2(200 BYTE) NOT NULL,
FORM_ACCESS CHAR(1 BYTE),
FORM_INSERT CHAR(1 BYTE),
FORM_UPDATE CHAR(1 BYTE),
FORM_DELETE CHAR(1 BYTE),
CREATED_BY VARCHAR2(50 BYTE),
CREATED_DATE DATE,
MODIFIED_BY VARCHAR2(50 BYTE),
MODIFIED_DATE DATE,
ACCESS_MODE NUMBER
)
2-create tree object
3-create PROCEDURE :-Create_tree
PROCEDURE Create_tree IS
BEGIN
declare
Treerg Recordgroup;
X Number ;
rg_id RECORDGROUP;
begin
rg_id := FIND_GROUP('MAIN.Tree');
IF NOT ID_NULL(rg_id) THEN
DELETE_GROUP(rg_id);
END IF;
rg_id := CREATE_GROUP_FROM_QUERY('G' ,' SELECT 1,level,Description,icon NODE_ICON,object_id
from (
SELECT object_id,OBJECT_DESC_A Description,icon,parent_object_id,PARENT_SEQUENCE,CHILD_SEQUENCE
FROM scm_objects
WHERE object_type = '||''''||'M'||''''||
'and object_id IN(
select
PARENT_OBJECT_ID
from USER_OBJECTS,SCM_OBJECTS
where EMP_CODE='||''''||:PARAMETER.P_EMP_NO||''''||
'and USER_OBJECTS.OBJECT_ID =SCM_OBJECTS.OBJECT_ID
group by PARENT_OBJECT_ID)
union SELECT SCM_OBJECTS.object_id,OBJECT_DESC_A Description,icon,parent_object_id,PARENT_SEQUENCE,CHILD_SEQUENCE
FROM USER_OBJECTS,SCM_OBJECTS
where USER_OBJECTS.OBJECT_ID =SCM_OBJECTS.OBJECT_ID
and EMP_CODE='||''''||:PARAMETER.P_EMP_NO||''''||')'||
'CONNECT BY PRIOR object_id = NVL(parent_object_id,0)
START WITH parent_object_id is null
ORDER BY PARENT_SEQUENCE,CHILD_SEQUENCE ');--parent_object_id =0 order by ');
X := Populate_Group('G');
Ftree.Set_Tree_Property('MAIN.Tree', Ftree.Record_Group, 'G');
Delete_Group ('G');
exception when others then
message(sqlerrm ) ;
End ;
end;
Note:-:PARAMETER.P_EMP_NO Come from Login Screen
4-on WHEN-NEW-FORM-INSTANCE add this;
Create_tree;