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

Select Query for VBRK table

Former Member
0 Likes
2,038

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,697

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

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.

4 REPLIES 4
Read only

Former Member
0 Likes
1,698

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

Read only

0 Likes
1,697

Hi ,

Try using the secondary index for the field KUNRG but,

check if the switch is enabled.

Read only

Former Member
0 Likes
1,697

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

Read only

Former Member
0 Likes
1,697

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