97: gItemKey := itemKey;
98: gPlanID := PlanID;
99:
100: -- Create WF Automate process instance
101: wf_engine.CreateProcess(ItemType => ItemType,
102: itemKey => ItemKey,
103: process => ProcessName);
104:
105: -- setup attributes for Master Automation process
102: itemKey => ItemKey,
103: process => ProcessName);
104:
105: -- setup attributes for Master Automation process
106: wf_engine.SetItemAttrText(Itemtype => ItemType,
107: Itemkey => ItemKey,
108: aname => 'CODEDB',
109: avalue => codeDBName);
110:
107: Itemkey => ItemKey,
108: aname => 'CODEDB',
109: avalue => codeDBName);
110:
111: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
112: Itemkey => ItemKey,
113: aname => 'USER_ID',
114: avalue => userID);
115: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
111: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
112: Itemkey => ItemKey,
113: aname => 'USER_ID',
114: avalue => userID);
115: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
116: Itemkey => ItemKey,
117: aname => 'RESP_ID',
118: avalue => respID);
119: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
115: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
116: Itemkey => ItemKey,
117: aname => 'RESP_ID',
118: avalue => respID);
119: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
120: Itemkey => ItemKey,
121: aname => 'RESP_APPL_ID',
122: avalue => respApplID);
123:
121: aname => 'RESP_APPL_ID',
122: avalue => respApplID);
123:
124: -- This should be the demand planning administrator.
125: wf_engine.SetItemOwner(ItemType => ItemType,
126: ItemKey => ItemKey,
127: owner => owner);
128: -- Sets new attribute Is OPD Master running.
129: wf_engine.SetItemAttrText(Itemtype => ItemType,
125: wf_engine.SetItemOwner(ItemType => ItemType,
126: ItemKey => ItemKey,
127: owner => owner);
128: -- Sets new attribute Is OPD Master running.
129: wf_engine.SetItemAttrText(Itemtype => ItemType,
130: Itemkey => ItemKey,
131: aname => 'ISMASTER',
132: avalue => 'Y');
133: wf_engine.SetItemAttrText(Itemtype => ItemType,
129: wf_engine.SetItemAttrText(Itemtype => ItemType,
130: Itemkey => ItemKey,
131: aname => 'ISMASTER',
132: avalue => 'Y');
133: wf_engine.SetItemAttrText(Itemtype => ItemType,
134: Itemkey => ItemKey,
135: aname => 'DPADMIN',
136: avalue => owner);
137: wf_engine.SetItemAttrText(Itemtype => ItemType,
133: wf_engine.SetItemAttrText(Itemtype => ItemType,
134: Itemkey => ItemKey,
135: aname => 'DPADMIN',
136: avalue => owner);
137: wf_engine.SetItemAttrText(Itemtype => ItemType,
138: Itemkey => ItemKey,
139: aname => 'ODPROLE',
140: avalue => owner);
141: -- Plan ID!
138: Itemkey => ItemKey,
139: aname => 'ODPROLE',
140: avalue => owner);
141: -- Plan ID!
142: wf_engine.SetItemAttrText(Itemtype => ItemType,
143: Itemkey => ItemKey,
144: aname => 'ODPPLAN',
145: avalue => PlanID);
146: wf_engine.SetItemAttrText(Itemtype => ItemType,
142: wf_engine.SetItemAttrText(Itemtype => ItemType,
143: Itemkey => ItemKey,
144: aname => 'ODPPLAN',
145: avalue => PlanID);
146: wf_engine.SetItemAttrText(Itemtype => ItemType,
147: Itemkey => ItemKey,
148: aname => 'PLNAME',
149: avalue => PlanName);
150: wf_engine.SetItemAttrText(Itemtype => ItemType,
146: wf_engine.SetItemAttrText(Itemtype => ItemType,
147: Itemkey => ItemKey,
148: aname => 'PLNAME',
149: avalue => PlanName);
150: wf_engine.SetItemAttrText(Itemtype => ItemType,
151: Itemkey => ItemKey,
152: aname => 'CODELOC',
153: avalue => CodeLoc);
154: wf_engine.SetItemAttrText(Itemtype => ItemType,
150: wf_engine.SetItemAttrText(Itemtype => ItemType,
151: Itemkey => ItemKey,
152: aname => 'CODELOC',
153: avalue => CodeLoc);
154: wf_engine.SetItemAttrText(Itemtype => ItemType,
155: Itemkey => ItemKey,
156: aname => 'DBNAME',
157: avalue => DBName);
158: wf_engine.SetItemAttrText(Itemtype => ItemType,
154: wf_engine.SetItemAttrText(Itemtype => ItemType,
155: Itemkey => ItemKey,
156: aname => 'DBNAME',
157: avalue => DBName);
158: wf_engine.SetItemAttrText(Itemtype => ItemType,
159: Itemkey => ItemKey,
160: aname => 'SHAREDLOC',
161: avalue => SharedLoc);
162: wf_engine.SetItemAttrText(Itemtype => ItemType,
158: wf_engine.SetItemAttrText(Itemtype => ItemType,
159: Itemkey => ItemKey,
160: aname => 'SHAREDLOC',
161: avalue => SharedLoc);
162: wf_engine.SetItemAttrText(Itemtype => ItemType,
163: Itemkey => ItemKey,
164: aname => 'EXPCONN',
165: avalue => express_server);
166: -- set NumDays to collect
163: Itemkey => ItemKey,
164: aname => 'EXPCONN',
165: avalue => express_server);
166: -- set NumDays to collect
167: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
168: Itemkey => ItemKey,
169: aname => 'NUMDAYS',
170: avalue => NumDaysToCol);
171: -- set DelayDays to Upload
168: Itemkey => ItemKey,
169: aname => 'NUMDAYS',
170: avalue => NumDaysToCol);
171: -- set DelayDays to Upload
172: wf_engine.SetItemAttrNumber(Itemtype => ItemType,
173: Itemkey => ItemKey,
174: aname => 'DELAYDAYS',
175: avalue => DelayDaysToUpld);
176:
231: Days_delayUpld => NumDays_to_delayUpld,
232: ProcessName => workflowProcess);
233:
234: -- set attributes for SOP process
235: wf_engine.SetItemAttrNumber(Itemtype => gItemType,
236: Itemkey => gItemKey,
237: aname => 'DELAYDAYSDIST',
238: avalue => to_number(NumDays_to_delayDist)
239: );
237: aname => 'DELAYDAYSDIST',
238: avalue => to_number(NumDays_to_delayDist)
239: );
240:
241: wf_engine.SetItemAttrNumber(Itemtype => gItemType,
242: Itemkey => gItemKey,
243: aname => 'LAUNCHSNPSHT',
244: avalue => 3);
245:
242: Itemkey => gItemKey,
243: aname => 'LAUNCHSNPSHT',
244: avalue => 3);
245:
246: wf_engine.SetItemAttrNumber(Itemtype => gItemType,
247: Itemkey => gItemKey,
248: aname => 'LAUNCHPLANNER',
249: avalue => 1);
250:
247: Itemkey => gItemKey,
248: aname => 'LAUNCHPLANNER',
249: avalue => 1);
250:
251: wf_engine.SetItemAttrText(Itemtype => gItemType,
252: Itemkey => gItemKey,
253: aname => 'MASTER_TYPE',
254: avalue => 'SOP');
255:
252: Itemkey => gItemKey,
253: aname => 'MASTER_TYPE',
254: avalue => 'SOP');
255:
256: wf_engine.SetItemAttrText(Itemtype => gItemType,
257: Itemkey => gItemKey,
258: aname => 'SHOW_LOG_TITLE',
259: avalue => 'Y');
260: commit;
274: errbuf:=substr(sqlerrm, 1, 255);
275:
276: if instr(upper(SQLERRM), 'EXPRESS') > 0 or instr(upper(SQLERRM), 'SNAPI') > 0
277: then
278: wf_engine.SetItemAttrText(Itemtype => gItemType,
279: Itemkey => gItemKey,
280: aname => 'DPPROBLEM',
281: avalue => substr(SQLERRM, 1, 200));
282:
286:
287: end;
288:
289: -- Now when all is created and set, start the process!
290: wf_engine.StartProcess(ItemType => gItemType,
291: ItemKey => gItemKey);
292: commit;
293:
294: -- Start background engine for this process.
359: resultout :='COMPLETE:N';
360: end if;
361:
362: -- get attribute values
363: launch_snapshot := nvl(wf_engine.GetItemAttrNumber(
364: Itemtype => ItemType,
365: Itemkey => ItemKey,
366: aname => 'LAUNCHSNPSHT'),3);
367:
364: Itemtype => ItemType,
365: Itemkey => ItemKey,
366: aname => 'LAUNCHSNPSHT'),3);
367:
368: launch_planner := nvl(wf_engine.GetItemAttrNumber(
369: Itemtype => ItemType,
370: Itemkey => ItemKey,
371: aname => 'LAUNCHPLANNER'),1);
372:
369: Itemtype => ItemType,
370: Itemkey => ItemKey,
371: aname => 'LAUNCHPLANNER'),1);
372:
373: planID := wf_engine.GetItemAttrText(
374: Itemtype => ItemType,
375: Itemkey => ItemKey,
376: aname => 'ODPPLAN');
377: