This function module gets the authorisation value for a User and authorisation object on any given date.
/*
FUNCTION z_check_authorization.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(UNAME) TYPE SYUNAME DEFAULT SY-UNAME
*" VALUE(OBJECT) TYPE XUOBJECT
*" VALUE(FIELD) TYPE XUFIELD OPTIONAL
*" VALUE(DATE) TYPE DATS DEFAULT SY-DATUM
*" TABLES
*" AUTHTAB STRUCTURE ZHR_AUTHOBJECT
*"----------------------------------------------------------------------
*-------------------------------------------*
* Data Declaration
*-------------------------------------------*
DATA: BEGIN OF authobj,
begda TYPE begda,
endda TYPE endda,
agr_name TYPE agr_name,
auth TYPE auth,
END OF authobj.
DATA: l_field TYPE xufield.
* Internal tables.
DATA:
itab_agr_users TYPE STANDARD TABLE OF agr_users WITH HEADER LINE,
itab_agr_1250 TYPE STANDARD TABLE OF agr_1250 WITH HEADER LINE,
itab_ust12 TYPE STANDARD TABLE OF ust12 WITH HEADER LINE.
*-------------------------------------------*
* Processing Logic
*-------------------------------------------*
REFRESH authtab. CLEAR authtab.
REFRESH itab_agr_users. CLEAR itab_agr_users.
REFRESH itab_agr_1250. CLEAR itab_agr_1250.
REFRESH itab_ust12. CLEAR itab_ust12.
SELECT * FROM agr_users INTO TABLE itab_agr_users
WHERE uname EQ uname
AND from_dat LE date
AND to_dat GT date.
LOOP AT itab_agr_users.
SELECT * FROM agr_1250
APPENDING CORRESPONDING FIELDS OF TABLE itab_agr_1250
WHERE agr_name = itab_agr_users-agr_name.
ENDLOOP.
LOOP AT itab_agr_1250.
IF field is initial.
SELECT * FROM ust12
APPENDING CORRESPONDING FIELDS OF TABLE itab_ust12
WHERE objct = object
AND auth = itab_agr_1250-auth
AND aktps = 'A'.
ELSE.
SELECT * FROM ust12
APPENDING CORRESPONDING FIELDS OF TABLE itab_ust12
WHERE objct = object
AND auth = itab_agr_1250-auth
AND aktps = 'A'
and field = field.
endif. ENDLOOP. LOOP AT itab_ust12.
authtab-seqnr = sy-tabix.
authtab-field = itab_ust12-field.
authtab-fieldval = itab_ust12-von.
APPEND authtab.
ENDLOOP.
delete adjacent duplicates from authtab comparing field.
Welcome To My BLOG
This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me
Please vote for my Blog. And please input me on this mail addrssess.Email me
Share this link with your friends
http://www.rebtel.com/u/15163104576
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment