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: 

Alternative to BSEG

Former Member
0 Kudos

Hi

We are using BSEG table. The performance is very slow. Is there any other table to access or is there any way to improve the performance??. Kindly let me know ASAP.

Regards

11 REPLIES 11

Former Member
0 Kudos

Check:

BKPF BSIS BSAS BSAD

Ps: Reward points if helpful.

Former Member
0 Kudos

Hi Ramya,

Welcome to SDN !!!

The FI-GL table BSEG, which is one of our

biggest PR1 tables, is an example of a clustered table. At the database-level, there is no table

called BSEG, but instead RFBLG is being used for the BSEG data. Most of the fields known

in BSEG are not known in the database table RFBLG, but are compressed in a VARDATA

field of RFBLG. So tests in the WHERE clause of SELECTs agains BSEG are not used by

the database (e.g. lifnr = vendor account number, hkont = G/L account, kostl = cost center).

As a consequence, these tests are done after the facts similar to using the CHECK statement,

and as already said in tip 1, CHECK statements are worse than tests in the WHERE-clause.

Check this link also.

1) select with header information from bkpf

2) use secondary index tables

3) use logical data base e.g.: BRF

Regards,

Raj

Former Member
0 Kudos

Hi,

You can use bkpf.

Bseg is cluster table select data using all

keys.

what are the keys you are passing to select data ?

Regards,

Amole

0 Kudos

Hi,

Unless you have the complete primary key, it is always better to stay away from BSEG.. Please use the following Secondary Index tables instead,depending on your requirement.


BSID                           Accounting: Secondary Index for Customers(Open Items)  
BSIK                           Accounting: Secondary Index for Vendors    
BSIM                           Secondary Index, Documents for Material    
BSIS                           Accounting: Secondary Index for G/L Accounts
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)

Regards,

Suresh Datti

andreas_mann3
Active Contributor
0 Kudos

Hi,

or use a logical database (se36):

SDF,KDF,DDF or BRF

regards Andreas

Former Member
0 Kudos

There are ways to speed up the select on BSEG. But we really can't tell until we see the code you are using. Could you post it please?

Rob

0 Kudos

The select which I use is :

SELECT belnr

augbl

lifnr

shkzg

qbshb

wrbtr

sknto

gsber

INTO CORRESPONDING FIELDS OF TABLE paym_det1

FROM bseg

WHERE belnr NOT IN adv_no

AND augbl IN adv_no

AND lifnr NE space

AND bukrs = com_code.

In this select statement the performance is very slow. It takes more than 1 minute to select

Former Member
0 Kudos

Instead of "INTO CORRESPONDING FIELDS OF" use "INTO TABLE" as it would be more efficient like...

SELECT belnr

augbl

lifnr

shkzg

qbshb

wrbtr

sknto

gsber

INTO TABLE paym_det1

FROM bseg

WHERE belnr NOT IN adv_no

AND augbl IN adv_no

AND lifnr NE space

AND bukrs = com_code.

Ps: Reward points if helpful.

Former Member
0 Kudos

The analysis of your code shows 97% of time in Query Execution whereas the analysis of the code with

 belnr IN adv_no

shows 78.2% of time in Query Execution and total time of less than 3 seconds.

Using NOT IN in the query takes a lot of time in comparing with all the database records. Hence try to avoid using it.

Ps: Reward points if helpful.

0 Kudos

BSEG can be a very large table. The 'NOT' operator prevents the database from using the index past BUKRS. If you want to use BSEG, you have to find a way to select on equality (as Wenceslaus has suggested).

Since you also select where lifnr ne space, if you do know the value of lifnr, you could use BSIK and BSAK. These are secondary index tables for BKPF/BSEG and are indexed on lifnr.

Rob

Former Member
0 Kudos

Hi Ramya,

Try to use select with 'for all entries' statement.

By this way u fatch all data of bseg in one time from database then store that data in some internal table.

Now, U can use loop with where condition or read statement

to fatch data form that internal table.

This will improve ur performance.

Regards,

Digesh Panchal