DBA Data[Home] [Help]

PACKAGE BODY: APPS.INV_DIAG_OH_REV_ITMNOREV

Source


1 package body INV_DIAG_OH_REV_ITMNOREV as
2 /* $Header: INVDO03B.pls 120.0.12000000.1 2007/06/22 01:00:27 musinha noship $ */
3 
4 PROCEDURE init is
5 BEGIN
6 -- test writer
7 null;
8 END init;
9 
10 PROCEDURE cleanup IS
11 BEGIN
12 -- test writer could insert special cleanup code here
13 NULL;
14 END cleanup;
15 
16 PROCEDURE runtest(inputs IN JTF_DIAG_INPUTTBL,
17                   report OUT NOCOPY JTF_DIAG_REPORT,
18                   reportClob OUT NOCOPY CLOB) IS
19 
20 reportStr LONG;
21 counter NUMBER;
22 dummy_v2t JTF_DIAGNOSTIC_COREAPI.v2t;
23 c_userid VARCHAR2(50);
24 statusStr VARCHAR2(50);
25 errStr VARCHAR2(4000);
26 fixInfo VARCHAR2(4000);
27 isFatal VARCHAR2(50);
28 dummy_num NUMBER;
29 sqltxt VARCHAR2 (9999);
30 l_org_id NUMBER;
31 BEGIN
32 
33    JTF_DIAGNOSTIC_ADAPTUTIL.setUpVars;
34    JTF_DIAGNOSTIC_ADAPTUTIL.addStringToReport('@html');
35    JTF_DIAGNOSTIC_COREAPI.insert_style_sheet;
36    --JTF_DIAGNOSTIC_COREAPI.line_out('this also writes to the clob');
37 
38    l_org_id := JTF_DIAGNOSTIC_ADAPTUTIL.getInputValue('OrgId',inputs);
39 
40 
41    IF l_org_id IS NOT NULL THEN
42 
43       sqltxt := 'select  mp.organization_code|| '' (''||moqd.organization_id ||'')'' "Organization|Code (Id)"' ||
44                 ' ,mif.item_number|| '' (''||moqd.inventory_item_id||'')'' "Item (Id)" ' ||
45                 ' ,moqd.subinventory_code "Subinv", moqd.locator_id "Loc id",moqd.lot_number "Lot number",moqd.revision "Rev" ' ||
46                 ' from mtl_onhand_quantities_detail moqd,' ||
47                 ' mtl_parameters mp,mtl_item_flexfields mif' ||
48                 ' where moqd.organization_id = mp.organization_id' ||
49                 ' and moqd.inventory_item_id = mif.inventory_item_id' ||
50                 ' and moqd.organization_id = mif.organization_id' ||
51                 ' and moqd.revision is not null ' ||
52                 ' and moqd.organization_id = ' || l_org_id ||
53                 ' and exists (select 1 from mtl_system_items ' ||
54                              ' where inventory_item_id = moqd.inventory_item_id ' ||
55                              ' and organization_id = moqd.organization_id ' ||
56                              ' and revision_qty_control_code = 1)' ||
57                 ' group  by ' ||
58                 ' mp.organization_code || '' ('' || moqd.organization_id  || '')'',' ||
59                 ' mif.item_number|| '' (''||moqd.inventory_item_id||'')'',' ||
60                 ' moqd.inventory_item_id, moqd.subinventory_code, moqd.locator_id, moqd.lot_number, moqd.revision' ;
61 
62       dummy_num:= JTF_DIAGNOSTIC_COREAPI.display_sql(sqltxt,'Onhand with Revision for item not revision controlled');
63 
64    ELSE
65 
66       sqltxt := ' select ' ||
67                 ' mp.organization_code || '' ('' || t.organization_id  || '')'' "Organization|Code (Id)"' ||
68                 ' ,mif.item_number|| '' (''||t.inventory_item_id||'')'' "Item (Id)" ,' ||
69                 ' t.subinventory_code "Subinv", t.locator_id "Locator_id", t.lot_number "Lot num", t.revision "Rev"' ||
70                 ' from temp_disc_inv_cg_loose t, mtl_parameters mp, mtl_item_flexfields mif' ||
71                 ' where  ' ||
72                 ' t.organization_id = mp.organization_id(+)' ||
73                 ' and t.inventory_item_id = mif.inventory_item_id(+)' ||
74                 ' and t.organization_id = mif.organization_id(+)' ||
75                 ' and t.revision is not null' ||
76                 ' and exists (select 1 from mtl_system_items ' ||
77                              ' where inventory_item_id = t.inventory_item_id ' ||
78                              ' and organization_id = t.organization_id ' ||
79                              ' and revision_qty_control_code =1 )' ||
80                 ' group  by ' ||
81                 ' mp.organization_code || '' ('' || t.organization_id  || '')'',' ||
82                 ' mif.item_number|| '' (''||t.inventory_item_id||'')'',' ||
83                 ' t.inventory_item_id, t.subinventory_code, t.locator_id, t.lot_number, t.revision' ;
84 
85       dummy_num:= JTF_DIAGNOSTIC_COREAPI.display_sql(sqltxt,' Onhand with Revision for item not revision controlled.');
86       JTF_DIAGNOSTIC_ADAPTUTIL.addStringToReport(reportClob,' Please execute with organization identifier to identify the revision mismatch for an organization.');
87       JTF_DIAGNOSTIC_ADAPTUTIL.addStringToReport(reportClob,' Alternatively user can execute the mismatch script mentioned in Note 279205.1  and then this script without organization identifier to identify revision mismatches across organization.');
88 
89    END IF;
90 
91    reportStr := 'The test completed as expected';
92    JTF_DIAGNOSTIC_ADAPTUTIL.addStringToReport(reportClob,reportStr);
93    statusStr := 'SUCCESS';
94    report := JTF_DIAGNOSTIC_ADAPTUTIL.constructReport(statusStr,errStr,fixInfo,isFatal);
95    reportClob := JTF_DIAGNOSTIC_ADAPTUTIL.getReportClob;
96 
97 EXCEPTION
98   when others then
99     JTF_DIAGNOSTIC_COREAPI.errorprint('Error: '||sqlerrm);
100     JTF_DIAGNOSTIC_COREAPI.ActionErrorPrint('This is the exception handler');
101     statusStr := 'FAILURE';
102     errStr := sqlerrm ||' occurred in script Exception handled';
103     fixInfo := 'Unexpected Exception in INVDO03B.pls';
104     isFatal := 'FALSE';
105     report := JTF_DIAGNOSTIC_ADAPTUTIL.constructReport(statusStr,errStr,fixInfo,isFatal);
106     reportClob := JTF_DIAGNOSTIC_ADAPTUTIL.getReportClob;
107 END runTest;
108 
109 
110 PROCEDURE getComponentName(name OUT NOCOPY VARCHAR2) IS
111 BEGIN
112 name := 'Onhand';
113 END getComponentName;
114 
115 PROCEDURE getTestDesc(descStr OUT NOCOPY VARCHAR2) IS
116 BEGIN
117 descStr := 'Onhand with revision when item is not revision controlled';
118 END getTestDesc;
119 
120 PROCEDURE getTestName(name OUT NOCOPY VARCHAR2) IS
121 BEGIN
122 name := 'Onhand Rev Item NoRev';
123 END getTestName;
124 
125 PROCEDURE getDependencies (package_names OUT NOCOPY  JTF_DIAG_DEPENDTBL) IS
126 tempDependencies JTF_DIAG_DEPENDTBL;
127 
128 BEGIN
129     package_names := JTF_DIAGNOSTIC_ADAPTUTIL.initDependencyTable;
130 END getDependencies;
131 
132 PROCEDURE isDependencyPipelined (str OUT NOCOPY  VARCHAR2) IS
133 BEGIN
134   str := 'FALSE';
135 END isDependencyPipelined;
136 
137 PROCEDURE getOutputValues(outputValues OUT NOCOPY  JTF_DIAG_OUTPUTTBL) IS
138   tempOutput JTF_DIAG_OUTPUTTBL;
139 BEGIN
140   tempOutput := JTF_DIAGNOSTIC_ADAPTUTIL.initOutputTable;
141   outputValues := tempOutput;
142 EXCEPTION
143  when others then
144  outputValues := JTF_DIAGNOSTIC_ADAPTUTIL.initOutputTable;
145 END getOutputValues;
146 
147 PROCEDURE getDefaultTestParams(defaultInputValues OUT NOCOPY JTF_DIAG_INPUTTBL) IS
148 tempInput JTF_DIAG_INPUTTBL;
149 BEGIN
150   tempInput := JTF_DIAGNOSTIC_ADAPTUTIL.initinputtable;
151   tempInput := JTF_DIAGNOSTIC_ADAPTUTIL.addInput(tempInput,'OrgId','LOV-oracle.apps.inv.diag.lov.OrganizationLov');
152   defaultInputValues := tempInput;
153 EXCEPTION
154 when others then
155   defaultInputValues := JTF_DIAGNOSTIC_ADAPTUTIL.initinputtable;
156 END getDefaultTestParams;
157 
158 Function getTestMode return INTEGER IS
159 BEGIN
160  return JTF_DIAGNOSTIC_ADAPTUTIL.ADVANCED_MODE;
161 
162 END getTestMode;
163 
164 END INV_DIAG_OH_REV_ITMNOREV;