-
Notifications
You must be signed in to change notification settings - Fork 0
/
ORAAPPS_TEMPLATES.ftd
3398 lines (3207 loc) · 118 KB
/
ORAAPPS_TEMPLATES.ftd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
simple
Name:makefile
all:
g++ -c -Wall $[![{FileName}]!].cpp
g++ $[![{FileName}]!].o -o $[![{FileName}]!][>END<]!$[FingerTextData FingerTextData]@#
xmlpubdef
Lang:XML
<?xml version = '1.0' encoding = 'UTF-8'?>
<dataTemplate name="$[![short_name]!]" description="$[![desc]!]" version="1.0" defaultPackage="$[0[]0]">
<properties>
<property name="include_parameters" value="true" />
<property name="debug_mode" value="on" />
</properties>
<parameters>
<parameter name="P_ORG_ID" dataType="NUMBER"/>
<parameter name="P_CREATION_DATE_FROM" dataType="DATE"/>
<parameter name="P_CREATION_DATE_TO" dataType="DATE"/>
<parameter name="P_PR_NUMBER" dataType="VARCHAR2"/>
</parameters>
<dataQuery>
<sqlStatement name="Q_MAIN">
<![CDATA[
SELECT prha.segment1 pr_number
, prla.line_num
, TO_CHAR( prha.creation_date, 'dd-MON-yyyy' ) creation_date
, prha.authorization_status
, fu.user_name returned_by_user
, hr_general.decode_person_name( NVL( prla.suggested_buyer_id, pah.employee_id ) ) returned_by
, hr_general.decode_person_name( prha.preparer_id ) returned_to
, ( SELECT pah.document_number
FROM pon_auction_headers_all pah
WHERE pah.auction_header_id = prla.auction_header_id )
rfq_number
, note return_reason
, TO_CHAR( pah.action_date, 'dd-MON-yyyy' ) return_date
FROM po_requisition_headers_all prha
, po_requisition_lines_all prla
, po_action_history pah
, fnd_user fu
WHERE prha.requisition_header_id = prla.requisition_header_id
AND ( prla.suggested_buyer_id = fu.employee_id
OR pah.employee_id = fu.employee_id )
AND prha.authorization_status = 'RETURNED'
AND pah.object_type_code = 'REQUISITION'
AND pah.action_code = 'RETURN'
AND prha.requisition_header_id = pah.object_id
AND prha.org_id = :p_org_id
AND prha.creation_date BETWEEN :p_creation_date_from AND :p_creation_date_to
]]>
</sqlStatement>
</dataQuery>
<!-- <dataTrigger name="beforeReport" source=""/> -->
<dataStructure>
<group name="G_RETURN_PR_DATA" source="Q_MAIN" >
<element name="PR_NUMBER" value="pr_number" />
<element name="LINE_NUM" value="line_num" />
<element name="CREATION_DATE" value="creation_date" />
<element name="AUTHORIZATION_STATUS" value="authorization_status" />
<element name="RETURNED_BY_USER" value="returned_by_user" />
<element name="RETURNED_BY" value="returned_by" />
<element name="RETURNED_TO" value="returned_to" />
<element name="RFQ_NUMBER" value="rfq_number" />
<element name="RETURN_REASON" value="return_reason" />
<element name="RETURN_DATE" value="return_date" />
</group>
</dataStructure>
<!-- <dataTrigger name="afterReport" source=""/> -->
</dataTemplate>[>END<]!$[FingerTextData FingerTextData]@#
oaspace
Lang:XML
<oa:messageLayout id="SpacerLayout$[![id]!]">
<ui:contents>
<oa:spacer id="Spacer$[![id]!]" height="2"/>
</ui:contents>
</oa:messageLayout>
[>END<]!$[FingerTextData FingerTextData]@#
oapagebutton
Lang:XML
<oa:pageButtonBar id="PageButtonBarRN">
<ui:contents>
<oa:submitButton id="SaveBtn" text="Save" use="/oracle/apps/fnd/attributesets/Buttons/Apply" prompt="Save" shortDesc="Click to Save Work Request" />
<oa:button id="Cancel" text="Cancel" prompt="Cancel" shortDesc="Go Back" serverUnvalidated="false">
<ui:primaryClientAction>
<ui:firePartialAction event="GoBack" id="firePartialAction112" unvalidated="true"/>
</ui:primaryClientAction>
</oa:button>
<oa:submitButton id="SubmitBtn" text="Submit" use="/oracle/apps/fnd/attributesets/Buttons/Submit" prompt="Submit"/>
</ui:contents>
</oa:pageButtonBar>
[>END<]!$[FingerTextData FingerTextData]@#
oanewcol
Lang:XML
<oa:column id="$[![column]!]Column">
<ui:columnHeader>
<oa:sortableHeader id="$[![column]!]Header" prompt="$[![prompt]!]" shortDesc="$[![prompt]!]"/>
</ui:columnHeader>
<ui:contents>
<oa:messageStyledText id="$[![column]!]" viewAttr="$[0[]0]" prompt="$[![prompt]!]"/>
</ui:contents>
</oa:column>
[>END<]!$[FingerTextData FingerTextData]@#
wfsetattrtx
Lang:SQL
wf_engine.setitemattrtext(
itemtype => g_item_type
, itemkey => itemkey
, aname => '$[![attr]!]'
, avalue => '$[![value]!]'
);$[0[]0]
[>END<] !$[FingerTextData FingerTextData]@#
wfsetattrnu
Lang:SQL
wf_engine.setitemattrnumber(
itemtype => g_item_type
, itemkey => itemkey
, aname => '$[![attr]!]'
, avalue => $[![value]!]
);$[0[]0]
[>END<]!$[FingerTextData FingerTextData]@#
wfgetattrtx
Lang:SQL
wf_engine.getitemattrtext(
itemtype => itemtype
, itemkey => itemkey
, aname => '$[![default]!]'
)$[0[]0]
[>END<]!$[FingerTextData FingerTextData]@#
wfgetattrnu
Lang:SQL
wf_engine.getitemattrnumber(
itemtype => itemtype
, itemkey => itemkey
, aname => '$[![default]!]'
)$[0[]0]
[>END<]!$[FingerTextData FingerTextData]@#
wfcmds
Lang:SQL
/* We can use Scripts to delete/modify a workflow : @$FND_TOP/SQL/wfrmitt */
-- Use wfrmitt.sql to delete all data in all Oracle Workflow design time and runtime tables for a particular item type.
-- This script prompts you for an item type from a list of valid item types.
sqlplus apps/$APPS_PASS @$FND_TOP/sql/wfrmitt
-- Use wfrmtype.sql to delete runtime data associated with a given item type.
-- This script prompts you for an item type to purge from a list of valid item types, then asks you to choose between deleting all runtime data
-- associated with the specified item type or deleting only runtime data for the completed activities and items of the specified item type.
sqlplus apps/$APPS_PASS @$FND_TOP/sql/wfrmtype
-- Use wfrmita.sql to delete all workflow data for a specified item type attribute.
-- This script prompts you for the item type and the name of the attribute to delete.
-- Alternatively, you can use Oracle Workflow Builder to delete an item type attribute from a workflow definition stored in a file or a database.
sqlplus apps/$APPS_PASS @$FND_TOP/sql/wfrmita
-- To change a workflow item type internal name
sqlplus apps/$APPS_PASS @$FND_TOP/sql/wfchitt XXXXPTR XXAMTTRN
-- To change a workflow item type activity internal name
sqlplus apps/$APPS_PASS @$FND_TOP/sql/wfchact XXXXPTR MAIN_TRAINING_PROCESS LESSON2
-- To change the internal name of a message and update all references to the message.
sqlplus apps/$APPS_PASS @$FND_TOP/sql/wfchmsg MSG_TYPE OLD_MSG_NAME NEW_MSG_NAME
[>END<]!$[FingerTextData FingerTextData]@#
upd
Lang:SQL
BEGIN
UPDATE apps.$[![]!]
SET $[![column]!] = $[![value]!]
WHERE $[0[]0];
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
[>END<]!$[FingerTextData FingerTextData]@#
ttbl
Lang:SQL
TYPE $[![tbl]!] IS TABLE OF $[![table]!]%ROWTYPE
INDEX BY BINARY_INTEGER;
l_$[0[]0] $[![tbl]!] ;
[>END<]!$[FingerTextData FingerTextData]@#
trec
Lang:SQL
TYPE $[![rec]!] IS RECORD (
$[0[]0] dept.name%TYPE );
l_rec $[![rec]!];
[>END<]!$[FingerTextData FingerTextData]@#
submit_request
Lang:SQL
l_request_id :=
fnd_request.submit_request(
'$[![APPL]!]' --Application Short Name
, '$[![PROG_SHORT_NAME]!]' -- Conc Program Short Name
, NULL --Description
, NULL --Start Time
, FALSE --Sub Request
, NULL --Argument1
, NULL --Argument2
);
IF ( l_request_id <> 0 ) THEN
-- Make a parent child relationship
BEGIN
UPDATE fnd_concurrent_requests
SET has_sub_request = 'Y'
WHERE request_id = l_num_parent_id;
UPDATE fnd_concurrent_requests
SET is_sub_request = 'Y'
, priority_request_id = g_request_id
, parent_request_id = g_request_id
WHERE request_id = l_request_id;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
apps.fnd_file.put_line( apps.fnd_file.LOG, 'Error : ' || SQLERRM );
END;
-- Wait for request
DECLARE
l_max_wait NUMBER := 300; -- max wait time in seconds
l_interval NUMBER := 60; -- interval time in seconds
l_phase_code VARCHAR2( 15 );
l_status_code VARCHAR2( 15 );
x_dev_phase VARCHAR2( 15 );
x_dev_status VARCHAR2( 15 );
x_messages VARCHAR2( 4000 );
BEGIN
-- Wait for Child request completeion
l_boolean_status :=
fnd_concurrent.wait_for_request(
request_id => l_request_id
, interval => l_interval -- Interval between checking the status of program
, max_wait => l_max_wait -- Max wait time 0 means forever
, phase => l_phase_code -- Program Phase
, status => l_status_code -- Program Status
, dev_phase => x_dev_phase -- COMPLETED
, dev_status => x_dev_status -- NORMAL
, MESSAGE => x_messages
);
IF ( l_dev_status <> 'NORMAL' ) THEN
x_errmsg := 'Program request not completed Normal. Request id : ' || l_reqimport_req_id;
RAISE excp_custom;
END IF;
END;
ELSE
x_errmsg := 'Unable to submit the request. Error : ' || SQLERRM;
RAISE excp_custom;
END IF;
[>END<]!$[FingerTextData FingerTextData]@#
setclient
Lang:SQL
EXECUTE dbms_application_info.set_client_info($[0[]0]);[>END<]!$[FingerTextData FingerTextData]@#
selbeg
Lang:SQL
BEGIN
-- Select Query
SELECT $[0[]0]
INTO $[![]!]
FROM $[![]!];
EXCEPTION --Exception Block
WHEN NO_DATA_FOUND THEN
printlog('No Data Found');
WHEN OTHERS THEN
printlog('Error while . Error : '||sqlerrm);
END;
[>END<]!$[FingerTextData FingerTextData]@#
sel
Lang:SQL
SELECT 1$[0[]0]
FROM apps.$[![]!]
WHERE 1=1;
[>END<]!$[FingerTextData FingerTextData]@#
oaprint
Lang:SQL
BEGIN
jdr_utils.printdocument( '/xxcust/oracle/apps/$[![path]!]/$[![page]!]' );
END;[>END<]!$[FingerTextData FingerTextData]@#
ldebug
Lang:SQL
debug_log('$[![message]!]',$[0[]0]);[>END<]!$[FingerTextData FingerTextData]@#
ifee
Lang:SQL
IF($[![]!]) THEN
$[![]!];
ELSIF($[![]!]) THEN
$[![]!];
ELSE
$[0[]0];
END IF;[>END<]!$[FingerTextData FingerTextData]@#
ife
Lang:SQL
IF($[![]!]) THEN
$[![]!];
ELSE
$[0[]0];
END IF;[>END<]!$[FingerTextData FingerTextData]@#
if
Lang:SQL
IF($[![]!]) THEN
$[![]!];
END IF;[>END<]!$[FingerTextData FingerTextData]@#
fori
Lang:SQL
FOR $[![indx]!] IN 1..$[![tbl_type]!].count
LOOP
-- Initializing Variables
$[![tbl_type]!]( $[![indx]!] ).last_update_date := SYSDATE;
$[![tbl_type]!]( $[![indx]!] ).last_update_login := g_login_id;
$[![tbl_type]!]( $[![indx]!] ).last_updated_by := g_user_id;
$[![tbl_type]!]( $[![indx]!] ).request_id := g_request_id;
$[![tbl_type]!]( $[![indx]!] ).processed_flag := $[![new_status]!];
$[![tbl_type]!]( $[![indx]!] ).error_message := '$[0[]0]';
END LOOP;
[>END<]!$[FingerTextData FingerTextData]@#
forc
Lang:SQL
FOR $[![cur]!]_rec IN $[![cur]!]$[![()]!]
LOOP
$[0[]0]
END LOOP; -- End $[![cur]!]
[>END<]!$[FingerTextData FingerTextData]@#
fora
Lang:SQL
IF ( $[![tbl]!].COUNT > 0 ) THEN
BEGIN
FORALL indx IN 1 .. $[![tbl]!].COUNT
UPDATE apps.$[0[]0]
SET processed_flag = $[![tbl]!]( indx ).processed_flag
, error_message = $[![tbl]!]( indx ).error_message
, last_updated_by = $[![tbl]!]( indx ).last_updated_by
, last_update_date = $[![tbl]!]( indx ).last_update_date
, last_update_login = $[![tbl]!]( indx ).last_update_login
, request_id = $[![tbl]!]( indx ).request_id
WHERE transaction_id = $[![tbl]!]( indx ).transaction_id;
EXCEPTION --Exception Block
WHEN OTHERS THEN
l_errmsg := 'Error while Bulk updating the records, Error : ' || SQLERRM;
RAISE excp_custom;
END;
END IF;
[>END<]!$[FingerTextData FingerTextData]@#
flushsp
Lang:SQL
ALTER SYSTEM FLUSH SHARED_POOL;[>END<]!$[FingerTextData FingerTextData]@#
flushca
Lang:SQL
ALTER SYSTEM FLUSH BUFFER_CACHE;[>END<]!$[FingerTextData FingerTextData]@#
excp
Lang:SQL
EXCEPTION --Exception Block
$[0[]0]
WHEN OTHERS THEN
$[![message]!];
[>END<]!$[FingerTextData FingerTextData]@#
els
Lang:SQL
ELSIF($[![]!]) THEN
$[![]!];
END IF;[>END<]!$[FingerTextData FingerTextData]@#
dec
Lang:SQL
DECLARE
$[![var]!] $[![type]!] := null;
BEGIN
$[0[]0]
EXCEPTION--Exception Block
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.put_line( 'No Data Found' );
WHEN OTHERS THEN
DBMS_OUTPUT.put_line( 'Unexpected error occurred. Error : ' || SQLERRM );
END;
[>END<]!$[FingerTextData FingerTextData]@#
debug
Lang:SQL
debug_log('$[![message]!]',$[0[]0]);[>END<]!$[FingerTextData FingerTextData]@#
dbut
Lang:SQL
DBMS_UTILITY.get_time;[>END<]!$[FingerTextData FingerTextData]@#
dbo
Lang:SQL
DBMS_OUTPUT.put_line('$[0[]0]');[>END<]!$[FingerTextData FingerTextData]@#
curopen
Lang:SQL
OPEN $[![cursor]!]( );
FETCH $[![cursor]!]
INTO $[0[]0];
IF ( $[![cursor]!] %NOTFOUND ) THEN
CLOSE $[![cursor]!];
l_errmsg := 'No records fetched in cursor.';
RAISE excp_custom; -- Close cursor in excp_custom
END IF;
CLOSE $[![cursor]!];[>END<]!$[FingerTextData FingerTextData]@#
cur
Lang:SQL
CURSOR $[![cursor]!] IS
SELECT $[0[]0]
FROM $[![]!]
WHERE 1 = 1;[>END<]!$[FingerTextData FingerTextData]@#
crwfproc
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : $[![proc]!]
-- Description : This Workflow procedure will $[![description]!].
------------------------------------------------------------------------------------------------
PROCEDURE $[![proc]!](
itemtype IN VARCHAR2
, itemkey IN VARCHAR2
, actid IN NUMBER
, funcmode IN VARCHAR2
, result IN OUT VARCHAR2
)
IS
-- Declare cursors
-- Error code and Exception variables
l_retcode VARCHAR2(1) := g_success_code;
l_errmsg VARCHAR2( 4000 ) := g_success;
-- Declare variables
BEGIN
g_proc_name := '$[![proc]!]';
g_item_key := itemkey;
IF ( funcmode = 'RUN' ) THEN
$[0[]0]
-- Set the result as success
result := 'COMPLETE:Y';
END IF; -- End funcmode
EXCEPTION -- Exception block of Procedure
WHEN excp_custom THEN
wf_core.error_stack := l_errmsg;
wf_core.context(
g_package_name
, g_proc_name
, g_item_type
, itemkey
, TO_CHAR( actid )
, funcmode
);
debug_log( l_errmsg, g_proc_name );
result := 'COMPLETE:N';
RAISE;
WHEN OTHERS THEN
l_errmsg := 'Error in ' || g_proc_name || ' : ' || SQLERRM;
wf_core.error_stack := l_errmsg;
wf_core.context(
g_package_name
, g_proc_name
, itemtype
, itemkey
, TO_CHAR( actid )
, funcmode
);
debug_log( l_errmsg, g_proc_name );
RAISE;
END $[![proc]!];[>END<]!$[FingerTextData FingerTextData]@#
crwfpkb
Lang:SQL
CREATE OR REPLACE PACKAGE BODY $[![package]!]
IS
-- #############################################################################
-- # Copyright (c) 2010 $[![company]!]
-- # All rights reserved
-- #
-- ############################################################################
-- #
-- # Application : $[![appl]!]
-- # File Name: : $[![package]!].$[![ext]!]
-- # Exec Method : PL/SQL Stored - Procedure
-- # Description : Package Body used for Workflow Item $[![wfitem]!]
-- #
-- # Change History
-- # -----------------------------------------------------------------------
-- # Version Date Author Remarks
-- # ======= =========== ============= ============================
-- # 1.0 $[![(key)DATE:dd-MMM-yyyy]!] Amit Maindola Initial Version
-- #
-- #
-- #
-- ############################################################################ */
-- Declare Global Variables
g_success_code CONSTANT VARCHAR2( 1 ) := xxcust_wf_utility_pkg.success_code;
g_warning_code CONSTANT VARCHAR2( 1 ) := xxcust_wf_utility_pkg.warning_code;
g_failure_code CONSTANT VARCHAR2( 1 ) := xxcust_wf_utility_pkg.failure_code;
g_sysdate DATE := SYSDATE;
g_user_id NUMBER := fnd_profile.VALUE( 'USER_ID' );
g_package_name CONSTANT VARCHAR2( 30 ) := '$[![package]!]';
g_proc_name VARCHAR2( 30 ) := NULL;
g_item_type CONSTANT VARCHAR2( 8 ) := '$[![wfitem]!]';
g_item_key VARCHAR2( 100 ) := NULL;
excp_custom EXCEPTION;
-- Debug Workflow
PROCEDURE debug_log(
p_node_name IN VARCHAR2
, p_message IN VARCHAR2
)
IS
BEGIN
xxcust_wf_utility_pkg.wf_debug_log(
p_itemtype => g_item_type
, p_itemkey => g_item_key
, p_node_name => p_node_name
, p_node_type => 'FUNCTION'
, p_pkg_name => g_package_name
, p_pkg_sub_program_name => g_proc_name
, p_message => p_message
);
END debug_log;
$[0[]0]
END $[![package]!];
/
SHOW ERROR
/
[>END<]!$[FingerTextData FingerTextData]@#
crwflaunch
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : $[![procedure]!]
-- Description : This Workflow procedure will launch $[![process]!].
------------------------------------------------------------------------------------------------
PROCEDURE $[![procedure]!]( p_$[![id]!] IN INTEGER
, x_retcode OUT VARCHAR2
, x_errmsg OUT VARCHAR2
)
IS
l_user_name VARCHAR2( 30 ) := get_user( g_user_id );
l_itemkey VARCHAR2( 300 ) := $[![itemkey]!];
CURSOR $[![cursor]!]
IS
SELECT *
FROM $[![table]!]
WHERE $[![column]!] = p_$[![id]!];
$[![cursor]!]_rec $[![cursor]!]%ROWTYPE;
BEGIN
x_retcode := 'S';
x_errmsg := 'Workflow process launched Successfully.';
debug_log( 'Opening cursor for ID : ' || p_$[![id]!] );
OPEN $[![cursor]!];
FETCH $[![cursor]!]
INTO $[![cursor]!]_rec;
CLOSE $[![cursor]!];
l_itemkey := $[![cursor]!]_rec.$[0[]0] ;
debug_log( 'Details fetched successfully.' );
wf_engine.createprocess(
itemtype => g_item_type
, itemkey => l_itemkey
, process => '$[![process]!]'
, owner_role => l_user_name
);
wf_engine.setitemuserkey(
itemtype => g_item_type
, itemkey => l_itemkey
, userkey => 'USERKEY: ' || l_itemkey
);
wf_engine.setitemowner(
itemtype => g_item_type
, itemkey => l_itemkey
, owner => 'SYSADMIN'
);
wf_engine.setitemattrtext(
itemtype => g_item_type
, itemkey => l_itemkey
, aname => '$[0[]0]'
, avalue => '' -- An existing role/User
);
debug_log( 'Attributes set, starting process.' );
wf_engine.startprocess( g_item_type, l_itemkey );
COMMIT;
EXCEPTION -- Exception block of Procedure
WHEN OTHERS THEN
x_retcode := 'E';
x_errmsg := 'Error while launching Workflow, Error : ' || SQLERRM;
debug_log( x_errmsg );
END $[![procedure]!];
[>END<]!$[FingerTextData FingerTextData]@#
crwfhndlnotif
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : $[![proc]!]_HNDLNF
-- Description : This Workflow procedure will handle notification for $[![description]!].
------------------------------------------------------------------------------------------------
PROCEDURE $[![proc]!]_HNDLNF(
itemtype IN VARCHAR2
, itemkey IN VARCHAR2
, actid IN NUMBER
, funcmode IN VARCHAR2
, result IN OUT VARCHAR2
)
IS
-- Error code and Exception variables
l_errmsg VARCHAR2 (4000) := NULL;
l_retcode VARCHAR2 (1) := g_success_code;
l_nid NUMBER;
l_act_result_code VARCHAR2 (200);
l_resp_comment VARCHAR2 (400);
-- Declare variables
BEGIN
g_proc_name := '$[![proc]!]_HNDLNF';
g_item_key := itemkey;
IF (funcmode = 'RESPOND') THEN
-- derive the current notification id
l_nid := wf_engine.context_nid;
l_act_result_code := wf_notification.getattrtext ( l_nid, 'RESULT');
l_resp_comment := wf_notification.getattrtext ( l_nid, 'REJECTED_REASON');
IF (l_act_result_code = 'REJECTED') THEN
-- Check if comments are empty
IF (l_resp_comment IS NULL) THEN
result := 'ERROR: You must enter rejection reason for Rejecting the Request.';
RETURN;
END IF;
ELSIF (l_act_result_code = 'APPROVED') THEN
$[0[]0]
END IF;
-- Set the result as success
result := 'COMPLETE:Y';
END IF; -- End funcmode
EXCEPTION -- Exception block of Procedure
WHEN excp_custom THEN
wf_core.error_stack := l_errmsg;
wf_core.context (
g_package_name
, g_proc_name
, g_item_type
, g_item_key
, TO_CHAR (actid)
, funcmode
);
debug_log ( l_errmsg, g_proc_name);
RAISE;
WHEN OTHERS THEN
l_errmsg := 'Error in ' || g_proc_name || ' : ' || SQLERRM;
wf_core.error_stack := l_errmsg;
wf_core.context (
g_package_name
, g_proc_name
, g_item_type
, g_item_key
, TO_CHAR (actid)
, funcmode
);
debug_log ( l_errmsg, g_proc_name);
RAISE;
END $[![proc]!]_HNDLNF;[>END<]!$[FingerTextData FingerTextData]@#
crwfdebugproc
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : WF_DEBUG_LOG
-- Description : This Procedur will make entries into WF Custom Debug Log table
------------------------------------------------------------------------------------------------
PROCEDURE wf_debug_log(
p_itemtype IN VARCHAR2
, p_itemkey IN VARCHAR2
, p_node_name IN VARCHAR2
, p_node_type IN VARCHAR2
, p_pkg_name IN VARCHAR2
, p_pkg_sub_program_name IN VARCHAR2
, p_description IN VARCHAR2
, p_message IN VARCHAR2
)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
l_log_id NUMBER;
BEGIN
BEGIN
l_log_id := $[![SCHEMA]!].$[![SEQ]!].NEXTVAL;
EXCEPTION
WHEN OTHERS THEN
SELECT NVL( MAX( log_id ), 0 ) + 1
INTO l_log_id
FROM $[![TABLE]!];
END;
INSERT INTO $[![SCHEMA]!].$[![TABLE]!]( log_id
, item_type
, item_key
, node_name
, node_type
, pkg_name
, pkg_sub_program_name
, description
, transaction_date )
VALUES (
l_log_id
, p_itemtype
, p_item_key
, p_node_name
, p_node_type
, p_pkg_name
, p_pkg_sub_program_name
, p_message
, SYSDATE
);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line( 'Error : ' || SQLERRM );
END wf_debug_log;
[>END<]!$[FingerTextData FingerTextData]@#
crwfdebug
Lang:SQL
-- Debug Procedure
PROCEDURE debug_log (
p_message IN VARCHAR2
, p_node_name IN VARCHAR2
)
IS
BEGIN
xxcust_wf_utility_pkg.wf_debug_log (
p_itemtype => g_item_type
, p_itemkey => g_item_key
, p_node_name => NVL (p_node_name, g_proc_name)
, p_node_type => 'FUNCTION'
, p_pkg_name => g_package_name
, p_pkg_sub_program_name => g_proc_name
, p_message => p_message
);
xxcust_utility_pkg.printlog (p_message);
END debug_log;
[>END<]!$[FingerTextData FingerTextData]@#
crwfcmnattr
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : SET_COMMON_ATTRIBUTES
-- Description : This procedure will set commonly used WF Attributes.
------------------------------------------------------------------------------------------------
PROCEDURE set_common_attributes(
x_errbuf OUT VARCHAR2
, x_retcode OUT VARCHAR2
, p_subject IN VARCHAR2
, p_message IN VARCHAR2
)
IS
-- Declare cursors
-- Declare Out and exception variables
-- Declare Varibales
l_user_id NUMBER := fnd_global.user_id;
l_user_name VARCHAR2( 100 ) := fnd_global.user_name;
BEGIN
-- Initializing out parameters
-- g_proc_name := 'SET_COMMON_ATTRIBUTES';
x_errbuf := NULL;
x_retcode := g_success_code;
IF ( g_item_key IS NULL ) THEN -- Throw error if item key is null
x_errbuf := 'Global Item key is Null.';
x_retcode := g_failure_code;
ELSE
-- Create/Update the role
xxcust_wf_utility_pkg.crupd_adhoc_role(
x_errbuf => x_errbuf
, x_retcode => x_retcode
, p_role_name => g_performer_role
, p_role_dname => g_performer_role_dname
, p_email => NULL
, p_notif_preference => 'QUERY'
, p_rm_existing_users => TRUE -- remove previous users
);
-- Check procedure status
IF ( x_retcode <> g_success_code ) THEN
RAISE excp_custom;
END IF;
-- remove previous users
-- wf_directory.removeusersfromadhocrole( g_performer_role );
-- Set performer role
wf_engine.setitemattrtext(
itemtype => g_item_type
, itemkey => g_item_key
, aname => 'PERFORMER'
, avalue => g_performer_role -- An existing role/User
);
-- Set subject
wf_engine.setitemattrtext(
itemtype => g_item_type
, itemkey => g_item_key
, aname => 'SUBJECT'
, avalue => p_subject
);
wf_engine.setitemattrnumber(
itemtype => g_item_type
, itemkey => g_item_key
, aname => 'USER_ID'
, avalue => l_user_id
);
-- Set from Role
IF ( l_user_name = 'SYSADMIN' ) THEN
--debug_log ( 'Setting Responder', g_proc_name);
l_user_name := xxcust_wf_utility_pkg.get_responder(
p_item_type => g_item_type
, p_item_key => g_item_key
, p_item_message => p_message
);
END IF;
wf_engine.setitemattrtext(
itemtype => g_item_type
, itemkey => g_item_key
, aname => '#FROM_ROLE'
, avalue => NVL( l_user_name, 'SYSADMIN' )
);
END IF;
EXCEPTION -- Exception block of Procedure
WHEN excp_custom THEN
x_retcode := g_failure_code;
debug_log( x_errbuf, g_proc_name );
WHEN OTHERS THEN
x_errbuf := 'Unexpected Error while Setting Common WF Attributes Error : ' || SQLERRM;
x_retcode := g_failure_code;
debug_log( x_errbuf, g_proc_name );
END set_common_attributes;
[>END<]!$[FingerTextData FingerTextData]@#
crview
Lang:SQL
-- #############################################################################
-- # Copyright (c) $[![company]!]
-- # All rights reserved
-- #
-- ############################################################################
-- # Application : $[![appl]!]
-- # File Name: : $[![View]!].$[![ext]!]
-- # Type : View
-- # Exec Method : PL/SQL File
-- # Description : This script will creates View - $[![View]!]
-- # This view has $[![desc]!].
-- # Change History
-- # -----------------------------------------------------------------------
-- # Version Date Author Remarks
-- # ======= =========== ============= ============================
-- # 1.0 $[![(key)DATE:dd-MMM-yyyy]!] Amit Maindola Initial Version
-- #**************************************************************************************************************/
CREATE OR REPLACE VIEW APPS.$[![View]!]
(
ship_to_number
, non_consigned_to_consigned
, ship_to_type
, no_parts_fs_vmi_ext
, no_parts_fs_vmi_null_int
, vmi_org_setup
, part_setup
)
AS
SELECT *
FROM apps.$[0[]0];
[>END<]
!$[FingerTextData FingerTextData]@#
crtab
Lang:SQL
-- #############################################################################
-- # Copyright (c) $[![company]!]
-- # All rights reserved
-- #
-- ############################################################################
-- # Application : $[![appl]!]
-- # File Name: : $[![table]!].$[![ext]!]
-- # Type : Table
-- # Exec Method : PL/SQL File
-- # Description : This script creates table - $[![table]!] under the schema $[![appl]!]
-- #
-- # Change History
-- # -----------------------------------------------------------------------
-- # Version Date Author Remarks
-- # ======= =========== ============= ============================
-- # 1.0 $[![(key)DATE:dd-MMM-yyyy]!] Amit Maindola Initial Version
-- #**************************************************************************************************************/
DROP TABLE $[![appl]!].$[![table]!] CASCADE CONSTRAINTS;
CREATE TABLE $[![appl]!].$[![table]!]
(
$[0[]0]ID NUMBER
,NUMBER VARCHAR2( 50 )
,ship_to_type VARCHAR2( 10 )
, CODE VARCHAR2( 20 )
,vmi_org_setup VARCHAR2( 3 )
,part_setup VARCHAR2( 3 )
,description VARCHAR2( 200 )
,status_code VARCHAR2( 30 )
,creation_date DATE NOT NULL
,created_by NUMBER NOT NULL
,last_update_date DATE
,last_updated_by NUMBER
,last_update_login NUMBER
,program_update_date DATE
,program_application_id NUMBER
,program_id NUMBER
,request_id NUMBER
,attribute1 VARCHAR2( 150 )
,attribute2 VARCHAR2( 150 )
,attribute3 VARCHAR2( 150 )
,attribute4 VARCHAR2( 150 )
,attribute5 VARCHAR2( 150 )
,attribute6 VARCHAR2( 150 )
,attribute7 VARCHAR2( 150 )
,attribute8 VARCHAR2( 150 )
,attribute9 VARCHAR2( 150 )
,attribute10 VARCHAR2( 150 )
,attribute11 VARCHAR2( 150 )
,attribute12 VARCHAR2( 150 )
,attribute13 VARCHAR2( 150 )
,attribute14 VARCHAR2( 150 )
,attribute15 VARCHAR2( 150 )
);
-- Grant all to table
PROMPT Granting Previlages to APPS on Table $[![table]!]...
GRANT ALL ON $[![appl]!].$[![table]!] TO apps;
-- Create Synonm for table
PROMPT Creating Synonm in APPS for Table $[![table]!]...
CREATE OR REPLACE SYNONYM APPS.$[![table]!] FOR $[![appl]!].$[![table]!];
PROMPT Creating Synonm in APPSREAD for Table $[![table]!]...
CREATE OR REPLACE SYNONYM APPSREAD.$[![table]!] FOR $[![appl]!].$[![table]!];
[>END<]
!$[FingerTextData FingerTextData]@#
crproc
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : $[![proc]!]
-- Description : This procedure will $[![description]!].
------------------------------------------------------------------------------------------------
PROCEDURE $[![proc]!](
x_retcode OUT VARCHAR2
, x_errbuf OUT VARCHAR2
, p_$[0[]0] IN VARCHAR2
)
IS
-- Declare cursors
-- Declare Out and exception variables
l_retcode NUMBER := g_success_code;
l_errmsg VARCHAR2( 4000 ) := g_success;
excp_skip EXCEPTION;
-- Declare Varibales
BEGIN
-- Initializing out parameters
g_proc_name := '$[![proc]!]';
x_errbuf := l_errmsg;
x_retcode := l_retcode;
EXCEPTION -- Exception block of Procedure
WHEN excp_custom THEN
ROLLBACK;
x_errbuf := l_errmsg;
x_retcode := l_retcode;
printlog( l_errmsg );
WHEN OTHERS THEN
ROLLBACK;
x_errbuf := form_err_msg;
x_retcode := g_failure_code;
printlog( x_errbuf );
END $[![proc]!];[>END<]!$[FingerTextData FingerTextData]@#
crprintlog
Lang:SQL
------------------------------------------------------------------------------------------------
-- PROCEDURE : PRINTLOG
-- Description : This procedure is used to print log messages in Log file and Console
------------------------------------------------------------------------------------------------
PROCEDURE printlog (p_message IN VARCHAR2)
IS
l_errmsg VARCHAR2 (10000);
BEGIN
l_errmsg := SUBSTR ( p_message, 1, g_err_length_limit);
fnd_file.put_line ( fnd_file.LOG, l_errmsg);
DBMS_OUTPUT.put_line (l_errmsg);
END printlog;
[>END<]!$[FingerTextData FingerTextData]@#
crpkg
Lang:SQL
CREATE OR REPLACE PACKAGE $[![package]!]