Skip to Content
avatar image
Former Member

Select Query for VBRK table

Hi Expert,

Kindly help me to sort this problem,

I am having requirement where I have to pass kunnr from knvv to kunag-vbrk where vbtyp EQ 'M' or 'O',.

where after all entries with knvv , my select query taking much more time to fetch data from vbrk as I know that key field of vbrk is VBELN but for joining knvv I had use kunag.

My code

Kindly help.

Thanks & Regards.

3.JPG (27.1 kB)
2.JPG (23.9 kB)
1.JPG (25.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 26, 2015 at 06:51 AM

    HI Anand,

    You need to narrow your search conditions. Currently you have given condition on sales org only. KNVV will have massive set of data and condition on VKORG only will result into this only.

    Check with your functional consultant, whether its possible to put some more conditions on primary keys or not.

    Thanks,

    Swet

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2015 at 10:08 AM

    Did you not check Note 185530 - Performance: Customer developments in SD?

    Based on this you should query table VRKPA instead of VBRK when doing a select on customer from VBRK. It will definitely improve the runtime. Don't go for unnecessary secondary index creation. It might have adverse impact on the system.

    1. a) Search for invoices with customer number ("payer") (field VBRK-KUNRG):Incorrect:   SELECT FROM vbrk WHERE kunrg = ...

                           Correct:   SELECT FROM vrkpa WHERE kunde = ...    then SELECT FROM vbrk WHERE vbeln = vrkpa-vbeln

    R

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 26, 2015 at 07:08 AM

    Hi ,

    Try using the secondary index for the field KUNRG but,

    check if the switch is enabled.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2015 at 06:57 AM

    Thanks guys for your help,
    Issue is solved as functional given more filters based on FKDAT in VBRK table.
    Thanks & Regards.

    Select Query for VBRK table

    Add comment
    10|10000 characters needed characters exceeded