20:
21: BEGIN
22:
23: FND_GLOBAL.apps_initialize
24: ( WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'USER_ID' )
25: , WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'RESP_ID' )
26: , WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'RESP_APPL_ID' )
27: );
28:
21: BEGIN
22:
23: FND_GLOBAL.apps_initialize
24: ( WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'USER_ID' )
25: , WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'RESP_ID' )
26: , WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'RESP_APPL_ID' )
27: );
28:
29: END Apps_Initialize;
22:
23: FND_GLOBAL.apps_initialize
24: ( WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'USER_ID' )
25: , WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'RESP_ID' )
26: , WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'RESP_APPL_ID' )
27: );
28:
29: END Apps_Initialize;
30:
170: BEGIN
171:
172: IF ( FuncMode = 'RUN' ) THEN
173:
174: Requestor := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'REQUESTOR' );
175:
176: OPEN c ( to_number( ItemKey ) );
177: FETCH c INTO crec;
178: CLOSE c;
176: OPEN c ( to_number( ItemKey ) );
177: FETCH c INTO crec;
178: CLOSE c;
179:
180: WF_ENGINE.SetItemAttrText( itemtype => ItemType
181: , itemkey => ItemKey
182: , aname => 'TRANSFER_ID'
183: , avalue => ItemKey );
184:
181: , itemkey => ItemKey
182: , aname => 'TRANSFER_ID'
183: , avalue => ItemKey );
184:
185: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
186: , itemkey => ItemKey
187: , aname => 'ORGANIZATION_ID'
188: , avalue => crec.organization_id );
189:
186: , itemkey => ItemKey
187: , aname => 'ORGANIZATION_ID'
188: , avalue => crec.organization_id );
189:
190: WF_ENGINE.SetItemAttrText( itemtype => ItemType
191: , itemkey => ItemKey
192: , aname => 'ORGANIZATION_CODE'
193: , avalue => crec.organization_code );
194:
191: , itemkey => ItemKey
192: , aname => 'ORGANIZATION_CODE'
193: , avalue => crec.organization_code );
194:
195: WF_ENGINE.SetItemAttrText( itemtype => ItemType
196: , itemkey => ItemKey
197: , aname => 'ORGANIZATION_NAME'
198: , avalue => crec.organization_name );
199:
196: , itemkey => ItemKey
197: , aname => 'ORGANIZATION_NAME'
198: , avalue => crec.organization_name );
199:
200: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
201: , itemkey => ItemKey
202: , aname => 'FROM_PROJECT_ID'
203: , avalue => crec.from_project_id );
204:
201: , itemkey => ItemKey
202: , aname => 'FROM_PROJECT_ID'
203: , avalue => crec.from_project_id );
204:
205: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
206: , itemkey => ItemKey
207: , aname => 'TO_PROJECT_ID'
208: , avalue => crec.to_project_id );
209:
206: , itemkey => ItemKey
207: , aname => 'TO_PROJECT_ID'
208: , avalue => crec.to_project_id );
209:
210: WF_ENGINE.SetItemAttrDate( itemtype => ItemType
211: , itemkey => ItemKey
212: , aname => 'TRANSFER_DATE'
213: , avalue => crec.transfer_date );
214:
211: , itemkey => ItemKey
212: , aname => 'TRANSFER_DATE'
213: , avalue => crec.transfer_date );
214:
215: WF_ENGINE.SetItemAttrText( itemtype => ItemType
216: , itemkey => ItemKey
217: , aname => 'TRANSFER_MODE'
218: , avalue => crec.transfer_mode );
219:
216: , itemkey => ItemKey
217: , aname => 'TRANSFER_MODE'
218: , avalue => crec.transfer_mode );
219:
220: WF_ENGINE.SetItemAttrText( itemtype => ItemType
221: , itemkey => ItemKey
222: , aname => 'TRANSFER_REASON'
223: , avalue => crec.transfer_reason );
224:
221: , itemkey => ItemKey
222: , aname => 'TRANSFER_REASON'
223: , avalue => crec.transfer_reason );
224:
225: WF_ENGINE.SetItemAttrText( itemtype => ItemType
226: , itemkey => ItemKey
227: , aname => 'REFERENCE'
228: , avalue => crec.transfer_reference );
229:
226: , itemkey => ItemKey
227: , aname => 'REFERENCE'
228: , avalue => crec.transfer_reference );
229:
230: WF_ENGINE.SetItemAttrText( itemtype => ItemType
231: , itemkey => ItemKey
232: , aname => 'DETAILS'
233: , avalue => 'PLSQL:PJM_MASS_TRANSFER_WF.TRANSFER_DETAILS/'
234: || ItemType || ':' || ItemKey );
241: CLOSE p;
242:
243: ProjMgr := Find_Proj_Mgr( crec.from_project_id , Requestor );
244:
245: WF_ENGINE.SetItemAttrText( itemtype => ItemType
246: , itemkey => ItemKey
247: , aname => 'FROM_PROJECT_NUM'
248: , avalue => prec.project_num );
249:
246: , itemkey => ItemKey
247: , aname => 'FROM_PROJECT_NUM'
248: , avalue => prec.project_num );
249:
250: WF_ENGINE.SetItemAttrText( itemtype => ItemType
251: , itemkey => ItemKey
252: , aname => 'FROM_PROJECT_NAME'
253: , avalue => prec.project_name );
254:
251: , itemkey => ItemKey
252: , aname => 'FROM_PROJECT_NAME'
253: , avalue => prec.project_name );
254:
255: WF_ENGINE.SetItemAttrText( itemtype => ItemType
256: , itemkey => ItemKey
257: , aname => 'FROM_PROJECT_DESC'
258: , avalue => prec.project_desc );
259:
256: , itemkey => ItemKey
257: , aname => 'FROM_PROJECT_DESC'
258: , avalue => prec.project_desc );
259:
260: WF_ENGINE.SetItemAttrText( itemtype => ItemType
261: , itemkey => ItemKey
262: , aname => 'FROM_PROJECT_MGR'
263: , avalue => ProjMgr );
264:
272: CLOSE p;
273:
274: ProjMgr := Find_Proj_Mgr( crec.to_project_id , Requestor );
275:
276: WF_ENGINE.SetItemAttrText( itemtype => ItemType
277: , itemkey => ItemKey
278: , aname => 'TO_PROJECT_NUM'
279: , avalue => prec.project_num );
280:
277: , itemkey => ItemKey
278: , aname => 'TO_PROJECT_NUM'
279: , avalue => prec.project_num );
280:
281: WF_ENGINE.SetItemAttrText( itemtype => ItemType
282: , itemkey => ItemKey
283: , aname => 'TO_PROJECT_NAME'
284: , avalue => prec.project_name );
285:
282: , itemkey => ItemKey
283: , aname => 'TO_PROJECT_NAME'
284: , avalue => prec.project_name );
285:
286: WF_ENGINE.SetItemAttrText( itemtype => ItemType
287: , itemkey => ItemKey
288: , aname => 'TO_PROJECT_DESC'
289: , avalue => prec.project_desc );
290:
287: , itemkey => ItemKey
288: , aname => 'TO_PROJECT_DESC'
289: , avalue => prec.project_desc );
290:
291: WF_ENGINE.SetItemAttrText( itemtype => ItemType
292: , itemkey => ItemKey
293: , aname => 'TO_PROJECT_MGR'
294: , avalue => ProjMgr );
295:
304: OPEN ic ( crec.transfer_mode , crec.organization_id , crec.inventory_item_id , crec.category_id );
305: FETCH ic INTO icrec;
306: CLOSE ic;
307:
308: WF_ENGINE.SetItemAttrText( itemtype => ItemType
309: , itemkey => ItemKey
310: , aname => 'ITEMCAT'
311: , avalue => icrec.concatenated_segments );
312:
309: , itemkey => ItemKey
310: , aname => 'ITEMCAT'
311: , avalue => icrec.concatenated_segments );
312:
313: WF_ENGINE.SetItemAttrText( itemtype => ItemType
314: , itemkey => ItemKey
315: , aname => 'ITEMCAT_DESC'
316: , avalue => icrec.description );
317:
338:
339: EXCEPTION
340: WHEN OTHERS THEN
341: ResultOut := 'ERROR';
342: WF_ENGINE.SetItemAttrText
343: ( ItemType => ItemType , ItemKey => ItemKey , AName => 'ERRORTEXT' , AValue => sqlerrm );
344: WF_CORE.Context( 'PJM_MASS_TRANSFER_WF'
345: , 'INITIALIZE'
346: , ItemType , ItemKey , to_char(ActID) , FuncMode , ResultOut );
380: IF ( FuncMode = 'RUN' ) THEN
381:
382: ResultOut := 'COMPLETE:Y';
383:
384: Requestor := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'REQUESTOR' );
385:
386: --
387: -- Approval not required if From Project is a Seiban
388: --
385:
386: --
387: -- Approval not required if From Project is a Seiban
388: --
389: ProjectID := WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'FROM_PROJECT_ID' );
390: IF ( Is_Project_Seiban( ProjectID ) = 'Y' ) THEN
391: ResultOut := 'COMPLETE:N';
392: RETURN;
393: END IF;
394:
395: --
396: -- Approval not required if Requestor is also the From Project Manager
397: --
398: ProjMgr := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'FROM_PROJECT_MGR' );
399: IF ( Requestor = ProjMgr ) THEN
400: ResultOut := 'COMPLETE:N';
401: RETURN;
402: END IF;
421:
422: EXCEPTION
423: WHEN OTHERS THEN
424: ResultOut := 'ERROR';
425: WF_ENGINE.SetItemAttrText
426: ( ItemType => ItemType , ItemKey => ItemKey , AName => 'ERRORTEXT' , AValue => sqlerrm );
427: WF_CORE.Context( 'PJM_MASS_TRANSFER_WF'
428: , 'APPROVAL_REQUIRED_F'
429: , ItemType , ItemKey , to_char(ActID) , FuncMode , ResultOut );
464: IF ( FuncMode = 'RUN' ) THEN
465:
466: ResultOut := 'COMPLETE:Y';
467:
468: Requestor := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'REQUESTOR' );
469:
470: ProjectID := WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'TO_PROJECT_ID' );
471: --
472: -- Transfer to Common does not require approval
466: ResultOut := 'COMPLETE:Y';
467:
468: Requestor := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'REQUESTOR' );
469:
470: ProjectID := WF_ENGINE.GetItemAttrNumber( ItemType , ItemKey , 'TO_PROJECT_ID' );
471: --
472: -- Transfer to Common does not require approval
473: --
474: IF ( ProjectID IS NULL ) THEN
486:
487: --
488: -- Approval not required if Requestor is also the To Project Manager
489: --
490: ProjMgr := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'TO_PROJECT_MGR' );
491: IF ( Requestor = ProjMgr ) THEN
492: ResultOut := 'COMPLETE:N';
493: RETURN;
494: END IF;
496: --
497: -- Approval not required to To Project Manager is the same as From Project Manager
498: -- Approval will be obtained from the "From Project" side only
499: --
500: FProjMgr := WF_ENGINE.GetItemAttrText( ItemType , ItemKey , 'FROM_PROJECT_MGR' );
501: IF ( ProjMgr = FProjMgr ) THEN
502: ResultOut := 'COMPLETE:N';
503: RETURN;
504: END IF;
523:
524: EXCEPTION
525: WHEN OTHERS THEN
526: ResultOut := 'ERROR';
527: WF_ENGINE.SetItemAttrText
528: ( ItemType => ItemType , ItemKey => ItemKey , AName => 'ERRORTEXT' , AValue => sqlerrm );
529: WF_CORE.Context( 'PJM_MASS_TRANSFER_WF'
530: , 'APPROVAL_REQUIRED_T'
531: , ItemType , ItemKey , to_char(ActID) , FuncMode , ResultOut );
582: , X_Txn_Count => Txn_Count
583: , X_Request_ID => Request_ID
584: );
585:
586: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
587: , itemkey => ItemKey
588: , aname => 'CONC_REQUEST_ID'
589: , avalue => Request_ID );
590:
587: , itemkey => ItemKey
588: , aname => 'CONC_REQUEST_ID'
589: , avalue => Request_ID );
590:
591: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
592: , itemkey => ItemKey
593: , aname => 'TXN_HEADER_ID'
594: , avalue => Txn_Header_ID );
595:
592: , itemkey => ItemKey
593: , aname => 'TXN_HEADER_ID'
594: , avalue => Txn_Header_ID );
595:
596: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
597: , itemkey => ItemKey
598: , aname => 'TXN_COUNT'
599: , avalue => Txn_Count );
600:
619:
620: EXCEPTION
621: WHEN OTHERS THEN
622: ResultOut := 'COMPLETE:N';
623: WF_ENGINE.SetItemAttrText
624: ( ItemType => ItemType , ItemKey => ItemKey , AName => 'ERRORTEXT' , AValue => sqlerrm );
625: WF_CORE.Context( 'PJM_MASS_TRANSFER_WF'
626: , 'EXECUTE'
627: , ItemType , ItemKey , to_char(ActID) , FuncMode , ResultOut );
806: ) IS
807:
808: BEGIN
809:
810: WF_ENGINE.CreateProcess( itemtype => ItemType
811: , process => Process
812: , itemkey => ItemKey );
813:
814: WF_ENGINE.SetItemUserKey( itemtype => ItemType
810: WF_ENGINE.CreateProcess( itemtype => ItemType
811: , process => Process
812: , itemkey => ItemKey );
813:
814: WF_ENGINE.SetItemUserKey( itemtype => ItemType
815: , itemkey => ItemKey
816: , userkey => ItemKey );
817:
818: WF_ENGINE.SetItemOwner( itemtype => ItemType
814: WF_ENGINE.SetItemUserKey( itemtype => ItemType
815: , itemkey => ItemKey
816: , userkey => ItemKey );
817:
818: WF_ENGINE.SetItemOwner( itemtype => ItemType
819: , itemkey => ItemKey
820: , owner => FND_GLOBAL.User_Name );
821:
822: WF_ENGINE.SetItemAttrText( itemtype => ItemType
818: WF_ENGINE.SetItemOwner( itemtype => ItemType
819: , itemkey => ItemKey
820: , owner => FND_GLOBAL.User_Name );
821:
822: WF_ENGINE.SetItemAttrText( itemtype => ItemType
823: , itemkey => ItemKey
824: , aname => 'REQUESTOR'
825: , avalue => FND_GLOBAL.User_Name );
826:
823: , itemkey => ItemKey
824: , aname => 'REQUESTOR'
825: , avalue => FND_GLOBAL.User_Name );
826:
827: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
828: , itemkey => ItemKey
829: , aname => 'USER_ID'
830: , avalue => FND_GLOBAL.User_ID );
831:
828: , itemkey => ItemKey
829: , aname => 'USER_ID'
830: , avalue => FND_GLOBAL.User_ID );
831:
832: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
833: , itemkey => ItemKey
834: , aname => 'RESP_APPL_ID'
835: , avalue => FND_GLOBAL.Resp_Appl_ID );
836:
833: , itemkey => ItemKey
834: , aname => 'RESP_APPL_ID'
835: , avalue => FND_GLOBAL.Resp_Appl_ID );
836:
837: WF_ENGINE.SetItemAttrNumber( itemtype => ItemType
838: , itemkey => ItemKey
839: , aname => 'RESP_ID'
840: , avalue => FND_GLOBAL.Resp_ID );
841:
838: , itemkey => ItemKey
839: , aname => 'RESP_ID'
840: , avalue => FND_GLOBAL.Resp_ID );
841:
842: WF_ENGINE.StartProcess( itemtype => ItemType
843: , itemkey => ItemKey );
844:
845: EXCEPTION
846: WHEN OTHERS THEN