2012年5月2日 星期三

How to use & get user login's exe file to implement new module(Gui)

 IF  test_api.get_user_program__ > 0 Then doing new module.....
------------------------------------------

FUNCTION Get_User_Program__
RETURN NUMBER
IS


program_ VARCHAR2(48);
-- machine_ VARCHAR2(64);


CURSOR p_cursor_ IS
SELECT program
FROM fnd_session_runtime
WHERE SID = (select sid from v$session
where audsid = sys_context('USERENV', 'SESSIONID') ) ;


BEGIN


OPEN p_cursor_;
FETCH p_cursor_ INTO program_;


IF (p_cursor_%FOUND) THEN
CLOSE p_cursor_;


  IF instr( upper(program_) ,'GUI')  > 0  then
     RETURN(1);
 Else
    RETURN(0);
 END if;


ELSE
CLOSE p_cursor_;
RETURN(0);


END IF;
END Get_User_Program__;
-------------------------------------------