Thanks it works I created a recursive function and used it for sub menu. Issue is resolved. Just in case if any one interested I used men_item.tag property to store acl_id. reasons are as follows. I also says thanks to Topwiz for dynamicMenu In future I will implement it also.
01 We have 2-3 languages and verticals so menu objects are more
02 in Report Menu We have situation like one permission is enough for group of reports like item list, item list 2 columns, item list 3 columns, Item list Group wise
// *********** UDF: set_menu_option_permission_f ***************
global type set_menu_option_permission_f from function_object
end type
forward prototypes
global function integer set_menu_option_permission_f (menu am_menu)
end prototypes
global function integer set_menu_option_permission_f (menu am_menu);Menu lm_sub_menu
Int li_start, li_max, li_answer, li_counter, li_acl_id
String ls_itemname, ls_value
Boolean lb_view, lb_create, lb_update, lb_delete
li_max = UpperBound(am_menu.Item)
For li_start = 1 To li_max
lm_sub_menu = am_menu.Item[li_start]
ls_itemname = lm_sub_menu.Classname()
li_acl_id = Integer(lm_sub_menu.Tag)
IF li_acl_id > 0 Then
get_module_permission_f(li_acl_id, lb_view, lb_create, lb_update, lb_delete)
lm_sub_menu.Enabled = lb_view
lm_sub_menu.Toolbaritemvisible = lb_view
END IF
li_counter += set_menu_option_permission_f(lm_sub_menu)
Next
return li_max + li_counter
end function
global type get_all_module_permission_f from function_object
end type
forward prototypes
global subroutine get_all_module_permission_f (integer ai_acl_id, ref boolean ab_view, ref boolean ab_create, ref boolean ab_update, ref boolean ab_delete)
end prototypes
// ************* UDF get_module_permission *****************
global subroutine get_module_permission_f (integer ai_acl_id, ref boolean ab_view, ref boolean ab_create, ref boolean ab_update, ref boolean ab_delete);Int li_count
Char lc_view, lc_create, lc_update, lc_delete
SELECT view_permission, create_permission, update_permission, delete_permission, count(acl_user_permission_id)
INTO :lc_view, :lc_create, :lc_update, :lc_delete, :li_count
FROM acl_user_permission
WHERE company_id = :sec.co_id AND acl_id = :ai_acl_id AND user_id = :sec.user_id ;
IF li_count = 0 THEN
SELECT view_permission, create_permission, update_permission, delete_permission, count(acl_group_permission_id)
INTO :lc_view, :lc_create, :lc_update, :lc_delete, :li_count
FROM acl_group_permission
WHERE company_id = :sec.co_id AND acl_id = :ai_acl_id AND user_group_id = :sec.user_group_id ;
END IF
IF lc_view = "N" THEN
ab_view = False
Else
ab_view = True
END IF
IF lc_create = "N" THEN
ab_create = False
Else
ab_create = True
END IF
IF lc_update = "N" THEN
ab_update = False
Else
ab_update = True
END IF
IF lc_delete = "N" THEN
ab_delete = False
Else
ab_delete = True
END IF
end subroutine