12-04-2007 11:08 AM
Hi,
My requirement is as such that a ZFB03 transaction should take me to Autual FB03 for Authorized users.A simple call transaction 'FB03' in the program of transaction ZFB03,doesn't do standard Authorization checks of the FB03.Is there any way to perform Standard Authorization Checks in this Z program?
12-04-2007 11:11 AM
Sure. Debug, or look at the code of FB03, and see what authorisation checks it makes. Then put these into your code.
You should also check S_TCODE for FB03 access.
( I'm assuming you know how to use AUTHORITY-CHECK ).
matt
12-04-2007 11:22 AM
Hi ,
Try the following code.
*************************AUHTORITY CHECK IMPLEMENTED************************
INITIALIZATION.
AUTHORITY-CHECK OBJECT 'ZAOBJECT'
ID 'TCODE' FIELD 'ZTCODE'
ID 'ACTVT' FIELD '16'.
IF sy-subrc NE 0.
MESSAGE 'NO authorisation found' TYPE 'E' .
ENDIF.
*************************AUHTORITY CHECK IMPLEMENTED ***********************
Before add this part in your code cretaed authority object'ZAOBJECT'
Where add the activity field 16.
Regards
Debjani
12-04-2007 12:16 PM
Hi,
Will this FM 'AUTHORITY_CHECK_TCODE' will be helpful before
Call Transaction 'FB03'.
12-04-2007 12:21 PM
Yes. In fact it is advised. From the documenation of the function module.
<i>This function module checks all authorizations as at the start of a transaction, that is, the authorization object S_TCODE and authorization objects that were stored when defining the transaction using SE93. It should be called before a CALL TRANSACTION....</i>
matt
12-04-2007 12:24 PM
Hi,
try like this
FORM sub_check_auth_iwerk .
--Constant for t code, no tcode hence value = '' (all)
CONSTANTS: lc_tcd LIKE tstc-tcode VALUE '*'.
*--Table for all the plants in selection screen. This
table will be used for authority check.
DATA: BEGIN OF li_plant OCCURS 0,
iwerk LIKE t001w-werks,
END OF li_plant.
*--Select query to pick plant from table t001w
SELECT werks "Plant
INTO TABLE li_plant
FROM t001w
WHERE werks IN s_iwerk.
LOOP AT li_plant.
AUTHORITY-CHECK OBJECT 'I_SWERK'
ID 'TCD' FIELD lc_tcd
ID 'SWERK' FIELD li_plant-iwerk.
*--Check SUBRC
IF sy-subrc NE 0.
*--No Authorization for Plant
MESSAGE e016 WITH li_plant-iwerk.
ENDIF.
ENDLOOP. "loop at li_plant
ENDFORM. "sub_check_auth_iwerk
Regards,
prashant