cancel
Showing results for 
Search instead for 
Did you mean: 

Seelct query time out for single region

Former Member
0 Kudos

Hi ,

I am currently facing a problem with a report .The problem is in a select query.The report runs successfully when it is run for only more than 1 state but when it is run for single state then it times out.The select query is as given below.

SELECT avbeln eposnr bvbtyp aerdat akunnr ckunnr d~regio

ewerks aernam dname1 afaksk b~cmgst

INTO TABLE t_block

FROM vbak AS a

INNER JOIN vbuk AS b

ON bvbeln = avbeln

INNER JOIN vbpa AS c

ON cvbeln = avbeln

INNER JOIN kna1 AS d

  • ON dkunnr = akunnr

ON dkunnr = ckunnr

INNER JOIN vbap AS e

ON evbeln = avbeln

WHERE a~faksk IN faksk

AND a~vkorg = vkorg

AND a~vtweg IN vtweg

AND a~spart IN spart

AND a~vkbur IN vkbur

AND a~vkgrp IN vkgrp

AND a~kunnr IN kunnr

AND a~ernam IN ernam

AND a~erdat IN erdat

AND a~vbeln IN vbeln

AND a~vbtyp IN vbtyp

AND b~spstg IN ('A','B','C')

AND ( b~fsstk NE space

OR b~cmgst NE space )

AND b~abstk NE 'C'

AND c~kunnr IN s_kunwe

AND c~parvw = 'WE'

AND d~regio IN s_regio.

Please let me know if you require any more information.

s_regio is the select option for state.Also I feel that for KUNNR the On conditon might cause soem problem becasue it does not involve key fields.

thanks,

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi ds,

separate the select in several selects. The inner join is not always the best solution.

take

data : ivbak type table of vbak,

...

field symbols : <xvbak>

select +++ into corresponding fields of table ivbuk

from vbuk

where

select +++ into corresponding fields of table ivbak

form vbak

for all entries in ivbuk

where vbeln eq ivbuk-vbeln ...

select ...

if you want to have one internal table then do it with a loop.

loop at ivbak assigning <xvbak>

read table ikna1 with key kunnr = <xvbak>-kunnr.

loop at ivbap whee vbeln = <xvbak>-vbeln.

itab..= vbak..

? move corresponding ?

append itab.

endloop.

endloop.

that will not cause a time-out.

if you want a verry quick program - use tables without heading lines and field symbols with loops with assigning.

It is more to write but the effect is verry good.

Hans

Hans