Application Development and Automation 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: 
Read only

selecting from bseg

Former Member
0 Likes
2,257

Abap Gurus,

I am fetching belnr dmbtr buzei hkont from bseg

for all entries from one table say 'TAB'

where hkont = TAB-hkont

and koart = 'S'.

but in in the code inspector check it;s showing error

The message is

"Large table BSEG: No field of a table index in WHERE"

How to optimize a fetch from a larger cluster table BSEG

rewards if useful.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,865

Hi,

Alternatives to Reading BSEG (Accounting Document Segment).

Since performance is an issue if reading data from BSEG table ( being a cluster table ), maybe you would

consider using the tables:

BSAD Accounting : Secondary Index for Customers (Cleared Items)

BSAK Accounting : Secondary Index for Vendors (Cleared Items)

BSAS Accounting : Secondary Index for G/L Accounts (Cleared Items)

BSID Accounting : Secondary Index for Customers

BSIK Accounting : Secondary Index for Vendors

BSIS Accounting : Secondary Index for G/L Accounts

instead of BSEG.

It depends on what your program has to select (if you're only looking for customers

you can use BSID and BSAD etc.)

These are normal database tables, not clusters. Normally every record from BSEG

can be found back in one of these 6 tables and a program which selects data from

these tables runs faster than from BSEG.

Reward points if helpful

Thanks

Shambhu

Abap Gurus,

I am fetching belnr dmbtr buzei hkont from bseg

for all entries from one table say 'TAB'

where hkont = TAB-hkont

and koart = 'S'.

but in in the code inspector check it;s showing error

The message is

"Large table BSEG: No field of a table index in WHERE"

How to optimize a fetch from a larger cluster table BSEG

rewards if useful.

Thanks in advance

7 REPLIES 7
Read only

rainer_hbenthal
Active Contributor
0 Likes
1,865

Thats not an error, thats a warning, but a critical one from a performance point of view. The report will run, but because you dont use an index the database will use a table space scan resulting in very slow performance.

Create an index for fields in the where clause, but ask your database admins before, cause having a lot of indexes will slow the system down when isnerts or updates will take place very often.

Read only

Former Member
0 Likes
1,866

Hi,

Alternatives to Reading BSEG (Accounting Document Segment).

Since performance is an issue if reading data from BSEG table ( being a cluster table ), maybe you would

consider using the tables:

BSAD Accounting : Secondary Index for Customers (Cleared Items)

BSAK Accounting : Secondary Index for Vendors (Cleared Items)

BSAS Accounting : Secondary Index for G/L Accounts (Cleared Items)

BSID Accounting : Secondary Index for Customers

BSIK Accounting : Secondary Index for Vendors

BSIS Accounting : Secondary Index for G/L Accounts

instead of BSEG.

It depends on what your program has to select (if you're only looking for customers

you can use BSID and BSAD etc.)

These are normal database tables, not clusters. Normally every record from BSEG

can be found back in one of these 6 tables and a program which selects data from

these tables runs faster than from BSEG.

Reward points if helpful

Thanks

Shambhu

Read only

Former Member
0 Likes
1,865

If you know HKONT, the best way is doing a first select in BSIS and for each selected row do a SELECT SINGLE in BSEG with all keys (if you don't have all necessary fields in BSIS). If you are also searching for cleared items, you must do also the same with BSAS.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,865

Look at these threads [SELECT FROM BSEG performance|https://www.sdn.sap.com/irj/sdn/directforumsearch?q=select%20from%20bseg%5e4%20performance&objid=c42&daterange=last90days&searchid=10363956&rankby=10001&start=0]

Regards

Read only

Former Member
0 Likes
1,865

which type of records comes in cancelled g/l accounts

how is it identified

Read only

Former Member
0 Likes
1,865

.

Read only

Former Member
0 Likes
1,865

Gowri ,

You are trying to fetch records from BSEG based on the GL A/C number. BSEG is a cluster table with keys BUKRS BELNR GJAHR BUZID. In your select you are not using any keys. SELECT s on cluster tables are always a matter of concern if you are not using the FULL KEY.

But if the functionality is like that, i will suggest you to use secondary index tables for deriving the data. One option is using logical database SDF. ( most FI programs like FBL3N uses it ). Or you will have to derive the logic for deriving the BSEG keys ( I guess you can at least use the BUKRS and GJAHR if not BELNR) .

Hope it explains.