Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

IndexParameterDescriptionRequired?Data Type (max length)Example
0kfsChartCodeKFS Chart CodeYesString(2)IR
1kfsOrgCodeKFS Organization CodeKYesString(4)9023

DB Query

   
Code Block
WITH ChildOrgList As (
	SELECT
		CASE
			WHEN LEN(ChildOrg.[CHART_CD],ChildOrg.[ORG_ROLLUPUC_LEVEL06LEVEL_CD]) = 4 THEN 6
			WHEN LEN(, ChildOrg.[ORG_CD],ChildOrg.[ORG_NM],
		ChildOrg.[ORG_ROLLUPPARENT_LEVEL05ORG_CD]) = 4 THEN 5
			WHEN LEN(, ChildOrg.[ORG_ROLLUP_LEVEL04LEVEL01_CD]) = 4 THEN 4
			WHEN LEN(, ChildOrg.[ORG_ROLLUP_LEVEL03LEVEL02_CD]) = 4 THEN 3
			WHEN LEN(ChildOrg.[ORG_ROLLUP_LEVEL02_CD]) = 4 THEN 2
			WHEN LEN(ChildOrg.[ORG_ROLLUP_LEVEL01_CD]) = 4 THEN 1
		END as ORG_LEVEL,
		ChildOrg.[CHART_CD],ChildOrg.[ORG_UC_LEVEL_CD], ChildOrg.[ORG_CD],ChildOrg.[ORG_NM],
		ChildOrg.[ORG_PARENT_ORG_CD], ChildOrg.[ORG_ROLLUP_LEVEL01_CD], ,
		ChildOrg.[ORG_ROLLUP_LEVEL02_CD],
		ChildOrg.[ORG_ROLLUP_LEVEL03_CD], ChildOrg.[ORG_ROLLUP_LEVEL04_CD], ChildOrg.[ORG_ROLLUP_LEVEL05_CD],
		ChildOrg.[ORG_ROLLUP_LEVEL06_CD]
	FROM [dwhs_ods].[dbo].[kfs_d_org] as ChildOrg
	WHERE ChildOrg.CHART_CD = 'IR' and ChildOrg.ORG_CD = '9023'
	UNION ALL
	SELECT
		CASE
			WHEN LEN(ChildOrg.[CHART_CD],ChildOrg.[ORG_ROLLUPUC_LEVEL06LEVEL_CD]) = 4 THEN 6
			WHEN LEN(, ChildOrg.[ORG_ROLLUP_LEVEL05_CD]) = 4 THEN 5CD],ChildOrg.[ORG_NM],
			WHEN LEN(ChildOrg.[ORG_ROLLUPPARENT_LEVEL04ORG_CD]) = 4 THEN 4
			WHEN LEN(, ChildOrg.[ORG_ROLLUP_LEVEL03LEVEL01_CD]) = 4 THEN 3
			WHEN LEN(, ChildOrg.[ORG_ROLLUP_LEVEL02_CD]) = 4 THEN 2,
			WHEN LEN(ChildOrg.[ORG_ROLLUP_LEVEL01LEVEL03_CD]) = 4 THEN 1
		END as ORG_LEVEL, 		ChildOrg.[CHART[ORG_ROLLUP_LEVEL04_CD], ChildOrg.[ORG_UCROLLUP_LEVELLEVEL05_CD],
		ChildOrg.[ORG_CD],ChildOrg.[ORG_NM],
		ROLLUP_LEVEL06_CD]
	FROM [dwhs_ods].[dbo].[kfs_d_org] as ChildOrg
	INNER JOIN ChildOrgList as Child ON ChildOrg.[ORG_PARENT_ORG_CD], = ChildOrgChild.[ORG_ROLLUP_LEVEL01_CD], ChildOrg
)
SELECT
	CASE
		WHEN LEN(L.[ORG_ROLLUP_LEVEL02LEVEL06_CD],) = 4 THEN 6
		ChildOrgWHEN LEN(L.[ORG_ROLLUP_LEVEL03LEVEL05_CD], ChildOrg]) = 4 THEN 5
		WHEN LEN(L.[ORG_ROLLUP_LEVEL04_CD], ChildOrg) = 4 THEN 4
		WHEN LEN(L.[ORG_ROLLUP_LEVEL05LEVEL03_CD],) = 4 THEN 3
		ChildOrgWHEN LEN(L.[ORG_ROLLUP_LEVEL06LEVEL02_CD]) 	FROM [dwhs_ods].[dbo].[kfs_d_org] as ChildOrg
	INNER JOIN ChildOrgList as Child ON ChildOrg= 4 THEN 2
		WHEN LEN(L.[ORG_PARENTROLLUP_ORGLEVEL01_CD]) = Child.ORG_CD
)
SELECT
	L.[4 THEN 1
	END as ORG_LEVEL],
	L.[ORG_UC_LEVEL_CD], L.[CHART_CD], L.[ORG_CD],
	L.[ORG_NM], L.[ORG_PARENT_ORG_CD], L.[ORG_ROLLUP_LEVEL01_CD], L.[ORG_ROLLUP_LEVEL02_CD],
	L.[ORG_ROLLUP_LEVEL03_CD], L.[ORG_ROLLUP_LEVEL04_CD], L.[ORG_ROLLUP_LEVEL05_CD],
	L.[ORG_ROLLUP_LEVEL06_CD]
