Oracle EBs Apps Blog of Mahfuz, OPM and OBIEE Consultant

Tuesday 24 May 2016

ORG List as Per Location and Organization Type

ORG List as Per  Location and Organization Type:

select o.ORGANIZATION_CODE ORG_CODE, o.ORGANIZATION_NAME ORG_NAME, substr(o.ORGANIZATION_NAME,1,3) LOC, 'PF' org_type --,o.USER_DEFINITION_ENABLE_DATE, p.CREATION_DATE
from org_organization_definitions o, org_acct_periods p
where o.ORGANIZATION_ID=p.ORGANIZATION_ID(+) and o.ORGANIZATION_CODE not in ('FMO','IMO')
and p.PERIOD_NAME(+)='May-15-16' --and p.ORGANIZATION_ID is null
and o.ORGANIZATION_NAME like '%-PF-%'
--order by LOC desc
union all
select o.ORGANIZATION_CODE ORG_CODE, o.ORGANIZATION_NAME ORG_NAME, substr(o.ORGANIZATION_NAME,1,3) LOC, 'MAT' org_type --,o.USER_DEFINITION_ENABLE_DATE, p.CREATION_DATE
from org_organization_definitions o, org_acct_periods p
where o.ORGANIZATION_ID=p.ORGANIZATION_ID(+) and o.ORGANIZATION_CODE not in ('FMO','IMO')
and p.PERIOD_NAME(+)='May-15-16'-- and p.ORGANIZATION_ID is null
and o.ORGANIZATION_NAME like '%-MAT-%'
union all
select o.ORGANIZATION_CODE ORG_CODE, o.ORGANIZATION_NAME ORG_NAME, substr(o.ORGANIZATION_NAME,1,3) LOC, 'ME' org_type --,o.USER_DEFINITION_ENABLE_DATE, p.CREATION_DATE
from org_organization_definitions o, org_acct_periods p
where o.ORGANIZATION_ID=p.ORGANIZATION_ID(+) and o.ORGANIZATION_CODE not in ('FMO','IMO')
and p.PERIOD_NAME(+)='May-15-16' --and p.ORGANIZATION_ID is null
and o.ORGANIZATION_NAME like '%-ME-%'
union all
select o.ORGANIZATION_CODE ORG_CODE, o.ORGANIZATION_NAME ORG_NAME, substr(o.ORGANIZATION_NAME,1,3) LOC, 'LCM' org_type --,o.USER_DEFINITION_ENABLE_DATE, p.CREATION_DATE
from org_organization_definitions o, org_acct_periods p
where o.ORGANIZATION_ID=p.ORGANIZATION_ID(+) and o.ORGANIZATION_CODE not in ('FMO','IMO')
and p.PERIOD_NAME(+)='May-15-16' --and p.ORGANIZATION_ID is null
and o.ORGANIZATION_NAME like '%-LCM-%'
union all
select o.ORGANIZATION_CODE ORG_CODE, o.ORGANIZATION_NAME ORG_NAME, substr(o.ORGANIZATION_NAME,1,3) LOC, 'SELLING' org_type --,o.USER_DEFINITION_ENABLE_DATE, p.CREATION_DATE
from org_organization_definitions o, org_acct_periods p
where o.ORGANIZATION_ID=p.ORGANIZATION_ID(+) and o.ORGANIZATION_CODE not in ('FMO','IMO')
and p.PERIOD_NAME(+)='May-15-16' --and p.ORGANIZATION_ID is null
and o.ORGANIZATION_NAME like '35%'
union all
select o.ORGANIZATION_CODE ORG_CODE, o.ORGANIZATION_NAME ORG_NAME, substr(o.ORGANIZATION_NAME,1,3) LOC, 'OTHERS' org_type --,o.USER_DEFINITION_ENABLE_DATE, p.CREATION_DATE
from org_organization_definitions o, org_acct_periods p
where o.ORGANIZATION_ID=p.ORGANIZATION_ID(+) and o.ORGANIZATION_CODE not in ('FMO','IMO')
and p.PERIOD_NAME(+)='May-15-16' --and p.ORGANIZATION_ID is null
and o.ORGANIZATION_NAME not like '%-MAT-%' and  o.ORGANIZATION_NAME not like '%-PF-%' and  o.ORGANIZATION_NAME not like '%-ME-%' and  o.ORGANIZATION_NAME not like '%-LCM-%' and  o.ORGANIZATION_NAME not like '35%'
order by LOC desc, org_type desc, ORG_CODE asc

No comments:

Post a Comment

Internal location is Already assigned to another Ship-to Address

      SELECT *   FROM hz_cust_accounts  WHERE ACCOUNT_NUMBER = 'R08'; -- CUST_ACCOUNT_ID =51401 , PARTY_ID= 235048    SELECT *   FRO...