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

Authorisation Check

Bema
Active Participant
0 Likes
1,305

Hi,

SELECT-OPTIONS: s_kostl FOR zstruct_kostl-kostl

NO-EXTENSION.

AUTHORITY-CHECK OBJECT 'K_CSKS'

ID 'KOKRS' FIELD '*'

ID 'KOSTL' FIELD s_kostl

ID 'ACTVT' FIELD '*' .

IF sy-subrc NE 0.

MESSAGE ID 'ZFI' TYPE 'E' NUMBER 34 WITH s_kostl.

ENDIF.

User has given the authorisation to run the cost center 511131311.

But it is showin the message like this.

Object K_CSKS CO-CCA: Cost Center Master

Object class CO Controlling

Field Value

Activity

*

Controlling Area

*

Cost Center

<b>IEQ0511131</b>

It is not allowing the user to xecute this cost center value.

Can I know what the problem will be?

Regards,

Beena

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,075

hi beena ,

1.first u have to get all the Cost centes which comes for the given range in selection scree.

select kokrs kostl from csks into i_kostl where kostl in s_kostl.

2.Then u have to check like this


loop at i_kostl.
AUTHORITY-CHECK OBJECT 'K_CSKS'
ID 'KOKRS' FIELD '*'
ID 'KOSTL' FIELD i_kostl-kostl.
ID 'ACTVT' FIELD '*' .
IF sy-subrc NE 0.
MESSAGE ID 'ZFI' TYPE 'E' NUMBER 34 WITH i_kostl-kostl.
ENDIF.
endloop.

Regards

Prabhu

5 REPLIES 5
Read only

Laxmana_Appana_
Active Contributor
0 Likes
1,075

Hi,

Have you added 'K_CSKS' to user profile? Before calling the authorization object , use below statement .

read s_kostl index 1.

AUTHORITY-CHECK OBJECT 'K_CSKS'

ID 'KOKRS' FIELD '*'

ID 'KOSTL' FIELD s_kostl-low

ID 'ACTVT' FIELD '*' .

IF sy-subrc NE 0.

MESSAGE ID 'ZFI' TYPE 'E' NUMBER 34 WITH s_kostl.

ENDIF.

Regards

Appana

Read only

Former Member
0 Likes
1,075

I think you need to loop <b>s_kostl</b> and pick up each value for authorization check.

The selection-option <b>s_kostl</b> will have multiple value.

you can loop it

for each value moving to a temp variable.

pass the temp variable to authority check.

Rgds,

TM

Read only

Bema
Active Participant
0 Likes
1,075

hi,

For one value also it is not working.

yes, we have added this in the user profile.

Read only

Former Member
0 Likes
1,075

Are you sure you have specified the check as s_kostl-low as Appana suggested above?

It sounds like the system takes the entire value of the select-option, IEQxxxx, instead of only taking the value xxxx, and that is where the check fails.

Please check for s_kostl-low.

Hope this helps.

Sudha

Read only

Former Member
0 Likes
1,076

hi beena ,

1.first u have to get all the Cost centes which comes for the given range in selection scree.

select kokrs kostl from csks into i_kostl where kostl in s_kostl.

2.Then u have to check like this


loop at i_kostl.
AUTHORITY-CHECK OBJECT 'K_CSKS'
ID 'KOKRS' FIELD '*'
ID 'KOSTL' FIELD i_kostl-kostl.
ID 'ACTVT' FIELD '*' .
IF sy-subrc NE 0.
MESSAGE ID 'ZFI' TYPE 'E' NUMBER 34 WITH i_kostl-kostl.
ENDIF.
endloop.

Regards

Prabhu