Skip to Content
author's profile photo Former Member
Former Member

Retained Earnings logic required in BW

Hi experts

We have a requirement to calculate the Retained earnings for FIGL leading ledger balances.

The GL for Retained earnings is 33000000 & at the same time we have P&L accounts from 4000000 till 8999999.

Now my requirement is to add the GL 3300000 with all P&L GL's and pass to the the retained earning A/c(GL 3300000).

example:

GLA/c 0Balance

Retained earnings 3300000 1000

Profit & loss 4000000-899999 9000

Now GL A/c 3300000 should get the values both Retained earnings n P&L Sum, which is 10000.

I'm loading data using 0FI_GL_12 DS loading to Zcube1 ( assume Cube1).

from Zcube1, we are again loading to ZCube2 & in between we wrote the logic to calculate the Retained Earning Account in End Routine. Code as follows-

DATA: RESULT_PACKAGE_temp type _ty_t_TG_1.

RESULT_PACKAGE_temp[] = RESULT_PACKAGE[].


sort RESULT_PACKAGE by gl_account.
sort RESULT_PACKAGE_temp by gl_account.

Loop at RESULT_PACKAGE ASSIGNING <fs_rp>
WHERE GL_ACCOUNT EQ '0003300000'.

CLEAR ls_s1.
LOOP AT RESULT_PACKAGE_temp INTO ls_temp

WHERE fiscper EQ <fs_rp>-fiscper
AND comp_code EQ <fs_rp>-comp_code
AND gl_account BETWEEN '0004000000' AND '0008999999'
AND company = 'I_NONE'.
ls_s1 = ls_s1 + ls_temp-balance.
clear: ls_temp.
ENDLOOP.
if ls_s1 is not INITIAL.
<fs_rp>-balance = <fs_rp>-balance + ls_s1 + ls_s2.
CLEAR ls_s1.
endif.
ENDLOOP.

But this is not working fine.. Can you please help me in getting the right values.

Thanks.

Kumar

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Sep 06, 2013 at 01:25 PM

    Hi Kumar,

    Please find my below understanding about your thread.

    You want to update the balance of GL 3300000 as follows:

    ADD Balance of GL 3300000 & all remaining P&L GLs (starting from 4000000-899999 )

    I have written below code to populate Balance of GL 3300000.

    DATA : WA TYPE _ty_s_TG_1,

    BALANCE TYPE DE_BALANCE,

    NEW_INDEX TYPE SY-TABIX.

    SORT RESULT_PACKAGE BY GL_AC.

    loop at RESULT_PACKAGE into WA where GL_AC = '3300000'. "FIND BALANCE OF 33000000

    BALANCE = WA-/BI0/BALANCE.

    exit.

    endloop.

    NEW_INDEX = SY-TABIX. " STORE IT'S(3300000) INDEX

    loop at RESULT_PACKAGE into <RESULT_FIELDS> FROM NEW_INDEX " ADD BALANCE FROM '0004000000' TO '0008999999'

    where GL_AC between '0004000000' AND '0008999999'.

    BALANCE = BALANCE + <RESULT_FIELDS>-/BI0/BALANCE.

    ENDLOOP.

    loop at RESULT_PACKAGE into <RESULT_FIELDS> FROM NEW_INDEX. " UPDATE BALANCE OF GL 3300000

    <RESULT_FIELDS>-/BI0/BALANCE = BALANCE.

    exit.

    endloop.

    Harshawardhan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Harsha for your Code.

      I have shown the same code to my ABAPer & he worked it fine. Thanks again.

      Meanwhile, we have got another issue within it.

      Now GL A/c 3300000 has some value & the P&L A/c's getting added up, so that retained a/c shows the total of 330000+P&L A/c's.

      If there is no values of cumulative balance in ECC for this Retained A/c(3300000), BW is not going to pick anything if you do not have value. but my user is asking me to create a Dummy record of 330000 with 0.00 as balance in BW with same conditions, so that BW should populate another line like -

      330000 US01 PCRTR 001.2012 0.00(Balance).

      So that, the P& L balances will get added up to this A/c.

      Please suggest would that be possible in BW to create like this? I believe BW is only an Analytical system but not the Transactional System to create a record with these conditions.

      If possible, how can we achieve it ?

      Thanks

      Kumar

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2013 at 07:20 AM

    Still i have the same kind requirement, if it resolved pls share here.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2013 at 09:35 AM

    Hi Kumar,

    It's possible I would advice you to write a Start Routine.

    from your 0FI_GL_12 DS to Zcube1 write a start routine of below logic

    DATA : wa type _ty_s_SC_1.

    loop at SOURCE_PACKAGE assigning <SOURCE_FIELDS>

    where GL = '3300000'.

    endloop. "Find if record with GL=3300000 exist in Datasource or not

    if sy-subrc <> 0. " if not. create one such record with initial values & append it to source_pkg

    wa-GL = '3300000'.

    wa-field2 = 'US01'.

    wa-field3 = ' 001.2012'.

    wa-balance = ' 0.00'.

    append wa to SOURCE_PACKAGE.

    endif.

    (Thus,every time you will have record with GL=3300000 in your Zcube1)

    This will put record of GL 3300000 in your ZCube1 & you can populate Balance in Zcube2 using above routine.

    Harshwardhan.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.