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 improvement of Select Query

Former Member
0 Kudos

Hi All,

Please suggest me to fine tune below query with example. It is causing DUMP when I am executing it because of low memory..

select * from vbap into table it_vbap where vbeln = p_vbeln

or vgbel = p_vbeln

or vbeln = j_3avbfae-vbelv

or vgbel = j_3avbfae-vbelv

or vbeln = p_vgbel

or vgbel = p_vgbel.

Thanks in advance.

Regards,

Chandravadan

3 REPLIES 3

Former Member
0 Kudos

Check out this way...

declare 2 ranges it_vbeln and it_vgbel.

move values of p_vbeln, j_3avbfae-vbelv, p_vgbel to it_vbeln.

move values of p_vbeln, j_3avbfae-vbelv, p_vgbel to it_vgbel.

select * from vbap into table it_vbap

where vbeln in it_vbeln.

select * from vbap appending table it_vbap

where vbeln in it_vgbel.

former_member585060
Active Contributor
0 Kudos

Try this ,

Instead of * in below code fetch the specific fields you require.

SELECT * FROM vbap INTO TABLE it_vbap WHERE

vbeln IN (p_vbeln, j_3avbfae-vbelv, p_vgbel) OR

vgbel IN (p_vbeln, j_3avbfae-vbelv, p_vgbel).

ThomasZloch
Active Contributor
0 Kudos

Are you sure it duoms because of low memory? Looks more like a TIME_OUT to me, since you are selecting on the non-indexed field VBAP-VGBEL.

Analyze whether you can rather use table VBFA to quickly find the reference document.

Also, do you really need all fields from VBAP for further processing? If not, better declare table IT_VBAP with only the necessary fields and select using INTO CORRESPONDING FIELDS OF TABLE ... .

Thomas