5: l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
6:
7:
8: APPLICATION_ERROR EXCEPTION;
9: -- Following function accepts FND userId and returns
10: -- User name
11: FUNCTION GET_FND_USER_NAME( userId Integer) RETURN VARCHAR2 IS
12: CURSOR GET_USER_NAME IS
13: SELECT USER_NAME
7:
8: APPLICATION_ERROR EXCEPTION;
9: -- Following function accepts FND userId and returns
10: -- User name
11: FUNCTION GET_FND_USER_NAME( userId Integer) RETURN VARCHAR2 IS
12: CURSOR GET_USER_NAME IS
13: SELECT USER_NAME
14: FROM FND_USER
15: WHERE USER_ID = userId;
10: -- User name
11: FUNCTION GET_FND_USER_NAME( userId Integer) RETURN VARCHAR2 IS
12: CURSOR GET_USER_NAME IS
13: SELECT USER_NAME
14: FROM FND_USER
15: WHERE USER_ID = userId;
16: l_userName FND_USER.USER_NAME%TYPE;
17: BEGIN
18: OPEN GET_USER_NAME;
12: CURSOR GET_USER_NAME IS
13: SELECT USER_NAME
14: FROM FND_USER
15: WHERE USER_ID = userId;
16: l_userName FND_USER.USER_NAME%TYPE;
17: BEGIN
18: OPEN GET_USER_NAME;
19: FETCH GET_USER_NAME INTO l_userName;
20: CLOSE GET_USER_NAME;
18: OPEN GET_USER_NAME;
19: FETCH GET_USER_NAME INTO l_userName;
20: CLOSE GET_USER_NAME;
21: RETURN l_userName;
22: END GET_FND_USER_NAME;
23:
24: /********************************************************************************
25: *** This procedure is associated with GMDQSVRS_ISAPROVAL_REQUIRED workflow. **
26: *** This code will execute when Spec Validity Rule Approval Business Event **
39: transactionType varchar2(50) := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'EVENT_NAME');
40: l_TABLE_NAME varchar2(50) := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TABLE_NAME');
41: nextApprover ame_util.approverRecord;
42: l_userID integer;
43: l_userName FND_USER.USER_NAME%TYPE;
44: l_Requester FND_USER.USER_NAME%TYPE;
45: l_Owner FND_USER.USER_NAME%TYPE;
46: lSpecVRId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_VR_ID');
47: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
40: l_TABLE_NAME varchar2(50) := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TABLE_NAME');
41: nextApprover ame_util.approverRecord;
42: l_userID integer;
43: l_userName FND_USER.USER_NAME%TYPE;
44: l_Requester FND_USER.USER_NAME%TYPE;
45: l_Owner FND_USER.USER_NAME%TYPE;
46: lSpecVRId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_VR_ID');
47: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
48: lTargetStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TARGET_STATUS');
41: nextApprover ame_util.approverRecord;
42: l_userID integer;
43: l_userName FND_USER.USER_NAME%TYPE;
44: l_Requester FND_USER.USER_NAME%TYPE;
45: l_Owner FND_USER.USER_NAME%TYPE;
46: lSpecVRId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_VR_ID');
47: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
48: lTargetStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TARGET_STATUS');
49: l_wf_timeout NUMBER := TO_NUMBER(FND_PROFILE.VALUE ('GMD_WF_TIMEOUT'));
414: END IF;
415:
416: IF nextApprover.person_id IS NOT NULL THEN
417: --
418: -- if we got HR Person then we have to find corresponding FND USER
419: -- assumption here is all HR user configured in AME will have
420: -- corresponding FND USER
421: --
422: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
416: IF nextApprover.person_id IS NOT NULL THEN
417: --
418: -- if we got HR Person then we have to find corresponding FND USER
419: -- assumption here is all HR user configured in AME will have
420: -- corresponding FND USER
421: --
422: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
423: ELSE
424: l_userID := nextApprover.user_id;
423: ELSE
424: l_userID := nextApprover.user_id;
425: END IF;
426: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'USER_ID',l_userID);
427: l_userName := GET_FND_USER_NAME(l_userId);
428:
429: --
430: -- Update status to pending
431: --
457: WF_CORE.CONTEXT ('GMDQSPEC_APPROVAL_WF_PKG','is_approval_req',p_itemtype,p_itemkey,FND_MESSAGE.GET_STRING('GMD','GMD_QC_INVALID_SPEC_VR_ID for Monitoring'));
458: raise APPLICATION_ERROR;
459: END IF;
460:
461: l_requester := GET_FND_USER_NAME(mont_disp_attr_rec.LAST_UPDATED_BY);
462: close get_mont_disp_Attr;
463: else
464: /* This is an item spec VR */
465: open get_disp_Attr;
468: WF_CORE.CONTEXT ('GMDQSPEC_APPROVAL_WF_PKG','is_approval_req',p_itemtype,p_itemkey,FND_MESSAGE.GET_STRING('GMD','GMD_QC_INVALID_SPEC_VR_ID'));
469: raise APPLICATION_ERROR;
470: END IF;
471:
472: l_requester := GET_FND_USER_NAME(disp_attr_rec.LAST_UPDATED_BY);
473: close get_disp_Attr;
474: end if;
475:
476:
740: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
741: lTargetStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TARGET_STATUS');
742: lSpecVRId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_VR_ID');
743: l_userID integer;
744: l_userName FND_USER.USER_NAME%TYPE;
745: api_ret_status VARCHAR2(1);
746: api_err_mesg VARCHAR2(240);
747: BEGIN
748: IF p_funcmode = 'RUN' THEN
785:
786:
787: IF nextApprover.person_id IS NOT NULL THEN
788: --
789: -- if we got HR Person then we have to find corresponding FND USER
790: -- assumption here is all HR user configured in AME will have
791: -- corresponding FND USER
792: --
793: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
787: IF nextApprover.person_id IS NOT NULL THEN
788: --
789: -- if we got HR Person then we have to find corresponding FND USER
790: -- assumption here is all HR user configured in AME will have
791: -- corresponding FND USER
792: --
793: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
794: ELSE
795: l_userID := nextApprover.user_id;
794: ELSE
795: l_userID := nextApprover.user_id;
796: END IF;
797:
798: l_userName := GET_FND_USER_NAME(l_userId);
799: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'USER_ID',l_userID);
800: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'APPROVER',l_userName);
801: p_resultout := 'COMPLETE:Y';
802: END IF;
904: transactionTypeIn => transactionType,
905: nextApproverOut => nextApprover);
906: IF nextApprover.person_id IS NOT NULL THEN
907: --
908: -- if we got HR Person then we have to find corresponding FND USER
909: -- assumption here is all HR user configured in AME will have
910: -- corresponding FND USER
911: --
912: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
906: IF nextApprover.person_id IS NOT NULL THEN
907: --
908: -- if we got HR Person then we have to find corresponding FND USER
909: -- assumption here is all HR user configured in AME will have
910: -- corresponding FND USER
911: --
912: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
913: ELSE
914: new_user_id := nextApprover.user_id;
970: transactionTypeIn => transactionType,
971: nextApproverOut => nextApprover);
972: IF nextApprover.person_id IS NOT NULL THEN
973: --
974: -- if we got HR Person then we have to find corresponding FND USER
975: -- assumption here is all HR user configured in AME will have
976: -- corresponding FND USER
977: --
978: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
972: IF nextApprover.person_id IS NOT NULL THEN
973: --
974: -- if we got HR Person then we have to find corresponding FND USER
975: -- assumption here is all HR user configured in AME will have
976: -- corresponding FND USER
977: --
978: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
979: ELSE
980: new_user_id := nextApprover.user_id;