Get menu item list for the given user - BAQ

We are trying to extract all the menu items (displayed in the E10 menu) for the given user Id.

We use the following query to extract the menu items.
But below query returns some of the additional menu items which are not shown in the E10 menu list.
Can you please suggest what are the additional filter criteria that needs to be applied on this.

select
[SecGroup].[Company] as [SecGroup_Company],
[SysUserFile].[UserID] as [SysUserFile_UserID],
[SysUserFile].[Name] as [SysUserFile_Name],
[Menu].[ParentMenuID] as [Menu_ParentMenuID],
[MenuParent].[MenuDesc] as [MenuParent_MenuDesc],
[Menu].[MenuID] as [Menu_MenuID],
[Menu].[MenuDesc] as [Menu_MenuDesc],
[Menu].[Program] as [Menu_Program],
[Menu].[Sequence] as [Menu_Sequence]
from Ice.Security as Security
inner join Ice.SecGroup as SecGroup on
((’,’ + EntryList +’,’ like ā€˜%,’+ SecGroupCode +’,%’
or Security.EntryList = ā€˜ā€™)
and (Security.NoEntryList <> '
’
or Security.NoEntryList not like ā€˜%,’+ SecGroupCode +’,%’))
inner join Ice.SysUserFile as SysUserFile on
ā€˜~’ + GroupList +’~’ like ā€˜%~’+ SecGroupCode +’~%’
inner join Ice.Menu as Menu on
Security.SecCode = Menu.SecCode
and ( Menu.OptionType = ā€˜I’ )

inner join Ice.Menu as MenuParent on
Menu.ParentMenuID = MenuParent.MenuID
group by [SecGroup].[Company],
[SysUserFile].[UserID],
[SysUserFile].[Name],
[Menu].[ParentMenuID],
[MenuParent].[MenuDesc],
[Menu].[MenuID],
[Menu].[MenuDesc],
[Menu].[Program],
[Menu].[Sequence]
order by SysUserFile.UserID, Menu.ParentMenuID, Menu.Sequence

1 Like