4:
5: l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
6:
7: APPLICATION_ERROR EXCEPTION;
8: -- Following function accepts FND userId and returns
9: -- User name
10: FUNCTION GET_FND_USER_NAME( userId Integer) RETURN VARCHAR2 IS
11: CURSOR GET_USER_NAME IS
12: SELECT USER_NAME
6:
7: APPLICATION_ERROR EXCEPTION;
8: -- Following function accepts FND userId and returns
9: -- User name
10: FUNCTION GET_FND_USER_NAME( userId Integer) RETURN VARCHAR2 IS
11: CURSOR GET_USER_NAME IS
12: SELECT USER_NAME
13: FROM FND_USER
14: WHERE USER_ID = userId;
9: -- User name
10: FUNCTION GET_FND_USER_NAME( userId Integer) RETURN VARCHAR2 IS
11: CURSOR GET_USER_NAME IS
12: SELECT USER_NAME
13: FROM FND_USER
14: WHERE USER_ID = userId;
15: l_userName FND_USER.USER_NAME%TYPE;
16: BEGIN
17: OPEN GET_USER_NAME;
11: CURSOR GET_USER_NAME IS
12: SELECT USER_NAME
13: FROM FND_USER
14: WHERE USER_ID = userId;
15: l_userName FND_USER.USER_NAME%TYPE;
16: BEGIN
17: OPEN GET_USER_NAME;
18: FETCH GET_USER_NAME INTO l_userName;
19: CLOSE GET_USER_NAME;
17: OPEN GET_USER_NAME;
18: FETCH GET_USER_NAME INTO l_userName;
19: CLOSE GET_USER_NAME;
20: RETURN l_userName;
21: END GET_FND_USER_NAME;
22:
23: /********************************************************************************
24: *** This procedure is associated with GMDQSPAP_ISAPROVAL_REQUIRED workflow. **
25: *** This code will execute when Spec Approval Business Event is raised. **
37: applicationId number :=552;
38: transactionType varchar2(50) := 'oracle.apps.gmd.qm.spec.sts';
39: nextApprover ame_util.approverRecord;
40: l_userID integer;
41: l_userName FND_USER.USER_NAME%TYPE;
42: l_Requester FND_USER.USER_NAME%TYPE;
43: l_Owner FND_USER.USER_NAME%TYPE;
44: lSpecId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_ID');
45: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
38: transactionType varchar2(50) := 'oracle.apps.gmd.qm.spec.sts';
39: nextApprover ame_util.approverRecord;
40: l_userID integer;
41: l_userName FND_USER.USER_NAME%TYPE;
42: l_Requester FND_USER.USER_NAME%TYPE;
43: l_Owner FND_USER.USER_NAME%TYPE;
44: lSpecId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_ID');
45: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
46: lTargetStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TARGET_STATUS');
39: nextApprover ame_util.approverRecord;
40: l_userID integer;
41: l_userName FND_USER.USER_NAME%TYPE;
42: l_Requester FND_USER.USER_NAME%TYPE;
43: l_Owner FND_USER.USER_NAME%TYPE;
44: lSpecId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_ID');
45: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
46: lTargetStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TARGET_STATUS');
47: l_wf_timeout NUMBER := TO_NUMBER(FND_PROFILE.VALUE ('GMD_WF_TIMEOUT'));
228: -- We got the first approver from AME
229: --
230: IF nextApprover.person_id IS NOT NULL THEN
231: --
232: -- if we got HR Person then we have to find corresponding FND USER
233: -- assumption here is all HR user configured in AME will have
234: -- corresponding FND USER
235: --
236: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
230: IF nextApprover.person_id IS NOT NULL THEN
231: --
232: -- if we got HR Person then we have to find corresponding FND USER
233: -- assumption here is all HR user configured in AME will have
234: -- corresponding FND USER
235: --
236: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
237: ELSE
238: l_userID := nextApprover.user_id;
237: ELSE
238: l_userID := nextApprover.user_id;
239: END IF;
240: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'USER_ID',l_userID);
241: l_userName := GET_FND_USER_NAME(l_userId);
242: --
243: -- Update status to pending
244: --
245:
268: IF (l_debug = 'Y') THEN
269: gmd_debug.put_line('Setting up workflow attributes');
270: END IF;
271:
272: l_requester := GET_FND_USER_NAME(disp_attr_rec.LAST_UPDATED_BY);
273: l_owner := GET_FND_USER_NAME(disp_attr_rec.OWNER_ID);
274: lStartStatus_DESC := GMDQSPEC_APPROVAL_WF_PKG.GET_STATUS_MEANING(lStartStatus,'S');
275: lTargetStatus_DESC:= GMDQSPEC_APPROVAL_WF_PKG.GET_STATUS_MEANING(lTargetStatus,'S');
276:
269: gmd_debug.put_line('Setting up workflow attributes');
270: END IF;
271:
272: l_requester := GET_FND_USER_NAME(disp_attr_rec.LAST_UPDATED_BY);
273: l_owner := GET_FND_USER_NAME(disp_attr_rec.OWNER_ID);
274: lStartStatus_DESC := GMDQSPEC_APPROVAL_WF_PKG.GET_STATUS_MEANING(lStartStatus,'S');
275: lTargetStatus_DESC:= GMDQSPEC_APPROVAL_WF_PKG.GET_STATUS_MEANING(lTargetStatus,'S');
276:
277: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'SPEC_NAME',disp_attr_rec.SPEC_NAME);
456: lStartStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'START_STATUS');
457: lTargetStatus Number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'TARGET_STATUS');
458: lSpecId number := wf_engine.getitemattrtext(p_itemtype, p_itemkey,'SPEC_ID');
459: l_userID integer;
460: l_userName FND_USER.USER_NAME%TYPE;
461: api_ret_status VARCHAR2(1);
462: api_err_mesg VARCHAR2(240);
463: BEGIN
464: IF p_funcmode = 'RUN' THEN
496: p_resultout := 'COMPLETE:N';
497: ELSE
498: IF nextApprover.person_id IS NOT NULL THEN
499: --
500: -- if we got HR Person then we have to find corresponding FND USER
501: -- assumption here is all HR user configured in AME will have
502: -- corresponding FND USER
503: --
504: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
498: IF nextApprover.person_id IS NOT NULL THEN
499: --
500: -- if we got HR Person then we have to find corresponding FND USER
501: -- assumption here is all HR user configured in AME will have
502: -- corresponding FND USER
503: --
504: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
505: ELSE
506: l_userID := nextApprover.user_id;
504: l_userID := ame_util.personIdToUserId(nextApprover.person_id);
505: ELSE
506: l_userID := nextApprover.user_id;
507: END IF;
508: l_userName := GET_FND_USER_NAME(l_userId);
509: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'USER_ID',l_userID);
510: wf_engine.setitemattrtext(p_itemtype, p_itemkey,'APPROVER',l_userName);
511: p_resultout := 'COMPLETE:Y';
512: END IF;
613: transactionTypeIn => transactionType,
614: nextApproverOut => nextApprover);
615: IF nextApprover.person_id IS NOT NULL THEN
616: --
617: -- if we got HR Person then we have to find corresponding FND USER
618: -- assumption here is all HR user configured in AME will have
619: -- corresponding FND USER
620: --
621: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
615: IF nextApprover.person_id IS NOT NULL THEN
616: --
617: -- if we got HR Person then we have to find corresponding FND USER
618: -- assumption here is all HR user configured in AME will have
619: -- corresponding FND USER
620: --
621: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
622: ELSE
623: new_user_id := nextApprover.user_id;
679: transactionTypeIn => transactionType,
680: nextApproverOut => nextApprover);
681: IF nextApprover.person_id IS NOT NULL THEN
682: --
683: -- if we got HR Person then we have to find corresponding FND USER
684: -- assumption here is all HR user configured in AME will have
685: -- corresponding FND USER
686: --
687: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
681: IF nextApprover.person_id IS NOT NULL THEN
682: --
683: -- if we got HR Person then we have to find corresponding FND USER
684: -- assumption here is all HR user configured in AME will have
685: -- corresponding FND USER
686: --
687: new_user_id := ame_util.personIdToUserId(nextApprover.person_id);
688: ELSE
689: new_user_id := nextApprover.user_id;