03-30-2016 2:10 PM
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
03-30-2016 2:18 PM
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
03-30-2016 2:48 PM
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).
03-30-2016 2:53 PM
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