SELECT count(*) FROM GL_PERIOD_STATUSES gps , LAUD_AUDIT_TRANSACTIONS LAT , FND_APPLICATION fa , FND_USER fu , GL_LEDGERS gsb , GL_LOOKUPS_PERIOD_STATUSES_V gpsvnew , GL_LOOKUPS_PERIOD_STATUSES_V gpsvold,FND_APPLICATION_ALL_VIEW fav WHERE
lat.TABLE_NAME in ('GL_PERIOD_STATUSES')
and lat.PK_VAL3_ID=gps.application_id
and lat.PK_VAL2_ID=gps.period_name
and lat.PK_VAL1_ID=gps.set_of_books_id
and fa.application_id=gps.application_id
and fav.application_id=fa.application_id
and gsb.ledger_id=gps.set_of_books_id
and gps.application_id in (200,222,101)
and fu.user_id=gps.last_updated_by
and lat.old_value='C'
and lat.new_value='O'
--and gps.closing_status ='O'
and lat.COLUMN_NAME not in ('CREATION_DATE','LAST_UPDATE_DATE')
---and to_date(lat.transaction_date) >=to_date(sysdate)-10
and gpsvold.status_flag = lat.old_value
and gpsvnew.status_flag = lat.new_value
and gps.period_name in
(select period_name from gl_periods tt
where tt.period_set_name='BTVL Fiscal'
and end_date=(
select start_date-1 from gl_periods
where period_set_name='BTVL Fiscal'
and start_date<=sysdate
and end_date >=sysdate)
)
order by lat.transaction_date desc
lat.TABLE_NAME in ('GL_PERIOD_STATUSES')
and lat.PK_VAL3_ID=gps.application_id
and lat.PK_VAL2_ID=gps.period_name
and lat.PK_VAL1_ID=gps.set_of_books_id
and fa.application_id=gps.application_id
and fav.application_id=fa.application_id
and gsb.ledger_id=gps.set_of_books_id
and gps.application_id in (200,222,101)
and fu.user_id=gps.last_updated_by
and lat.old_value='C'
and lat.new_value='O'
--and gps.closing_status ='O'
and lat.COLUMN_NAME not in ('CREATION_DATE','LAST_UPDATE_DATE')
---and to_date(lat.transaction_date) >=to_date(sysdate)-10
and gpsvold.status_flag = lat.old_value
and gpsvnew.status_flag = lat.new_value
and gps.period_name in
(select period_name from gl_periods tt
where tt.period_set_name='BTVL Fiscal'
and end_date=(
select start_date-1 from gl_periods
where period_set_name='BTVL Fiscal'
and start_date<=sysdate
and end_date >=sysdate)
)
order by lat.transaction_date desc
No comments:
Post a Comment