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: 

Performance Issue While fetching from BSEG Table.

former_member196331
Active Contributor
0 Kudos

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

raymond_giuseppi
Active Contributor

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

former_member196331
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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

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.