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

Need logic : all role for a given tcode : even mannually added

Former Member
0 Likes
800

Hello Friends,

I need some help in creating logic.

Requirement : User enters transaction and report should show list of all ROLES which contain that tcode. Remember to consider Mannually added tcodes under S_TCODE e.g it could be A* or range T* to Z* or only RZ11.

i had created small program to extract data, but I am unable to build logic to get required result.

Please help.

REPORT YTEST .

TABLES : AGR_1251.

DATA ITAB LIKE AGR_1251 OCCURS 0 WITH HEADER LINE.

PARAMETER TCODE LIKE AGR_1251-LOW .

SELECT * FROM AGR_1251 INTO TABLE ITAB WHERE OBJECT = 'S_TCODE' AND

FIELD = 'TCD' '.

LOOP AT ITAB.

IF ITAB-LOW CP '*'.

ELSE.

DELETE ITAB WHERE LOW(1) <> TCODE(1).

ENDIF.

ENDLOOP.

WRITE : / 'ITAB-AGR_NAME', 30'ITAB-OBJECT', 'ITAB-FIELD', 'ITAB-LOW',

'ITAB-HIGH'.

LOOP AT ITAB.

WRITE : / ITAB-AGR_NAME, ITAB-OBJECT, ITAB-FIELD, ITAB-LOW, ITAB-HIGH.

ENDLOOP.

6 REPLIES 6
Read only

Former Member
0 Likes
748

Kindly advice I am unable to get logic to resolve issue, although I know where is data.

So if user give SMLG, how to find whether it is in a given range or not

Message was edited by:

satinder ghuman

Read only

0 Likes
748

hi Satinder,

if u want to find roles in a range of t-code u need to use Select-options instead of parameters.

<b>TABLES : AGR_1251.

DATA ITAB LIKE AGR_1251 OCCURS 0 WITH HEADER LINE.

SELECT-OPTIONS: TCODE FOR AGR_1251-LOW.

SELECT * FROM AGR_1251 INTO TABLE ITAB WHERE OBJECT = 'S_TCODE' AND

FIELD = 'TCD' AND LOW IN TCODE.

WRITE : / 'ITAB-AGR_NAME', 30'ITAB-OBJECT', 'ITAB-FIELD', 'ITAB-LOW',

'ITAB-HIGH'.

LOOP AT ITAB.

WRITE : / ITAB-AGR_NAME, ITAB-OBJECT, ITAB-FIELD, ITAB-LOW, ITAB-HIGH.

ENDLOOP.</b>

Regards

SAB

Read only

uwe_schieferstein
Active Contributor
0 Likes
748

Hello Satinder

Are you sure that neither of the many reports available in transaction <b>SUIM </b>are suitable for your inquiries?

For example, if you call Report <b>User Information System -> Roles -> By Transaction Assignment</b> the result shows all roles that have the selected transaction(s) assigned.

Regards

Uwe

Read only

Former Member
0 Likes
748

Hi,

Have you looked standard program RSUSR070?

In this program, you can enter a given transaction and system willl display all role(s) involved.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
748

Thanks for replying.

Using RSUSR070 was the first thing I did. But it was rejected.

So now all I need is a logic in the said program.

Hello Syed,

Sorry this logic did not work as we can give range like P* to Y*. So we have to keep track of both LOW as well as HIGH.

Any other suggestion please, will be greatly appreaciated.

Read only

Former Member
0 Likes
748

Hello Guys,

Please advice.

Do we have a developer who can help me in ABAP logic for this issue.

regards,

Message was edited by:

satinder ghuman