‎2008 Feb 25 9:14 AM
Hi,
1) I want to query the psacl_tab database table with following conditions:
a) AUTH_USER = sy-uname
b) AUTH_USER_GRP = the user groups of the current user logged in
( say it is in internal table it_usrgrp - 3 entries )
c) AUTH_ORG = the current user's org units
( say it is also in internal table it_org - 2 entries ).
How can I write the query for the above one?
2) Also, suggest how can I get the current user's AUTH_ORG.
Thanks & Regards,
SAP Lover
‎2008 Feb 25 9:28 AM
Hi,
Take One "i_temp" internal table which is having both 'it_usrgrp' and
"it_org" fields.Means
LOOP AT it_usrgrp.
READ TABLE it_org WITH KEY commn fields = it_usrgrp-key
field.
IF sy-subrc EQ 0.
MOVE both internal table fields to i_temp.
APPEND i_temp.
ENDIF.
ENDLOOP.
SELECT required fields
INTO TABLE i_psacl_tab
FROM psacl_tab
FOR ALL ENTRIES IN i_temp
WHERE AUTH_USER = sy-uname AND
AUTH_USER_GRP = i_temp-AUTH_USER_GRP AND
AUTH_ORG = i_temp-AUTH_ORG.
2. READ TABLE i_temp with key AUTH_USER = sy-uname.
i_temp-AUTH_ORG will have the current user's AUTH_ORG.