1: PACKAGE BODY AHL_FMP_MR_APPROVAL_PVT AS
2: /* $Header: AHLVMWKB.pls 115.15 2004/01/13 23:18:01 rtadikon noship $ */
3: --G_DEBUG VARCHAR2(1):=FND_PROFILE.VALUE('AHL_API_FILE_DEBUG_ON');
4: G_DEBUG VARCHAR2(1) := AHL_DEBUG_PUB.is_log_enabled;
5:
6:
7: PROCEDURE Set_Activity_Details(
8: itemtype IN VARCHAR2
36: where mr_header_id=c_mr_header_id;
37: l_mr_rec GetMrHeaderDet%rowtype;
38: BEGIN
39: IF G_DEBUG='Y' THEN
40: AHL_DEBUG_PUB.enable_debug;
41: AHL_DEBUG_PUB.debug( 'Start Set Actvity Details');
42: END IF;
43:
44: fnd_msg_pub.initialize;
37: l_mr_rec GetMrHeaderDet%rowtype;
38: BEGIN
39: IF G_DEBUG='Y' THEN
40: AHL_DEBUG_PUB.enable_debug;
41: AHL_DEBUG_PUB.debug( 'Start Set Actvity Details');
42: END IF;
43:
44: fnd_msg_pub.initialize;
45: l_return_status := fnd_api.g_ret_sts_success;
191: ------------------------------------------------------------------------------
192: -- Get Approval Rule and First Approver Sequence
193: ------------------------------------------------------------------------------
194: IF G_DEBUG='Y' THEN
195: AHL_DEBUG_PUB.debug( 'Set Activity l_approval_RULE_ID-->'||l_approval_rule_id);
196: END IF;
197:
198: ahl_generic_aprv_pvt.get_approval_details(
199: p_object => l_object,
205: );
206:
207:
208: IF G_DEBUG='Y' THEN
209: AHL_DEBUG_PUB.debug('Get approval details-->'||l_APPROVAL_RULE_ID);
210: END IF;
211:
212: IF l_return_status = fnd_api.g_ret_sts_success THEN
213:
255: RETURN;
256: END IF;
257: --
258: IF G_DEBUG='Y' THEN
259: AHL_DEBUG_PUB.disable_debug;
260: END IF;
261:
262: EXCEPTION
263: WHEN fnd_api.G_EXC_ERROR THEN
284: l_error_msg);
285:
286: resultout := 'COMPLETE:ERROR';
287: IF G_DEBUG='Y' THEN
288: AHL_DEBUG_PUB.disable_debug;
289: END IF;
290:
291: WHEN OTHERS THEN
292: wf_core.context(
297: ,actid
298: ,'Unexpected Error!'
299: );
300: IF G_DEBUG='Y' THEN
301: AHL_DEBUG_PUB.disable_debug;
302: END IF;
303: RAISE;
304:
305: END Set_Activity_Details;
336: where mr_header_id=c_mr_header_id;
337: l_mr_header_rec GetMrHeaderDet%rowtype;
338: BEGIN
339: IF G_DEBUG='Y' THEN
340: AHL_DEBUG_PUB.enable_debug;
341: AHL_DEBUG_PUB.debug( 'Start Notify Forward');
342: END IF;
343:
344: -- Debug info.
337: l_mr_header_rec GetMrHeaderDet%rowtype;
338: BEGIN
339: IF G_DEBUG='Y' THEN
340: AHL_DEBUG_PUB.enable_debug;
341: AHL_DEBUG_PUB.debug( 'Start Notify Forward');
342: END IF;
343:
344: -- Debug info.
345: document_type := 'text/plain';
399: l_subject:= fnd_message.get||'-'||l_body;
400: document := document || l_body;
401:
402: IF G_DEBUG='Y' THEN
403: AHL_DEBUG_PUB.disable_debug;
404: END IF;
405: RETURN;
406:
407: EXCEPTION
421: ) ;
422: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','NTF_FORWARD_FYI',
423: l_item_type,l_item_key,l_error_msg);
424: IF G_DEBUG='Y' THEN
425: AHL_DEBUG_PUB.disable_debug;
426: END IF;
427: RAISE;
428: WHEN OTHERS THEN
429: wf_core.context( 'AHLGAPP'
431: , l_item_type
432: , l_item_key
433: );
434: IF G_DEBUG='Y' THEN
435: AHL_DEBUG_PUB.disable_debug;
436: END IF;
437: RAISE;
438: END Ntf_Forward_FYI;
439:
465: l_mr_header_rec GetMrHeaderDet%rowtype;
466:
467: BEGIN
468: IF G_DEBUG='Y' THEN
469: AHL_DEBUG_PUB.enable_debug;
470: AHL_DEBUG_PUB.debug( 'Start Notify Approved FYI');
471: END IF;
472: document_type := 'text/plain';
473:
466:
467: BEGIN
468: IF G_DEBUG='Y' THEN
469: AHL_DEBUG_PUB.enable_debug;
470: AHL_DEBUG_PUB.debug( 'Start Notify Approved FYI');
471: END IF;
472: document_type := 'text/plain';
473:
474: l_hyphen_pos1 := INSTR(document_id, ':');
520: l_body :=l_body||'.'||fnd_message.get;
521: l_subject :=l_body||fnd_message.get;
522: document := document || l_body;
523: IF G_DEBUG='Y' THEN
524: AHL_DEBUG_PUB.disable_debug;
525: END IF;
526:
527: RETURN;
528:
543: ) ;
544: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','Ntf_Approved_FYI',
545: l_item_type,l_item_key,l_error_msg);
546: IF G_DEBUG='Y' THEN
547: AHL_DEBUG_PUB.disable_debug;
548: END IF;
549: RAISE;
550: WHEN OTHERS THEN
551: wf_core.context( 'AHLGAPP'
553: , l_item_type
554: , l_item_key
555: );
556: IF G_DEBUG='Y' THEN
557: AHL_DEBUG_PUB.disable_debug;
558: END IF;
559: RAISE;
560: END Ntf_Approved_FYI;
561:
585: l_mr_header_rec GetMrHeaderDet%rowtype;
586:
587: BEGIN
588: IF G_DEBUG='Y' THEN
589: AHL_DEBUG_PUB.enable_debug;
590: AHL_DEBUG_PUB.debug( 'Start NTF Final approval');
591: END IF;
592:
593: document_type := 'text/plain';
586:
587: BEGIN
588: IF G_DEBUG='Y' THEN
589: AHL_DEBUG_PUB.enable_debug;
590: AHL_DEBUG_PUB.debug( 'Start NTF Final approval');
591: END IF;
592:
593: document_type := 'text/plain';
594:
645: l_body :=l_body||'.'|| fnd_message.get;
646:
647: document := document || l_body;
648: IF G_DEBUG='Y' THEN
649: AHL_DEBUG_PUB.disable_debug;
650: END IF;
651:
652: RETURN;
653:
668: ) ;
669: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','Ntf_Final_Approval_FYI',
670: l_item_type,l_item_key,l_error_msg);
671: IF G_DEBUG='Y' THEN
672: AHL_DEBUG_PUB.disable_debug;
673: END IF;
674: RAISE;
675: WHEN OTHERS THEN
676: wf_core.context( 'AHLGAPP'
678: , l_item_type
679: , l_item_key
680: );
681: IF G_DEBUG='Y' THEN
682: AHL_DEBUG_PUB.disable_debug;
683: END IF;
684: RAISE;
685: END Ntf_Final_Approval_FYI;
686:
709: where mr_header_id=c_mr_header_id;
710: l_mr_header_rec GetMrHeaderDet%rowtype;
711: BEGIN
712: IF G_DEBUG='Y' THEN
713: AHL_DEBUG_PUB.enable_debug;
714: AHL_DEBUG_PUB.debug( 'Start Notify Rejected');
715: END IF;
716: document_type := 'text/plain';
717:
710: l_mr_header_rec GetMrHeaderDet%rowtype;
711: BEGIN
712: IF G_DEBUG='Y' THEN
713: AHL_DEBUG_PUB.enable_debug;
714: AHL_DEBUG_PUB.debug( 'Start Notify Rejected');
715: END IF;
716: document_type := 'text/plain';
717:
718: -- parse document_id for the ':' dividing item type name from item key value
768: l_subject:= l_body||fnd_message.get;
769:
770: document := document || l_body;
771: IF G_DEBUG='Y' THEN
772: AHL_DEBUG_PUB.disable_debug;
773: END IF;
774: RETURN;
775:
776: EXCEPTION
790: ) ;
791: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','Ntf_Rejected_FYI',
792: l_item_type,l_item_key,l_error_msg);
793: IF G_DEBUG='Y' THEN
794: AHL_DEBUG_PUB.disable_debug;
795: END IF;
796: RAISE;
797:
798: WHEN OTHERS THEN
801: , l_item_type
802: , l_item_key
803: );
804: IF G_DEBUG='Y' THEN
805: AHL_DEBUG_PUB.disable_debug;
806: END IF;
807: RAISE;
808: END Ntf_Rejected_FYI;
809:
835: l_mr_header_rec GetMrHeaderDet%rowtype;
836: BEGIN
837:
838: IF G_DEBUG='Y' THEN
839: AHL_DEBUG_PUB.enable_debug;
840: AHL_DEBUG_PUB.debug( 'Start Nty_approval');
841: END IF;
842:
843: document_type := 'text/plain';
836: BEGIN
837:
838: IF G_DEBUG='Y' THEN
839: AHL_DEBUG_PUB.enable_debug;
840: AHL_DEBUG_PUB.debug( 'Start Nty_approval');
841: END IF;
842:
843: document_type := 'text/plain';
844:
896: l_body :=l_body||fnd_message.get;
897: document := document || l_body;
898:
899: IF G_DEBUG='Y' THEN
900: AHL_DEBUG_PUB.disable_debug;
901: END IF;
902: RETURN;
903: EXCEPTION
904: WHEN FND_API.G_EXC_ERROR THEN
917: ) ;
918: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','Ntf_Approval',
919: l_item_type,l_item_key,l_error_msg);
920: IF G_DEBUG='Y' THEN
921: AHL_DEBUG_PUB.disable_debug;
922: END IF;
923: RAISE;
924: WHEN OTHERS THEN
925: wf_core.context( 'AHLGAPP'
927: , l_item_type
928: , l_item_key
929: );
930: IF G_DEBUG='Y' THEN
931: AHL_DEBUG_PUB.disable_debug;
932: END IF;
933: RAISE;
934: END Ntf_Approval;
935:
960: where mr_header_id=c_mr_header_id;
961: l_mr_header_rec GetMrHeaderDet%rowtype;
962: BEGIN
963: IF G_DEBUG='Y' THEN
964: AHL_DEBUG_PUB.enable_debug;
965: AHL_DEBUG_PUB.debug( 'Start ntfy Apprvl remainder');
966: END IF;
967: document_type := 'text/plain';
968:
961: l_mr_header_rec GetMrHeaderDet%rowtype;
962: BEGIN
963: IF G_DEBUG='Y' THEN
964: AHL_DEBUG_PUB.enable_debug;
965: AHL_DEBUG_PUB.debug( 'Start ntfy Apprvl remainder');
966: END IF;
967: document_type := 'text/plain';
968:
969: l_hyphen_pos1 := INSTR(document_id, ':');
1016: --l_body :=l_body||'.'|| 'Reminder: You just received a request from '||l_requester;
1017: --l_body := l_body ||'. The note from him/her is as following: '||l_requester_note;
1018: document := document || l_body;
1019: IF G_DEBUG='Y' THEN
1020: AHL_DEBUG_PUB.disable_debug;
1021: END IF;
1022:
1023: RETURN;
1024:
1039: ) ;
1040: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','Ntf_Approval_Reminder',
1041: l_item_type,l_item_key,l_error_msg);
1042: IF G_DEBUG='Y' THEN
1043: AHL_DEBUG_PUB.disable_debug;
1044: END IF;
1045: RAISE;
1046: WHEN OTHERS THEN
1047: wf_core.context( 'AHLGAPP'
1049: , l_item_type
1050: , l_item_key
1051: );
1052: IF G_DEBUG='Y' THEN
1053: AHL_DEBUG_PUB.disable_debug;
1054: END IF;
1055: RAISE;
1056: END Ntf_Approval_Reminder;
1057:
1082: where mr_header_id=c_mr_header_id;
1083: l_mr_header_rec GetMrHeaderDet%rowtype;
1084: BEGIN
1085: IF G_DEBUG='Y' THEN
1086: AHL_DEBUG_PUB.enable_debug;
1087: AHL_DEBUG_PUB.debug( 'Start Ntfy error','+NOTIFY ERROR ACT+');
1088: END IF;
1089:
1090:
1083: l_mr_header_rec GetMrHeaderDet%rowtype;
1084: BEGIN
1085: IF G_DEBUG='Y' THEN
1086: AHL_DEBUG_PUB.enable_debug;
1087: AHL_DEBUG_PUB.debug( 'Start Ntfy error','+NOTIFY ERROR ACT+');
1088: END IF;
1089:
1090:
1091: document_type := 'text/plain';
1137: l_body := l_body || 'Error Message'||l_error_msg;
1138:
1139: document := document || l_body;
1140: IF G_DEBUG='Y' THEN
1141: AHL_DEBUG_PUB.disable_debug;
1142: END IF;
1143:
1144: RETURN;
1145:
1160: ) ;
1161: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','Ntf_Error_Act',
1162: l_item_type,l_item_key,l_error_msg);
1163: IF G_DEBUG='Y' THEN
1164: AHL_DEBUG_PUB.disable_debug;
1165: END IF;
1166: RAISE;
1167: WHEN OTHERS THEN
1168: wf_core.context( 'AHL_FMP_MR_APPROVAL_PVT'
1170: , l_item_type
1171: , l_item_key
1172: );
1173: IF G_DEBUG='Y' THEN
1174: AHL_DEBUG_PUB.disable_debug;
1175: END IF;
1176: RAISE;
1177: END Ntf_Error_Act;
1178:
1209: l_default VARCHAR2(1):= FND_API.G_FALSE;
1210:
1211: BEGIN
1212: IF G_DEBUG='Y' THEN
1213: AHL_DEBUG_PUB.enable_debug;
1214: AHL_DEBUG_PUB.debug( 'Start Update Status API','+UPDATE_STATUS+');
1215: END IF;
1216:
1217: IF funcmode = 'RUN' THEN
1210:
1211: BEGIN
1212: IF G_DEBUG='Y' THEN
1213: AHL_DEBUG_PUB.enable_debug;
1214: AHL_DEBUG_PUB.debug( 'Start Update Status API','+UPDATE_STATUS+');
1215: END IF;
1216:
1217: IF funcmode = 'RUN' THEN
1218: l_approval_status := wf_engine.getitemattrtext(
1247: ,aname => 'OBJECT_ID'
1248: );
1249:
1250: IF G_DEBUG='Y' THEN
1251: AHL_DEBUG_PUB.debug( 'l_object_id mr_header_id'||l_object_id);
1252: AHL_DEBUG_PUB.debug( 'Approval Status--->'||l_approval_status);
1253: AHL_DEBUG_PUB.debug( 'Before complete complete_mr_revision api');
1254: END IF;
1255: AHL_FMP_MR_REVISION_PVT.COMPLETE_MR_REVISION
1248: );
1249:
1250: IF G_DEBUG='Y' THEN
1251: AHL_DEBUG_PUB.debug( 'l_object_id mr_header_id'||l_object_id);
1252: AHL_DEBUG_PUB.debug( 'Approval Status--->'||l_approval_status);
1253: AHL_DEBUG_PUB.debug( 'Before complete complete_mr_revision api');
1254: END IF;
1255: AHL_FMP_MR_REVISION_PVT.COMPLETE_MR_REVISION
1256: (
1249:
1250: IF G_DEBUG='Y' THEN
1251: AHL_DEBUG_PUB.debug( 'l_object_id mr_header_id'||l_object_id);
1252: AHL_DEBUG_PUB.debug( 'Approval Status--->'||l_approval_status);
1253: AHL_DEBUG_PUB.debug( 'Before complete complete_mr_revision api');
1254: END IF;
1255: AHL_FMP_MR_REVISION_PVT.COMPLETE_MR_REVISION
1256: (
1257: p_api_version =>l_api_version,
1267: p_mr_header_id =>l_object_id,
1268: p_object_version_number =>l_object_version_number
1269: );
1270: IF G_DEBUG='Y' THEN
1271: AHL_DEBUG_PUB.debug( 'After complete Update Status');
1272: END IF;
1273: COMMIT;
1274: resultout := 'COMPLETE:';
1275: IF G_DEBUG='Y' THEN
1272: END IF;
1273: COMMIT;
1274: resultout := 'COMPLETE:';
1275: IF G_DEBUG='Y' THEN
1276: AHL_DEBUG_PUB.disable_debug;
1277: END IF;
1278: RETURN;
1279: END IF;
1280:
1282: --
1283: IF (funcmode = 'CANCEL') THEN
1284: resultout := 'COMPLETE:';
1285: IF G_DEBUG='Y' THEN
1286: AHL_DEBUG_PUB.disable_debug;
1287: END IF;
1288: RETURN;
1289: END IF;
1290:
1293: --
1294: IF (funcmode = 'TIMEOUT') THEN
1295: resultout := 'COMPLETE:';
1296: IF G_DEBUG='Y' THEN
1297: AHL_DEBUG_PUB.disable_debug;
1298: END IF;
1299: RETURN;
1300: END IF;
1301:
1302:
1303: EXCEPTION
1304: WHEN fnd_api.g_exc_error THEN
1305: IF G_DEBUG='Y' THEN
1306: AHL_DEBUG_PUB.debug( ' Error in workflow:'||sqlerrm||'Update_status');
1307: END IF;
1308:
1309: FND_MSG_PUB.Count_And_Get (
1310: p_encoded => FND_API.G_FALSE,
1321: ) ;
1322: wf_core.context('AHL_FMP_APRV_PVT','UPDATE_STATUS',
1323: itemtype,itemkey,actid,funcmode,l_error_msg);
1324: IF G_DEBUG='Y' THEN
1325: AHL_DEBUG_PUB.disable_debug;
1326: END IF;
1327: RAISE;
1328:
1329: WHEN OTHERS THEN
1327: RAISE;
1328:
1329: WHEN OTHERS THEN
1330: IF G_DEBUG='Y' THEN
1331: AHL_DEBUG_PUB.debug( ' Error ...2..'||sqlerrm||'<--From-->UPDATE_STATUS');
1332: END IF;
1333:
1334: wf_core.context(
1335: 'AHL_FMP_MR_APPROVAL_PVT'
1340: ,funcmode
1341: ,'Unexpected Error!'
1342: );
1343: IF G_DEBUG='Y' THEN
1344: AHL_DEBUG_PUB.disable_debug;
1345: END IF;
1346: RAISE;
1347:
1348: END Update_Status;
1373: l_return_status VARCHAR2(1);
1374:
1375: BEGIN
1376: IF G_DEBUG='Y' THEN
1377: AHL_DEBUG_PUB.enable_debug;
1378: AHL_DEBUG_PUB.debug( '10010','+REVERT STATUS+');
1379: END IF;
1380:
1381: l_return_Status:='S';
1374:
1375: BEGIN
1376: IF G_DEBUG='Y' THEN
1377: AHL_DEBUG_PUB.enable_debug;
1378: AHL_DEBUG_PUB.debug( '10010','+REVERT STATUS+');
1379: END IF;
1380:
1381: l_return_Status:='S';
1382: IF funcmode = 'RUN' THEN
1416: return;
1417:
1418: end if;
1419: IF G_DEBUG='Y' THEN
1420: AHL_DEBUG_PUB.disable_debug;
1421: END IF;
1422:
1423: COMMIT;
1424: resultout := 'COMPLETE:';
1458: ) ;
1459: wf_core.context('AHL_FMP_MR_APPROVAL_PVT','revert_status',
1460: itemtype,itemkey,actid,funcmode,l_error_msg);
1461: IF G_DEBUG='Y' THEN
1462: AHL_DEBUG_PUB.disable_debug;
1463: END IF;
1464: RAISE;
1465: WHEN OTHERS THEN
1466: wf_core.context(
1472: ,funcmode
1473: ,'Unexpected Error!'
1474: );
1475: IF G_DEBUG='Y' THEN
1476: AHL_DEBUG_PUB.disable_debug;
1477: END IF;
1478: RAISE;
1479:
1480: END Revert_Status;