Skip to Content
1
Former Member
Sep 05, 2013 at 03:55 PM

Retained Earnings logic required in BW

86 Views

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