Hi,
This may have a simple answer. Since I'm new to Oracle SQL Developer (and SQL in general), I've been racking my brain with no luck.
This company is on Oracle 12.1 and I'm writing a queries in SQL Developer connected to PROD. I am writing a script that will return the information for depreciation for the month, by company (this main one and sister companies) and by the posting accounts. I need to bring in the 2 digit Company Code, which is the same as Segment1 of the GL Account Flex Field.
I've been able to extract the Cost, Depreciation and Accumulated Depreciation accounts as well as the monthly depreciation amount. What I cannot find is what FA table contains the 2 digit Company Code. I've looked in FA_Books, Additions_B, Deprn_Detail, Categories, etc. with no luck (thus, my racked brain). My code and a sample of the results are below.
Is that code in FA or do I have to join my FA tables in my query to a GL one?
ANY help will be greatly appreciated.
Marco
SELECT DISTINCT
fab.asset_number,
fab.attribute1, --PLACE HOLDER FOR THE COMPANY CODE
fds.deprn_run_date,
fcb.ASSET_COST_ACCT,
FCB.DEPRN_EXPENSE_ACCT,
FCB.DEPRN_RESERVE_ACCT,
fds.deprn_amount,
fds.ytd_deprn,
fds.deprn_reserve
FROM
apps.fa_additions_b fab,
apps.fa_categorY_bOOKS fcb,
apps.fa_deprn_summary fds
WHERE
1 = 1
AND fds.book_type_code = '@@@@ @@@@ CORP'
AND fab.asset_id = fds.asset_id
AND FAB.ASSET_CATEGORY_ID = FCB.CATEGORY_ID
AND fds.period_counter = '24235' -- July 2019
and FCB.DEPRN_EXPENSE_ACCT <> '900001'
AND fds.deprn_amount IS NOT NULL
ORDER BY 1, 4;
RESULTS
ASSET_NUMBER | ATTRIBUTE1 | DEPRN_RUN_DATE | ASSET_COST_ACCT | DEPRN_EXPENSE_ACCT | DEPRN_RESERVE_ACCT | DEPRN_AMOUNT | YTD_DEPRN | DEPRN_RESERVE |
138853-RS14A | 13-Aug-19 | 114707 | 751707 | 115707 | 972.61 | 6,808.27 | 127,411.69 |
138854-RS14A | 13-Aug-19 | 114707 | 751707 | 115707 | 6,470.66 | 45,294.62 | 854,126.90 |
138855-RS14A | 13-Aug-19 | 114707 | 751707 | 115707 | 1,346.38 | 9,424.66 | 175,029.31 |
138856-RS14A | 13-Aug-19 | 114707 | 751707 | 115707 | 3,238.54 | 22,669.78 | 430,726.27 |
138857-RS14A | 13-Aug-19 | 114707 | 751707 | 115707 | 5,846.90 | 40,928.30 | 777,637.70 |
138858-RS14A | 13-Aug-19 | 114707 | 751707 | 115707 | 167.99 | 1,175.93 | 22,343.12 |
155499-RS14 | 13-Aug-19 | 114707 | 751707 | 115707 | 4.36 | 30.52 | 591.50 |
155500-RS14 | 13-Aug-19 | 114707 | 751707 | 115707 | 123.62 | 865.34 | 16,759.92 |
155501-RS14 | 13-Aug-19 | 114707 | 751707 | 115707 | 9.67 | 67.69 | 1,311.25 |
155502-RS14 | 13-Aug-19 | 114707 | 751707 | 115707 | 205.66 | 1,439.62 | 27,881.74 |
155628-RS14 | 13-Aug-19 | 114707 | 751707 | 115707 | 38.49 | 269.43 | 5,034.73 |
155629 | 13-Aug-19 | 114707 | 751707 | 115707 | 6.67 | 46.69 | 740.02 |
155630 | 13-Aug-19 | 114707 | 751707 | 115707 | 17.93 | 125.51 | 1,990.57 |