Skip to Content

Performance Issue While fetching from BSEG Table.

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 17, 2017 at 06: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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17, 2017 at 06:57 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 17, 2017 at 07: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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Kali Charan

      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.