‎2008 Apr 21 8:06 AM
Hi All
I have a requirement,i have opening balance,debit and credit amount.suppose i have opening balance of 10
my formula is balance = opening bel + debit + credit
debit ,,,credit ,,,balance
1 ,,,, 2 ,,, (1021)= 13
but for second doc onwards it should be balance (not ope bal)+debit + credit
debit ,,,credit ,,,balance
3 ,,,, 4 ,,, (1334)= 20
5 ,,,, 6 ,,, (2056)= 31
7,,,, 8 ,,,, (3178)=46
Pls Help me.
Regards
Lalith
‎2008 Apr 21 8:11 AM
loop at itab.
if sy-tabix = 1.
balance = openbal + credit + debit.
else.
balance = balance + credit + debit.
endif.
endloop.
‎2008 Apr 21 8:49 AM
i have given this logic , but balance = balance + credit + debit.
it is not taking balance of sy-tabix = 1 only in sytabix = 1 it should take openining balance elsewhere it should take balance of previous doc no.
loop at itab.
if sy-tabix = 1.
balance = openbal + credit + debit.
else.
balance = balance + credit + debit.
endif.
endloop.
‎2008 Apr 21 8:14 AM
Hi,
Try setting a flag. For ex,
data: gf_flag type i .
if gf_flag <> 1.
balance = opening bel + debit + credit.
gf_flag = 1.
else.
balance = balance + debit + credit.
endif.
Regards,
Ramya
‎2008 Apr 21 8:17 AM
Hi,
data: v_flag type c value 'X'.
loop at itab.
if v_flag = 'X'.
balance = openbal + credit + debit.
clear v_flag.
else.
balance = balance + credit + debit.
endif.
endloop.
‎2008 Apr 21 8:27 AM
Hi,
Balance = 0.
loop .
balance = balance + credit + debit.
endloop.
I think it is useful for you.
‎2008 Apr 21 8:56 AM
if balance is INITIAL
balance = open bal + credit...
else
bal = bal +
Check whether this logic will satisfy ur purpose