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

Performance Issue While fetching from BSEG Table.

former_member196331
Active Contributor
0 Likes
1,365

Need Small information.

SELECT * INTO CORRESPONDING FIELDS OF TABLE it_bseg-debit FROM bseg WHERE shkzg EQ 'S' AND umskz EQ 'A' AND ebeln EQ i_ekko-ebeln.

The above Query i am Writing.Based on the Purchase order ebeln. I need to fetch the Data.
In Development the query is working fine, But in Quality Bseg is having much of data.So, performance is very slow.

In Where condition i mentioned ebeln. Actually i need to pass key fields. For getting key fields also, Again i need to write the query. May i know how could i reduce the time.
Po number wise i need to fetch data.

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
1,118

Use so called secondary indexes like BSIS/BSAS to read the data, then if some fields are missing you can then read BSEG with primary keys of RFBLG the actual db table. You could also consider using table EKBE to get invoice documents associated to Purchase Orders, filtering on BEWTP to restrict to thoze.

Regards,
Raymond

Read only

former_member196331
Active Contributor
0 Likes
1,118

Ok, I will check it, EKBE i was forgotton.

Read only

Former Member
0 Likes
1,118

Avoid using ''CORRESPONDING FIELDS OF..'' Instead

SELECT * FROM bseg INTO TABLE it_bseg-debit WHERE shkzg EQ 'S' AND umskz EQ 'A' AND ebeln EQ i_ekko-ebeln....

Also, to further enhance the performance use fields instead of 'Select *'

Furthermore you can use secondary indexes.

Read only

0 Likes
1,118

How can we use secondary indexed in my case. Can you explain.

Read only

1,118

It depends on the queries you need to do.

For example my table has the following fields:

KEY1

KEY2

KEY3

FIELD1

FIELD2

FIELD3

If I often need to do a query using FIELD1 and FIELD2, I have to create an index with those two fields.

Every time I do a select like this:

SELECT * FROM <TABLE> WHERE FIELD1 = .....

AND FIELD2 = .....

The index'll be used.

But also if I do:

SELECT * FROM <TABLE> WHERE FIELD1 = .....

The index'll be used partially.