lunes, 6 de octubre de 2014

Query de accesos a organizaciones de Inventarios

El siguiente query obtiene los acceso de organizaciones e Inventarios en base a las respoanbildiades que tiene cada usuario.

SELECT fuser.USER_NAME USER_NAME,
       per.FULL_NAME FULL_NAME,
       frt.RESPONSIBILITY_NAME RESPONSIBILITY,
       OODF.ORGANIZATION_code,
       OODF.ORGANIZATION_NAME

  FROM apps.FND_USER                     fuser,
       apps.PER_PEOPLE_F                 per,
       apps.FND_USER_RESP_GROUPS         furg,
       apps.FND_RESPONSIBILITY_TL        frt,
       apps.ORG_ACCESS                   OACC,
       APPS.ORG_ORGANIZATION_DEFINITIONS OODF

 WHERE FUSER.EMPLOYEE_ID = PER.PERSON_ID
   AND FUSER.USER_ID = FURG.USER_ID
   AND (TO_CHAR(FUSER.END_DATE) IS NULL OR FUSER.END_DATE > SYSDATE)
   AND FRT.RESPONSIBILITY_ID = FURG.RESPONSIBILITY_ID
   AND (TO_CHAR(FURG.END_DATE) IS NULL OR FURG.END_DATE > SYSDATE)
   AND OACC.RESPONSIBILITY_ID = FRT.RESPONSIBILITY_ID
   AND OODF.ORGANIZATION_ID = OACC.ORGANIZATION_ID
   AND OODF.DISABLE_DATE IS NULL
   AND FUSER.USER_NAME = '&USER_NAME'
 ORDER BY FUSER.USER_NAME

No hay comentarios:

Publicar un comentario