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

Restrict User to Company Code

venkateswaran_k
Active Contributor
0 Likes
1,880

Dear All

I have some requirement viz.

1. Restrict one company code data from other company users.

2. There are some common  code (user exits) that should be executed for certain  company code only.

So based on user id logged in is there any way to get the company code.

Your guidance will help me a lot.

PS:  We have HCM system in place.  But I need a solution without depending upon the HCM system.

Regards,

Venkat

Dear All

I have some requirement viz.

1. Restrict one company code data from other company users.

2. There are some common  code (user exits) that should be executed for certain  company code only.

So based on user id logged in is there any way to get the company code.

Your guidance will help me a lot.

PS:  We have HCM system in place.  But I need a solution without depending upon the HCM system.

Regards,

Venkat

3 REPLIES 3
Read only

rajkumarnarasimman
Active Contributor
0 Likes
1,178

Hi Venkat,

Filter BADI/enhancement won't available in all the case. Can you try the Authority-check statement for company code condition statement like below inside enhancement/exit.


CONSTANTS: C_BUK1 LIKE REGUP-BUKRS VALUE '1234',

                       C_BUK2 LIKE REGUP-BUKRS VALUE '2345',

"First company code

AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'

ID 'ACTVT' FIELD '03'

ID 'BUKRS' FIELD C_BUK1.

IF SY-SUBRC = 0.

<STATEMENTS>

ENDIF.

"Second company code

AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'

ID 'ACTVT' FIELD '03'

ID 'BUKRS' FIELD C_BUK2.

IF SY-SUBRC = 0.

<STATEMENTS>

ENDIF.

Note: Assign the authorization object and authorization field correctly.

Regards

Rajkumar Narasimman

Read only

Former Member
0 Likes
1,178

The usual way is to use authority checks to restrict users. I hope you have a field where the company code is contained. Depending on your module you can use the authority object mentioned by or create your own.

The filter functionality of kernal BADIs works very well for those requirements to execute different coding for a different value (in your case company code). If your used user exits havn't those filter you could simply use the factory pattern (the filter functionality works the same way).

Read only

0 Likes
1,178

Hi

Thank  you for the reply.  Actually I need for the following case specifically..

I have an user exit return in MV45AFZZ - upon saving event.

This user exit validation should be executed only for one company and for other company it should not.

So, I was planning to modify the user exit based on company code from where the user logged in.

Kindly advice

Regards,

Venkat