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: 

TIME_OUT error

Former Member
0 Kudos

The below select statement is causing time_out error.

SELECT vbeln t1vkorg t1kunnr t2~werks

INTO TABLE t_likp

FROM likp AS t1

INNER JOIN t001w AS t2

ON t1kunnr = t2kunnr

WHERE lfart IN s_lfart

AND t1~kunnr IN s_kunnr

AND wadat_ist IN s_budat

AND ( t2~werks = p_werks1

OR t2~werks = p_werks2 ).

There is one more select statement which is selecting kunnr and werks values into table t_t001w.

I think this error can be avoided by using for all entries in t_t001w.If not please correct me.

Please give me your valuable suggestions

6 REPLIES 6

valter_oliveira
Active Contributor
0 Kudos

The problem is that you are using "ON t1kunnr = t2kunnr", and T001W has not an index to kunnr. When you use INNER JOIN, try to link the tables by proper index like:

Also use t1~ prefix when refering to all LIKP table fields.


SELECT t1~vbeln t1~vkorg t1~kunnr t2~werks
  INTO TABLE t_likp
  FROM likp AS t1 INNER JOIN t001w AS t2
    ON t1~werks = t2~werks
 WHERE t1~lfart IN s_lfart
   AND t1~kunnr IN s_kunnr
   AND t1~wadat_ist IN s_budat
   AND ( t2~werks EQ p_werks1 OR t2~werks EQ p_werks2 ).

Regards,

Valter Oliveira.

ThomasZloch
Active Contributor
0 Kudos

Another serious problem is that you are selecting from the potentially very large table LIKP without providing key fields. "For all entries" will not help to resolve this. Maybe you can speed up the retrieval by using tables VAKPA and VBFA.

Thomas

0 Kudos

Hi Thomas,

VBFA is Sales doc flow table. Isn't it worse than LIKP? My guess

is its too huge to fetch and Join.

Cheers ,

Kothand

0 Kudos

VBFA is Sales doc flow table. Isn't it worse than LIKP? My guess is its too huge to fetch and Join

I don't agree ... the thing here is about using proper index (and with kunnr you can fetch data from VAKPA and then, with vbeln, you can fetch data from VBFA). The size of the table doesn't matter if you use it's primary (or any secondary) index.

Regards,

Valter Oliveira.

0 Kudos

Hi Valter,

Fine.

But VBFA does not seems to contain any secondary index. Its primary index also has 5 fields VBELV,POSNV,

VBELN,POSNN,VBTYP_N.. From where can we get all these

values?

If we have these values then we can try with this logic.

Is my understanding correct?

Cheers

Kothand

0 Kudos

Hi kotland.

From VAKPA you get VBELN, and this field you can use in VBFA-VBELV, and 'J' in vbtyp_n (get likp vbeln). Using VBELV and VBTYP_N makes a nice selection.

Regards,

Valter Oliveira.