Authorization Object
Hi All,
I need a help about authorization objects
Iam not aware on this at all.
I have to carry authorization objects for
F_BKPF_BUK ( For Company Code )
Iam taking the company code from selection screen.
ex : s_companycode
Now , my problem is how to write the code in my program.
authority-check object 'F_BKPF_BUK'
id 'BUKRS' field '__________'
id 'ACTVT' field '__________'.
'ACTVT' for F_BKPF_BUK has 01(Create or generate) , 02 (Change), 03(Display) , 06(Delete) , 07 (Activate, generate),08(Display change documents) and 77(Pre-enter).
What should I pass for 'BUKRS' and 'ACTVT'.
And where should I put this code in my program?
Should I place this in Initialization event?
Which number among the permitted activities should I use in the code?
Kindly help out as I am using the authorization object for the first time?
Hello
Here is the code you have to write :
start-of-selection.
*For each company you've selected (via a loop at s_companycode if no *interval can be filled)
loop at s_companycode
authority-check object 'F_BKPF_BUK'
id 'BUKRS' field s_companycode-low
id 'ACTVT' field '??'.
if sy-subrc <> 0.
message e001.
endif.
endloop.
For the number in ACTVT, it depends on your needs and your program. For example, if your program allow to modify data, put '02'.
Hope it helps !!
_________________
Have a nice day!
Benoît