FROM ChildOrgList L
ORDER BY 1

...

No input parameter, ALL active KFS organization details will be returned in result set.

DB Query

Code Block
SELECT 
FIN_COA_CD, 
ORG_CD, 
ORG_MGR_UNVL_ID, 
ORG_NM, 
RC_CD,
ORG_PHYS_CMP_CD,
ORG_TYP_CD,
ORG_DFLT_ACCT_NBR,
ORG_LN1_ADDR,
ORG_LN2_ADDR,
ORG_CITY_NM,
ORG_STATE_CD,
ORG_ZIP_CD,
ORG_CNTRY_CD,
ORG_BEGIN_DT,
ORG_END_DT,
RPTS_TO_FIN_COA_CD,
RPTS_TO_ORG_CD,
ORG_ACTIVE_CD,
ORG_PLNT_ACCT_NBR,
CMP_PLNT_ACCT_NBR,
ORG_PLNT_COA_CD,
CMP_PLNT_COA_CD 
FROM CA_ORG_T WHERE ORG_ACTIVE_CD <> 'N';

...

IndexParameterDescriptionRequired?Data Type (max length)Example
0fsLocationCodeFS Location CodeYesString(1)9
1fsHierarchyCodeFS Organization CodeNoString(4)2000

DB Query

Code Block
SELECT 
FIN_COA_CD, 
ORG_CD, 
UC_LOC_CD, 
UC_HIERARCHY_CD, 
UC_HIERARCHY_TYPE_CD 
FROM UCI_CA_ORG_XW_T 
WHERE UC_HIERARCHY_TYPE_CD='O' AND 
(
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='2000') OR 
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='3000') OR 
(UC_LOC_CD='0' AND UC_HIERARCHY_CD='0000') 
);

...

IndexParameterDescriptionRequired?Data Type (max length)Example
0fsLocationCodeFS Location CodeYesString(1)9
1fsHierarchyCodeFS Division CodeYesString(4)1015

DB Query

Code Block
SELECT 
FIN_COA_CD, 
ORG_CD, 
UC_LOC_CD, 
UC_HIERARCHY_CD, 
UC_HIERARCHY_TYPE_CD 
FROM UCI_CA_ORG_XW_T 
WHERE UC_HIERARCHY_TYPE_CD='V' AND 
(
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='1015') OR 
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='1100') OR 
(UC_LOC_CD='0' AND UC_HIERARCHY_CD='0000')
);

...

IndexParameterDescriptionRequired?Data Type (max length)Example
0fsLocationCodeFS Location CodeYesString(1)9
1fsHierarchyCodeFS SubDivisionCodeYesString(4)1300

DB Query

Code Block
SELECT 
FIN_COA_CD, 
ORG_CD, 
UC_LOC_CD, 
UC_HIERARCHY_CD, 
UC_HIERARCHY_TYPE_CD 
FROM UCI_CA_ORG_XW_T 
WHERE UC_HIERARCHY_TYPE_CD='S' AND 
(
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='1300') OR
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='1350') OR
(UC_LOC_CD='0' AND UC_HIERARCHY_CD='0000')
);

...

IndexParameterDescriptionRequired?Data Type (max length)Example
0fsLocationCodeFS Location CodeYesString(1)9
1fsHierarchyCodeFS DepartmentCodeYesString(4)0302

DB Query

Code Block
SELECT 
FIN_COA_CD, 
ORG_CD, 
UC_LOC_CD, 
UC_HIERARCHY_CD, 
UC_HIERARCHY_TYPE_CD 
FROM UCI_CA_ORG_XW_T 
WHERE UC_HIERARCHY_TYPE_CD='D' AND 
(
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='0302') OR
(UC_LOC_CD='9' AND UC_HIERARCHY_CD='0003') OR
(UC_LOC_CD='0' AND UC_HIERARCHY_CD='0000')
);

...