77: ---------------------------------------------------------------------------
78: -- Procedure set_wf_error_context
79: ---------------------------------------------------------------------------
80: /* Proceedure loops through the FND_MSG_PUB stack and sets the
81: workflow error context to give as much information as possible to wf engine
82: in case an api fails
83: */
84: PROCEDURE set_wf_error_context(
85: p_pkg_name IN VARCHAR2,
170: RETURN;
171: /*Bug 6329229*/
172: ELSIF (funcmode = 'SET_CTX') THEN
173:
174: -- wf_seq_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
175:
176:
177: -- Set the database session context
178: fnd_global.apps_initialize(l_user_id,l_resp_id, l_resp_appl_id);
686: -- If workflowprocess is passed, it will be run.
687: -- If workflowprocess is NOT passed, the selector function
688: -- defined in the item type will determine which process to run.
689: --
690: wf_engine.CreateProcess( ItemType => l_ItemType,
691: ItemKey => l_ItemKey,
692: process => l_WorkflowProcess );
693:
694: wf_engine.SetItemUserKey ( ItemType => l_ItemType,
690: wf_engine.CreateProcess( ItemType => l_ItemType,
691: ItemKey => l_ItemKey,
692: process => l_WorkflowProcess );
693:
694: wf_engine.SetItemUserKey ( ItemType => l_ItemType,
695: ItemKey => l_ItemKey,
696: UserKey => l_ItemUserKey);
697: --
698: --
697: --
698: --
699: -- Initialize workflow item attributes
700: --
701: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
702: itemkey => l_itemkey,
703: aname => 'TEMPLATE_NAME',
704: avalue => l_tmpl_rec.template_name);
705: --
702: itemkey => l_itemkey,
703: aname => 'TEMPLATE_NAME',
704: avalue => l_tmpl_rec.template_name);
705: --
706: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
707: itemkey => l_itemkey,
708: aname => 'TEMPLATE_DESCRIPTION',
709: avalue => l_tmpl_rec.description);
710:
707: itemkey => l_itemkey,
708: aname => 'TEMPLATE_DESCRIPTION',
709: avalue => l_tmpl_rec.description);
710:
711: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
712: itemkey => l_itemkey,
713: aname => 'SUBMITTED_BY_USER',
714: avalue => l_ProcessOwner);
715:
712: itemkey => l_itemkey,
713: aname => 'SUBMITTED_BY_USER',
714: avalue => l_ProcessOwner);
715:
716: wf_engine.SetItemAttrNumber ( itemtype => l_itemtype,
717: itemkey => l_itemkey,
718: aname => 'TEMPLATE_ID',
719: avalue => l_tmpl_rec.template_id);
720:
718: aname => 'TEMPLATE_ID',
719: avalue => l_tmpl_rec.template_id);
720:
721:
722: wf_engine.SetItemAttrNumber ( itemtype => l_itemtype,
723: itemkey => l_itemkey,
724: aname => 'PRINT_TEMPLATE_ID',
725: avalue => l_tmpl_rec.print_template_id);
726:
723: itemkey => l_itemkey,
724: aname => 'PRINT_TEMPLATE_ID',
725: avalue => l_tmpl_rec.print_template_id);
726:
727: wf_engine.SetItemAttrNumber ( itemtype => l_itemtype,
728: itemkey => l_itemkey,
729: aname => 'ORG_ID',
730: avalue => l_tmpl_rec.org_id);
731:
728: itemkey => l_itemkey,
729: aname => 'ORG_ID',
730: avalue => l_tmpl_rec.org_id);
731:
732: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
733: itemkey => l_itemkey,
734: aname => 'STATUS_CODE',
735: avalue => l_tmpl_rec.status_code);
736:
733: itemkey => l_itemkey,
734: aname => 'STATUS_CODE',
735: avalue => l_tmpl_rec.status_code);
736:
737: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
738: itemkey => l_itemkey,
739: aname => 'TMPL_INTENT',
740: avalue => okc_util.decode_lookup('OKC_TERMS_INTENT',l_tmpl_rec.intent) );
741:
738: itemkey => l_itemkey,
739: aname => 'TMPL_INTENT',
740: avalue => okc_util.decode_lookup('OKC_TERMS_INTENT',l_tmpl_rec.intent) );
741:
742: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
743: itemkey => l_itemkey,
744: aname => 'TMPL_WORKINGCOPY',
745: avalue => NVL(l_tmpl_rec.working_copy_flag,'N'));
746:
743: itemkey => l_itemkey,
744: aname => 'TMPL_WORKINGCOPY',
745: avalue => NVL(l_tmpl_rec.working_copy_flag,'N'));
746:
747: wf_engine.SetItemAttrNumber ( itemtype => l_itemtype,
748: itemkey => l_itemkey,
749: aname => 'TMPL_WF_SEQ_ID',
750: avalue => l_tmpl_rec.wf_sequence);
751:
752: OPEN org_name_csr(l_tmpl_rec.org_id);
753: FETCH org_name_csr INTO l_org_name;
754: CLOSE org_name_csr;
755:
756: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
757: itemkey => l_itemkey,
758: aname => 'ORG_NAME',
759: avalue => l_org_name);
760:
765: l_attach_key := 'FND:entity=OKC_TERMS_TEMPLATES'||'&pk1name=TEMPLATE_ID&pk1value='||
766: l_tmpl_rec.template_id||'&pk2name=WF_SEQUENCE_ID&pk2value='||l_tmpl_rec.wf_sequence ;
767:
768:
769: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
770: itemkey => l_itemkey,
771: aname => 'TMPL_ATTACHMENT',
772: avalue => l_attach_key);
773:
772: avalue => l_attach_key);
773:
774: --wf_directory.GetRoleDisplayName(RequestorUsername) );
775:
776: wf_engine.SetItemAttrText( itemtype => l_itemtype,
777: itemkey => l_itemkey,
778: aname => 'MONITOR_URL',
779: avalue =>
780: wf_monitor.GetUrl(wf_core.translate('WF_WEB_AGENT')
781: ,l_itemtype,l_itemkey,'NO'));
782:
783: -- set new attribute expert enabled
784: -- TODO call expert function to set l_expert_enabled
785: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
786: itemkey => l_itemkey,
787: aname => 'TMPL_EXPERT_ENABLED',
788: avalue => l_expert_enabled);
789:
786: itemkey => l_itemkey,
787: aname => 'TMPL_EXPERT_ENABLED',
788: avalue => l_expert_enabled);
789:
790: wf_engine.SetItemOwner ( itemtype => l_itemtype,
791: itemkey => l_itemkey,
792: owner => l_ProcessOwner );
793:
794: -- 11.5.10+ changes
804: AND nvl(selected_yn, 'N') = 'N';
805:
806: -- end of 11.5.10+ changes
807: --MLS for templates
808: wf_engine.SetItemAttrText ( itemtype => l_itemtype,
809: itemkey => l_itemkey,
810: aname => 'TEMPLATE_LANGUAGE',
811: avalue => l_tmpl_rec.language_desc);
812:
812:
813:
814: -- need to ensure that call to wf start_process is the last to be called
815: -- becuase once invoked, it stops only if a blocking activity is reached.
816: wf_engine.StartProcess( itemtype => l_itemtype,
817: itemkey => l_itemkey );
818:
819: -- Standard call to get message count and if count is 1, get message info.
820: FND_MSG_PUB.Count_And_Get(p_encoded=>'F', p_count => x_msg_count, p_data => x_msg_data );
925:
926: BEGIN
927: IF ( funcmode = 'RUN' ) THEN
928: l_tmpl_id :=
929: wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
930: l_tmpl_status :=
931: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
932: l_tmpl_wc :=
933: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WORKINGCOPY', false);
927: IF ( funcmode = 'RUN' ) THEN
928: l_tmpl_id :=
929: wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
930: l_tmpl_status :=
931: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
932: l_tmpl_wc :=
933: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WORKINGCOPY', false);
934: l_tmpl_wf_seq_id :=
935: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
929: wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
930: l_tmpl_status :=
931: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
932: l_tmpl_wc :=
933: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WORKINGCOPY', false);
934: l_tmpl_wf_seq_id :=
935: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
936: l_expert_enabled :=
937: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_EXPERT_ENABLED', false);
931: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
932: l_tmpl_wc :=
933: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WORKINGCOPY', false);
934: l_tmpl_wf_seq_id :=
935: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
936: l_expert_enabled :=
937: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_EXPERT_ENABLED', false);
938: x_return_status := 'S';
939:
933: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WORKINGCOPY', false);
934: l_tmpl_wf_seq_id :=
935: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
936: l_expert_enabled :=
937: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_EXPERT_ENABLED', false);
938: x_return_status := 'S';
939:
940:
941: IF (l_expert_enabled = 'Y') THEN
988: x_msg_data => x_msg_data,
989: x_msg_count => x_msg_count,
990: x_parent_template_id => l_parent_template_id);
991:
992: Wf_engine.setItemAttrNumber(
993: itemtype => itemtype,
994: itemkey => itemkey,
995: aname => 'TEMPLATE_ID',
996: avalue => l_parent_template_id);
1113:
1114: IF ( funcmode = 'RUN' ) THEN
1115:
1116: l_tmpl_id :=
1117: wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
1118: l_tmpl_status :=
1119: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
1120: l_tmpl_wf_seq_id :=
1121: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
1115:
1116: l_tmpl_id :=
1117: wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
1118: l_tmpl_status :=
1119: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
1120: l_tmpl_wf_seq_id :=
1121: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
1122: x_return_status := 'S';
1123:
1117: wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
1118: l_tmpl_status :=
1119: wf_engine.getItemAttrText(itemtype, itemkey, 'STATUS_CODE', false);
1120: l_tmpl_wf_seq_id :=
1121: wf_engine.getItemAttrText(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
1122: x_return_status := 'S';
1123:
1124: CHANGE_CLAUSE_STATUS (
1125: p_api_version => 1,
1218: -- RUN mode - normal process execution
1219: --
1220: IF (funcmode = 'RUN') then
1221:
1222: l_template_id := wf_engine.GetItemAttrNumber(
1223: itemtype => itemtype,
1224: itemkey => itemkey,
1225: aname => 'TEMPLATE_ID' );
1226:
1230:
1231: --l_approver := 'CONMGR';
1232:
1233: IF l_approver IS NOT NULL THEN
1234: wf_engine.SetItemAttrText (itemtype => itemtype,
1235: itemkey => itemkey,
1236: aname => 'APPROVER_USERNAME',
1237: avalue => l_approver);
1238:
1288: IF (funcmode = 'RUN') then
1289:
1290:
1291: -- checking wether the item attribute was already set.
1292: l_tmpl_attach_exists := wf_engine.GetItemAttrNumber(
1293: itemtype => itemtype,
1294: itemkey => itemkey,
1295: aname => 'TMPL_ATTACH_EXISTS' );
1296:
1304:
1305: -- first time ,if item attribute was not set, execute the query
1306: else
1307:
1308: l_template_id := wf_engine.GetItemAttrNumber(
1309: itemtype => itemtype,
1310: itemkey => itemkey,
1311: aname => 'TEMPLATE_ID' );
1312:
1309: itemtype => itemtype,
1310: itemkey => itemkey,
1311: aname => 'TEMPLATE_ID' );
1312:
1313: l_wf_seq_id := wf_engine.GetItemAttrNumber(
1314: itemtype => itemtype,
1315: itemkey => itemkey,
1316: aname => 'TMPL_WF_SEQ_ID' );
1317:
1320:
1321:
1322: IF attachment_exists_csr%FOUND THEN
1323: resultout := 'COMPLETE:T';
1324: wf_engine.setItemAttrText(itemtype, itemkey, 'TMPL_ATTACH_EXISTS', 'Y');
1325: ELSE
1326: resultout := 'COMPLETE:F';
1327: wf_engine.setItemAttrText(itemtype, itemkey, 'TMPL_ATTACH_EXISTS', 'N');
1328: END IF;
1323: resultout := 'COMPLETE:T';
1324: wf_engine.setItemAttrText(itemtype, itemkey, 'TMPL_ATTACH_EXISTS', 'Y');
1325: ELSE
1326: resultout := 'COMPLETE:F';
1327: wf_engine.setItemAttrText(itemtype, itemkey, 'TMPL_ATTACH_EXISTS', 'N');
1328: END IF;
1329: CLOSE attachment_exists_csr;
1330:
1331: end if;
1371:
1372: -- RUN mode - normal process execution
1373: IF (funcmode = 'RUN') then
1374:
1375: l_template_id := wf_engine.GetItemAttrNumber(
1376: itemtype => itemtype,
1377: itemkey => itemkey,
1378: aname => 'TEMPLATE_ID' );
1379:
1744: adoption_type_lst adoption_type_tbl;
1745: organization_id_lst organization_id_tbl;
1746: org_information3_lst org_information3_tbl;
1747:
1748: operation Wf_Engine.NameTabTyp;
1749: operation_list Wf_Engine.TextTabTyp;
1750: organization Wf_Engine.NameTabTyp;
1751: organization_list Wf_Engine.NumTabTyp;
1752: notified Wf_Engine.NameTabTyp;
1745: organization_id_lst organization_id_tbl;
1746: org_information3_lst org_information3_tbl;
1747:
1748: operation Wf_Engine.NameTabTyp;
1749: operation_list Wf_Engine.TextTabTyp;
1750: organization Wf_Engine.NameTabTyp;
1751: organization_list Wf_Engine.NumTabTyp;
1752: notified Wf_Engine.NameTabTyp;
1753: notified_list Wf_Engine.TextTabTyp;
1746: org_information3_lst org_information3_tbl;
1747:
1748: operation Wf_Engine.NameTabTyp;
1749: operation_list Wf_Engine.TextTabTyp;
1750: organization Wf_Engine.NameTabTyp;
1751: organization_list Wf_Engine.NumTabTyp;
1752: notified Wf_Engine.NameTabTyp;
1753: notified_list Wf_Engine.TextTabTyp;
1754: global_org_id NUMBER := NVL(FND_PROFILE.VALUE('OKC_GLOBAL_ORG_ID'),-99);
1747:
1748: operation Wf_Engine.NameTabTyp;
1749: operation_list Wf_Engine.TextTabTyp;
1750: organization Wf_Engine.NameTabTyp;
1751: organization_list Wf_Engine.NumTabTyp;
1752: notified Wf_Engine.NameTabTyp;
1753: notified_list Wf_Engine.TextTabTyp;
1754: global_org_id NUMBER := NVL(FND_PROFILE.VALUE('OKC_GLOBAL_ORG_ID'),-99);
1755: counter NUMBER;
1748: operation Wf_Engine.NameTabTyp;
1749: operation_list Wf_Engine.TextTabTyp;
1750: organization Wf_Engine.NameTabTyp;
1751: organization_list Wf_Engine.NumTabTyp;
1752: notified Wf_Engine.NameTabTyp;
1753: notified_list Wf_Engine.TextTabTyp;
1754: global_org_id NUMBER := NVL(FND_PROFILE.VALUE('OKC_GLOBAL_ORG_ID'),-99);
1755: counter NUMBER;
1756:
1749: operation_list Wf_Engine.TextTabTyp;
1750: organization Wf_Engine.NameTabTyp;
1751: organization_list Wf_Engine.NumTabTyp;
1752: notified Wf_Engine.NameTabTyp;
1753: notified_list Wf_Engine.TextTabTyp;
1754: global_org_id NUMBER := NVL(FND_PROFILE.VALUE('OKC_GLOBAL_ORG_ID'),-99);
1755: counter NUMBER;
1756:
1757: BEGIN
1755: counter NUMBER;
1756:
1757: BEGIN
1758: counter := 0;
1759: template_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
1760: l_tmpl_intent := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TMPL_INTENT', false);
1761:
1762: IF ( funcmode = 'RUN' ) THEN
1763: OPEN notified_csr(l_tmpl_intent , global_org_id);
1756:
1757: BEGIN
1758: counter := 0;
1759: template_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
1760: l_tmpl_intent := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TMPL_INTENT', false);
1761:
1762: IF ( funcmode = 'RUN' ) THEN
1763: OPEN notified_csr(l_tmpl_intent , global_org_id);
1764: FETCH notified_csr BULK COLLECT INTO adoption_type_lst,organization_id_lst,org_information3_lst;
1774: notified(counter):= 'NOTIFIED_LIST$'||counter;
1775: notified_list(counter):= org_information3_lst(i);
1776: END LOOP;
1777:
1778: wf_engine.AddItemAttrTextArray( itemtype, itemkey, operation, operation_list);
1779: wf_engine.AddItemAttrNumberArray( itemtype, itemkey, organization, organization_list);
1780: wf_engine.AddItemAttrTextArray( itemtype, itemkey, notified, notified_list);
1781: wf_engine.AddItemAttr(itemtype, itemkey, 'COUNTER$', null, counter, null);
1782: resultout := 'COMPLETE';
1775: notified_list(counter):= org_information3_lst(i);
1776: END LOOP;
1777:
1778: wf_engine.AddItemAttrTextArray( itemtype, itemkey, operation, operation_list);
1779: wf_engine.AddItemAttrNumberArray( itemtype, itemkey, organization, organization_list);
1780: wf_engine.AddItemAttrTextArray( itemtype, itemkey, notified, notified_list);
1781: wf_engine.AddItemAttr(itemtype, itemkey, 'COUNTER$', null, counter, null);
1782: resultout := 'COMPLETE';
1783:
1776: END LOOP;
1777:
1778: wf_engine.AddItemAttrTextArray( itemtype, itemkey, operation, operation_list);
1779: wf_engine.AddItemAttrNumberArray( itemtype, itemkey, organization, organization_list);
1780: wf_engine.AddItemAttrTextArray( itemtype, itemkey, notified, notified_list);
1781: wf_engine.AddItemAttr(itemtype, itemkey, 'COUNTER$', null, counter, null);
1782: resultout := 'COMPLETE';
1783:
1784: RETURN;
1777:
1778: wf_engine.AddItemAttrTextArray( itemtype, itemkey, operation, operation_list);
1779: wf_engine.AddItemAttrNumberArray( itemtype, itemkey, organization, organization_list);
1780: wf_engine.AddItemAttrTextArray( itemtype, itemkey, notified, notified_list);
1781: wf_engine.AddItemAttr(itemtype, itemkey, 'COUNTER$', null, counter, null);
1782: resultout := 'COMPLETE';
1783:
1784: RETURN;
1785: END IF;
1848: OPEN wf_admin_csr;
1849: FETCH wf_admin_csr INTO wf_admin_user;
1850: CLOSE wf_admin_csr;
1851:
1852: counter := wf_engine.getItemAttrNumber(itemtype, itemkey, 'COUNTER$', false);
1853: IF counter > 0 THEN
1854: operation := wf_engine.getItemAttrText(itemtype, itemkey, 'OPERATION_LIST$'||counter, false);
1855: organization := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORGANIZATION_LIST$'||counter, false);
1856: notified := wf_engine.getItemAttrText(itemtype, itemkey, 'NOTIFIED_LIST$'||counter, false);
1850: CLOSE wf_admin_csr;
1851:
1852: counter := wf_engine.getItemAttrNumber(itemtype, itemkey, 'COUNTER$', false);
1853: IF counter > 0 THEN
1854: operation := wf_engine.getItemAttrText(itemtype, itemkey, 'OPERATION_LIST$'||counter, false);
1855: organization := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORGANIZATION_LIST$'||counter, false);
1856: notified := wf_engine.getItemAttrText(itemtype, itemkey, 'NOTIFIED_LIST$'||counter, false);
1857:
1858: OPEN org_name_csr(organization);
1851:
1852: counter := wf_engine.getItemAttrNumber(itemtype, itemkey, 'COUNTER$', false);
1853: IF counter > 0 THEN
1854: operation := wf_engine.getItemAttrText(itemtype, itemkey, 'OPERATION_LIST$'||counter, false);
1855: organization := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORGANIZATION_LIST$'||counter, false);
1856: notified := wf_engine.getItemAttrText(itemtype, itemkey, 'NOTIFIED_LIST$'||counter, false);
1857:
1858: OPEN org_name_csr(organization);
1859: FETCH org_name_csr INTO org_name;
1852: counter := wf_engine.getItemAttrNumber(itemtype, itemkey, 'COUNTER$', false);
1853: IF counter > 0 THEN
1854: operation := wf_engine.getItemAttrText(itemtype, itemkey, 'OPERATION_LIST$'||counter, false);
1855: organization := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORGANIZATION_LIST$'||counter, false);
1856: notified := wf_engine.getItemAttrText(itemtype, itemkey, 'NOTIFIED_LIST$'||counter, false);
1857:
1858: OPEN org_name_csr(organization);
1859: FETCH org_name_csr INTO org_name;
1860: CLOSE org_name_csr;
1870: if (adoption_type_desc is null ) then
1871: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1872: end if ;
1873:
1874: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_DESC', adoption_type_desc);
1875: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_TYPE', operation);
1876: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_NAME', org_name);
1877: wf_engine.setItemAttrNumber(itemtype, itemkey, 'LOCAL_ORG_ID', organization);
1878:
1871: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1872: end if ;
1873:
1874: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_DESC', adoption_type_desc);
1875: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_TYPE', operation);
1876: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_NAME', org_name);
1877: wf_engine.setItemAttrNumber(itemtype, itemkey, 'LOCAL_ORG_ID', organization);
1878:
1879: IF notified IS NOT NULL THEN
1872: end if ;
1873:
1874: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_DESC', adoption_type_desc);
1875: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_TYPE', operation);
1876: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_NAME', org_name);
1877: wf_engine.setItemAttrNumber(itemtype, itemkey, 'LOCAL_ORG_ID', organization);
1878:
1879: IF notified IS NOT NULL THEN
1880: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_APPROVER', notified);
1873:
1874: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_DESC', adoption_type_desc);
1875: wf_engine.setItemAttrText(itemtype, itemkey, 'ADOPTION_TYPE', operation);
1876: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_NAME', org_name);
1877: wf_engine.setItemAttrNumber(itemtype, itemkey, 'LOCAL_ORG_ID', organization);
1878:
1879: IF notified IS NOT NULL THEN
1880: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_APPROVER', notified);
1881: ELSE
1876: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_NAME', org_name);
1877: wf_engine.setItemAttrNumber(itemtype, itemkey, 'LOCAL_ORG_ID', organization);
1878:
1879: IF notified IS NOT NULL THEN
1880: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_APPROVER', notified);
1881: ELSE
1882: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_APPROVER', wf_admin_user);
1883: END IF;
1884:
1878:
1879: IF notified IS NOT NULL THEN
1880: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_APPROVER', notified);
1881: ELSE
1882: wf_engine.setItemAttrText(itemtype, itemkey, 'LOCAL_ORG_APPROVER', wf_admin_user);
1883: END IF;
1884:
1885: resultout := 'COMPLETE:'||operation;
1886: ELSE
1927: counter number;
1928:
1929: BEGIN
1930: IF (funcmode = 'RUN') THEN
1931: counter := wf_engine.getItemAttrNumber(itemtype, itemkey, 'COUNTER$', false) - 1;
1932: IF counter > 0 THEN
1933: wf_engine.setItemAttrNumber(itemtype, itemkey, 'COUNTER$', counter);
1934: resultout := 'COMPLETE:T';
1935: ELSE
1929: BEGIN
1930: IF (funcmode = 'RUN') THEN
1931: counter := wf_engine.getItemAttrNumber(itemtype, itemkey, 'COUNTER$', false) - 1;
1932: IF counter > 0 THEN
1933: wf_engine.setItemAttrNumber(itemtype, itemkey, 'COUNTER$', counter);
1934: resultout := 'COMPLETE:T';
1935: ELSE
1936: resultout := 'COMPLETE:F';
1937: END IF;
2011:
2012: BEGIN
2013: IF (funcmode = 'RUN') THEN
2014: resultout := 'COMPLETE:F';
2015: current_org_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORG_ID', false);
2016: template_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
2017: wf_seq_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
2018:
2019: IF (current_org_id = GLOBAL_ORG_ID ) THEN
2012: BEGIN
2013: IF (funcmode = 'RUN') THEN
2014: resultout := 'COMPLETE:F';
2015: current_org_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORG_ID', false);
2016: template_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
2017: wf_seq_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
2018:
2019: IF (current_org_id = GLOBAL_ORG_ID ) THEN
2020:
2013: IF (funcmode = 'RUN') THEN
2014: resultout := 'COMPLETE:F';
2015: current_org_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'ORG_ID', false);
2016: template_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TEMPLATE_ID', false);
2017: wf_seq_id := wf_engine.getItemAttrNumber(itemtype, itemkey, 'TMPL_WF_SEQ_ID', false);
2018:
2019: IF (current_org_id = GLOBAL_ORG_ID ) THEN
2020:
2021: OPEN global_articles_csr(template_id,wf_seq_id);