Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get sum amount (wrbtr) from table BSIS group by gjahr hkont monat

Former Member
0 Kudos
630

Hello! I am new to this forum, and to ABAP. Hope my question is not obvious.

I want to get sum amount from table BSIS, group by year, period an account. Normally I will try a SQL select like this:

SELECT gjahr monat hkont sum( wrbtr ) as wrbtr INTO CORRESPONDING FIELDS OF TABLE itab FROM BSIS WHERE (itabcond) GROUP BY gjahr monat hkont .

The problem is that the amount in field wrbtr is all positive. The result gets wrong. The debet/credit indicator shkzg determines what is positive/negative. How to solve this in the most efficient way? Should I read all accounting documents into an internal table, and loop through them, changing the sign, and then make some new select, or is there a better way?

Regards Dag-Egil

Message was edited by:

Dag-Egil Bull Sletholt

1 ACCEPTED SOLUTION

Former Member
0 Kudos
232

Have a look at table GLT0. This has account balances by GL and fiscal period.

Rob

11 REPLIES 11

Former Member
0 Kudos
233

Have a look at table GLT0. This has account balances by GL and fiscal period.

Rob

0 Kudos
232

My table GLT0 contains no records. I tried looking it at using transactions SE16. Is there a special settings to make this table "active"?

0 Kudos
232

That's odd. What happens when you execute transaction FBL3N?

Rob

0 Kudos
232

This report displays the accounting documents correctly.

0 Kudos
232

Can you run a performance trace (ST05) while you execute this transaction? It will show you what tables it's reading and how many records each returns.

Rob

0 Kudos
232

Here are the objects in the trace list:

SKB1

USR05

TRDIR

SKA1

SKAT

SKB1

BSIS

PRPS

BSAS

V_LTDX

USR02

RFBLG

V_LTDX

LTDX

RTXTH

RTXTF

RTXTT

TRDIR

The most of this call to this tables returns 1-2 records, apart from BSIS, where it returns 10 records. This is the same as accounting documents in the transaction FBL3N. When i try this again with more records returned I still have no call to table GLT0.

0 Kudos
232

That's interesting. I ran it as well and instead of BSIS and BSAS, it called GLT0. So somehow, this isn't being used in your system. You might check with your functional people to see if they have turned it off in customization.

But it's agood table to have because it allows this transaction to run quickly.

Rob

0 Kudos
232

I'm really sorry - I gave you the wrong transaction. FBL3N displays documents. <b>FS10N</b> displays balances. Try running this (with a trace if necessary).

Sorry for the confusion.

Rob

0 Kudos
232

I tried again with FS10N, and I found a call to table FAGLFLEXT that probably will do. I will need to do some more research to figure out if this will solve my problem. Thanks so far!

0 Kudos
232

You're welcome.

Please close the post (solved on own).

In the future, you should probably post questions like this to ABAP General.

Rob

Former Member
0 Kudos
232

hello,

i met this problem before

use the into itab replec the into corronspording fields of table itab

then it will be corrert .

even now i donnot why strange