2011 May 06 6:02 AM
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
2011 May 06 6:45 AM
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
2011 May 06 6:45 AM
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
2011 May 06 8:29 AM
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".
2011 May 06 12:00 PM
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
2011 May 06 1:18 PM
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