04-11-2018 10:15 AM
I have a report to write where I need to reconcile Sub ledger to ledger balances.
The report needs to be based on transaction ABST2 and it needs to be able to show the differences at profit center and GL account level. Currently, the report can only be executed at company code level.
Our current process involves running 3 separate transactions:
Has anyone written anything like this before?
This is my SQL query so far but I don't think that the keys between the tables are strong enough.:
SELECT ANEK~BUKRS WERT KOSTL PRCTR ANEK~ANLN1 ANEK~ANLN2 KONTO ANEK~GJAHR ANEK~BUDAT FROM ANEK
JOIN ANLP ON
ANEK~BUKRS = ANLP~BUKRS AND
ANEK~ANLN1 = ANLP~ANLN1 AND
ANEK~ANLN2 = ANLP~ANLN2
JOIN EWUFIAASUM ON
ANEK~BUKRS = EWUFIAASUM~BUKRS AND
ANEK~GJAHR = EWUFIAASUM~GJAHR AND
ANEK~PARGB = EWUFIAASUM~GSBER
INTO CORRESPONDING FIELDS OF TABLE WA
WHERE ANLP~PRCTR IN SO_PRCTR AND
EWUFIAASUM~KONTO IN SO_GLACC AND
ANLP~KOSTL IN SO_KOSTL AND
ANEK~BUDAT IN SO_PDate.
LOOP AT wa.
CALL FUNCTION 'BAPI_GL_ACC_GETPERIODBALANCES'
EXPORTING
companycode = wa-bukrs "'1000'
glacct = wa-konto
fiscalyear = wa-gjahr "'2018'
currencytype = '10'
IMPORTING
return = ret
TABLES
account_balances = bal3.
IF sy-subrc = 0.
READ TABLE bal3 with KEY fis_period = '01'.
IF sy-subrc = 0.
wa-gl = bal3-balance - bal3-per_sales.
wa-valuediff = wa-wert - wa-gl .
MODIFY wa.
ENDIF.
ENDIF.
ENDLOOP.
This is what the report should show at the end of the day:
Profit Center: PRCTR
Asset Number: ANLN1
Sub Asset Number: ANLN2
Sub Ledger Value: ABST2 Calculation
Ledger Value: ABST2 calculation
04-12-2018 8:57 AM
How do I combine ABST2, AR01 and FAGLB03 into one report.
I guess that this is what it comes down to.
Any help will be greatly appreciated.
05-02-2018 12:30 PM