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 table vbrp

Former Member
0 Kudos
269

Hi experts

I have writen a select query in z program but i am getting the prformance issue. The program is taking more than 40 min when execute the below select query. could anyone please give me the idea how to resolve this performance issue. can i replace with view.

select  vbrp~vbeln
            vbrp~posnr
           vbrk~fkdat
           vbrk~fksto
           vbrk~vbtyp
           vbrk~rfbsk
            vbrp~matnr
           vbrp~fkimg
           vbrp~werks
            vbrp~shkzg
     into table it_billcom
     from vbrk inner join vbrp "wb2_v_vbrk_vbrp2
      on vbrk~vbeln eq vbrp~vbeln
      for all entries in it_alv_output
        where vbrp~vbeln eq vbrk~vbeln

with regards

chandan_vigi

1 ACCEPTED SOLUTION

Former Member
0 Kudos
137

Hi Chandan,

I see that the ON CLAUSE and the WHERE CLAUSE are the same, since you are using FOR ALL ENTRIES against IT_ALV_OUTPUT, i presume that your SELECT WHERE CLAUSE must be more like VBRK~VBELN EQ IT_ALV_OUTPUT-VBELN?

Also, it is better to have a check if IT_ALV_OUTPUT is not initial before the WHERE CLAUSE.

Regards,

Chen

4 REPLIES 4

Former Member
0 Kudos
138

Hi Chandan,

I see that the ON CLAUSE and the WHERE CLAUSE are the same, since you are using FOR ALL ENTRIES against IT_ALV_OUTPUT, i presume that your SELECT WHERE CLAUSE must be more like VBRK~VBELN EQ IT_ALV_OUTPUT-VBELN?

Also, it is better to have a check if IT_ALV_OUTPUT is not initial before the WHERE CLAUSE.

Regards,

Chen

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Kudos
137

Hi Chandan,

>

> I see that the ON CLAUSE and the WHERE CLAUSE are the same, since you are using FOR ALL ENTRIES against IT_ALV_OUTPUT, i presume that your SELECT WHERE CLAUSE must be more like VBRK~VBELN EQ IT_ALV_OUTPUT-VBELN?

>

> Also, it is better to have a check if IT_ALV_OUTPUT is not initial before the WHERE CLAUSE.

>

> Regards,

> Chen

Chen is absolutely right. I would just fix his last sentence:

"it is necessary to have a check if IT_ALV_OUTPUT is not initial before the SELECT statement".

ravi_lanjewar
Contributor
0 Kudos
137

Hi,

1. In you SQL Where clause has not written correctly or incomplete.

2. Why are you using the join and for all entries togather ?

first used the for all entries on table vbrk using internal table it_alv_output

2nd used the for all entries on table vbrp using data read in table step 1.

Don't forget to check driver table internal table is not initial while apply the for all entries

Kind Rgds

Ravi Lanjewar

Former Member
0 Kudos
137

Hi,

1. correct your code as Chen KV suggested.

2. Dont use join or use item table(VBRP) in left side. ref below statment

select vbrp~vbeln

vbrp~posnr

vbrk~fkdat

vbrk~fksto

vbrk~vbtyp

vbrk~rfbsk

vbrp~matnr

vbrp~fkimg

vbrp~werks

vbrp~shkzg

into table it_billcom

from vbrp inner join vbrk

on vbrkvbeln eq vbrpvbeln