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

Authirisation in se38 code

Former Member
0 Likes
886

Dear Friends,

I have taken Material Type in selection screen.Requirement is multiple user(login id) can aceess particular material Type.Lets take one example,

user1 can see data of only FERT,

user2 can see data of all material type

user3 can see data of FERT & HAWA.

So i have to restriction in material type.I have written code for that matter but probem is not solved

DATA: NO TYPE N.

RANGES: R_MTART FOR T134-MTART.

SELECT-OPTIONS: S_MTART FOR T134-MTART.

DESCRIBE TABLE S_MTART LINES NO.

IF NO EQ 000.

SELECT * FROM T134.

AUTHORITY-CHECK OBJECT 'M_MATE_MAR'

id 'MTART' field T134-MTART.

IF SY-SUBRC = 0.

R_MTART-SIGN = 'I'.

R_MTART-OPTION = 'EQ'.

R_MTART-LOW = T134-MTART.

APPEND R_MTART.

ENDIF.

ENDSELECT.

ELSE.

SELECT * FROM T134 WHERE MTART IN S_MTART.

AUTHORITY-CHECK OBJECT 'M_MATE_MAR'

id 'MTART' field T134-MTART.

IF SY-SUBRC = 0.

R_MTART-SIGN = 'I'.

R_MTART-OPTION = 'EQ'.

R_MTART-LOW = T134-MTART.

APPEND R_MTART.

ENDIF.

ENDSELECT.

ENDIF.

CLEAR: NO.

DESCRIBE TABLE R_MTART LINES NO.

IF NO EQ 000.

message e000(ZFI) WITH TEXT-000 .

ENDIF.

-


So please look into matter and reply me.

Thanks.

8 REPLIES 8
Read only

GauthamV
Active Contributor
0 Likes
838

hi,

after you use AUTHORITY-CHECK OBJECT statement in program

tell the basis people to maintain this object in profiles of the users with

respective material types thay are authorised.

Read only

Former Member
0 Likes
838

hi,

i think you didn't specify anything regarding 'ACTVT' in authority -check

Sample code:-

here it is checked whether user has display authority or not....

LOOP AT t_t001_temp INTO wa_t001_temp.

AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'

ID 'BUKRS' FIELD wa_t001_temp-bukrs

ID 'ACTVT' FIELD '03'.

IF sy-subrc NE 0.

MESSAGE e063(yl) WITH wa_t001_temp-bukrs.

ENDIF.

CLEAR wa_t001_temp.

ENDLOOP.

Read only

Former Member
0 Likes
838

Thans for reply.

But Basis person have already done restriction in user login profile.

although problem is not solved

Thanks.

Read only

0 Likes
838

hi,

where did you define that statement in program.

declare in at selection screen on field event.

Read only

0 Likes
838

Hi Shivam,

I have verified the object 'M_MATE_MAR' in SU21. It doesn't have the fieldname MTART defined in the object. I guess you are using the wrong object to check the authorisation. In this object you can just check using the Field - BEGRU (Authorization Group) not MTART.

Please check in the transaction - SU21 what all fields have been defined in the object.

Ask your functional person or basis people for the correct authorization object to be used.

Read only

Former Member
0 Likes
838

Thans for reply.

Problem is solved.

Read only

0 Likes
838

Please close the thread once your issue is resolved.

Read only

Former Member
0 Likes
838

ok.Thanks.