01-17-2017 6:03 AM
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.
01-17-2017 6:49 AM
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
01-17-2017 6:57 AM
01-17-2017 7:47 AM
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.
01-17-2017 7:59 AM
01-17-2017 8:50 AM
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.