Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Role Menu/Function using BAPI

Former Member
0 Likes
1,590

In an effort to integrate a customers two products, I am trying to list out all of the roles and menus assigned to a role using JAVA/JCO and BAPI.

Is this relationship well defined enough to use RFC_GET_TABLE_ENTRIES? I can get a list of the role names from AGR_DEFINE (or V_AGR_SINGL, V_AGR_COLL) , but the menu/function table is not as obvious. I noticed the ARG_HIERT table, which look like it has the textual names of the menus. I was thinking I'd get back an ID of a object instead of the textual representation. Or is this not recommended?

Additionally, is there any iterative approach that can be used when listing objects (like roles) where the number of objects is in the 10's of thousands? The only way I can see now is to fetch all of the names from a view that has only the names, then for each one make a separate call to get the details.

I see there are some nice APis in the com.sap.security.api package, but those will require I have an application living on the J2EE side of SAP and I would like to prevent that if at all possible.

Thanks,

Donny

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,311

Hello Donny

Your requirements are not fully clear to me yet perhaps the following fm's might be useful.

COLL_ACTGROUPS_GET_ACTGROUPS (RFC enabled) => get all roles of collective role
MENU_AGR_TREE_READ_HIERARCHY (RFC enabled) => reads AGR_HIER

Regards

Uwe

6 REPLIES 6
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,312

Hello Donny

Your requirements are not fully clear to me yet perhaps the following fm's might be useful.

COLL_ACTGROUPS_GET_ACTGROUPS (RFC enabled) => get all roles of collective role
MENU_AGR_TREE_READ_HIERARCHY (RFC enabled) => reads AGR_HIER

Regards

Uwe

Read only

0 Likes
1,311

Thanks of the response it was helpful for me to find the menus to role mapping in MENU_AGR_TREE_READ_HIERARCHY.

As for the other part of my question, is there a table/view or function I can call to get back just the names of all the roles defined in the system? Something similar to the V_USR_NAME view for users?

I am trying to get a list of all the roles ids/names and am currently using AGR_DEFINE in conjunction with RFC_GET_TABLE_ENTRIES and finding the amount of data it transfers is large and causes performance problems.

Thanks,

Donny

Read only

0 Likes
1,311

Hello Donny

The RFC-fm you are looking for is PRGN_ACTIVITY_GROUPS_LOAD_RFC.

Regards

Uwe

Read only

0 Likes
1,311

Thanks for your help.

PRGN_ACTIVITY_GROUPS_LOAD_RFC has some good data in it I can use, however the one piece of information that I am after is the TCODES assigned to a role.

The information that is contained in the AGR_TCODES table.

Is there a remote function/program I can call that given the name of the role will return all of the tcodes assigned to the role?

PRGN_READ_TRANSACTIONS_ONE_AGR

and

PRGN_1221_READ_TRANSACTIONS

Are exactly they type of thing am after, but they cannot be used for 'remote' calls.

Thanks again,

Donny Smith

Read only

0 Likes
1,311

Hello Donny

Yep, there is:

PRGN_READ_TRANSACTIONS_AGRS = multiple roles, but not RFC-enabled
MENU_AGR_TREE_READ_HIERARCHY = single role, RFC-enabled
PRGN_STRU_LOAD_NODES =  single role, RFC-enabled

I think fm MENU_AGR_TREE_READ_HIERARCHY is your candidate.

Regards

Uwe

Read only

0 Likes
1,311

Hi Uwe,

is it possible you have ever tried to save this data back to the system?

Namely the combination of 'MENU_AGR_TREE_READ_HIERARCHY' and 'PRGN_SAVE_ROLE_MENU'?

Or any other combination that would let me replicate a role menu into another role? Ok, not so difficult so far... but I need to hhave this done with structure. I am able to replicate the menu, but then the structure is lost as well as everything else except the transactions. I would love to be able to replicate "any" menu (menu with folders, menu with RFC modules in it etc.).

Any ideas would help,

thanks

Otto