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

Problem while selecting BELNR from BSEG

Former Member
0 Likes
908

Hi Experts,

I have a report performance problem while fetching BELNR from BSEG table.

I have to print latest BELNR from BSEG where BUZID = ‘M’ but at the time of execution of report, It is taking too much time (More that hour and sometimes it gets hanged).

I have also gone through the comments provided by experts for previous problems asked in this forum e.g. BSEG is a cluster table that is why data retrieval takes long time etc.

Can any one has any other idea or suggestion or any other way to solve this problem

Regards,

Neeraj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
848

Hi,

Try using the keys(BUKRS,BELNR,GJAHR,BUZEI) of the table BSEG in the where condition.

Generally the performance does improve if you utilize as many keys as possible in the where condition while selecting from a database table.

Thanks,

Sandeep.

6 REPLIES 6
Read only

Former Member
0 Likes
848

Hi neeraj,

1. One thing which can be done is to create a secondary index on BUZID field.

2. Also i assume that the select query is a simple one without any join.

regards,

amit m.

Read only

Former Member
0 Likes
848

Hi,

BSEG is basically clusture table.

Use relevenat table instead of that

BSAD

BSAK

BSAS

BSID

BSIK

BSIM

BSIP

BSIS

etc.

Reward if useful!

Read only

Former Member
0 Likes
849

Hi,

Try using the keys(BUKRS,BELNR,GJAHR,BUZEI) of the table BSEG in the where condition.

Generally the performance does improve if you utilize as many keys as possible in the where condition while selecting from a database table.

Thanks,

Sandeep.

Read only

Former Member
0 Likes
848

Hi,

1) Try to create an index on BUZID field

2) Don't use SELECT/ENDSELECT statement. Instead of that extract all the concerned entries from BSEG into an internal table :

select belnr from bseg appending table itab where buzid = 'M'.

then do this :

sort itab by belnr.

describe itab lines n.

read table itab index n.

Please reward if helpful.

Regards,

Nicolas.

Read only

che_eky
Active Contributor
0 Likes
848

Use a combination of Sandeep and Nicolas's suggestions.

Definately try to narrow the selection by BUKRS,BELNR,GJAHR,BUZEI and read the result into an internal table before sorting for latest BELNR.

Read only

Former Member
0 Likes
848

Well, BSEG is a cluster table, so you probably can't create a secondary index on it. I don't think there's much you can do here except run it in the bachground overnight when system load is light.

Rob